@f-ewald/components 1.39.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/README.md +48 -0
- package/custom-elements.json +1179 -100
- package/dist/address-autocomplete.js +2 -2
- package/dist/address-autocomplete.js.map +1 -1
- package/dist/app-shell.js +4 -4
- package/dist/app-shell.js.map +1 -1
- package/dist/app-sidebar.js +2 -2
- package/dist/app-sidebar.js.map +1 -1
- package/dist/audio-player.js +1 -1
- package/dist/audio-player.js.map +1 -1
- package/dist/autocomplete-input.js +2 -2
- package/dist/autocomplete-input.js.map +1 -1
- package/dist/breadcrumb-nav.d.ts +87 -0
- package/dist/breadcrumb-nav.d.ts.map +1 -0
- package/dist/breadcrumb-nav.js +281 -0
- package/dist/breadcrumb-nav.js.map +1 -0
- package/dist/button-group.js +2 -2
- package/dist/button-group.js.map +1 -1
- package/dist/calendar-day.js +3 -3
- package/dist/calendar-day.js.map +1 -1
- package/dist/calendar-month.d.ts.map +1 -1
- package/dist/calendar-month.js +4 -1
- package/dist/calendar-month.js.map +1 -1
- package/dist/calendar-week.js +4 -4
- package/dist/calendar-week.js.map +1 -1
- package/dist/chat-message.js +1 -1
- package/dist/chat-message.js.map +1 -1
- package/dist/comment-composer.js +1 -1
- package/dist/comment-composer.js.map +1 -1
- package/dist/confirm-dialog.d.ts.map +1 -1
- package/dist/confirm-dialog.js +5 -2
- package/dist/confirm-dialog.js.map +1 -1
- package/dist/content-divider.js +1 -1
- package/dist/content-divider.js.map +1 -1
- package/dist/cron-schedule.d.ts.map +1 -1
- package/dist/cron-schedule.js +6 -5
- package/dist/cron-schedule.js.map +1 -1
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +3 -2
- package/dist/data-table.js.map +1 -1
- package/dist/dropdown-button.d.ts.map +1 -1
- package/dist/dropdown-button.js +4 -2
- package/dist/dropdown-button.js.map +1 -1
- package/dist/editable-text.js +1 -1
- package/dist/editable-text.js.map +1 -1
- package/dist/empty-state.d.ts +58 -0
- package/dist/empty-state.d.ts.map +1 -0
- package/dist/empty-state.js +203 -0
- package/dist/empty-state.js.map +1 -0
- package/dist/form-field.js +1 -1
- package/dist/form-field.js.map +1 -1
- package/dist/form-select.js +3 -3
- package/dist/form-select.js.map +1 -1
- package/dist/frame-box.js +1 -1
- package/dist/frame-box.js.map +1 -1
- package/dist/fullscreen-button.js +1 -1
- package/dist/fullscreen-button.js.map +1 -1
- package/dist/icons.d.ts +2 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +2 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/kanban-card.js +1 -1
- package/dist/kanban-card.js.map +1 -1
- package/dist/kanban-column.js +3 -3
- package/dist/kanban-column.js.map +1 -1
- package/dist/kbd-hint.d.ts.map +1 -1
- package/dist/kbd-hint.js +2 -1
- package/dist/kbd-hint.js.map +1 -1
- package/dist/link-card.js +1 -1
- package/dist/link-card.js.map +1 -1
- package/dist/markdown-view.js +3 -3
- package/dist/markdown-view.js.map +1 -1
- package/dist/modal-dialog.js +1 -1
- package/dist/modal-dialog.js.map +1 -1
- package/dist/multi-select.js +5 -5
- package/dist/multi-select.js.map +1 -1
- package/dist/pagination-nav.d.ts.map +1 -1
- package/dist/pagination-nav.js +5 -1
- package/dist/pagination-nav.js.map +1 -1
- package/dist/photo-gallery.js +1 -1
- package/dist/photo-gallery.js.map +1 -1
- package/dist/popover-panel.d.ts.map +1 -1
- package/dist/popover-panel.js +4 -2
- package/dist/popover-panel.js.map +1 -1
- package/dist/progress-bar.d.ts.map +1 -1
- package/dist/progress-bar.js +1 -0
- package/dist/progress-bar.js.map +1 -1
- package/dist/radio-cards.js +1 -1
- package/dist/radio-cards.js.map +1 -1
- package/dist/radio-pills.js +1 -1
- package/dist/radio-pills.js.map +1 -1
- package/dist/reveal-button.js +1 -1
- package/dist/reveal-button.js.map +1 -1
- package/dist/scroll-to-bottom.js +1 -1
- package/dist/scroll-to-bottom.js.map +1 -1
- package/dist/scroll-to-top.js +1 -1
- package/dist/scroll-to-top.js.map +1 -1
- package/dist/skip-link.d.ts +38 -0
- package/dist/skip-link.d.ts.map +1 -0
- package/dist/skip-link.js +184 -0
- package/dist/skip-link.js.map +1 -0
- package/dist/slide-panel.js +1 -1
- package/dist/slide-panel.js.map +1 -1
- package/dist/spec-list.d.ts +58 -0
- package/dist/spec-list.d.ts.map +1 -0
- package/dist/spec-list.js +226 -0
- package/dist/spec-list.js.map +1 -0
- package/dist/stat-meter.d.ts.map +1 -1
- package/dist/stat-meter.js +1 -0
- package/dist/stat-meter.js.map +1 -1
- package/dist/tab-bar.js +1 -1
- package/dist/tab-bar.js.map +1 -1
- package/dist/text-area.js +1 -1
- package/dist/text-area.js.map +1 -1
- package/dist/tile-grid.js +1 -1
- package/dist/tile-grid.js.map +1 -1
- package/dist/tokens.css +42 -1
- package/dist/tokens.d.ts +50 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +136 -0
- package/dist/tokens.js.map +1 -1
- package/dist/tree-view.js +2 -2
- package/dist/tree-view.js.map +1 -1
- package/dist/ui-admonition.js +1 -1
- package/dist/ui-admonition.js.map +1 -1
- package/dist/ui-button.js +1 -1
- package/dist/ui-button.js.map +1 -1
- package/dist/video-player.js +1 -1
- package/dist/video-player.js.map +1 -1
- package/dist/vote-control.d.ts +40 -0
- package/dist/vote-control.d.ts.map +1 -0
- package/dist/vote-control.js +318 -0
- package/dist/vote-control.js.map +1 -0
- package/docs/address-autocomplete.md +1 -0
- package/docs/app-shell.md +1 -0
- package/docs/app-sidebar.md +1 -0
- package/docs/audio-player.md +1 -0
- package/docs/autocomplete-input.md +1 -0
- package/docs/breadcrumb-nav.md +70 -0
- package/docs/button-group.md +1 -0
- package/docs/calendar-day.md +1 -0
- package/docs/calendar-month.md +1 -0
- package/docs/calendar-week.md +1 -0
- package/docs/chat-message.md +1 -0
- package/docs/comment-composer.md +1 -0
- package/docs/confirm-dialog.md +1 -0
- package/docs/content-divider.md +1 -0
- package/docs/cron-schedule.md +2 -0
- package/docs/data-table.md +2 -0
- package/docs/design-language.md +57 -5
- package/docs/dropdown-button.md +1 -0
- package/docs/editable-text.md +1 -0
- package/docs/empty-state.md +60 -0
- package/docs/form-field.md +1 -0
- package/docs/form-select.md +1 -0
- package/docs/frame-box.md +1 -0
- package/docs/fullscreen-button.md +1 -0
- package/docs/icons.md +1 -0
- package/docs/kanban-card.md +1 -0
- package/docs/kanban-column.md +1 -0
- package/docs/kbd-hint.md +1 -0
- package/docs/link-card.md +1 -0
- package/docs/markdown-view.md +1 -0
- package/docs/modal-dialog.md +1 -0
- package/docs/multi-select.md +1 -0
- package/docs/pagination-nav.md +2 -0
- package/docs/photo-gallery.md +1 -0
- package/docs/popover-panel.md +1 -0
- package/docs/progress-bar.md +1 -0
- package/docs/radio-cards.md +1 -0
- package/docs/radio-pills.md +1 -0
- package/docs/reveal-button.md +1 -0
- package/docs/scroll-to-bottom.md +1 -0
- package/docs/scroll-to-top.md +1 -0
- package/docs/skip-link.md +61 -0
- package/docs/slide-panel.md +1 -0
- package/docs/spec-list.md +79 -0
- package/docs/stat-meter.md +1 -0
- package/docs/tab-bar.md +1 -0
- package/docs/text-area.md +1 -0
- package/docs/tile-grid.md +1 -0
- package/docs/tree-view.md +1 -0
- package/docs/ui-admonition.md +1 -0
- package/docs/ui-button.md +1 -0
- package/docs/video-player.md +1 -0
- package/docs/vote-control.md +73 -0
- package/llms.txt +212 -49
- package/package.json +1 -1
|
@@ -0,0 +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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C;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/stat-meter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat-meter.d.ts","sourceRoot":"","sources":["../src/stat-meter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C;;;;;;;GAOG;AACH,qBACa,SAAU,SAAQ,UAAU;IACvC,OAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"stat-meter.d.ts","sourceRoot":"","sources":["../src/stat-meter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C;;;;;;;GAOG;AACH,qBACa,SAAU,SAAQ,UAAU;IACvC,OAAgB,MAAM,4BA8DpB;IAEF,6DAA6D;IACjD,KAAK,SAAM;IAEvB,qFAAqF;IACzD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE1D,mEAAmE;IACvD,KAAK,SAAM;IAEvB,kGAAkG;IAC1D,UAAU,SAAM;IAE/C,MAAM,yCAYd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
|
package/dist/stat-meter.js
CHANGED
|
@@ -50,6 +50,7 @@ let StatMeter = class StatMeter extends LitElement {
|
|
|
50
50
|
font-size: var(--ui-font-size-sm, 0.75rem);
|
|
51
51
|
font-weight: var(--ui-font-weight-semibold, 600);
|
|
52
52
|
letter-spacing: var(--ui-tracking-wide, 0.04em);
|
|
53
|
+
text-transform: var(--ui-label-transform, none);
|
|
53
54
|
color: var(--ui-text-muted, #64748b);
|
|
54
55
|
}
|
|
55
56
|
|
package/dist/stat-meter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat-meter.js","sourceRoot":"","sources":["../src/stat-meter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;GAOG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;
|
|
1
|
+
{"version":3,"file":"stat-meter.js","sourceRoot":"","sources":["../src/stat-meter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mB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AAC,CAAC,CAAC,GAAG,GAAG,GAAG;KACrD,CAAC;IACJ,CAAC;CACF,CAAA;AAxBa;IAAX,QAAQ,EAAE;wCAAY;AAGK;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAA+B;AAG9C;IAAX,QAAQ,EAAE;wCAAY;AAGiB;IAAvC,QAAQ,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;6CAAiB;AA3E7C,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CA0FrB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A compact labeled meter for a single percentage reading — e.g. CPU or\n * memory usage in a dashboard header. `percent` may be `null` when no\n * reading is available yet (e.g. the first tick of a polling metric); the\n * bar then renders empty and the value shows an em dash instead of \"0%\".\n *\n * @element stat-meter\n */\n@customElement(\"stat-meter\")\nexport class StatMeter extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-flex;\n align-items: center;\n gap: 0.5rem;\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\n .label {\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-semibold, 600);\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\n .track {\n display: block;\n width: 4rem;\n height: 0.375rem;\n border-radius: var(--ui-radius-pill, 9999px);\n background: var(--track-color, var(--ui-surface-muted, #f8fafc));\n overflow: hidden;\n }\n\n .fill {\n display: block;\n height: 100%;\n /* Keep the top highlight while softening the dark edge for compact meters. */\n background: linear-gradient(\n to bottom,\n color-mix(in srgb, var(--fill-color, var(--ui-success, #16a34a)) 70%, #ffffff) 0%,\n color-mix(in srgb, var(--fill-color, var(--ui-success, #16a34a)) 80%, #000000) 100%\n );\n transition: width 200ms ease;\n }\n\n .value {\n min-width: 2rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n color: var(--ui-text, #0f172a);\n font-variant-numeric: tabular-nums;\n text-align: right;\n }\n @media (prefers-reduced-motion: reduce) {\n .fill {\n transition: none;\n }\n }\n `,\n ];\n\n /** Short label shown before the bar, e.g. \"CPU\" or \"MEM\". */\n @property() label = \"\";\n\n /** Percentage 0-100. `null` renders an empty bar and a \"—\" value instead of \"0%\". */\n @property({ type: Number }) percent: number | null = null;\n\n /** Fill color override; falls back to the `--ui-success` token. */\n @property() color = \"\";\n\n /** Track (inactive portion) background override; falls back to the `--ui-surface-muted` token. */\n @property({ attribute: \"track-color\" }) trackColor = \"\";\n\n override render() {\n const pct = this.percent;\n const clamped = pct === null ? 0 : Math.min(100, Math.max(0, pct));\n const fillStyle = this.color ? `width: ${clamped}%; --fill-color: ${this.color}` : `width: ${clamped}%`;\n const trackStyle = this.trackColor ? `--track-color: ${this.trackColor}` : \"\";\n return html`\n <span class=\"label\">${this.label}</span>\n <span class=\"track\" role=\"img\" style=${trackStyle} aria-label=\"${this.label} ${pct === null ? \"no reading\" : `${pct}%`}\">\n <span class=\"fill\" style=${fillStyle}></span>\n </span>\n <span class=\"value\">${pct === null ? \"—\" : `${pct}%`}</span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"stat-meter\": StatMeter;\n }\n}\n"]}
|
package/dist/tab-bar.js
CHANGED
|
@@ -41,7 +41,7 @@ let TabBar = class TabBar extends LitElement {
|
|
|
41
41
|
.tablist {
|
|
42
42
|
display: flex;
|
|
43
43
|
gap: 1rem;
|
|
44
|
-
border-bottom: 1px solid var(--ui-border, #e2e8f0);
|
|
44
|
+
border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
45
45
|
}
|
|
46
46
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,CAAC;CACF,CAAA;AA9Ma;IAAX,QAAQ,EAAE;qCAAY;AAGN;IADhB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;yCACT;AAEtB;IAAhB,KAAK,EAAE;wCAAsB;AAPnB,MAAM;IADlB,aAAa,CAAC,SAAS,CAAC;GACZ,MAAM,CAgNlB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, queryAssignedElements, state } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\nimport { TabItem } from \"./tab-item.js\";\n\nlet instanceCount = 0;\n\n/** Fired when the active tab changes in response to user interaction. */\nexport interface TabChangeDetail {\n /** The newly active `tab-item`'s `value` (falling back to its `label`). */\n value: string;\n /** Index of the newly active `tab-item` among its siblings. */\n index: number;\n}\n\n/**\n * WAI-ARIA tabs pattern (automatic activation, roving tabindex) driving a\n * strip of declarative `tab-item` children. `tab-bar` renders the `role=\"tab\"`\n * button strip itself, reading `label`/`value`/`selected` off each slotted\n * `tab-item`; each `tab-item` owns its own visibility via its reflected\n * `selected` attribute.\n *\n * The active tab's underline uses `--ui-primary`; a `--ui-border` line spans\n * the full strip beneath every tab, standing in for the inactive state since\n * this design system has no dedicated secondary accent color.\n *\n * @element tab-bar\n * @slot - `tab-item` elements.\n * @fires change - The active tab changed via click or keyboard; detail: `TabChangeDetail`.\n */\n@customElement(\"tab-bar\")\nexport class TabBar extends LitElement {\n /** Accessible name for the tablist (e.g. \"Editor mode\"). */\n @property() label = \"\";\n\n @queryAssignedElements({ selector: \"tab-item\" })\n private readonly _tabItems!: TabItem[];\n\n @state() private _version = 0;\n private readonly _uid = `tab-bar-${++instanceCount}`;\n private _observer?: MutationObserver;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .tablist {\n display: flex;\n gap: 1rem;\n border-bottom: 1px solid var(--ui-border, #e2e8f0);\n }\n .tab {\n appearance: none;\n background: none;\n border: none;\n border-bottom: 2px solid transparent;\n margin-bottom: -1px;\n min-height: 2rem;\n padding: 0.5rem 0.25rem;\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 font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text-muted, #64748b);\n cursor: pointer;\n }\n .tab:hover {\n color: var(--ui-text, #0f172a);\n }\n .tab[aria-selected=\"true\"] {\n color: var(--ui-text, #0f172a);\n font-weight: var(--ui-font-weight-semibold, 600);\n border-bottom-color: var(--ui-primary, #4f46e5);\n }\n .tab:focus-visible {\n outline: none;\n border-radius: var(--ui-radius-sm, 0.25rem);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .panels {\n margin-top: 1rem;\n }\n @media (forced-colors: active) {\n .tab[aria-selected=\"true\"] {\n border-bottom-color: Highlight;\n }\n .tab:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._observer ??= new MutationObserver(() => {\n this._version++;\n this._ensureSelection();\n });\n this._observer.observe(this, {\n attributes: true,\n attributeFilter: [\"label\", \"value\", \"selected\"],\n childList: true,\n subtree: true,\n });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._observer?.disconnect();\n this._observer = undefined;\n }\n\n protected override updated(): void {\n this._tabItems.forEach((item, index) => {\n item.setAttribute(\"aria-labelledby\", this._tabButtonId(index));\n });\n }\n\n private _handleSlotChange(): void {\n this._version++;\n this._ensureSelection();\n }\n\n /** Defaults the first tab-item to selected if none was marked so by the consumer. */\n private _ensureSelection(): void {\n const items = this._tabItems;\n if (items.length > 0 && !items.some((item) => item.selected)) {\n items[0].selected = true;\n }\n }\n\n private _currentIndex(): number {\n const index = this._tabItems.findIndex((item) => item.selected);\n return index === -1 ? 0 : index;\n }\n\n private _tabButtonId(index: number): string {\n return `${this._uid}-tab-${index}`;\n }\n\n private _select(index: number, options?: { focus?: boolean }): void {\n const items = this._tabItems;\n const target = items[index];\n if (!target) return;\n const changed = !target.selected;\n for (const item of items) item.selected = item === target;\n this._version++;\n if (options?.focus) this._focusButton(index);\n if (changed) {\n this.dispatchEvent(\n new CustomEvent<TabChangeDetail>(\"change\", {\n detail: { value: target.value || target.label, index },\n bubbles: true,\n composed: true,\n }),\n );\n }\n }\n\n private _focusButton(index: number): void {\n void this.updateComplete.then(() => {\n this.shadowRoot?.querySelectorAll<HTMLButtonElement>(\".tab\")[index]?.focus();\n });\n }\n\n /** Arrow/Home/End roving-tabindex navigation with automatic activation. */\n private _onKeydown(event: KeyboardEvent): void {\n const items = this._tabItems;\n if (items.length === 0) return;\n const current = this._currentIndex();\n let next: number;\n switch (event.key) {\n case \"ArrowRight\":\n case \"ArrowDown\":\n next = (current + 1) % items.length;\n break;\n case \"ArrowLeft\":\n case \"ArrowUp\":\n next = (current - 1 + items.length) % items.length;\n break;\n case \"Home\":\n next = 0;\n break;\n case \"End\":\n next = items.length - 1;\n break;\n default:\n return;\n }\n event.preventDefault();\n this._select(next, { focus: true });\n }\n\n override render() {\n const items = this._tabItems ?? [];\n const current = this._currentIndex();\n return html`\n <div\n class=\"tablist\"\n role=\"tablist\"\n aria-label=${this.label || nothing}\n @keydown=${this._onKeydown}\n >\n ${repeat(\n items,\n (item) => item,\n (item, index) => html`\n <button\n type=\"button\"\n class=\"tab\"\n role=\"tab\"\n id=${this._tabButtonId(index)}\n aria-selected=${item.selected ? \"true\" : \"false\"}\n aria-controls=${item.id}\n tabindex=${index === current ? 0 : -1}\n @click=${() => this._select(index)}\n >\n ${item.label}\n </button>\n `,\n )}\n </div>\n <div class=\"panels\"><slot @slotchange=${this._handleSlotChange}></slot></div>\n `;\n }\n}\n\ndeclare global {\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ma;IAAX,QAAQ,EAAE;qCAAY;AAGN;IADhB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;yCACT;AAEtB;IAAhB,KAAK,EAAE;wCAAsB;AAPnB,MAAM;IADlB,aAAa,CAAC,SAAS,CAAC;GACZ,MAAM,CAgNlB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, queryAssignedElements, state } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\nimport { TabItem } from \"./tab-item.js\";\n\nlet instanceCount = 0;\n\n/** Fired when the active tab changes in response to user interaction. */\nexport interface TabChangeDetail {\n /** The newly active `tab-item`'s `value` (falling back to its `label`). */\n value: string;\n /** Index of the newly active `tab-item` among its siblings. */\n index: number;\n}\n\n/**\n * WAI-ARIA tabs pattern (automatic activation, roving tabindex) driving a\n * strip of declarative `tab-item` children. `tab-bar` renders the `role=\"tab\"`\n * button strip itself, reading `label`/`value`/`selected` off each slotted\n * `tab-item`; each `tab-item` owns its own visibility via its reflected\n * `selected` attribute.\n *\n * The active tab's underline uses `--ui-primary`; a `--ui-border` line spans\n * the full strip beneath every tab, standing in for the inactive state since\n * this design system has no dedicated secondary accent color.\n *\n * @element tab-bar\n * @slot - `tab-item` elements.\n * @fires change - The active tab changed via click or keyboard; detail: `TabChangeDetail`.\n */\n@customElement(\"tab-bar\")\nexport class TabBar extends LitElement {\n /** Accessible name for the tablist (e.g. \"Editor mode\"). */\n @property() label = \"\";\n\n @queryAssignedElements({ selector: \"tab-item\" })\n private readonly _tabItems!: TabItem[];\n\n @state() private _version = 0;\n private readonly _uid = `tab-bar-${++instanceCount}`;\n private _observer?: MutationObserver;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .tablist {\n display: flex;\n gap: 1rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n .tab {\n appearance: none;\n background: none;\n border: none;\n border-bottom: 2px solid transparent;\n margin-bottom: -1px;\n min-height: 2rem;\n padding: 0.5rem 0.25rem;\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 font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text-muted, #64748b);\n cursor: pointer;\n }\n .tab:hover {\n color: var(--ui-text, #0f172a);\n }\n .tab[aria-selected=\"true\"] {\n color: var(--ui-text, #0f172a);\n font-weight: var(--ui-font-weight-semibold, 600);\n border-bottom-color: var(--ui-primary, #4f46e5);\n }\n .tab:focus-visible {\n outline: none;\n border-radius: var(--ui-radius-sm, 0.25rem);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .panels {\n margin-top: 1rem;\n }\n @media (forced-colors: active) {\n .tab[aria-selected=\"true\"] {\n border-bottom-color: Highlight;\n }\n .tab:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._observer ??= new MutationObserver(() => {\n this._version++;\n this._ensureSelection();\n });\n this._observer.observe(this, {\n attributes: true,\n attributeFilter: [\"label\", \"value\", \"selected\"],\n childList: true,\n subtree: true,\n });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._observer?.disconnect();\n this._observer = undefined;\n }\n\n protected override updated(): void {\n this._tabItems.forEach((item, index) => {\n item.setAttribute(\"aria-labelledby\", this._tabButtonId(index));\n });\n }\n\n private _handleSlotChange(): void {\n this._version++;\n this._ensureSelection();\n }\n\n /** Defaults the first tab-item to selected if none was marked so by the consumer. */\n private _ensureSelection(): void {\n const items = this._tabItems;\n if (items.length > 0 && !items.some((item) => item.selected)) {\n items[0].selected = true;\n }\n }\n\n private _currentIndex(): number {\n const index = this._tabItems.findIndex((item) => item.selected);\n return index === -1 ? 0 : index;\n }\n\n private _tabButtonId(index: number): string {\n return `${this._uid}-tab-${index}`;\n }\n\n private _select(index: number, options?: { focus?: boolean }): void {\n const items = this._tabItems;\n const target = items[index];\n if (!target) return;\n const changed = !target.selected;\n for (const item of items) item.selected = item === target;\n this._version++;\n if (options?.focus) this._focusButton(index);\n if (changed) {\n this.dispatchEvent(\n new CustomEvent<TabChangeDetail>(\"change\", {\n detail: { value: target.value || target.label, index },\n bubbles: true,\n composed: true,\n }),\n );\n }\n }\n\n private _focusButton(index: number): void {\n void this.updateComplete.then(() => {\n this.shadowRoot?.querySelectorAll<HTMLButtonElement>(\".tab\")[index]?.focus();\n });\n }\n\n /** Arrow/Home/End roving-tabindex navigation with automatic activation. */\n private _onKeydown(event: KeyboardEvent): void {\n const items = this._tabItems;\n if (items.length === 0) return;\n const current = this._currentIndex();\n let next: number;\n switch (event.key) {\n case \"ArrowRight\":\n case \"ArrowDown\":\n next = (current + 1) % items.length;\n break;\n case \"ArrowLeft\":\n case \"ArrowUp\":\n next = (current - 1 + items.length) % items.length;\n break;\n case \"Home\":\n next = 0;\n break;\n case \"End\":\n next = items.length - 1;\n break;\n default:\n return;\n }\n event.preventDefault();\n this._select(next, { focus: true });\n }\n\n override render() {\n const items = this._tabItems ?? [];\n const current = this._currentIndex();\n return html`\n <div\n class=\"tablist\"\n role=\"tablist\"\n aria-label=${this.label || nothing}\n @keydown=${this._onKeydown}\n >\n ${repeat(\n items,\n (item) => item,\n (item, index) => html`\n <button\n type=\"button\"\n class=\"tab\"\n role=\"tab\"\n id=${this._tabButtonId(index)}\n aria-selected=${item.selected ? \"true\" : \"false\"}\n aria-controls=${item.id}\n tabindex=${index === current ? 0 : -1}\n @click=${() => this._select(index)}\n >\n ${item.label}\n </button>\n `,\n )}\n </div>\n <div class=\"panels\"><slot @slotchange=${this._handleSlotChange}></slot></div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"tab-bar\": TabBar;\n }\n}\n"]}
|
package/dist/text-area.js
CHANGED
|
@@ -73,7 +73,7 @@ let TextArea = class TextArea extends LitElement {
|
|
|
73
73
|
color: var(--ui-text, #0f172a);
|
|
74
74
|
background: var(--ui-surface, #ffffff);
|
|
75
75
|
padding: 0.5rem 0.75rem;
|
|
76
|
-
border: 1px solid var(--ui-border, #e2e8f0);
|
|
76
|
+
border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
77
77
|
border-radius: var(--ui-radius-sm, 0.25rem);
|
|
78
78
|
resize: vertical;
|
|
79
79
|
}
|
package/dist/text-area.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-area.js","sourceRoot":"","sources":["../src/text-area.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;AACrC,OAAO,EACL,gBAAgB,GAEjB,MAAM,+BAA+B,CAAC;AAEvC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;GAWG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACL,4BAA4B;QAChB,UAAK,GAAG,EAAE,CAAC;QACvB,oDAAoD;QACxB,SAAI,GAAG,CAAC,CAAC;QACrC,yCAAyC;QAC7B,gBAAW,GAAG,EAAE,CAAC;QAC7B,kEAAkE;QACrC,aAAQ,GAAG,KAAK,CAAC;QAC9C,4DAA4D;QAC/B,aAAQ,GAAG,KAAK,CAAC;QAE7B,qBAAgB,GAAkC,IAAI,CAAC;QAE/D,gBAAW,GAAG,mBAAmB,EAAE,aAAa,EAAE,CAAC;IAoM9D,CAAC;IApMU,WA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,CAAC,CAAC;QACpF,OAAO,IAAI,CAAA;;6BAEc,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,KAAK;YAC3D,CAAC,CAAC,WAAW;YACb,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;;UAEvC,QAAQ;YACR,CAAC,CAAC,IAAI,CAAA;kDACkC,IAAI,CAAC,WAAW;wBAC1C,IAAI,CAAC,gBAAiB,CAAC,KAAK;kBAClC,IAAI,CAAC,gBAAiB,CAAC,QAAQ;gBAC/B,CAAC,CAAC,IAAI,CAAA;;;qBAGH;gBACH,CAAC,CAAC,OAAO;;aAEd;YACH,CAAC,CAAC,OAAO;;eAEJ,IAAI,CAAC,WAAW;mBACZ,IAAI,CAAC,KAAK;iBACZ,IAAI,CAAC,IAAI;wBACF,IAAI,CAAC,WAAW;sBAClB,IAAI,CAAC,QAAQ;sBACb,IAAI,CAAC,QAAQ;mBAChB,IAAI,CAAC,QAAQ;oBACZ,IAAI,CAAC,SAAS;;;KAG7B,CAAC;IACJ,CAAC;CACF,CAAA;AAhNa;IAAX,QAAQ,EAAE;uCAAY;AAEK;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAU;AAEzB;IAAX,QAAQ,EAAE;6CAAkB;AAEA;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAE7B;IAAhB,KAAK,EAAE;kDAAgE;AAZ7D,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAkNpB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n formFieldControl,\n type FormFieldControlConfig,\n} from \"./utils/form-field-control.js\";\n\nlet instanceCount = 0;\n\n/**\n * Plain multi-line text field — a thin, tokenized wrapper around a native\n * `<textarea>`, styled to match the other value-entry form fields\n * (autocomplete-input, form-select, ...). Not a rich editor; use `readonly`\n * to display pre-formatted text (e.g. an error message) that the user can\n * still select and copy, typically paired with `<copy-link-button>`.\n * Supports `form-field`'s opt-in floating-label mode when slotted inside it.\n *\n * @element text-area\n * @fires input - Fires on every keystroke; detail: { value: string }.\n * @fires change - Native change semantics (on blur, if the value changed); detail: { value: string }.\n */\n@customElement(\"text-area\")\nexport class TextArea extends LitElement {\n /** Current text content. */\n @property() value = \"\";\n /** Visible row count (native `<textarea rows>`). */\n @property({ type: Number }) rows = 4;\n /** Placeholder text shown when empty. */\n @property() placeholder = \"\";\n /** When true, the value can be selected/copied but not edited. */\n @property({ type: Boolean }) readonly = false;\n /** Disables the field entirely (no interaction, dimmed). */\n @property({ type: Boolean }) disabled = false;\n\n @state() private _formFieldConfig: FormFieldControlConfig | null = null;\n\n readonly #textareaId = `text-area-field-${++instanceCount}`;\n\n /**\n * Applies or clears label configuration supplied by a wrapping `form-field`.\n * @private\n */\n [formFieldControl](config: FormFieldControlConfig | null): void {\n this._formFieldConfig = config;\n }\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .field-shell {\n position: relative;\n }\n textarea {\n display: block;\n box-sizing: border-box;\n width: 100%;\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 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 background: var(--ui-surface, #ffffff);\n padding: 0.5rem 0.75rem;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n resize: vertical;\n }\n .floating-label {\n position: absolute;\n top: 0.25rem;\n left: 0.75rem;\n right: 0.75rem;\n z-index: 1;\n display: flex;\n align-items: baseline;\n gap: 0.25rem;\n overflow: hidden;\n color: var(--ui-text-muted, #64748b);\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 font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-regular, 400);\n line-height: var(--ui-line-height-tight, 1.25);\n white-space: nowrap;\n text-overflow: ellipsis;\n cursor: text;\n transition:\n top 150ms ease,\n font-size 150ms ease;\n }\n .field-shell.floating textarea {\n min-height: 3rem;\n padding-top: 1.5rem;\n }\n .field-shell.floating.has-value .floating-label,\n .field-shell.floating:focus-within .floating-label {\n top: 0.25rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .field-shell.floating:not(.has-value):not(:focus-within) textarea::placeholder {\n opacity: 0;\n }\n .field-shell.disabled .floating-label {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .required-mark {\n flex: 0 0 auto;\n color: var(--ui-danger, #dc2626);\n }\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n textarea:read-only {\n background: var(--ui-surface-muted, #f8fafc);\n }\n textarea:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n textarea:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n @media (forced-colors: active) {\n textarea:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n textarea:disabled {\n color: GrayText;\n opacity: 1;\n }\n .field-shell.disabled .floating-label {\n color: GrayText;\n opacity: 1;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .floating-label {\n transition: none;\n }\n }\n `,\n ];\n\n private _onInput(e: Event): void {\n // The native textarea's own \"input\" event is composed (crosses the shadow\n // boundary) — stop it so only our re-dispatched CustomEvent (carrying\n // `detail.value`) reaches consumers. Otherwise the native event bubbles\n // out afterwards too, re-invoking the same \"input\" listener with a plain\n // UIEvent whose `detail` defaults to 0, clobbering consumer state.\n e.stopPropagation();\n this.value = (e.target as HTMLTextAreaElement).value;\n this.dispatchEvent(\n new CustomEvent(\"input\", { detail: { value: this.value }, bubbles: true, composed: true }),\n );\n }\n\n private _onChange(e: Event): void {\n e.stopPropagation();\n this.value = (e.target as HTMLTextAreaElement).value;\n this.dispatchEvent(\n new CustomEvent(\"change\", { detail: { value: this.value }, bubbles: true, composed: true }),\n );\n }\n\n override render() {\n const floating =\n Boolean(this._formFieldConfig?.floating) && Boolean(this._formFieldConfig?.label);\n return html`\n <div\n class=\"field-shell ${floating ? \"floating\" : \"\"} ${this.value\n ? \"has-value\"\n : \"\"} ${this.disabled ? \"disabled\" : \"\"}\"\n >\n ${floating\n ? html`\n <label class=\"floating-label\" for=${this.#textareaId}>\n <span>${this._formFieldConfig!.label}</span>\n ${this._formFieldConfig!.required\n ? html`\n <span class=\"required-mark\" aria-hidden=\"true\">*</span>\n <span class=\"sr-only\"> (required)</span>\n `\n : nothing}\n </label>\n `\n : nothing}\n <textarea\n id=${this.#textareaId}\n .value=${this.value}\n rows=${this.rows}\n placeholder=${this.placeholder}\n ?readonly=${this.readonly}\n ?disabled=${this.disabled}\n @input=${this._onInput}\n @change=${this._onChange}\n ></textarea>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"text-area\": TextArea;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"text-area.js","sourceRoot":"","sources":["../src/text-area.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD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AClB,IAAI,CAAC,QAAQ;sBACb,IAAI,CAAC,QAAQ;mBAChB,IAAI,CAAC,QAAQ;oBACZ,IAAI,CAAC,SAAS;;;KAG7B,CAAC;IACJ,CAAC;CACF,CAAA;AAhNa;IAAX,QAAQ,EAAE;uCAAY;AAEK;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAU;AAEzB;IAAX,QAAQ,EAAE;6CAAkB;AAEA;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAE7B;IAAhB,KAAK,EAAE;kDAAgE;AAZ7D,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAkNpB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n formFieldControl,\n type FormFieldControlConfig,\n} from \"./utils/form-field-control.js\";\n\nlet instanceCount = 0;\n\n/**\n * Plain multi-line text field — a thin, tokenized wrapper around a native\n * `<textarea>`, styled to match the other value-entry form fields\n * (autocomplete-input, form-select, ...). Not a rich editor; use `readonly`\n * to display pre-formatted text (e.g. an error message) that the user can\n * still select and copy, typically paired with `<copy-link-button>`.\n * Supports `form-field`'s opt-in floating-label mode when slotted inside it.\n *\n * @element text-area\n * @fires input - Fires on every keystroke; detail: { value: string }.\n * @fires change - Native change semantics (on blur, if the value changed); detail: { value: string }.\n */\n@customElement(\"text-area\")\nexport class TextArea extends LitElement {\n /** Current text content. */\n @property() value = \"\";\n /** Visible row count (native `<textarea rows>`). */\n @property({ type: Number }) rows = 4;\n /** Placeholder text shown when empty. */\n @property() placeholder = \"\";\n /** When true, the value can be selected/copied but not edited. */\n @property({ type: Boolean }) readonly = false;\n /** Disables the field entirely (no interaction, dimmed). */\n @property({ type: Boolean }) disabled = false;\n\n @state() private _formFieldConfig: FormFieldControlConfig | null = null;\n\n readonly #textareaId = `text-area-field-${++instanceCount}`;\n\n /**\n * Applies or clears label configuration supplied by a wrapping `form-field`.\n * @private\n */\n [formFieldControl](config: FormFieldControlConfig | null): void {\n this._formFieldConfig = config;\n }\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .field-shell {\n position: relative;\n }\n textarea {\n display: block;\n box-sizing: border-box;\n width: 100%;\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 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 background: var(--ui-surface, #ffffff);\n padding: 0.5rem 0.75rem;\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n resize: vertical;\n }\n .floating-label {\n position: absolute;\n top: 0.25rem;\n left: 0.75rem;\n right: 0.75rem;\n z-index: 1;\n display: flex;\n align-items: baseline;\n gap: 0.25rem;\n overflow: hidden;\n color: var(--ui-text-muted, #64748b);\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 font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-regular, 400);\n line-height: var(--ui-line-height-tight, 1.25);\n white-space: nowrap;\n text-overflow: ellipsis;\n cursor: text;\n transition:\n top 150ms ease,\n font-size 150ms ease;\n }\n .field-shell.floating textarea {\n min-height: 3rem;\n padding-top: 1.5rem;\n }\n .field-shell.floating.has-value .floating-label,\n .field-shell.floating:focus-within .floating-label {\n top: 0.25rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .field-shell.floating:not(.has-value):not(:focus-within) textarea::placeholder {\n opacity: 0;\n }\n .field-shell.disabled .floating-label {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .required-mark {\n flex: 0 0 auto;\n color: var(--ui-danger, #dc2626);\n }\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n textarea:read-only {\n background: var(--ui-surface-muted, #f8fafc);\n }\n textarea:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n textarea:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n @media (forced-colors: active) {\n textarea:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n textarea:disabled {\n color: GrayText;\n opacity: 1;\n }\n .field-shell.disabled .floating-label {\n color: GrayText;\n opacity: 1;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .floating-label {\n transition: none;\n }\n }\n `,\n ];\n\n private _onInput(e: Event): void {\n // The native textarea's own \"input\" event is composed (crosses the shadow\n // boundary) — stop it so only our re-dispatched CustomEvent (carrying\n // `detail.value`) reaches consumers. Otherwise the native event bubbles\n // out afterwards too, re-invoking the same \"input\" listener with a plain\n // UIEvent whose `detail` defaults to 0, clobbering consumer state.\n e.stopPropagation();\n this.value = (e.target as HTMLTextAreaElement).value;\n this.dispatchEvent(\n new CustomEvent(\"input\", { detail: { value: this.value }, bubbles: true, composed: true }),\n );\n }\n\n private _onChange(e: Event): void {\n e.stopPropagation();\n this.value = (e.target as HTMLTextAreaElement).value;\n this.dispatchEvent(\n new CustomEvent(\"change\", { detail: { value: this.value }, bubbles: true, composed: true }),\n );\n }\n\n override render() {\n const floating =\n Boolean(this._formFieldConfig?.floating) && Boolean(this._formFieldConfig?.label);\n return html`\n <div\n class=\"field-shell ${floating ? \"floating\" : \"\"} ${this.value\n ? \"has-value\"\n : \"\"} ${this.disabled ? \"disabled\" : \"\"}\"\n >\n ${floating\n ? html`\n <label class=\"floating-label\" for=${this.#textareaId}>\n <span>${this._formFieldConfig!.label}</span>\n ${this._formFieldConfig!.required\n ? html`\n <span class=\"required-mark\" aria-hidden=\"true\">*</span>\n <span class=\"sr-only\"> (required)</span>\n `\n : nothing}\n </label>\n `\n : nothing}\n <textarea\n id=${this.#textareaId}\n .value=${this.value}\n rows=${this.rows}\n placeholder=${this.placeholder}\n ?readonly=${this.readonly}\n ?disabled=${this.disabled}\n @input=${this._onInput}\n @change=${this._onChange}\n ></textarea>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"text-area\": TextArea;\n }\n}\n"]}
|
package/dist/tile-grid.js
CHANGED
|
@@ -64,7 +64,7 @@ let TileGrid = class TileGrid extends LitElement {
|
|
|
64
64
|
gap: 0.75rem;
|
|
65
65
|
}
|
|
66
66
|
.tile {
|
|
67
|
-
border: 1px solid var(--ui-border, #e2e8f0);
|
|
67
|
+
border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
68
68
|
border-radius: var(--ui-radius, 0.5rem);
|
|
69
69
|
padding: 0.75rem;
|
|
70
70
|
color: var(--ui-text, #0f172a);
|
package/dist/tile-grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-grid.js","sourceRoot":"","sources":["../src/tile-grid.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;A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B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uCAAuB;AAEtB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yCAGpB;AAEqB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAAiE;AAEhE;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;0CAA4D;AAEtC;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;0CAAkB;AA5E3D,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAoIpB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { iconDocument } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A generic, presentational grid shell: renders one bordered card per entry\n * in `items`, with each tile's content produced by `renderTile` (default:\n * stringify). Knows nothing about what an \"item\" means — callers own the\n * data shape entirely. Modeled directly on `data-table`'s headless pattern.\n *\n * Optional `itemHref` makes whole tiles clickable (navigating via\n * `location.hash`), without hijacking clicks on nested interactive elements\n * (links/buttons) a tile's rendered content might contain.\n *\n * Optional `fileIcon` prefixes each tile with a decorative Heroicons\n * \"document\" glyph, for grids whose items represent files — the icon never\n * carries its own accessible name since the rendered tile content (e.g. a\n * filename) already identifies the item. Off by default, so it consumes no\n * layout space or markup for grids of non-file items.\n *\n * @element tile-grid\n */\n@customElement(\"tile-grid\")\nexport class TileGrid extends LitElement {\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 font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr));\n gap: 0.75rem;\n }\n .tile {\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius, 0.5rem);\n padding: 0.75rem;\n color: var(--ui-text, #0f172a);\n }\n .tile.clickable {\n cursor: pointer;\n }\n .tile.clickable:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .tile.clickable:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .tile-body {\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n }\n .tile-icon {\n display: inline-flex;\n flex-shrink: 0;\n margin-top: 0.125rem;\n color: var(--ui-text-muted, #64748b);\n }\n .tile-content {\n min-width: 0;\n flex: 1;\n }\n @media (forced-colors: active) {\n .tile.clickable:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n /** Tile data; opaque to this component beyond what `renderTile` does with it. */\n @property({ attribute: false }) items: unknown[] = [];\n /** Stable identity for `items[i]`, used as the repeat-directive key. Defaults to the item's index. */\n @property({ attribute: false }) itemKey: (item: unknown, index: number) => string | number = (\n _item,\n index,\n ) => index;\n /** Produces a tile's rendered content for `item`. Default: stringify. */\n @property({ attribute: false }) renderTile: (item: unknown) => unknown = (item) => String(item);\n /** When set, clicking a tile (outside any nested link/button) navigates to this hash. */\n @property({ attribute: false }) itemHref: ((item: unknown) => string | null) | null = null;\n /** Prefixes each tile with a decorative \"document\" icon, for grids of file-like items. Off by default. */\n @property({ type: Boolean, attribute: \"file-icon\" }) fileIcon = false;\n\n #onTileClick(item: unknown, e: MouseEvent): void {\n if (!this.itemHref) return;\n if (this.#isNestedInteractive(e.composedPath(), e.currentTarget)) return;\n const href = this.itemHref(item);\n if (href) location.hash = href;\n }\n\n #onTileKeydown(href: string, e: KeyboardEvent): void {\n if (e.key !== \"Enter\" || e.target !== e.currentTarget) return;\n e.preventDefault();\n location.hash = href;\n }\n\n #isNestedInteractive(path: EventTarget[], tile: EventTarget | null): boolean {\n const selector =\n \"a, button, input, select, textarea, summary, [contenteditable], [role='button'], [role='link'], [tabindex]\";\n for (const target of path) {\n if (target === tile) return false;\n if (target instanceof HTMLElement && target.matches(selector)) return true;\n }\n return false;\n }\n\n override render() {\n return html`\n <div class=\"grid\">\n ${repeat(\n this.items,\n (item, i) => this.itemKey(item, i),\n (item) => {\n const href = this.itemHref?.(item) ?? null;\n return html`\n <div\n class=${href ? \"tile clickable\" : \"tile\"}\n role=${href ? \"link\" : nothing}\n tabindex=${href ? \"0\" : nothing}\n @click=${(e: MouseEvent) => this.#onTileClick(item, e)}\n @keydown=${href ? (e: KeyboardEvent) => this.#onTileKeydown(href, e) : nothing}\n >\n ${this.fileIcon\n ? html`\n <div class=\"tile-body\">\n <span class=\"tile-icon\" aria-hidden=\"true\">${iconDocument(14)}</span>\n <div class=\"tile-content\">${this.renderTile(item)}</div>\n </div>\n `\n : this.renderTile(item)}\n </div>\n `;\n },\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"tile-grid\": TileGrid;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tile-grid.js","sourceRoot":"","sources":["../src/tile-grid.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QAgEL,iFAAiF;QACjD,UAA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E,CAAC;yCAGpB;AAEqB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAAiE;AAEhE;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;0CAA4D;AAEtC;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;0CAAkB;AA5E3D,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAoIpB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { iconDocument } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A generic, presentational grid shell: renders one bordered card per entry\n * in `items`, with each tile's content produced by `renderTile` (default:\n * stringify). Knows nothing about what an \"item\" means — callers own the\n * data shape entirely. Modeled directly on `data-table`'s headless pattern.\n *\n * Optional `itemHref` makes whole tiles clickable (navigating via\n * `location.hash`), without hijacking clicks on nested interactive elements\n * (links/buttons) a tile's rendered content might contain.\n *\n * Optional `fileIcon` prefixes each tile with a decorative Heroicons\n * \"document\" glyph, for grids whose items represent files — the icon never\n * carries its own accessible name since the rendered tile content (e.g. a\n * filename) already identifies the item. Off by default, so it consumes no\n * layout space or markup for grids of non-file items.\n *\n * @element tile-grid\n */\n@customElement(\"tile-grid\")\nexport class TileGrid extends LitElement {\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 font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr));\n gap: 0.75rem;\n }\n .tile {\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius, 0.5rem);\n padding: 0.75rem;\n color: var(--ui-text, #0f172a);\n }\n .tile.clickable {\n cursor: pointer;\n }\n .tile.clickable:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .tile.clickable:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .tile-body {\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n }\n .tile-icon {\n display: inline-flex;\n flex-shrink: 0;\n margin-top: 0.125rem;\n color: var(--ui-text-muted, #64748b);\n }\n .tile-content {\n min-width: 0;\n flex: 1;\n }\n @media (forced-colors: active) {\n .tile.clickable:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n /** Tile data; opaque to this component beyond what `renderTile` does with it. */\n @property({ attribute: false }) items: unknown[] = [];\n /** Stable identity for `items[i]`, used as the repeat-directive key. Defaults to the item's index. */\n @property({ attribute: false }) itemKey: (item: unknown, index: number) => string | number = (\n _item,\n index,\n ) => index;\n /** Produces a tile's rendered content for `item`. Default: stringify. */\n @property({ attribute: false }) renderTile: (item: unknown) => unknown = (item) => String(item);\n /** When set, clicking a tile (outside any nested link/button) navigates to this hash. */\n @property({ attribute: false }) itemHref: ((item: unknown) => string | null) | null = null;\n /** Prefixes each tile with a decorative \"document\" icon, for grids of file-like items. Off by default. */\n @property({ type: Boolean, attribute: \"file-icon\" }) fileIcon = false;\n\n #onTileClick(item: unknown, e: MouseEvent): void {\n if (!this.itemHref) return;\n if (this.#isNestedInteractive(e.composedPath(), e.currentTarget)) return;\n const href = this.itemHref(item);\n if (href) location.hash = href;\n }\n\n #onTileKeydown(href: string, e: KeyboardEvent): void {\n if (e.key !== \"Enter\" || e.target !== e.currentTarget) return;\n e.preventDefault();\n location.hash = href;\n }\n\n #isNestedInteractive(path: EventTarget[], tile: EventTarget | null): boolean {\n const selector =\n \"a, button, input, select, textarea, summary, [contenteditable], [role='button'], [role='link'], [tabindex]\";\n for (const target of path) {\n if (target === tile) return false;\n if (target instanceof HTMLElement && target.matches(selector)) return true;\n }\n return false;\n }\n\n override render() {\n return html`\n <div class=\"grid\">\n ${repeat(\n this.items,\n (item, i) => this.itemKey(item, i),\n (item) => {\n const href = this.itemHref?.(item) ?? null;\n return html`\n <div\n class=${href ? \"tile clickable\" : \"tile\"}\n role=${href ? \"link\" : nothing}\n tabindex=${href ? \"0\" : nothing}\n @click=${(e: MouseEvent) => this.#onTileClick(item, e)}\n @keydown=${href ? (e: KeyboardEvent) => this.#onTileKeydown(href, e) : nothing}\n >\n ${this.fileIcon\n ? html`\n <div class=\"tile-body\">\n <span class=\"tile-icon\" aria-hidden=\"true\">${iconDocument(14)}</span>\n <div class=\"tile-content\">${this.renderTile(item)}</div>\n </div>\n `\n : this.renderTile(item)}\n </div>\n `;\n },\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"tile-grid\": TileGrid;\n }\n}\n"]}
|
package/dist/tokens.css
CHANGED
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
--ui-overlay: rgb(15 23 42 / 0.45);
|
|
49
49
|
--ui-radius: 0.5rem;
|
|
50
50
|
--ui-radius-sm: 0.25rem;
|
|
51
|
+
--ui-border-width: 1px;
|
|
51
52
|
--ui-radius-pill: 9999px;
|
|
52
53
|
--ui-radius-circle: 50%;
|
|
53
54
|
--ui-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
@@ -68,10 +69,12 @@
|
|
|
68
69
|
--ui-line-height-normal: 1.5;
|
|
69
70
|
--ui-tracking-normal: 0;
|
|
70
71
|
--ui-tracking-wide: 0.04em;
|
|
72
|
+
--ui-label-transform: none;
|
|
73
|
+
--ui-numeric: normal;
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
@media (prefers-color-scheme: dark) {
|
|
74
|
-
:root:not([data-theme="light"]):not([data-theme="gradient"]):not([data-theme="metro"]) {
|
|
77
|
+
:root:not([data-theme="light"]):not([data-theme="gradient"]):not([data-theme="metro"]):not([data-theme="blueprint"]) {
|
|
75
78
|
color-scheme: dark;
|
|
76
79
|
--ui-primary: #6366f1;
|
|
77
80
|
--ui-primary-hover: #818cf8;
|
|
@@ -163,3 +166,41 @@
|
|
|
163
166
|
--ui-shadow: 0 0 0 1px rgb(15 23 42 / 0.12);
|
|
164
167
|
--ui-shadow-lg: 0 0 0 1px rgb(15 23 42 / 0.18);
|
|
165
168
|
}
|
|
169
|
+
|
|
170
|
+
:root[data-theme="blueprint"] {
|
|
171
|
+
color-scheme: light;
|
|
172
|
+
--ui-text: #17160f;
|
|
173
|
+
--ui-text-muted: #686763;
|
|
174
|
+
--ui-surface: #ffffff;
|
|
175
|
+
--ui-surface-muted: #f0f0f0;
|
|
176
|
+
--ui-border: #898883;
|
|
177
|
+
--ui-tooltip: #17160f;
|
|
178
|
+
--ui-overlay: rgb(23 22 15 / 0.45);
|
|
179
|
+
--ui-highlight: #dcdcff;
|
|
180
|
+
--ui-primary: #0000ff;
|
|
181
|
+
--ui-primary-hover: #0000cc;
|
|
182
|
+
--ui-info: #0000ff;
|
|
183
|
+
--ui-info-hover: #0000cc;
|
|
184
|
+
--ui-on-accent: #ffffff;
|
|
185
|
+
--ui-focus-ring: 0 0 0 2px #0000ff;
|
|
186
|
+
--ui-button-background: #17160f;
|
|
187
|
+
--ui-button-background-hover: #0000ff;
|
|
188
|
+
--ui-button-background-active: #0000cc;
|
|
189
|
+
--ui-button-border: #17160f;
|
|
190
|
+
--ui-button-danger-border: #b91c1c;
|
|
191
|
+
--ui-button-secondary-border: #17160f;
|
|
192
|
+
--ui-button-secondary-border-hover: #0000ff;
|
|
193
|
+
--ui-button-secondary-background-hover: #f0f0f0;
|
|
194
|
+
--ui-button-secondary-surface-muted: #f0f0f0;
|
|
195
|
+
--ui-button-accent: #0000ff;
|
|
196
|
+
--ui-radius: 0;
|
|
197
|
+
--ui-radius-sm: 0;
|
|
198
|
+
--ui-radius-pill: 0;
|
|
199
|
+
--ui-radius-circle: 0;
|
|
200
|
+
--ui-shadow: 0 0 0 1.5px rgb(23 22 15 / 0.24);
|
|
201
|
+
--ui-shadow-lg: 0 0 0 1.5px #17160f;
|
|
202
|
+
--ui-border-width: 1.5px;
|
|
203
|
+
--ui-label-transform: uppercase;
|
|
204
|
+
--ui-numeric: tabular-nums;
|
|
205
|
+
--ui-font: "Space Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
206
|
+
}
|
package/dist/tokens.d.ts
CHANGED
|
@@ -60,6 +60,56 @@ export declare const gradientTokenValues: Record<string, string>;
|
|
|
60
60
|
* that separation while removing the blur and the faked depth.
|
|
61
61
|
*/
|
|
62
62
|
export declare const metroTokenValues: Record<string, string>;
|
|
63
|
+
/**
|
|
64
|
+
* "Blueprint" theme overrides, applied via `data-theme="blueprint"` on `<html>`
|
|
65
|
+
* (see `generate-tokens-css.mjs`) — forces `color-scheme: light` like every
|
|
66
|
+
* other non-dark theme, and restyles the light palette as a technical catalog
|
|
67
|
+
* / spec sheet: warm near-black ink on white paper, one pure-blue accent,
|
|
68
|
+
* square corners, and structure carried entirely by hairline rules instead of
|
|
69
|
+
* shadows.
|
|
70
|
+
*
|
|
71
|
+
* It is the widest theme in the system, and the reason three token axes exist
|
|
72
|
+
* that no earlier theme needed:
|
|
73
|
+
*
|
|
74
|
+
* - `--ui-font` is retargeted to a monospace stack. `darkTokenValues` notes
|
|
75
|
+
* that shape and type tokens are theme-independent; `metro` already broke
|
|
76
|
+
* that for shape, and this breaks it for the type *family* only. Type
|
|
77
|
+
* *metrics* (size, weight, line height) remain unthemed in every theme —
|
|
78
|
+
* they encode hierarchy, which is not a stylistic choice. "Space Mono"
|
|
79
|
+
* leads the stack purely so a consumer who loads that webfont gets the
|
|
80
|
+
* reference face automatically; with no external CSS at all it falls
|
|
81
|
+
* straight through to the same system mono stack `--ui-font-mono` uses, so
|
|
82
|
+
* the theme still renders correctly on its own.
|
|
83
|
+
* - `--ui-border-width` goes to `1.5px`. Every border in this theme is doing
|
|
84
|
+
* the work a shadow does elsewhere, and at 1px those rules read as a faint
|
|
85
|
+
* table rather than as drawn structure.
|
|
86
|
+
* - `--ui-label-transform` goes to `uppercase`, which is what makes chrome
|
|
87
|
+
* micro-labels read as signage/spec-sheet keys. Only labels that name a
|
|
88
|
+
* region or column carry this — never user content.
|
|
89
|
+
* - `--ui-numeric` goes to `tabular-nums`, so figures line up in a column and
|
|
90
|
+
* do not jitter as they change.
|
|
91
|
+
*
|
|
92
|
+
* Buttons are deliberately NOT the accent color. `--ui-primary` stays pure
|
|
93
|
+
* blue because it drives accents everywhere else (active tab underlines,
|
|
94
|
+
* selected states, links, the certification-style tints), but the primary
|
|
95
|
+
* button fill is overridden to ink through the `--ui-button-*` hooks and only
|
|
96
|
+
* turns blue on hover — a black-on-white CTA that lights up is the
|
|
97
|
+
* catalog-print look, and a large pure-blue fill next to blue accents would
|
|
98
|
+
* flatten the two roles into one. That split is exactly what those hooks
|
|
99
|
+
* exist for (see `gradientTokenValues` above for the same technique).
|
|
100
|
+
*
|
|
101
|
+
* Semantic `danger`/`success`/`warning` keep their default hues: they encode
|
|
102
|
+
* meaning rather than style, and the reference's blue-only restraint is an
|
|
103
|
+
* editorial choice a component library cannot make on a consumer's behalf.
|
|
104
|
+
* `--ui-info` is the exception — it is "neutral notice", which in this theme
|
|
105
|
+
* is precisely the accent, and the default sky blue would otherwise sit a few
|
|
106
|
+
* degrees off the pure blue beside it and read as a mistake.
|
|
107
|
+
*
|
|
108
|
+
* Shadows flatten to a hard ink ring rather than to `none`, for the same
|
|
109
|
+
* reason `metro` does it: `slide-panel` has no border of its own and would
|
|
110
|
+
* otherwise lose its edge entirely.
|
|
111
|
+
*/
|
|
112
|
+
export declare const blueprintTokenValues: Record<string, string>;
|
|
63
113
|
/**
|
|
64
114
|
* Historically a shared `:host { --ui-x: var(--ui-x, fallback); } ` block,
|
|
65
115
|
* re-declaring every token on each component's own host element as a
|
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,
|
|
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
|
@@ -112,6 +112,19 @@ export const tokenValues = {
|
|
|
112
112
|
// Shape / depth
|
|
113
113
|
"--ui-radius": "0.5rem", // rounded-lg
|
|
114
114
|
"--ui-radius-sm": "0.25rem", // rounded
|
|
115
|
+
// The width of a themeable surface/control border. Spacing is deliberately
|
|
116
|
+
// untokenized, but a border is chrome rather than layout: the `blueprint`
|
|
117
|
+
// theme's whole structure is carried by hairline rules instead of shadows,
|
|
118
|
+
// and it needs those rules one step heavier than the default. Defaults to
|
|
119
|
+
// the literal 1px every component used before, so nothing renders
|
|
120
|
+
// differently until a theme overrides it. Only genuine surface/control
|
|
121
|
+
// borders read this — forced-colors `CanvasText` borders and purely
|
|
122
|
+
// decorative literals (a slider thumb's white ring, a tab's 2px underline)
|
|
123
|
+
// keep their own widths, since those aren't the theme's structural rules.
|
|
124
|
+
// Anything with a fixed height/width and a themeable border must also set
|
|
125
|
+
// `box-sizing: border-box`, or a heavier border grows it past the shared
|
|
126
|
+
// 2rem control target.
|
|
127
|
+
"--ui-border-width": "1px",
|
|
115
128
|
// Deliberate pill/circle shapes — a chip, an avatar, a slider thumb, a dot.
|
|
116
129
|
// Tokenized rather than hardcoded so a theme that squares the design system
|
|
117
130
|
// (metro) can reach them too; a literal 9999px/50% silently opts that shape
|
|
@@ -141,6 +154,21 @@ export const tokenValues = {
|
|
|
141
154
|
// Letter spacing / tracking — default and the single widened step.
|
|
142
155
|
"--ui-tracking-normal": "0",
|
|
143
156
|
"--ui-tracking-wide": "0.04em",
|
|
157
|
+
// Casing of chrome micro-labels — the small, wide-tracked labels that name a
|
|
158
|
+
// region rather than carry content (a `frame-box` legend, an `app-sidebar`
|
|
159
|
+
// section heading, a `stat-meter` caption). Defaults to `none`, today's
|
|
160
|
+
// sentence case, so nothing changes until a theme sets it; the `blueprint`
|
|
161
|
+
// theme sets `uppercase`, where signage-style labels are the point. Never
|
|
162
|
+
// apply this to user-supplied content — shouting someone's data is not a
|
|
163
|
+
// theme's decision, and `text-transform` is a presentational lie that
|
|
164
|
+
// survives copy/paste as the original casing anyway.
|
|
165
|
+
"--ui-label-transform": "none",
|
|
166
|
+
// Numeral rendering for figures that change in place or stack into a column
|
|
167
|
+
// — a score, a page number, a running clock. Defaults to `normal`
|
|
168
|
+
// (proportional, as before); `tabular-nums` stops digits from jittering
|
|
169
|
+
// horizontally as they tick, which the `blueprint` theme's spec-sheet
|
|
170
|
+
// aesthetic wants everywhere.
|
|
171
|
+
"--ui-numeric": "normal",
|
|
144
172
|
};
|
|
145
173
|
/**
|
|
146
174
|
* Dark-mode overrides for the same `--ui-*` custom properties, applied by
|
|
@@ -270,6 +298,114 @@ export const metroTokenValues = {
|
|
|
270
298
|
"--ui-shadow": "0 0 0 1px rgb(15 23 42 / 0.12)",
|
|
271
299
|
"--ui-shadow-lg": "0 0 0 1px rgb(15 23 42 / 0.18)",
|
|
272
300
|
};
|
|
301
|
+
/**
|
|
302
|
+
* "Blueprint" theme overrides, applied via `data-theme="blueprint"` on `<html>`
|
|
303
|
+
* (see `generate-tokens-css.mjs`) — forces `color-scheme: light` like every
|
|
304
|
+
* other non-dark theme, and restyles the light palette as a technical catalog
|
|
305
|
+
* / spec sheet: warm near-black ink on white paper, one pure-blue accent,
|
|
306
|
+
* square corners, and structure carried entirely by hairline rules instead of
|
|
307
|
+
* shadows.
|
|
308
|
+
*
|
|
309
|
+
* It is the widest theme in the system, and the reason three token axes exist
|
|
310
|
+
* that no earlier theme needed:
|
|
311
|
+
*
|
|
312
|
+
* - `--ui-font` is retargeted to a monospace stack. `darkTokenValues` notes
|
|
313
|
+
* that shape and type tokens are theme-independent; `metro` already broke
|
|
314
|
+
* that for shape, and this breaks it for the type *family* only. Type
|
|
315
|
+
* *metrics* (size, weight, line height) remain unthemed in every theme —
|
|
316
|
+
* they encode hierarchy, which is not a stylistic choice. "Space Mono"
|
|
317
|
+
* leads the stack purely so a consumer who loads that webfont gets the
|
|
318
|
+
* reference face automatically; with no external CSS at all it falls
|
|
319
|
+
* straight through to the same system mono stack `--ui-font-mono` uses, so
|
|
320
|
+
* the theme still renders correctly on its own.
|
|
321
|
+
* - `--ui-border-width` goes to `1.5px`. Every border in this theme is doing
|
|
322
|
+
* the work a shadow does elsewhere, and at 1px those rules read as a faint
|
|
323
|
+
* table rather than as drawn structure.
|
|
324
|
+
* - `--ui-label-transform` goes to `uppercase`, which is what makes chrome
|
|
325
|
+
* micro-labels read as signage/spec-sheet keys. Only labels that name a
|
|
326
|
+
* region or column carry this — never user content.
|
|
327
|
+
* - `--ui-numeric` goes to `tabular-nums`, so figures line up in a column and
|
|
328
|
+
* do not jitter as they change.
|
|
329
|
+
*
|
|
330
|
+
* Buttons are deliberately NOT the accent color. `--ui-primary` stays pure
|
|
331
|
+
* blue because it drives accents everywhere else (active tab underlines,
|
|
332
|
+
* selected states, links, the certification-style tints), but the primary
|
|
333
|
+
* button fill is overridden to ink through the `--ui-button-*` hooks and only
|
|
334
|
+
* turns blue on hover — a black-on-white CTA that lights up is the
|
|
335
|
+
* catalog-print look, and a large pure-blue fill next to blue accents would
|
|
336
|
+
* flatten the two roles into one. That split is exactly what those hooks
|
|
337
|
+
* exist for (see `gradientTokenValues` above for the same technique).
|
|
338
|
+
*
|
|
339
|
+
* Semantic `danger`/`success`/`warning` keep their default hues: they encode
|
|
340
|
+
* meaning rather than style, and the reference's blue-only restraint is an
|
|
341
|
+
* editorial choice a component library cannot make on a consumer's behalf.
|
|
342
|
+
* `--ui-info` is the exception — it is "neutral notice", which in this theme
|
|
343
|
+
* is precisely the accent, and the default sky blue would otherwise sit a few
|
|
344
|
+
* degrees off the pure blue beside it and read as a mistake.
|
|
345
|
+
*
|
|
346
|
+
* Shadows flatten to a hard ink ring rather than to `none`, for the same
|
|
347
|
+
* reason `metro` does it: `slide-panel` has no border of its own and would
|
|
348
|
+
* otherwise lose its edge entirely.
|
|
349
|
+
*/
|
|
350
|
+
export const blueprintTokenValues = {
|
|
351
|
+
// Ink over paper. --ui-text-muted is the same ink at ~65% over white rather
|
|
352
|
+
// than a neutral gray, so the quiet text stays in the same warm family
|
|
353
|
+
// instead of turning blue-gray beside the accent.
|
|
354
|
+
"--ui-text": "#17160f",
|
|
355
|
+
"--ui-text-muted": "#686763",
|
|
356
|
+
"--ui-surface": "#ffffff",
|
|
357
|
+
"--ui-surface-muted": "#f0f0f0",
|
|
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",
|
|
366
|
+
"--ui-tooltip": "#17160f",
|
|
367
|
+
"--ui-overlay": "rgb(23 22 15 / 0.45)",
|
|
368
|
+
// The "just changed" flash tints toward the accent instead of amber, which
|
|
369
|
+
// is the one warm hue this palette has no room for.
|
|
370
|
+
"--ui-highlight": "#dcdcff",
|
|
371
|
+
"--ui-primary": "#0000ff",
|
|
372
|
+
"--ui-primary-hover": "#0000cc",
|
|
373
|
+
"--ui-info": "#0000ff",
|
|
374
|
+
"--ui-info-hover": "#0000cc",
|
|
375
|
+
"--ui-on-accent": "#ffffff",
|
|
376
|
+
// Solid and crisp at the reference's own 2px, not the default translucent
|
|
377
|
+
// 3px halo — a blurred ring is the one soft edge this theme has nowhere to
|
|
378
|
+
// put.
|
|
379
|
+
"--ui-focus-ring": "0 0 0 2px #0000ff",
|
|
380
|
+
// Ink CTA that lights up blue on hover, and inverts its two stops while
|
|
381
|
+
// pressed. The border is ink at every state so the button keeps a defining
|
|
382
|
+
// edge even once the fill goes blue.
|
|
383
|
+
"--ui-button-background": "#17160f",
|
|
384
|
+
"--ui-button-background-hover": "#0000ff",
|
|
385
|
+
"--ui-button-background-active": "#0000cc",
|
|
386
|
+
"--ui-button-border": "#17160f",
|
|
387
|
+
"--ui-button-danger-border": "#b91c1c",
|
|
388
|
+
// Secondary is the reference's ghost button: no fill, ink border, a paper
|
|
389
|
+
// wash on hover and an accent border to echo the primary's hover.
|
|
390
|
+
"--ui-button-secondary-border": "#17160f",
|
|
391
|
+
"--ui-button-secondary-border-hover": "#0000ff",
|
|
392
|
+
"--ui-button-secondary-background-hover": "#f0f0f0",
|
|
393
|
+
"--ui-button-secondary-surface-muted": "#f0f0f0",
|
|
394
|
+
// Non-button accents that can only take a plain color (a native input's
|
|
395
|
+
// accent-color, range-slider's track/thumb) follow --ui-primary, not the
|
|
396
|
+
// ink button fill — those are selection marks, not calls to action.
|
|
397
|
+
"--ui-button-accent": "#0000ff",
|
|
398
|
+
"--ui-radius": "0",
|
|
399
|
+
"--ui-radius-sm": "0",
|
|
400
|
+
"--ui-radius-pill": "0",
|
|
401
|
+
"--ui-radius-circle": "0",
|
|
402
|
+
"--ui-shadow": "0 0 0 1.5px rgb(23 22 15 / 0.24)",
|
|
403
|
+
"--ui-shadow-lg": "0 0 0 1.5px #17160f",
|
|
404
|
+
"--ui-border-width": "1.5px",
|
|
405
|
+
"--ui-label-transform": "uppercase",
|
|
406
|
+
"--ui-numeric": "tabular-nums",
|
|
407
|
+
"--ui-font": '"Space Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',
|
|
408
|
+
};
|
|
273
409
|
/**
|
|
274
410
|
* Historically a shared `:host { --ui-x: var(--ui-x, fallback); } ` block,
|
|
275
411
|
* re-declaring every token on each component's own host element as a
|