Compare commits

...

609 Commits

Author SHA1 Message Date
Lea Verou
4316c2670a Improve theme remixing UI 2025-01-27 12:42:35 -05:00
Lindsay M
71c054d6e4 Use background-image for native select caret (#594) 2025-01-24 11:52:06 -05:00
Cory LaViska
e1bf5471bf Use native events when possible (#590)
* fix filename

* <wa-input> input + change (change not working)

* compose that horribly misleading change event

* use native blur/focus events

* update checkbox

* update color picker events

* update color picker events

* update radio group events

* update button events

* remove event options

* update select events

* update image comparer events

* update icon button events

* update slider events

* update rating events

* update radio events

* update switch event

* update textarea events

* update radio button events

* remove unused events

* cleanup

* fix react wrappers

* fix react events for real this time

* update changelog

* add note

* Update src/components/input/input.ts

Co-authored-by: Lea Verou <lea@verou.me>

* delete unused close event

* use same event type

* fix tests

* remove wa- from events in docs and examples

* fix comment

* Update docs/docs/resources/changelog.md

Co-authored-by: Lea Verou <lea@verou.me>

---------

Co-authored-by: Lea Verou <lea@verou.me>
2025-01-23 17:52:41 -05:00
Lea Verou
099edc5186 Implement wide page-level data 2025-01-22 13:25:29 -05:00
Lea Verou
e3560dcf98 Do not reflect default values
- Add `default` descriptor
- Do not reflect attributes when equal to their default value
- Patch getter return value to return default value when empty
- Use it in button `appearance`
2025-01-21 15:16:11 -05:00
Cory LaViska
f2bb2c84a0 fix nested tab groups (#576) 2025-01-21 12:54:38 -05:00
Cory LaViska
13b3342017 fix slot names (#577) 2025-01-21 12:52:41 -05:00
Cory LaViska
d1c1d689ce ensure fix works on backers website (#579) 2025-01-21 12:36:54 -05:00
Cory LaViska
44e5e37a2b 3.0.0-alpha.9 2025-01-17 10:40:54 -05:00
Cory LaViska
566aae927d fix typo 2025-01-17 10:39:18 -05:00
Lea Verou
7258c001a7 Demo for mixing and matching (#565) 2025-01-17 10:38:03 -05:00
Lea Verou
7a70940c6a Update changelog, remove .wa-callout from alpha 2025-01-16 18:27:47 -05:00
Lea Verou
45f4edc426 Fix #561 2025-01-16 16:50:28 -05:00
Lea Verou
da32015f27 Basic mixing and matching docs (#560) 2025-01-16 16:31:24 -05:00
Lea Verou
03d8238edb Add missing :state(blank) docs 2025-01-16 16:17:50 -05:00
Lindsay M
34f8744493 Fix missing mild palette doc and links (#557) 2025-01-16 16:09:52 -05:00
Lindsay M
fa3fe5f753 Theme files housekeeping, closes #519 (#552)
* Reorg Glossy theme

* Reorg Playful theme

* Remove redundant dark mode tokens
2025-01-16 16:09:28 -05:00
Lindsay M
fc6c7de1fd Fix contrast issues with Bright teal (#556) 2025-01-16 16:09:03 -05:00
Lea Verou
0037712549 Matter Ripple MVP (#558)
Co-authored-by: lindsaym-fa <dev@lindsaym.design>
2025-01-16 16:05:50 -05:00
Lea Verou
5301945bfa Filled inputs 2025-01-16 14:48:56 -05:00
Lea Verou
1298651dd8 Floating labels on select 2025-01-16 14:48:56 -05:00
Lea Verou
5f9695fde1 Floating labels on textarea 2025-01-16 14:48:56 -05:00
Lea Verou
2eb2597efe Floating labels for input 2025-01-16 14:48:56 -05:00
lindsaym-fa
431e82261b Initial floating label attempt 2025-01-16 14:48:56 -05:00
Lea Verou
df51149d0a Show contrast ratios in contrast pair tables 2025-01-16 13:18:26 -05:00
Lindsay M
fba0b11343 Add Matter theme (#547)
* Add Matter theme

* Add Matter to alpha build

* Add changelog

* Fix incorrect palette name

* Make loud fills darker in light mode
2025-01-16 12:08:51 -05:00
Lea Verou
3618e93490 Reintroduce --border-width and --border-radius, fixes #531 2025-01-16 10:36:03 -05:00
Lea Verou
cfa95307d1 Quick proof of concept contrast tests 2025-01-16 10:22:01 -05:00
Lea Verou
15344c2a2a Appease Turbo for the color scheme picker too, fixes #520 2025-01-16 10:15:52 -05:00
lindsaym-fa
3974aa5130 Decrease line height on swatches 2025-01-16 10:15:16 -05:00
lindsaym-fa
a6702ad6d2 Revise Color tokens doc and link to palettes 2025-01-16 10:15:16 -05:00
lindsaym-fa
ecf21adddc Fix punctuation 2025-01-16 10:15:16 -05:00
Lea Verou
52c24fc3b7 Add color palette to theme pages 2025-01-16 10:15:16 -05:00
Lea Verou
d464714d7b Rudimentary palette icons 2025-01-16 10:15:16 -05:00
Lea Verou
7d089bbe2f Palette Docs 2025-01-16 10:15:16 -05:00
Lea Verou
71914afc91 defaultPalette -> palette 2025-01-16 10:15:16 -05:00
Lindsay M
9d139e3fa0 Minor style update for checkboxes in wa-tree-item (#542)
* Use theme value line height for tree item checkbox

* Apply theme checkbox styles to selected tree items
2025-01-16 09:30:35 -05:00
Lindsay M
db3039e9fe Fix green-40 in classic color palette (#548) 2025-01-16 09:26:06 -05:00
Lindsay M
9494b9bb67 Improve default tooltip styles (#543)
* Use inverted colors for tooltips

* Remove redundant tooltip overrides from themes
2025-01-16 04:35:08 -05:00
Lea Verou
7e1f4f0351 Separate meaningful theme parts out (#526)
Co-authored-by: lindsaym-fa <dev@lindsaym.design>
2025-01-15 17:32:36 -05:00
Lindsay M
5ebe4f4d3e Finalize playful theme, closes #490 (#527)
* Finalize Playful theme

* Add changelog, add to alpha

* Add playful theme to alpha build

* Touchup and tweaks

* Tweak hover mix color in `wa-dark`

* Avoid transforming buttons in button groups

* Final touchup

---------

Co-authored-by: Lea Verou <lea@verou.me>
2025-01-15 17:13:48 -05:00
Lea Verou
dfb9d53a25 Checkbox improvements
- Added `part="control", fixes #529
- Removed wrapper div which is no longer needed
- Removed `form-control--has-hint` class which is no longer used anywhere
2025-01-15 15:03:58 -05:00
Lindsay M
c2c1a2ff5b Add missing Glossy and Premium themes to alpha build (#528) 2025-01-15 10:45:43 -05:00
Lindsay M
ac86c037a1 Finalize Glossy theme, closes #491 (#525)
* Initial glassy theme progress

* Add fallback to slider thumb box shadow

* Remove redundant `wa-dark` styles and refactor shadows

* Rename to 'Glossy' since it fits the vibe better
2025-01-14 18:44:31 -05:00
Lea Verou
6b07c9a040 Native callout (#513)
Co-authored-by: lindsaym-fa <dev@lindsaym.design>
2025-01-14 14:56:03 -05:00
Lea Verou
24a76f6a7c Color palette housekeeping (#523) 2025-01-14 14:54:34 -05:00
Lea Verou
89c0667e9c Improve maintainability of color docs 2025-01-14 14:44:30 -05:00
Lea Verou
434084ea4e Playful: refer to rudimentary palette 2025-01-14 14:32:39 -05:00
Lea Verou
1738c6345b Fix #514 for reals this time 2025-01-14 13:02:37 -05:00
Lea Verou
0ac7916a1b Attempt to fix #514 2025-01-14 13:02:37 -05:00
Lea Verou
e7979991e3 Update docs to lean into the "tokens" terminology in lieu of "properties"
Co-Authored-By: Lindsay M <126139086+lindsaym-fa@users.noreply.github.com>
2025-01-14 12:31:24 -05:00
Lea Verou
07f70098f8 Theming -> Design Tokens 2025-01-14 12:31:24 -05:00
Lindsay M
17146698db Finalize Premium theme, closes #489 (#510)
* Finalize Premium theme

* Improve theme compatibility of dark mode shadows

* Improve theme compatibility of code examples

* Add comments

* Revert dark mode shadow color changes (to be addressed separately)

* Revert dark mode shadow color change

* Clean up redundant `wa-dark` properties
2025-01-14 11:56:30 -05:00
Lea Verou
bf852b1296 Fix #515 2025-01-14 11:29:36 -05:00
Lea Verou
e367c0ef29 Open sidebar group on overview pages, fixes #507 2025-01-14 10:20:04 -05:00
Lea Verou
01210ef364 Implement .wa-invert, closes #497 (#508) 2025-01-14 10:04:27 -05:00
Lea Verou
40648e15fb Refactor: library.system.ts to export supported icons (#505) 2025-01-13 16:37:54 -05:00
Cory LaViska
ab67ecfad3 add native icon to search (#498) 2025-01-13 14:48:51 -05:00
Lea Verou
a07f6280a3 Themes category in docs (#477)
Co-authored-by: Lindsay M <126139086+lindsaym-fa@users.noreply.github.com>
Co-authored-by: lindsaym-fa <dev@lindsaym.design>
2025-01-13 13:14:12 -05:00
Lea Verou
6822b25772 Rewrite color scheme logic (#481)
- Minimize needless swaps
- Centralize logic
- Use an actual `<wa-select>` rather than hacking it with `<wa-dropdown>`
- Move shared includes to shared template
- Rewrite critical theme JS
- Refactor of theme picker code
- Utilize view transitions better and use them for color scheme too
- Do not store default value in localStorage
- Removed unused `*-wide` templates
- Fixed #482
2025-01-10 15:32:28 -05:00
Konnor Rogers
200188b0c3 properly report build failures (#485)
* properly report build failures

* prettier
2025-01-10 13:29:14 -05:00
Lea Verou
bc6fe95f13 npm run build:alpha:serve per @KonnorRogers suggestion 2025-01-10 13:13:01 -05:00
Lea Verou
3a33fa208a Add command for testing the build without having to push to Vercel 2025-01-10 13:13:01 -05:00
Lea Verou
3ec4e6de07 Fix build 2025-01-10 13:13:01 -05:00
Lea Verou
eb07dc1410 Use passthrough copy (#474) 2025-01-09 17:24:18 -05:00
Lindsay M
5bfeb8044e Theme showcase improvements (#480)
* Presentation improvements

* Change `-webkit-text-size-adjust` to supported value (`none` isn't a supported keyword on iOS)

* Try using `text-size-adjust`

* Throwing caution to the wind

* Give up on `text-size-adjust` and add 1-column view
2025-01-09 13:31:31 -05:00
lindsaym-fa
aa915c3e28 Doc revisions 2025-01-09 11:57:35 -05:00
Lea Verou
c79457a607 Attempt at better style isolation between themes
Still doesn't quite fix #475 but might be a nudge in the right direction.
2025-01-09 11:57:35 -05:00
Lea Verou
419f0610e4 Template-tweaks
- Move breadcrumbs to separate template
- Rename `beforeContent` to `header`
- Move breadcrumbs inside header
2025-01-09 02:26:01 -05:00
Cory LaViska
7ab5ca8640 3.0.0-alpha.8 2025-01-08 18:30:48 -05:00
Cory LaViska
c39faff936 update version (#473) 2025-01-08 18:17:31 -05:00
Lindsay M
6d31db57f6 Revise and add showcase to Themes doc (#456)
* Initial progress

* Make responsive

* quick fix to show theme name/description

* Small styling tweaks

* Documentation updates

* Revisions and improvements

* Avoid using static URLs 'cause that's ridiculous

---------

Co-authored-by: Cory LaViska <cory@abeautifulsite.net>
2025-01-08 17:33:09 -05:00
Lea Verou
21ed4f82b0 Improve UX of Layout section 2025-01-08 17:13:38 -05:00
Lea Verou
844e374a72 Fix #470 2025-01-08 16:23:34 -05:00
Lea Verou
e5f4c14608 Fix native select caret positioning, fixes #411 2025-01-08 15:58:33 -05:00
Lea Verou
1ad963f5ad wa-card styling fixes 2025-01-08 15:36:12 -05:00
Lea Verou
4476117932 Add default layout as a failsafe 2025-01-08 15:20:26 -05:00
Lindsay M
e52a7a5ce5 Pre-release theme touchup (#465)
* Fix themed card styles

* Improve lowered surface colors across themes
2025-01-08 15:04:27 -05:00
Lindsay M
fa66f4262d Fix mobile theme selector; fixes #440 (#446)
* Fix styling

* Fix mobile theme selector label
2025-01-08 15:01:20 -05:00
Lea Verou
a87f3627bb Fix #451 without changing logic/specificity 2025-01-08 15:00:45 -05:00
Cory LaViska
06e432589f change migration => tailspin (#463) 2025-01-08 13:59:27 -05:00
Cory LaViska
b4c4074ae1 fix mobile color picker bug (#462) 2025-01-08 13:49:57 -05:00
Lea Verou
19042fcca4 Decouple dark mode & theme, fixes #445 closes #385 (#457)
Co-authored-by: Lindsay M <126139086+lindsaym-fa@users.noreply.github.com>
2025-01-08 12:50:29 -05:00
Lea Verou
8541369ae1 Fix #437 regression (#458) 2025-01-08 12:33:19 -05:00
Kelsey Jackson
31cfdf5704 Fixed radio button styling regression (#443)
* fixed styling regression

* Import missing appearance utilities

* Fix up radio button theme styles

* tweaked based on feedback

---------

Co-authored-by: lindsaym-fa <dev@lindsaym.design>
2025-01-08 12:07:28 -05:00
Lindsay M
3511a60b93 Fix missing select styles, improve consistency (#450)
* Refactor for consistency, fix missing theme styles

* Remove unused custom properties from docs

* Add missing custom property to docs

* Add UI test case
2025-01-08 12:04:22 -05:00
Lindsay M
e55e091192 Fix caret color on slider tooltips (#448) 2025-01-08 12:03:16 -05:00
Lindsay M
09df23dff8 Use theme properties for color picker border (#449) 2025-01-08 10:02:18 -05:00
Lea Verou
f4a88c3b3a Harmonize updated() definitions
- Use proper type
- Use same argument name
- Ensure `super.updated()` is called
2025-01-07 17:39:56 -05:00
Cory LaViska
559efcd1d2 Fix switch's submitted value; fixes #409 (#442)
* fix switch's submitted value; fixes #409

* update tests
2025-01-07 17:01:27 -05:00
Lindsay M
e046015ed5 Theme cleanup (#414)
* formatting, docs tweaks

* FA theme cleanup

* Revert removal of `--wa-form-control-height-*`

* Classic theme cleanup

* Use consistent selectors for dark mode

* Clean slate for additional themes

* Retire depth stylesheets

* Move header styles for themer out of themes

* Missed instance of dark mode selector

* Migration theme cleanup

* Brutalist theme cleanup

* Changelog for new themes

* Playful theme cleanup

* Formatting

* Default theme update

* Add tests for form theming

* Fix test typo

* Change misnamed `multiplier` properties to `scale`

* Active theme cleanup

* Mellow theme cleanup

* Cleanup unused FA styles

* Glassy theme progress

* Add checked styles to glassy

* Fix typo

* Final FA theme cleanup

* Rename FA theme to 'Awesome', allow in alpha

* Final brutalist theme cleanup

* A few more brutalist tweaks

* One last brutalist tweak

* Final mellow theme cleanup

* Final Tailwind theme cleanup

* Final active theme cleanup

* Some classic theme cleanup

* Remove unused `--wa-form-control-height-*`

* Rename `--wa-form-control-resting-color` to `border-color`

* Touch up callout `appearance` styles

* Add more themes to alpha

* Add changelog for removal of `--wa-form-control-height-*`

* Clean up colors

* Final classic theme cleanup

* Add new themes to alpha build

* Re-add teal (used by Awesome theme)

* sync mobile/desktop theme pickers and don't dup IDs

* Remove `color/standard.css` (duplicates `/themes/default/color.css`)

* add view transition

* Add premium theme for later cleanup

* Accommodate new tag `appearance` styles

* Revise `--wa-form-control-height-*` changelog entry

Co-authored-by: Lea Verou <lea@verou.me>

* Improve `--wa-border-width-scale` description

Co-authored-by: Lea Verou <lea@verou.me>

* Better border docs

* Premium tweaks

---------

Co-authored-by: Cory LaViska <cory@abeautifulsite.net>
Co-authored-by: Lea Verou <lea@verou.me>
2025-01-07 15:41:57 -05:00
Lea Verou
44dbdd14cc Separate WebAwesomeFormAssociatedElement (and friends) into a separate file 2025-01-07 14:23:20 -05:00
lindsaym-fa
5e3fed605e Add changelog 2025-01-07 11:56:19 -05:00
Lea Verou
4b4f2247c5 [Tag] Add appearance, closes #435 2025-01-07 11:56:19 -05:00
Lea Verou
eca15dc7fc Revamp <wa-card> HTML & CSS, fix #431 (#433)
Co-authored-by: Cory LaViska <cory@abeautifulsite.net>
2025-01-07 10:12:32 -05:00
Lea Verou
eca444bbaa [Callout] Add appearance & size, closes #422 (#432)
Co-authored-by: lindsaym-fa <dev@lindsaym.design>
2025-01-07 09:38:28 -05:00
Lea Verou
f39308dbc5 Allow customization of outlined styles, fixes #412 (#426) 2025-01-06 17:35:57 -05:00
Lea Verou
fc84e1a50d Replace M form control height with size-dependent height (#425) 2025-01-06 17:10:11 -05:00
Lea Verou
ef7d47e2b9 [Docs] Move commonalities across blocks to a single base layout (#424) 2025-01-06 17:01:29 -05:00
Lea Verou
a9af3172ad Rename Range to Slider (#428) 2025-01-06 16:44:43 -05:00
konnorrogers
cde8bea97a test commit 2025-01-06 13:24:54 -05:00
Kelsey Jackson
33b4045dad tweaked the tag component (#407)
* tweaked the tag component

* updated based on feedback

* updated to remove span

* changed display to initial

* prettier

---------

Co-authored-by: Konnor Rogers <konnor5456@gmail.com>
2025-01-06 13:23:47 -05:00
Cory LaViska
bc4ad39f2e Fix tests (#410)
* skip broken test

* add middleware to follow new stylesheet imports

* fix avatar tests

* update badge tests

* fix button tests

* skip carousel test

* fix checkbox tests

* fix details test

* update radio button tests

* fix input tests

* fix progress bar tests

* update

* fix range tests

* fix select tests

* restore wrapper div to pass a11y tests

* fix switch tests

* fix tag tests

* fix textarea tests

* fix tooltip tests

* skips

* fix tree item tests

* [DRAFT]: test fixes (#421)

* working on some stuff..

* add a small delay for menu-item

* prettier

* add a small delay for menu-item

* prettier

* add a small delay for menu-item

* add a small delay for menu-item

* add a small delay for menu-item

* prettier

* Empty commit

* add a small delay for menu-item

* always build with alpha

* always build with alpha

* move to alpha builds

---------

Co-authored-by: Konnor Rogers <konnor5456@gmail.com>
2025-01-06 13:13:34 -05:00
Konnor Rogers
b868b1e8fc fix alpha builds (#423)
* fix alpha builds

* Update docs/_includes/sidebar-group.njk

Co-authored-by: Lea Verou <lea@verou.me>

* Update docs/_includes/sidebar-group.njk

Co-authored-by: Lea Verou <lea@verou.me>

---------

Co-authored-by: Lea Verou <lea@verou.me>
2025-01-06 12:53:47 -05:00
Lea Verou
e916d771b0 Ensure --box-shadow & --border-width defaults are always set on the root stylable element, fixes #419 2025-01-06 12:41:28 -05:00
lindsaym-fa
bd6fe74c7d Fix missing input value styles 2025-01-04 16:42:45 -05:00
Lea Verou
ac7437894a Automate all overviews, fix bugs with filtering 2025-01-03 20:17:19 -05:00
Lea Verou
55ebe6e20b Add e-commerce tag, for overview 2025-01-03 20:14:51 -05:00
Lea Verou
e6388e7671 Let sort filter provide missing values so we can specify large values to place elements at the end 2025-01-03 19:20:49 -05:00
Lea Verou
9a21ae6f52 Make sure unlisted page cards never show up 2025-01-03 19:02:31 -05:00
Lea Verou
cd3386ce78 Exclude unlisted pages properly 2025-01-03 18:51:16 -05:00
Lea Verou
26b9bbb515 Automate Theming listing 2025-01-03 18:44:11 -05:00
Lea Verou
bda0ec0313 Overviews don't need to be MD files
And having them as MD files can insert pointless `<p>` tags if we're not careful, which can cause weird bugs.
2025-01-03 18:27:07 -05:00
Lea Verou
2490fbeaca attr filter for nicer optional attributes 2025-01-03 18:12:41 -05:00
Lea Verou
297149021e Add {% markdown %} paired shortcode 2025-01-03 17:45:26 -05:00
Lea Verou
c700c3ec09 Components index doesn't actually need to be a MD file
And having it as a MD file can insert pointless `<p>` tags if we're not careful, which can cause weird bugs.
2025-01-03 16:13:02 -05:00
Lea Verou
b383d8bf2d Move e-commerce patterns under E-commerce
As discussed on Slack with @kelseythejackson
2025-01-03 16:08:24 -05:00
Lea Verou
1dcf895be1 Don’t render children on the top level as well 2025-01-03 16:00:36 -05:00
Lea Verou
19fd55ca97 fix: noAlpha, not isAlpha 2025-01-03 15:58:42 -05:00
Lea Verou
fa094d924d Automate sidebar listings 2025-01-03 15:52:58 -05:00
Lea Verou
2a957e6316 Add layout and isAlpha to pattern pages automatically 2025-01-03 15:52:27 -05:00
Lea Verou
90b6a9a8ac Add status as computed data on component pages 2025-01-03 15:02:36 -05:00
Lea Verou
99fdd90601 [Select] Remove leftover code
The select uses the appearance utils, so this is done automatically.
2025-01-03 14:23:09 -05:00
Lea Verou
ecaa461638 [Select] Remove leftover code, rel #413
This was meant to be deleted, since there’s already `min-height: var(--wa-form-control-height);` above it which already responds to size.
2025-01-03 14:14:39 -05:00
lindsaym-fa
d3a65ee35d Fix typo 2025-01-03 09:37:39 -05:00
lindsaym-fa
8ab1489cc4 Simplify shadow scales 2025-01-02 15:59:04 -05:00
lindsaym-fa
093c42ce66 Revise changelog for border radius and width tokens 2025-01-02 15:50:09 -05:00
lindsaym-fa
ed3e7014e3 Simplify border radius scale 2025-01-02 15:37:09 -05:00
Cory LaViska
7db62766dc update changelog 2025-01-02 10:23:43 -05:00
Cory LaViska
2de515bce7 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2025-01-02 10:23:07 -05:00
Cory LaViska
80949c2988 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2025-01-02 10:23:05 -05:00
Konnor Rogers
c7a35afefb fix wa-split utility (#395) 2025-01-02 10:12:44 -05:00
Cory LaViska
89dd462720 backport SL-2318 2025-01-02 10:02:10 -05:00
Cory LaViska
ce40d5e997 Merge pull request #396 from shoelace-style/konnorrogers/fix-switch-checked-property
Fix switch dirty checking to behave like checkbox
2025-01-02 09:33:03 -05:00
Cory LaViska
752cbb2f16 Merge branch 'next' into konnorrogers/fix-switch-checked-property 2025-01-02 09:32:54 -05:00
Cory LaViska
2048df8a40 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2025-01-02 09:31:29 -05:00
Cory LaViska
beace5a611 backport SL-2329 2025-01-02 09:31:26 -05:00
Konnor Rogers
1a8908acf7 prettier 2024-12-23 16:39:32 -05:00
Konnor Rogers
812badd721 fix switch 2024-12-23 16:39:16 -05:00
Lea Verou
8142da95d8 Update sidebar.njk 2024-12-23 02:20:39 -05:00
Lea Verou
546c9c67b4 Hide cheatsheet from components sidebar 2024-12-23 02:18:59 -05:00
Lea Verou
d5fe23ab39 Add missing icons 2024-12-23 02:17:39 -05:00
Lea Verou
3b10933151 Automate listing in components index page 2024-12-23 02:15:48 -05:00
Lea Verou
51a416718d sidebar should be using components tag 2024-12-23 02:15:25 -05:00
Lea Verou
08f327c224 [docs.css] Remove duplicate code, use CSS nesting for .index.grid 2024-12-23 01:58:10 -05:00
Konnor Rogers
b196ccc0bc Merge pull request #394 from shoelace-style/next
next -> alpha
2024-12-22 06:14:28 -05:00
Konnor Rogers
c62eed16aa fix missing components and format number (#393) 2024-12-22 06:12:44 -05:00
Lea Verou
e982c10987 Move grouping logic to separate subtemplate and use it on layout too 2024-12-20 18:29:28 -05:00
Lea Verou
23af07bcd5 Temp fix for spacing issue 2024-12-20 17:49:44 -05:00
Lea Verou
6aca515024 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-20 17:44:12 -05:00
Lea Verou
7d3f8b175c Separate native styles page for elements that correspond to a separate WA component 2024-12-20 17:44:10 -05:00
Cory LaViska
e2acfd106f fix padding in codepen examples 2024-12-20 15:39:30 -05:00
Cory LaViska
cfd282df4b update version 2024-12-20 14:05:02 -05:00
Cory LaViska
d0567c7ae9 3.0.0-alpha.7 2024-12-20 14:04:13 -05:00
Lea Verou
f076dd1afa Usage -> Installation 2024-12-20 14:02:35 -05:00
Lea Verou
83fb761d41 Rename applied.css to docs and add some docs on usage 2024-12-20 14:01:14 -05:00
Cory LaViska
fd337dd1ee not true anymore 2024-12-20 13:40:39 -05:00
Lea Verou
22883021e9 Fix typo 2024-12-20 13:37:10 -05:00
Lea Verou
02b72f991b Mark rounding utils as WIP and change title to Rounding 2024-12-20 13:32:40 -05:00
Lea Verou
84734a56b6 Add class names to utility class pages 2024-12-20 13:20:06 -05:00
Cory LaViska
c159964490 update changelog 2024-12-20 13:17:22 -05:00
Cory LaViska
5c8e044f4d 3.0.0-alpha.6 2024-12-20 13:16:45 -05:00
Lea Verou
a238880dbe Allow utilities to have statuses too 2024-12-20 13:14:37 -05:00
Lea Verou
307c989e3b Add examples for native buttons in button group 2024-12-20 13:06:17 -05:00
Cory LaViska
c33d17b4a2 fix search styles 2024-12-20 12:59:58 -05:00
lindsaym-fa
9d3e2bd214 Fix giant homepage icons (#380) 2024-12-20 12:46:30 -05:00
Lea Verou
6e99787425 Add properties for border-radius overrides and use them to fix #348 in a better way, also closes #379 and improves #374 2024-12-20 12:26:47 -05:00
Lea Verou
43a1179513 Automate layout page listing 2024-12-20 12:00:43 -05:00
Lea Verou
8887056651 If you say pill, we should assume you really mean it :P Fixes #378 2024-12-20 11:44:29 -05:00
Lea Verou
ec3251d0c6 Utilities index pages 2024-12-20 11:37:15 -05:00
Lea Verou
f5ac87c8a3 Cards for native styles 2024-12-20 11:22:21 -05:00
Lea Verou
a3d8f712ce Remove visually-hidden component, add its icon to the util 2024-12-20 11:22:21 -05:00
Cory LaViska
0fdf4e0f4d Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-20 11:19:05 -05:00
Lea Verou
013cf46be8 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-20 11:10:59 -05:00
Lea Verou
cbd74eded2 Native <progress> styles 2024-12-20 11:10:57 -05:00
lindsaym-fa
960c6d8da3 Add descriptions for utilities 2024-12-20 11:07:51 -05:00
Cory LaViska
ef81c77c60 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-20 11:05:43 -05:00
Cory LaViska
01918ca784 fix button alignment in button groups 2024-12-20 11:05:32 -05:00
Lea Verou
b0bb014167 Statuses 2024-12-20 10:58:45 -05:00
Lea Verou
9f12c1d9ab Temp workaround for #376 2024-12-20 10:55:53 -05:00
lindsaym-fa
4456a8df5c Add descriptions for native styles 2024-12-20 10:36:22 -05:00
Cory LaViska
8e7816f308 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-20 10:33:12 -05:00
Cory LaViska
3861041bc1 fixes #350 2024-12-20 10:33:10 -05:00
Lea Verou
e29ae5d18e No, button groups shouldn't wrap 2024-12-20 10:15:29 -05:00
Cory LaViska
6ef2e92923 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-20 10:07:30 -05:00
Cory LaViska
562fec9ac7 fix component section in alpha 2024-12-20 10:07:27 -05:00
Cory LaViska
b38568f5c5 fix dropdown examples 2024-12-20 10:07:19 -05:00
Lea Verou
c0012f5b94 Fix dropdown in button-group rounding, closes #348 2024-12-20 10:03:03 -05:00
lindsaym-fa
41ee75bbfe Fix capitalization 2024-12-20 09:45:23 -05:00
Lea Verou
54f7916ddb Simplify progress bar CSS & DOM (still doesn't fix the transition in Safari but working on it) 2024-12-20 08:41:14 -05:00
Konnor Rogers
e170b488ea fix label position docs (#371) 2024-12-19 22:08:53 -05:00
Lea Verou
cd172ede8c Docs for visually hidden util, remove visually hidden component per #232 2024-12-19 21:15:33 -05:00
Konnor Rogers
d1b38af039 fix textarea jank (#370)
* fix textarea jank

* prettier
2024-12-19 20:52:05 -05:00
Lea Verou
506fb2588b Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-19 19:49:13 -05:00
Lea Verou
123a8c331f Restrict what default slot things <wa-page> adds spacing to, related to #331 2024-12-19 19:49:11 -05:00
Lea Verou
1a1847eeb5 Update search dialog styles to new simpler structure, closes #331 2024-12-19 19:48:38 -05:00
Konnor Rogers
835326a2db fix delayed button loading (#369)
* fix delayed button loading

* fix delayed button loading
2024-12-19 19:13:08 -05:00
lindsaym-fa
1905ca9b77 Capitalize "Style Utilities" 2024-12-19 18:54:12 -05:00
lindsaym-fa
fc3688df97 Fix closable tab example (#363) 2024-12-19 17:55:57 -05:00
Lea Verou
107f074f99 Page utils & native styles 2024-12-19 17:34:32 -05:00
lindsaym-fa
5d3e58bde0 Fix #361 2024-12-19 16:58:06 -05:00
lindsaym-fa
f5b8f2257d Fix specificity of gap and align-items in layout utilities 2024-12-19 16:51:55 -05:00
Lea Verou
52c0fdf6de Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-19 16:37:57 -05:00
Lea Verou
c2c42f56ba Docs for size utils 2024-12-19 16:37:55 -05:00
lindsaym-fa
328d6989d9 Set default color for dark theme 2024-12-19 16:34:36 -05:00
lindsaym-fa
49465c9a1d Fix form control label margin 2024-12-19 16:26:06 -05:00
lindsaym-fa
394a028973 Consolidate native form styles 2024-12-19 15:58:31 -05:00
lindsaym-fa
431d23d420 Fix range disabled and focus styles 2024-12-19 15:46:30 -05:00
Lea Verou
c230a42053 Fix filename 2024-12-19 15:30:48 -05:00
Lea Verou
378f100729 Update changelog.md 2024-12-19 15:30:38 -05:00
Cory LaViska
87314f8864 Merge pull request #364 from shoelace-style/konnorrogers/fix-safari-placeholder
fix safari placeholder
2024-12-19 15:01:47 -05:00
konnorrogers
70a8fc6425 fix safari placeholder 2024-12-19 14:28:35 -05:00
Konnor Rogers
486b0649e0 fix code demo with empty slot (#360)
* fix code demo with empty slot

* prettier
2024-12-19 14:12:55 -05:00
Lea Verou
63a2367cc5 Docs for color and appearance variants 2024-12-19 14:04:15 -05:00
Lea Verou
995d0f2af4 First stab at variant utils docs 2024-12-19 13:50:12 -05:00
Lindsay M
874bb5cbf6 Fix missing input and textarea styles in Firefox and Safari (#339)
* initial fix

* fix disabled styles in all browsers

* simpler fix
2024-12-19 13:32:30 -05:00
Lea Verou
15495bd9bd Automate theming sidebar block 2024-12-19 13:05:59 -05:00
Cory LaViska
f4678e12c6 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-19 12:43:31 -05:00
Cory LaViska
2bf7ebbb71 fixes #343; fixes #341 2024-12-19 12:43:29 -05:00
Lea Verou
68e53a4ef1 Automatic util listing on sidebar 2024-12-19 12:40:04 -05:00
Lea Verou
0f0b9d50cd Move all utilities under /utilities/
Co-Authored-By: Lindsay M <126139086+lindsaym-fa@users.noreply.github.com>
2024-12-19 12:40:04 -05:00
Lea Verou
5d13583da7 Update sort filter to take multiple keys into account in order of priority, default to order, then title
And use `order` on Page
2024-12-19 12:40:04 -05:00
Lea Verou
f99f32d054 Refactor: sort filter 2024-12-19 12:40:04 -05:00
Lea Verou
39acaeba70 Refactor: move sort filter to filters.js 2024-12-19 12:40:04 -05:00
Cory LaViska
e87c725e07 fixes #344 2024-12-19 12:38:49 -05:00
Cory LaViska
31a3421709 fixes #332 2024-12-19 12:15:34 -05:00
Cory LaViska
5d1fb7c477 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-19 11:19:51 -05:00
Lea Verou
13e606c1cb Native color-picker styles 2024-12-19 10:16:23 -05:00
lindsaym-fa
42dd64f397 Fix layout and add description to Native Styles 2024-12-19 10:13:16 -05:00
Kelsey Jackson
53e87e4dcd Remove :required content styles for native elements
* fixed label ::after

* removed label styles
2024-12-19 10:00:39 -05:00
Lea Verou
dabaef3fab The big rename nobody wants to do :P 2024-12-19 04:03:44 -05:00
Lea Verou
d5939efc30 Refactor table styles
- Use hueless color tokens so it can be used with variants (and add example)
- Fix hover effect on zebra rows
- Reduce padding a bit
- Shorten utility class
- CSS nesting
2024-12-19 03:53:54 -05:00
Lea Verou
d345878de6 Remove *--disabled classes, use regular selectors 2024-12-19 03:24:18 -05:00
lindsaym-fa
609578ff30 Fix typo 2024-12-19 03:08:37 -05:00
lindsaym-fa
648137a964 Add native select styles and share with <wa-select> 2024-12-19 03:06:31 -05:00
Lea Verou
cd487bf8be Use :dir() in CSS rather than custom RTL classes 2024-12-19 02:17:55 -05:00
Lea Verou
239ddcf75d Simplify RTL handling with logical properties 2024-12-19 02:13:17 -05:00
Lea Verou
ad2e945e44 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-19 02:01:39 -05:00
Lea Verou
11f7adefc2 Remove no longer needed hasFocus in all but color-picker 2024-12-19 02:01:30 -05:00
lindsaym-fa
909986b520 Tweak checkbox styles 2024-12-19 01:44:52 -05:00
lindsaym-fa
8de5fc9580 *Actually* add radio styles 2024-12-19 01:44:28 -05:00
lindsaym-fa
197aedcc70 Add radio styles and share with <wa-radio> 2024-12-19 01:43:56 -05:00
Lea Verou
491533e09c Merge textarea & input styles
Also simplify textarea component DOM
2024-12-19 01:38:39 -05:00
Lea Verou
474d8d7c7b Remove wa-off 2024-12-19 01:38:07 -05:00
Lea Verou
8d83076ef2 Fix transition 2024-12-19 00:59:00 -05:00
Lea Verou
e69632ff60 [Input] Several improvements
- Simplify styles and DOM
- Add `.wa-text-field` utility class
- Eliminate `--border-color` (except when set by appearance utils), `--border-style`, `--border-radius`
2024-12-19 00:39:23 -05:00
Lea Verou
996fa6df57 Import appearance helpers in elements with newly acquired appearance attribute 2024-12-19 00:39:23 -05:00
Konnor Rogers
239782a7d8 add proper dependencies to wa-page (#337)
* add proper dependencies to wa-page

* add proper dependencies to wa-page
2024-12-18 23:40:14 -05:00
Konnor Rogers
7d3a629a1e fix host context selectors for unsupported browsers (#335)
* fix host context selectors

* fix textarea value being lost

* fix textarea

* fix example

* fix textarea value being lost
2024-12-18 23:27:50 -05:00
lindsaym-fa
067ae799fd Add native textarea styles and share with <wa-textarea> 2024-12-18 22:33:24 -05:00
Lea Verou
ea165cb477 Now that all sizeable form controls use the size util, simplify form-control.css 2024-12-18 21:42:55 -05:00
Lea Verou
d33b5c4870 [Switch] Simplify DOM & CSS 2024-12-18 21:33:52 -05:00
Lea Verou
96db264724 [Switch] Use size utils 2024-12-18 21:09:22 -05:00
Lea Verou
dda4575aa4 [color-picker] Use size util 2024-12-18 21:06:52 -05:00
Lea Verou
2322762cc6 [Input] Remove unnecessary classes, simplify DOM 2024-12-18 20:56:30 -05:00
Lea Verou
4a14eb3282 Calculate form control height in size util 2024-12-18 20:48:25 -05:00
Lea Verou
931faf911c Use size helper in input 2024-12-18 20:34:55 -05:00
Lea Verou
f4db1e37e0 No need for fallback any more 2024-12-18 20:34:45 -05:00
Lea Verou
833b7b1207 Update tag.css 2024-12-18 20:33:47 -05:00
Lea Verou
622ee91323 Fix tag glitch 2024-12-18 20:12:28 -05:00
Lea Verou
d206414825 Make size utils root-level so there's always a default value 2024-12-18 20:09:31 -05:00
Lea Verou
73d26ece05 Clean up CSS structure 2024-12-18 19:40:52 -05:00
Lea Verou
3b90a1cc31 Native slider! 2024-12-18 19:36:26 -05:00
Lea Verou
289ce105dc Fix build 2024-12-18 18:59:39 -05:00
Lea Verou
deb2752d35 Refactor range styles to prepare for native ranges 2024-12-18 18:58:21 -05:00
lindsaym-fa
df4393e033 Fix native label spacing 2024-12-18 18:09:58 -05:00
Konnor Rogers
cf34747701 fix layout demo and custom states support (#318)
* fix demo

* fix linting errors

* remove jinja, run prettier

* prettier
2024-12-18 17:08:38 -05:00
lindsaym-fa
ad467f0691 Add native details styles and share with <wa-details> 2024-12-18 17:02:25 -05:00
Kelsey Jackson
142403fe78 changed disply on label 2024-12-18 15:20:07 -06:00
Cory LaViska
60f2b9657b remove base from docs 2024-12-18 15:09:46 -05:00
Lea Verou
a41787d23a Remove opt-out class, add docs on opting out, closes #300 2024-12-18 14:18:30 -05:00
Lea Verou
252adbd830 filledappearance=filled rel #330 2024-12-18 14:18:30 -05:00
lindsaym-fa
c8db30fa0f Add native checkbox styles and share with <wa-checkbox> 2024-12-18 14:09:09 -05:00
Lea Verou
fa415005eb Rename tintedfilled 2024-12-18 13:11:40 -05:00
Cory LaViska
ba8046bff5 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-18 13:08:57 -05:00
Cory LaViska
948254dd29 remove SSR in dev mode 2024-12-18 13:08:55 -05:00
Lea Verou
82b799c1a4 Prettier 2024-12-18 13:05:08 -05:00
Lea Verou
358444bc1d Remove poorly working Prettier Jinja plugin 2024-12-18 13:02:27 -05:00
Lea Verou
dbab4ae645 Rename filledaccent (rel #330) 2024-12-18 12:58:06 -05:00
Lea Verou
f5ed55513b textplain (for appearance and utils) rel #330 2024-12-18 12:51:13 -05:00
Lea Verou
d6fb269381 Add reference to button essentials in button component and vice versa 2024-12-18 12:49:16 -05:00
Lea Verou
3734f9cea5 Essential Dialog docs
Essentials page for dialog
2024-12-18 11:15:52 -05:00
Lea Verou
5a058a8808 Revamp dialog styles, port to Essentials
Refactor dialog CSS

Add native dialog stub
2024-12-18 11:15:52 -05:00
Lea Verou
e2d99e3c86 Refactor: animateWithClass() 2024-12-18 11:15:52 -05:00
Lea Verou
e74edd8f68 Element description, just like components 2024-12-18 11:15:52 -05:00
Cory LaViska
d961203d17 fix styles 2024-12-18 11:06:13 -05:00
Lea Verou
be752371a6 Revert back to has any sibling 2024-12-17 18:41:46 -05:00
Lea Verou
af3b83318b Cross linking between Essentials and Components 2024-12-17 18:06:54 -05:00
Lea Verou
b0cd38e2c5 Tweak spacing to have more reasonable spacing for callout
cc @lindsaym-fa
2024-12-17 18:06:54 -05:00
Cory LaViska
0d8d718b7a Merge pull request #317 from shoelace-style/component-search
Add search filter to component index page
2024-12-17 16:49:01 -05:00
Lea Verou
54687046ab Use .wa-off-deep for deep opt-out
Rel #300
2024-12-17 16:40:45 -05:00
Lea Verou
22529870f4 Failed attempt to get Prettier to work with .njk files 2024-12-17 16:22:42 -05:00
Lea Verou
8aafea456d Flesh out Essentials pages a little (still heavily WIP) 2024-12-17 16:22:11 -05:00
Lea Verou
cfb70f2135 Remove invalid </input> 2024-12-17 15:54:22 -05:00
Lea Verou
1d02644996 [Essentials] Write index page 2024-12-17 15:53:33 -05:00
Lea Verou
312809a766 First stab at breaking down essentials into multiple pages
Co-Authored-By: Lindsay M <126139086+lindsaym-fa@users.noreply.github.com>
2024-12-17 15:17:25 -05:00
Lea Verou
5e221f6c3a Remove empty page 2024-12-17 14:50:17 -05:00
Lea Verou
232734563f Formatting 2024-12-17 14:47:24 -05:00
Cory LaViska
5cbc64ad4f fix link to size.css 2024-12-17 14:46:13 -05:00
Cory LaViska
35858e0549 ugh, modal 2024-12-17 14:46:08 -05:00
Cory LaViska
752b8d462e add empty state 2024-12-17 14:41:11 -05:00
Lea Verou
1da80bee80 Fix custom parents in breadcrumbs 2024-12-17 14:38:02 -05:00
Cory LaViska
315dd40734 add search filter 2024-12-17 14:27:33 -05:00
Lea Verou
5a82b7ad99 Remove BEM-style namespaces on class names (#316) 2024-12-17 13:46:39 -05:00
Cory LaViska
1a29875940 Merge pull request #315 from shoelace-style/konnorrogers/fix-component-reloading
fix component reloading
2024-12-17 13:27:23 -05:00
konnorrogers
be0631bd3e fix component reloading 2024-12-17 13:22:10 -05:00
Lea Verou
e882102aff Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-17 13:00:57 -05:00
Lea Verou
97c0470f13 First stab at breadcrumbs (no custom parents yet) 2024-12-17 13:00:55 -05:00
Cory LaViska
47badda35c Merge pull request #314 from shoelace-style/custom-states
Custom states
2024-12-17 12:20:10 -05:00
Cory LaViska
b2353ca9bd remove try/catch 2024-12-17 12:18:40 -05:00
Cory LaViska
65310be0b0 Merge branch 'next' into custom-states 2024-12-17 12:14:29 -05:00
Cory LaViska
ac9960c1f0 Merge pull request #296 from shoelace-style/konnorrogers/fix-turbo-2
Fix turbo caching on script tag
2024-12-17 12:13:57 -05:00
Cory LaViska
b9393068a7 Merge branch 'next' into custom-states 2024-12-17 12:13:32 -05:00
Cory LaViska
9c216f60ff Merge pull request #312 from shoelace-style/konnorrogers/remove-unnecessary-plugin
remove unnecessary plugin
2024-12-17 12:13:10 -05:00
Cory LaViska
ce65a49dbe Merge branch 'next' into konnorrogers/remove-unnecessary-plugin 2024-12-17 12:13:02 -05:00
Cory LaViska
e973b599aa add links; fixes #313 2024-12-17 12:10:11 -05:00
Cory LaViska
9979028d7e fix smooth scroll bug 2024-12-17 12:09:45 -05:00
Cory LaViska
d09ea4a73a add section for custom states 2024-12-17 12:09:36 -05:00
Lea Verou
1bf83499b0 Refactor: Move 11ty filters to separate file 2024-12-17 12:08:55 -05:00
lindsaym-fa
9c4e4a2280 Use appearance for alpha badge 😁 2024-12-17 11:57:32 -05:00
Cory LaViska
f8e61f72c4 fix typo 2024-12-17 11:53:30 -05:00
lindsaym-fa
d08b95378a Fix custom button styles 2024-12-17 11:50:50 -05:00
lindsaym-fa
c1153708f6 Fix link button appearance 2024-12-17 11:47:59 -05:00
Cory LaViska
d676c1b569 update changelog 2024-12-17 11:46:05 -05:00
Cory LaViska
77f50a4890 fix part name 2024-12-17 11:46:00 -05:00
Cory LaViska
24e2b47ff1 fix part name 2024-12-17 11:45:56 -05:00
Cory LaViska
651c38afbf use states instead of parts 2024-12-17 11:45:45 -05:00
Cory LaViska
2dec73b2c5 hoist internals and custom state methods to WebAwesomeElement 2024-12-17 11:43:51 -05:00
Cory LaViska
ad36ba5569 rename part 2024-12-17 11:34:18 -05:00
Cory LaViska
1855d1b809 update tests to use :state() 2024-12-17 11:30:19 -05:00
Cory LaViska
543fa3c85c update tests to check states 2024-12-17 11:30:07 -05:00
Cory LaViska
fe05300bdc use :state() 2024-12-17 11:29:59 -05:00
Cory LaViska
0eebf44292 move custom states 2024-12-17 11:29:47 -05:00
Cory LaViska
7c40243da3 add custom state types to wa form control 2024-12-17 11:26:33 -05:00
Cory LaViska
4a046684c8 add comments and fix hasCustomState 2024-12-17 11:22:49 -05:00
Lea Verou
49eeca1617 Update callout.css 2024-12-17 11:20:54 -05:00
Cory LaViska
88e2af266f update docs and tests 2024-12-17 11:18:43 -05:00
Cory LaViska
0bcc788752 remove data- attribute fallback for states 2024-12-17 11:13:20 -05:00
Cory LaViska
5d687f1aa0 add custom states to checkbox/radio 2024-12-17 11:12:40 -05:00
Cory LaViska
8fbd0b54e4 update changelog 2024-12-17 11:10:10 -05:00
Cory LaViska
37a1680a85 move states 2024-12-17 11:10:04 -05:00
Cory LaViska
2b0acca219 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-17 10:57:42 -05:00
Cory LaViska
5293f0fa63 downgrade esbuild 2024-12-17 10:57:23 -05:00
Lea Verou
7d52f00d8d Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-17 10:46:55 -05:00
Lea Verou
f8e367a5e7 Move size utils to style/utilities/ 2024-12-17 10:46:40 -05:00
Cory LaViska
b9541ba2e0 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-17 10:44:54 -05:00
Cory LaViska
25ee6ef1ad fix ts errors 2024-12-17 10:44:40 -05:00
Cory LaViska
45cb5598fc add update script and update non-breaking deps 2024-12-17 10:44:28 -05:00
Cory LaViska
a6bf9ea58c add terms 2024-12-17 10:44:11 -05:00
Lea Verou
1e1877c954 --content-color ➡️ --text-color
Harmonize with other properties for the same thing
2024-12-17 10:41:51 -05:00
Lea Verou
47c9f43954 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-17 10:39:52 -05:00
Lea Verou
2136fed4cb --label-color ➡️ --text-color
As we move towards using these helpers more widely, `--label-color` doesn't quite make sense
2024-12-17 10:39:47 -05:00
Cory LaViska
4b6baa93a6 remove AI note 2024-12-17 10:13:54 -05:00
Lea Verou
ef4cbd915d Tidy up 2024-12-17 04:31:46 -05:00
Lea Verou
d9b8fc6806 Prettier 2024-12-17 04:29:37 -05:00
Lea Verou
6bb6bcc538 Simplify tag
- Drop `base`, rel #207
- Use size helper
- Drop classes duplicating attributes
2024-12-17 04:27:32 -05:00
Lea Verou
e60a5032da Remove classes no longer needed 2024-12-17 04:07:45 -05:00
Lea Verou
a6b71e119c Use variant helper in tag & callout 2024-12-17 04:06:47 -05:00
Lea Verou
8e01281c12 Leftover 2024-12-17 04:01:24 -05:00
Lea Verou
a31de87882 [Avatar] Simplify HTML & CSS, drop base (rel #207) 2024-12-17 03:58:58 -05:00
Lea Verou
dbfaa4299f [Avatar] Drop BEM 2024-12-17 03:40:28 -05:00
Lea Verou
78432c41d8 Better appearance combinations 2024-12-17 03:22:31 -05:00
Lea Verou
0d003c0309 Fix build 2024-12-17 03:06:18 -05:00
Lea Verou
0a796d618f Badge appearances! 2024-12-17 03:04:44 -05:00
Lea Verou
84909930fb Simplify badge HTML & styles 2024-12-17 03:04:36 -05:00
Lea Verou
cbab3b09e5 Move appearance utils to separate file 2024-12-17 03:03:55 -05:00
Lea Verou
8a321951d3 Fix wording 2024-12-17 03:03:28 -05:00
Lea Verou
4852f5614f Use variant helper to simplify badge styles 2024-12-17 02:22:28 -05:00
Lea Verou
87621ef109 Rename variant color tokens to be wa- prefixed, since we specify them on :root too 2024-12-17 02:22:08 -05:00
Lea Verou
6a9c7dd2bc Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-17 02:03:06 -05:00
Lea Verou
1fb8088fc8 Essentials page for button 2024-12-17 02:03:01 -05:00
Lea Verou
27c58637eb Revamp button styles
- More style sharing between native buttons & button component
- Fix radio button styling
- Better ability to style button from the outside (without `::part(base)`)
- Orthogonal variant + appearance
2024-12-17 02:02:30 -05:00
Lea Verou
426a242d26 Define button-group util and use it in button-group and radio-group 2024-12-17 01:57:48 -05:00
Lea Verou
7a7a7abe78 Add size & variant utils to Applied CSS 2024-12-17 01:55:17 -05:00
Lea Verou
aade89b66e Remove unused class 2024-12-17 01:54:32 -05:00
Lea Verou
771a1559ef Fix typo 2024-12-16 22:08:38 -05:00
lindsaym-fa
74ae758819 Add native input styles and share with <wa-input> 2024-12-16 19:32:35 -05:00
Lea Verou
5e2081451d Add --space-smaller to size utility 2024-12-16 15:41:33 -05:00
Lea Verou
1ffdc19305 Add variants.css (not yet linked from anywhere) 2024-12-16 15:41:33 -05:00
Lea Verou
6996d17531 Replace font-size variable with 1em
Revert "Replace font-size variable with `1em`"

This reverts commit 1ac70f31abe2bab310bbfbdbb3aa5d4498c5648d.

Replace font-size vars with 1em when calculating form control height
2024-12-16 15:41:33 -05:00
Cory LaViska
1e3b93d579 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-16 14:38:25 -05:00
Cory LaViska
70fab26e6b empty styles for these components 2024-12-16 14:38:22 -05:00
konnorrogers
725fb1f013 remove unnecessary plugin 2024-12-16 14:05:29 -05:00
Lea Verou
6d4c8e5942 Simplify Classic theme using the new CSS files 2024-12-16 13:21:27 -05:00
Lea Verou
b6e0ca5d45 --*-multiplier to --*-scale
As discussed with @lindsaym-fa

Co-Authored-By: Lindsay M <126139086+lindsaym-fa@users.noreply.github.com>
2024-12-16 12:50:37 -05:00
Lea Verou
35571c1d4e Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-16 12:46:59 -05:00
Lea Verou
82a5aff8db Split default theme tokens into separate CSS files
As discussed with @lindsaym-fa last week. Hopefully this will eventually help reduce duplication across themes.

Co-Authored-By: Lindsay M <126139086+lindsaym-fa@users.noreply.github.com>
2024-12-16 12:46:57 -05:00
Cory LaViska
e74a30f62a prettier 2024-12-16 12:45:25 -05:00
Lindsay M
11d3a73f05 Add native button styles and share with <wa-button> (#310) 2024-12-16 12:18:45 -05:00
Lea Verou
9fefb6d65a [Native details] Refactor to use nesting and opt-out
Rel #300
2024-12-16 11:51:40 -05:00
Lea Verou
4b18c74b83 [Details] Add RTL example 2024-12-16 11:50:41 -05:00
Lea Verou
f739c6c143 Fix details tests 2024-12-16 11:17:58 -05:00
Lea Verou
9739aceb9f Fix select tests 2024-12-16 11:16:42 -05:00
Lea Verou
afde497a1a [Docs] Collapse "Components" by default, except when viewing a page in /components/ 2024-12-16 11:14:18 -05:00
Lea Verou
666f1e5d52 Fix #309 for reals this time 2024-12-16 11:13:07 -05:00
Lea Verou
1013e83032 [Details] Fix interactive elements in summary, closes #309 2024-12-16 11:10:13 -05:00
Lea Verou
b15d938c7e Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-16 10:49:09 -05:00
Lea Verou
c066c5f30b [Details] Revamp CSS, simplify part names
First component to use the `display: contents` trick discussed in #207
2024-12-16 10:48:56 -05:00
Cory LaViska
abbfd9b43d remove eslint from gh actions 2024-12-16 10:39:25 -05:00
Cory LaViska
ee0167a059 fix jsdoc 2024-12-16 10:29:46 -05:00
Lea Verou
f86c07bdab Automate component navigation 2024-12-16 09:42:24 -05:00
Lea Verou
699595496e [Page] CSS utilities: .wa-mobile-only and .wa-desktop-only 2024-12-16 07:55:28 -05:00
Lea Verou
fa42764a4b Automatically hide [data-toggle-nav] on desktop view 2024-12-16 07:53:35 -05:00
Lea Verou
15bbafd631 Fix typo 2024-12-16 07:44:01 -05:00
Lea Verou
9423178df5 Tweaks to <details> styles 2024-12-16 07:18:02 -05:00
Lea Verou
9260d35b4c Split Applied CSS out to make it easier to manage and share w/ components
As discussed with @lindsaym-fa
Still unsure about some of these (especially about whether blockquote & details should be separate) but I figured better go ahead and split and we can fine tune later

Co-Authored-By: Lindsay M <126139086+lindsaym-fa@users.noreply.github.com>
2024-12-16 06:55:01 -05:00
Lea Verou
10156a8218 Add log filter for easier debugging of templates 2024-12-16 06:27:25 -05:00
Lea Verou
d0574677c1 Fix a couple types that were throwing off the CEM 2024-12-14 20:29:29 -05:00
Lea Verou
7b0274a657 Refactor: Normalize order of alternatives 2024-12-14 19:51:04 -05:00
Lea Verou
325eaeb225 [select] Mark getTag as attribute: false 2024-12-14 19:10:30 -05:00
Lea Verou
f840d623d5 We no longer need to highlight CSS in template strings 2024-12-14 18:53:56 -05:00
Lea Verou
f9590195a5 Refactor: Revamp select styles
- Removed BEM-style naming (the shadow DOM gives you scoping already!)
- Use new size helper
- Organize styles to keep an element’s styles together, using nesting for modifiers
- Removed unused classes
2024-12-14 17:35:50 -05:00
Lea Verou
53eb0d8f30 Refactor: [textarea] Use size util 2024-12-14 17:12:22 -05:00
Lea Verou
b0c4c7263b Allow Prettier default for trailing commas, run Prettier on repo
per convo with @claviska
2024-12-14 17:10:26 -05:00
Lea Verou
b5d1a71f46 Simplify hint slots 2024-12-14 17:04:42 -05:00
Lea Verou
dd7b673328 Run Prettier on repo
Turns out `prettier-plugin-organize-imports` sorts imports differently than the old one so this will prevent spreading the change across multiple commits whenever we touch a file (and potentially introducing conflicts)
2024-12-14 17:01:35 -05:00
Lea Verou
9f0276f55e Introduce size shadow utils and use them with checkbox (more to come) 2024-12-14 16:34:53 -05:00
Lea Verou
15d250b103 Refactor: [select.css] more CSS nesting 2024-12-14 15:46:59 -05:00
Lea Verou
0c40579be4 Split visually hidden into a separate file that components can import 2024-12-14 15:30:51 -05:00
Lea Verou
f0f080a428 Refactor: [select, input] Use CSS Nesting 2024-12-13 19:20:54 -05:00
Lea Verou
54b511b709 Collapse weird pill rules duplicating values 2024-12-13 18:57:45 -05:00
Lea Verou
c50da3429b Refactor: Collapse 3 rules doing the same thing 2024-12-13 17:32:34 -05:00
Lea Verou
ad3cd289dd Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-13 17:17:48 -05:00
Lea Verou
b1fffc7df9 Refactor: checkbox
- Reduce class names by using `:has()`, native pseudo-classes, or `[part~=foo]` selectors
- Remove `hasFocus` property since it’s no longer needed
- Move the icon hiding logic to CSS
2024-12-13 17:17:45 -05:00
Lea Verou
587db10022 Refactor: reduce duplication in form-controls.css 2024-12-13 17:14:15 -05:00
Lea Verou
47294ad0ed Leftover help-text ➡️ hint 2024-12-13 17:09:23 -05:00
lindsaym-fa
28ebab868b remove busted links to old layout.css location 2024-12-13 15:03:25 -05:00
lindsaym-fa
07d15fd863 fix references to utility files 2024-12-13 14:43:43 -05:00
Lea Verou
2c9eb385fd Add note about Chrome bugfix
Also revert unintentional change, oops
2024-12-13 14:35:16 -05:00
Lea Verou
6d9f513f68 help-text ➡️ hint 2024-12-13 14:17:58 -05:00
Lea Verou
4b56a03144 Convert component shadow styles to CSS files too 2024-12-13 13:56:42 -05:00
Lea Verou
9c17d27af4 Big CSS Reorg Part 1 (#304) 2024-12-13 13:45:33 -05:00
Lea Verou
cc37a5c44b Delete unused tabbable.ts file 2024-12-13 10:56:13 -05:00
Lea Verou
9e6ee89585 Support any CSS length in mobile-breakpoint (#303)
Co-authored-by: Konnor Rogers <konnor5456@gmail.com>
2024-12-13 10:48:41 -05:00
Lea Verou
ea25de8040 Split CSS utility regions into separate files 2024-12-13 04:25:58 -05:00
Lea Verou
7bee00d706 Update package-lock.json 2024-12-13 04:25:28 -05:00
Lea Verou
6b9f064aeb Ooops, turns out prettier-plugin-organize-imports was not added 2024-12-13 04:16:32 -05:00
Lea Verou
e9377cf746 Apply display: flex to gap utils, closes #265 2024-12-13 03:50:22 -05:00
Lea Verou
35d2b7f12a Add tab-size: 4, closes #256 2024-12-13 03:45:48 -05:00
Lea Verou
922d7d9894 Remove <wa-visually-hidden>, closes #232 2024-12-13 03:42:09 -05:00
Lea Verou
24f5f3c4ca Enable light dismiss by default for <wa-drawer>
The docs seemed to be hinting that this is the case, and indeed it seems more reasonable.
2024-12-13 03:32:45 -05:00
Lea Verou
8358127992 Leftover work from removing ESLint 2024-12-13 03:14:41 -05:00
Lea Verou
67563b2bba Remove ESLint, add prettier-plugin-organize-imports
Per discussions with @claviska
2024-12-13 02:56:24 -05:00
Lea Verou
73e9e9ab3a More CSS refactor
cc @lindsaym-fa
2024-12-12 20:53:54 -05:00
Lea Verou
7ce393feb8 Slight refactor of page demo CSS
@lindsaym-fa I think I didn't break anything, but you might want to take a look
2024-12-12 20:42:19 -05:00
lindsaym-fa
b25e58b24b reinstate content flow rule 2024-12-12 16:13:39 -05:00
lindsaym-fa
cb0240c91d let navigation links close the navigation drawer 2024-12-12 16:00:04 -05:00
Lea Verou
16302c0130 Move component styles to use CSS files (#298) 2024-12-12 12:30:13 -05:00
Lea Verou
88f2f99290 Simplify how components specify their own shadow styles
Shared styles are now added in the base class, rather than having to be repeated in every component.
In the odd case a component does not want the shared styles, it can define a custom `styles` property of its own.
2024-12-11 21:21:30 -05:00
Lea Verou
36a397ddaa Split out mobile page styles
Now each `*.styles.ts` file has a single default export
2024-12-11 20:40:34 -05:00
Lea Verou
8fd897e348 [viewport-demo] Revert resize button 2024-12-11 16:22:42 -05:00
Lea Verou
adc76b4eb1 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-11 16:09:17 -05:00
Lea Verou
cbb4aa8be1 Fix <wa-viewport-demo> zooming in Safari & Firefox
Also some refactoring to use `updated()` rather than `handleXXX()` functions
2024-12-11 16:09:15 -05:00
lindsaym-fa
968930c543 improve responsiveness of media example page 2024-12-11 10:52:46 -05:00
lindsaym-fa
4be8a46cdd touch up media example page 2024-12-11 10:32:09 -05:00
Lea Verou
c02496ff02 Add warning 2024-12-11 10:06:19 -05:00
Lea Verou
4b8afb4bc3 Hide zoom/viewport readings when they are lying 2024-12-11 10:02:25 -05:00
Lea Verou
01aa2afc15 Move display: flex to shared rule 2024-12-11 02:11:56 -05:00
Lea Verou
4f3539cb43 Formatting 2024-12-11 01:59:26 -05:00
Lea Verou
260bd47030 Simplify selector 2024-12-11 01:54:27 -05:00
Konnor Rogers
f27c982962 keep previews 2024-12-10 22:47:26 -05:00
konnorrogers
19340adcfb fix turbo 2024-12-10 19:07:45 -05:00
konnorrogers
f22e598ad6 prettier 2024-12-10 18:52:12 -05:00
konnorrogers
68f693cbc0 fix turbo caching stuff 2024-12-10 18:49:56 -05:00
Lea Verou
2f6fe33e2c Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-10 18:18:22 -05:00
Lea Verou
c307cfde1c Re-enable zoom in Safari & FF
The way they do zooming is crap, but hey, at least you can now tweak it again
2024-12-10 18:18:20 -05:00
Cory LaViska
883ef50186 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-10 17:42:07 -05:00
Cory LaViska
c359556605 cleanup changelog 2024-12-10 17:41:51 -05:00
Lea Verou
3e18309367 Reorg page docs, light content editing 2024-12-10 15:34:14 -05:00
Cory LaViska
2fb0cc7d6d Merge branch 'next' into alpha 2024-12-10 15:27:19 -05:00
Lea Verou
26449e12e5 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-10 15:23:22 -05:00
Lea Verou
7058de0568 Convert preview scripts to modules when using a manually slotted preview 2024-12-10 15:23:16 -05:00
Cory LaViska
0c3438e1a5 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-10 15:21:04 -05:00
Cory LaViska
bae9b57c2a temp fix for page demo not showing when rendered with turbo 2024-12-10 15:21:01 -05:00
Lea Verou
739c45d34c Better proxy feature for detecting Chrome 2024-12-10 15:20:39 -05:00
Cory LaViska
32df4598fc fix default checked state 2024-12-10 14:59:09 -05:00
Cory LaViska
f52daeecdc Merge branch 'next' into alpha 2024-12-10 14:28:33 -05:00
Cory LaViska
930216e3f7 3.0.0-alpha.5 2024-12-10 14:27:49 -05:00
Lea Verou
8e40a082f5 Quick hack to disable zooming in Firefox and Safari 2024-12-10 14:14:27 -05:00
Konnor Rogers
e3fdf61e4a add layout toggling (#294)
* Add nav toggling

* fix comments

* fix comments

* prettier

* add comments / docs

* prettier

* fix up page stuff

* prettier

* Add comment

* minor fixes

* prettier
2024-12-10 13:53:08 -05:00
lindsaym-fa
414b29b046 tweak page demo styles 2024-12-10 12:58:28 -05:00
Lea Verou
ba4cdc9b28 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-10 11:54:04 -05:00
Lea Verou
99704faeb4 Page demo draft 2024-12-10 11:53:39 -05:00
lindsaym-fa
78c446f525 update layout anatomy image 2024-12-10 11:41:41 -05:00
lindsaym-fa
b50b4ca632 revise responsive section on widths 2024-12-10 11:24:34 -05:00
Lea Verou
21d84332e4 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-10 11:18:04 -05:00
Cory LaViska
c88a2c788d Merge pull request #291 from shoelace-style/konnorrogers/set-a-default-theme
Fix FOUC for default theme
2024-12-10 11:15:54 -05:00
konnorrogers
b1c459c226 fix fouc for default theme 2024-12-10 11:06:35 -05:00
Lea Verou
a8ddefe31e Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-10 10:30:27 -05:00
Lea Verou
80d23a4efe Fix code-demo expand animations on page load
Rn this means we don't get expand animations at all but that’s fine. I think it's fine to have an animation on close and not on open (different user goals — you open to get to the info, you close to get it out of the way, the opening is more urgent)
2024-12-10 10:29:55 -05:00
lindsaym-fa
5393a86e2b add descriptions for page examples 2024-12-10 10:19:12 -05:00
Lea Verou
1d822db30d Reapply "Fix missing content issue, closes #198"
This reverts commit 60c7c91e8a.

Also used a longer timeout
2024-12-10 10:14:20 -05:00
konnorrogers
654cd0b0bd set a default theme 2024-12-10 10:03:20 -05:00
Cory LaViska
6da942083c Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-10 09:54:39 -05:00
Cory LaViska
f15814c784 use callout markdown syntax 2024-12-10 09:54:37 -05:00
Lea Verou
60c7c91e8a Revert "Fix missing content issue, closes #198"
This reverts commit 22ca715ddb.
2024-12-10 09:52:29 -05:00
Cory LaViska
62cf254365 remove tooltips for now 2024-12-10 09:45:23 -05:00
Cory LaViska
747f185dc5 add labels to zoom buttons 2024-12-10 09:45:17 -05:00
Cory LaViska
1a61bd9583 fix outline spacing 2024-12-10 09:35:08 -05:00
Cory LaViska
7cff8fadde update tests 2024-12-10 09:26:58 -05:00
Cory LaViska
67abde6d97 Merge pull request #289 from shoelace-style/page-docs
Page documentation revisions
2024-12-10 09:23:09 -05:00
Cory LaViska
6e0b3d820c Merge pull request #288 from shoelace-style/callout
Simplify `<wa-callout>`
2024-12-10 08:57:31 -05:00
Cory LaViska
998180b05d Update docs/docs/components/callout.md 2024-12-10 08:57:24 -05:00
lindsaym-fa
ee9cc49956 Merge branch 'next' into page-docs 2024-12-10 05:01:06 -05:00
lindsaym-fa
3f79b35878 add media layout example 2024-12-10 05:00:44 -05:00
Lea Verou
fd3ec885f9 [viewport-demp] Parts for zoom buttons, zoom cursors 2024-12-10 04:50:36 -05:00
Lea Verou
22ca715ddb Fix missing content issue, closes #198 2024-12-10 04:45:13 -05:00
Lea Verou
5e6b8628d4 We don’t use Liquid! 2024-12-10 01:29:24 -05:00
lindsaym-fa
0a980addc3 remove duplicate heading, link Theming heading 2024-12-09 22:50:24 -05:00
lindsaym-fa
9bbfa1aeb2 add page card to components overview 2024-12-09 22:49:14 -05:00
lindsaym-fa
48fc9d9779 touch up header and sidebar spacing 2024-12-09 22:31:44 -05:00
lindsaym-fa
8ec8e2a9b4 Merge branch 'next' into page-docs 2024-12-09 21:56:09 -05:00
lindsaym-fa
5ec5979136 move styles to bottom of example code 2024-12-09 21:55:47 -05:00
Lea Verou
4926ad6ce5 Remove wa-callout::part(base) 2024-12-09 21:55:29 -05:00
lindsaym-fa
f013756b7b revise and edit docs 2024-12-09 21:46:52 -05:00
Lea Verou
feb092a7fa [code-examples] Smarter default for open 2024-12-09 21:41:54 -05:00
Lea Verou
406e899b34 Merge branch 'next' into page-docs 2024-12-09 21:03:42 -05:00
Lea Verou
4d89c344d1 [code-examples] Better syntax, do not include docs.css 2024-12-09 21:01:49 -05:00
Lea Verou
b9f484ceb6 data-viewport -> viewport 2024-12-09 21:01:27 -05:00
Lea Verou
1920ae8c1e Oops, commited debug code 2024-12-09 20:43:58 -05:00
lindsaym-fa
08422c29e7 Merge branch 'next' into page-docs 2024-12-09 20:29:49 -05:00
lindsaym-fa
59a70dd5b7 add documentation page demo 2024-12-09 20:29:16 -05:00
Lea Verou
86a80d3e78 [code-demo] Bugfixes
Slotted previews still don't work well with isolated demos :(
2024-12-09 20:27:23 -05:00
lindsaym-fa
1cebae7868 fix typo 2024-12-09 20:23:39 -05:00
Lea Verou
7b0ab1f7b7 Merge branch 'next' into page-docs 2024-12-09 19:42:03 -05:00
Lea Verou
1aebdf4a06 Fix isolated demos 2024-12-09 19:40:28 -05:00
Lea Verou
e94a424596 Simplify <wa-callout>
- Remove `base` (rel #207)
- Eliminate properties mirroring standard CSS properties (rel #259)
- Simplify markup
2024-12-09 19:32:55 -05:00
lindsaym-fa
14db763613 initial progress 2024-12-09 19:09:53 -05:00
Konnor Rogers
65ced601e9 fix various page issues (#286)
* fix dialog issues

* fix various page issues

* prettier
2024-12-09 19:00:16 -05:00
Lea Verou
2f0b259d96 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-09 18:43:17 -05:00
Lea Verou
8267dd91d9 Do not restrict what attributes are allowed in curlies
We're the only ones writing Markdown…
2024-12-09 18:43:14 -05:00
Cory LaViska
2149a1efde Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-09 17:56:12 -05:00
Cory LaViska
7990717a95 move selectors to sidebar on mobile 2024-12-09 17:56:10 -05:00
Konnor Rogers
4526effbfa fix footer / header dialog (#285) 2024-12-09 17:30:56 -05:00
Lea Verou
a8774b5c88 [code-demo] Fix Safari collapsing bug 2024-12-09 17:15:07 -05:00
Lea Verou
fbc5946e71 [viewport-demo] Beautiful, cursed hack to make the resizers visible in Safari 2024-12-09 16:37:07 -05:00
Lea Verou
0fbdf110b1 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-09 15:23:27 -05:00
Lea Verou
d37d873b4c More/better parts for *-demo components 2024-12-09 15:23:21 -05:00
Lea Verou
d5419ab0d0 [code-demo] Fix Safari bug with viewport emulation 2024-12-09 15:18:15 -05:00
lindsaym-fa
4805cdb64c update sample page metadata 2024-12-09 14:43:18 -05:00
Cory LaViska
5d74d8163b hide pro themes for alpha 2024-12-09 14:31:31 -05:00
Cory LaViska
76c74fc8a9 remove code-demo + viewport-demo from the alpha 2024-12-09 14:04:22 -05:00
Lea Verou
321f53f953 Add <wa-code-demo> and <wa-viewport-demo> and use them by default
Co-authored-by: Cory LaViska <cory@abeautifulsite.net>
2024-12-09 13:44:14 -05:00
Cory LaViska
849def9ef2 Merge pull request #284 from shoelace-style/konnorrogers/run-ssr-only-on-push-to-next
run ssr only on next push
2024-12-09 13:38:21 -05:00
konnorrogers
911668617b only on push 2024-12-09 13:35:31 -05:00
konnorrogers
d55e750ecd run ssr only on next push 2024-12-09 13:04:59 -05:00
Cory LaViska
08d6af502c Merge pull request #272 from shoelace-style/konnorrogers/set-outline-false-on-page
set outline false on page, add pattern.njk
2024-12-09 12:57:45 -05:00
Cory LaViska
9a68409ccd Merge branch 'next' into konnorrogers/set-outline-false-on-page 2024-12-09 12:56:40 -05:00
Cory LaViska
b8f4a38c80 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-09 12:15:41 -05:00
Cory LaViska
a86acc9717 remove pro/dev stuff from alpha release 2024-12-09 12:13:32 -05:00
lindsaym-fa
a1fc75689e fix outdated logo 2024-12-09 11:55:24 -05:00
Lea Verou
0a5e4ab99c Make sidebar headings links whenever an overview is available (#241) 2024-12-09 11:33:04 -05:00
Cory LaViska
fd8876b3c4 fix filename typop 2024-12-09 11:23:43 -05:00
Lindsay M
994cba2fcf Page spacing (#279)
* initial progress

* spruce up docs sample page

* clean up and organization

* revert extraneous addition to applied.css

* accidentally reverted the wrong change 😅

* take 2 - revert extraneous addition in applied.css

* more cleanup
2024-12-09 11:10:15 -05:00
lindsaym-fa
fb565d202e remove outline from 'page' layout 2024-12-09 10:54:52 -05:00
Lea Verou
adb655a53b Properties ➡️ Attributes & Properties 2024-12-09 10:44:03 -05:00
Konnor Rogers
2d19c5d915 fix dialog scroll locking (#282)
* fix dialog scroll locking

* add changelog entry
2024-12-06 17:26:03 -05:00
Cory LaViska
ff0e00e4e4 Merge pull request #277 from shoelace-style/konnorrogers/fix-dialog-show
Fix calling `.show()`
2024-12-06 12:57:17 -05:00
Cory LaViska
1ea76cc08a fix padding and newlines 2024-12-06 10:45:13 -05:00
Cory LaViska
786b3c3da2 add layout and utilities to codepen 2024-12-06 10:36:30 -05:00
konnorrogers
c74049a140 changelog 2024-12-05 18:58:12 -05:00
konnorrogers
e7a0444c67 fixed a bug in wa-dialog causing it to close prematurely 2024-12-05 18:57:12 -05:00
Cory LaViska
32ed169ca8 don't redirect on 404 in build 2024-12-05 16:34:07 -05:00
konnorrogers
9e2f1d15d8 set outline false on page, add pattern.njk 2024-12-05 12:22:45 -05:00
Lea Verou
8d93a44566 Revert edit, turns out code previews are already documented in the linked page 🤦🏽‍♀️ 2024-12-04 17:17:26 -05:00
Lea Verou
471cb0287d Document API around code examples
cc @claviska
2024-12-04 16:25:35 -05:00
Cory LaViska
1428ec0708 Merge pull request #271 from shoelace-style/backports
Backports from Shoelace
2024-12-04 14:34:41 -05:00
Cory LaViska
4ed0a93ec6 backport SL-2281, SL-2295 2024-12-04 14:05:04 -05:00
Cory LaViska
ba125dc06a backport SL-2218 2024-12-04 12:47:57 -05:00
Cory LaViska
fe8b0624fe backport SL-2192 2024-12-04 12:43:43 -05:00
Cory LaViska
56dc07e30d backport SL-2189 2024-12-04 12:39:03 -05:00
Cory LaViska
6dd31748e9 backport SL-2210 2024-12-04 12:29:23 -05:00
Cory LaViska
2f4379716a backport SL-2182 2024-12-04 12:26:30 -05:00
Cory LaViska
58ac1c920d fix prefixes 2024-12-04 12:19:49 -05:00
Cory LaViska
abedd14cac backport SL-2299 2024-12-04 12:18:17 -05:00
Cory LaViska
73ca47b608 who 2024-12-04 12:12:14 -05:00
Cory LaViska
5ddc832e9d backport SL-2292 2024-12-04 12:09:17 -05:00
Cory LaViska
c097b21443 backport SL-2274 2024-12-04 12:03:49 -05:00
Cory LaViska
17fb0ef94e backport SL-2293 2024-12-04 11:52:09 -05:00
Cory LaViska
2089065499 add missing translations from shoelace 2024-12-04 11:45:38 -05:00
Cory LaViska
b168214952 backport SL-2270 2024-12-04 11:45:27 -05:00
Cory LaViska
678e3bd108 backport SL-2272 2024-12-04 11:39:12 -05:00
Cory LaViska
6cc030fa06 backport SL-2220 2024-12-04 11:38:18 -05:00
Cory LaViska
b84bd8e3cf backport SL-2221 2024-12-04 11:33:22 -05:00
Cory LaViska
8c1921da15 lint 2024-12-03 14:21:11 -05:00
Cory LaViska
9a86311bc4 Merge branch 'next' of https://github.com/shoelace-style/webawesome into next 2024-12-03 14:17:56 -05:00
Cory LaViska
5950100615 skip test that crashes 2024-12-03 14:17:43 -05:00
Lea Verou
4e3e0aad14 [cheatsheet] Make match URL param work
Co-Authored-By: Konnor Rogers <konnor5456@gmail.com>
2024-12-03 12:38:24 -05:00
Lea Verou
6cc3b05fb7 Move cheatsheet JS to separate file 2024-12-03 12:36:51 -05:00
Cory LaViska
0e75ec6758 fix failing test 2024-12-03 12:17:52 -05:00
Cory LaViska
f157d4dfa4 remove tests to reflect new button href behavior 2024-12-03 12:10:08 -05:00
Cory LaViska
3c81f9c5e9 Merge pull request #264 from shoelace-style/honor-existing-ids
Leave existing ids intact when generating anchor headings
2024-12-03 12:06:44 -05:00
Cory LaViska
d97bf9a9e9 Update docs/_utils/anchor-headings.js
Co-authored-by: Lea Verou <lea@verou.me>
2024-12-03 12:06:31 -05:00
Cory LaViska
bda66ab4b9 don't bork ids when already provided 2024-12-03 11:58:30 -05:00
Cory LaViska
2719880636 temporarily disable prettier in prod to speed things up 2024-12-03 11:52:23 -05:00
lindsaym-fa
ca20f4de22 add custom property for checkbox icon color 2024-12-03 10:52:59 -05:00
Lea Verou
9080810c20 [cheatsheet] Permalinks should include match params too 2024-12-03 09:40:08 -05:00
Lea Verou
0a6b36d3c8 [cheatsheet] Rename references -> cheatsheet 2024-12-02 20:38:34 -05:00
Lea Verou
0cf6765d56 [reference] Implement case insensitive and regexp search 2024-12-02 20:24:18 -05:00
Lea Verou
7b3e572d25 [reference] Update outline links when searching 2024-12-02 20:11:41 -05:00
Lea Verou
be387992e6 Enable Prettier for workspace 2024-12-02 19:57:21 -05:00
Lea Verou
1f8a282971 [reference] Support filtering permalinks 2024-12-02 19:57:10 -05:00
Lea Verou
8c804957fa [reference] Add filter input, add counts 2024-12-02 19:37:29 -05:00
Lea Verou
8b1fc9a18f [components/reference] Show count of components if > 1 2024-12-02 16:08:17 -05:00
Lea Verou
bd35c23784 Indices of components by attribute, slot, part, etc. (#240)
* Simplify how list of components is exposed to 11ty

No need for functions or computing multiple times, that's what data is for!

* Add attributes to component data

* Cleanup

* Add slug (tagName without wa-)

* Add component reference / cheatsheet
2024-11-24 21:19:50 -05:00
Cory LaViska
aef3ed8bcb Merge pull request #247 from shoelace-style/autoslot
automatically slot tab into tab group; fixes #239
2024-11-22 12:29:06 -05:00
Cory LaViska
01b23a3e88 Update src/components/tab/tab.ts
Co-authored-by: Lea Verou <lea@verou.me>
2024-11-22 12:28:58 -05:00
Cory LaViska
4185f3816b automatically slot tab into tab group; fixes #239 2024-11-22 12:15:30 -05:00
Lea Verou
4522b40879 Copyediting: First singular to first plural 2024-11-22 02:33:09 -05:00
705 changed files with 25251 additions and 24582 deletions

View File

@@ -1,10 +0,0 @@
.cache
docs/dist
docs/search.json
docs/**/*.min.js
dist
examples
node_modules
src/react
scripts

View File

@@ -1,213 +0,0 @@
/* eslint-env node */
module.exports = {
plugins: [
'@typescript-eslint',
'wc',
'lit',
'lit-a11y',
'chai-expect',
'chai-friendly',
'import',
'sort-imports-es6-autofix'
],
extends: [
'eslint:recommended',
'plugin:wc/recommended',
'plugin:wc/best-practice',
'plugin:lit/recommended',
'plugin:lit-a11y/recommended'
],
env: {
es2021: true,
browser: true
},
parserOptions: {
sourceType: 'module'
},
overrides: [
{
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking'
],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
project: './tsconfig.json',
tsconfigRootDir: __dirname
},
files: ['*.ts'],
rules: {
'default-param-last': 'off',
'@typescript-eslint/default-param-last': 'error',
'no-console': 'warn',
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': 'warn',
'no-implied-eval': 'off',
'no-invalid-this': 'off',
'no-shadow': 'off',
'no-throw-literal': 'off',
'no-unused-expressions': 'off',
'lit-a11y/no-autofocus': 'off',
'@typescript-eslint/no-implied-eval': 'error',
'@typescript-eslint/no-invalid-this': 'error',
'@typescript-eslint/no-throw-literal': 'error',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/prefer-regexp-exec': 'off',
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-misused-promises': [
'error',
{
checksVoidReturn: false
}
],
'@typescript-eslint/consistent-type-assertions': [
'warn',
{
assertionStyle: 'as',
objectLiteralTypeAssertions: 'never'
}
],
'@typescript-eslint/consistent-type-imports': 'warn',
'@typescript-eslint/no-base-to-string': 'error',
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
'@typescript-eslint/no-invalid-void-type': 'error',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn',
'@typescript-eslint/no-unnecessary-condition': 'off',
'@typescript-eslint/no-unnecessary-qualifier': 'warn',
'@typescript-eslint/non-nullable-type-assertion-style': 'warn',
'@typescript-eslint/prefer-for-of': 'warn',
'@typescript-eslint/prefer-optional-chain': 'warn',
'@typescript-eslint/prefer-ts-expect-error': 'warn',
'@typescript-eslint/prefer-return-this-type': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'warn',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/unified-signatures': 'warn',
'@typescript-eslint/array-type': 'warn',
'@typescript-eslint/consistent-type-definitions': ['warn', 'interface'],
'@typescript-eslint/member-delimiter-style': 'warn',
'@typescript-eslint/method-signature-style': 'warn',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/parameter-properties': 'error',
'@typescript-eslint/strict-boolean-expressions': 'off'
}
},
{
files: ['**/*.cjs'],
env: {
node: true
}
},
{
extends: ['plugin:chai-expect/recommended', 'plugin:chai-friendly/recommended'],
files: ['*.test.ts'],
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unused-expressions': 'off'
}
}
],
rules: {
'no-template-curly-in-string': 'error',
'array-callback-return': 'error',
'comma-dangle': 'off',
'consistent-return': 'error',
curly: 'off',
'default-param-last': 'error',
eqeqeq: 'error',
'lit-a11y/click-events-have-key-events': 'off',
'no-constructor-return': 'error',
'no-empty-function': 'warn',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-floating-decimal': 'error',
'no-implicit-coercion': 'off',
'no-implicit-globals': 'error',
'no-implied-eval': 'error',
'no-invalid-this': 'error',
'no-labels': 'error',
'no-lone-blocks': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-octal-escape': 'error',
'no-proto': 'error',
'no-return-assign': 'warn',
'no-script-url': 'error',
'no-self-compare': 'warn',
'no-sequences': 'warn',
'no-throw-literal': 'error',
'no-unmodified-loop-condition': 'error',
'no-unused-expressions': 'warn',
'no-useless-call': 'error',
'no-useless-concat': 'error',
'no-useless-return': 'warn',
'prefer-promise-reject-errors': 'error',
radix: 'off',
'require-await': 'error',
'wrap-iife': ['warn', 'inside'],
'no-shadow': 'error',
'no-array-constructor': 'error',
'no-bitwise': 'error',
'no-multi-assign': 'warn',
'no-new-object': 'error',
'no-useless-computed-key': 'warn',
'no-useless-rename': 'warn',
'no-var': 'error',
'prefer-const': 'warn',
'prefer-numeric-literals': 'warn',
'prefer-object-spread': 'warn',
'prefer-rest-params': 'warn',
'prefer-spread': 'warn',
'prefer-template': 'off',
'no-else-return': 'off',
'func-names': ['warn', 'never'],
'one-var': ['warn', 'never'],
'operator-assignment': 'warn',
'prefer-arrow-callback': 'warn',
'no-restricted-imports': [
'warn',
{
paths: [
{
name: '.',
message: 'Usage of local index imports is not allowed.'
},
{
name: './index',
message: 'Import from the source file instead.'
}
]
}
],
'import/extensions': [
'error',
'always',
{
ignorePackages: true,
pattern: {
js: 'always',
ts: 'never'
}
}
],
'import/no-duplicates': 'warn',
'sort-imports-es6-autofix/sort-imports-es6': [
2,
{
ignoreCase: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single']
}
],
'wc/guard-super-call': 'off'
}
};

39
.github/workflows/client_tests.js.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
# # This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Client Tests
on:
push:
branches: [next]
pull_request:
branches: [next]
jobs:
client_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run prettier
- name: Build
run: npm run build:alpha
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run CSR tests
# FAIL_FAST to fail on first failing test.
run: FAIL_FAST="true" CSR_ONLY="true" npm run test

View File

@@ -1,42 +1,13 @@
# # This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
name: SSR Tests
on:
push:
branches: [next]
pull_request:
branches: [next]
jobs:
client_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run prettier && npm run lint
- name: Build
run: npm run build
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run CSR tests
# FAIL_FAST to fail on first failing test.
run: FAIL_FAST="true" CSR_ONLY="true" npm run test
ssr_test:
runs-on: ubuntu-latest
@@ -56,10 +27,10 @@ jobs:
run: npm ci
# Just lint here too. Save some GH Action minutes and not need to use "depends_on" or anything.
- name: Lint
run: npm run prettier && npm run lint
run: npm run prettier
- name: Build
run: npm run build
run: npm run build:alpha
- name: Install Playwright
run: npx playwright install --with-deps

View File

@@ -3,7 +3,6 @@
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bierner.lit-html",
"bashmish.es6-string-css",
"streetsidesoftware.code-spell-checker"
]
}

View File

@@ -1,6 +1,7 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},

View File

@@ -59,6 +59,8 @@ To generate a production build, run the following command.
npm run build
```
You can also run `npm run build:serve` to start an [`http-server`](https://www.npmjs.com/package/http-server) instance on `http://localhost:4000` after the build completes, so you can preview the production build.
### Creating New Components
To scaffold a new component, run the following command, replacing `wa-tag-name` with the desired tag name.

View File

@@ -39,12 +39,15 @@
"crutchcorn",
"csspart",
"cssproperty",
"cssstate",
"datetime",
"describedby",
"Docsify",
"dogfood",
"dropdowns",
"easings",
"ecommerce",
"endfor",
"endraw",
"endregion",
"enterkeyhint",
@@ -83,6 +86,8 @@
"jsfiddle",
"keydown",
"keyframes",
"keymaker",
"Konnor",
"Kool",
"labelledby",
"Laravel",
@@ -100,6 +105,7 @@
"metaframeworks",
"middlewares",
"minlength",
"minmax",
"monospace",
"mousedown",
"mousemove",
@@ -108,6 +114,7 @@
"multiselectable",
"nextjs",
"nocheck",
"noindex",
"noopener",
"noreferrer",
"novalidate",
@@ -120,6 +127,7 @@
"peta",
"petabit",
"Preact",
"preconnect",
"prismjs",
"progressbar",
"radiogroup",
@@ -150,16 +158,19 @@
"smartquotes",
"spacebar",
"stylesheet",
"svgs",
"Tabbable",
"tabindex",
"tabler",
"tablist",
"tabpanel",
"tbody",
"templating",
"tera",
"testid",
"textareas",
"textfield",
"thead",
"Themer",
"tinycolor",
"transitionend",
@@ -183,7 +194,8 @@
"webawesomer",
"WEBP",
"Webpacker",
"xmark"
"xmark",
"zoomable"
],
"ignorePaths": [
"package.json",

View File

@@ -2,8 +2,8 @@ import { customElementJetBrainsPlugin } from 'custom-element-jet-brains-integrat
import { customElementVsCodePlugin } from 'custom-element-vs-code-integration';
// import { customElementVuejsPlugin } from 'custom-element-vuejs-integration';
import { parse } from 'comment-parser';
import { pascalCase } from 'pascal-case';
import fs from 'fs';
import { pascalCase } from 'pascal-case';
const packageData = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
const { name, description, version, author, homepage, license } = packageData;
@@ -28,7 +28,7 @@ export default {
name: 'wa-package-data',
packageLinkPhase({ customElementsManifest }) {
customElementsManifest.package = { name, description, version, author, homepage, license };
}
},
},
// Parse custom jsDoc tags
@@ -83,13 +83,13 @@ export default {
classDoc[t.tag].push({
name: t.name,
description: t.description,
type: t.type || undefined
type: t.type || undefined,
});
}
});
}
}
}
},
},
{
@@ -109,7 +109,7 @@ export default {
}
}
}
}
},
},
{
@@ -127,7 +127,7 @@ export default {
//
const terms = [
{ from: /^src\//, to: '' }, // Strip the src/ prefix
{ from: /\.(t|j)sx?$/, to: '.js' } // Convert .ts to .js
{ from: /\.(t|j)sx?$/, to: '.js' }, // Convert .ts to .js
];
mod.path = replace(mod.path, terms);
@@ -146,7 +146,7 @@ export default {
}
}
});
}
},
},
// Generate custom VS Code data
@@ -156,9 +156,9 @@ export default {
referencesTemplate: (_, tag) => [
{
name: 'Documentation',
url: `https://webawesome.com/docs/components/${tag.replace('wa-', '')}`
}
]
url: `https://webawesome.com/docs/components/${tag.replace('wa-', '')}`,
},
],
}),
customElementJetBrainsPlugin({
@@ -168,10 +168,10 @@ export default {
referencesTemplate: (_, tag) => {
return {
name: 'Documentation',
url: `https://webawesome.com/docs/components/${tag.replace('wa-', '')}`
url: `https://webawesome.com/docs/components/${tag.replace('wa-', '')}`,
};
}
})
},
}),
//
// TODO - figure out why this broke when events were updated
@@ -181,5 +181,5 @@ export default {
// fileName: 'index.d.ts',
// componentTypePath: (_, tag) => `../../components/${tag.replace('wa-', '')}/${tag.replace('wa-', '')}.js`
// })
]
],
};

View File

@@ -1,61 +1,70 @@
import { parse } from 'path';
import { markdown } from './_utils/markdown.js';
import { anchorHeadingsPlugin } from './_utils/anchor-headings.js';
import { codeExamplesPlugin } from './_utils/code-examples.js';
import { copyCodePlugin } from './_utils/copy-code.js';
import { currentLink } from './_utils/current-link.js';
import { highlightCodePlugin } from './_utils/highlight-code.js';
import { formatCodePlugin } from './_utils/format-code.js';
import { markdown } from './_utils/markdown.js';
import { removeDataAlphaElements } from './_utils/remove-data-alpha-elements.js';
// import { formatCodePlugin } from './_utils/format-code.js';
import litPlugin from '@lit-labs/eleventy-plugin-lit';
import { readFile } from 'fs/promises';
import componentList from './_data/componentList.js';
import * as filters from './_utils/filters.js';
import { outlinePlugin } from './_utils/outline.js';
import { replaceTextPlugin } from './_utils/replace-text.js';
import { searchPlugin } from './_utils/search.js';
import { readFile } from 'fs/promises';
import { outlinePlugin } from './_utils/outline.js';
import { getComponents } from './_utils/manifest.js';
import litPlugin from '@lit-labs/eleventy-plugin-lit';
import process from 'process';
const packageData = JSON.parse(await readFile('./package.json', 'utf-8'));
const isAlpha = process.argv.includes('--alpha');
const isDeveloping = process.argv.includes('--develop');
const isDev = process.argv.includes('--develop');
const globalData = {
package: packageData,
isAlpha,
layout: 'page.njk',
};
const passThroughExtensions = ['js', 'css', 'png', 'svg', 'jpg', 'mp4'];
const passThrough = [...passThroughExtensions.map(ext => 'docs/**/*.' + ext)];
export default function (eleventyConfig) {
// NOTE - alpha setting removes certain pages
if (isAlpha) {
eleventyConfig.ignores.add('**/components/page.md');
eleventyConfig.ignores.add('**/experimental/**');
eleventyConfig.ignores.add('**/layout/**');
eleventyConfig.ignores.add('**/patterns/**');
eleventyConfig.ignores.add('**/style-utilities/**');
eleventyConfig.ignores.add('**/components/code-demo.md');
eleventyConfig.ignores.add('**/components/viewport-demo.md');
}
// Add template data
eleventyConfig.addGlobalData('package', packageData);
for (let name in globalData) {
eleventyConfig.addGlobalData(name, globalData[name]);
}
// Template filters - {{ content | filter }}
eleventyConfig.addFilter('inlineMarkdown', content => markdown.renderInline(content || ''));
eleventyConfig.addFilter('markdown', content => markdown.render(content || ''));
eleventyConfig.addFilter('stripExtension', string => parse(string).name);
eleventyConfig.addFilter('stripPrefix', content => content.replace(/^wa-/, ''));
eleventyConfig.addFilter('trimPipes', content => {
// Trims whitespace and pipes from the start and end of a string. Useful for CEM types, which can be pipe-delimited.
// With Prettier 3, this means a leading pipe will exist be present when the line wraps.
return typeof content === 'string' ? content.replace(/^(\s|\|)/g, '').replace(/(\s|\|)$/g, '') : content;
});
for (let name in filters) {
eleventyConfig.addFilter(name, filters[name]);
}
// Shortcodes - {% shortCode arg1, arg2 %}
eleventyConfig.addShortcode('cdnUrl', location => {
return `https://early.webawesome.com/webawesome@${packageData.version}/dist/` + location.replace(/^\//, '');
});
// Helpers
eleventyConfig.addNunjucksGlobal('getComponent', tagName => {
const component = getComponents().find(c => c.tagName === tagName);
// Paired shortcodes - {% shortCode %}content{% endShortCode %}
eleventyConfig.addPairedShortcode('markdown', content => markdown.render(content || ''));
if (!component) {
throw new Error(
`Unable to find "<${tagName}>". Make sure the file name is the same as the tag name (without prefix).`
);
}
return component;
});
// Helpers
// Remove elements that have [data-alpha="remove"]
eleventyConfig.addPlugin(removeDataAlphaElements({ isAlpha }));
// Use our own markdown instance
eleventyConfig.setLibrary('md', markdown);
@@ -71,15 +80,15 @@ export default function (eleventyConfig) {
selector: 'h2, h3',
ifEmpty: doc => {
doc.querySelector('#outline')?.remove();
}
})
},
}),
);
// Add current link classes
eleventyConfig.addPlugin(currentLink());
// Add code examples for `<code class="example">` blocks
eleventyConfig.addPlugin(codeExamplesPlugin());
eleventyConfig.addPlugin(codeExamplesPlugin);
// Highlight code blocks with Prism
eleventyConfig.addPlugin(highlightCodePlugin());
@@ -93,61 +102,77 @@ export default function (eleventyConfig) {
// Replace [issue:1234] with a link to the issue on GitHub
{
replace: /\[pr:([0-9]+)\]/gs,
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/pull/$1">#$1</a>'
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/pull/$1">#$1</a>',
},
// Replace [pr:1234] with a link to the pull request on GitHub
{
replace: /\[issue:([0-9]+)\]/gs,
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/issues/$1">#$1</a>'
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/issues/$1">#$1</a>',
},
// Replace [discuss:1234] with a link to the discussion on GitHub
{
replace: /\[discuss:([0-9]+)\]/gs,
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/discussions/$1">#$1</a>'
}
])
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/discussions/$1">#$1</a>',
},
]),
);
const omittedModules = [];
// SSR plugin
if (!isDev) {
//
// Problematic components in SSR land:
// - animation (breaks on navigation + ssr with Turbo)
// - mutation-observer (why SSR this?)
// - resize-observer (why SSR this?)
// - tooltip (why SSR this?)
//
const omittedModules = [];
const componentModules = componentList
.filter(component => !omittedModules.includes(component.tagName.split(/wa-/)[1]))
.map(component => {
const name = component.tagName.split(/wa-/)[1];
return `./dist/components/${name}/${name}.js`;
});
// problematic components:
// animation (breaks on navigation + ssr with Turbo)
// mutation-observer (why SSR this?)
// resize-observer (why SSR this?)
// tooltip (why SSR this?)
const componentModules = getComponents()
// .filter(component => !omittedModules.includes(component.tagName.split(/wa-/)[1]))
.map(component => {
const name = component.tagName.split(/wa-/)[1];
return `./dist/components/${name}/${name}.js`;
eleventyConfig.addPlugin(litPlugin, {
mode: 'worker',
componentModules,
});
eleventyConfig.addPlugin(litPlugin, {
mode: 'worker',
componentModules
});
}
// Build the search index
eleventyConfig.addPlugin(
searchPlugin({
filename: '',
selectorsToIgnore: ['code.example'],
getContent: doc => doc.querySelector('#content')?.textContent ?? ''
})
getContent: doc => doc.querySelector('#content')?.textContent ?? '',
}),
);
// Production-only plugins
if (!isDeveloping) {
// Run Prettier on each file (prod only because it can be slow)
eleventyConfig.addPlugin(formatCodePlugin());
//
// TODO - disabled because it takes about a minute to run now
//
// if (!isDev) {
// // Run Prettier on each file (prod only because it can be slow)
// eleventyConfig.addPlugin(formatCodePlugin());
// }
eleventyConfig.addPassthroughCopy({
'docs/assets': 'assets',
});
for (let glob of passThrough) {
eleventyConfig.addPassthroughCopy(glob);
}
return {
markdownTemplateEngine: 'njk',
dir: {
input: 'docs',
includes: '_includes',
layouts: '_layouts'
layouts: '_layouts',
},
templateFormats: ['njk', 'md']
templateFormats: ['njk', 'md'],
};
}

View File

@@ -0,0 +1,75 @@
/**
* @module components Fetches components from custom-elements.json and exposes them in a saner format.
*/
import { readFileSync } from 'fs';
import { dirname, resolve } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const manifest = JSON.parse(readFileSync(resolve(__dirname, '../../dist/custom-elements.json'), 'utf-8'));
const components = manifest.modules.flatMap(module => {
return module.declarations
.filter(c => c?.customElement)
.map(declaration => {
// Generate the dist path based on the src path and attach it to the component
declaration.path = module.path.replace(/^src\//, 'dist/').replace(/\.ts$/, '.js');
// Remove private members and those that lack a description
const members = declaration.members?.filter(member => member.description && member.privacy !== 'private');
const methods = members?.filter(prop => prop.kind === 'method' && prop.privacy !== 'private');
const attributes = declaration.attributes ?? [];
const properties = members?.filter(prop => {
// Look for a corresponding attribute
const attribute = attributes?.find(attr => attr.fieldName === prop.name);
if (attribute) {
prop.attribute = attribute.name || attribute.fieldName;
}
return prop.kind === 'field' && prop.privacy !== 'private';
});
return {
...declaration,
slug: declaration.tagName.replace(/^wa-/, ''),
methods,
attributes,
properties,
};
});
});
// Build dependency graphs
components.forEach(component => {
const dependencies = [];
// Recursively fetch sub-dependencies
function getDependencies(tag) {
const cmp = components.find(c => c.tagName === tag);
if (!cmp || !Array.isArray(component.dependencies)) {
return;
}
cmp.dependencies?.forEach(dependentTag => {
if (!dependencies.includes(dependentTag)) {
dependencies.push(dependentTag);
}
getDependencies(dependentTag);
});
}
getDependencies(component.tagName);
component.dependencies = dependencies.sort();
});
// Sort by name
components.sort((a, b) => {
if (a.name < b.name) return -1;
if (a.name > b.name) return 1;
return 0;
});
export default components;

3
docs/_data/components.js Normal file
View File

@@ -0,0 +1,3 @@
import componentList from './componentList.js';
export default Object.fromEntries(componentList.map(component => [component.slug, component]));

View File

@@ -0,0 +1,43 @@
import components from './components.js';
const by = {
attribute: {},
slot: {},
event: {},
method: {},
cssPart: {},
cssProperty: {},
};
function getAll(component, type) {
let prop = type + 's';
if (type === 'cssProperty') {
prop = 'cssProperties';
}
return component[prop] ?? [];
}
for (const componentName in components) {
const component = components[componentName];
for (const type of ['attribute', 'slot', 'event', 'method', 'cssPart', 'cssProperty']) {
for (const item of getAll(component, type)) {
by[type][item.name] ??= [];
by[type][item.name].push(component);
}
}
}
// Sort by descending number of components
const sortByLengthDesc = (a, b) => b[1].length - a[1].length;
for (const key in by) {
by[key] = sortObject(by[key], sortByLengthDesc);
}
export default by;
function sortObject(obj, sorter) {
return Object.fromEntries(Object.entries(obj).sort(sorter));
}

1
docs/_data/hues.json Normal file
View File

@@ -0,0 +1 @@
["red", "yellow", "green", "teal", "blue", "indigo", "violet", "gray"]

1
docs/_data/palettes.js Normal file
View File

@@ -0,0 +1 @@
export { default as default } from '../../src/styles/color/palettes.js';

File diff suppressed because one or more lines are too long

View File

@@ -1,127 +1,46 @@
<!DOCTYPE html>
<html lang="en" data-fa-kit-code="b10bfbde90" data-cdn-url="{% cdnUrl %}">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ description }}">
{% include 'head.njk' %}
<meta name="theme-color" content="#f36944">
{% if noindex %}<meta name="robots" content="noindex">{% endif %}
<title>{{ title }}</title>
<link rel="icon" href="/assets/images/webawesome-logo.svg" />
<link rel="apple-touch-icon" href="/assets/images/app-icon.png">
{# Scripts #}
{# Hydration stuff #}
<script src="/assets/scripts/hydration-errors.js"></script>
<link rel="stylesheet" href="/assets/styles/hydration-errors.css">
<link rel="preconnect" href="https://cdn.jsdelivr.net">
<script type="module" src="https://cdn.jsdelivr.net/npm/@hotwired/turbo@8.0.4/+esm"></script>
<script type="module" src="/assets/scripts/code-examples.js"></script>
<script type="module" src="/assets/scripts/color-scheme.js"></script>
<script type="module" src="/assets/scripts/copy-code.js"></script>
<script type="module" src="/assets/scripts/preset-theme.js"></script>
<script type="module" src="/assets/scripts/scroll.js"></script>
<script type="module" src="/assets/scripts/turbo.js"></script>
<script type="module" src="/assets/scripts/search.js"></script>
<script type="module" src="/assets/scripts/outline.js"></script>
<script defer data-domain="backers.webawesome.com" src="https://plausible.io/js/script.js"></script>
{# Web Awesome #}
<script type="module" src="/dist/webawesome.ssr-loader.js"></script>
<link rel="stylesheet" id="theme-stylesheet" />
<link rel="stylesheet" href="/dist/themes/applied.css" />
<link id="color-stylesheet" rel="stylesheet" href="/dist/themes/layout.css" />
<link id="color-stylesheet" rel="stylesheet" href="/dist/themes/utilities.css" />
<link rel="stylesheet" href="/dist/themes/forms.css" />
{# Docs styles #}
<link rel="stylesheet" href="/assets/styles/docs.css" />
{# Set the theme to prevent flashing #}
<script>
function getColorScheme() {
return localStorage.getItem('colorScheme') || 'auto';
}
function getPresetTheme () {
return localStorage.getItem('presetTheme') || 'default';
}
function isDark() {
const colorScheme = getColorScheme()
if (colorScheme === 'auto') {
return window.matchMedia('(prefers-color-scheme: dark)').matches;
}
return colorScheme === 'dark';
}
const stylesheet = document.getElementById("theme-stylesheet")
let preset = getPresetTheme()
stylesheet.href = `/dist/themes/${preset}.css`
document.documentElement.classList.toggle(
`wa-theme-${preset}-dark`,
isDark()
);
</script>
</head>
<body class="layout-{{ layout | stripExtension }}">
<body class="layout-{{ layout | stripExtension }}{{ ' page-wide' if wide }}">
<!-- use view="desktop" as default to reduce layout jank on desktop site. -->
<wa-page view="desktop">
<header slot="header">
<wa-page view="desktop" disable-navigation-toggle="">
<header slot="header" class="wa-split">
{# Logo #}
<div id="docs-branding">
{# Nav toggle #}
<wa-button appearance="text" data-toggle-nav>
<wa-button appearance="plain" size="small" data-toggle-nav>
<wa-icon name="bars" label="Toggle navigation"></wa-icon>
</wa-button>
<a href="/" aria-label="Web Awesome">
<span class="only-desktop">{% include "logo.njk" %}</span>
<span class="only-mobile">{% include "logo-simple.njk" %}</span>
<span class="wa-desktop-only">{% include "logo.njk" %}</span>
<span class="wa-mobile-only">{% include "logo-simple.njk" %}</span>
</a>
<small id="version-number" class="only-desktop">{{ package.version }}</small>
<wa-badge variant="warning" class="only-desktop">Alpha</wa-badge>
<wa-badge variant="warning" appearance="filled" class="only-desktop">Alpha</wa-badge>
</div>
<div id="docs-toolbar">
{# Preset theme selector #}
<wa-dropdown id="preset-theme-selector">
<wa-button slot="trigger" appearance="tinted" size="small" pill caret>
<wa-icon slot="prefix" name="paintbrush" variant="regular"></wa-icon>
<span id="preset-theme-selector__text" class="only-desktop">Default</span>
</wa-button>
<wa-menu>
<wa-menu-item type="checkbox" value="default">Default</wa-menu-item>
<wa-menu-item type="checkbox" value="classic">Classic</wa-menu-item>
<wa-menu-item type="checkbox" value="fa">Font Awesome</wa-menu-item>
<wa-menu-item type="checkbox" value="active">Active</wa-menu-item>
<wa-menu-item type="checkbox" value="brutalist">Brutalism</wa-menu-item>
<wa-menu-item type="checkbox" value="glassy">Glassy</wa-menu-item>
<wa-menu-item type="checkbox" value="migration">Migration</wa-menu-item>
<wa-menu-item type="checkbox" value="playful">Playful</wa-menu-item>
<wa-menu-item type="checkbox" value="premium">Premium</wa-menu-item>
</wa-menu>
</wa-dropdown>
{# Color scheme selector #}
<wa-dropdown id="color-scheme-selector">
<wa-button slot="trigger" appearance="tinted" size="small" pill caret title="Press \ to toggle">
<wa-icon class="only-light" slot="prefix" name="sun" variant="regular"></wa-icon>
<wa-icon class="only-dark" slot="prefix" name="moon" variant="regular"></wa-icon>
<span class="only-light only-desktop">Light</span>
<span class="only-dark only-desktop">Dark</span>
</wa-button>
<wa-menu>
<wa-menu-item type="checkbox" value="light">Light</wa-menu-item>
<wa-menu-item type="checkbox" value="dark">Dark</wa-menu-item>
<wa-divider></wa-divider>
<wa-menu-item type="checkbox" value="auto">System</wa-menu-item>
</wa-menu>
</wa-dropdown>
<div id="docs-toolbar" class="wa-cluster wa-gap-xs">
{# Desktop selectors #}
<div class="only-desktop wa-cluster wa-gap-xs">
{% include "preset-theme-selector.njk" %}
{% include "color-scheme-selector.njk" %}
</div>
{# Search #}
<wa-button id="search-trigger" appearance="outlined" size="small" data-search>
@@ -134,12 +53,16 @@
{# Sidebar #}
{% if hasSidebar %}
<aside slot="navigation" id="sidebar" class="docs-aside" data-remember-scroll>
<wa-icon-button id="sidebar-close-button" name="xmark" label="Close" data-drawer="close"></wa-icon-button>
<nav>
{% include "sidebar.njk" %}
</nav>
</aside>
{# Mobile selectors #}
<div class="wa-mobile-only" slot="navigation-header">
<div class="wa-cluster wa-gap-xs">
{% include "preset-theme-selector.njk" %}
{% include "color-scheme-selector.njk" %}
</div>
</div>
<div slot="navigation" id="sidebar" class="docs-aside" data-remember-scroll>
{% include "sidebar.njk" %}
</div>
{% endif %}
{# Outline #}
@@ -160,11 +83,12 @@
</details>
</nav>
{% block beforeContent %}{% endblock %}
{% block header %}
{% include 'breadcrumbs.njk' %}
<h1 class="title">{{ title }}</h1>
{% endblock %}
{% block content %}
<h1 class="title">{{ title }}</h1>
{{ content | safe }}
{% endblock %}

View File

@@ -0,0 +1,10 @@
{% set breadcrumbs = page.url | breadcrumbs %}
{% if breadcrumbs.length > 0 %}
<wa-breadcrumb id="docs-breadcrumbs">
{% for crumb in breadcrumbs %}
<wa-breadcrumb-item href="{{ crumb.url }}">{{ crumb.title }}</wa-breadcrumb-item>
{% endfor %}
<wa-breadcrumb-item>{# Current page #}</wa-breadcrumb-item>
</wa-breadcrumb>
{% else %}
{% endif %}

View File

@@ -0,0 +1,19 @@
{# Color scheme selector #}
<wa-select class="color-scheme-selector" appearance="filled" size="small" value="auto" pill title="Press \ to toggle">
<wa-icon class="only-light" slot="prefix" name="sun" variant="regular"></wa-icon>
<wa-icon class="only-dark" slot="prefix" name="moon" variant="regular"></wa-icon>
<wa-option value="light">
<wa-icon slot="prefix" name="sun" variant="regular"></wa-icon>
Light
</wa-option>
<wa-option value="dark">
<wa-icon slot="prefix" name="moon" variant="regular"></wa-icon>
Dark
</wa-option>
<wa-divider></wa-divider>
<wa-option value="auto">
<wa-icon class="only-light" slot="prefix" name="sun" variant="regular"></wa-icon>
<wa-icon class="only-dark" slot="prefix" name="moon" variant="regular"></wa-icon>
System
</wa-option>
</wa-select>

View File

@@ -0,0 +1,40 @@
<table class="colors wa-palette-{{ paletteId }}">
<thead>
<tr>
<th></th>
{% for tint_bg in tints -%}
{% for tint_fg in tints | reverse -%}
{% if (tint_fg - tint_bg) | abs == difference %}
<th>{{ tint_fg }} on {{ tint_bg }}</th>
{% endif %}
{%- endfor -%}
{%- endfor %}
</tr>
</thead>
{% for hue in hues -%}
<tr>
<th>{{ hue | capitalize }}</th>
{% for tint_bg in tints -%}
{% set color_bg = palettes[paletteId][hue][tint_bg] %}
{% for tint_fg in tints | reverse -%}
{% set color_fg = palettes[paletteId][hue][tint_fg] %}
{% if (tint_fg - tint_bg) | abs == difference %}
<td>
<div class="color swatch" style="background-color: var(--wa-color-{{ hue }}-{{ tint_bg }}); color: var(--wa-color-{{ hue }}-{{ tint_fg }})">
{% set contrast_wcag = '' %}
{% if color_fg and color_bg %}
{% set contrast_wcag = color_bg.contrast(color_fg, 'WCAG21') %}
{% endif %}
{% if contrast_wcag %}
{{ contrast_wcag | number({maximumSignificantDigits: 2}) }}
{% else %}
{{ tint_fg }} on {{ tint_bg }}
{% endif %}
</div>
</td>
{% endif %}
{%- endfor -%}
{%- endfor -%}
</tr>
{%- endfor %}
</table>

View File

@@ -0,0 +1,12 @@
{# Cards for pages listed by category #}
<section id="grid" class="index-grid">
{% for category, pages in allPages | groupByTags(categories) -%}
<h2 class="index-category">{{ category | getCategoryTitle(categories) }}</h2>
{%- for page in pages -%}
{%- if not page.data.parent or listChildren -%}
{% include "page-card.njk" %}
{%- endif -%}
{%- endfor -%}
{%- endfor -%}
</section>

49
docs/_includes/head.njk Normal file
View File

@@ -0,0 +1,49 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ description }}">
{% if noindex %}<meta name="robots" content="noindex">{% endif %}
<title>{{ title }}</title>
{# Dark mode #}
<script>
let colorScheme = localStorage.colorScheme;
let isDark = localStorage.colorScheme === "dark";
if (!colorScheme || colorScheme === "auto") {
isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
}
document.documentElement.classList.toggle('wa-dark', isDark);
</script>
<link rel="icon" href="/assets/images/webawesome-logo.svg" />
<link rel="apple-touch-icon" href="/assets/images/app-icon.png">
{# Scripts #}
{# Hydration stuff #}
<script src="/assets/scripts/hydration-errors.js"></script>
<link rel="stylesheet" href="/assets/styles/hydration-errors.css">
<link rel="preconnect" href="https://cdn.jsdelivr.net">
<script type="module" src="https://cdn.jsdelivr.net/npm/@hotwired/turbo@8.0.10/+esm"></script>
{# Web Awesome #}
<script type="module" src="/dist/webawesome.ssr-loader.js"></script>
<script type="module" src="/assets/scripts/theme-picker.js"></script>
{# Preset Theme #}
{% if forceTheme %}
<link id="theme-stylesheet" rel="stylesheet" id="theme-stylesheet" href="/dist/styles/themes/{{ forceTheme }}.css" render="blocking" fetchpriority="high" />
{% else %}
<noscript><link id="theme-stylesheet" rel="stylesheet" id="theme-stylesheet" href="/dist/styles/themes/default.css" render="blocking" fetchpriority="high" /></noscript>
<script>
{
let preset = localStorage.presetTheme ?? 'default';
let script = document.currentScript;
script.insertAdjacentHTML('beforebegin', `<link id="theme-stylesheet" rel="stylesheet" id="theme-stylesheet" href="/dist/styles/themes/${ preset }.css" render="blocking" fetchpriority="high" />`);
}
</script>
<script type="module" src="/assets/scripts/preset-theme-picker.js"></script>
{% endif %}
<link rel="stylesheet" href="/dist/styles/webawesome.css" />
<link id="color-stylesheet" rel="stylesheet" href="/dist/styles/utilities.css" />
<link rel="stylesheet" href="/dist/styles/forms.css" />

View File

@@ -0,0 +1,24 @@
{%- if not stylesheets %}{% set stylesheets = [stylesheet] %}{% endif -%}
<wa-tab-group>
<wa-tab panel="html">In HTML</wa-tab>
<wa-tab panel="css">In CSS</wa-tab>
<wa-tab-panel name="html">
Simply add the following code to the `<head>` of your page:
```html
{% for stylesheet in stylesheets -%}
<link rel="stylesheet" href="{% cdnUrl stylesheet %}" />{% if not loop.last %}
{% endif %}{% endfor %}
```
</wa-tab-panel>
<wa-tab-panel name="css">
Simply add the following code at the top of your CSS file:
```css
{% for stylesheet in stylesheets -%}
@import url('{% cdnUrl stylesheet %}');{% if not loop.last %}
{% endif %}{% endfor %}
```
</wa-tab-panel>
</wa-tab-group>

View File

@@ -0,0 +1,10 @@
{%- if not page.data.unlisted -%}
<a href="{{ page.url }}"{{ page.data.keywords | attr('data-keywords') }}>
<wa-card with-header>
<div slot="header">
{% include "svgs/" + (page.data.icon or "thumbnail-placeholder") + ".njk" %}
</div>
<span class="page-name">{{ page.data.title }}</span>
</wa-card>
</a>
{% endif %}

View File

@@ -0,0 +1,26 @@
<div id="page_slots_demo">
<link rel="stylesheet" href="./demo.css">
{% set slots = components.page.slots %}
<fieldset id="page_slots_fieldset">
<legend>Slots</legend>
<div class="options">
{% for slot in slots %}
{% if (slot.name != "skip-to-content") and (slot.name != "navigation-toggle-icon") %}
<wa-checkbox name="slot" value="{{ slot.name }}" {{ 'checked' if slot.name != "menu" and slot.name != 'navigation-toggle' | safe}} class="{{ 'default' if not slot.name }}"
data-description="{{ slot.description | inlineMarkdown }}" title="{{ slot.description | inlineMarkdown | striptags | safe }}">
{{ slot.name or "(default)" }}
</wa-checkbox>
{% endif %}
{% endfor %}
</div>
</fieldset>
<wa-viewport-demo viewport="1000">
<iframe srcdoc="" id="page_slots_iframe"></iframe>
</wa-viewport-demo>
</div>
<script type="module">
const cacheBust = new Date().toString()
import(`./demo.js?${cacheBust}`)
</script>

View File

@@ -0,0 +1,9 @@
{# Preset theme selector #}
<wa-select appearance="filled" size="small" value="default" pill class="preset-theme-selector">
<wa-icon slot="prefix" name="paintbrush" variant="regular"></wa-icon>
{% for theme in collections.theme | sort %}
<wa-option value="{{ theme.page.fileSlug }}"{{ ' data-alpha="remove"' if theme.noAlpha }}>
{{ theme.data.title }}
</wa-option>
{% endfor %}
</wa-select>

View File

@@ -6,7 +6,7 @@
<wa-input
id="site-search-input"
type="search"
filled
appearance="filled"
size="large"
clearable
placeholder="Search"

View File

@@ -0,0 +1,22 @@
{# Some collections (like "patterns") will not have any items in the alpha build for example. So this checks to make sure the collection exists. #}
{% if collections[tag] -%}
{% set groupUrl %}/docs/{{ tag }}/{% endset %}
<wa-details {{ ((tag in (tags or [])) or (groupUrl in page.url)) | attr('open') }}>
<h2 slot="summary">
{% if groupUrl | getCollectionItemFromUrl %}
<a href="{{ groupUrl }}" title="Overview">{{ title or (tag | capitalize) }}
<wa-icon name="grid-2"></wa-icon>
</a>
{% else %}
{{ title or (tag | capitalize) }}
{% endif %}
</h2>
<ul>
{% for page in collections[tag] | sort %}
{% if not page.data.parent -%}
{% include 'sidebar-link.njk' %}
{%- endif %}
{% endfor %}
</ul>
</wa-details>
{%- endif %}

View File

@@ -0,0 +1,16 @@
{% if not (isAlpha and page.data.noAlpha) and page.fileSlug != tag and not page.data.unlisted -%}
<li>
<a href="{{ page.url }}">{{ page.data.title }}</a>
{% if page.data.status == 'experimental' %}<wa-icon name="flask"></wa-icon>{% endif %}
{% if page.data.isPro %}<wa-badge class="pro">PRO</wa-badge>{% endif %}
{% set children = page.data.children %}
{% if children.length > 0 %}
<ul>
{% for page in children %}
{% include 'sidebar-link.njk' %}
{% endfor %}
</ul>
{% endif %}
</li>
{%- endif %}

View File

@@ -3,7 +3,6 @@
<ul>
<li><a href="/docs/installation">Installation</a></li>
<li><a href="/docs/usage">Usage</a></li>
<li><a href="/docs/themes">Themes</a></li>
<li><a href="/docs/customizing">Customizing</a></li>
<li><a href="/docs/form-controls">Form Controls</a></li>
<li><a href="/docs/localization">Localization</a></li>
@@ -19,275 +18,15 @@
<li><a href="/docs/resources/changelog">Changelog</a></li>
</ul>
{# Components #}
<h2>Components</h2>
<ul>
<li>
<a href="/docs/components/">Components Overview</a>
</li>
<li>
<a href="/docs/components/animated-image">Animated Image</a>
</li>
<li>
<a href="/docs/components/animation">Animation</a>
</li>
<li>
<a href="/docs/components/avatar">Avatar</a>
</li>
<li>
<a href="/docs/components/badge">Badge</a>
</li>
<li>
<a href="/docs/components/breadcrumb">Breadcrumb</a>
<ul>
<li>
<a href="/docs/components/breadcrumb-item">Breadcrumb Item</a>
</li>
</ul>
</li>
<li>
<a href="/docs/components/button">Button</a>
</li>
<li>
<a href="/docs/components/button-group">Button Group</a>
</li>
<li>
<a href="/docs/components/callout">Callout</a>
</li>
<li>
<a href="/docs/components/card">Card</a>
</li>
<li>
<a href="/docs/components/carousel">Carousel</a>
<ul>
<li>
<a href="/docs/components/carousel-item">Carousel Item</a>
</li>
</ul>
</li>
<li>
<a href="/docs/components/checkbox">Checkbox</a>
</li>
<li>
<a href="/docs/components/color-picker">Color Picker</a>
</li>
<li>
<a href="/docs/components/copy-button">Copy Button</a>
</li>
<li>
<a href="/docs/components/details">Details</a>
</li>
<li>
<a href="/docs/components/dialog">Dialog</a>
</li>
<li>
<a href="/docs/components/divider">Divider</a>
</li>
<li>
<a href="/docs/components/drawer">Drawer</a>
</li>
<li>
<a href="/docs/components/dropdown">Dropdown</a>
</li>
<li>
<a href="/docs/components/format-bytes">Format Bytes</a>
</li>
<li>
<a href="/docs/components/format-date">Format Date</a>
</li>
<li>
<a href="/docs/components/format-number">Format Number</a>
</li>
<li>
<a href="/docs/components/icon">Icon</a>
</li>
<li>
<a href="/docs/components/icon-button">Icon Button</a>
</li>
<li>
<a href="/docs/components/image-comparer">Image Comparer</a>
</li>
<li>
<a href="/docs/components/include">Include</a>
</li>
<li>
<a href="/docs/components/input">Input</a>
</li>
<li>
<a href="/docs/components/menu">Menu</a>
<ul>
<li>
<a href="/docs/components/menu-item">Menu Item</a>
</li>
<li>
<a href="/docs/components/menu-label">Menu Label</a>
</li>
</ul>
</li>
<li>
<a href="/docs/components/mutation-observer">Mutation Observer</a>
</li>
<li>
<a href="/docs/components/popup">Popup</a>
</li>
<li>
<a href="/docs/components/progress-bar">Progress Bar</a>
</li>
<li>
<a href="/docs/components/progress-ring">Progress Ring</a>
</li>
<li>
<a href="/docs/components/qr-code">QR Code</a>
</li>
<li>
<a href="/docs/components/radio-group">Radio Group</a>
<ul>
<li>
<a href="/docs/components/radio">Radio</a>
</li>
<li>
<a href="/docs/components/radio-button">Radio Button</a>
</li>
</ul>
</li>
<li>
<a href="/docs/components/range">Range</a>
</li>
<li>
<a href="/docs/components/rating">Rating</a>
</li>
<li>
<a href="/docs/components/relative-time">Relative Time</a>
</li>
<li>
<a href="/docs/components/resize-observer">Resize Observer</a>
</li>
<li>
<a href="/docs/components/select">Select</a>
<ul>
<li>
<a href="/docs/components/option">Option</a>
</li>
</ul>
</li>
<li>
<a href="/docs/components/skeleton">Skeleton</a>
</li>
<li>
<a href="/docs/components/spinner">Spinner</a>
</li>
<li>
<a href="/docs/components/split-panel">Split Panel</a>
</li>
<li>
<a href="/docs/components/switch">Switch</a>
</li>
<li>
<a href="/docs/components/tab-group">Tab Group</a>
<ul>
<li>
<a href="/docs/components/tab">Tab</a>
</li>
<li>
<a href="/docs/components/tab-panel">Tab Panel</a>
</li>
</ul>
</li>
<li>
<a href="/docs/components/tag">Tag</a>
</li>
<li>
<a href="/docs/components/textarea">Textarea</a>
</li>
<li>
<a href="/docs/components/tooltip">Tooltip</a>
</li>
<li>
<a href="/docs/components/tree">Tree</a>
<ul>
<li>
<a href="/docs/components/tree-item">Tree Item</a>
</li>
</ul>
</li>
<li>
<a href="/docs/components/visually-hidden">Visually Hidden</a>
</li>
</ul>
{# Layout #}
<h2>Layout</h2>
<ul>
<li><a href="/docs/layout">Layout Overview</a></li>
<li><a href="/docs/components/page">Page</a></li>
<li><a href="/docs/layout/cluster">Cluster</a></li>
<li><a href="/docs/layout/flank">Flank</a></li>
<li><a href="/docs/layout/frame">Frame</a></li>
<li><a href="/docs/layout/grid">Grid</a></li>
<li><a href="/docs/layout/split">Split</a></li>
<li><a href="/docs/layout/stack">Stack</a></li>
</ul>
{# Patterns #}
<h2>Patterns</h2>
<ul>
<li>
<a href="/docs/patterns/">Pattern Overview</a>
</li>
<li><a href="/docs/patterns/app">Web App</a></li>
<li><a href="/docs/patterns/ecommerce">E-commerce</a>
<ul>
<li><a href="/docs/patterns/ecommerce-product-review">Product Reviews</a></li>
<li><a href="/docs/patterns/ecommerce-product-list">Product Lists</a></li>
<li><a href="/docs/patterns/ecommerce-category-preview">Category Previews</a></li>
<li><a href="/docs/patterns/ecommerce-shopping-cart">Shopping Carts</a></li>
<li><a href="/docs/patterns/ecommerce-category-filter">Category Filters</a></li>
<li><a href="/docs/patterns/ecommerce-product-detail">Product Detail</a></li>
<li><a href="/docs/patterns/ecommerce-order-summmary">Order Summaries</a></li>
<li><a href="/docs/patterns/ecommerce-order-history">Order History</a></li>
</ul>
</li>
<li><a href="/docs/patterns/blog">Blog</a></li>
<li><a href="/docs/patterns/news">News</a></li>
</ul>
{# Theming #}
<h2>Theming</h2>
<ul>
<li>
<a href="/docs/theming/">Theming Overview</a>
</li>
<li>
<a href="/docs/theming/color">Color</a>
</li>
<li>
<a href="/docs/theming/typography">Typography</a>
</li>
<li>
<a href="/docs/theming/space">Space</a>
</li>
<li>
<a href="/docs/theming/borders">Borders</a>
</li>
<li>
<a href="/docs/theming/focus">Focus</a>
</li>
<li>
<a href="/docs/theming/shadows">Shadows</a>
</li>
<li>
<a href="/docs/theming/transitions">Transitions</a>
</li>
<li>
<a href="/docs/theming/component-groups">Component Groups</a>
</li>
</ul>
{# Style Utilities #}
<h2>Style Utilities</h2>
<ul>
<li><a href="/docs/style-utilities/align-items">Align Items</a></li>
<li><a href="/docs/style-utilities/border-radius">Border Radius</a></li>
<li><a href="/docs/style-utilities/gap">Gap</a></li>
<li><a href="/docs/style-utilities/text">Text</a></li>
</ul>
{% for tag, title in {
'themes': 'Themes',
'components': 'Components',
'native': 'Native Styles',
'utilities': 'Style Utilities',
'layout': 'Layout',
'patterns': 'Patterns',
'palettes': 'Color Palettes',
'tokens': 'Design Tokens'
} %}
{% include 'sidebar-group.njk' %}
{% endfor %}

25
docs/_includes/status.njk Normal file
View File

@@ -0,0 +1,25 @@
{% if since -%}
<wa-badge variant="neutral">Since {{ since }}</wa-badge>
{% endif -%}
{%- if status %}
{%- if status == "wip" %}
<wa-badge variant="danger">
<wa-icon name="pickaxe"></wa-icon>
Work In Progress
</wa-badge>
{%- elif status == "experimental" %}
<wa-badge variant="warning">
<wa-icon name="flask"></wa-icon>
Experimental
</wa-badge>
{%- elif status == "stable" %}
<wa-badge variant="brand">Stable</wa-badge>
{%- else %}
<wa-badge>{{ status}}</wa-badge>
{%- endif -%}
{%- endif %}
{%- if isPro %}
<wa-badge class="pro">PRO</wa-badge>
{%- endif -%}

View File

@@ -0,0 +1,9 @@
<svg width="96" height="80" viewBox="0 0 96 80" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="1" y="1" width="94" height="6" rx="3" fill="var(--wa-color-surface-default)" stroke="var(--wa-color-surface-border)" stroke-width="2"/>
<rect x="1" y="13" width="94" height="6" rx="3" fill="var(--wa-color-surface-default)" stroke="var(--wa-color-surface-border)" stroke-width="2"/>
<rect x="1" y="73" width="94" height="6" rx="3" fill="var(--wa-color-surface-default)" stroke="var(--wa-color-surface-border)" stroke-width="2"/>
<rect x="25" y="61" width="46" height="6" rx="3" fill="var(--wa-color-surface-default)" stroke="var(--wa-color-surface-border)" stroke-width="2"/>
<rect x="25" y="25" width="46" height="30" rx="5" fill="var(--wa-color-surface-default)" stroke="var(--wa-color-surface-border)" stroke-width="2"/>
<rect x="1" y="25" width="18" height="42" rx="5" fill="var(--wa-color-surface-default)" stroke="var(--wa-color-surface-border)" stroke-width="2"/>
<rect x="77" y="25" width="18" height="42" rx="5" fill="var(--wa-color-surface-default)" stroke="var(--wa-color-surface-border)" stroke-width="2"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,24 @@
{% set paletteId = page.fileSlug %}
{% set tints = [80, 60, 40, 20] %}
{% set width = 20 %}
{% set height = 13 %}
{% set gap_x = 3 %}
{% set gap_y = 3 %}
<svg viewBox="0 0 {{ (width + gap_x) * hues|length }} {{ (height + gap_y) * tints|length }}" fill="none" xmlns="http://www.w3.org/2000/svg" class="wa-palette-{{ paletteId }} palette-icon">
<style>
@import url('/dist/styles/color/{{ paletteId }}.css') layer(palette.{{ paletteId }});
.palette-icon {
height: 8ch;
}
</style>
{% for hue in hues -%}
{% set hueIndex = loop.index0 %}
{% for tint in tints -%}
<rect x="{{ hueIndex * (width + gap_x) }}" y="{{ loop.index0 * (height + gap_y) }}"
width="{{ width }}" height="{{ height }}"
fill="var(--wa-color-{{ hue }}-{{ tint }})" rx="4" />
{%- endfor %}
{% endfor %}
</svg>

View File

Before

Width:  |  Height:  |  Size: 337 B

After

Width:  |  Height:  |  Size: 337 B

View File

Before

Width:  |  Height:  |  Size: 596 B

After

Width:  |  Height:  |  Size: 596 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 502 B

View File

Before

Width:  |  Height:  |  Size: 790 B

After

Width:  |  Height:  |  Size: 790 B

View File

Before

Width:  |  Height:  |  Size: 697 B

After

Width:  |  Height:  |  Size: 697 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,144 @@
<div class="showcase-examples-wrapper" aria-hidden="true" data-no-outline>
<div class="showcase-examples">
<wa-card with-header with-footer>
<div slot="header" class="wa-split">
<h3 class="wa-heading-m">Your Cart</h3>
<wa-icon-button name="xmark" tabindex="-1"></wa-icon-button>
</div>
<div class="wa-stack wa-gap-xl">
<div class="wa-flank">
<wa-avatar shape="rounded" style="--size: 3em; --background-color: var(--wa-color-green-60); --text-color: var(--wa-color-green-95);">
<wa-icon slot="icon" name="sword-laser" family="duotone" style="font-size: 1.5em;"></wa-icon>
</wa-avatar>
<div class="wa-stack wa-gap-2xs">
<div class="wa-split wa-gap-2xs">
<strong>Initiate Saber</strong>
<strong>$179.99</strong>
</div>
<div class="wa-split wa-gap-2xs wa-caption-m">
<span>Green</span>
<a href="#" tabindex="-1">Remove</a>
</div>
</div>
</div>
<wa-divider></wa-divider>
<div class="wa-flank">
<wa-avatar shape="rounded" style="--size: 3em; --background-color: var(--wa-color-teal-60); --text-color: var(--wa-color-teal-95);">
<wa-icon slot="icon" name="robot-astromech" family="duotone" style="font-size: 1.5em;"></wa-icon>
</wa-avatar>
<div class="wa-stack wa-gap-2xs">
<div class="wa-split wa-gap-2xs">
<strong>Repair Droid</strong>
<strong>$3,049.99</strong>
</div>
<div class="wa-split wa-gap-2xs wa-caption-m">
<span>R-series</span>
<a href="#" tabindex="-1">Remove</a>
</div>
</div>
</div>
</div>
<div slot="footer" class="wa-stack">
<div class="wa-split">
<strong>Subtotal</strong>
<strong>$3,229.98</strong>
</div>
<span class="wa-caption-m">Shipping and taxes calculated at checkout.</span>
<wa-button tabindex="-1" variant="brand">
<wa-icon slot="prefix" name="shopping-bag"></wa-icon>
Checkout
</wa-button>
</div>
</wa-card>
<wa-card>
<wa-avatar shape="rounded" style="--size: 1.9lh; float: left; margin-right: var(--wa-space-m);">
<wa-icon slot="icon" name="hat-wizard" family="duotone" style="font-size: 1.75em;"></wa-icon>
</wa-avatar>
<p class="wa-body-l" style="margin: 0;">&ldquo;All we have to decide is what to do with the time that is given to us. There are other forces at work in this world, Frodo, besides the will of evil.&rdquo;</p>
</wa-card>
<wa-card>
<div class="wa-stack">
<h3 class="wa-heading-m">Sign In</h3>
<wa-input tabindex="-1" label="Email" placeholder="ddjarin@mandalore.gov">
<wa-icon slot="prefix" name="envelope" variant="regular"></wa-icon>
</wa-input>
<wa-input tabindex="-1" label="Password" type="password">
<wa-icon slot="prefix" name="lock" variant="regular"></wa-icon>
</wa-input>
<wa-button tabindex="-1" variant="brand">Sign In</wa-button>
<a href="#" tabindex="-1" class="wa-body-s">I forgot my password</a>
</div>
</wa-card>
<wa-card with-footer>
<div class="wa-stack">
<div class="wa-split">
<h3 class="wa-heading-m">To-Do</h3>
<wa-icon-button tabindex="-1" name="plus" label="Add task"></wa-icon-button>
</div>
<wa-checkbox tabindex="-1" checked>Umbrella for Adelard</wa-checkbox>
<wa-checkbox tabindex="-1" checked>Waste-paper basket for Dora</wa-checkbox>
<wa-checkbox tabindex="-1" checked>Pen and ink for Milo</wa-checkbox>
<wa-checkbox tabindex="-1">Mirror for Angelica</wa-checkbox>
<wa-checkbox tabindex="-1">Silver spoons for Lobelia</wa-checkbox>
</div>
<div slot="footer">
<a href="" tabindex="-1">View all completed</a>
</div>
</wa-card>
<wa-card>
<div class="wa-stack">
<div class="wa-frame wa-border-radius-m" style="align-self: center; max-inline-size: 25ch;">
<img src="https://images.unsplash.com/photo-1667514627762-521b1c815a89?q=20" alt="Album art">
</div>
<div class="wa-flank:end wa-align-items-start">
<div class="wa-stack wa-gap-3xs">
<div class="wa-cluster wa-gap-xs" style="height: 2.25em;">
<strong>The Stone Troll</strong>
<small><wa-badge variant="neutral" appearance="filled">E</wa-badge></small>
</div>
<span class="wa-caption-m">Samwise G</span>
</div>
<wa-icon-button tabindex="-1" name="ellipsis" label="Options"></wa-icon-button>
</div>
<div class="wa-stack wa-gap-2xs">
<wa-progress-bar value="34" style="height: 0.5em"></wa-progress-bar>
<div class="wa-split">
<span class="wa-caption-xs">1:01</span>
<span class="wa-caption-xs">-1:58</span>
</div>
</div>
<div class="wa-grid wa-align-items-center" style="--min-column-size: 1em; justify-items: center;">
<wa-icon-button tabindex="-1" name="backward" label="Skip backward"></wa-icon-button>
<wa-icon-button tabindex="-1" name="pause" style="font-size: var(--wa-font-size-2xl);" label="Pause"></wa-icon-button>
<wa-icon-button tabindex="-1" name="forward" label="Skip forward"></wa-icon-button>
</div>
</div>
</wa-card>
<wa-card>
<div class="wa-stack">
<h3 class="wa-heading-m">Chalmun's Spaceport Cantina</h3>
<div class="wa-cluster wa-gap-xs">
<wa-rating value="4.6" read-only></wa-rating>
<strong>4.6</strong>
<span>(419 reviews)</span>
</div>
<div class="wa-cluster wa-gap-xs">
<div class="wa-cluster wa-gap-3xs">
<wa-icon name="dollar" style="color: var(--wa-color-green-60);"></wa-icon>
<wa-icon name="dollar" style="color: var(--wa-color-green-60);"></wa-icon>
<wa-icon name="dollar" style="color: var(--wa-color-green-60);"></wa-icon>
</div>
<span class="wa-caption-m">&bull;</span>
<wa-tag size="small">Cocktail Bar</wa-tag>
<wa-tag size="small">Gastropub</wa-tag>
<wa-tag size="small">Local Fare</wa-tag>
<wa-tag size="small">Gluten Free</wa-tag>
</div>
<div class="wa-flank wa-gap-xs">
<wa-icon name="location-dot"></wa-icon>
<a href="#" class="wa-caption-m" tabindex="-1">Mos Eisley, Tatooine</a>
</div>
</div>
</wa-card>
</div>
</div>

17
docs/_layouts/blank.njk Normal file
View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en" data-fa-kit-code="b10bfbde90" data-cdn-url="{% cdnUrl %}">
<head>
{% include 'head.njk' %}
</head>
<body class="layout-{{ layout | stripExtension }}">
{% block header %}{% endblock %}
{% block content %}
{{ content | safe }}
{% endblock %}
{% block afterContent %}{% endblock %}
</body>
</html>

38
docs/_layouts/block.njk Normal file
View File

@@ -0,0 +1,38 @@
{% set hasSidebar = true %}
{% set hasOutline = true %}
{% extends '../_includes/base.njk' %}
{# Component header #}
{% block header %}
{% include 'breadcrumbs.njk' %}
<h1 class="title">{{ title }}</h1>
<div class="block-info">
{% set snippets = (elements or element or snippets or snippet) | dict %}
{% for snippet, link in snippets %}
{% if snippet %}
<code class="class">
{%- if link -%}
<a href="{{ link }}">{{ snippet }}</a>
{%- else -%}
{{ snippet }}
{%- endif-%}
</code>
{%- endif %}
{% endfor %}
{% include '../_includes/status.njk' %}
</div>
{% if description %}
<p class="summary">
{{ description | inlineMarkdown | safe }}
</p>
{% endif %}
{% block notes %}{% endblock %}
{% endblock %}
{# Content #}
{% block content %}
{{ content | safe }}
{% endblock %}

View File

@@ -1,31 +1,15 @@
{% set hasSidebar = true %}
{% set hasOutline = true %}
{% set component = getComponent('wa-' + page.fileSlug) %}
{% set description = component.summary %}
{% extends '../_includes/base.njk' %}
{% extends '../_layouts/block.njk' %}
{% set component = components[page.fileSlug] %}
{# Component header #}
{% block beforeContent %}
<h1 class="title">{{ title }}</h1>
<div class="component-info">
<code class="component-tag">&lt;{{ component.tagName }}&gt;</code>
<wa-badge variant="neutral">Since {{ component.since }}</wa-badge>
<wa-badge
{% if component.status == 'stable' %}variant="brand"{% endif %}
{% if component.status == 'experimental' %}variant="warning"{% endif %}
>
{{ component.status }}
</wa-badge>
</div>
<p class="component-summary">
{{ component.summary | inlineMarkdown | safe }}
</p>
{% endblock %}
{# Content #}
{% block content %}
{{ content | safe }}
{% block notes %}
{% if native %}
<wa-callout variant="success">
<wa-icon slot="icon" name="lightbulb" variant="regular"></wa-icon>
Just want the styles?
Check out the <a href="/docs/native/{{ native }}/">{{ ('/docs/native/' + native + '/') | getTitleFromUrl }} native styles</a>!
</wa-callout>
{% endif %}
{% endblock %}
{# Component API #}
@@ -33,6 +17,7 @@
{# Slots #}
{% if component.slots.length %}
<h2>Slots</h2>
<p>Learn more about <a href="/docs/usage/#slots">using slots</a>.</p>
<div class="table-scroll">
<table class="component-table">
@@ -62,7 +47,8 @@
{# Properties #}
{% if component.properties.length %}
<h2>Properties</h2>
<h2>Attributes & Properties</h2>
<p>Learn more about <a href="/docs/usage/#attributes-and-properties">attributes and properties</a>.</p>
<div class="table-scroll">
<table class="component-table">
@@ -77,9 +63,9 @@
{% for prop in component.properties %}
<tr>
<td class="table-name">
<code>{{ prop.name }}</code><br>
<code title="JS property">{{ prop.name }}</code><br>
{% if prop.attribute %}
<div><small><code>{{ prop.attribute }}</code></small></div>
<div><small><code title="HTML attribute">{{ prop.attribute }}</code></small></div>
{% endif %}
</td>
<td class="table-description">
@@ -109,6 +95,8 @@
{# Methods #}
{% if component.methods.length %}
<h2>Methods</h2>
<p>Learn more about <a href="/docs/usage/#methods">methods</a>.</p>
<div class="table-scroll">
<table class="component-table">
<thead>
@@ -139,34 +127,10 @@
</div>
{% endif %}
{# States #}
{% if component.states.length %}
<h2>States</h2>
<div class="table-scroll">
<table class="component-table">
<thead>
<tr>
<th class="table-name">Name</th>
<th class="table-description">Description</th>
<th class="table-selector">CSS selector</th>
</tr>
</thead>
<tbody>
{% for state in component.states %}
<tr>
<td class="table-name"><code>{{ state.name }}</code></td>
<td class="table-description">{{ state.description | inlineMarkdown | safe }}</td>
<td class="table-selector"><code>[data-state-{{ state.name }}]</code></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{# Events #}
{% if component.events.length %}
<h2>Events</h2>
<p>Learn more about <a href="/docs/usage/#events">events</a>.</p>
<div class="table-scroll">
<table class="component-table">
@@ -193,6 +157,7 @@
{# Custom Properties #}
{% if component.cssProperties.length %}
<h2>CSS custom properties</h2>
<p>Learn more about <a href="/docs/customizing/#custom-properties">CSS custom properties</a>.</p>
<div class="table-scroll">
<table class="component-table">
@@ -221,9 +186,37 @@
</div>
{% endif %}
{# Custom States #}
{% if component.cssStates.length %}
<h2>Custom States</h2>
<p>Learn more about <a href="/docs/customizing/#custom-states">custom states</a>.</p>
<div class="table-scroll">
<table class="component-table">
<thead>
<tr>
<th class="table-name">Name</th>
<th class="table-description">Description</th>
<th class="table-selector">CSS selector</th>
</tr>
</thead>
<tbody>
{% for state in component.cssStates %}
<tr>
<td class="table-name"><code>{{ state.name }}</code></td>
<td class="table-description">{{ state.description | inlineMarkdown | safe }}</td>
<td class="table-selector"><code>:state({{ state.name }})</code></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{# CSS Parts #}
{% if component.cssParts.length %}
<h2>CSS parts</h2>
<p>Learn more about <a href="/docs/customizing/#css-parts">CSS parts</a>.</p>
<div class="table-scroll">
<table class="component-table">
@@ -249,7 +242,7 @@
{% if component.dependencies.length %}
<h2>Dependencies</h2>
<p>
This component automatically imports the following elements. Subdependencies, if any exist, will also be included in this list.
This component automatically imports the following elements. Sub-dependencies, if any exist, will also be included in this list.
</p>
<ul class="dependency-list">
@@ -266,9 +259,9 @@
</p>
<wa-tab-group label="How would you like to import this component?">
<wa-tab slot="nav" panel="cdn">CDN</wa-tab>
<wa-tab slot="nav" panel="npm">npm</wa-tab>
<wa-tab slot="nav" panel="react">React</wa-tab>
<wa-tab panel="cdn">CDN</wa-tab>
<wa-tab panel="npm">npm</wa-tab>
<wa-tab panel="react">React</wa-tab>
<wa-tab-panel name="cdn">
<p>
To manually import this component from the CDN, use the following code.

24
docs/_layouts/element.njk Normal file
View File

@@ -0,0 +1,24 @@
{% extends '../_layouts/block.njk' %}
{# Component header #}
{% block notes %}
{% if component %}
<wa-callout variant="success">
<wa-icon slot="icon" name="lightbulb" variant="regular"></wa-icon>
Want to do more?
Check out the {% for name in (component | toList) -%}
{{ ' and ' if loop.last and not loop.first }}<a href="/docs/components/{{ name }}"><code>&lt;wa-{{ name }}&gt;</code></a>{{ ', ' if not loop.last }}
{%- endfor %} component{{ 's' if (component | isList) }}</a>!
</wa-callout>
{% endif %}
{% endblock %}
{% block afterContent %}
{# Slots #}
{% if css_file %}
<h2>Using these styles</h2>
<p>If you want to use these styles without using the entirety of Web Awesome Native Styles, you can include the following CSS files:</p>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,25 @@
---
layout: page-outline
tags: ["overview"]
---
{% set forTag = forTag or (page.url | split('/') | last) %}
{% if description %}
<div class="index-summary">{{ description | markdown | safe }}</div>
{% endif %}
<div id="block-filter">
<wa-input type="search" placeholder="Search {{ title }}" clearable autofocus>
<wa-icon slot="prefix" name="search"></wa-icon>
</wa-input>
</div>
{% set allPages = collections[forTag] %}
{% include "grouped-pages.njk" %}
<link href="/assets/styles/filter.css" rel="stylesheet">
<script type="module" src="/assets/scripts/filter.js"></script>
{% if content | trim %}
<br> {# Temp fix for spacing issue #}
{{ content | safe }}
{% endif %}

View File

@@ -1,4 +0,0 @@
{% set hasSidebar = true %}
{% set hasOutline = true %}
{% extends "../_includes/base-wide.njk" %}

View File

@@ -1,4 +1,4 @@
{% set hasSidebar = true %}
{% set hasOutline = true %}
{% set hasOutline = false %}
{% extends "../_includes/base.njk" %}

119
docs/_layouts/palette.njk Normal file
View File

@@ -0,0 +1,119 @@
{% set hasSidebar = true %}
{% set hasOutline = true %}
{# {% set forceTheme = page.fileSlug %} #}
{% extends '../_layouts/block.njk' %}
{% set paletteId = page.fileSlug %}
{% block afterContent %}
<style>@import url('/dist/styles/color/{{ paletteId }}.css') layer(palette.{{ paletteId }});</style>
{% set tints = ["95", "90", "80", "70", "60", "50", "40", "30", "20", "10", "05"] %}
<table class="colors wa-palette-{{ paletteId }}">
<thead>
<tr>
<th></th>
{% for tint in tints -%}
<th>{{ tint }}</th>
{%- endfor %}
</tr>
</thead>
{% for hue in hues -%}
<tr>
<th>{{ hue | capitalize }}</th>
{% for tint in tints -%}
<td>
<div class="color swatch" style="background-color: var(--wa-color-{{ hue }}-{{ tint }})">
<wa-copy-button value="--wa-color-{{ hue }}-{{ tint }}" copy-label="--wa-color-{{ hue }}-{{ tint }}"></wa-copy-button>
</div>
</td>
{%- endfor -%}
</tr>
{%- endfor %}
</table>
<h2>Used By</h2>
<section class="index-grid">
{% for page in collections.theme %}
{%- if page.data.palette == paletteId -%}
{% include "page-card.njk" %}
{%- endif -%}
{% endfor %}
</section>
{% markdown %}
## Color Contrast
Web Awesome color scales are designed to guarantee certain contrast ratios,
both per [WCAG 2.1 success criteria](https://www.w3.org/TR/WCAG21/#contrast-minimum)
as well as the emergent APCA specification _(planned)_,
so you can ensure that text is both legible to all users, and legally conformant.
### Level 1
A difference of `40` ensures a minimum **3:1** contrast ratio, suitable for large text and icons (AA).
{% endmarkdown %}
{% set difference = 40 %}
{% include "contrast-table.njk" %}
{% markdown %}
This also goes for a difference of `45`:
{% endmarkdown %}
{% set difference = 45 %}
{% include "contrast-table.njk" %}
{% markdown %}
### Level 2
A difference of `50` ensures a minimum **4.5:1** contrast ratio, suitable for normal text (AA) and large text (AAA)
{% endmarkdown %}
{% set difference = 50 %}
{% include "contrast-table.njk" %}
{% markdown %}
This also goes for a difference of `55`:
{% endmarkdown %}
{% set difference = 55 %}
{% include "contrast-table.njk" %}
{% markdown %}
### Level 3
A difference of `60` ensures a minimum **7:1** contrast ratio, suitable for all text (AAA)
{% endmarkdown %}
{% set difference = 60 %}
{% include "contrast-table.njk" %}
{% markdown %}
This also goes for a difference of `65`:
{% endmarkdown %}
{% set difference = 65 %}
{% include "contrast-table.njk" %}
{% markdown %}
## How to use this palette
If you are using a Web Awesome theme that uses this palette, it will already be included.
To use a different palette than a theme default, or to use it in a custom theme, you can import this palette directly from the Web Awesome CDN.
{% set stylesheet = 'styles/color/' + page.fileSlug + '.css' %}
{% include 'import-stylesheet-code.md.njk' %}
{% endmarkdown %}
{% endblock %}

87
docs/_layouts/theme.njk Normal file
View File

@@ -0,0 +1,87 @@
{% set hasSidebar = true %}
{% set hasOutline = true %}
{# {% set forceTheme = page.fileSlug %} #}
{% extends '../_includes/base.njk' %}
{% set themeId = page.fileSlug %}
{% if themeId == 'remixed' -%}
{% set themeId = 'default' %}
{% endif -%}
{% block header %}
<iframe src='/docs/themes/{{ themeId }}/demo.html' id="demo"></iframe>
{% if palette -%}
<h2>Default Color Palette</h2>
{% set paletteURL = '/docs/palettes/' + palette + '/' %}
{% set themePage = page %}
{% set page = paletteURL | getCollectionItemFromUrl %}
<div class="index-grid">
{% include 'page-card.njk' %}
</div>
{% set page = themePage %}
{% endif %}
{% endblock %}
{% block afterContent %}
{% markdown %}
{%- if page.fileSlug != 'remixed' %}
## How to use this theme
You can import this theme from the Web Awesome CDN.
{% set stylesheet = 'styles/themes/' + themeId + '.css' %}
{% include 'import-stylesheet-code.md.njk' %}
{% endif %}
## Dark mode
To activate the dark color scheme of the theme on any element and its contents, apply the class `wa-dark` to it.
This means you can use different color schemes throughout the page.
Here, we use the default theme with a dark sidebar:
```html
<html>
<head>
<link rel="stylesheet" href="path/to/web-awesome/dist/styles/themes/default.css" />
</head>
<body>
<nav class="wa-dark">
<!-- dark-themed sidebar -->
</nav>
<!-- light-themed content -->
</body>
</html>
```
You can apply the class to the `<html>` element on your page to activate the dark color scheme for the entire page.
```html
<html class="wa-dark">
<head>
<link rel="stylesheet" href="path/to/web-awesome/dist/styles/themes/{{ page.fileSlug }}.css" />
<!-- other links, scripts, and metadata -->
</head>
<body>
<!-- page content -->
</body>
</html>
```
### Detecting Color Scheme Preference
Web Awesome's themes have both light and dark styles built in.
However, Web Awesome doesn't try to auto-detect the user's light/dark mode preference.
This should be done at the application level.
As a best practice, to provide a dark theme in your app, you should:
- Check for [`prefers-color-scheme`](https://stackoverflow.com/a/57795495/567486) and use its value by default
- Allow the user to override the setting in your app
- Remember the user's preference and restore it on subsequent logins
Web Awesome avoids using the `prefers-color-scheme` media query because not all apps support dark mode, and it would break things for the ones that don't.
{% endmarkdown %}
{% endblock %}

View File

@@ -1,11 +1,11 @@
import { parse } from 'node-html-parser';
import { v4 as uuid } from 'uuid';
import slugify from 'slugify';
import { v4 as uuid } from 'uuid';
function createId(text) {
let slug = slugify(String(text), {
remove: /[^\w|\s]/g,
lower: true
lower: true,
});
// ids must start with a letter
@@ -24,7 +24,7 @@ export function anchorHeadingsPlugin(options = {}) {
container: 'body',
headingSelector: 'h2, h3, h4, h5, h6',
anchorLabel: 'Jump to heading',
...options
...options,
};
return function (eleventyConfig) {
@@ -39,22 +39,26 @@ export function anchorHeadingsPlugin(options = {}) {
// Look for headings
container.querySelectorAll(options.headingSelector).forEach(heading => {
const hasAnchor = heading.querySelector('a');
const existingId = heading.getAttribute('id');
const clone = parse(heading.outerHTML);
// Create a clone of the heading so we can remove [data-no-anchor] elements from the text content
clone.querySelectorAll('[data-no-anchor]').forEach(el => el.remove());
const slug = createId(clone.textContent ?? '') ?? uuid().slice(-12);
let id = slug;
let suffix = 0;
// Make sure the slug is unique in the document
while (doc.getElementById(id) !== null) {
id = `${slug}-${++suffix}`;
if (hasAnchor) {
return;
}
if (hasAnchor || !id) {
return;
let id = existingId;
if (!id) {
const slug = createId(clone.textContent ?? '') ?? uuid().slice(-12);
id = slug;
let suffix = 1;
// Make sure the slug is unique in the document
while (doc.getElementById(id) !== null) {
id = `${slug}-${++suffix}`;
}
}
// Create the anchor
@@ -67,7 +71,9 @@ export function anchorHeadingsPlugin(options = {}) {
anchor.querySelector('.wa-visually-hidden').textContent = options.anchorLabel;
// Update the heading
heading.setAttribute('id', id);
if (!existingId) {
heading.setAttribute('id', id);
}
heading.classList.add('anchor-heading');
heading.appendChild(anchor);
});

View File

@@ -1,82 +1,190 @@
import { parse } from 'node-html-parser';
import { v4 as uuid } from 'uuid';
const templates = {
old(pre, code, { open, buttons, edit }) {
const id = `code-example-${uuid().slice(-12)}`;
let preview = code.textContent;
// Run preview scripts as modules to prevent collisions
const root = parse(preview, { blockTextElements: { script: true } });
root.querySelectorAll('script').forEach(script => script.setAttribute('type', 'module'));
preview = root.toString();
return `
<div class="code-example ${open ? 'open' : ''}">
<div class="code-example-preview">
${preview}
</div>
<div class="code-example-source" id="${id}">
${pre.outerHTML}
</div>
${
buttons
? `
<div class="code-example-buttons">
<button
class="code-example-toggle"
type="button"
aria-expanded="${open ? 'true' : 'false'}"
aria-controls="${id}"
>
Code
<wa-icon name="chevron-down"></wa-icon>
</button>
${
edit
? `
<button class="code-example-pen" type="button">
<wa-icon name="pen-to-square"></wa-icon>
Edit
</button>
`
: ''
}
`
: ''
}
</div>
</div>
`;
},
new(pre, code, { open, first, attributes }) {
attributes = {
open,
include: `link[rel=stylesheet][href^='/dist/']`,
...attributes,
};
const attributesString = Object.entries(attributes)
.map(([key, value]) => {
if (value === true) {
return key;
}
if (value === false || value === null) {
return '';
}
return `${key}="${value}"`;
})
.join(' ');
let includes = '';
if (first) {
includes = `
<template class="wa-code-demo-include-isolated">
<script src="/dist/webawesome.loader.js" type="module"></script>
</template>`;
}
let preview = '';
if (attributes.viewport === undefined) {
// Slot in pre-rendered preview
preview = `<div style="display:contents" slot="preview">${code.textContent}</div>`;
// Run preview scripts as modules to prevent collisions
const root = parse(preview, { blockTextElements: { script: true } });
root.querySelectorAll('script').forEach(script => script.setAttribute('type', 'module'));
preview = root.toString();
}
return `${includes}
<wa-code-demo ${attributesString}>
${preview}
${pre.outerHTML}
</wa-code-demo>
`;
},
};
/**
* Eleventy plugin to turn `<code class="example">` blocks into live examples.
*/
export function codeExamplesPlugin(options = {}) {
options = {
export function codeExamplesPlugin(eleventyConfig, options = {}) {
const defaultOptions = {
container: 'body',
...options
defaultOpen: (code, { outputPathIndex }) => {
return (
outputPathIndex === 1 && // is first
code.textContent.length < 500
); // is short
},
};
options = { ...defaultOptions, ...options };
const stats = {
inputPaths: {},
outputPaths: {},
};
return function (eleventyConfig) {
eleventyConfig.addTransform('code-examples', content => {
const doc = parse(content, { blockTextElements: { code: true } });
const container = doc.querySelector(options.container);
eleventyConfig.addTransform('code-examples', function (content) {
const { inputPath, outputPath } = this.page;
if (!container) {
return content;
const doc = parse(content, { blockTextElements: { code: true } });
const container = doc.querySelector(options.container);
if (!container) {
return content;
}
// Look for external links
container.querySelectorAll('code.example').forEach(code => {
stats.inputPaths[inputPath] ??= 0;
stats.outputPaths[outputPath] ??= 0;
stats.inputPaths[inputPath]++;
stats.outputPaths[outputPath]++;
const pre = code.closest('pre');
const first = stats.inputPaths[inputPath] === 1;
const localOptions = {
...options,
first,
// Modifier defaults
edit: true,
buttons: true,
new: true, // comment this line to default back to the old demos
attributes: {},
};
for (const prop of ['new', 'open', 'buttons', 'edit']) {
if (code.classList.contains(prop)) {
localOptions[prop] = true;
} else if (code.classList.contains(`no-${prop}`)) {
localOptions[prop] = false;
}
}
// Look for external links
container.querySelectorAll('code.example').forEach(code => {
const pre = code.closest('pre');
const hasButtons = !code.classList.contains('no-buttons');
const isOpen = code.classList.contains('open') || !hasButtons;
const noEdit = code.classList.contains('no-edit');
const id = `code-example-${uuid().slice(-12)}`;
let preview = pre.textContent;
for (const attribute of ['viewport', 'include']) {
if (code.hasAttribute(attribute)) {
localOptions.attributes[attribute] = code.getAttribute(attribute);
code.removeAttribute(attribute);
}
}
// Run preview scripts as modules to prevent collisions
const root = parse(preview, { blockTextElements: { script: true } });
root.querySelectorAll('script').forEach(script => script.setAttribute('type', 'module'));
preview = root.toString();
if (Object.keys(localOptions.attributes).length > 0) {
// attributes only work on the new syntax
localOptions.new = true;
}
const codeExample = parse(`
<div class="code-example ${isOpen ? 'open' : ''}">
<div class="code-example-preview">
${preview}
</div>
<div class="code-example-source" id="${id}">
${pre.outerHTML}
</div>
${
hasButtons
? `
<div class="code-example-buttons">
<button
class="code-example-toggle"
type="button"
aria-expanded="${isOpen ? 'true' : 'false'}"
aria-controls="${id}"
>
Code
<wa-icon name="chevron-down"></wa-icon>
</button>
if (localOptions.open === undefined) {
if (localOptions.defaultOpen === true) {
localOptions.open = localOptions.defaultOpen;
} else if (typeof localOptions.defaultOpen === 'function') {
localOptions.open = localOptions.defaultOpen(code, {
pre,
inputPathIndex: stats.inputPaths[inputPath],
outputPathIndex: stats.outputPaths[outputPath],
});
}
}
${
noEdit
? ''
: `
<button class="code-example-pen" type="button">
<wa-icon name="pen-to-square"></wa-icon>
Edit
</button>
`
}
const template = localOptions.new ? 'new' : 'old';
const codeExample = parse(templates[template](pre, code, localOptions));
`
: ''
}
</div>
</div>
`);
pre.replaceWith(codeExample);
});
return doc.toString();
pre.replaceWith(codeExample);
});
};
return doc.toString();
});
}

View File

@@ -6,7 +6,7 @@ import { parse } from 'node-html-parser';
export function copyCodePlugin(options = {}) {
options = {
container: 'body',
...options
...options,
};
return function (eleventyConfig) {

View File

@@ -28,7 +28,7 @@ export function currentLink(options = {}) {
options = {
container: 'body',
className: 'current',
...options
...options,
};
return function (eleventyConfig) {

284
docs/_utils/filters.js Normal file
View File

@@ -0,0 +1,284 @@
import { parse } from 'path';
export function stripExtension(string) {
return parse(string).name;
}
export function stripPrefix(content) {
return content.replace(/^wa-/, '');
}
// Trims whitespace and pipes from the start and end of a string. Useful for CEM types, which can be pipe-delimited.
// With Prettier 3, this means a leading pipe will exist be present when the line wraps.
export function trimPipes(content) {
return typeof content === 'string' ? content.replace(/^(\s|\|)/g, '').replace(/(\s|\|)$/g, '') : content;
}
export function keys(obj) {
return Object.keys(obj);
}
export function log(firstArg, ...rest) {
console.log(firstArg, ...rest);
return firstArg;
}
function getCollection(name) {
// From https://github.com/11ty/eleventy/blob/d3d24ccddb804e6e14773501d8c4e07e2c4b9c2b/src/Filters/GetLocaleCollectionItem.js#L39-L43
return this.collections?.[name] || this.ctx?.collections?.[name] || this.context?.environments?.collections?.[name];
}
export function getCollectionItemFromUrl(url, collection) {
collection ??= getCollection.call(this, 'all') || [];
return collection.find(item => item.url === url);
}
export function getTitleFromUrl(url, collection) {
const item = getCollectionItemFromUrl.call(this, url, collection);
return item?.data.title || '';
}
export function split(text, separator) {
return (text + '').split(separator).filter(Boolean);
}
export function breadcrumbs(url, { withCurrent = false } = {}) {
const parts = split(url, '/');
const ret = [];
while (parts.length) {
let partialUrl = '/' + parts.join('/') + '/';
let item = getCollectionItemFromUrl.call(this, partialUrl);
if (item && (partialUrl !== url || withCurrent)) {
let title = item.data.title;
if (title) {
ret.unshift({ url: partialUrl, title });
}
}
parts.pop();
if (item?.data.parent) {
let parentURL = item.data.parent;
if (!item.data.parent.startsWith('/')) {
// Parent is in the same directory
parts.push(item.data.parent);
parentURL = '/' + parts.join('/') + '/';
}
let parentBreadcrumbs = breadcrumbs.call(this, parentURL, { withCurrent: true });
return [...parentBreadcrumbs, ...ret];
}
}
return ret;
}
export function isObject(value) {
return typeof value === 'object' && value !== null && !Array.isArray(value);
}
export function isList(value) {
return Array.isArray(value) || value instanceof Set;
}
/** Get an Array or Set */
export function toList(value) {
return isList(value) ? value : [value];
}
/**
* Convert any value to something that can be iterated over with a for key, value loop.
* Arrays and sets will be converted to a Map of value -> undefined
*/
export function dict(value) {
if (value instanceof Map || isObject(value)) {
return value;
}
let list = toList(value);
return new Map([...list].map(item => [item, undefined]));
}
export function deepValue(obj, key) {
key = Array.isArray(key) ? key : key.split('.');
return key.reduce((subObj, property) => subObj?.[property], obj);
}
export function number(value, options) {
if (typeof value !== 'number' && isNaN(value)) {
return value;
}
let lang = options?.lang ?? 'en';
if (options?.lang) {
delete options.lang;
}
if (!options || Object.keys(options).length === 0) {
options = { maximumSignificantDigits: 3 };
}
return Number(value).toLocaleString(lang, options);
}
export function isNumeric(value) {
return typeof value === 'number' || (typeof value === 'string' && !isNaN(value));
}
export function isString(value) {
return typeof value === 'string';
}
export function isEmpty(value) {
return value === null || value === undefined || value === '';
}
function compare(a, b) {
let isEmptyA = isEmpty(a);
let isEmptyB = isEmpty(b);
if (isEmptyA) {
if (isEmptyB) {
return 0;
} else {
return 1;
}
} else if (isEmptyB) {
return -1;
}
// Both strings, and at least one non-numeric
if (isNumeric(a) || isNumeric(b)) {
return a - b;
}
return (a + '').localeCompare(b);
}
/** Sort an array of objects by one or more of their properties */
export function sort(arr, by = { 'data.order': 1, 'data.title': '' }) {
let keys = Array.isArray(by) ? by : Object.keys(by);
return arr.sort((a, b) => {
let aValues = keys.map(key => deepValue(a, key) ?? by[key]);
let bValues = keys.map(key => deepValue(b, key) ?? by[key]);
for (let i = 0; i < aValues.length; i++) {
let aVal = aValues[i];
let bVal = bValues[i];
let result = compare(aVal, bVal);
// They are not equal in terms of comparison OR we're at the last key
if (result !== 0 || i === aValues.length - 1) {
return result;
}
}
});
}
/**
* Group an 11ty collection (or any array of objects with a `data.tags` property) by certain tags.
* @param {object[]} collection
* @param { Object<string, string> | (string | Object<string, string>)[]} [tags] The tags to group by. If not provided/empty, defaults to grouping by all tags.
* @returns { Object.<string, object[]> } An object with keys for each tag, and an array of items for each tag.
*/
export function groupByTags(collection, tags) {
if (!collection) {
console.error(`Empty collection passed to groupByTags() to group by ${JSON.stringify(tags)}`);
}
if (!tags) {
// Default to grouping by union of all tags
tags = Array.from(new Set(collection.flatMap(item => item.data.tags)));
} else if (Array.isArray(tags)) {
// May contain objects of one-off tag -> label mappings
tags = tags.map(tag => (typeof tag === 'object' ? Object.keys(tag)[0] : tag));
} else if (typeof tags === 'object') {
// tags is an object of tags to labels, so we just want the keys
tags = Object.keys(tags);
}
let ret = Object.fromEntries(tags.map(tag => [tag, []]));
ret.other = [];
for (let item of collection) {
let categorized = false;
for (let tag of tags) {
if (item.data.tags.includes(tag)) {
ret[tag].push(item);
categorized = true;
}
}
if (!categorized) {
ret.other.push(item);
}
}
// Remove empty categories
for (let category in ret) {
if (ret[category].length === 0) {
delete ret[category];
}
}
return ret;
}
export function getCategoryTitle(category, categories) {
let title;
if (Array.isArray(categories)) {
// Find relevant entry
// [{id: "Title"}, id2, ...]
title = categories.find(entry => typeof entry === 'object' && entry?.[category])?.[category];
} else if (typeof categories === 'object') {
// {id: "Title", id2: "Title 2", ...}
title = categories[category];
}
if (title) {
return title;
}
// Capitalized
return category.charAt(0).toUpperCase() + category.slice(1);
}
const IDENTITY = x => x;
/**
* Helper to print out one or more HTML attributes, especially conditional ones.
* Usage in 11ty:
* - Single attribute: `<foo{{ value | attr(name) }}>`
* - Multiple attributes: `<foo{{ { name1: value1, name2: value2 } | attr }}>`
*
* @overload
* @param {any} value - The attribute value If falsey, the attribute is not printed. If `true` the attribute is printed without a value.
* @param {string} name - The name of the attribute
*
* @overload
* @param {Object<string, any>} obj - Map of attribute names to values
*
* @returns {string} The attribute string. No `| safe` is needed.
*/
export function attr(value, name) {
const safe = this?.env.filters.safe ?? IDENTITY;
if (arguments.length === 1 && value && typeof value === 'object') {
// Called with a single object argument of names to values
let ret = Object.entries(obj)
.map(([name, value]) => attr(value, name))
.join('');
return safe(ret);
}
if (!value) {
// false, "", null, undefined
return '';
}
let ret = ' ' + name + (value === true ? '' : `="${value}"`);
return safe(ret);
}

View File

@@ -11,7 +11,7 @@ import defaultOptions from '../../prettier.config.js';
export async function formatCode(string, options) {
return await format(string, {
...defaultOptions,
...options
...options,
});
}
@@ -21,7 +21,7 @@ export async function formatCode(string, options) {
export function formatCodePlugin(options = {}) {
options = {
parser: 'html',
...options
...options,
};
return function (eleventyConfig) {

View File

@@ -1,8 +1,8 @@
/* eslint sort-imports-es6-autofix/sort-imports-es6: 0 */
import { parse } from 'node-html-parser';
import Prism from 'prismjs';
import 'prismjs/plugins/custom-class/prism-custom-class.js';
import PrismLoader from 'prismjs/components/index.js';
import 'prismjs/plugins/custom-class/prism-custom-class.js';
PrismLoader('diff');
PrismLoader.silent = true;
@@ -40,7 +40,7 @@ export function highlightCode(code, language = 'plain') {
export function highlightCodePlugin(options = {}) {
options = {
container: 'body',
...options
...options,
};
return function (eleventyConfig) {

View File

@@ -1,71 +0,0 @@
import { fileURLToPath } from 'url';
import { dirname, resolve } from 'path';
import { readFileSync } from 'fs';
const __dirname = dirname(fileURLToPath(import.meta.url));
const manifest = JSON.parse(readFileSync(resolve(__dirname, '../../dist/custom-elements.json'), 'utf-8'));
/**
* @returns Fetches components from custom-elements.json and returns them in more sane format.
*/
export function getComponents() {
const components = [];
manifest.modules?.forEach(module => {
module.declarations?.forEach(declaration => {
if (declaration.customElement) {
// Generate the dist path based on the src path and attach it to the component
declaration.path = module.path.replace(/^src\//, 'dist/').replace(/\.ts$/, '.js');
// Remove private members and those that lack a description
const members = declaration.members?.filter(member => member.description && member.privacy !== 'private');
const methods = members?.filter(prop => prop.kind === 'method' && prop.privacy !== 'private');
const properties = members?.filter(prop => {
// Look for a corresponding attribute
const attribute = declaration.attributes?.find(attr => attr.fieldName === prop.name);
if (attribute) {
prop.attribute = attribute.name || attribute.fieldName;
}
return prop.kind === 'field' && prop.privacy !== 'private';
});
components.push({
...declaration,
methods,
properties
});
}
});
});
// Build dependency graphs
components.forEach(component => {
const dependencies = [];
// Recursively fetch sub-dependencies
function getDependencies(tag) {
const cmp = components.find(c => c.tagName === tag);
if (!cmp || !Array.isArray(component.dependencies)) {
return;
}
cmp.dependencies?.forEach(dependentTag => {
if (!dependencies.includes(dependentTag)) {
dependencies.push(dependentTag);
}
getDependencies(dependentTag);
});
}
getDependencies(component.tagName);
component.dependencies = dependencies.sort();
});
// Sort by name
return components.sort((a, b) => {
if (a.name < b.name) return -1;
if (a.name > b.name) return 1;
return 0;
});
}

View File

@@ -14,7 +14,7 @@ export const markdown = MarkdownIt({
breaks: false,
langPrefix: 'language-',
linkify: false,
typographer: false
typographer: false,
});
markdown.use(markdownItIns);
@@ -34,7 +34,7 @@ markdown.use(markdownItMark);
`;
}
return '</div></div>\n';
}
},
});
});
@@ -44,7 +44,7 @@ markdown.use(markdownItContainer, 'aside', {
return `<aside>`;
}
return '</aside>\n';
}
},
});
markdown.use(markdownItContainer, 'details', {
@@ -55,9 +55,9 @@ markdown.use(markdownItContainer, 'details', {
return `<details>\n<summary><span>${markdown.utils.escapeHtml(m[1])}</span></summary>\n`;
}
return '</details>\n';
}
},
});
markdown.use(markdownItAttrs, {
allowedAttributes: ['id', 'class', 'data']
allowedAttributes: [],
});

View File

@@ -15,7 +15,7 @@ export function outlinePlugin(options = {}) {
target: '.outline',
selector: 'h2,h3',
ifEmpty: () => null,
...options
...options,
};
return function (eleventyConfig) {

View File

@@ -0,0 +1,23 @@
import { parse } from 'node-html-parser';
/**
* Eleventy plugin to add remove elements with <div data-alpha="remove"> from the alpha build.
*/
export function removeDataAlphaElements(options = {}) {
options = {
isAlpha: false,
...options,
};
return function (eleventyConfig) {
eleventyConfig.addTransform('remove-data-alpha-elements', content => {
const doc = parse(content, { blockTextElements: { code: true } });
if (options.isAlpha) {
doc.querySelectorAll('[data-alpha="remove"]').forEach(el => el.remove());
}
return doc.toString();
});
};
}

View File

@@ -1,8 +1,8 @@
/* eslint-disable no-invalid-this */
import { dirname, join } from 'path';
import { mkdir, writeFile } from 'fs/promises';
import { parse } from 'node-html-parser';
import lunr from 'lunr';
import { parse } from 'node-html-parser';
import { dirname, join } from 'path';
function collapseWhitespace(string) {
return string.replace(/\s+/g, ' ');
@@ -19,7 +19,7 @@ export function searchPlugin(options = {}) {
getDescription: doc => doc.querySelector('meta[name="description"]')?.getAttribute('content') ?? '',
getHeadings: doc => [...doc.querySelectorAll('h1, h2, h3, h4, h5, h6')].map(heading => heading.textContent ?? ''),
getContent: doc => doc.querySelector('body')?.textContent ?? '',
...options
...options,
};
return function (eleventyConfig) {
@@ -32,8 +32,8 @@ export function searchPlugin(options = {}) {
noscript: false,
style: false,
pre: false,
code: false
}
code: false,
},
});
// Remove content that shouldn't be searchable to reduce the index size
@@ -46,7 +46,7 @@ export function searchPlugin(options = {}) {
description: collapseWhitespace(options.getDescription(doc)),
headings: options.getHeadings(doc).map(collapseWhitespace),
content: collapseWhitespace(options.getContent(doc)),
url: this.page.url === '/' ? '/' : this.page.url.replace(/\/$/, '')
url: this.page.url === '/' ? '/' : this.page.url.replace(/\/$/, ''),
});
return content;

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 698 KiB

After

Width:  |  Height:  |  Size: 698 KiB

View File

Before

Width:  |  Height:  |  Size: 241 KiB

After

Width:  |  Height:  |  Size: 241 KiB

View File

Before

Width:  |  Height:  |  Size: 786 KiB

After

Width:  |  Height:  |  Size: 786 KiB

View File

Before

Width:  |  Height:  |  Size: 716 KiB

After

Width:  |  Height:  |  Size: 716 KiB

View File

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 148 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 438 KiB

After

Width:  |  Height:  |  Size: 438 KiB

View File

@@ -1,3 +1,3 @@
<svg viewBox="0 0 20 16" xmlns="http://www.w3.org/2000/svg" fill="#f68a4c">
<path d="M11.63 1.625C11.63 2.27911 11.2435 2.84296 10.6865 3.10064L14 6L17.2622 5.34755C17.0968 5.10642 17 4.81452 17 4.5C17 3.67157 17.6716 3 18.5 3C19.3284 3 20 3.67157 20 4.5C20 5.31157 19.3555 5.9726 18.5504 5.99917L15.0307 13.8207C14.7077 14.5384 13.9939 15 13.2068 15H6.79317C6.00615 15 5.29229 14.5384 4.96933 13.8207L1.44963 5.99917C0.64452 5.9726 0 5.31157 0 4.5C0 3.67157 0.671573 3 1.5 3C2.32843 3 3 3.67157 3 4.5C3 4.81452 2.9032 5.10642 2.73777 5.34755L6 6L9.31702 3.09761C8.76346 2.83855 8.38 2.27656 8.38 1.625C8.38 0.727537 9.10754 0 10.005 0C10.9025 0 11.63 0.727537 11.63 1.625Z"/>
</svg>
<svg width="20" height="15" viewBox="0 0 20 15" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.63 1.625C11.63 2.27911 11.2435 2.84296 10.6865 3.10064L14 6L17.2622 5.34755C17.0968 5.10642 17 4.81452 17 4.5C17 3.67157 17.6716 3 18.5 3C19.3284 3 20 3.67157 20 4.5C20 5.31157 19.3555 5.9726 18.5504 5.99917L15.0307 13.8207C14.7077 14.5384 13.9939 15 13.2068 15H6.79317C6.00615 15 5.29229 14.5384 4.96933 13.8207L1.44963 5.99917C0.64452 5.9726 0 5.31157 0 4.5C0 3.67157 0.671573 3 1.5 3C2.32843 3 3 3.67157 3 4.5C3 4.81452 2.9032 5.10642 2.73777 5.34755L6 6L9.31702 3.09761C8.76346 2.83855 8.38 2.27656 8.38 1.625C8.38 0.727537 9.10754 0 10.005 0C10.9025 0 11.63 0.727537 11.63 1.625Z" fill="var(--wa-brand-orange, #f36944)"/>
</svg>

Before

Width:  |  Height:  |  Size: 684 B

After

Width:  |  Height:  |  Size: 742 B

View File

@@ -18,10 +18,11 @@ document.addEventListener('click', event => {
const cdnUrl = document.documentElement.dataset.cdnUrl;
const html =
`<script type="module" src="${cdnUrl}webawesome.loader.js"></script>\n` +
`<link rel="stylesheet" href="${cdnUrl}themes/default.css">\n\n` +
`<link rel="stylesheet" href="${cdnUrl}themes/applied.css">\n\n` +
`<link rel="stylesheet" href="${cdnUrl}styles/themes/default.css">\n` +
`<link rel="stylesheet" href="${cdnUrl}styles/webawesome.css">\n` +
`<link rel="stylesheet" href="${cdnUrl}styles/utilities.css">\n\n` +
`${code.textContent}`;
const css = 'body {\n font: 16px sans-serif;\n padding: 2rem;\n}';
const css = 'html > body {\n padding: 2rem !important;\n}';
const js = '';
const form = document.createElement('form');
@@ -42,7 +43,7 @@ document.addEventListener('click', event => {
js_pre_processor: 'none',
html,
css,
js
js,
};
const input = document.createElement('input');

View File

@@ -1,59 +0,0 @@
//
// Color scheme selector
//
(() => {
function setColorScheme(newColorScheme) {
colorScheme = newColorScheme;
localStorage.setItem('colorScheme', colorScheme);
const presetTheme = window.getPresetTheme();
// Update the UI
updateSelection();
// Toggle the dark mode class
document.documentElement.classList.toggle(`wa-theme-${presetTheme}-dark`, window.isDark());
}
function updateSelection() {
const menu = document.querySelector('#color-scheme-selector wa-menu');
if (!menu) return;
[...menu.querySelectorAll('wa-menu-item')].forEach(async item => {
await customElements.whenDefined(item.localName);
await item.updateComplete;
item.checked = item.getAttribute('value') === colorScheme;
});
}
let colorScheme = window.getColorScheme();
// Selection is not preserved when changing page, so update when opening dropdown
document.addEventListener('wa-show', event => {
const colorSchemeSelector = event.target.closest('#color-scheme-selector');
if (!colorSchemeSelector) return;
updateSelection();
});
// Listen for selections
document.addEventListener('wa-select', event => {
const menu = event.target.closest('#color-scheme-selector wa-menu');
if (!menu) return;
setColorScheme(event.detail.item.value);
});
// Update the color scheme when the preference changes
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => setColorScheme(colorScheme));
// Toggle with backslash
document.addEventListener('keydown', event => {
if (
event.key === '\\' &&
!event.composedPath().some(el => ['input', 'textarea'].includes(el?.tagName?.toLowerCase()))
) {
event.preventDefault();
setColorScheme(window.isDark() ? 'light' : 'dark');
}
});
// Set the initial color scheme and sync the UI
setColorScheme(colorScheme);
})();

View File

@@ -0,0 +1,25 @@
function updateResults(input) {
const filter = input.value.toLowerCase().trim();
let filtered = Boolean(filter);
for (let grid of document.querySelectorAll('.index-grid')) {
grid.classList.toggle('filtered', filtered);
for (let item of grid.querySelectorAll('a:has(> wa-card)')) {
let isMatch = true;
if (filter) {
const content = item.textContent.toLowerCase() + ' ' + (item.getAttribute('data-keywords') + ' ');
isMatch = content.includes(filter);
}
item.hidden = !isMatch;
}
}
}
document.documentElement.addEventListener('input', e => {
if (e.target?.matches('#block-filter wa-input')) {
updateResults(e.target);
}
});

View File

@@ -79,8 +79,8 @@
diffViewer.appendChild(
createDiff({
serverHTML,
clientHTML
})
clientHTML,
}),
);
});
}
@@ -88,7 +88,7 @@
function createDiff({ serverHTML, clientHTML }) {
const diff = diffLines(serverHTML, clientHTML, {
ignoreWhitespace: false,
newLineIsToken: true
newLineIsToken: true,
});
const fragment = document.createDocumentFragment();
for (var i = 0; i < diff.length; i++) {

View File

@@ -0,0 +1,52 @@
import { domChange, nextFrame, ThemeAspect } from './theme-picker.js';
const presetTheme = new ThemeAspect({
defaultValue: 'default',
key: 'presetTheme',
picker: 'wa-select.preset-theme-selector',
applyChange(options = {}) {
const oldStylesheets = [...document.querySelectorAll('#theme-stylesheet')];
const oldStylesheet = oldStylesheets.pop();
if (oldStylesheets.length > 0) {
// Remove all but the last one
for (let stylesheet of oldStylesheets) {
stylesheet.remove();
}
}
const href = `/dist/styles/themes/${this.value}.css`;
if (!oldStylesheet || oldStylesheet.getAttribute('href') !== href) {
const newStylesheet = document.createElement('link');
Object.assign(newStylesheet, { href, id: 'theme-stylesheet', rel: 'preload', as: 'style' });
oldStylesheet.after(newStylesheet);
newStylesheet.addEventListener(
'load',
e => {
domChange(
async instant => {
// Swap stylesheets
newStylesheet.rel = 'stylesheet';
if (instant) {
// If no VT, delay by 1 frame to make it smoother
await nextFrame();
}
oldStylesheet.remove();
},
{ behavior: 'smooth', ...options },
);
},
{ once: true },
);
}
},
});
window.addEventListener('turbo:render', e => {
presetTheme.applyChange({ behavior: 'instant' });
});

View File

@@ -1,86 +0,0 @@
//
// Preset theme selector
//
(() => {
function setPresetTheme(newPresetTheme) {
presetTheme = newPresetTheme;
localStorage.setItem('presetTheme', presetTheme);
const stylesheet = document.getElementById('theme-stylesheet');
const newStylesheet = Object.assign(document.createElement('link'), {
href: `/dist/themes/${presetTheme}.css`,
rel: 'preload',
as: 'style'
});
newStylesheet.addEventListener(
'load',
() => {
newStylesheet.rel = 'stylesheet';
newStylesheet.id = stylesheet.id;
requestAnimationFrame(() => {
stylesheet.remove();
});
},
{ once: true }
);
document.head.append(newStylesheet);
// Update the UI
updateSelection();
// Toggle the dark mode class
document.documentElement.classList.toggle(`wa-theme-${presetTheme}-dark`, window.isDark());
}
function updateSelection(container = document) {
const menu = container.querySelector('#preset-theme-selector wa-menu');
if (!menu) return;
[...menu.querySelectorAll('wa-menu-item')].forEach(async item => {
const isChecked = item.getAttribute('value') === presetTheme;
if (isChecked) {
container.querySelector('#preset-theme-selector__text').textContent = item.innerText;
}
await customElements.whenDefined(item.localName);
await item.updateComplete;
item.checked = isChecked;
});
}
let presetTheme = window.getPresetTheme();
// Selection is not preserved when changing page, so update when opening dropdown
document.addEventListener('wa-show', event => {
const presetThemeSelector = event.target.closest('#preset-theme-selector');
if (!presetThemeSelector) return;
updateSelection();
});
// Listen for selections
document.addEventListener('wa-select', event => {
const menu = event.target.closest('#preset-theme-selector wa-menu');
if (!menu) return;
setPresetTheme(event.detail.item.value);
});
// Update the color scheme when the preference changes
window.matchMedia('(prefers-preset-theme: dark)').addEventListener('change', () => setPresetTheme(presetTheme));
updateSelection();
/**
* Without this, there's a flash of the incorrect preset theme.
*/
function updateSelectionBeforeTurboLoad(e) {
const newElement = e.detail.newBody || e.detail.newFrame || e.detail.newStream;
if (!newElement) {
return;
}
updateSelection(newElement);
}
['turbo:before-render', 'turbo:before-stream-render', 'turbo:before-frame-render'].forEach(eventName => {
document.addEventListener(eventName, updateSelectionBeforeTurboLoad);
});
})();

View File

@@ -1,13 +1,14 @@
// Smooth links
document.addEventListener('click', event => {
const link = event.target.closest('a');
const id = (link?.hash ?? '').substr(1);
if (!link || link.getAttribute('data-smooth-link') === 'off') {
return;
}
if (id) {
const id = (link.hash ?? '').substr(1);
// Only handle smooth scroll if there's a hash and the link points to the current page
if (id && link.pathname === window.location.pathname) {
const target = document.getElementById(id);
const headerHeight = document.querySelector('wa-page > header').clientHeight;
@@ -15,7 +16,7 @@ document.addEventListener('click', event => {
event.preventDefault();
window.scroll({
top: target.offsetTop - headerHeight,
behavior: 'smooth'
behavior: 'smooth',
});
history.pushState(undefined, undefined, `#${id}`);
}

View File

@@ -9,7 +9,8 @@ const icons = {
component: 'puzzle-piece',
document: 'file',
home: 'house',
theme: 'palette'
native: 'code',
theme: 'palette',
};
let searchTimeout;
@@ -18,7 +19,7 @@ function getElements() {
return {
dialog: document.getElementById('site-search'),
input: document.getElementById('site-search-input'),
results: document.getElementById('site-search-listbox')
results: document.getElementById('site-search-listbox'),
};
}
@@ -166,6 +167,7 @@ async function updateResults(query = '') {
li.setAttribute('data-selected', index === 0 ? 'true' : 'false');
if (page.url === '/') icon = icons.home;
if (page.url.startsWith('/docs/native')) icon = icons.native;
if (page.url.startsWith('/docs/components')) icon = icons.component;
if (page.url.startsWith('/docs/theme') || page.url.startsWith('/docs/restyle')) icon = icons.theme;

View File

@@ -0,0 +1,37 @@
/**
* Sync iframe height with its content page (for same-origin iframes)
* NOT CURRENTLY USED ANYWHERE
*/
for (let iframe of document.querySelectorAll('iframe')) {
if (iframe.contentDocument) {
// Already loaded
syncIframeHeight(iframe);
}
iframe.onload = () => {
console.log('iframe loaded');
if (iframe.contentDocument) {
// Same origin
iframe.contentWindow.iframe = iframe;
syncIframeHeight(iframe);
const resizeObserver = new ResizeObserver(entries => {
for (let entry of entries) {
if (entry.target === iframe.contentDocument.body) {
syncIframeHeight(iframe);
}
}
});
resizeObserver.observe(iframe.contentDocument.body);
window.addEventListener('turbo:render', syncIframeHeight(iframe));
}
};
}
function syncIframeHeight(iframe) {
iframe.style.height = '0px';
requestAnimationFrame(() => {
iframe.style.height = iframe.contentDocument.body.scrollHeight + 'px';
});
}

View File

@@ -0,0 +1,119 @@
// Helper for view transitions
export function domChange(fn, { behavior = 'smooth' } = {}) {
const canUseViewTransitions =
document.startViewTransition && !window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (canUseViewTransitions && behavior === 'smooth') {
document.startViewTransition(fn);
} else {
fn(true);
}
}
export function nextFrame() {
return new Promise(resolve => requestAnimationFrame(resolve));
}
export class ThemeAspect {
constructor(options) {
Object.assign(this, options);
this.set();
// Update when local storage changes.
// That way changes in one window will propagate to others (including iframes).
window.addEventListener('storage', event => {
if (event.key === this.key) {
this.set();
}
});
// Listen for selections
document.addEventListener('change', event => {
const picker = event.target.closest(this.picker);
if (picker) {
this.set(picker.value);
}
});
['turbo:before-render', 'turbo:before-stream-render', 'turbo:before-frame-render'].forEach(eventName => {
document.addEventListener(eventName, e => {
const newElement = e.detail.newBody || e.detail.newFrame || e.detail.newStream;
if (newElement) {
this.syncUI(newElement);
}
});
});
}
get() {
return localStorage.getItem(this.key) ?? this.defaultValue;
}
computed = {};
get computedValue() {
if (this.value in this.computed) {
return this.computed[this.value];
}
return this.value;
}
set(value = this.get()) {
if (value === this.value) {
return;
}
this.value = value;
if (this.value === this.defaultValue) {
localStorage.removeItem(this.key);
} else {
localStorage.setItem(this.key, this.value);
}
this.applyChange();
this.syncUI();
}
syncUI(container = document) {
for (let picker of container.querySelectorAll(this.picker)) {
picker.setAttribute('value', this.value);
picker.value = this.value;
}
}
}
const colorScheme = new ThemeAspect({
defaultValue: 'auto',
key: 'colorScheme',
picker: 'wa-select.color-scheme-selector',
computed: {
get auto() {
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
},
},
applyChange() {
// Toggle the dark mode class
domChange(() => {
let dark = this.computedValue === 'dark';
document.documentElement.classList.toggle(`wa-dark`, dark);
});
},
});
// Update the color scheme when the preference changes
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => colorScheme.set());
// Toggle color scheme with backslash
document.addEventListener('keydown', event => {
if (
event.key === '\\' &&
!event.composedPath().some(el => ['input', 'textarea'].includes(el?.tagName?.toLowerCase()))
) {
event.preventDefault();
colorScheme.set(theming.colorScheme.resolvedValue === 'dark' ? 'light' : 'dark');
}
});

View File

@@ -9,7 +9,7 @@ function saveScrollPosition() {
if (element.id) {
positions[element.id] = {
top: element.scrollTop,
left: element.scrollLeft
left: element.scrollLeft,
};
} else {
console.warn(`Can't save scroll position for elements without an id.`, el);

View File

@@ -1,6 +1,6 @@
.code-example {
border: var(--wa-border-style) var(--wa-panel-border-width) var(--wa-color-neutral-border-quiet);
border-radius: var(--wa-border-radius-m);
border-radius: var(--wa-border-radius-l);
color: var(--wa-color-text-normal);
margin-block-end: var(--wa-flow-spacing);
}
@@ -41,8 +41,8 @@
border-bottom: none;
pre {
border-bottom-right-radius: var(--wa-border-radius-m);
border-bottom-left-radius: var(--wa-border-radius-m);
border-bottom-right-radius: var(--wa-border-radius-l);
border-bottom-left-radius: var(--wa-border-radius-l);
}
}
@@ -62,11 +62,11 @@
&:first-of-type {
border-left: none;
border-bottom-left-radius: var(--wa-border-radius-m);
border-bottom-left-radius: var(--wa-border-radius-l);
}
&:last-of-type {
border-bottom-right-radius: var(--wa-border-radius-m);
border-bottom-right-radius: var(--wa-border-radius-l);
}
&:focus-visible {

View File

@@ -1,6 +1,12 @@
pre {
background-color: var(--wa-color-gray-20);
color: white;
/* Ensures a discernible background color in dark mode
* Useful for themes that use gray-20 as --wa-color-surface-default */
.wa-dark & {
background-color: var(--wa-color-surface-lowered);
}
}
.code-comment,
.code-prolog,

View File

@@ -6,7 +6,7 @@ wa-copy-button.copy-button {
right: 0.25rem;
font-family: var(--wa-font-family-body);
color: var(--wa-color-gray-80);
border-radius: var(--wa-border-radius-s);
border-radius: var(--wa-border-radius-m);
padding: 0.25rem;
&:hover {

View File

@@ -10,8 +10,8 @@
--wa-brand-grey: #30323b;
}
html.wa-theme-default-dark .only-light,
html:not(.wa-theme-default-dark) .only-dark {
.wa-dark .only-light,
.only-dark:not(.wa-dark, .wa-dark *) {
display: none;
}
@@ -22,15 +22,18 @@ wa-page {
/* Header */
wa-page::part(header) {
background-color: var(--wa-color-surface-default);
border-bottom: var(--wa-border-style) var(--wa-panel-border-width) var(--wa-color-neutral-border-quiet);
border-bottom: var(--wa-border-style) var(--wa-panel-border-width) var(--wa-color-surface-border);
}
wa-page::part(body) {
padding-top: 0px;
}
wa-page::part(header-actions) {
align-self: center;
}
wa-page > header {
flex: 1 1 auto;
display: flex;
align-items: center;
justify-content: space-between;
height: 4rem;
padding-inline: var(--wa-space-xl);
a[href='/'] {
@@ -39,7 +42,8 @@ wa-page > header {
}
wa-button[data-toggle-nav] {
--label-color: currentColor;
--text-color: currentColor;
font-size: 1rem;
margin-inline-start: -0.875rem;
margin-inline-end: 0;
@@ -68,14 +72,12 @@ wa-page > header {
margin-block-start: var(--wa-space-2xs);
}
#version-number + wa-badge {
--background-color: var(--wa-color-warning-fill-quiet);
--content-color: var(--wa-color-warning-on-quiet);
font-size: var(--wa-font-size-2xs);
text-transform: uppercase;
}
wa-button#search-trigger {
--background-color: var(--wa-form-control-background-color);
--border-color: var(--wa-form-control-resting-color);
--border-color: var(--wa-form-control-border-color);
}
#search-trigger kbd {
font-size: var(--wa-font-size-2xs);
@@ -87,11 +89,20 @@ wa-page > header {
#outline {
h2 {
font-size: var(--wa-font-size-m);
margin-block-end: var(--wa-space-m);
margin: 0;
}
h2:not(:first-of-type) {
margin-block-start: var(--wa-space-xl);
h2:not(:first-child),
wa-details:not(:first-child) {
margin-block-start: var(--wa-space-xs);
}
wa-details {
border: none;
background: none;
padding: 0;
}
ul {
border-inline-start: var(--wa-border-width-s) solid var(--wa-color-surface-border);
font-size: var(--wa-font-size-s);
@@ -99,19 +110,83 @@ wa-page > header {
margin: 0;
padding-inline-start: var(--wa-space-m);
}
ul ul {
margin-block-start: var(--wa-space-m);
}
ul:empty {
display: none;
}
li {
list-style: none;
margin-block-end: var(--wa-space-m);
+ li {
margin-block-start: var(--wa-space-m);
}
}
li a {
color: var(--wa-color-text-normal);
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
li a:hover {
text-decoration: underline;
li wa-badge::part(base) {
font-size: var(--wa-font-size-2xs);
font-weight: var(--wa-font-weight-bold);
}
li wa-icon {
color: var(--wa-color-text-quiet);
vertical-align: middle;
&[name='flask'] {
margin-inline: 0.125em;
}
}
}
#outline-standard h2 {
margin-block-end: var(--wa-space-m);
}
/* Pro badges */
wa-badge.pro::part(base) {
background-color: var(--wa-brand-orange);
border-color: var(--wa-brand-orange);
}
#sidebar {
h2 {
color: var(--wa-color-text-quiet);
a {
display: flex;
align-items: center;
gap: 0.4em;
color: var(--wa-color-text-normal);
text-decoration: none;
wa-icon {
margin-block-end: -0.15em;
font-size: var(--wa-font-size-s);
font-weight: var(--wa-font-weight-action);
color: var(--wa-color-gray-70);
}
&:hover {
color: var(--wa-color-brand-on-normal);
wa-icon {
color: var(--wa-color-brand-on-quiet);
}
}
}
}
}
@@ -136,6 +211,20 @@ wa-page::part(menu) {
scrollbar-width: thin;
}
wa-page[view='mobile'] :is([slot='navigation-header'], [slot='navigation']) {
padding: 0;
& wa-details::part(icon) {
padding-inline: var(--wa-space-xs); /* aligns details icons with drawer close icon */
}
}
[slot='navigation-header'] wa-menu {
font-family: var(--wa-font-family-body);
font-size: var(--wa-font-size-m);
font-weight: var(--wa-font-weight-normal);
}
/* Main content */
wa-page > main {
max-width: 80ch;
@@ -143,7 +232,15 @@ wa-page > main {
margin-inline: auto;
}
.component-info {
h1.title wa-badge {
vertical-align: middle;
&::part(base) {
font-size: 1.5rem;
}
}
.block-info {
margin-block-end: var(--wa-flow-spacing);
}
@@ -174,7 +271,7 @@ wa-page > main {
display: flex;
gap: 1rem;
border: var(--wa-border-style) var(--wa-border-width-s);
border-radius: var(--wa-border-radius-m);
border-radius: var(--wa-border-radius-l);
padding: 1rem;
margin-block-end: var(--wa-flow-spacing);
@@ -234,8 +331,48 @@ wa-page > main:has(> .index-grid) {
.index-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(20ch, 100%), 1fr));
grid-template-columns: repeat(auto-fit, minmax(min(22ch, 100%), 1fr));
gap: var(--wa-space-2xl);
margin-block-end: var(--wa-space-3xl);
a {
border-radius: var(--wa-border-radius-l);
text-decoration: none;
}
wa-card {
box-shadow: none;
--spacing: var(--wa-space-m);
inline-size: 100%;
&:hover {
--border-color: var(--wa-color-brand-border-loud);
border-color: var(--border-color);
box-shadow: 0 0 0 var(--wa-border-width-s) var(--border-color);
.page-name {
color: var(--wa-color-brand-on-quiet);
}
}
[slot='header'] {
display: flex;
}
&::part(header) {
background-color: var(--wa-color-neutral-fill-quiet);
border-bottom: none;
display: flex;
align-items: center;
justify-content: center;
min-block-size: calc(6rem + var(--spacing));
}
}
.page-name {
font-size: var(--wa-font-size-s);
font-weight: var(--wa-font-weight-action);
}
}
.index-category {
@@ -244,123 +381,93 @@ wa-page > main:has(> .index-grid) {
margin-block-start: var(--wa-space-2xl);
}
.index-grid a {
border-radius: var(--wa-border-radius-m);
}
.index-grid wa-card {
--box-shadow: none;
--spacing: var(--wa-space-m);
inline-size: 100%;
}
.index-grid wa-card:hover {
--border-color: var(--wa-color-brand-border-loud);
--box-shadow: 0 0 0 var(--wa-border-width-s) var(--border-color);
& .page-name {
color: var(--wa-color-brand-on-quiet);
}
}
.index-grid wa-card [slot='header'] {
display: flex;
}
.index-grid wa-card::part(header) {
background-color: var(--wa-color-neutral-fill-quiet);
border-bottom: none;
display: flex;
align-items: center;
justify-content: center;
min-block-size: calc(6rem + var(--spacing));
}
.index-grid .page-name {
font-size: var(--wa-font-size-s);
font-weight: var(--wa-font-weight-action);
}
/* Index Pages */
wa-page > main:has(> .index-grid) {
max-width: 120ch;
margin-inline: auto;
}
.index-summary {
max-inline-size: 80ch;
}
.index-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(20ch, 100%), 1fr));
gap: var(--wa-space-2xl);
}
.index-category {
grid-column: 1 / -1;
margin-block-end: 0;
margin-block-start: var(--wa-space-2xl);
}
.index-grid a {
border-radius: var(--wa-border-radius-m);
}
.index-grid wa-card {
--box-shadow: none;
--spacing: var(--wa-space-m);
inline-size: 100%;
}
.index-grid wa-card:hover {
--border-color: var(--wa-color-brand-border-loud);
--box-shadow: 0 0 0 var(--wa-border-width-s) var(--border-color);
& .page-name {
color: var(--wa-color-brand-on-quiet);
}
}
.index-grid wa-card [slot='header'] {
display: flex;
}
.index-grid wa-card::part(header) {
background-color: var(--wa-color-neutral-fill-quiet);
border-bottom: none;
display: flex;
align-items: center;
justify-content: center;
min-block-size: calc(6rem + var(--spacing));
}
.index-grid .page-name {
font-size: var(--wa-font-size-s);
font-weight: var(--wa-font-weight-action);
}
/* Swatches */
.swatch {
position: relative;
display: flex;
align-items: center;
justify-content: center;
background-color: transparent;
border-color: var(--wa-color-neutral-border-normal);
border-style: var(--wa-border-style);
border-width: var(--wa-border-width-s);
border-radius: var(--wa-border-radius-s);
border-radius: var(--wa-border-radius-m);
box-sizing: border-box;
line-height: 2.5;
height: 2.5em;
padding-inline: var(--wa-space-xs);
min-height: 2.5em;
padding: var(--wa-space-xs);
font-weight: var(--wa-font-weight-semibold);
line-height: var(--wa-line-height-condensed);
&.color {
border-color: transparent;
}
wa-copy-button {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: block;
--background-color-hover: transparent;
font-family: var(--wa-font-family-code);
&::part(button) {
display: block;
height: 100%;
width: 100%;
}
&::part(button):hover {
cursor: copy;
}
&::part(copy-icon),
&::part(success-icon),
&::part(error-icon) {
opacity: 0 !important;
}
}
}
table.colors {
thead {
th {
text-align: center;
padding-block: 0;
}
}
tbody {
tr {
border: none;
&:hover {
background: transparent;
}
}
th {
width: 0;
vertical-align: middle;
text-align: right;
}
td {
padding-inline: var(--wa-space-3xs);
padding-block: var(--wa-space-s);
}
}
}
/* Layout Examples */
.layout-example-boundary {
border: var(--wa-border-width-s) dashed var(--wa-color-neutral-border-normal);
border-radius: var(--wa-border-radius-m);
border-radius: var(--wa-border-radius-l);
padding: var(--wa-space-s);
}
.layout-example-block {
background-color: var(--wa-color-indigo-60);
border-radius: var(--wa-border-radius-s);
border-radius: var(--wa-border-radius-m);
min-block-size: 4rem;
min-inline-size: 4rem;
}
@@ -384,6 +491,7 @@ wa-page > main:has(> .index-grid) {
.table-scroll {
overflow-x: auto;
margin-block-end: var(--wa-flow-spacing);
}
/** mobile */
@@ -395,14 +503,9 @@ wa-page > main:has(> .index-grid) {
/** desktop */
@media screen and not (max-width: 768px) {
wa-page [data-toggle-nav],
wa-page .only-mobile {
display: none;
}
/* Navigation sidebar */
wa-page::part(navigation) {
border-right: var(--wa-border-style) var(--wa-panel-border-width) var(--wa-color-neutral-border-quiet);
border-right: var(--wa-border-style) var(--wa-panel-border-width) var(--wa-color-surface-border);
}
wa-page > #sidebar {
@@ -417,3 +520,22 @@ wa-page > main:has(> .index-grid) {
padding: var(--wa-space-3xl);
}
}
.page-wide {
wa-page > main {
max-width: 140ch;
.max-line-length {
max-width: 80ch;
}
}
}
.layout-theme {
iframe {
width: 100%;
min-height: 16lh;
height: 65vh;
max-height: 21lh;
}
}

View File

@@ -0,0 +1,37 @@
wa-card#drawer-card::part(header) {
--spacing: 0;
justify-content: flex-end;
overflow: hidden;
}
#block-filter {
margin-block-end: var(--wa-space-xl);
}
.index-grid.filtered {
h2 {
/* Hide headings while filtering */
display: none;
}
&:not(:has(> a:not([hidden]))) {
/* Were filtering and there are no results */
&::before {
content: var(--empty-message);
grid-column: 1 / -1;
color: var(--wa-color-on-quiet);
font-style: italic;
font-weight: var(--wa-font-weight-action);
}
/* Show empty state when there's a search filter and no results */
&[data-empty] {
--empty-message: attr(data-empty);
}
&:not([data-empty]) {
--empty-message: 'No results';
}
}
}

View File

@@ -18,7 +18,7 @@
.diff-grid > * {
height: 100%;
}
.diff-dialog::part(dialog) {
.diff-dialog {
max-width: 90vw;
width: 90vw;
}

View File

@@ -31,6 +31,9 @@
}
@media screen and (max-width: 1199px) {
wa-page [slot='aside'] {
display: none;
}
#outline {
padding-block: 0.25rem;
margin-block-end: -1rem;
@@ -42,5 +45,6 @@
#outline-expandable {
display: block;
margin-block-end: var(--wa-space-xl);
}
}

View File

@@ -1,13 +1,14 @@
#site-search {
--width: 38rem;
width: 38rem;
position: absolute;
top: 0;
border-radius: var(--wa-border-radius-l);
padding: 0;
margin: 0 auto;
overflow: hidden;
&::part(dialog) {
position: absolute;
top: 0;
border-radius: var(--wa-border-radius-m);
padding: 0;
margin: 10rem auto;
overflow: hidden;
&::part(base) {
margin-block: 10rem;
}
&::part(body) {
@@ -18,21 +19,22 @@
justify-content: center;
gap: 0.5rem;
}
@media screen and (max-width: 900px) {
max-width: calc(100% - 2rem);
&::part(base) {
margin-block: 1rem;
}
}
}
#site-search-container {
display: flex;
flex-direction: column;
max-height: calc(100vh - 20rem);
}
@media screen and (max-width: 900px) {
#site-search::part(dialog) {
max-width: calc(100% - 2rem);
margin-block: 1rem;
}
#site-search-container {
@media screen and (max-width: 900px) {
max-height: calc(100dvh - 2rem);
}
}
@@ -229,8 +231,8 @@ header {
gap: 2rem;
color: var(--wa-color-text-quiet);
border-top: var(--wa-panel-border-style) var(--wa-panel-border-width) var(--wa-color-neutral-border-quiet);
border-bottom-left-radius: var(--wa-border-radius-m);
border-bottom-right-radius: var(--wa-border-radius-m);
border-bottom-left-radius: var(--wa-border-radius-l);
border-bottom-right-radius: var(--wa-border-radius-l);
padding: 1rem;
kbd {

View File

@@ -1,5 +1,14 @@
/* #region Custom Styles */
@container preview (min-width: 0) {
/* Theme Builder Headers
* These styles control the appearance of the header of the theme builder,
* allowing each theme to have a unique hero section.
*/
/* #region Default */
html.wa-theme-default .preview-container {
container-name: default-theme;
}
@container default-theme (min-width: 0) {
.hero-background {
height: 47rem;
background-color: var(--wa-color-brand-fill-loud);
@@ -22,8 +31,8 @@
}
.hero wa-button[variant='brand'] {
--background: var(--wa-color-neutral-fill-quiet);
--label-color: var(--wa-color-neutral-on-normal);
--background-color: var(--wa-color-neutral-fill-quiet);
--text-color: var(--wa-color-neutral-on-normal);
}
.project-header {
@@ -41,10 +50,733 @@
}
/* responsive */
@container preview (min-width: 1040px) {
@container default-theme (min-width: 1040px) {
.hero-background::after {
background-position: right bottom;
background-size: 90%;
}
}
/* #endregion */
/* #region Tailspin */
html.wa-theme-tailspin .preview-container {
container-name: tailspin-theme;
}
@container tailspin-theme (min-width: 0) {
.project-header {
background: var(--wa-color-surface-default);
}
.hero {
--hero-background-color: var(--wa-color-surface-default);
--hero-lines-color: color-mix(in oklab, var(--wa-color-neutral-fill-normal), transparent 30%);
background: linear-gradient(to top, var(--wa-color-surface-lowered), transparent 40%),
radial-gradient(circle at 10% 70%, color-mix(in oklab, var(--wa-color-red-50) 16%, transparent), transparent 30%),
radial-gradient(
circle at 40% 50%,
color-mix(in oklab, var(--wa-color-indigo-40) 16%, transparent),
transparent 40%
),
radial-gradient(circle at 80% 25%, color-mix(in oklab, var(--wa-color-red-50) 8%, transparent), transparent 20%),
radial-gradient(
circle at 80% 80%,
color-mix(in oklab, var(--wa-color-indigo-40) 16%, transparent),
transparent 40%
),
radial-gradient(circle at 90% 30%, color-mix(in oklab, var(--wa-color-red-60) 8%, transparent), transparent 10%),
linear-gradient(176deg, var(--hero-background-color), transparent 6rem),
linear-gradient(90deg, var(--hero-background-color), transparent),
repeating-linear-gradient(
var(--hero-lines-color),
var(--hero-lines-color) 1px,
transparent 1px,
transparent 10rem,
var(--hero-lines-color) 10rem
),
repeating-linear-gradient(
90deg,
var(--hero-lines-color),
var(--hero-lines-color) 1px,
transparent 1px,
transparent 10rem,
var(--hero-lines-color) 10rem
),
var(--hero-background-color);
& .title {
padding-block: calc(var(--wa-space-3xl) * 2) calc(var(--wa-space-3xl) * 10);
& .hero-title {
font-size: calc((var(--wa-font-size-4xl) * 1.125) * 1.125);
margin-block: 0 var(--wa-space-3xl);
}
}
}
.badge-stock {
position: absolute;
top: var(--wa-space-l);
left: var(--wa-space-l);
}
.message-composer wa-card {
&::part(footer) {
border: none;
}
& wa-icon-button {
color: var(--wa-color-base-50);
}
}
.products {
margin-top: calc(var(--wa-space-3xl) * -8);
}
pre.codeblock {
background-color: var(--wa-color-neutral-fill-normal);
}
}
/* #endregion */
/* #region Brutalist */
html.wa-theme-brutalist .preview-container {
container-name: brutalist-theme;
}
@container brutalist-theme (min-width: 0) {
.overlap {
background: var(--wa-color-surface-lowered) url('/assets/images/themer/brutalist/hero.png') 50% 3% no-repeat;
}
.strata.hero {
height: 42rem;
padding-top: 8rem;
padding-right: 50%;
--wa-font-weight-heading: var(--wa-font-weight-normal);
}
.hero wa-button {
--background: var(--wa-color-neutral-fill-loud);
margin-block-start: var(--wa-space-xl);
font-size: var(--wa-font-size-l);
}
/* imitating the large button styles */
.hero wa-button::part(label) {
padding: 0 var(--wa-space-l);
}
.strata.products {
margin-top: -20rem;
padding-top: 10rem;
}
.product-card .badge-stock {
position: absolute;
top: 0;
left: 0;
}
.product-card::part(footer) {
--wa-shadow-offset-x-s: 0;
--wa-shadow-offset-y-s: 0;
border-width: 0;
text-align: right;
}
.product-card wa-button::part(prefix) {
padding-inline-start: var(--wa-space-xs);
}
.product-card wa-button::part(suffix) {
padding-inline-end: var(--wa-space-xs);
}
.product-card wa-button:not(:last-child) {
margin-inline-end: var(--wa-space-xs);
}
/* imitating the rounded avatar */
.blog wa-avatar {
background-color: transparent;
}
.blog wa-avatar::part(image) {
border: var(--wa-border-width-s) solid var(--wa-color-brand-fill-loud);
border-radius: var(--wa-border-radius-circle);
}
.blog .landscape-frame {
box-shadow: var(--wa-shadow-s);
border: var(--wa-panel-border-width) var(--wa-panel-border-style) var(--wa-color-surface-border);
margin-block-end: var(--wa-shadow-offset-y-s);
}
.post-meta .categories {
display: flex;
flex-direction: column;
}
.message-composer wa-card::part(header) {
background-color: var(--wa-color-neutral-fill-loud);
}
.message-composer .grouped-buttons {
--wa-color-neutral-border-quiet: color-mix(in oklab, var(--wa-color-gray-30), white 40%);
}
.message-composer [slot='header'] wa-icon-button::part(base) {
color: var(--wa-color-neutral-on-loud);
}
.message-composer .grouped-buttons wa-icon-button::part(base):hover {
background-color: var(--wa-color-neutral-fill-normal);
color: var(--wa-color-text-normal);
}
.message-composer wa-tooltip::part(body) {
background-color: var(--wa-color-brand-fill-loud);
color: var(--wa-color-brand-on-loud);
}
.message-composer wa-tooltip::part(base__arrow) {
--arrow-color: var(--wa-color-brand-fill-loud);
}
.message-composer wa-card::part(footer) {
border-width: 0;
--padding: 0 var(--wa-space-s) var(--wa-space-s) var(--wa-space-s);
}
.support-table th {
background-color: var(--wa-color-neutral-fill-loud);
color: var(--wa-color-neutral-on-loud);
}
.support-table th wa-checkbox {
--background: transparent;
--border-color: var(--wa-color-neutral-on-loud);
--border-color-checked: var(--wa-color-neutral-on-loud);
}
.checkout-form {
font-size: var(--wa-font-size-s);
}
.checkout-form .square-frame {
box-shadow: var(--wa-shadow-s);
border: var(--wa-panel-border-width) var(--wa-panel-border-style) var(--wa-color-surface-border);
}
.wa-theme-brutalist.wa-dark {
& p a::before {
background: var(--wa-color-yellow-40);
}
& wa-rating {
--symbol-color: color-mix(in oklab, var(--wa-color-base-80), transparent 50%);
--symbol-color-active: var(--wa-color-gray-80);
}
& wa-alert {
&[variant='brand'] {
--icon-color: var(--wa-color-brand-on-quiet);
}
&[variant='success'] {
--icon-color: var(--wa-color-success-on-quiet);
}
&[variant='warning'] {
--icon-color: var(--wa-color-warning-on-quiet);
}
&[variant='danger'] {
--icon-color: var(--wa-color-danger-on-quiet);
}
&[variant='neutral'] {
--icon-color: var(--wa-color-neutral-on-quiet);
}
}
}
.preview-container pre {
border-inline-start: var(--wa-panel-border-width) var(--wa-panel-border-style) var(--wa-color-neutral-border-quiet);
}
p a,
a.highlite-link {
position: relative;
--wa-link-decoration-default: none;
--wa-link-decoration-hover: none;
&:before {
position: absolute;
z-index: -1;
content: '';
background: var(--wa-color-yellow-80);
width: 100%;
bottom: 0;
height: 50%;
opacity: 0.7;
transition: all var(--wa-transition-fast) ease-in-out;
}
&:hover:before {
height: 100%;
}
}
}
@container brutalist-theme (min-width: 1040px) and (max-width: 1140px) {
.product-card wa-button {
font-size: 80%;
}
}
/* #endregion */
/* #region Playful */
html.wa-theme-playful .preview-container {
container-name: playful-theme;
}
@container playful-theme (min-width: 0) {
.project-header {
color: var(--wa-color-success-on-normal);
}
.hero-background {
position: absolute;
z-index: -1;
top: -60rem;
left: 50%;
width: 250rem;
height: 250rem;
transform: translate(-50%, -50%);
flex-shrink: 0;
border-radius: 50%;
background: linear-gradient(180deg, var(--wa-color-green-90) 69.42%, var(--wa-color-green-80) 100%);
}
.hero-background::after {
background: url(/assets/images/themer/playful/hero.png) 0 50% no-repeat;
content: '';
position: absolute;
width: 520px;
height: 600px;
transform: translateX(-50%);
left: 50%;
bottom: 33rem;
}
.strata.hero {
padding-top: 19rem;
text-align: center;
}
.hero .hero-title {
color: var(--wa-color-success-on-normal);
font-size: var(--wa-font-size-4xl);
}
.hero .hero-cta {
font-size: var(--wa-font-size-l);
}
.product-card .badge-stock {
position: absolute;
top: var(--wa-space-xl);
right: var(--wa-space-xl);
}
.product-card {
--wa-panel-border-radius: var(--wa-border-radius-l);
}
.product-card::part(footer) {
border-width: 0;
}
.product-card wa-button {
margin-inline-end: var(--wa-space-xs);
}
.blog wa-avatar {
--size: 2rem;
}
.blog .landscape-frame {
border-radius: var(--wa-border-radius-l);
box-shadow: var(--wa-shadow-s);
}
.message-composer wa-card {
--background: var(--wa-color-surface-raised);
}
.message-composer wa-card::part(header) {
--wa-color-neutral-border-quiet: var(--wa-color-gray-70);
border-width: 0;
background-color: var(--wa-color-neutral-fill-quiet);
}
&:not(.wa-theme-premium.wa-dark) .message-composer wa-card {
--wa-color-neutral-fill-quiet: var(--wa-color-gray-90);
}
.message-composer wa-icon-button {
color: var(--wa-text-color-normal);
font-size: var(--wa-font-size-l);
}
.message-composer wa-card::part(footer) {
padding-top: 0;
}
.product-detail .price {
font-weight: var(--wa-font-weight-bold);
}
.support-table wa-card {
background: var(--wa-color-surface-raised);
}
.support-table th {
font-size: var(--wa-font-size-s);
font-weight: var(--wa-font-weight-bold);
background-color: var(--wa-color-surface-lowered);
}
.support-table tr {
border-top-color: var(--wa-color-surface-lowered);
}
.support-table .excerpt {
color: var(--wa-color-text-quiet);
}
.order-item img {
border-radius: var(--wa-border-radius-m);
}
.checkout-form {
font-size: var(--wa-font-size-s);
}
.checkout-form h2 {
font-size: var(--wa-font-size-3xl);
}
.checkout-form wa-input::part(form-control-label),
.checkout-form wa-select::part(form-control-label) {
font-size: var(--wa-font-size-s);
padding-block-end: var(--wa-space-xs);
}
.wa-theme-playful.wa-dark {
& .hero-background {
background: linear-gradient(180deg, var(--wa-color-green-60) 69.42%, var(--wa-color-green-30) 100%);
}
& .message-composer wa-card {
border-color: var(--wa-color-gray-30);
}
& .message-composer wa-card::part(header) {
background: var(--wa-color-gray-40);
}
& .message-composer wa-card::part(footer) {
border-top: 0;
}
& .message-composer .tools .grouped-buttons:not(:last-of-type) {
--wa-color-neutral-border-quiet: var(--wa-color-gray-40);
}
& .support-table th {
background: var(--wa-color-surface-lowered);
}
}
}
/* responsive */
@container playful-theme (min-width: 1040px) and (max-width: 1140px) {
.product-card wa-button {
font-size: 80%;
margin-inline-end: 0;
}
}
/* #endregion */
/* #region Active */
html.wa-theme-active .preview-container {
container-name: active-theme;
}
@container active-theme (min-width: 0) {
.hero-background::after {
backdrop-filter: brightness(0.8);
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.hero-background {
background: linear-gradient(
var(--wa-color-green-80) 20%,
var(--wa-color-primary-80) 80.5%,
var(--wa-color-base-10) 80.5%,
var(--wa-color-primary-80) 100%
);
background: url(/assets/images/themer/active/hero.png) 50% 0px / cover no-repeat;
height: 40rem;
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: -1;
}
.strata.hero {
height: 24rem;
}
.hero .title {
text-align: right;
margin-inline-start: 55%;
}
.hero .hero-title {
font-style: italic;
font-weight: var(--wa-font-weight-black);
font-size: var(--wa-font-size-2xl);
}
.hero wa-button[variant='brand'] {
--background: var(--wa-color-neutral-fill-quiet);
--text-color: var(--wa-color-neutral-on-normal);
}
wa-rating {
--symbol-color-active: var(--wa-color-brand-on-quiet);
}
}
/* responsive */
@container preview (min-width: 1100px) {
.hero-background {
height: 47rem;
}
.strata.hero {
height: 30rem;
}
.hero .title {
margin-block-start: 10%;
}
}
/* #endregion */
/* #region Premium */
html.wa-theme-premium .preview-container {
container-name: premium-theme;
}
@container premium-theme (min-width: 0) {
.project-header {
background-color: var(--wa-color-warning-fill-normal);
}
.strata.hero {
height: 60rem;
background: var(--wa-color-warning-fill-normal) url('/assets/images/themer/premium/hero.png') -4rem 12rem no-repeat;
background-size: cover;
padding-top: var(--wa-space-2xl);
padding-left: var(--wa-space-s);
text-align: right;
}
.hero .hero-title {
color: var(--wa-color-warning-on-normal);
font-style: italic;
}
.blog wa-avatar {
border-radius: var(--wa-border-radius-circle);
overflow: hidden;
}
.strata.products {
margin-top: -25rem;
padding-top: 10rem;
background: linear-gradient(0deg, var(--wa-color-surface-lowered) 80%, rgba(255, 255, 255, 0) 100%);
}
.product-card .badge-stock {
position: absolute;
top: var(--wa-space-xl);
right: var(--wa-space-xl);
}
.product-card wa-rating {
--symbol-size: var(--wa-font-size-m);
}
.product-card .title {
font-size: var(--wa-font-size-2xl);
}
.product-card .description {
color: var(--wa-color-text-quiet);
}
.product-card::part(footer) {
border-width: 0;
}
.product-card wa-button:not(:last-child) {
margin-inline-end: var(--wa-space-xs);
}
.blog .authors a {
--wa-color-text-link: var(--wa-color-text-quiet);
--wa-link-decoration-default: none;
}
.message-composer wa-card {
background: var(--wa-color-surface-raised);
}
.message-composer wa-card::part(header) {
border-width: 0;
background-color: var(--wa-color-neutral-fill-quiet);
}
&:not(.wa-theme-premium.wa-dark) .message-composer wa-card {
--wa-color-neutral-fill-quiet: var(--wa-color-base-95);
}
.message-composer wa-card::part(footer) {
border-width: 0;
--padding: var(--wa-space-s) var(--wa-space-xl);
}
.message-composer .grouped-buttons wa-icon-button::part(base) {
block-size: var(--wa-form-control-height-s);
inline-size: var(--wa-form-control-height-s);
justify-content: center;
}
.message-composer .grouped-buttons wa-icon-button::part(base):hover {
background-color: var(--wa-color-neutral-fill-normal);
color: var(--wa-color-text-normal);
}
.support-table th {
text-transform: uppercase;
font-weight: var(--wa-font-weight-normal);
color: var(--wa-color-text-quiet);
background-color: var(--wa-color-surface-lowered);
}
.support-table th:first-child {
border-radius: var(--wa-border-radius-l) 0 0 0;
}
.support-table th:last-child {
border-radius: 0 var(--wa-border-radius-l) 0 0;
}
.support-table tr {
--wa-color-surface-border: var(--wa-color-surface-lowered);
}
.checkout-form wa-input::part(form-control-label),
.checkout-form wa-select::part(form-control-label) {
font-size: var(--wa-font-size-s);
margin-block-end: var(--wa-space-xs);
}
.order-item .finish {
color: var(--wa-color-text-quiet);
font-size: var(--wa-font-size-s);
font-style: italic;
}
.wa-theme-premium.wa-dark {
& .message-composer .tools .grouped-buttons:not(:last-of-type) {
--wa-color-neutral-border-quiet: var(--wa-color-base-40);
}
& .preview-container pre,
& .preview-container code {
background-color: var(--wa-color-base-20);
}
/* syntax highlighting */
& .token {
&.selector {
color: var(--wa-color-green-80);
}
&.tag {
color: var(--wa-color-primary-80);
}
&.punctuation {
color: var(--wa-color-base-95);
}
&.attr-name {
color: var(--wa-color-green-80);
}
&.attr-value {
color: var(--wa-color-yellow-80);
}
}
}
.preview-container pre,
.preview-container code {
background-color: var(--wa-color-base-90);
font-size: var(--font-size-m);
}
/* syntax highlighting */
.token {
&.selector {
color: var(--wa-color-green-30);
}
&.tag {
color: var(--wa-color-primary-30);
}
&.punctuation {
color: var(--wa-color-base-10);
}
&.attr-name {
color: var(--wa-color-green-30);
}
&.attr-value {
color: var(--wa-color-yellow-30);
}
}
}
/* responsive */
@container preview (min-width: 1040px) {
.strata.hero {
background: var(--wa-color-warning-fill-normal) url('/assets/images/themer/premium/hero.png') -4rem 35% no-repeat;
padding-top: 15rem;
padding-left: 50%;
}
.strata.products {
margin-top: -25rem;
padding-top: 10rem;
background: linear-gradient(0deg, var(--wa-color-surface-lowered) 60%, rgba(255, 255, 255, 0) 100%);
}
}
/* #endregion */

View File

@@ -1,7 +1,8 @@
---
title: Animated Image
description: A component for displaying animated GIFs and WEBPs that play and pause on interaction.
layout: component
tags: [imagery, niche]
icon: animated-image
---
```html {.example}

View File

@@ -1,7 +1,8 @@
---
title: Animation
description: Animate elements declaratively with nearly 100 baked-in presets, or roll your own with custom keyframes.
layout: component
tags: [helpers, primitives]
icon: animation
---
To animate an element, wrap it in `<wa-animation>` and set an animation `name`. The animation will not start until you add the `play` attribute. Refer to the [properties table](#properties) for a list of all animation options.
@@ -76,9 +77,9 @@ This example demonstrates all of the baked-in animations and easings. Animations
easingName.appendChild(option);
});
animationName.addEventListener('wa-change', () => (animation.name = animationName.value));
easingName.addEventListener('wa-change', () => (animation.easing = easingName.value));
playbackRate.addEventListener('wa-input', () => (animation.playbackRate = playbackRate.value));
animationName.addEventListener('change', () => (animation.name = animationName.value));
easingName.addEventListener('change', () => (animation.easing = easingName.value));
playbackRate.addEventListener('input', () => (animation.playbackRate = playbackRate.value));
</script>
<style>
@@ -196,4 +197,3 @@ Animations won't play until you apply the `play` attribute. You can omit it init
animation.play = true;
});
</script>
```

View File

@@ -1,7 +1,8 @@
---
title: Avatar
description: Avatars are used to represent a person or object.
layout: component
tags: [imagery, apps, content]
icon: avatar
---
By default, a generic icon will be shown. You can personalize avatars by adding custom icons, initials, and images. You should always provide a `label` for assistive devices.
@@ -97,7 +98,7 @@ You can group avatars with a few lines of CSS.
margin-left: calc(-1 * var(--wa-space-m));
}
.avatar-group wa-avatar::part(base) {
.avatar-group wa-avatar {
border: solid 2px var(--wa-color-surface-default);
}
</style>

View File

@@ -1,7 +1,8 @@
---
title: Badge
description: Badges are used to draw attention and display statuses or counts.
layout: component
tags: [feedback, content]
icon: badge
---
```html {.example}
@@ -22,6 +23,48 @@ Set the `variant` attribute to change the badge's variant.
<wa-badge variant="danger">Danger</wa-badge>
```
### Appearance
Use the `appearance` attribute to change the badge's visual appearance.
```html {.example}
<div style="margin-block-end: 1rem;">
<wa-badge appearance="accent outlined" variant="neutral">A+O</wa-badge>
<wa-badge appearance="accent" variant="neutral">Accent</wa-badge>
<wa-badge appearance="filled outlined" variant="neutral">F+O</wa-badge>
<wa-badge appearance="filled" variant="neutral">Filled</wa-badge>
<wa-badge appearance="outlined" variant="neutral">Outlined</wa-badge>
</div>
<div style="margin-block-end: 1rem;">
<wa-badge appearance="accent outlined" variant="brand">A+O</wa-badge>
<wa-badge appearance="accent" variant="brand">Accent</wa-badge>
<wa-badge appearance="filled outlined" variant="brand">F+O</wa-badge>
<wa-badge appearance="filled" variant="brand">Filled</wa-badge>
<wa-badge appearance="outlined" variant="brand">Outlined</wa-badge>
</div>
<div style="margin-block-end: 1rem;">
<wa-badge appearance="accent outlined" variant="success">A+O</wa-badge>
<wa-badge appearance="accent" variant="success">Accent</wa-badge>
<wa-badge appearance="filled outlined" variant="success">F+O</wa-badge>
<wa-badge appearance="filled" variant="success">Filled</wa-badge>
<wa-badge appearance="outlined" variant="success">Outlined</wa-badge>
</div>
<div style="margin-block-end: 1rem;">
<wa-badge appearance="accent outlined" variant="warning">A+O</wa-badge>
<wa-badge appearance="accent" variant="warning">Accent</wa-badge>
<wa-badge appearance="filled outlined" variant="warning">F+O</wa-badge>
<wa-badge appearance="filled" variant="warning">Filled</wa-badge>
<wa-badge appearance="outlined" variant="warning">Outlined</wa-badge>
</div>
<div>
<wa-badge appearance="accent outlined" variant="danger">A+O</wa-badge>
<wa-badge appearance="accent" variant="danger">Accent</wa-badge>
<wa-badge appearance="filled outlined" variant="danger">F+O</wa-badge>
<wa-badge appearance="filled" variant="danger">Filled</wa-badge>
<wa-badge appearance="outlined" variant="danger">Outlined</wa-badge>
</div>
```
### Pill Badges
Use the `pill` attribute to give badges rounded edges.
@@ -85,4 +128,3 @@ When including badges in menu items, use the `suffix` slot to make sure they're
<wa-menu-item>Comments <wa-badge slot="suffix" variant="neutral" pill>4</wa-badge></wa-menu-item>
<wa-menu-item>Replies <wa-badge slot="suffix" variant="neutral" pill>12</wa-badge></wa-menu-item>
</wa-menu>
```

View File

@@ -1,7 +1,8 @@
---
title: Breadcrumb Item
description: Breadcrumb Items are used inside breadcrumbs to represent different links.
layout: component
tags: component
parent: breadcrumb
---
```html {.example}

View File

@@ -1,7 +1,8 @@
---
title: Breadcrumb
description: Breadcrumbs provide a group of links so users can easily navigate a website's hierarchy.
layout: component
tags: [navigation]
icon: breadcrumb
---
Breadcrumbs are usually placed before a page's main content with the current page shown last to indicate the user's position in the navigation.
@@ -135,7 +136,7 @@ Dropdown menus can be placed in the default slot to provide additional options.
<wa-breadcrumb-item>Homepage</wa-breadcrumb-item>
<wa-breadcrumb-item>
<wa-dropdown>
<wa-button slot="trigger" size="small" appearance="tinted" pill>
<wa-button slot="trigger" size="small" appearance="filled" pill>
<wa-icon label="More options" name="ellipsis" variant="solid"></wa-icon>
</wa-button>
<wa-menu>
@@ -160,7 +161,7 @@ Alternatively, you can place dropdown menus in a prefix or suffix slot.
<wa-breadcrumb-item>
Web Design
<wa-dropdown slot="suffix">
<wa-button slot="trigger" size="small" appearance="tinted" pill>
<wa-button slot="trigger" size="small" appearance="filled" pill>
<wa-icon label="More options" name="ellipsis" variant="solid"></wa-icon>
</wa-button>
<wa-menu>
@@ -171,4 +172,3 @@ Alternatively, you can place dropdown menus in a prefix or suffix slot.
</wa-dropdown>
</wa-breadcrumb-item>
</wa-breadcrumb>
```

View File

@@ -1,7 +1,8 @@
---
title: Button Group
description: Button groups can be used to group related buttons into sections.
layout: component
tags: [actions, forms, apps]
icon: button-group
---
```html {.example}
@@ -139,15 +140,17 @@ Pill buttons are supported through the button's `pill` attribute.
</wa-button-group>
```
### Dropdowns in Button Groups
### Dropdowns and Native Buttons in Button Groups
Dropdowns can be placed inside button groups as long as the trigger is an `<wa-button>` element.
Other elements can also be placed inside button groups:
- Native buttons as long as their [native styles](/docs/native/button) are included
- Dropdowns as long as the trigger is either a `<wa-button>`, or a `<button>` with [native styles](/docs/native/button) included.
```html {.example}
<wa-button-group label="Example Button Group">
<wa-button>Button</wa-button>
<wa-button>Button</wa-button>
<wa-dropdown>
<button>Native Button</button>
<wa-dropdown hoist>
<wa-button slot="trigger" caret>Dropdown</wa-button>
<wa-menu>
<wa-menu-item>Item 1</wa-menu-item>
@@ -165,9 +168,9 @@ Create a split button using a button and a dropdown. Use a [visually hidden](/do
```html {.example}
<wa-button-group label="Example Button Group">
<wa-button variant="brand">Save</wa-button>
<wa-dropdown placement="bottom-end">
<wa-dropdown placement="bottom-end" hoist>
<wa-button slot="trigger" variant="brand" caret>
<wa-visually-hidden>More options</wa-visually-hidden>
<span class="wa-visually-hidden">More options</span>
</wa-button>
<wa-menu>
<wa-menu-item>Save</wa-menu-item>

Some files were not shown because too many files have changed in this diff Show More