Compare commits

..

1 Commits

Author SHA1 Message Date
Cory LaViska
4668573a0e improve icon perf; closes #1729 2025-11-17 14:47:13 -05:00
29 changed files with 54 additions and 217 deletions

19
package-lock.json generated
View File

@@ -14029,8 +14029,7 @@
"devDependencies": {
"@wc-toolkit/jsx-types": "^1.3.0",
"eleventy-plugin-git-commit-date": "^0.1.3",
"esbuild": "^0.25.11",
"npm-check-updates": "^19.1.2"
"esbuild": "^0.25.11"
},
"engines": {
"node": ">=14.17.0"
@@ -14038,7 +14037,7 @@
},
"packages/webawesome-pro": {
"name": "@shoelace-style/webawesome-pro",
"version": "3.0.0",
"version": "3.0.0-beta.6",
"dependencies": {
"@ctrl/tinycolor": "4.1.0",
"@floating-ui/dom": "^1.6.13",
@@ -14967,20 +14966,6 @@
"engines": {
"node": "^18 || >=20"
}
},
"packages/webawesome/node_modules/npm-check-updates": {
"version": "19.1.2",
"resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-19.1.2.tgz",
"integrity": "sha512-FNeFCVgPOj0fz89hOpGtxP2rnnRHR7hD2E8qNU8SMWfkyDZXA/xpgjsL3UMLSo3F/K13QvJDnbxPngulNDDo/g==",
"dev": true,
"bin": {
"ncu": "build/cli.js",
"npm-check-updates": "build/cli.js"
},
"engines": {
"node": ">=20.0.0",
"npm": ">=8.12.1"
}
}
}
}

View File

@@ -78,10 +78,10 @@
</li>
</ul>
</li>
<li><span class="is-planned wa-split">Charts <span><a href="https://github.com/shoelace-style/webawesome/issues/1073" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a>{{ proBadge({ description: "This will require access to Web Awesome Pro" }) }}</span></span></li>
<li><span class="is-planned wa-split">Charts <a href="https://github.com/shoelace-style/webawesome/issues/1073" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a></span></li>
<li><a href="/docs/components/checkbox/">Checkbox</a></li>
<li><a href="/docs/components/color-picker/">Color Picker</a></li>
<li><span class="is-planned wa-split">Combobox <span><a href="https://github.com/shoelace-style/webawesome/issues/1074" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a>{{ proBadge({ description: "This will require access to Web Awesome Pro" }) }}</span></span></li>
<li><span class="is-planned wa-split">Combobox <a href="https://github.com/shoelace-style/webawesome/issues/1074" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a></span></li>
<li><a href="/docs/components/comparison/">Comparison</a></li>
<li>
<a class="wa-cluster wa-gap-xs" href="/docs/components/copy-button/">
@@ -89,8 +89,8 @@
<wa-icon name="flask" aria-hidden="true" class="icon-shrink"></wa-icon>
</a>
</li>
<li><span class="is-planned wa-split">Data Grid <span><a href="https://github.com/shoelace-style/webawesome/issues/1072" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a>{{ proBadge({ description: "This will require access to Web Awesome Pro" }) }}</span></span></li>
<li><span class="is-planned wa-split">Datepicker <span><a href="https://github.com/shoelace-style/webawesome/issues/1075" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a>{{ proBadge({ description: "This will require access to Web Awesome Pro" }) }}</span></span></li>
<li><span class="is-planned wa-split">Data Grid <a href="https://github.com/shoelace-style/webawesome/issues/1072" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a></span></li>
<li><span class="is-planned wa-split">Datepicker <a href="https://github.com/shoelace-style/webawesome/issues/1075" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a></span></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>
@@ -101,7 +101,7 @@
<li><a href="/docs/components/dropdown-item">Dropdown Item</a></li>
</ul>
</li>
<li><span class="is-planned wa-split">File Input <span><a href="https://github.com/shoelace-style/webawesome/issues/1240" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a>{{ proBadge({ description: "This will require access to Web Awesome Pro" }) }}</span></span></li>
<li><span class="is-planned wa-split">File Input <a href="https://github.com/shoelace-style/webawesome/issues/1240" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a></span></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>
@@ -146,7 +146,7 @@
</li>
<li><a href="/docs/components/tag/">Tag</a></li>
<li><a href="/docs/components/textarea/">Textarea</a></li>
<li><span class="is-planned wa-split">Toast <span><a href="https://github.com/shoelace-style/webawesome/issues/105" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a>{{ proBadge( { description: "This will require access to Web Awesome Pro" }) }}</span></span></li>
<li><span class="is-planned wa-split">Toast <a href="https://github.com/shoelace-style/webawesome/issues/105" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a></span></li>
<li><a href="/docs/components/tooltip/">Tooltip</a></li>
<li>
<a href="/docs/components/tree/">Tree</a>
@@ -154,7 +154,7 @@
<li><a href="/docs/components/tree-item/">Tree Item</a></li>
</ul>
</li>
<li><span class="is-planned wa-split">Video <span><a href="https://github.com/shoelace-style/webawesome/issues/985" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a>{{ proBadge( { description: "This will require access to Web Awesome Pro" }) }}</span></span></li>
<li><span class="is-planned wa-split">Video <a href="https://github.com/shoelace-style/webawesome/issues/985" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a></span></li>
<li><a href="/docs/components/zoomable-frame">Zoomable Frame</a></li>
{# PLOP_NEW_COMPONENT_PLACEHOLDER #}
</ul>

View File

@@ -38,7 +38,7 @@ wa-page > [slot='banner'] {
}
&.banner-wa-launch {
/* custom brand colors carried over from theme-site for the banner */
/* custom brand colors carrried over from theme-site for the banner */
--wa-color-brand-95: #fef0ec;
--wa-color-brand-90: #fce0d8;
--wa-color-brand-80: #f8bcac;

View File

@@ -5,6 +5,7 @@
border-radius: var(--wa-border-radius-l);
padding: 0;
margin: 0 auto;
overflow: hidden;
&::part(dialog) {
margin-block-start: 10vh;

View File

@@ -13,22 +13,16 @@ Components with the <wa-badge variant="warning">Experimental</wa-badge> badge sh
## Next
- Added `layers.css` to define cascade layer order and updated palettes, themes, native styles, and utilities to import the new rule for more fail-safe modularity [pr:1793]
- Fixed a bug in `<wa-slider>` that caused some touch devices to end up with the incorrect value [issue:1703]
- Fixed a bug in `<wa-card>` that prevented some slots from being detected correctly [discuss:1450]
- Fixed a z-index bug in `<wa-scroller>` styles [issue:1724]
- Fixed a bug in `<wa-icon>` that caused some icon libraries to render with the incorrect SVG fill [issue:1733]
- Fixed a bug in `<wa-tree-item>` that caused the spinner to not show when lazy loading [issue:1678]
- Fixed a bug in `<wa-dropdown>` that caused the browser to hang when cancelling the `wa-hide` event [issue:1483]
- Improved performance of `<wa-icon>` so initial rendering occurs faster, especially with multiple icons on the page [issue:1729]
- Modified the default `transition` styles of `<wa-dropdown-item>` to use design tokens [pr:1693]
## 3.0.0
- 🚨 BREAKING: Changed `appearance="filled outlined"` to `appearance="filled-outlined"` in the following elements [issue:1127]
- `<wa-badge>`
- `<wa-button>`
- `<wa-callout>`
- `<wa-card>`
- `<wa-details>`
- `<wa-input>`
- `<wa-select>`

View File

@@ -64,7 +64,7 @@
"spellcheck": "cspell \"**/*.{js,ts,json,html,css,md}\" --no-progress --config=\"../../cspell.json\"",
"verify": "npm run prettier && npm run build && npm run test",
"prepublishOnly": "npm run verify",
"check-updates": "npm-check-updates --cooldown 7 --interactive --format group",
"check-updates": "npx npm-check-updates --interactive --format group",
"print-version": "echo $npm_package_version",
"tag-version": "git tag -a \"v$(npm run print-version | tail -n1)\" -m \"tag v$(npm run print-version | tail -n1)\"",
"postversion": "npm run tag-version"
@@ -91,7 +91,6 @@
"devDependencies": {
"@wc-toolkit/jsx-types": "^1.3.0",
"eleventy-plugin-git-commit-date": "^0.1.3",
"esbuild": "^0.25.11",
"npm-check-updates": "^19.1.2"
"esbuild": "^0.25.11"
}
}

View File

@@ -16,28 +16,27 @@
}
/* Appearance modifiers */
:host([appearance='plain']) {
:host([appearance~='plain']) {
background-color: transparent;
border-color: transparent;
box-shadow: none;
}
:host([appearance='outlined']) {
:host([appearance~='outlined']) {
background-color: var(--wa-color-surface-default);
border-color: var(--wa-color-surface-border);
}
:host([appearance='filled']) {
:host([appearance~='filled']) {
background-color: var(--wa-color-neutral-fill-quiet);
border-color: transparent;
}
:host([appearance='filled-outlined']) {
background-color: var(--wa-color-neutral-fill-quiet);
border-color: var(--wa-color-surface-border);
:host([appearance~='filled'][appearance~='outlined']) {
border-color: var(--wa-color-neutral-border-quiet);
}
:host([appearance='accent']) {
:host([appearance~='accent']) {
color: var(--wa-color-neutral-on-loud);
background-color: var(--wa-color-neutral-fill-loud);
border-color: transparent;

View File

@@ -42,7 +42,7 @@ export default class WaCard extends WebAwesomeElement {
/** The card's visual appearance. */
@property({ reflect: true })
appearance: 'accent' | 'filled' | 'outlined' | 'filled-outlined' | 'plain' = 'outlined';
appearance: 'accent' | 'filled' | 'outlined' | 'plain' = 'outlined';
/** Renders the card with a header. Only needed for SSR, otherwise is automatically added. */
@property({ attribute: 'with-header', type: Boolean, reflect: true }) withHeader = false;

View File

@@ -9,8 +9,8 @@
line-height: var(--wa-line-height-condensed);
cursor: pointer;
transition:
var(--wa-transition-fast) background-color var(--wa-transition-easing),
var(--wa-transition-fast) color var(--wa-transition-easing);
100ms background-color ease,
100ms color ease;
}
@media (hover: hover) {

View File

@@ -1,6 +1,4 @@
import { aTimeout, expect, fixture, html, waitUntil } from '@open-wc/testing';
import sinon from 'sinon';
import type WaDropdown from './dropdown.js';
import { expect, fixture, html } from '@open-wc/testing';
describe('<wa-dropdown>', () => {
it('should render a component', async () => {
@@ -8,112 +6,4 @@ describe('<wa-dropdown>', () => {
expect(el).to.exist;
});
it('should respect the open attribute when included', async () => {
const el = await fixture<WaDropdown>(html`
<wa-dropdown open>
<wa-button slot="trigger">Dropdown</wa-button>
<wa-dropdown-item>One</wa-dropdown-item>
</wa-dropdown>
`);
await el.updateComplete;
await aTimeout(200);
expect(el.open).to.be.true;
});
it('should fire a single show/after-show and hide/after-hide in normal open/close flow', async () => {
const el = await fixture<WaDropdown>(html`
<wa-dropdown>
<wa-button slot="trigger">Dropdown</wa-button>
<wa-dropdown-item>One</wa-dropdown-item>
<wa-dropdown-item>Two</wa-dropdown-item>
</wa-dropdown>
`);
// setup spies to track how often we see different show/hide events
const showSpy = sinon.spy();
const afterShowSpy = sinon.spy();
const hideSpy = sinon.spy();
const afterHideSpy = sinon.spy();
el.addEventListener('wa-show', showSpy);
el.addEventListener('wa-after-show', afterShowSpy);
el.addEventListener('wa-hide', hideSpy);
el.addEventListener('wa-after-hide', afterHideSpy);
// open the dropdown by triggering a click on the trigger
const trigger = el.querySelector<HTMLElement>('[slot="trigger"]')!;
trigger.click();
await waitUntil(() => showSpy.calledOnce);
await waitUntil(() => afterShowSpy.calledOnce);
expect(showSpy.callCount).to.equal(1);
expect(afterShowSpy.callCount).to.equal(1);
expect(el.open).to.be.true;
// close the dropdown by clicking the trigger again
trigger.click();
await waitUntil(() => hideSpy.calledOnce);
await waitUntil(() => afterHideSpy.calledOnce);
expect(hideSpy.callCount).to.equal(1);
expect(afterHideSpy.callCount).to.equal(1);
expect(el.open).to.be.false;
});
it('should fire a single show/after-show and hide/after-hide when wa-hide event is cancelled', async () => {
const el = await fixture<WaDropdown>(html`
<wa-dropdown>
<wa-button slot="trigger">Dropdown</wa-button>
<wa-dropdown-item>One</wa-dropdown-item>
<wa-dropdown-item>Two</wa-dropdown-item>
</wa-dropdown>
`);
// setup spies to track how often we see different show/hide events
const showSpy = sinon.spy();
const afterShowSpy = sinon.spy();
const hideSpy = sinon.spy();
const afterHideSpy = sinon.spy();
el.addEventListener('wa-show', showSpy);
el.addEventListener('wa-after-show', afterShowSpy);
// Intercept wa-hide and prevent it
el.addEventListener('wa-hide', event => {
event.preventDefault();
hideSpy(event);
});
el.addEventListener('wa-after-hide', afterHideSpy);
// open the dropdown by triggering a click on the trigger
const trigger = el.querySelector<HTMLElement>('[slot="trigger"]')!;
trigger.click();
await waitUntil(() => showSpy.calledOnce);
await waitUntil(() => afterShowSpy.calledOnce);
expect(showSpy.callCount).to.equal(1);
expect(afterShowSpy.callCount).to.equal(1);
expect(el.open).to.be.true;
// click on the trigger (which should do nothing to the open state)
trigger.click();
await waitUntil(() => hideSpy.calledOnce);
expect(hideSpy.callCount).to.equal(1);
// after-hide should not have been called if hide is cancelled
expect(afterHideSpy.callCount).to.equal(0);
expect(el.open).to.be.true;
});
});

View File

@@ -109,18 +109,6 @@ export default class WaDropdown extends WebAwesomeElement {
async updated(changedProperties: PropertyValues) {
if (changedProperties.has('open')) {
const previousOpen = changedProperties.get('open');
// check if the previous value is the same
// (if they are, do not trigger menu showing / hiding)
if (previousOpen === this.open) {
return;
}
// check if we are changing from undefined to false
// (if we are, we can skip menu hiding)
if (previousOpen === undefined && this.open === false) {
return;
}
this.customStates.set('open', this.open);
if (this.open) {
@@ -239,12 +227,6 @@ export default class WaDropdown extends WebAwesomeElement {
return;
}
// if this dropdown is already open, do nothing
// (this can happen when wa-hide was cancelled)
if (this.popup.active) {
return;
}
openDropdowns.forEach(dropdown => (dropdown.open = false));
this.popup.active = true; // Use wa-popup's active property instead of showPopover

View File

@@ -25,6 +25,7 @@
svg {
height: 1em;
fill: currentColor;
overflow: visible;
/* Duotone colors with path-specific opacity fallback */

View File

@@ -249,7 +249,7 @@ export default class WaIcon extends WebAwesomeElement {
return this.svg;
}
return html`<svg part="svg" width="16" height="16"></svg>`;
return html`<svg part="svg" fill="currentColor" width="16" height="16"></svg>`;
}
}

View File

@@ -53,19 +53,6 @@
overflow-y: auto;
}
#start-shadow,
#end-shadow {
z-index: 2;
}
#start-shadow {
opacity: var(--start-shadow-opacity);
}
#end-shadow {
opacity: var(--end-shadow-opacity);
}
/* Horizontal shadows */
:host([orientation='horizontal']) {
#start-shadow,
@@ -77,6 +64,14 @@
pointer-events: none;
}
#start-shadow {
opacity: var(--start-shadow-opacity);
}
#end-shadow {
opacity: var(--end-shadow-opacity);
}
#start-shadow {
&:dir(ltr) {
left: 0;
@@ -107,12 +102,21 @@
#start-shadow,
#end-shadow {
position: absolute;
z-index: 2;
right: 0;
left: 0;
height: var(--shadow-size);
pointer-events: none;
}
#start-shadow {
opacity: var(--start-shadow-opacity);
}
#end-shadow {
opacity: var(--end-shadow-opacity);
}
#start-shadow {
top: 0;
background: linear-gradient(to bottom, var(--shadow-color), transparent 100%);

View File

@@ -74,6 +74,7 @@
padding: 0 var(--wa-form-control-padding-inline);
position: relative;
vertical-align: middle;
width: 100%;
transition:
background-color var(--wa-transition-normal),
border var(--wa-transition-normal),

View File

@@ -119,7 +119,7 @@ export default class WaSelect extends WebAwesomeFormAssociatedElement {
@state() optionValues: Set<string | null> | undefined;
/** The name of the select, submitted as a name/value pair with form data. */
@property({ reflect: true }) name = '';
@property() name = '';
private _defaultValue: null | string | string[] = null;

View File

@@ -73,16 +73,12 @@ slot:not([name])::slotted(wa-icon) {
rotate: -90deg;
}
.tree-item-expanded:not(.tree-item-loading) slot[name='expand-icon'],
.tree-item-expanded slot[name='expand-icon'],
.tree-item:not(.tree-item-expanded) slot[name='collapse-icon'] {
display: none;
}
.tree-item:not(.tree-item-has-expand-button):not(.tree-item-loading) .expand-icon-slot {
display: none;
}
.tree-item-loading .expand-icon-slot wa-icon {
.tree-item:not(.tree-item-has-expand-button) .expand-icon-slot {
display: none;
}

View File

@@ -254,7 +254,6 @@ export default class WaTreeItem extends WebAwesomeElement {
'tree-item-expanded': this.expanded,
'tree-item-selected': this.selected,
'tree-item-leaf': this.isLeaf,
'tree-item-loading': this.loading,
'tree-item-has-expand-button': showExpandButton,
})}"
>
@@ -273,10 +272,8 @@ export default class WaTreeItem extends WebAwesomeElement {
${when(
this.loading,
() => html` <wa-spinner part="spinner" exportparts="base:spinner__base"></wa-spinner> `,
() => html`
<wa-icon name=${isRtl ? 'chevron-left' : 'chevron-right'} library="system" variant="solid"></wa-icon>
`,
)}
<wa-icon name=${isRtl ? 'chevron-left' : 'chevron-right'} library="system" variant="solid"></wa-icon>
</slot>
<slot class="expand-icon-slot" name="collapse-icon">
<wa-icon name=${isRtl ? 'chevron-left' : 'chevron-right'} library="system" variant="solid"></wa-icon>

View File

@@ -1,7 +1,3 @@
/* Rules shared by all palettes */
@import url('../../layers.css');
@import url('../variants.css');
/* Generates --wa-color-{hue}-on tokens for pairing with any palette's key colors */
:where(:root),
:host {

View File

@@ -1,4 +1,5 @@
@import url('base.css');
@import url('../variants.css');
@layer wa-color-palette {
.wa-palette-bright {

View File

@@ -1,4 +1,5 @@
@import url('base.css');
@import url('../variants.css');
@layer wa-color-palette {
:where(:root),

View File

@@ -1,4 +1,5 @@
@import url('base.css');
@import url('../variants.css');
@layer wa-color-palette {
.wa-palette-shoelace,

View File

@@ -1,2 +0,0 @@
/* Order of precedence for all cascade layers in Web Awesome */
@layer wa-native, wa-utilities, wa-color-palette, wa-color-variant, wa-theme, wa-theme-dimension, wa-theme-overrides;

View File

@@ -1,6 +1,3 @@
@import url('layers.css');
/* Required utilities */
@import url('utilities/size.css');
@import url('utilities/variants.css');

View File

@@ -1,4 +1,3 @@
@import url('../layers.css');
@import url('../color/palettes/bright.css'); /* To use this palette, add class="wa-palette-bright" to the <html> element */
@import url('https://fonts.bunny.net/css2?family=Crimson+Pro:ital,wght@0,200..900;1,200..900&family=Quicksand:wght@300..700&display=swap');

View File

@@ -1,4 +1,3 @@
@import url('../layers.css');
@import url('../color/palettes/default.css');
@layer wa-theme {

View File

@@ -1,4 +1,3 @@
@import url('../layers.css');
@import url('../color/palettes/shoelace.css'); /* To use this palette, add class="wa-palette-shoelace" to the <html> element */
@layer wa-theme {

View File

@@ -1,5 +1,3 @@
@import url('layers.css');
@import url('utilities/fouce.css');
@import url('utilities/visually-hidden.css');
@import url('utilities/scroll-lock.css');

View File

@@ -1,10 +1,9 @@
/* Cascade layers */
@import url('layers.css');
@layer wa-native, wa-utilities, wa-color-palette, wa-color-variant, wa-theme, wa-theme-dimension, wa-theme-overrides;
/* Native styles */
/* Native Styles */
@import url('native.css');
/* CSS utilities */
/* CSS Utilities */
@import url('utilities.css');
/* Theme */