{{ category | getCategoryTitle(categories) }}
- {%- for page in pages -%} - {%- if not page.data.parent or listChildren -%} - {% include "page-card.njk" %} - {%- endif -%} - {%- endfor -%} +{% set groupedPages = allPages | groupPages(categories, page) %} +{% for category, pages in groupedPages -%} + {% if groupedPages.meta.groupCount > 1 and pages.length > 0 %} ++ {% if pages.meta.url %}{{ pages.meta.title }} + {% else %} + {{ pages.meta.title }} + {% endif %} +
+ {% endif %} + {%- for page in pages -%} + {% include "page-card.njk" %} + {%- endfor -%} {%- endfor -%}
- {% if groupUrl | getCollectionItemFromUrl %}
+ {% if groupItem %}
{{ title or (tag | capitalize) }}
@@ -12,10 +15,8 @@
{% endif %}
-
- {% for page in collections[tag] | sort %}
- {% if not page.data.parent -%}
+ {% for page in children %}
{% include 'sidebar-link.njk' %}
- {%- endif %}
{% endfor %}
This kitten is as cute as he is playful. Bring him home today!
- 6 weeks old + 6 weeks old -
- How do you make holy water? -
- You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat. +
- How often do you update your courses? +
- A course is updated once there is a fundamental shift in the language or library’s underlying API. You can check our workshop list to see if a new version of a given course is on the schedule. You may also write to us as support@frontendmasters.com with suggestions for updates.
- How do you make holy water? -
- You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat. +
- Do you offer certificates of completion? +
- You can download certificates of completion from the Completed Courses list in your Learning Library. Click the diploma icon next to the course to download the certificate in light or dark mode. A link to your Public Profile is included on each certificate if you’ve created one. Public Profiles showcase your learning journey and are a fantastic way to share progress with friends, co-workers, or employers. Public Profiles are available to members with an active Frontend Masters subscription who have watched ten or more hours of content. Visit the Public Profile section in My Account to get started.
- How do you make holy water? -
- You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat. +
- Do you offer a free trial? +
-
+
We offer a free trial to first-time subscribers. You can find more about the trial here.
+We also have the following opportunities to learn for free:
+-
+
- The online bootcamp is a free, two-week curriculum to get you started with web development. +
- You can create a free account to gain access to five full courses for free. +
- How do you make holy water? -
- You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat. +
- Do you have discounts for students? +
- We are part of the GitHub Student Developer Pack, allowing students six months of free access to the entire platform.
- How do you make holy water? -
- You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat. +
- How do I cancel my plan? +
- You can cancel your Frontend Masters subscription by visiting the Subscription tab in your My Account area.
Frequently Asked Questions
We offer a free trial to first-time subscribers. You can find more about the trial here.
+We also have the following opportunities to learn for free:
+-
+
- The online bootcamp is a free, two-week curriculum to get you started with web development. +
- You can create a free account to gain access to five full courses for free. +
- How do you make holy water? -
- You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat. +
- How often do you update your courses? +
- A course is updated once there is a fundamental shift in the language or library’s underlying API. You can check our workshop list to see if a new version of a given course is on the schedule. You may also write to us as support@frontendmasters.com with suggestions for updates.
- How do you make holy water? -
- You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat. +
- Do you offer certificates of completion? +
- You can download certificates of completion from the Completed Courses list in your Learning Library. Click the diploma icon next to the course to download the certificate in light or dark mode. A link to your Public Profile is included on each certificate if you’ve created one. Public Profiles showcase your learning journey and are a fantastic way to share progress with friends, co-workers, or employers. Public Profiles are available to members with an active Frontend Masters subscription who have watched ten or more hours of content. Visit the Public Profile section in My Account to get started.
- How do you make holy water? -
- You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat. +
- Do you offer a free trial? +
-
+
We offer a free trial to first-time subscribers. You can find more about the trial here.
+We also have the following opportunities to learn for free:
+-
+
- The online bootcamp is a free, two-week curriculum to get you started with web development. +
- You can create a free account to gain access to five full courses for free. +
- How do you make holy water? -
- You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat. +
- Do you have discounts for students? +
- We are part of the GitHub Student Developer Pack, allowing students six months of free access to the entire platform.
- How do you make holy water? -
- You boil the hell out of it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat. +
- How do I cancel my plan? +
- You can cancel your Frontend Masters subscription by visiting the Subscription tab in your My Account area.
Kicked ass and chewed bubblegum
- Oct. 31st +## Comment Section +```html{.example} +Activity
+-
+
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis mollis nunc, vel tempor sem faucibus nec. Suspendisse potenti. Pellentesque lobortis pulvinar nulla non tempor. Interdum et malesuada fames ac ante ipsum primis in faucibus. +
-
+ ++
+ + Robert Fox + commented 32 min ago ++Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis mollis nunc, vel tempor sem faucibus nec.
+
+ -
+ ++
+ + Robert Fox + commented 32 min ago ++Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis mollis nunc, vel tempor sem faucibus nec.
+
+ -
+ ++
+ Leave Comment +
+
Kicked ass and chewed bubblegum
- Oct. 31st + +``` +## With Summary Components +```html{.example} +Monthly Activity
+Kicked ass and chewed bubblegum
- Oct. 31st + +Kicked ass and chewed bubblegum
- Oct. 31st + +
@@ -49,7 +47,7 @@ tags: e-commerce
-
-+
@@ -39,7 +37,7 @@ tags: e-commerce
--
@@ -219,7 +217,7 @@ tags: e-commerce
Wood fired, salt glaze
Delivered @@ -237,7 +235,7 @@ tags: e-commerce- +High quality Japanese Kutani-yaki ceramic-ware
Shipping Soon @@ -255,7 +253,7 @@ tags: e-commerce- +Koishiwara-yaki style with crystalline glaze
Out for Delivery diff --git a/docs/docs/patterns/ecommerce/product-list.md b/docs/docs/patterns/ecommerce/product-list.md index 0d37e670c..570b01f6b 100644 --- a/docs/docs/patterns/ecommerce/product-list.md +++ b/docs/docs/patterns/ecommerce/product-list.md @@ -1,8 +1,6 @@ --- title: Product Lists description: 'Let shoppers browse and compare products with detailed lists of the products in your store.' -parent: ecommerce -tags: e-commerce --- ## Simple Grid with Ratings @@ -11,7 +9,7 @@ tags: e-commerce -@@ -23,7 +21,7 @@ tags: e-commerce
-@@ -35,7 +33,7 @@ tags: e-commerce
-@@ -47,7 +45,7 @@ tags: e-commerce
-@@ -59,7 +57,7 @@ tags: e-commerce
--``` \ No newline at end of file +``` diff --git a/docs/docs/patterns/ecommerce/shopping-cart.md b/docs/docs/patterns/ecommerce/shopping-cart.md index 36766542a..61ccfb182 100644 --- a/docs/docs/patterns/ecommerce/shopping-cart.md +++ b/docs/docs/patterns/ecommerce/shopping-cart.md @@ -1,8 +1,6 @@ --- title: Shopping Cart description: 'Give shoppers an overview of selected items with shopping carts that let them edit items and proceed to checkout.' -parent: ecommerce -tags: e-commerce --- ## Two Columns with Summary Card @@ -14,7 +12,7 @@ tags: e-commerce@@ -71,7 +69,7 @@ tags: e-commerce
-@@ -83,7 +81,7 @@ tags: e-commerce
-@@ -362,7 +360,7 @@ tags: e-commerce
License diff --git a/docs/docs/patterns/ecommerce/product-preview.md b/docs/docs/patterns/ecommerce/product-preview.md index 33e508529..55e62233e 100644 --- a/docs/docs/patterns/ecommerce/product-preview.md +++ b/docs/docs/patterns/ecommerce/product-preview.md @@ -1,11 +1,9 @@ --- title: Product Preview description: 'Give shoppers a quick look at your products as they browse with modal previews.' -parent: ecommerce -tags: e-commerce icon: preview --- - + ## With Product Options ```html {.example} @@ -16,7 +14,7 @@ icon: preview-@@ -128,7 +126,7 @@ icon: preview
+About
The Champion® Crossbody Bag is crafted for the trendsetter. Its sleek silhouette, paired with a tonal branded adjustable sling strap, ensures you look effortlessly cool no matter where you go.
-Details
@@ -150,7 +148,7 @@ icon: preview- +- Add to Cart + Add to Cart View Full Details diff --git a/docs/docs/patterns/ecommerce/review.md b/docs/docs/patterns/ecommerce/review.md index dfdf4abf3..7ad6e8235 100644 --- a/docs/docs/patterns/ecommerce/review.md +++ b/docs/docs/patterns/ecommerce/review.md @@ -1,8 +1,6 @@ --- title: Product Reviews description: 'Help shoppers make informed decisions with ratings, reviews, and testimonials from your customers.' -parent: ecommerce -tags: e-commerce --- ## Multi column @@ -174,7 +172,7 @@ tags: e-commerce I recently purchased the Modern Sofa Couch, and I couldn't be happier with my decision! The process from ordering to delivery was smooth and hassle-free
@@ -190,7 +188,7 @@ tags: e-commerce- +The cushions are soft yet supportive, and the sectional layout gives plenty of space to stretch out. It’s perfect for movie nights or just lounging with a good book.
@@ -206,8 +204,8 @@ tags: e-commerce- +The leather is high quality, but it’s a little firmer than I thought. That said, after sitting on it for a while, it does soften up and feels more comfortable. It’s perfect if you’re looking for a more structured seating experience.
-@@ -32,7 +30,7 @@ tags: e-commerce
-@@ -50,7 +48,7 @@ tags: e-commerce
-@@ -205,12 +203,12 @@ tags: e-commerce
--+-``` --> \ No newline at end of file +``` --> diff --git a/docs/docs/resources/changelog.md b/docs/docs/resources/changelog.md index 0da89e80d..45c4b94fc 100644 --- a/docs/docs/resources/changelog.md +++ b/docs/docs/resources/changelog.md @@ -14,9 +14,21 @@ During the alpha period, things might break! We take breaking changes very serio ## Next -- Fixed `wa-pill` class for text fields +### Enhancements + +- Added `appearance` to [`AJ1 Low $170.00 @@ -230,7 +228,7 @@ tags: e-commerce alt="(Photograph by Hamed darzi)" />-+-``` \ No newline at end of file +``` diff --git a/docs/docs/patterns/information/paywall.md b/docs/docs/patterns/information/paywall.md index 690a3dfb7..5fc82b234 100644 --- a/docs/docs/patterns/information/paywall.md +++ b/docs/docs/patterns/information/paywall.md @@ -105,4 +105,4 @@ tags: informationThe Trails $35.00 @@ -245,12 +243,12 @@ tags: e-commerce--+diff --git a/docs/docs/patterns/information/index.njk b/docs/docs/patterns/information/index.njk index c6ae2f61e..4a95f49d4 100644 --- a/docs/docs/patterns/information/index.njk +++ b/docs/docs/patterns/information/index.njk @@ -1,26 +1,8 @@ --- title: Information description: '' -layout: page +parent: patterns +layout: overview +override:tags: [] +listChildren: true --- - -{% set infoPages = collections.information %} - -\ No newline at end of file +Outcast 2-pack $27.00 @@ -276,4 +274,4 @@ tags: e-commerce-``` \ No newline at end of file +``` diff --git a/docs/docs/patterns/ecommerce/store-navigation.md b/docs/docs/patterns/ecommerce/store-navigation.md index 3cfb62d10..4a9c32503 100644 --- a/docs/docs/patterns/ecommerce/store-navigation.md +++ b/docs/docs/patterns/ecommerce/store-navigation.md @@ -1,7 +1,6 @@ --- title: Store Navigation description: 'Help shoppers explore categories and find products with all of the links they need to navigate your store.' -parent: ecommerce unlisted: true --- @@ -82,4 +81,4 @@ unlisted: true -``` \ No newline at end of file +``` diff --git a/docs/docs/patterns/index.njk b/docs/docs/patterns/index.njk index 81f7ab1d8..ec87fb460 100644 --- a/docs/docs/patterns/index.njk +++ b/docs/docs/patterns/index.njk @@ -2,8 +2,6 @@ title: Patterns description: Patterns are reusable UI solutions to common design problems, ready to copy and paste into any project. layout: overview -categories: ["app", "e-commerce", "information"] -listChildren: true override:tags: [] --- @@ -12,7 +10,7 @@ override:tags: [] ## What's a Pattern? -A pattern is a code snippet composed of components, style utilities, and native HTML that you can copy and paste into any project that uses Web Awesome. +A pattern is a code snippet composed of components, style utilities, and native HTML that you can copy and paste into any project that uses Web Awesome. It's a chunk of a user interface, rather than a single component, that allows you to implement UI solutions without designing something from scratch. Patterns are designed according to proven usability practices so they're responsive, accessible, and cohesive out-of-the-box. Importantly, patterns don't handle business logic or functionality like form submissions, data processing, encryption, etc. It's up to you to implement the logic you need for your project. @@ -26,4 +24,4 @@ To use a pattern in your project, refer to each pattern's docs for a copyable co Because patterns use a combination of Web Awesome features, they work best when you have [native styles](/docs/native), [style utilities](/docs/utilities), and a [theme](/docs/themes) installed in addition to Web Awesome [components](/docs/components). Refer to the [Installation page](/docs/installation) to set up all of these features in your project. {% endmarkdown %} -- {%- for page in infoPages -%} - - - diff --git a/docs/docs/patterns/information/information.json b/docs/docs/patterns/information/information.json new file mode 100644 index 000000000..6612f3ac9 --- /dev/null +++ b/docs/docs/patterns/information/information.json @@ -0,0 +1,3 @@ +{ + "tags": ["information"] +} diff --git a/docs/docs/patterns/information/newsletter.md b/docs/docs/patterns/information/newsletter.md index a4339ee90..2476e9f2b 100644 --- a/docs/docs/patterns/information/newsletter.md +++ b/docs/docs/patterns/information/newsletter.md @@ -1,8 +1,6 @@ --- title: Newsletter description: 'Empower your customers to view past purchases and track upcoming orders with comprehensive order histories.' -parent: information -tags: information --- ## Newsletter signup @@ -62,4 +60,4 @@ For questions, Please contact us. Terms- - - - {%- endfor -%} - -- {% include "svgs/" + (page.data.icon or "thumbnail-placeholder") + ".njk" %} -- {{ page.data.title }} - {% if pageSubtitle -%} -{{ pageSubtitle }}- {%- endif %} -`](/docs/components/details) and [` `](/docs/components/card) and support for the [appearance utilities](/docs/utilities/appearance/) in the [` ` native styles](/docs/native/details). +- Added an `orange` scale to all color palettes +- Added the `.wa-cloak` utility to prevent FOUCE +- Added the `allDefined()` utility for awaiting component registration + +### Bugfixes + +- Specifying inherited CSS properties on `` now works as expected ([thanks Dennis!](https://github.com/shoelace-style/webawesome-alpha/discussions/203)) +- Fixed a bug in ` ` that made it hard to use with VueJS, Svelte, and many other frameworks +- Fixed the `wa-pill` class for text fields - Fixed `pill` style for ` ` elements - Fixed a bug in ` ` that prevented light dismiss from working when clicking immediately above the color picker dropdown +- Fixed a bug in ` ` that sometimes resulted in empty ` ` elements being output ## 3.0.0-alpha.11 diff --git a/docs/docs/themes/creating.md b/docs/docs/themes/creating.md index 618d7bead..a73484182 100644 --- a/docs/docs/themes/creating.md +++ b/docs/docs/themes/creating.md @@ -31,8 +31,7 @@ If you're customizing the default dark styles, scope your styles to the followin ```css .wa-dark, -.wa-invert, -:is(:host-context(.wa-dark)) { +.wa-invert { /* your custom styles here */ } ``` diff --git a/docs/docs/themes/index.njk b/docs/docs/themes/index.njk index 9c1753e0e..71331c483 100644 --- a/docs/docs/themes/index.njk +++ b/docs/docs/themes/index.njk @@ -1,13 +1,13 @@ --- title: Themes -description: Themes are collections of design tokens that thread through every Web Awesome component and pattern. +description: Themes are collections of design tokens that thread through every Web Awesome component and pattern. Themes play a crucial role in [customizing Web Awesome](/docs/customizing). layout: overview override:tags: [] forTag: theme categories: + tags: [other, pro] other: Free - pro: Pro ---@@ -30,7 +30,7 @@ In pre-made themes, we use a light color scheme by default. Additionally, styles may be scoped to the `:root` selector to be activated automatically. For pre-made themes, *all* custom properties are scoped to `:root`, the theme class, and `wa-light`. -Finally, we scope themes to `:host` and `:host-context()` to ensure the styles are applied to the shadow roots of custom elements. +Finally, we scope themes to `:host` to ensure the styles are applied to the shadow roots of custom elements. For example, the default theme is set up like this: @@ -44,8 +44,7 @@ For example, the default theme is set up like this: } .wa-dark, -.wa-invert, -:host-context(.wa-dark) { +.wa-invert { /* subset of CSS custom properties for a dark color scheme */ } ``` diff --git a/docs/docs/tokens/index.njk b/docs/docs/tokens/index.njk index 74337da3f..578b6524f 100644 --- a/docs/docs/tokens/index.njk +++ b/docs/docs/tokens/index.njk @@ -3,4 +3,5 @@ title: Design Tokens description: A theme is a collection of predefined CSS custom properties that control global styles from color to shadows. These custom properties thread through all Web Awesome components for a consistent look and feel. layout: overview override:tags: [] +categories: {tags: true} --- diff --git a/docs/docs/usage.md b/docs/docs/usage.md index aea75ebc4..651ade28e 100644 --- a/docs/docs/usage.md +++ b/docs/docs/usage.md @@ -8,6 +8,30 @@ Web Awesome components are just regular HTML elements, or [custom elements](http If you're new to custom elements, often referred to as "web components," this section will familiarize you with how to use them. +## Awaiting Registration + +Unlike traditional frameworks, custom elements don't have a centralized initialization phase. This means you need to verify that a custom element has been properly registered before attempting to interact with its properties or methods. + +You can use the [`customElements.whenDefined()`](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/whenDefined) method to ensure a specific component is ready: + +```ts +await customElements.whenDefined('wa-button'); + +//is ready to use! +const button = document.querySelector('wa-button'); +``` + +When working with multiple components, checking each one individually can become tedious. For convenience, Web Awesome provides the `allDefined()` function which automatically detects and waits for all Web Awesome components in the DOM to be initialized before resolving. + +```ts +import { allDefined } from '/dist/webawesome.js'; + +// Waits for all Web Awesome components in the DOM to be registered +await allDefined(); + +// All Web Awesome components on the page are ready! +``` + ## Attributes & Properties Many components have properties that can be set using attributes. For example, buttons accept a `size` attribute that maps to the `size` property which dictates the button's size. diff --git a/docs/docs/utilities/fouce.md b/docs/docs/utilities/fouce.md new file mode 100644 index 000000000..e80173065 --- /dev/null +++ b/docs/docs/utilities/fouce.md @@ -0,0 +1,32 @@ +--- +title: Reduce FOUCE +description: Utility to improve the loading experience by hiding non-prerendered custom elements until they are registered. +file: styles/utilities/fouce.css +icon: spinner +--- + +While convenient, autoloading can lead to a [Flash of Undefined Custom Elements](https://www.abeautifulsite.net/posts/flash-of-undefined-custom-elements/). +The [FOUCE style utility](/docs/utilities/fouce/#opting-in) (which is automatically applied if you use the [Web Awesome utilities](/docs/utilities/)) takes care of hiding custom elements until they and their contents have been registered, up to a maximum of two seconds. + +In many cases, this is not enough, and you may wish to hide a broader wrapper element or even the entire page until all WA elements within it have loaded. To do that, you can add the `wa-reduce-fouce` class to any element on the page or even apply it to the whole page by placing the class on the `` element. + +```html + + ... + +``` + +As soon as all elements are registered _or_ after two seconds have elapsed, the autoloader will show the page. The two-second timeout prevents blank screens from persisting on slow networks and pages that have errors. + +:::details Are you using Turbo in your app? + +If you're using [Turbo](https://turbo.hotwired.dev/) to serve a multi-page application (MPA) as a single page application (SPA), you might notice FOUCE when navigating from page to page. This is because Turbo renders the new page's content before the autoloader has a change to register new components. + +The following function acts as a middleware to ensure components are registered _before_ the page shows, eliminating FOUCE for page-to-page navigation with Turbo. + +```js +import { preventTurboFouce } from '/dist/webawesome.js'; + +preventTurboFouce(); +``` +::: diff --git a/docs/docs/utilities/fouce.njk b/docs/docs/utilities/fouce.njk deleted file mode 100644 index 23669b9dc..000000000 --- a/docs/docs/utilities/fouce.njk +++ /dev/null @@ -1,131 +0,0 @@ ---- -title: Reduce FOUCE -description: Utility to improve the loading experience by hiding non-prerendered custom elements until they are registered. -file: styles/utilities/fouce.css -icon: spinner ---- -{% markdown %} -No class is needed to use this utility, it will be applied automatically as long as it its CSS is included. - -Here is a comparison of the loading experience with and without this utility, -with a simulated slow loading time: - -{% endmarkdown %} - - - - Normal loading -- - -{% set sample_card %} - - - - - -- - With FOUCE reduction -- Refresh - - - - -{% endset %} - - -- - Mittens
- This kitten is as cute as he is playful. Bring him home today!
- 6 weeks old - ---More Info -- - - -- - -{% markdown %} -## How does it work? - -The utility consists of a timeout (`2s` by default) and a fade duration (`200ms` by default). -- If the element is _ready_ before the timeout, it will appear immediately. -- If it takes longer than _timeout_ + _fade_, it will fade in over the fade duration. -- If it takes somewhere between _timeout_ and _timeout_ + _fade_, you will get an interrupted fade. - -An element is considered ready when both of these are true: -1. Either It has been registered or has a `did-ssr` attribute (indicating it was pre-rendered) -2. If it’s a Web Awesome component, its contents are also ready - -## Customization - -You can use the following CSS variables to customize the behavior: - -| Variable | Description | Default | -| --- | --- | --- | -| `--wa-fouce-fade` | The transition duration for the fade effect. | `200ms` | -| `--wa-fouce-timeout` | The timeout after which elements will appear even if not registered | `2s` | - -The fade duration cannot be longer than the timeout. -This means that you can disable FOUCE reduction on an element by setting `--wa-fouce-timeout: 0s`. - -For example, if instead of `did-ssr` you used an `ssr` attribute to mark elements that were pre-rendered, you can do this to get them to appear immediately: - -```css -[ssr] { - --wa-fouce-timeout: 0s; -} -``` - -You can also opt-out from FOUCE reduction for an element and its contents by adding the `.wa-fouce-off` class to it. -Applying this class to the root element will disable the utility for the entire page. -{% endmarkdown %} diff --git a/docs/index.md b/docs/index.md index aa3d060f5..9ae2e8a82 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,8 +4,6 @@ description: Build better with Web Awesome, the open source library of web compo layout: page --- - -
@@ -57,7 +55,7 @@ icon: preview
@@ -66,7 +64,7 @@ icon: preview
@@ -161,4 +159,4 @@ icon: preview