@f-ewald/components 1.40.0 → 1.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +170 -6
- package/dist/breadcrumb-nav.d.ts +20 -2
- package/dist/breadcrumb-nav.d.ts.map +1 -1
- package/dist/breadcrumb-nav.js +53 -7
- package/dist/breadcrumb-nav.js.map +1 -1
- package/dist/empty-state.d.ts +16 -0
- package/dist/empty-state.d.ts.map +1 -1
- package/dist/empty-state.js +39 -8
- package/dist/empty-state.js.map +1 -1
- package/dist/skip-link.d.ts +10 -2
- package/dist/skip-link.d.ts.map +1 -1
- package/dist/skip-link.js +55 -7
- package/dist/skip-link.js.map +1 -1
- package/dist/spec-list.d.ts +17 -8
- package/dist/spec-list.d.ts.map +1 -1
- package/dist/spec-list.js +103 -45
- package/dist/spec-list.js.map +1 -1
- package/dist/tokens.css +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +8 -4
- package/dist/tokens.js.map +1 -1
- package/dist/vote-control.d.ts.map +1 -1
- package/dist/vote-control.js +9 -2
- package/dist/vote-control.js.map +1 -1
- package/docs/breadcrumb-nav.md +1 -1
- package/docs/empty-state.md +6 -1
- package/docs/skip-link.md +10 -3
- package/docs/spec-list.md +18 -10
- package/llms.txt +23 -12
- package/package.json +1 -1
package/dist/spec-list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec-list.js","sourceRoot":"","sources":["../src/spec-list.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,QAAQ,GAAd,MAAM,Q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AAC,OAAO,CAAC,CAAC,CAAC,EAAE;0BAChB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;;UAElD,SAAS;YACT,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CACZ,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;wBAEJ,IAAI,CAAC,KAAK;wBACV,IAAI,CAAC,KAAK;;eAEnB,CACF;YACH,CAAC,CAAC,OAAO;4BACS,IAAI,CAAC,aAAa;;KAEzC,CAAC;IACJ,CAAC;CACF,CAAA;AA9H4B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;uCAA4B;AAMzB;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAAqC;AAGrB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAiB;AAGhD;IAAX,QAAQ,EAAE;yCAAc;AAGR;IAAhB,KAAK,EAAE;6CAA6B;AAjB1B,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAgIpB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** One key/value row of a {@link SpecList} in the data-driven `items` path. */\nexport interface SpecListItem {\n /** The attribute name, shown as the muted, wide-tracked key. */\n label: string;\n /** The attribute value, shown against the key. */\n value: string;\n}\n\n/**\n * A key/value specification sheet — the \"spec sheet\" block on a product page:\n * an uppercase, muted, wide-tracked key column against a value column,\n * separated by hairline rules. It describes ONE record's attributes, which is\n * what sets it apart from `data-table` (many records, many columns, sorting);\n * `spec-list` is not tabular and renders a real `<dl>`/`<dt>`/`<dd>` structure.\n *\n * Feed it the `items` array for the plain data path, or slot your own\n * `<div><dt>…</dt><dd>…</dd></div>` groups when a value needs a link, a\n * `status-pill`, or other markup. Slotted content takes precedence over\n * `items`; with neither, nothing is rendered.\n *\n * @element spec-list\n * @slot - Optional `<div><dt>…</dt><dd>…</dd></div>` groups for values that\n * need custom markup; when present, they replace the `items` path.\n */\n@customElement(\"spec-list\")\nexport class SpecList extends LitElement {\n /** The key/value rows for the data-driven path. Ignored when the default slot has content. */\n @property({ type: Array }) items: SpecListItem[] = [];\n\n /**\n * `auto` is the two-column grid that collapses to stacked below `48rem`;\n * `stacked` forces the stacked form at every width.\n */\n @property({ reflect: true }) layout: \"auto\" | \"stacked\" = \"auto\";\n\n /** Whether to draw a hairline rule between rows; `false` for a dense inline listing. */\n @property({ type: Boolean, reflect: true }) dividers = true;\n\n /** Optional accessible caption rendered above the list; no element or reserved space when empty. */\n @property() caption = \"\";\n\n /** Whether the default slot currently has assigned content. */\n @state() private _hasSlotted = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .caption {\n margin: 0 0 0.5rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n letter-spacing: var(--ui-tracking-wide, 0.04em);\n text-transform: var(--ui-label-transform, none);\n color: var(--ui-text-muted, #64748b);\n }\n .list {\n margin: 0;\n }\n .list.empty {\n display: none;\n }\n /* Both the data-driven rows and the slotted div groups are laid out as\n the same two-column grid so the two paths line up identically. */\n .row,\n ::slotted(*) {\n display: grid;\n grid-template-columns: 11rem minmax(0, 1fr);\n column-gap: 0.75rem;\n padding: 0.5rem 0;\n }\n :host([dividers]) .row,\n :host([dividers]) ::slotted(*) {\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n :host([dividers]) .row:last-of-type,\n :host([dividers]) ::slotted(*:last-of-type) {\n border-bottom: none;\n }\n .row dt {\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n letter-spacing: var(--ui-tracking-wide, 0.04em);\n text-transform: var(--ui-label-transform, none);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text-muted, #64748b);\n }\n .row dd {\n margin: 0;\n min-width: 0;\n font-size: var(--ui-font-size, 0.875rem);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text, #0f172a);\n word-break: break-word;\n }\n :host([layout=\"stacked\"]) .row,\n :host([layout=\"stacked\"]) ::slotted(*) {\n grid-template-columns: minmax(0, 1fr);\n row-gap: 0.25rem;\n }\n @media (max-width: 48rem) {\n :host([layout=\"auto\"]) .row,\n :host([layout=\"auto\"]) ::slotted(*) {\n grid-template-columns: minmax(0, 1fr);\n row-gap: 0.25rem;\n }\n }\n `,\n ];\n\n /** Tracks whether the default slot has content so slotted markup can take precedence over `items`. */\n private _onSlotChange(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n this._hasSlotted = slot.assignedNodes({ flatten: true }).some((node) => {\n return node.nodeType === Node.ELEMENT_NODE || (node.textContent ?? \"\").trim().length > 0;\n });\n }\n\n override render() {\n const showItems = !this._hasSlotted && this.items.length > 0;\n const empty = !this._hasSlotted && this.items.length === 0;\n return html`\n ${this.caption ? html`<div class=\"caption\" id=\"caption\">${this.caption}</div>` : nothing}\n <dl\n class=\"list ${empty ? \"empty\" : \"\"}\"\n aria-labelledby=${this.caption ? \"caption\" : nothing}\n >\n ${showItems\n ? this.items.map(\n (item) => html`\n <div class=\"row\">\n <dt>${item.label}</dt>\n <dd>${item.value}</dd>\n </div>\n `,\n )\n : nothing}\n <slot @slotchange=${this._onSlotChange}></slot>\n </dl>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"spec-list\": SpecList;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"spec-list.js","sourceRoot":"","sources":["../src/spec-list.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAA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AQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;uCAA4B;AAMzB;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAAqC;AAGrB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAiB;AAGhD;IAAX,QAAQ,EAAE;yCAAc;AAGR;IAAhB,KAAK,EAAE;6CAA6B;AAjB1B,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAqLpB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** One key/value row of a {@link SpecList} in the data-driven `items` path. */\nexport interface SpecListItem {\n /** The attribute name, shown as the muted, wide-tracked key. */\n label: string;\n /** The attribute value, shown against the key. */\n value: string;\n}\n\n/**\n * A key/value specification sheet — the \"spec sheet\" block on a product page:\n * a muted, wide-tracked key column against a value column, separated by\n * hairline rules (and uppercased under themes that set\n * `--ui-label-transform`). It describes ONE record's attributes, which is\n * what sets it apart from `data-table` (many records, many columns, sorting);\n * `spec-list` is not tabular and renders a real `<dl>`/`<dt>`/`<dd>` structure.\n *\n * Feed it the `items` array for the plain data path, or slot bare `<dt>`/`<dd>`\n * pairs when a value needs a link, a `status-pill`, or other markup — slotted\n * pairs inherit the component's own key/value styling, so no page CSS is\n * needed. A `<div>` wrapping a pair is also accepted as a full-width grouping\n * row, but `::slotted()` cannot reach inside it, so those `dt`/`dd` stay the\n * consumer's to style. Slotted content takes precedence over `items`; with\n * neither, nothing is rendered.\n *\n * @element spec-list\n * @slot - Optional `<dt>`/`<dd>` pairs for values that need custom markup;\n * when present, they replace the `items` path.\n */\n@customElement(\"spec-list\")\nexport class SpecList extends LitElement {\n /** The key/value rows for the data-driven path. Ignored when the default slot has content. */\n @property({ type: Array }) items: SpecListItem[] = [];\n\n /**\n * `auto` is the two-column grid that collapses to stacked below `48rem`;\n * `stacked` forces the stacked form at every width.\n */\n @property({ reflect: true }) layout: \"auto\" | \"stacked\" = \"auto\";\n\n /** Whether to draw a hairline rule between rows; `false` for a dense inline listing. */\n @property({ type: Boolean, reflect: true }) dividers = true;\n\n /** Optional accessible caption rendered above the list; no element or reserved space when empty. */\n @property() caption = \"\";\n\n /** Whether the default slot currently has assigned content. */\n @state() private _hasSlotted = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .caption {\n margin: 0 0 0.5rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n letter-spacing: var(--ui-tracking-wide, 0.04em);\n text-transform: var(--ui-label-transform, none);\n color: var(--ui-text-muted, #64748b);\n }\n /* The dl itself is the two-column grid, so a slotted dt/dd pair is a\n direct slottable and can be styled by this stylesheet. Nesting each\n pair in a wrapper element instead would put the dt/dd a level deeper\n than ::slotted() can reach, leaving slotted keys and values entirely\n unstyled — including the dd's 40px UA margin and the min-width: 0 that\n keeps a long value from overflowing the grid column. */\n .list {\n margin: 0;\n display: grid;\n grid-template-columns: 11rem minmax(0, 1fr);\n }\n .list.empty {\n display: none;\n }\n dt,\n ::slotted(dt) {\n /* The column gap is padding on the key rather than column-gap, so a\n divider draws as one unbroken rule across both columns. */\n padding: 0.5rem 0.75rem 0.5rem 0;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n letter-spacing: var(--ui-tracking-wide, 0.04em);\n text-transform: var(--ui-label-transform, none);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text-muted, #64748b);\n }\n dd,\n ::slotted(dd) {\n margin: 0;\n min-width: 0;\n padding: 0.5rem 0;\n font-size: var(--ui-font-size, 0.875rem);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text, #0f172a);\n word-break: break-word;\n }\n :host([dividers]) dt,\n :host([dividers]) dd,\n :host([dividers]) ::slotted(dt),\n :host([dividers]) ::slotted(dd) {\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n :host([dividers]) dt:last-of-type,\n :host([dividers]) dd:last-of-type,\n :host([dividers]) ::slotted(dt:last-of-type),\n :host([dividers]) ::slotted(dd:last-of-type) {\n border-bottom: none;\n }\n /* A slotted wrapper element still groups a pair, but this stylesheet\n cannot reach the dt/dd inside it — the consumer styles those. */\n ::slotted(div) {\n grid-column: 1 / -1;\n display: grid;\n grid-template-columns: 11rem minmax(0, 1fr);\n column-gap: 0.75rem;\n padding: 0.5rem 0;\n }\n :host([dividers]) ::slotted(div) {\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n :host([dividers]) ::slotted(div:last-of-type) {\n border-bottom: none;\n }\n /* Stacked: one column, and the rule sits under the value only, since the\n key and value are now two rows of one logical row. */\n :host([layout=\"stacked\"]) .list,\n :host([layout=\"stacked\"]) ::slotted(div) {\n grid-template-columns: minmax(0, 1fr);\n }\n :host([layout=\"stacked\"]) dt,\n :host([layout=\"stacked\"]) ::slotted(dt) {\n padding: 0.5rem 0 0;\n border-bottom: none;\n }\n :host([layout=\"stacked\"]) dd,\n :host([layout=\"stacked\"]) ::slotted(dd) {\n padding: 0.25rem 0 0.5rem;\n }\n @media (max-width: 48rem) {\n :host([layout=\"auto\"]) .list,\n :host([layout=\"auto\"]) ::slotted(div) {\n grid-template-columns: minmax(0, 1fr);\n }\n :host([layout=\"auto\"]) dt,\n :host([layout=\"auto\"]) ::slotted(dt) {\n padding: 0.5rem 0 0;\n border-bottom: none;\n }\n :host([layout=\"auto\"]) dd,\n :host([layout=\"auto\"]) ::slotted(dd) {\n padding: 0.25rem 0 0.5rem;\n }\n }\n `,\n ];\n\n /** Whether a slot node is real content, ignoring the whitespace ordinary indented markup leaves between children. */\n private static _isContent(node: Node): boolean {\n return node.nodeType === Node.ELEMENT_NODE || (node.textContent ?? \"\").trim().length > 0;\n }\n\n /** Tracks whether the default slot has content so slotted markup can take precedence over `items`. */\n private _onSlotChange(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n this._hasSlotted = slot.assignedNodes({ flatten: true }).some(SpecList._isContent);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n // slotchange only fires after the first render, so without seeding from the\n // light DOM here an element given both items and slotted markup renders\n // both paths for its first update — visible to anything awaiting\n // updateComplete, and contrary to the documented \"slot wins\" contract.\n this._hasSlotted = Array.from(this.childNodes).some(SpecList._isContent);\n }\n\n /** The rows, defended against a non-array value assigned at runtime by a JS or HTML consumer. */\n private _rows(): SpecListItem[] {\n return Array.isArray(this.items) ? this.items.filter((item) => item != null) : [];\n }\n\n override render() {\n const rows = this._rows();\n const showItems = !this._hasSlotted && rows.length > 0;\n const empty = !this._hasSlotted && rows.length === 0;\n return html`\n ${this.caption ? html`<div class=\"caption\" id=\"caption\">${this.caption}</div>` : nothing}\n <dl\n class=\"list ${empty ? \"empty\" : \"\"}\"\n aria-labelledby=${this.caption ? \"caption\" : nothing}\n >\n ${showItems\n ? rows.map((item) => html`<dt>${item.label}</dt><dd>${item.value}</dd>`)\n : nothing}\n <slot @slotchange=${this._onSlotChange}></slot>\n </dl>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"spec-list\": SpecList;\n }\n}\n"]}
|
package/dist/tokens.css
CHANGED
package/dist/tokens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA8K9C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqBlD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyCtD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAanD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA8K9C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqBlD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyCtD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAanD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+DvD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,MAAM,yBAAQ,CAAC"}
|
package/dist/tokens.js
CHANGED
|
@@ -355,10 +355,14 @@ export const blueprintTokenValues = {
|
|
|
355
355
|
"--ui-text-muted": "#686763",
|
|
356
356
|
"--ui-surface": "#ffffff",
|
|
357
357
|
"--ui-surface-muted": "#f0f0f0",
|
|
358
|
-
// ~
|
|
359
|
-
//
|
|
360
|
-
//
|
|
361
|
-
|
|
358
|
+
// ~55% ink over white. Darker than it looks like it needs to be, because a
|
|
359
|
+
// border is often the only thing bounding a white-on-white control, and
|
|
360
|
+
// WCAG 1.4.11 wants 3:1 against both adjacent surfaces for that: this is
|
|
361
|
+
// 3.55:1 on white and 3.12:1 on the muted surface. The lighter ~40% ink
|
|
362
|
+
// (#a2a29f) reads better but only reaches 2.56:1, and 1.5px of extra weight
|
|
363
|
+
// does not buy an exemption. Still short of fully black, which at this width
|
|
364
|
+
// would turn every bordered surface into a hard box.
|
|
365
|
+
"--ui-border": "#898883",
|
|
362
366
|
"--ui-tooltip": "#17160f",
|
|
363
367
|
"--ui-overlay": "rgb(23 22 15 / 0.45)",
|
|
364
368
|
// The "just changed" flash tints toward the accent instead of amber, which
|
package/dist/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAA2B;IACjD,SAAS;IACT,cAAc,EAAE,SAAS,EAAE,aAAa;IACxC,oBAAoB,EAAE,SAAS,EAAE,aAAa;IAC9C,4EAA4E;IAC5E,2EAA2E;IAC3E,0EAA0E;IAC1E,uEAAuE;IACvE,yEAAyE;IACzE,wEAAwE;IACxE,sEAAsE;IACtE,uEAAuE;IACvE,wEAAwE;IACxE,wEAAwE;IACxE,wBAAwB,EAAE,4BAA4B;IACtD,8BAA8B,EAAE,kCAAkC;IAClE,+BAA+B,EAAE,yDAAyD;IAC1F,oBAAoB,EAAE,aAAa;IACnC,yEAAyE;IACzE,uEAAuE;IACvE,wEAAwE;IACxE,oEAAoE;IACpE,oEAAoE;IACpE,kEAAkE;IAClE,kCAAkC,EAAE,MAAM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W,EAAE,SAAS;IACtB,iBAAiB,EAAE,SAAS;IAC5B,gBAAgB,EAAE,SAAS;IAC3B,0EAA0E;IAC1E,2EAA2E;IAC3E,OAAO;IACP,iBAAiB,EAAE,mBAAmB;IAEtC,wEAAwE;IACxE,2EAA2E;IAC3E,qCAAqC;IACrC,wBAAwB,EAAE,SAAS;IACnC,8BAA8B,EAAE,SAAS;IACzC,+BAA+B,EAAE,SAAS;IAC1C,oBAAoB,EAAE,SAAS;IAC/B,2BAA2B,EAAE,SAAS;IACtC,0EAA0E;IAC1E,kEAAkE;IAClE,8BAA8B,EAAE,SAAS;IACzC,oCAAoC,EAAE,SAAS;IAC/C,wCAAwC,EAAE,SAAS;IACnD,qCAAqC,EAAE,SAAS;IAChD,wEAAwE;IACxE,yEAAyE;IACzE,oEAAoE;IACpE,oBAAoB,EAAE,SAAS;IAE/B,aAAa,EAAE,GAAG;IAClB,gBAAgB,EAAE,GAAG;IACrB,kBAAkB,EAAE,GAAG;IACvB,oBAAoB,EAAE,GAAG;IACzB,aAAa,EAAE,kCAAkC;IACjD,gBAAgB,EAAE,qBAAqB;IAEvC,mBAAmB,EAAE,OAAO;IAC5B,sBAAsB,EAAE,WAAW;IACnC,cAAc,EAAE,cAAc;IAC9B,WAAW,EACT,gFAAgF;CACnF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,EAAE,CAAC","sourcesContent":["import { css } from \"lit\";\n\n/**\n * Design token values, sourced from Tailwind v4's default theme palette.\n * Each entry maps a `--ui-*` custom property name to its default value.\n * These are the same values baked in as `var(--ui-*, <fallback>)` fallbacks\n * throughout component styles, so components render correctly with zero\n * external CSS. Consumers may override any of these by setting the custom\n * property on `:root` or an ancestor element (see `tokens.css`).\n */\nexport const tokenValues: Record<string, string> = {\n // Colors\n \"--ui-primary\": \"#4f46e5\", // indigo-600\n \"--ui-primary-hover\": \"#4338ca\", // indigo-700\n // Button-specific background/border hooks: default to the flat --ui-primary\n // / --ui-danger tokens above unchanged, so those stay the single source of\n // truth for every other component. Overriding just these lets a theme opt\n // ui-button into a gradient (or any other) background without touching\n // component markup; --ui-button-border/--ui-button-danger-border default\n // to transparent (today's look) and are meant to be paired with a shade\n // darker than the gradient's dark stop when one is set. The `-active`\n // variants default to whatever `-background` already resolved to (so a\n // solid override still applies while pressed) — a gradient theme should\n // set them to the same stops in reverse, for a pressed/\"indented\" look.\n \"--ui-button-background\": \"var(--ui-primary, #4f46e5)\",\n \"--ui-button-background-hover\": \"var(--ui-primary-hover, #4338ca)\",\n \"--ui-button-background-active\": \"var(--ui-button-background, var(--ui-primary, #4f46e5))\",\n \"--ui-button-border\": \"transparent\",\n // The bordered, transparent-background secondary variant's equivalents —\n // shared with confirm-dialog's Cancel button, which is the same visual\n // pattern. Defaults reproduce today's literal secondary styling exactly\n // (no background at any state, border colors matching --ui-border /\n // --ui-text-muted), so a theme only needs to override these to make\n // secondary/Cancel buttons match a primary/danger gradient theme.\n \"--ui-button-secondary-background\": \"none\",\n \"--ui-button-secondary-background-hover\": \"none\",\n \"--ui-button-secondary-background-active\": \"var(--ui-button-secondary-background, none)\",\n \"--ui-button-secondary-border\": \"var(--ui-border, #e2e8f0)\",\n \"--ui-button-secondary-border-hover\": \"var(--ui-text-muted, #64748b)\",\n // A muted-gray surface used wherever something already paints\n // --ui-surface-muted as a state indicator in flat mode — button-group's\n // unchecked-segment hover, pagination-nav's button hover, and\n // radio-cards/radio-pills' checked background — which is a genuinely\n // different default than secondary's borderless flat hover, so it can't\n // reuse --ui-button-secondary-background-hover's \"none\" default.\n \"--ui-button-secondary-surface-muted\": \"var(--ui-surface-muted, #f8fafc)\",\n // Shared by both primary/danger — a purely cosmetic gloss/legibility pair,\n // not color-specific, so one token covers both variants. `-highlight` is a\n // full box-shadow value (e.g. `inset 0 1px 0 rgb(255 255 255 / 0.35)`) for\n // a glossy top edge, defaulting to a fully transparent (so invisible)\n // shadow rather than the keyword `none` — some usages combine it with\n // another literal shadow in a comma-separated list, where a bare `none`\n // item is invalid CSS and would zero out the *whole* declaration.\n // `-text-shadow` is a full text-shadow value for label legibility against\n // a gradient's lighter stop, always used standalone, so it keeps `none`.\n \"--ui-button-highlight\": \"0 0 0 0 transparent\",\n \"--ui-button-text-shadow\": \"none\",\n // A solid stand-in for the same accent, for spots that can't render a\n // background gradient at all — a native <input>'s accent-color only\n // accepts a plain color, and a hard-stop background gradient (e.g.\n // range-slider's filled track) can't nest another gradient inside its own\n // color-stop list. Consumers that theme the buttons into a gradient should\n // set this to the gradient's dark stop, so these non-button accents (radio\n // selection indicators, the range-slider track/thumb) stay visually\n // coordinated with it even though they can't literally paint a gradient.\n \"--ui-button-accent\": \"var(--ui-primary, #4f46e5)\",\n \"--ui-info\": \"#0ea5e9\", // sky-500\n \"--ui-info-hover\": \"#0284c7\", // sky-600\n \"--ui-danger\": \"#dc2626\", // red-600\n \"--ui-danger-hover\": \"#b91c1c\", // red-700\n \"--ui-button-danger-background\": \"var(--ui-danger, #dc2626)\",\n \"--ui-button-danger-background-hover\": \"var(--ui-danger-hover, #b91c1c)\",\n \"--ui-button-danger-background-active\":\n \"var(--ui-button-danger-background, var(--ui-danger, #dc2626))\",\n \"--ui-button-danger-border\": \"transparent\",\n \"--ui-success\": \"#16a34a\", // green-600\n \"--ui-warning\": \"#d97706\", // amber-600\n \"--ui-warning-hover\": \"#b45309\", // amber-700\n // toast-notification's per-variant background hooks: default to the flat\n // --ui-success/--ui-danger/--ui-info/--ui-warning tokens unchanged, so\n // those stay the single source of truth for every other component —\n // the same pattern as --ui-button-background/--ui-button-danger-background\n // above. `-highlight`/`-text-shadow` are the same glossy-top-edge /\n // legibility-shadow pair as --ui-button-highlight/--ui-button-text-shadow,\n // kept as separate tokens so a theme can gloss toasts and buttons\n // independently.\n \"--ui-toast-success-background\": \"var(--ui-success, #16a34a)\",\n \"--ui-toast-error-background\": \"var(--ui-danger, #dc2626)\",\n \"--ui-toast-info-background\": \"var(--ui-info, #0ea5e9)\",\n \"--ui-toast-warning-background\": \"var(--ui-warning, #d97706)\",\n \"--ui-toast-highlight\": \"0 0 0 0 transparent\",\n \"--ui-toast-text-shadow\": \"none\",\n // AI accent sweep — the four stops of the animated multi-hue ring\n // ui-button's `ai` modifier draws around a button (and the only place a\n // rainbow reads as meaning \"this action is AI-powered\" rather than a\n // semantic state). Ordered around the color wheel and looping back to\n // stop 1, so the sweep is seamless; --ui-ai-2 is --ui-primary's own\n // indigo, anchoring the ring to the rest of the palette. Overriding these\n // four retunes every AI button at once.\n \"--ui-ai-1\": \"#38bdf8\", // sky-400\n \"--ui-ai-2\": \"#6366f1\", // indigo-500\n \"--ui-ai-3\": \"#d946ef\", // fuchsia-500\n \"--ui-ai-4\": \"#fbbf24\", // amber-400\n \"--ui-on-accent\": \"#ffffff\",\n \"--ui-text\": \"#0f172a\", // slate-900\n \"--ui-text-muted\": \"#64748b\", // slate-500\n \"--ui-border\": \"#e2e8f0\", // slate-200\n \"--ui-surface\": \"#ffffff\", // white\n \"--ui-surface-muted\": \"#f8fafc\", // slate-50\n \"--ui-highlight\": \"#fde68a\", // amber-200 — transient \"just changed\" flash\n \"--ui-tooltip\": \"#0f172a\", // slate-900\n \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.32)\",\n \"--ui-overlay\": \"rgb(15 23 42 / 0.45)\", // slate-900 / 45%\n\n // Shape / depth\n \"--ui-radius\": \"0.5rem\", // rounded-lg\n \"--ui-radius-sm\": \"0.25rem\", // rounded\n // The width of a themeable surface/control border. Spacing is deliberately\n // untokenized, but a border is chrome rather than layout: the `blueprint`\n // theme's whole structure is carried by hairline rules instead of shadows,\n // and it needs those rules one step heavier than the default. Defaults to\n // the literal 1px every component used before, so nothing renders\n // differently until a theme overrides it. Only genuine surface/control\n // borders read this — forced-colors `CanvasText` borders and purely\n // decorative literals (a slider thumb's white ring, a tab's 2px underline)\n // keep their own widths, since those aren't the theme's structural rules.\n // Anything with a fixed height/width and a themeable border must also set\n // `box-sizing: border-box`, or a heavier border grows it past the shared\n // 2rem control target.\n \"--ui-border-width\": \"1px\",\n // Deliberate pill/circle shapes — a chip, an avatar, a slider thumb, a dot.\n // Tokenized rather than hardcoded so a theme that squares the design system\n // (metro) can reach them too; a literal 9999px/50% silently opts that shape\n // out of every theme. Use these only where the shape is the point, not as a\n // heavier --ui-radius.\n \"--ui-radius-pill\": \"9999px\",\n \"--ui-radius-circle\": \"50%\",\n \"--ui-shadow\":\n \"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)\", // shadow-md\n \"--ui-shadow-lg\":\n \"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)\", // shadow-xl\n \"--ui-focus-ring\": \"0 0 0 3px rgb(79 70 229 / 0.35)\",\n\n // Type\n \"--ui-font\":\n 'ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"',\n \"--ui-font-mono\":\n \"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace\",\n \"--ui-font-size-lg\": \"1rem\", // text-base\n \"--ui-font-size\": \"0.875rem\", // text-sm\n \"--ui-font-size-sm\": \"0.75rem\", // text-xs\n \"--ui-font-size-xs\": \"0.6875rem\",\n\n // Font weights — the only four weights the system uses.\n \"--ui-font-weight-regular\": \"400\",\n \"--ui-font-weight-medium\": \"500\",\n \"--ui-font-weight-semibold\": \"600\",\n \"--ui-font-weight-bold\": \"700\",\n\n // Line heights — glyph (icon/marker box), tight (headings), normal (body).\n \"--ui-line-height-glyph\": \"1\",\n \"--ui-line-height-tight\": \"1.25\",\n \"--ui-line-height-normal\": \"1.5\",\n\n // Letter spacing / tracking — default and the single widened step.\n \"--ui-tracking-normal\": \"0\",\n \"--ui-tracking-wide\": \"0.04em\",\n\n // Casing of chrome micro-labels — the small, wide-tracked labels that name a\n // region rather than carry content (a `frame-box` legend, an `app-sidebar`\n // section heading, a `stat-meter` caption). Defaults to `none`, today's\n // sentence case, so nothing changes until a theme sets it; the `blueprint`\n // theme sets `uppercase`, where signage-style labels are the point. Never\n // apply this to user-supplied content — shouting someone's data is not a\n // theme's decision, and `text-transform` is a presentational lie that\n // survives copy/paste as the original casing anyway.\n \"--ui-label-transform\": \"none\",\n\n // Numeral rendering for figures that change in place or stack into a column\n // — a score, a page number, a running clock. Defaults to `normal`\n // (proportional, as before); `tabular-nums` stops digits from jittering\n // horizontally as they tick, which the `blueprint` theme's spec-sheet\n // aesthetic wants everywhere.\n \"--ui-numeric\": \"normal\",\n};\n\n/**\n * Dark-mode overrides for the same `--ui-*` custom properties, applied by\n * `tokens.css` via `@media (prefers-color-scheme: dark)` and `[data-theme]`\n * (see generate-tokens-css.mjs). Same Tailwind slate scale as the light\n * palette, inverted, with primary/danger/success lightened one step (500\n * instead of 600) for sufficient contrast against dark surfaces. Shape/type\n * tokens are theme-independent and not repeated here.\n */\nexport const darkTokenValues: Record<string, string> = {\n \"--ui-primary\": \"#6366f1\", // indigo-500\n \"--ui-primary-hover\": \"#818cf8\", // indigo-400\n \"--ui-info\": \"#38bdf8\", // sky-400\n \"--ui-info-hover\": \"#7dd3fc\", // sky-300\n \"--ui-danger\": \"#ef4444\", // red-500\n \"--ui-danger-hover\": \"#f87171\", // red-400\n \"--ui-success\": \"#22c55e\", // green-500\n \"--ui-warning\": \"#f59e0b\", // amber-500\n \"--ui-warning-hover\": \"#fbbf24\", // amber-400\n \"--ui-on-accent\": \"#ffffff\",\n \"--ui-text\": \"#f1f5f9\", // slate-100\n \"--ui-text-muted\": \"#94a3b8\", // slate-400\n \"--ui-border\": \"#334155\", // slate-700\n \"--ui-surface\": \"#0f172a\", // slate-900\n \"--ui-surface-muted\": \"#1e293b\", // slate-800\n \"--ui-highlight\": \"#854d0e\", // amber-800 — transient \"just changed\" flash on dark\n \"--ui-tooltip\": \"#020617\", // slate-950\n \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.12)\",\n \"--ui-overlay\": \"rgb(2 6 23 / 0.6)\", // slate-950 / 60%\n \"--ui-focus-ring\": \"0 0 0 3px rgb(99 102 241 / 0.45)\",\n};\n\n/**\n * \"Gradient\" theme overrides, applied via `data-theme=\"gradient\"` on `<html>`\n * (see `generate-tokens-css.mjs`) — forces `color-scheme: light` like the\n * `\"light\"` override and layers a glossy gradient look on top of the flat\n * light palette, using exactly the `--ui-button-*`/`--ui-button-danger-*`/\n * `--ui-button-secondary-*` hooks `ui-button.ts` already reads (see that\n * file's doc comment), plus the `--ui-toast-*` hooks `toast-notification.ts`\n * reads (see its doc comment). Every other token (`--ui-text`, `--ui-surface`,\n * …) is left at its light-mode default — this theme only glosses buttons and\n * toasts by design. Each variant's gradient runs light-to-dark top-to-bottom\n * (`180deg`) across one Tailwind shade step lighter/darker than the flat\n * token so it still reads as \"the same color, glossy\" rather than a\n * different hue; `-hover` shifts the whole pair one shade lighter, `-active`\n * reverses the two stops for a pressed/\"indented\" look, and `-border` is a\n * shade darker than the gradient's dark stop for a defining edge.\n */\nexport const gradientTokenValues: Record<string, string> = {\n \"--ui-button-background\": \"linear-gradient(180deg, #6366f1 0%, #4f46e5 100%)\", // indigo-500 -> 600\n \"--ui-button-background-hover\": \"linear-gradient(180deg, #818cf8 0%, #6366f1 100%)\", // indigo-400 -> 500\n \"--ui-button-background-active\": \"linear-gradient(180deg, #4f46e5 0%, #6366f1 100%)\", // reversed 600 -> 500\n \"--ui-button-border\": \"#4338ca\", // indigo-700\n \"--ui-button-danger-background\": \"linear-gradient(180deg, #ef4444 0%, #dc2626 100%)\", // red-500 -> 600\n \"--ui-button-danger-background-hover\": \"linear-gradient(180deg, #f87171 0%, #ef4444 100%)\", // red-400 -> 500\n \"--ui-button-danger-background-active\": \"linear-gradient(180deg, #dc2626 0%, #ef4444 100%)\", // reversed 600 -> 500\n \"--ui-button-danger-border\": \"#b91c1c\", // red-700\n // Secondary stays neutral gray rather than a saturated hue, matching its\n // flat \"not the primary action\" role, but one shade darker than the\n // original white -> slate-50 pairing: at a small button size, that pair\n // read as flat white with no visible gradient at all. slate-50 -> 100\n // keeps enough contrast to actually look like a gradient while still\n // being clearly lighter/quieter than primary/danger. Border stays\n // slate-300 (a step past the flat slate-200) so its edge still reads\n // against the fill.\n \"--ui-button-secondary-background\": \"linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%)\", // slate-50 -> 100\n \"--ui-button-secondary-background-hover\": \"linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%)\", // slate-100 -> 200\n \"--ui-button-secondary-background-active\": \"linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%)\", // reversed 100 -> 50\n \"--ui-button-secondary-border\": \"#cbd5e1\", // slate-300\n \"--ui-button-secondary-border-hover\": \"#94a3b8\", // slate-400\n // button-group's unchecked segments, pagination-nav's prev/next buttons, and\n // radio-cards/radio-pills' checked background read this rather than\n // --ui-button-secondary-background (see tokens above). Left flat they were\n // the one \"secondary\" surface that stayed matte while every actual secondary\n // button turned glossy, so it tracks the hover gradient rather than a\n // separate literal that could drift out of step with it.\n \"--ui-button-secondary-surface-muted\": \"var(--ui-button-secondary-background-hover)\",\n \"--ui-button-highlight\": \"inset 0 1px 0 rgb(255 255 255 / 0.35)\", // glossy top edge\n \"--ui-button-text-shadow\": \"0 1px 1px rgb(0 0 0 / 0.25)\", // legibility on primary/danger\n \"--ui-button-accent\": \"#4338ca\", // indigo-700, matches --ui-button-border\n // toast-notification: same light-to-dark, one-shade-step gradient\n // convention as the button variants above; the bottom stop always matches\n // the flat --ui-success/--ui-danger/--ui-info/--ui-warning value exactly.\n \"--ui-toast-success-background\": \"linear-gradient(180deg, #22c55e 0%, #16a34a 100%)\", // green-500 -> 600\n \"--ui-toast-error-background\": \"linear-gradient(180deg, #ef4444 0%, #dc2626 100%)\", // red-500 -> 600\n \"--ui-toast-info-background\": \"linear-gradient(180deg, #38bdf8 0%, #0ea5e9 100%)\", // sky-400 -> 500\n \"--ui-toast-warning-background\": \"linear-gradient(180deg, #f59e0b 0%, #d97706 100%)\", // amber-500 -> 600\n \"--ui-toast-highlight\": \"inset 0 1px 0 rgb(255 255 255 / 0.35)\", // glossy top edge, same as --ui-button-highlight\n \"--ui-toast-text-shadow\": \"0 1px 1px rgb(0 0 0 / 0.25)\", // legibility, same as --ui-button-text-shadow\n};\n\n/**\n * \"Metro\" theme overrides, applied via `data-theme=\"metro\"` on `<html>` (see\n * `generate-tokens-css.mjs`) — forces `color-scheme: light` like the `\"light\"`\n * and `\"gradient\"` overrides, and strips the roundness and depth off the flat\n * light palette to leave hard-edged surfaces over a blue accent, after the\n * dense square-cornered look of the early social bookmarking sites.\n *\n * This is the first theme to override shape rather than only color, so the\n * \"shape/type tokens are theme-independent\" rule `darkTokenValues` notes above\n * holds for every theme except this one (see `docs/design-language.md`).\n * Squaring the design system means squaring the deliberate pill and circle\n * shapes too — chips, avatars, dots, slider thumbs — which is why those read\n * `--ui-radius-pill`/`--ui-radius-circle` rather than hardcoding `9999px`/`50%`\n * (a literal would silently opt that shape out of the theme).\n *\n * One residual is genuinely out of reach: `price-history-chart` rounds its bars\n * with an SVG `rx` presentation attribute, which cannot take a `var()`, so\n * those stay slightly rounded under metro.\n *\n * The shadows flatten to a hairline ring rather than to `none`. Dropping them\n * outright would leave `slide-panel` — the only overlay with no border of its\n * own — as an invisible white-on-white edge; every other consumer of\n * `--ui-shadow*` either pairs it with `1px solid var(--ui-border)` or applies\n * it on hover/active over an already-bordered control. A hard 1px ring keeps\n * that separation while removing the blur and the faked depth.\n */\nexport const metroTokenValues: Record<string, string> = {\n \"--ui-primary\": \"#3274d0\", // the del.icio.us blue; no Tailwind equivalent\n \"--ui-primary-hover\": \"#2559a8\",\n \"--ui-focus-ring\": \"0 0 0 2px #3274d0\", // solid and crisp, not the default 3px translucent ring\n \"--ui-radius\": \"0\",\n \"--ui-radius-sm\": \"0\",\n \"--ui-radius-pill\": \"0\",\n \"--ui-radius-circle\": \"0\",\n // Hairline rings (slate-900 at low alpha) rather than blurred drop shadows:\n // separation without depth. -lg is a touch stronger, matching the default\n // pair's relative weighting.\n \"--ui-shadow\": \"0 0 0 1px rgb(15 23 42 / 0.12)\",\n \"--ui-shadow-lg\": \"0 0 0 1px rgb(15 23 42 / 0.18)\",\n};\n\n/**\n * \"Blueprint\" theme overrides, applied via `data-theme=\"blueprint\"` on `<html>`\n * (see `generate-tokens-css.mjs`) — forces `color-scheme: light` like every\n * other non-dark theme, and restyles the light palette as a technical catalog\n * / spec sheet: warm near-black ink on white paper, one pure-blue accent,\n * square corners, and structure carried entirely by hairline rules instead of\n * shadows.\n *\n * It is the widest theme in the system, and the reason three token axes exist\n * that no earlier theme needed:\n *\n * - `--ui-font` is retargeted to a monospace stack. `darkTokenValues` notes\n * that shape and type tokens are theme-independent; `metro` already broke\n * that for shape, and this breaks it for the type *family* only. Type\n * *metrics* (size, weight, line height) remain unthemed in every theme —\n * they encode hierarchy, which is not a stylistic choice. \"Space Mono\"\n * leads the stack purely so a consumer who loads that webfont gets the\n * reference face automatically; with no external CSS at all it falls\n * straight through to the same system mono stack `--ui-font-mono` uses, so\n * the theme still renders correctly on its own.\n * - `--ui-border-width` goes to `1.5px`. Every border in this theme is doing\n * the work a shadow does elsewhere, and at 1px those rules read as a faint\n * table rather than as drawn structure.\n * - `--ui-label-transform` goes to `uppercase`, which is what makes chrome\n * micro-labels read as signage/spec-sheet keys. Only labels that name a\n * region or column carry this — never user content.\n * - `--ui-numeric` goes to `tabular-nums`, so figures line up in a column and\n * do not jitter as they change.\n *\n * Buttons are deliberately NOT the accent color. `--ui-primary` stays pure\n * blue because it drives accents everywhere else (active tab underlines,\n * selected states, links, the certification-style tints), but the primary\n * button fill is overridden to ink through the `--ui-button-*` hooks and only\n * turns blue on hover — a black-on-white CTA that lights up is the\n * catalog-print look, and a large pure-blue fill next to blue accents would\n * flatten the two roles into one. That split is exactly what those hooks\n * exist for (see `gradientTokenValues` above for the same technique).\n *\n * Semantic `danger`/`success`/`warning` keep their default hues: they encode\n * meaning rather than style, and the reference's blue-only restraint is an\n * editorial choice a component library cannot make on a consumer's behalf.\n * `--ui-info` is the exception — it is \"neutral notice\", which in this theme\n * is precisely the accent, and the default sky blue would otherwise sit a few\n * degrees off the pure blue beside it and read as a mistake.\n *\n * Shadows flatten to a hard ink ring rather than to `none`, for the same\n * reason `metro` does it: `slide-panel` has no border of its own and would\n * otherwise lose its edge entirely.\n */\nexport const blueprintTokenValues: Record<string, string> = {\n // Ink over paper. --ui-text-muted is the same ink at ~65% over white rather\n // than a neutral gray, so the quiet text stays in the same warm family\n // instead of turning blue-gray beside the accent.\n \"--ui-text\": \"#17160f\",\n \"--ui-text-muted\": \"#686763\",\n \"--ui-surface\": \"#ffffff\",\n \"--ui-surface-muted\": \"#f0f0f0\",\n // ~40% ink over white: a rule that is unmistakably drawn at 1.5px without\n // going fully black, which at this width would turn every bordered surface\n // into a hard box.\n \"--ui-border\": \"#a2a29f\",\n \"--ui-tooltip\": \"#17160f\",\n \"--ui-overlay\": \"rgb(23 22 15 / 0.45)\",\n // The \"just changed\" flash tints toward the accent instead of amber, which\n // is the one warm hue this palette has no room for.\n \"--ui-highlight\": \"#dcdcff\",\n\n \"--ui-primary\": \"#0000ff\",\n \"--ui-primary-hover\": \"#0000cc\",\n \"--ui-info\": \"#0000ff\",\n \"--ui-info-hover\": \"#0000cc\",\n \"--ui-on-accent\": \"#ffffff\",\n // Solid and crisp at the reference's own 2px, not the default translucent\n // 3px halo — a blurred ring is the one soft edge this theme has nowhere to\n // put.\n \"--ui-focus-ring\": \"0 0 0 2px #0000ff\",\n\n // Ink CTA that lights up blue on hover, and inverts its two stops while\n // pressed. The border is ink at every state so the button keeps a defining\n // edge even once the fill goes blue.\n \"--ui-button-background\": \"#17160f\",\n \"--ui-button-background-hover\": \"#0000ff\",\n \"--ui-button-background-active\": \"#0000cc\",\n \"--ui-button-border\": \"#17160f\",\n \"--ui-button-danger-border\": \"#b91c1c\",\n // Secondary is the reference's ghost button: no fill, ink border, a paper\n // wash on hover and an accent border to echo the primary's hover.\n \"--ui-button-secondary-border\": \"#17160f\",\n \"--ui-button-secondary-border-hover\": \"#0000ff\",\n \"--ui-button-secondary-background-hover\": \"#f0f0f0\",\n \"--ui-button-secondary-surface-muted\": \"#f0f0f0\",\n // Non-button accents that can only take a plain color (a native input's\n // accent-color, range-slider's track/thumb) follow --ui-primary, not the\n // ink button fill — those are selection marks, not calls to action.\n \"--ui-button-accent\": \"#0000ff\",\n\n \"--ui-radius\": \"0\",\n \"--ui-radius-sm\": \"0\",\n \"--ui-radius-pill\": \"0\",\n \"--ui-radius-circle\": \"0\",\n \"--ui-shadow\": \"0 0 0 1.5px rgb(23 22 15 / 0.24)\",\n \"--ui-shadow-lg\": \"0 0 0 1.5px #17160f\",\n\n \"--ui-border-width\": \"1.5px\",\n \"--ui-label-transform\": \"uppercase\",\n \"--ui-numeric\": \"tabular-nums\",\n \"--ui-font\":\n '\"Space Mono\", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',\n};\n\n/**\n * Historically a shared `:host { --ui-x: var(--ui-x, fallback); } ` block,\n * re-declaring every token on each component's own host element as a\n * \"materialize the inherited value, or this fallback\" trick. That pattern\n * turned out to be a genuine bug, not a working default: browsers treat\n * `--ui-x: var(--ui-x, ...)` on `:host` as a self-referencing declaration\n * that computes to the guaranteed-invalid value REGARDLESS of what an\n * ancestor (e.g. `:root`) set — the host's own `:host` rule wins the cascade\n * over the ancestor's, so this dropped whatever the app actually set and\n * silently substituted the component's own fallback everywhere. It went\n * unnoticed because every component's fallback happened to equal the\n * intended light-mode value — dark mode (a real, different value at\n * `:root`) exposed it immediately (colors rendering as if no theme were\n * applied at all). Fix: don't redeclare tokens on `:host` — plain\n * inheritance already carries `:root`'s values into every shadow root\n * correctly, and every component already has its own `var(--ui-x, fallback)`\n * at each point of use, so nothing here is needed for the \"zero external\n * CSS\" default to keep working. Kept as an empty export so the existing\n * `static override styles = [tokens, css\\`...\\`]` import in every component\n * keeps compiling.\n */\nexport const tokens = css``;\n"]}
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAA2B;IACjD,SAAS;IACT,cAAc,EAAE,SAAS,EAAE,aAAa;IACxC,oBAAoB,EAAE,SAAS,EAAE,aAAa;IAC9C,4EAA4E;IAC5E,2EAA2E;IAC3E,0EAA0E;IAC1E,uEAAuE;IACvE,yEAAyE;IACzE,wEAAwE;IACxE,sEAAsE;IACtE,uEAAuE;IACvE,wEAAwE;IACxE,wEAAwE;IACxE,wBAAwB,EAAE,4BAA4B;IACtD,8BAA8B,EAAE,kCAAkC;IAClE,+BAA+B,EAAE,yDAAyD;IAC1F,oBAAoB,EAAE,aAAa;IACnC,yEAAyE;IACzE,uEAAuE;IACvE,wEAAwE;IACxE,oEAAoE;IACpE,oEAAoE;IACpE,kEAAkE;IAClE,kCAAkC,EAAE,MAAM;IAC1C,wCAAwC,EAAE,MAAM;IAChD,yCAAyC,EAAE,6CAA6C;IACxF,8BAA8B,EAAE,2BAA2B;IAC3D,oCAAoC,EAAE,+BAA+B;IACrE,8DAA8D;IAC9D,wEAAwE;IACxE,8DAA8D;IAC9D,qEAAqE;IACrE,wEAAwE;IACxE,iEAAiE;IACjE,qCAAqC,EAAE,kCAAkC;IACzE,2EAA2E;IAC3E,2EAA2E;IAC3E,2EAA2E;IAC3E,sEAAsE;IACtE,sEAAsE;IACtE,wEAAwE;IACxE,kEAAkE;IAClE,0EAA0E;IAC1E,yEAAyE;IACzE,uBAAuB,EAAE,qBAAqB;IAC9C,yBAAyB,EAAE,MAAM;IACjC,sEAAsE;IACtE,oEAAoE;IACpE,mEAAmE;IACnE,0EAA0E;IAC1E,2EAA2E;IAC3E,2EAA2E;IAC3E,oEAAoE;IACpE,yEAAyE;IACzE,oBAAoB,EAA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pE,oBAAoB,EAAE,SAAS;IAE/B,aAAa,EAAE,GAAG;IAClB,gBAAgB,EAAE,GAAG;IACrB,kBAAkB,EAAE,GAAG;IACvB,oBAAoB,EAAE,GAAG;IACzB,aAAa,EAAE,kCAAkC;IACjD,gBAAgB,EAAE,qBAAqB;IAEvC,mBAAmB,EAAE,OAAO;IAC5B,sBAAsB,EAAE,WAAW;IACnC,cAAc,EAAE,cAAc;IAC9B,WAAW,EACT,gFAAgF;CACnF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,EAAE,CAAC","sourcesContent":["import { css } from \"lit\";\n\n/**\n * Design token values, sourced from Tailwind v4's default theme palette.\n * Each entry maps a `--ui-*` custom property name to its default value.\n * These are the same values baked in as `var(--ui-*, <fallback>)` fallbacks\n * throughout component styles, so components render correctly with zero\n * external CSS. Consumers may override any of these by setting the custom\n * property on `:root` or an ancestor element (see `tokens.css`).\n */\nexport const tokenValues: Record<string, string> = {\n // Colors\n \"--ui-primary\": \"#4f46e5\", // indigo-600\n \"--ui-primary-hover\": \"#4338ca\", // indigo-700\n // Button-specific background/border hooks: default to the flat --ui-primary\n // / --ui-danger tokens above unchanged, so those stay the single source of\n // truth for every other component. Overriding just these lets a theme opt\n // ui-button into a gradient (or any other) background without touching\n // component markup; --ui-button-border/--ui-button-danger-border default\n // to transparent (today's look) and are meant to be paired with a shade\n // darker than the gradient's dark stop when one is set. The `-active`\n // variants default to whatever `-background` already resolved to (so a\n // solid override still applies while pressed) — a gradient theme should\n // set them to the same stops in reverse, for a pressed/\"indented\" look.\n \"--ui-button-background\": \"var(--ui-primary, #4f46e5)\",\n \"--ui-button-background-hover\": \"var(--ui-primary-hover, #4338ca)\",\n \"--ui-button-background-active\": \"var(--ui-button-background, var(--ui-primary, #4f46e5))\",\n \"--ui-button-border\": \"transparent\",\n // The bordered, transparent-background secondary variant's equivalents —\n // shared with confirm-dialog's Cancel button, which is the same visual\n // pattern. Defaults reproduce today's literal secondary styling exactly\n // (no background at any state, border colors matching --ui-border /\n // --ui-text-muted), so a theme only needs to override these to make\n // secondary/Cancel buttons match a primary/danger gradient theme.\n \"--ui-button-secondary-background\": \"none\",\n \"--ui-button-secondary-background-hover\": \"none\",\n \"--ui-button-secondary-background-active\": \"var(--ui-button-secondary-background, none)\",\n \"--ui-button-secondary-border\": \"var(--ui-border, #e2e8f0)\",\n \"--ui-button-secondary-border-hover\": \"var(--ui-text-muted, #64748b)\",\n // A muted-gray surface used wherever something already paints\n // --ui-surface-muted as a state indicator in flat mode — button-group's\n // unchecked-segment hover, pagination-nav's button hover, and\n // radio-cards/radio-pills' checked background — which is a genuinely\n // different default than secondary's borderless flat hover, so it can't\n // reuse --ui-button-secondary-background-hover's \"none\" default.\n \"--ui-button-secondary-surface-muted\": \"var(--ui-surface-muted, #f8fafc)\",\n // Shared by both primary/danger — a purely cosmetic gloss/legibility pair,\n // not color-specific, so one token covers both variants. `-highlight` is a\n // full box-shadow value (e.g. `inset 0 1px 0 rgb(255 255 255 / 0.35)`) for\n // a glossy top edge, defaulting to a fully transparent (so invisible)\n // shadow rather than the keyword `none` — some usages combine it with\n // another literal shadow in a comma-separated list, where a bare `none`\n // item is invalid CSS and would zero out the *whole* declaration.\n // `-text-shadow` is a full text-shadow value for label legibility against\n // a gradient's lighter stop, always used standalone, so it keeps `none`.\n \"--ui-button-highlight\": \"0 0 0 0 transparent\",\n \"--ui-button-text-shadow\": \"none\",\n // A solid stand-in for the same accent, for spots that can't render a\n // background gradient at all — a native <input>'s accent-color only\n // accepts a plain color, and a hard-stop background gradient (e.g.\n // range-slider's filled track) can't nest another gradient inside its own\n // color-stop list. Consumers that theme the buttons into a gradient should\n // set this to the gradient's dark stop, so these non-button accents (radio\n // selection indicators, the range-slider track/thumb) stay visually\n // coordinated with it even though they can't literally paint a gradient.\n \"--ui-button-accent\": \"var(--ui-primary, #4f46e5)\",\n \"--ui-info\": \"#0ea5e9\", // sky-500\n \"--ui-info-hover\": \"#0284c7\", // sky-600\n \"--ui-danger\": \"#dc2626\", // red-600\n \"--ui-danger-hover\": \"#b91c1c\", // red-700\n \"--ui-button-danger-background\": \"var(--ui-danger, #dc2626)\",\n \"--ui-button-danger-background-hover\": \"var(--ui-danger-hover, #b91c1c)\",\n \"--ui-button-danger-background-active\":\n \"var(--ui-button-danger-background, var(--ui-danger, #dc2626))\",\n \"--ui-button-danger-border\": \"transparent\",\n \"--ui-success\": \"#16a34a\", // green-600\n \"--ui-warning\": \"#d97706\", // amber-600\n \"--ui-warning-hover\": \"#b45309\", // amber-700\n // toast-notification's per-variant background hooks: default to the flat\n // --ui-success/--ui-danger/--ui-info/--ui-warning tokens unchanged, so\n // those stay the single source of truth for every other component —\n // the same pattern as --ui-button-background/--ui-button-danger-background\n // above. `-highlight`/`-text-shadow` are the same glossy-top-edge /\n // legibility-shadow pair as --ui-button-highlight/--ui-button-text-shadow,\n // kept as separate tokens so a theme can gloss toasts and buttons\n // independently.\n \"--ui-toast-success-background\": \"var(--ui-success, #16a34a)\",\n \"--ui-toast-error-background\": \"var(--ui-danger, #dc2626)\",\n \"--ui-toast-info-background\": \"var(--ui-info, #0ea5e9)\",\n \"--ui-toast-warning-background\": \"var(--ui-warning, #d97706)\",\n \"--ui-toast-highlight\": \"0 0 0 0 transparent\",\n \"--ui-toast-text-shadow\": \"none\",\n // AI accent sweep — the four stops of the animated multi-hue ring\n // ui-button's `ai` modifier draws around a button (and the only place a\n // rainbow reads as meaning \"this action is AI-powered\" rather than a\n // semantic state). Ordered around the color wheel and looping back to\n // stop 1, so the sweep is seamless; --ui-ai-2 is --ui-primary's own\n // indigo, anchoring the ring to the rest of the palette. Overriding these\n // four retunes every AI button at once.\n \"--ui-ai-1\": \"#38bdf8\", // sky-400\n \"--ui-ai-2\": \"#6366f1\", // indigo-500\n \"--ui-ai-3\": \"#d946ef\", // fuchsia-500\n \"--ui-ai-4\": \"#fbbf24\", // amber-400\n \"--ui-on-accent\": \"#ffffff\",\n \"--ui-text\": \"#0f172a\", // slate-900\n \"--ui-text-muted\": \"#64748b\", // slate-500\n \"--ui-border\": \"#e2e8f0\", // slate-200\n \"--ui-surface\": \"#ffffff\", // white\n \"--ui-surface-muted\": \"#f8fafc\", // slate-50\n \"--ui-highlight\": \"#fde68a\", // amber-200 — transient \"just changed\" flash\n \"--ui-tooltip\": \"#0f172a\", // slate-900\n \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.32)\",\n \"--ui-overlay\": \"rgb(15 23 42 / 0.45)\", // slate-900 / 45%\n\n // Shape / depth\n \"--ui-radius\": \"0.5rem\", // rounded-lg\n \"--ui-radius-sm\": \"0.25rem\", // rounded\n // The width of a themeable surface/control border. Spacing is deliberately\n // untokenized, but a border is chrome rather than layout: the `blueprint`\n // theme's whole structure is carried by hairline rules instead of shadows,\n // and it needs those rules one step heavier than the default. Defaults to\n // the literal 1px every component used before, so nothing renders\n // differently until a theme overrides it. Only genuine surface/control\n // borders read this — forced-colors `CanvasText` borders and purely\n // decorative literals (a slider thumb's white ring, a tab's 2px underline)\n // keep their own widths, since those aren't the theme's structural rules.\n // Anything with a fixed height/width and a themeable border must also set\n // `box-sizing: border-box`, or a heavier border grows it past the shared\n // 2rem control target.\n \"--ui-border-width\": \"1px\",\n // Deliberate pill/circle shapes — a chip, an avatar, a slider thumb, a dot.\n // Tokenized rather than hardcoded so a theme that squares the design system\n // (metro) can reach them too; a literal 9999px/50% silently opts that shape\n // out of every theme. Use these only where the shape is the point, not as a\n // heavier --ui-radius.\n \"--ui-radius-pill\": \"9999px\",\n \"--ui-radius-circle\": \"50%\",\n \"--ui-shadow\":\n \"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)\", // shadow-md\n \"--ui-shadow-lg\":\n \"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)\", // shadow-xl\n \"--ui-focus-ring\": \"0 0 0 3px rgb(79 70 229 / 0.35)\",\n\n // Type\n \"--ui-font\":\n 'ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"',\n \"--ui-font-mono\":\n \"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace\",\n \"--ui-font-size-lg\": \"1rem\", // text-base\n \"--ui-font-size\": \"0.875rem\", // text-sm\n \"--ui-font-size-sm\": \"0.75rem\", // text-xs\n \"--ui-font-size-xs\": \"0.6875rem\",\n\n // Font weights — the only four weights the system uses.\n \"--ui-font-weight-regular\": \"400\",\n \"--ui-font-weight-medium\": \"500\",\n \"--ui-font-weight-semibold\": \"600\",\n \"--ui-font-weight-bold\": \"700\",\n\n // Line heights — glyph (icon/marker box), tight (headings), normal (body).\n \"--ui-line-height-glyph\": \"1\",\n \"--ui-line-height-tight\": \"1.25\",\n \"--ui-line-height-normal\": \"1.5\",\n\n // Letter spacing / tracking — default and the single widened step.\n \"--ui-tracking-normal\": \"0\",\n \"--ui-tracking-wide\": \"0.04em\",\n\n // Casing of chrome micro-labels — the small, wide-tracked labels that name a\n // region rather than carry content (a `frame-box` legend, an `app-sidebar`\n // section heading, a `stat-meter` caption). Defaults to `none`, today's\n // sentence case, so nothing changes until a theme sets it; the `blueprint`\n // theme sets `uppercase`, where signage-style labels are the point. Never\n // apply this to user-supplied content — shouting someone's data is not a\n // theme's decision, and `text-transform` is a presentational lie that\n // survives copy/paste as the original casing anyway.\n \"--ui-label-transform\": \"none\",\n\n // Numeral rendering for figures that change in place or stack into a column\n // — a score, a page number, a running clock. Defaults to `normal`\n // (proportional, as before); `tabular-nums` stops digits from jittering\n // horizontally as they tick, which the `blueprint` theme's spec-sheet\n // aesthetic wants everywhere.\n \"--ui-numeric\": \"normal\",\n};\n\n/**\n * Dark-mode overrides for the same `--ui-*` custom properties, applied by\n * `tokens.css` via `@media (prefers-color-scheme: dark)` and `[data-theme]`\n * (see generate-tokens-css.mjs). Same Tailwind slate scale as the light\n * palette, inverted, with primary/danger/success lightened one step (500\n * instead of 600) for sufficient contrast against dark surfaces. Shape/type\n * tokens are theme-independent and not repeated here.\n */\nexport const darkTokenValues: Record<string, string> = {\n \"--ui-primary\": \"#6366f1\", // indigo-500\n \"--ui-primary-hover\": \"#818cf8\", // indigo-400\n \"--ui-info\": \"#38bdf8\", // sky-400\n \"--ui-info-hover\": \"#7dd3fc\", // sky-300\n \"--ui-danger\": \"#ef4444\", // red-500\n \"--ui-danger-hover\": \"#f87171\", // red-400\n \"--ui-success\": \"#22c55e\", // green-500\n \"--ui-warning\": \"#f59e0b\", // amber-500\n \"--ui-warning-hover\": \"#fbbf24\", // amber-400\n \"--ui-on-accent\": \"#ffffff\",\n \"--ui-text\": \"#f1f5f9\", // slate-100\n \"--ui-text-muted\": \"#94a3b8\", // slate-400\n \"--ui-border\": \"#334155\", // slate-700\n \"--ui-surface\": \"#0f172a\", // slate-900\n \"--ui-surface-muted\": \"#1e293b\", // slate-800\n \"--ui-highlight\": \"#854d0e\", // amber-800 — transient \"just changed\" flash on dark\n \"--ui-tooltip\": \"#020617\", // slate-950\n \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.12)\",\n \"--ui-overlay\": \"rgb(2 6 23 / 0.6)\", // slate-950 / 60%\n \"--ui-focus-ring\": \"0 0 0 3px rgb(99 102 241 / 0.45)\",\n};\n\n/**\n * \"Gradient\" theme overrides, applied via `data-theme=\"gradient\"` on `<html>`\n * (see `generate-tokens-css.mjs`) — forces `color-scheme: light` like the\n * `\"light\"` override and layers a glossy gradient look on top of the flat\n * light palette, using exactly the `--ui-button-*`/`--ui-button-danger-*`/\n * `--ui-button-secondary-*` hooks `ui-button.ts` already reads (see that\n * file's doc comment), plus the `--ui-toast-*` hooks `toast-notification.ts`\n * reads (see its doc comment). Every other token (`--ui-text`, `--ui-surface`,\n * …) is left at its light-mode default — this theme only glosses buttons and\n * toasts by design. Each variant's gradient runs light-to-dark top-to-bottom\n * (`180deg`) across one Tailwind shade step lighter/darker than the flat\n * token so it still reads as \"the same color, glossy\" rather than a\n * different hue; `-hover` shifts the whole pair one shade lighter, `-active`\n * reverses the two stops for a pressed/\"indented\" look, and `-border` is a\n * shade darker than the gradient's dark stop for a defining edge.\n */\nexport const gradientTokenValues: Record<string, string> = {\n \"--ui-button-background\": \"linear-gradient(180deg, #6366f1 0%, #4f46e5 100%)\", // indigo-500 -> 600\n \"--ui-button-background-hover\": \"linear-gradient(180deg, #818cf8 0%, #6366f1 100%)\", // indigo-400 -> 500\n \"--ui-button-background-active\": \"linear-gradient(180deg, #4f46e5 0%, #6366f1 100%)\", // reversed 600 -> 500\n \"--ui-button-border\": \"#4338ca\", // indigo-700\n \"--ui-button-danger-background\": \"linear-gradient(180deg, #ef4444 0%, #dc2626 100%)\", // red-500 -> 600\n \"--ui-button-danger-background-hover\": \"linear-gradient(180deg, #f87171 0%, #ef4444 100%)\", // red-400 -> 500\n \"--ui-button-danger-background-active\": \"linear-gradient(180deg, #dc2626 0%, #ef4444 100%)\", // reversed 600 -> 500\n \"--ui-button-danger-border\": \"#b91c1c\", // red-700\n // Secondary stays neutral gray rather than a saturated hue, matching its\n // flat \"not the primary action\" role, but one shade darker than the\n // original white -> slate-50 pairing: at a small button size, that pair\n // read as flat white with no visible gradient at all. slate-50 -> 100\n // keeps enough contrast to actually look like a gradient while still\n // being clearly lighter/quieter than primary/danger. Border stays\n // slate-300 (a step past the flat slate-200) so its edge still reads\n // against the fill.\n \"--ui-button-secondary-background\": \"linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%)\", // slate-50 -> 100\n \"--ui-button-secondary-background-hover\": \"linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%)\", // slate-100 -> 200\n \"--ui-button-secondary-background-active\": \"linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%)\", // reversed 100 -> 50\n \"--ui-button-secondary-border\": \"#cbd5e1\", // slate-300\n \"--ui-button-secondary-border-hover\": \"#94a3b8\", // slate-400\n // button-group's unchecked segments, pagination-nav's prev/next buttons, and\n // radio-cards/radio-pills' checked background read this rather than\n // --ui-button-secondary-background (see tokens above). Left flat they were\n // the one \"secondary\" surface that stayed matte while every actual secondary\n // button turned glossy, so it tracks the hover gradient rather than a\n // separate literal that could drift out of step with it.\n \"--ui-button-secondary-surface-muted\": \"var(--ui-button-secondary-background-hover)\",\n \"--ui-button-highlight\": \"inset 0 1px 0 rgb(255 255 255 / 0.35)\", // glossy top edge\n \"--ui-button-text-shadow\": \"0 1px 1px rgb(0 0 0 / 0.25)\", // legibility on primary/danger\n \"--ui-button-accent\": \"#4338ca\", // indigo-700, matches --ui-button-border\n // toast-notification: same light-to-dark, one-shade-step gradient\n // convention as the button variants above; the bottom stop always matches\n // the flat --ui-success/--ui-danger/--ui-info/--ui-warning value exactly.\n \"--ui-toast-success-background\": \"linear-gradient(180deg, #22c55e 0%, #16a34a 100%)\", // green-500 -> 600\n \"--ui-toast-error-background\": \"linear-gradient(180deg, #ef4444 0%, #dc2626 100%)\", // red-500 -> 600\n \"--ui-toast-info-background\": \"linear-gradient(180deg, #38bdf8 0%, #0ea5e9 100%)\", // sky-400 -> 500\n \"--ui-toast-warning-background\": \"linear-gradient(180deg, #f59e0b 0%, #d97706 100%)\", // amber-500 -> 600\n \"--ui-toast-highlight\": \"inset 0 1px 0 rgb(255 255 255 / 0.35)\", // glossy top edge, same as --ui-button-highlight\n \"--ui-toast-text-shadow\": \"0 1px 1px rgb(0 0 0 / 0.25)\", // legibility, same as --ui-button-text-shadow\n};\n\n/**\n * \"Metro\" theme overrides, applied via `data-theme=\"metro\"` on `<html>` (see\n * `generate-tokens-css.mjs`) — forces `color-scheme: light` like the `\"light\"`\n * and `\"gradient\"` overrides, and strips the roundness and depth off the flat\n * light palette to leave hard-edged surfaces over a blue accent, after the\n * dense square-cornered look of the early social bookmarking sites.\n *\n * This is the first theme to override shape rather than only color, so the\n * \"shape/type tokens are theme-independent\" rule `darkTokenValues` notes above\n * holds for every theme except this one (see `docs/design-language.md`).\n * Squaring the design system means squaring the deliberate pill and circle\n * shapes too — chips, avatars, dots, slider thumbs — which is why those read\n * `--ui-radius-pill`/`--ui-radius-circle` rather than hardcoding `9999px`/`50%`\n * (a literal would silently opt that shape out of the theme).\n *\n * One residual is genuinely out of reach: `price-history-chart` rounds its bars\n * with an SVG `rx` presentation attribute, which cannot take a `var()`, so\n * those stay slightly rounded under metro.\n *\n * The shadows flatten to a hairline ring rather than to `none`. Dropping them\n * outright would leave `slide-panel` — the only overlay with no border of its\n * own — as an invisible white-on-white edge; every other consumer of\n * `--ui-shadow*` either pairs it with `1px solid var(--ui-border)` or applies\n * it on hover/active over an already-bordered control. A hard 1px ring keeps\n * that separation while removing the blur and the faked depth.\n */\nexport const metroTokenValues: Record<string, string> = {\n \"--ui-primary\": \"#3274d0\", // the del.icio.us blue; no Tailwind equivalent\n \"--ui-primary-hover\": \"#2559a8\",\n \"--ui-focus-ring\": \"0 0 0 2px #3274d0\", // solid and crisp, not the default 3px translucent ring\n \"--ui-radius\": \"0\",\n \"--ui-radius-sm\": \"0\",\n \"--ui-radius-pill\": \"0\",\n \"--ui-radius-circle\": \"0\",\n // Hairline rings (slate-900 at low alpha) rather than blurred drop shadows:\n // separation without depth. -lg is a touch stronger, matching the default\n // pair's relative weighting.\n \"--ui-shadow\": \"0 0 0 1px rgb(15 23 42 / 0.12)\",\n \"--ui-shadow-lg\": \"0 0 0 1px rgb(15 23 42 / 0.18)\",\n};\n\n/**\n * \"Blueprint\" theme overrides, applied via `data-theme=\"blueprint\"` on `<html>`\n * (see `generate-tokens-css.mjs`) — forces `color-scheme: light` like every\n * other non-dark theme, and restyles the light palette as a technical catalog\n * / spec sheet: warm near-black ink on white paper, one pure-blue accent,\n * square corners, and structure carried entirely by hairline rules instead of\n * shadows.\n *\n * It is the widest theme in the system, and the reason three token axes exist\n * that no earlier theme needed:\n *\n * - `--ui-font` is retargeted to a monospace stack. `darkTokenValues` notes\n * that shape and type tokens are theme-independent; `metro` already broke\n * that for shape, and this breaks it for the type *family* only. Type\n * *metrics* (size, weight, line height) remain unthemed in every theme —\n * they encode hierarchy, which is not a stylistic choice. \"Space Mono\"\n * leads the stack purely so a consumer who loads that webfont gets the\n * reference face automatically; with no external CSS at all it falls\n * straight through to the same system mono stack `--ui-font-mono` uses, so\n * the theme still renders correctly on its own.\n * - `--ui-border-width` goes to `1.5px`. Every border in this theme is doing\n * the work a shadow does elsewhere, and at 1px those rules read as a faint\n * table rather than as drawn structure.\n * - `--ui-label-transform` goes to `uppercase`, which is what makes chrome\n * micro-labels read as signage/spec-sheet keys. Only labels that name a\n * region or column carry this — never user content.\n * - `--ui-numeric` goes to `tabular-nums`, so figures line up in a column and\n * do not jitter as they change.\n *\n * Buttons are deliberately NOT the accent color. `--ui-primary` stays pure\n * blue because it drives accents everywhere else (active tab underlines,\n * selected states, links, the certification-style tints), but the primary\n * button fill is overridden to ink through the `--ui-button-*` hooks and only\n * turns blue on hover — a black-on-white CTA that lights up is the\n * catalog-print look, and a large pure-blue fill next to blue accents would\n * flatten the two roles into one. That split is exactly what those hooks\n * exist for (see `gradientTokenValues` above for the same technique).\n *\n * Semantic `danger`/`success`/`warning` keep their default hues: they encode\n * meaning rather than style, and the reference's blue-only restraint is an\n * editorial choice a component library cannot make on a consumer's behalf.\n * `--ui-info` is the exception — it is \"neutral notice\", which in this theme\n * is precisely the accent, and the default sky blue would otherwise sit a few\n * degrees off the pure blue beside it and read as a mistake.\n *\n * Shadows flatten to a hard ink ring rather than to `none`, for the same\n * reason `metro` does it: `slide-panel` has no border of its own and would\n * otherwise lose its edge entirely.\n */\nexport const blueprintTokenValues: Record<string, string> = {\n // Ink over paper. --ui-text-muted is the same ink at ~65% over white rather\n // than a neutral gray, so the quiet text stays in the same warm family\n // instead of turning blue-gray beside the accent.\n \"--ui-text\": \"#17160f\",\n \"--ui-text-muted\": \"#686763\",\n \"--ui-surface\": \"#ffffff\",\n \"--ui-surface-muted\": \"#f0f0f0\",\n // ~55% ink over white. Darker than it looks like it needs to be, because a\n // border is often the only thing bounding a white-on-white control, and\n // WCAG 1.4.11 wants 3:1 against both adjacent surfaces for that: this is\n // 3.55:1 on white and 3.12:1 on the muted surface. The lighter ~40% ink\n // (#a2a29f) reads better but only reaches 2.56:1, and 1.5px of extra weight\n // does not buy an exemption. Still short of fully black, which at this width\n // would turn every bordered surface into a hard box.\n \"--ui-border\": \"#898883\",\n \"--ui-tooltip\": \"#17160f\",\n \"--ui-overlay\": \"rgb(23 22 15 / 0.45)\",\n // The \"just changed\" flash tints toward the accent instead of amber, which\n // is the one warm hue this palette has no room for.\n \"--ui-highlight\": \"#dcdcff\",\n\n \"--ui-primary\": \"#0000ff\",\n \"--ui-primary-hover\": \"#0000cc\",\n \"--ui-info\": \"#0000ff\",\n \"--ui-info-hover\": \"#0000cc\",\n \"--ui-on-accent\": \"#ffffff\",\n // Solid and crisp at the reference's own 2px, not the default translucent\n // 3px halo — a blurred ring is the one soft edge this theme has nowhere to\n // put.\n \"--ui-focus-ring\": \"0 0 0 2px #0000ff\",\n\n // Ink CTA that lights up blue on hover, and inverts its two stops while\n // pressed. The border is ink at every state so the button keeps a defining\n // edge even once the fill goes blue.\n \"--ui-button-background\": \"#17160f\",\n \"--ui-button-background-hover\": \"#0000ff\",\n \"--ui-button-background-active\": \"#0000cc\",\n \"--ui-button-border\": \"#17160f\",\n \"--ui-button-danger-border\": \"#b91c1c\",\n // Secondary is the reference's ghost button: no fill, ink border, a paper\n // wash on hover and an accent border to echo the primary's hover.\n \"--ui-button-secondary-border\": \"#17160f\",\n \"--ui-button-secondary-border-hover\": \"#0000ff\",\n \"--ui-button-secondary-background-hover\": \"#f0f0f0\",\n \"--ui-button-secondary-surface-muted\": \"#f0f0f0\",\n // Non-button accents that can only take a plain color (a native input's\n // accent-color, range-slider's track/thumb) follow --ui-primary, not the\n // ink button fill — those are selection marks, not calls to action.\n \"--ui-button-accent\": \"#0000ff\",\n\n \"--ui-radius\": \"0\",\n \"--ui-radius-sm\": \"0\",\n \"--ui-radius-pill\": \"0\",\n \"--ui-radius-circle\": \"0\",\n \"--ui-shadow\": \"0 0 0 1.5px rgb(23 22 15 / 0.24)\",\n \"--ui-shadow-lg\": \"0 0 0 1.5px #17160f\",\n\n \"--ui-border-width\": \"1.5px\",\n \"--ui-label-transform\": \"uppercase\",\n \"--ui-numeric\": \"tabular-nums\",\n \"--ui-font\":\n '\"Space Mono\", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',\n};\n\n/**\n * Historically a shared `:host { --ui-x: var(--ui-x, fallback); } ` block,\n * re-declaring every token on each component's own host element as a\n * \"materialize the inherited value, or this fallback\" trick. That pattern\n * turned out to be a genuine bug, not a working default: browsers treat\n * `--ui-x: var(--ui-x, ...)` on `:host` as a self-referencing declaration\n * that computes to the guaranteed-invalid value REGARDLESS of what an\n * ancestor (e.g. `:root`) set — the host's own `:host` rule wins the cascade\n * over the ancestor's, so this dropped whatever the app actually set and\n * silently substituted the component's own fallback everywhere. It went\n * unnoticed because every component's fallback happened to equal the\n * intended light-mode value — dark mode (a real, different value at\n * `:root`) exposed it immediately (colors rendering as if no theme were\n * applied at all). Fix: don't redeclare tokens on `:host` — plain\n * inheritance already carries `:root`'s values into every shadow root\n * correctly, and every component already has its own `var(--ui-x, fallback)`\n * at each point of use, so nothing here is needed for the \"zero external\n * CSS\" default to keep working. Kept as an empty export so the existing\n * `static override styles = [tokens, css\\`...\\`]` import in every component\n * keeps compiling.\n */\nexport const tokens = css``;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vote-control.d.ts","sourceRoot":"","sources":["../src/vote-control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAK1C;;;;;;;;;;;;;GAaG;AACH,qBACa,WAAY,SAAQ,UAAU;;IACzC,OAAgB,MAAM,4BA0KpB;IAEF,uDAAuD;IACZ,KAAK,SAAK;IAErD,kHAAkH;IACrF,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAQ;IAE/D,kDAAkD;IACN,QAAQ,UAAS;IAE7D,yGAAyG;IAC5E,WAAW,EAAE,UAAU,GAAG,YAAY,CAAc;IAEjF,iJAAiJ;IACrH,MAAM,SAAK;IAEvC,8CAA8C;IAClC,KAAK,SAAU;IAElB,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,QAI7C;IA4BQ,MAAM,
|
|
1
|
+
{"version":3,"file":"vote-control.d.ts","sourceRoot":"","sources":["../src/vote-control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAK1C;;;;;;;;;;;;;GAaG;AACH,qBACa,WAAY,SAAQ,UAAU;;IACzC,OAAgB,MAAM,4BA0KpB;IAEF,uDAAuD;IACZ,KAAK,SAAK;IAErD,kHAAkH;IACrF,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAQ;IAE/D,kDAAkD;IACN,QAAQ,UAAS;IAE7D,yGAAyG;IAC5E,WAAW,EAAE,UAAU,GAAG,YAAY,CAAc;IAEjF,iJAAiJ;IACrH,MAAM,SAAK;IAEvC,8CAA8C;IAClC,KAAK,SAAU;IAElB,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,QAI7C;IA4BQ,MAAM,yCAqDd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|
package/dist/vote-control.js
CHANGED
|
@@ -240,7 +240,12 @@ let VoteControl = class VoteControl extends LitElement {
|
|
|
240
240
|
}
|
|
241
241
|
render() {
|
|
242
242
|
const showMeter = this.target > 0;
|
|
243
|
-
|
|
243
|
+
// The meter's ARIA value is clamped to its own min/max: a score can go
|
|
244
|
+
// negative or overshoot the target, but exposing that raw number would
|
|
245
|
+
// contradict the clamped fill and break the valuemin <= valuenow <=
|
|
246
|
+
// valuemax relationship. The real score stays in aria-valuetext.
|
|
247
|
+
const clamped = showMeter ? Math.min(this.target, Math.max(0, this.value)) : 0;
|
|
248
|
+
const progress = showMeter ? (clamped / this.target) * 100 : 0;
|
|
244
249
|
return html `
|
|
245
250
|
<div class="control" role="group" aria-label=${this.label}>
|
|
246
251
|
<div class="buttons">
|
|
@@ -272,9 +277,11 @@ let VoteControl = class VoteControl extends LitElement {
|
|
|
272
277
|
<span
|
|
273
278
|
class="track"
|
|
274
279
|
role="progressbar"
|
|
275
|
-
aria-
|
|
280
|
+
aria-label="Progress toward promotion"
|
|
281
|
+
aria-valuenow=${clamped}
|
|
276
282
|
aria-valuemin="0"
|
|
277
283
|
aria-valuemax=${this.target}
|
|
284
|
+
aria-valuetext="${this.value} of ${this.target}"
|
|
278
285
|
>
|
|
279
286
|
<span class="fill" style=${`width: ${progress}%`}></span>
|
|
280
287
|
</span>
|
package/dist/vote-control.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vote-control.js","sourceRoot":"","sources":["../src/vote-control.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;GAaG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QA6KL,uDAAuD;QACZ,UAAK,GAAG,CAAC,CAAC;QAErD,kHAAkH;QACrF,SAAI,GAAyB,IAAI,CAAC;QAE/D,kDAAkD;QACN,a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,MAAM,CAAC,CAAC,CAAC,OAAO;wBAC1C,IAAI,CAAC,QAAQ;qBAChB,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;;cAE/B,eAAe,CAAC,EAAE,CAAC;;;UAGvB,SAAS;YACT,CAAC,CAAC,IAAI,CAAA;;;;;kCAKkB,IAAI,CAAC,KAAK;;kCAEV,IAAI,CAAC,MAAM;;6CAEA,UAAU,QAAQ,GAAG;;wCAE1B,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,MAAM;;aAEtD;YACH,CAAC,CAAC,OAAO;;KAEd,CAAC;IACJ,CAAC;CACF,CAAA;AAhG4C;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAW;AAGxB;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAmC;AAGnB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAkB;AAGhC;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAAqD;AAGrD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAY;AAG3B;IAAX,QAAQ,EAAE;0CAAgB;AA7LhB,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA8QvB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport type { PropertyValues } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconChevronDown, iconChevronUp } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * An up/down vote widget with a live score readout — the \"vote an entry up or\n * down toward a promotion threshold\" pattern from a public register site,\n * where one member casts a single vote that can be changed or withdrawn at any\n * time. Two native `<button>`s flank a score; the button matching the user's\n * own cast `vote` reads as pressed (`aria-pressed`), and clicking it again\n * withdraws the vote. Set an optional `target` to render a thin progress meter\n * toward the promotion threshold beneath (vertical) or beside (horizontal) the\n * buttons.\n *\n * @element vote-control\n * @fires vote-change - The user cast, switched, or withdrew their vote;\n * detail: { vote: \"up\" | \"down\" | null, value: number }.\n */\n@customElement(\"vote-control\")\nexport class VoteControl extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .control {\n display: inline-flex;\n box-sizing: border-box;\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius, 0.5rem);\n background: var(--ui-surface, #ffffff);\n }\n /* Vertical (default): stacked box — up, score, down, optional meter. */\n :host([orientation=\"vertical\"]) .control {\n flex-direction: column;\n align-items: stretch;\n padding: 0.25rem;\n gap: 0.25rem;\n }\n /* Horizontal: wide inline row — up, score, down, optional meter beside. */\n :host([orientation=\"horizontal\"]) .control {\n flex-direction: row;\n align-items: center;\n padding: 0.25rem 0.5rem;\n gap: 0.5rem;\n }\n .buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n }\n :host([orientation=\"vertical\"]) .buttons {\n flex-direction: column;\n }\n :host([orientation=\"horizontal\"]) .buttons {\n flex-direction: row;\n }\n .vote-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n box-sizing: border-box;\n border: none;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: none;\n color: var(--ui-text-muted, #64748b);\n cursor: pointer;\n }\n .vote-btn:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n color: var(--ui-text, #0f172a);\n }\n .vote-btn.up[aria-pressed=\"true\"] {\n color: var(--ui-success, #16a34a);\n background: var(--ui-surface-muted, #f8fafc);\n }\n .vote-btn.down[aria-pressed=\"true\"] {\n color: var(--ui-danger, #dc2626);\n background: var(--ui-surface-muted, #f8fafc);\n }\n .vote-btn:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n .vote-btn:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .score {\n min-width: 2rem;\n text-align: center;\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n font-variant-numeric: var(--ui-numeric, normal);\n }\n .meter {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n }\n :host([orientation=\"horizontal\"]) .meter {\n min-width: 4rem;\n }\n .track {\n display: block;\n width: 100%;\n height: 0.25rem;\n border-radius: var(--ui-radius-pill, 9999px);\n background: var(--ui-surface-muted, #f8fafc);\n overflow: hidden;\n }\n .fill {\n display: block;\n height: 100%;\n background: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n transition: width 200ms ease;\n }\n .caption {\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-medium, 500);\n letter-spacing: var(--ui-tracking-wide, 0.04em);\n line-height: var(--ui-line-height-tight, 1.25);\n text-transform: var(--ui-label-transform, none);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: var(--ui-numeric, normal);\n text-align: center;\n white-space: nowrap;\n }\n @media (prefers-reduced-motion: no-preference) {\n .score.bump {\n animation: vote-bump 220ms ease;\n }\n @keyframes vote-bump {\n 0% {\n transform: scale(1);\n }\n 40% {\n transform: scale(1.25);\n }\n 100% {\n transform: scale(1);\n }\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .fill {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n .control {\n border: 1px solid CanvasText;\n }\n .vote-btn:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .vote-btn[aria-pressed=\"true\"] {\n outline: 2px solid Highlight;\n }\n .vote-btn:disabled {\n color: GrayText;\n opacity: 1;\n }\n .track {\n border: 1px solid CanvasText;\n }\n .fill {\n background: Highlight;\n }\n }\n `,\n ];\n\n /** The current net score shown between the buttons. */\n @property({ type: Number, reflect: true }) value = 0;\n\n /** This user's own cast vote, or `null` if they have not voted. Reflected so CSS can style the pressed button. */\n @property({ reflect: true }) vote: \"up\" | \"down\" | null = null;\n\n /** Disables both buttons and dims the control. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Layout — `vertical` is the compact stacked box (default); `horizontal` is the wide inline variant. */\n @property({ reflect: true }) orientation: \"vertical\" | \"horizontal\" = \"vertical\";\n\n /** Promotion threshold. When > 0, a thin progress meter toward it renders; when 0 (default) no meter renders and no space is reserved for it. */\n @property({ type: Number }) target = 0;\n\n /** Accessible label naming the vote group. */\n @property() label = \"Vote\";\n\n override updated(changed: PropertyValues<this>) {\n if (changed.has(\"value\") && changed.get(\"value\") !== undefined) {\n this.#restartBump();\n }\n }\n\n #restartBump() {\n const score = this.renderRoot?.querySelector<HTMLElement>(\".score\");\n if (!score) return;\n score.classList.remove(\"bump\");\n // Force a reflow so removing/re-adding the class restarts the animation.\n void score.offsetWidth;\n score.classList.add(\"bump\");\n }\n\n #cast(dir: \"up\" | \"down\") {\n if (this.disabled) return;\n const previous = this.vote;\n const nextVote = previous === dir ? null : dir;\n const contribution = (v: \"up\" | \"down\" | null) => (v === \"up\" ? 1 : v === \"down\" ? -1 : 0);\n const delta = contribution(nextVote) - contribution(previous);\n this.vote = nextVote;\n this.value += delta;\n this.dispatchEvent(\n new CustomEvent(\"vote-change\", {\n detail: { vote: this.vote, value: this.value },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n override render() {\n const showMeter = this.target > 0;\n const progress = showMeter ? Math.min(100, Math.max(0, (this.value / this.target) * 100)) : 0;\n return html`\n <div class=\"control\" role=\"group\" aria-label=${this.label}>\n <div class=\"buttons\">\n <button\n type=\"button\"\n class=\"vote-btn up\"\n aria-label=\"Vote up\"\n aria-pressed=${this.vote === \"up\" ? \"true\" : \"false\"}\n ?disabled=${this.disabled}\n @click=${() => this.#cast(\"up\")}\n >\n ${iconChevronUp(18)}\n </button>\n <span class=\"score\" aria-live=\"polite\" aria-atomic=\"true\">${this.value}</span>\n <button\n type=\"button\"\n class=\"vote-btn down\"\n aria-label=\"Vote down\"\n aria-pressed=${this.vote === \"down\" ? \"true\" : \"false\"}\n ?disabled=${this.disabled}\n @click=${() => this.#cast(\"down\")}\n >\n ${iconChevronDown(18)}\n </button>\n </div>\n ${showMeter\n ? html`\n <div class=\"meter\">\n <span\n class=\"track\"\n role=\"progressbar\"\n aria-valuenow=${this.value}\n aria-valuemin=\"0\"\n aria-valuemax=${this.target}\n >\n <span class=\"fill\" style=${`width: ${progress}%`}></span>\n </span>\n <span class=\"caption\">${this.value} / ${this.target}</span>\n </div>\n `\n : nothing}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"vote-control\": VoteControl;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"vote-control.js","sourceRoot":"","sources":["../src/vote-control.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;GAaG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QA6KL,uDAAuD;QACZ,UAAK,GAAG,CAAC,CAAC;QAErD,kHAAkH;QACrF,SAAI,GAAyB,IAAI,CAAC;QAE/D,kDAAkD;QACN,aAAQ,GAAG,KAAK,CAAC;QAE7D,yGAAyG;QAC5E,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,CAAC,EAAE,CAAC;;sEAEuC,IAAI,CAAC,KAAK;;;;;2BAKrD,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;wBAC1C,IAAI,CAAC,QAAQ;qBAChB,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;;cAE/B,eAAe,CAAC,EAAE,CAAC;;;UAGvB,SAAS;YACT,CAAC,CAAC,IAAI,CAAA;;;;;;kCAMkB,OAAO;;kCAEP,IAAI,CAAC,MAAM;oCACT,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,MAAM;;6CAEnB,UAAU,QAAQ,GAAG;;wCAE1B,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,MAAM;;aAEtD;YACH,CAAC,CAAC,OAAO;;KAEd,CAAC;IACJ,CAAC;CACF,CAAA;AAvG4C;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAW;AAGxB;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAmC;AAGnB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAkB;AAGhC;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAAqD;AAGrD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAY;AAG3B;IAAX,QAAQ,EAAE;0CAAgB;AA7LhB,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAqRvB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport type { PropertyValues } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconChevronDown, iconChevronUp } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * An up/down vote widget with a live score readout — the \"vote an entry up or\n * down toward a promotion threshold\" pattern from a public register site,\n * where one member casts a single vote that can be changed or withdrawn at any\n * time. Two native `<button>`s flank a score; the button matching the user's\n * own cast `vote` reads as pressed (`aria-pressed`), and clicking it again\n * withdraws the vote. Set an optional `target` to render a thin progress meter\n * toward the promotion threshold beneath (vertical) or beside (horizontal) the\n * buttons.\n *\n * @element vote-control\n * @fires vote-change - The user cast, switched, or withdrew their vote;\n * detail: { vote: \"up\" | \"down\" | null, value: number }.\n */\n@customElement(\"vote-control\")\nexport class VoteControl extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .control {\n display: inline-flex;\n box-sizing: border-box;\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius, 0.5rem);\n background: var(--ui-surface, #ffffff);\n }\n /* Vertical (default): stacked box — up, score, down, optional meter. */\n :host([orientation=\"vertical\"]) .control {\n flex-direction: column;\n align-items: stretch;\n padding: 0.25rem;\n gap: 0.25rem;\n }\n /* Horizontal: wide inline row — up, score, down, optional meter beside. */\n :host([orientation=\"horizontal\"]) .control {\n flex-direction: row;\n align-items: center;\n padding: 0.25rem 0.5rem;\n gap: 0.5rem;\n }\n .buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n }\n :host([orientation=\"vertical\"]) .buttons {\n flex-direction: column;\n }\n :host([orientation=\"horizontal\"]) .buttons {\n flex-direction: row;\n }\n .vote-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n box-sizing: border-box;\n border: none;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: none;\n color: var(--ui-text-muted, #64748b);\n cursor: pointer;\n }\n .vote-btn:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n color: var(--ui-text, #0f172a);\n }\n .vote-btn.up[aria-pressed=\"true\"] {\n color: var(--ui-success, #16a34a);\n background: var(--ui-surface-muted, #f8fafc);\n }\n .vote-btn.down[aria-pressed=\"true\"] {\n color: var(--ui-danger, #dc2626);\n background: var(--ui-surface-muted, #f8fafc);\n }\n .vote-btn:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n .vote-btn:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .score {\n min-width: 2rem;\n text-align: center;\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n font-variant-numeric: var(--ui-numeric, normal);\n }\n .meter {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n }\n :host([orientation=\"horizontal\"]) .meter {\n min-width: 4rem;\n }\n .track {\n display: block;\n width: 100%;\n height: 0.25rem;\n border-radius: var(--ui-radius-pill, 9999px);\n background: var(--ui-surface-muted, #f8fafc);\n overflow: hidden;\n }\n .fill {\n display: block;\n height: 100%;\n background: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n transition: width 200ms ease;\n }\n .caption {\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-medium, 500);\n letter-spacing: var(--ui-tracking-wide, 0.04em);\n line-height: var(--ui-line-height-tight, 1.25);\n text-transform: var(--ui-label-transform, none);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: var(--ui-numeric, normal);\n text-align: center;\n white-space: nowrap;\n }\n @media (prefers-reduced-motion: no-preference) {\n .score.bump {\n animation: vote-bump 220ms ease;\n }\n @keyframes vote-bump {\n 0% {\n transform: scale(1);\n }\n 40% {\n transform: scale(1.25);\n }\n 100% {\n transform: scale(1);\n }\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .fill {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n .control {\n border: 1px solid CanvasText;\n }\n .vote-btn:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .vote-btn[aria-pressed=\"true\"] {\n outline: 2px solid Highlight;\n }\n .vote-btn:disabled {\n color: GrayText;\n opacity: 1;\n }\n .track {\n border: 1px solid CanvasText;\n }\n .fill {\n background: Highlight;\n }\n }\n `,\n ];\n\n /** The current net score shown between the buttons. */\n @property({ type: Number, reflect: true }) value = 0;\n\n /** This user's own cast vote, or `null` if they have not voted. Reflected so CSS can style the pressed button. */\n @property({ reflect: true }) vote: \"up\" | \"down\" | null = null;\n\n /** Disables both buttons and dims the control. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Layout — `vertical` is the compact stacked box (default); `horizontal` is the wide inline variant. */\n @property({ reflect: true }) orientation: \"vertical\" | \"horizontal\" = \"vertical\";\n\n /** Promotion threshold. When > 0, a thin progress meter toward it renders; when 0 (default) no meter renders and no space is reserved for it. */\n @property({ type: Number }) target = 0;\n\n /** Accessible label naming the vote group. */\n @property() label = \"Vote\";\n\n override updated(changed: PropertyValues<this>) {\n if (changed.has(\"value\") && changed.get(\"value\") !== undefined) {\n this.#restartBump();\n }\n }\n\n #restartBump() {\n const score = this.renderRoot?.querySelector<HTMLElement>(\".score\");\n if (!score) return;\n score.classList.remove(\"bump\");\n // Force a reflow so removing/re-adding the class restarts the animation.\n void score.offsetWidth;\n score.classList.add(\"bump\");\n }\n\n #cast(dir: \"up\" | \"down\") {\n if (this.disabled) return;\n const previous = this.vote;\n const nextVote = previous === dir ? null : dir;\n const contribution = (v: \"up\" | \"down\" | null) => (v === \"up\" ? 1 : v === \"down\" ? -1 : 0);\n const delta = contribution(nextVote) - contribution(previous);\n this.vote = nextVote;\n this.value += delta;\n this.dispatchEvent(\n new CustomEvent(\"vote-change\", {\n detail: { vote: this.vote, value: this.value },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n override render() {\n const showMeter = this.target > 0;\n // The meter's ARIA value is clamped to its own min/max: a score can go\n // negative or overshoot the target, but exposing that raw number would\n // contradict the clamped fill and break the valuemin <= valuenow <=\n // valuemax relationship. The real score stays in aria-valuetext.\n const clamped = showMeter ? Math.min(this.target, Math.max(0, this.value)) : 0;\n const progress = showMeter ? (clamped / this.target) * 100 : 0;\n return html`\n <div class=\"control\" role=\"group\" aria-label=${this.label}>\n <div class=\"buttons\">\n <button\n type=\"button\"\n class=\"vote-btn up\"\n aria-label=\"Vote up\"\n aria-pressed=${this.vote === \"up\" ? \"true\" : \"false\"}\n ?disabled=${this.disabled}\n @click=${() => this.#cast(\"up\")}\n >\n ${iconChevronUp(18)}\n </button>\n <span class=\"score\" aria-live=\"polite\" aria-atomic=\"true\">${this.value}</span>\n <button\n type=\"button\"\n class=\"vote-btn down\"\n aria-label=\"Vote down\"\n aria-pressed=${this.vote === \"down\" ? \"true\" : \"false\"}\n ?disabled=${this.disabled}\n @click=${() => this.#cast(\"down\")}\n >\n ${iconChevronDown(18)}\n </button>\n </div>\n ${showMeter\n ? html`\n <div class=\"meter\">\n <span\n class=\"track\"\n role=\"progressbar\"\n aria-label=\"Progress toward promotion\"\n aria-valuenow=${clamped}\n aria-valuemin=\"0\"\n aria-valuemax=${this.target}\n aria-valuetext=\"${this.value} of ${this.target}\"\n >\n <span class=\"fill\" style=${`width: ${progress}%`}></span>\n </span>\n <span class=\"caption\">${this.value} / ${this.target}</span>\n </div>\n `\n : nothing}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"vote-control\": VoteControl;\n }\n}\n"]}
|
package/docs/breadcrumb-nav.md
CHANGED
|
@@ -41,7 +41,7 @@ import "@f-ewald/components/breadcrumb-nav.js";
|
|
|
41
41
|
| Property | Attribute | Type | Default | Description |
|
|
42
42
|
| --- | --- | --- | --- | --- |
|
|
43
43
|
| `items` | `items` | `BreadcrumbItem[]` | `[]` | The crumbs, root first. The last entry is the current page and is rendered as non-interactive text with `aria-current="page"`. |
|
|
44
|
-
| `maxVisible` | `max-visible` | `number` | `0` | When greater than zero and the trail has more items than this, collapse the middle of the trail behind an overflow button (the first and current crumbs always stay visible). `0` (the default) never collapses. |
|
|
44
|
+
| `maxVisible` | `max-visible` | `number` | `0` | When greater than zero and the trail has more items than this, collapse the middle of the trail behind an overflow button (the first and current crumbs always stay visible). `0` (the default) never collapses. A collapsed trail always occupies three positions — first crumb, overflow button, current page — so values below `3` are raised to `3`. Collapsing a shorter trail would spend a button to hide one crumb, or none at all. |
|
|
45
45
|
| `expanded` | `expanded` | `boolean` | `false` | Whether a collapsed trail is currently expanded to show its hidden crumbs. |
|
|
46
46
|
|
|
47
47
|
## Events
|
package/docs/empty-state.md
CHANGED
|
@@ -30,6 +30,7 @@ import "@f-ewald/components/empty-state.js";
|
|
|
30
30
|
| `heading` | `heading` | `string` | `""` | The primary line. |
|
|
31
31
|
| `description` | `description` | `string` | `""` | The supporting line under the heading. Omitted entirely when empty. |
|
|
32
32
|
| `size` | `size` | `"sm" | "md"` | `"md"` | `sm` for a small panel/sidebar, `md` (default) for a full page region. `md` matches the pre-`size` look exactly. |
|
|
33
|
+
| `headingLevel` | `heading-level` | `number` | `2` | Heading rank the `heading` is exposed as, 1-6. An `empty-state` fills a page, a panel, or a sidebar, so no single rank is right everywhere; set this to whatever the surrounding outline needs. Applied via `aria-level` on the rendered `h2`, which overrides the element's native rank for assistive technology. |
|
|
33
34
|
|
|
34
35
|
## Events
|
|
35
36
|
|
|
@@ -37,7 +38,11 @@ _None._
|
|
|
37
38
|
|
|
38
39
|
## Slots
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
| Slot | Description |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `icon` | Optional leading glyph. The consumer supplies it (e.g. an inline SVG icon). |
|
|
44
|
+
| `(default)` | Optional rich body content, an alternative to `description`. |
|
|
45
|
+
| `actions` | Optional call to action, e.g. a `ui-button`. |
|
|
41
46
|
|
|
42
47
|
## CSS custom properties
|
|
43
48
|
|
package/docs/skip-link.md
CHANGED
|
@@ -5,8 +5,13 @@ accessibility-utility component. It renders a real `<a>` that stays
|
|
|
5
5
|
visually hidden (but in the focus order) until it receives keyboard focus,
|
|
6
6
|
then pins itself to the top-left of the viewport as a solid, high-contrast
|
|
7
7
|
block so a keyboard or screen-reader user can jump straight past repeated
|
|
8
|
-
page chrome to the main content.
|
|
9
|
-
|
|
8
|
+
page chrome to the main content.
|
|
9
|
+
|
|
10
|
+
Activating it moves focus into the target as well as scrolling to it: a
|
|
11
|
+
plain fragment link only moves focus when the target is already focusable,
|
|
12
|
+
so this applies `tabindex="-1"` to the target on demand rather than making
|
|
13
|
+
every consumer remember to. Native navigation is never prevented, so the
|
|
14
|
+
hash still updates.
|
|
10
15
|
|
|
11
16
|
Place it as the very first focusable element on the page, before the app
|
|
12
17
|
chrome, and point `href` at the `id` of the main content region.
|
|
@@ -37,7 +42,9 @@ _None._
|
|
|
37
42
|
|
|
38
43
|
## Slots
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
| Slot | Description |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `(default)` | Optional custom link wording, overriding `label`. |
|
|
41
48
|
|
|
42
49
|
## CSS custom properties
|
|
43
50
|
|
package/docs/spec-list.md
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
# `<spec-list>`
|
|
2
2
|
|
|
3
3
|
A key/value specification sheet — the "spec sheet" block on a product page:
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
a muted, wide-tracked key column against a value column, separated by
|
|
5
|
+
hairline rules (and uppercased under themes that set
|
|
6
|
+
`--ui-label-transform`). It describes ONE record's attributes, which is
|
|
6
7
|
what sets it apart from `data-table` (many records, many columns, sorting);
|
|
7
8
|
`spec-list` is not tabular and renders a real `<dl>`/`<dt>`/`<dd>` structure.
|
|
8
9
|
|
|
9
|
-
Feed it the `items` array for the plain data path, or slot
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
Feed it the `items` array for the plain data path, or slot bare `<dt>`/`<dd>`
|
|
11
|
+
pairs when a value needs a link, a `status-pill`, or other markup — slotted
|
|
12
|
+
pairs inherit the component's own key/value styling, so no page CSS is
|
|
13
|
+
needed. A `<div>` wrapping a pair is also accepted as a full-width grouping
|
|
14
|
+
row, but `::slotted()` cannot reach inside it, so those `dt`/`dd` stay the
|
|
15
|
+
consumer's to style. Slotted content takes precedence over `items`; with
|
|
16
|
+
neither, nothing is rendered.
|
|
13
17
|
|
|
14
18
|
## Install
|
|
15
19
|
|
|
@@ -29,11 +33,13 @@ import "@f-ewald/components/spec-list.js";
|
|
|
29
33
|
];
|
|
30
34
|
</script>
|
|
31
35
|
|
|
32
|
-
<!-- Or slot your own
|
|
33
|
-
markup
|
|
36
|
+
<!-- Or slot your own pairs when a value needs a link, a status-pill, or other
|
|
37
|
+
markup; slotted `dt`/`dd` pick up the component's own key/value styling.
|
|
38
|
+
`dividers` defaults to true; turn it off via the property, since a
|
|
34
39
|
`dividers="false"` attribute still parses as a truthy boolean. -->
|
|
35
40
|
<spec-list layout="stacked" id="sheet">
|
|
36
|
-
<
|
|
41
|
+
<dt>Homepage</dt>
|
|
42
|
+
<dd><a href="https://example.com">example.com</a></dd>
|
|
37
43
|
</spec-list>
|
|
38
44
|
```
|
|
39
45
|
|
|
@@ -52,7 +58,9 @@ _None._
|
|
|
52
58
|
|
|
53
59
|
## Slots
|
|
54
60
|
|
|
55
|
-
|
|
61
|
+
| Slot | Description |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| `(default)` | Optional `<dt>`/`<dd>` pairs for values that need custom markup; when present, they replace the `items` path. |
|
|
56
64
|
|
|
57
65
|
## CSS custom properties
|
|
58
66
|
|
package/llms.txt
CHANGED
|
@@ -1023,7 +1023,7 @@ completely when absent, reserving no layout space.
|
|
|
1023
1023
|
|
|
1024
1024
|
Import: `import "@f-ewald/components/empty-state.js";`
|
|
1025
1025
|
|
|
1026
|
-
Properties: `heading` (attribute `heading`) : string, default ""; `description` (attribute `description`) : string, default ""; `size` (attribute `size`) : "sm" | "md", default "md"
|
|
1026
|
+
Properties: `heading` (attribute `heading`) : string, default ""; `description` (attribute `description`) : string, default ""; `size` (attribute `size`) : "sm" | "md", default "md"; `headingLevel` (attribute `heading-level`) : number, default 2
|
|
1027
1027
|
Events: none
|
|
1028
1028
|
CSS custom properties: `--ui-font`, `--ui-font-size`, `--ui-font-size-lg`, `--ui-font-size-sm`, `--ui-font-weight-regular`, `--ui-font-weight-semibold`, `--ui-line-height-normal`, `--ui-line-height-tight`, `--ui-text`, `--ui-text-muted`
|
|
1029
1029
|
|
|
@@ -2234,8 +2234,13 @@ accessibility-utility component. It renders a real `<a>` that stays
|
|
|
2234
2234
|
visually hidden (but in the focus order) until it receives keyboard focus,
|
|
2235
2235
|
then pins itself to the top-left of the viewport as a solid, high-contrast
|
|
2236
2236
|
block so a keyboard or screen-reader user can jump straight past repeated
|
|
2237
|
-
page chrome to the main content.
|
|
2238
|
-
|
|
2237
|
+
page chrome to the main content.
|
|
2238
|
+
|
|
2239
|
+
Activating it moves focus into the target as well as scrolling to it: a
|
|
2240
|
+
plain fragment link only moves focus when the target is already focusable,
|
|
2241
|
+
so this applies `tabindex="-1"` to the target on demand rather than making
|
|
2242
|
+
every consumer remember to. Native navigation is never prevented, so the
|
|
2243
|
+
hash still updates.
|
|
2239
2244
|
|
|
2240
2245
|
Place it as the very first focusable element on the page, before the app
|
|
2241
2246
|
chrome, and point `href` at the `id` of the main content region.
|
|
@@ -2277,15 +2282,19 @@ Example:
|
|
|
2277
2282
|
## <spec-list>
|
|
2278
2283
|
|
|
2279
2284
|
A key/value specification sheet — the "spec sheet" block on a product page:
|
|
2280
|
-
|
|
2281
|
-
|
|
2285
|
+
a muted, wide-tracked key column against a value column, separated by
|
|
2286
|
+
hairline rules (and uppercased under themes that set
|
|
2287
|
+
`--ui-label-transform`). It describes ONE record's attributes, which is
|
|
2282
2288
|
what sets it apart from `data-table` (many records, many columns, sorting);
|
|
2283
2289
|
`spec-list` is not tabular and renders a real `<dl>`/`<dt>`/`<dd>` structure.
|
|
2284
2290
|
|
|
2285
|
-
Feed it the `items` array for the plain data path, or slot
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2291
|
+
Feed it the `items` array for the plain data path, or slot bare `<dt>`/`<dd>`
|
|
2292
|
+
pairs when a value needs a link, a `status-pill`, or other markup — slotted
|
|
2293
|
+
pairs inherit the component's own key/value styling, so no page CSS is
|
|
2294
|
+
needed. A `<div>` wrapping a pair is also accepted as a full-width grouping
|
|
2295
|
+
row, but `::slotted()` cannot reach inside it, so those `dt`/`dd` stay the
|
|
2296
|
+
consumer's to style. Slotted content takes precedence over `items`; with
|
|
2297
|
+
neither, nothing is rendered.
|
|
2289
2298
|
|
|
2290
2299
|
Import: `import "@f-ewald/components/spec-list.js";`
|
|
2291
2300
|
|
|
@@ -2304,11 +2313,13 @@ Example:
|
|
|
2304
2313
|
];
|
|
2305
2314
|
</script>
|
|
2306
2315
|
|
|
2307
|
-
<!-- Or slot your own
|
|
2308
|
-
markup
|
|
2316
|
+
<!-- Or slot your own pairs when a value needs a link, a status-pill, or other
|
|
2317
|
+
markup; slotted `dt`/`dd` pick up the component's own key/value styling.
|
|
2318
|
+
`dividers` defaults to true; turn it off via the property, since a
|
|
2309
2319
|
`dividers="false"` attribute still parses as a truthy boolean. -->
|
|
2310
2320
|
<spec-list layout="stacked" id="sheet">
|
|
2311
|
-
<
|
|
2321
|
+
<dt>Homepage</dt>
|
|
2322
|
+
<dd><a href="https://example.com">example.com</a></dd>
|
|
2312
2323
|
</spec-list>
|
|
2313
2324
|
```
|
|
2314
2325
|
|