@unframed/cli 0.6.1 → 0.7.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unframed/cli",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "Copy Unframed web components into your project, and own the code.",
5
5
  "license": "MIT",
6
6
  "author": "Patrizio Di Bartolomeo",
package/registry.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.1",
2
+ "version": "0.7.0",
3
3
  "components": {
4
4
  "accordion": {
5
5
  "name": "accordion",
@@ -565,11 +565,11 @@
565
565
  "components/select/select.ts": "import { css, html, nothing, type PropertyDeclarations, type PropertyValues } from 'lit';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { defineElement } from '../../internal/define.js';\nimport { controlBoxStyles, describedBy, fieldStyles, renderField, type FieldSize } from '../../internal/field.js';\nimport { FormControl } from '../../internal/form-control.js';\nimport { iconSvg, icons } from '../../internal/icons.js';\nimport { hostStyles } from '../../internal/shared.styles.js';\nimport { HasSlotController, uniqueId } from '../../internal/slot.js';\nimport { flattenOptions, readItems, type Item, type OptionItem } from '../../internal/options.js';\n\n/**\n * A dropdown built on the native `<select>`, so it gets the platform's\n * keyboard support, screen reader support and mobile pickers for free.\n * Write options as plain `<option>` and `<optgroup>` children.\n *\n * @summary Lets users pick one option from a dropdown list.\n * @tag uf-select\n *\n * @slot - `<option>` and `<optgroup>` elements. They are mirrored into the native select.\n * @slot label - The label, when you need markup. Overrides `label`.\n * @slot hint - Help text below the field. Overrides `hint`.\n * @slot prefix - An icon before the selected value.\n *\n * @event input - Fired when the selection changes.\n * @event change - Fired when the selection changes.\n *\n * @csspart field - The wrapper around label, control, hint and error.\n * @csspart form-label - The label.\n * @csspart box - The bordered box.\n * @csspart select - The native `<select>`.\n * @csspart chevron - The dropdown arrow.\n * @csspart hint - The hint text.\n * @csspart error - The validation message.\n *\n * @cssprop --uf-field-bg - Background of the box.\n * @cssprop --uf-field-border-color - Border color of the box.\n * @cssprop --uf-field-radius - Corner radius of the box.\n *\n * @cssstate user-invalid - The value is invalid and the user has interacted with the field.\n */\nexport class UfSelect extends FormControl {\n static override styles = [\n hostStyles,\n fieldStyles,\n controlBoxStyles,\n css`\n .box {\n position: relative;\n padding-inline-end: 0;\n }\n\n .native {\n appearance: none;\n min-height: calc(var(--_height) - 2px);\n padding-inline-end: calc(var(--_padding) + 1.25em);\n cursor: pointer;\n }\n\n .native:invalid,\n .native.placeholder {\n color: var(--uf-color-text-muted);\n }\n\n .native option {\n color: var(--uf-color-text);\n background: var(--uf-color-surface-overlay);\n }\n\n .icon {\n position: absolute;\n inset-inline-end: var(--_padding);\n width: 1em;\n height: 1em;\n color: var(--uf-color-text-muted);\n pointer-events: none;\n }\n `,\n ];\n\n static override properties: PropertyDeclarations = {\n value: { attribute: false },\n defaultValue: { attribute: 'value' },\n label: {},\n hint: {},\n placeholder: {},\n size: { reflect: true },\n autocomplete: {},\n };\n\n /** The selected option's value. */\n declare value: string;\n /** Initially selected value, restored on form reset. Set with the `value` attribute. */\n declare defaultValue: string | undefined;\n /** Visible label. */\n declare label: string | undefined;\n /** Help text below the field. */\n declare hint: string | undefined;\n /** Text shown while nothing is selected. */\n declare placeholder: string | undefined;\n /** Size of the field. */\n declare size: FieldSize;\n /** Native `autocomplete` hint. */\n declare autocomplete: AutoFill | undefined;\n\n readonly #slots = new HasSlotController(this, 'label', 'hint');\n readonly #id = uniqueId('uf-select');\n readonly #observer = new MutationObserver(() => this.#readItems());\n #items: Item[] = [];\n #itemsChanged = false;\n #hasInitialized = false;\n\n constructor() {\n super();\n this.value = '';\n this.size = 'md';\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.#readItems();\n this.#observer.observe(this, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#observer.disconnect();\n }\n\n get #select(): HTMLSelectElement | null {\n return this.renderRoot.querySelector('select');\n }\n\n get #options(): OptionItem[] {\n return flattenOptions(this.#items);\n }\n\n /** Mirrors the light-DOM options into the native select. */\n #readItems(): void {\n this.#items = readItems(this);\n this.#itemsChanged = true;\n this.requestUpdate();\n }\n\n /** The value a reset returns to: the `value` attribute, a `selected` option, or the native default. */\n #initialValue(): string {\n if (this.defaultValue !== undefined && this.defaultValue !== null) return this.defaultValue;\n const options = this.#options;\n const selected = options.find((o) => o.selected);\n if (selected) return selected.value;\n if (this.placeholder) return '';\n return options.find((o) => !o.disabled)?.value ?? '';\n }\n\n override willUpdate(changed: PropertyValues<this>): void {\n const defaultChanged = changed.has('defaultValue') || changed.has('placeholder') || this.#itemsChanged;\n if (!defaultChanged) return;\n this.#itemsChanged = false;\n // Frameworks often connect the element before appending its options: wait for them.\n if (!this.#items.length) return;\n const valid = this.#options.some((o) => o.value === this.value);\n if (!this.#hasInitialized) {\n // A value set before the options were read (e.g. by a framework) wins if it exists.\n if (!(this.value && valid)) this.value = this.#initialValue();\n this.#hasInitialized = true;\n } else if (!valid) {\n this.value = this.#initialValue();\n }\n }\n\n override updated(): void {\n this.syncFormState();\n }\n\n protected syncFormState(): void {\n const select = this.#select;\n if (!select) return;\n this.internals.setFormValue(this.value);\n this.setValidityFrom(select);\n }\n\n protected resetValue(): void {\n this.value = this.#initialValue();\n }\n\n /** @internal */\n formStateRestoreCallback(state: string | null): void {\n this.value = state ?? '';\n }\n\n #onChange = (event: Event): void => {\n this.value = (event.target as HTMLSelectElement).value;\n this.markInteracted();\n this.emitChange();\n };\n\n #renderOption(option: OptionItem) {\n return html`<option value=${option.value} ?disabled=${option.disabled} ?selected=${option.value === this.value}>\n ${option.label}\n </option>`;\n }\n\n override render() {\n const ids = { hintId: `${this.#id}-hint`, errorId: `${this.#id}-error` };\n const error = this.showInvalid ? this.validationMessage : '';\n const hasHintSlot = this.#slots.has('hint');\n const showingPlaceholder = Boolean(this.placeholder) && !this.value;\n\n return renderField({\n ...ids,\n controlId: this.#id,\n label: this.label,\n hasLabelSlot: this.#slots.has('label'),\n hint: this.hint,\n hasHintSlot,\n error,\n required: this.required,\n control: html`\n <div class=${classMap({ box: true, disabled: this.isDisabled })} part=\"box\">\n <slot name=\"prefix\"></slot>\n <select\n id=${this.#id}\n class=${classMap({ native: true, placeholder: showingPlaceholder })}\n part=\"select\"\n name=${ifDefined(this.name || undefined)}\n autocomplete=${ifDefined(this.autocomplete)}\n .value=${live(this.value)}\n ?required=${this.required}\n ?disabled=${this.isDisabled}\n aria-invalid=${error ? 'true' : 'false'}\n aria-describedby=${ifDefined(describedBy({ ...ids, hint: this.hint, hasHintSlot, error }))}\n @change=${this.#onChange}\n >\n ${this.placeholder\n ? html`<option value=\"\" disabled hidden ?selected=${!this.value}>${this.placeholder}</option>`\n : nothing}\n ${this.#items.map((item) =>\n item.kind === 'group'\n ? html`<optgroup label=${item.label} ?disabled=${item.disabled}>\n ${item.options.map((o) => this.#renderOption(o))}\n </optgroup>`\n : this.#renderOption(item),\n )}\n </select>\n ${iconSvg(icons['chevron-down'], 'chevron')}\n </div>\n `,\n });\n }\n}\n\ndefineElement('uf-select', UfSelect);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'uf-select': UfSelect;\n }\n}\n",
566
566
  "components/switch/switch.ts": "import { css, html, type PropertyDeclarations } from 'lit';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { defineElement } from '../../internal/define.js';\nimport { describedBy } from '../../internal/field.js';\nimport { hostStyles } from '../../internal/shared.styles.js';\nimport { HasSlotController, uniqueId } from '../../internal/slot.js';\nimport { ToggleControl } from '../../internal/toggle-control.js';\nimport { toggleStyles } from '../../internal/toggle.styles.js';\n\n/**\n * An on/off switch with its label as content. Use it for settings that apply\n * immediately; use a checkbox for choices submitted later with a form.\n *\n * @summary Turns a setting on or off.\n * @tag uf-switch\n *\n * @slot - The label.\n * @slot hint - Help text below the label. Overrides `hint`.\n *\n * @event input - Fired when the state changes.\n * @event change - Fired when the state changes.\n *\n * @csspart base - The `<label>` wrapping control and label.\n * @csspart control - The track.\n * @csspart thumb - The moving knob.\n * @csspart label - The label text.\n * @csspart hint - The hint text.\n * @csspart error - The validation message.\n *\n * @cssprop --uf-switch-width - Width of the track.\n * @cssprop --uf-switch-height - Height of the track.\n * @cssprop --uf-switch-checked-bg - Track color when on.\n * @cssprop --uf-switch-radius - Corner radius of track and thumb. Use `999px` for a pill.\n *\n * @cssstate checked - The switch is on.\n * @cssstate user-invalid - Required but off, after the user interacted.\n */\nexport class UfSwitch extends ToggleControl {\n static override styles = [\n hostStyles,\n toggleStyles,\n css`\n :host {\n --_control-width: var(--uf-switch-width, 2.25rem);\n --_control-height: var(--uf-switch-height, 1.25rem);\n --_thumb: calc(var(--_control-height) - 4px);\n }\n\n .native {\n width: var(--_control-width);\n height: var(--_control-height);\n border-radius: var(--uf-switch-radius, var(--uf-radius-control));\n background: var(--uf-color-border-strong);\n }\n\n .native:checked {\n background: var(--uf-switch-checked-bg, var(--uf-color-accent));\n }\n\n .disabled .native {\n background: var(--uf-color-neutral-fill);\n box-shadow: inset 0 0 0 1px var(--uf-color-border);\n }\n\n .disabled .native:checked {\n background: var(--uf-color-text-muted);\n box-shadow: none;\n }\n\n .disabled .thumb {\n background: var(--uf-color-border-strong);\n box-shadow: none;\n }\n\n .disabled .native:checked + .thumb {\n background: var(--uf-color-surface);\n }\n\n .invalid .native {\n box-shadow: 0 0 0 2px var(--uf-color-danger-text);\n }\n\n .thumb {\n position: absolute;\n top: 2px;\n left: 2px;\n width: var(--_thumb);\n height: var(--_thumb);\n border-radius: var(--uf-switch-radius, var(--uf-radius-control));\n background: var(--uf-palette-neutral-0);\n box-shadow: var(--uf-shadow-sm);\n pointer-events: none;\n transition: translate var(--uf-duration-base) ease;\n }\n\n .native:checked + .thumb {\n translate: calc(var(--_control-width) - var(--_thumb) - 4px) 0;\n }\n\n @media (prefers-reduced-motion: reduce) {\n .thumb {\n transition: none;\n }\n }\n `,\n ];\n\n static override properties: PropertyDeclarations = {\n hint: {},\n };\n\n /** Help text below the label. */\n declare hint: string | undefined;\n\n readonly #slots = new HasSlotController(this, 'hint');\n readonly #id = uniqueId('uf-switch');\n\n override render() {\n const ids = { hintId: `${this.#id}-hint`, errorId: `${this.#id}-error` };\n const error = this.showInvalid ? this.validationMessage : '';\n const hasHintSlot = this.#slots.has('hint');\n const disabled = this.isDisabled;\n\n return html`\n <label class=${classMap({ root: true, disabled, invalid: Boolean(error) })} part=\"base\">\n <span class=\"control\" part=\"control\">\n <input\n class=\"native\"\n type=\"checkbox\"\n role=\"switch\"\n name=${ifDefined(this.name || undefined)}\n .value=${this.value}\n .checked=${live(this.checked)}\n ?required=${this.required}\n ?disabled=${disabled}\n aria-invalid=${error ? 'true' : 'false'}\n aria-describedby=${ifDefined(describedBy({ ...ids, hint: this.hint, hasHintSlot, error }))}\n @change=${this.onNativeChange}\n />\n <span class=\"thumb\" part=\"thumb\"></span>\n </span>\n <span class=\"label\" part=\"label\"><slot></slot></span>\n </label>\n <div id=${ids.hintId} class=\"hint\" part=\"hint\" ?hidden=${!this.hint && !hasHintSlot}>\n <slot name=\"hint\">${this.hint}</slot>\n </div>\n <div id=${ids.errorId} class=\"error\" part=\"error\" ?hidden=${!error}>${error}</div>\n `;\n }\n}\n\ndefineElement('uf-switch', UfSwitch);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'uf-switch': UfSwitch;\n }\n}\n",
567
567
  "components/table/table.ts": "import { LitElement, css, html, nothing, type PropertyDeclarations, type PropertyValues } from 'lit';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { defineElement } from '../../internal/define.js';\nimport { Translator } from '../../internal/i18n.js';\nimport { iconSvg, icons } from '../../internal/icons.js';\nimport { focusRing, hostStyles } from '../../internal/shared.styles.js';\n\n/** A row of data: column keys to values. */\nexport type TableRow = Record<string, unknown>;\nexport type SortDirection = 'ascending' | 'descending';\nexport type TableDensity = 'comfortable' | 'compact';\n\nexport interface TableColumn<Row extends TableRow = TableRow> {\n /** The row property this column shows, and its id for sorting. */\n key: string;\n /** Header text. */\n label: string;\n /** Lets the user sort by this column. */\n sortable?: boolean;\n /** Text alignment. Use `end` for numbers. Defaults to `start`. */\n align?: 'start' | 'center' | 'end';\n /** Column width, as CSS: `8rem`, `20%`. */\n width?: string;\n /** Cell content from the value: text, or a DOM node such as a badge. Defaults to the value as text. */\n format?: (value: unknown, row: Row) => string | number | Node | null | undefined;\n /** Sort order for two rows, like `Array.prototype.sort`. Defaults to comparing the values. */\n compare?: (a: Row, b: Row) => number;\n}\n\nexport interface TableSortDetail {\n /** Key of the sorted column. */\n key: string;\n direction: SortDirection;\n}\n\nconst collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });\n\n/** Numbers and dates by value, everything else as text; empty values last. */\nfunction compareValues(a: unknown, b: unknown): number {\n const empty = (v: unknown) => v === null || v === undefined || v === '';\n if (empty(a) || empty(b)) return Number(empty(a)) - Number(empty(b));\n if (typeof a === 'number' && typeof b === 'number') return a - b;\n if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();\n return collator.compare(String(a), String(b));\n}\n\n/**\n * A table of data, from `columns` and `rows`. Users can sort by the columns\n * marked `sortable`. Rendered as a native `<table>`, so assistive tech reads\n * headers and cells as usual.\n *\n * Set `columns` and `rows` as properties, or as JSON attributes in plain HTML.\n * The table sorts `rows` itself; with `manual-sort` it only shows the order\n * and tells you, so you can sort on the server. Combine it with\n * `<uf-pagination>` for long lists.\n *\n * @summary Shows data in rows and columns, with sorting.\n * @tag uf-table\n *\n * @slot empty - Shown when there are no rows. Defaults to \"No data\", or its translation.\n *\n * @event {CustomEvent<TableSortDetail>} uf-sort - The user sorted by a column.\n *\n * @csspart base - The scroll container around the table.\n * @csspart table - The `<table>`.\n * @csspart header-cell - Every header cell (`<th>`).\n * @csspart sort-button - The button in a sortable header.\n * @csspart row - Every body row.\n * @csspart cell - Every body cell.\n * @csspart empty - The cell shown when there are no rows.\n *\n * @cssprop --uf-table-max-height - Height after which the body scrolls under a sticky header.\n * @cssprop --uf-table-border-color - Border color between rows.\n * @cssprop --uf-table-header-bg - Background of the header row.\n * @cssprop --uf-table-stripe-bg - Background of every other row, with `striped`.\n * @cssprop --uf-table-hover-bg - Background of the row under the pointer.\n */\nexport class UfTable extends LitElement {\n static override styles = [\n hostStyles,\n css`\n :host {\n display: block;\n --_pad-y: var(--uf-space-3);\n --_pad-x: var(--uf-space-4);\n --_border: var(--uf-table-border-color, var(--uf-color-border));\n }\n\n :host([density='compact']) {\n --_pad-y: var(--uf-space-1);\n --_pad-x: var(--uf-space-3);\n }\n\n .base {\n max-height: var(--uf-table-max-height, none);\n overflow: auto;\n border: 1px solid var(--_border);\n border-radius: var(--uf-radius-md);\n }\n\n .base:focus-visible {\n ${focusRing}\n }\n\n table {\n width: 100%;\n border-collapse: separate;\n border-spacing: 0;\n color: var(--uf-color-text);\n font-family: var(--uf-font-family-sans);\n font-size: var(--uf-font-size-sm);\n font-variant-numeric: tabular-nums;\n }\n\n th,\n td {\n padding: var(--_pad-y) var(--_pad-x);\n border-bottom: 1px solid var(--_border);\n text-align: start;\n vertical-align: middle;\n }\n\n tbody tr:last-child td {\n border-bottom: 0;\n }\n\n th {\n position: sticky;\n top: 0;\n z-index: 1;\n background: var(--uf-table-header-bg, var(--uf-color-surface-raised));\n color: var(--uf-color-text-muted);\n font-weight: var(--uf-font-weight-semibold);\n white-space: nowrap;\n }\n\n .align-center {\n text-align: center;\n }\n .align-end {\n text-align: end;\n }\n\n .sort {\n display: inline-flex;\n align-items: center;\n gap: var(--uf-space-1);\n margin: calc(var(--uf-space-1) * -1) calc(var(--uf-space-2) * -1);\n padding: var(--uf-space-1) var(--uf-space-2);\n border: 0;\n border-radius: var(--uf-radius-sm);\n background: none;\n color: inherit;\n font: inherit;\n cursor: pointer;\n }\n\n .sort:hover {\n color: var(--uf-color-text);\n }\n\n .sort:focus-visible {\n ${focusRing}\n }\n\n .sort svg {\n width: 1em;\n height: 1em;\n opacity: 0;\n }\n\n /* A hint on hover and focus, solid when sorted. */\n .sort:hover svg,\n .sort:focus-visible svg {\n opacity: 0.5;\n }\n [aria-sort] .sort {\n color: var(--uf-color-text);\n }\n [aria-sort] .sort svg {\n opacity: 1;\n }\n\n :host([striped]) tbody tr:nth-child(even) td {\n background: var(--uf-table-stripe-bg, var(--uf-color-surface-hover));\n }\n\n tbody tr:hover td {\n background: var(--uf-table-hover-bg, var(--uf-color-accent-tint));\n }\n\n .empty {\n padding: var(--uf-space-6) var(--_pad-x);\n color: var(--uf-color-text-muted);\n text-align: center;\n }\n\n tbody tr.empty-row:hover td {\n background: none;\n }\n `,\n ];\n\n static override properties: PropertyDeclarations = {\n columns: { type: Array },\n rows: { type: Array },\n label: {},\n sortKey: { attribute: 'sort-key', reflect: true },\n sortDirection: { attribute: 'sort-direction', reflect: true },\n manualSort: { type: Boolean, attribute: 'manual-sort' },\n rowKey: { attribute: 'row-key' },\n striped: { type: Boolean, reflect: true },\n density: { reflect: true },\n };\n\n /** The columns, in order. As an attribute, JSON: `[{\"key\": \"name\", \"label\": \"Name\"}]`. */\n declare columns: TableColumn[];\n /** The data, one object per row. As an attribute, JSON: `[{\"name\": \"John\"}]`. */\n declare rows: TableRow[];\n /** Accessible name of the table, e.g. \"Invoices\". */\n declare label: string | undefined;\n /** Key of the column the rows are sorted by. */\n declare sortKey: string | undefined;\n /** Sort order: `ascending` or `descending`. */\n declare sortDirection: SortDirection;\n /** Doesn't sort the rows: only shows the sort and fires `uf-sort`, for sorting on the server. */\n declare manualSort: boolean;\n /** Row property that identifies each row, so rows keep their DOM when the data changes. Defaults to the index. */\n declare rowKey: string | undefined;\n /** Shades every other row. */\n declare striped: boolean;\n /** Row spacing: `comfortable` or `compact`. */\n declare density: TableDensity;\n\n /** The table overflows its container, so it scrolls. */\n #scrollable = false;\n\n readonly #translator = new Translator(this);\n readonly #resizeObserver = new ResizeObserver(() => this.#checkScrollable());\n\n constructor() {\n super();\n this.columns = [];\n this.rows = [];\n this.sortDirection = 'ascending';\n this.manualSort = false;\n this.striped = false;\n this.density = 'comfortable';\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#resizeObserver.disconnect();\n }\n\n override firstUpdated(): void {\n const base = this.renderRoot.querySelector('.base')!;\n this.#resizeObserver.observe(base);\n this.#resizeObserver.observe(this.renderRoot.querySelector('table')!);\n }\n\n override updated(changed: PropertyValues<this>): void {\n if (changed.has('rows') || changed.has('columns')) this.#checkScrollable();\n }\n\n /** A scrolling table must be reachable by keyboard, to scroll it. */\n #checkScrollable(): void {\n const base = this.renderRoot.querySelector('.base');\n if (!base) return;\n const scrollable = base.scrollWidth > base.clientWidth || base.scrollHeight > base.clientHeight;\n if (scrollable === this.#scrollable) return;\n this.#scrollable = scrollable;\n this.requestUpdate();\n }\n\n /** The rows in display order. */\n get #sortedRows(): TableRow[] {\n const rows = Array.isArray(this.rows) ? this.rows : [];\n const column = this.columns.find((c) => c.key === this.sortKey);\n if (!column || this.manualSort) return rows;\n const compare = column.compare ?? ((a: TableRow, b: TableRow) => compareValues(a[column.key], b[column.key]));\n const sign = this.sortDirection === 'descending' ? -1 : 1;\n // Stable: equal rows keep their order.\n return [...rows].sort((a, b) => sign * compare(a, b));\n }\n\n #sortBy(column: TableColumn): void {\n const direction: SortDirection = this.sortKey === column.key && this.sortDirection === 'ascending' ? 'descending' : 'ascending';\n this.sortKey = column.key;\n this.sortDirection = direction;\n this.dispatchEvent(\n new CustomEvent<TableSortDetail>('uf-sort', { bubbles: true, composed: true, detail: { key: column.key, direction } }),\n );\n }\n\n #renderHeader(column: TableColumn) {\n const sorted = column.key === this.sortKey;\n const align = { [`align-${column.align ?? 'start'}`]: true };\n return html`<th\n scope=\"col\"\n part=\"header-cell\"\n class=${classMap(align)}\n style=${styleMap({ width: column.width })}\n aria-sort=${sorted && column.sortable ? this.sortDirection : nothing}\n >\n ${column.sortable\n ? html`<button class=\"sort\" part=\"sort-button\" type=\"button\" @click=${() => this.#sortBy(column)}>\n ${column.label}${iconSvg(sorted && this.sortDirection === 'descending' ? icons['chevron-down'] : icons['chevron-up'])}\n </button>`\n : column.label}\n </th>`;\n }\n\n #renderCell(column: TableColumn, row: TableRow) {\n const value = row[column.key];\n const content = column.format ? column.format(value, row) : value;\n return html`<td part=\"cell\" class=${classMap({ [`align-${column.align ?? 'start'}`]: true })}>\n ${content === null || content === undefined ? '' : content instanceof Node ? content : String(content)}\n </td>`;\n }\n\n override render() {\n const columns = Array.isArray(this.columns) ? this.columns : [];\n const rows = this.#sortedRows;\n return html`<div\n class=\"base\"\n part=\"base\"\n tabindex=${this.#scrollable ? '0' : nothing}\n role=${this.#scrollable ? 'region' : nothing}\n aria-label=${this.#scrollable && this.label ? this.label : nothing}\n >\n <table part=\"table\" aria-label=${this.label ?? nothing}>\n <thead>\n <tr>\n ${columns.map((column) => this.#renderHeader(column))}\n </tr>\n </thead>\n <tbody>\n ${rows.length\n ? repeat(\n rows,\n (row, index) => (this.rowKey ? row[this.rowKey] : index),\n (row) => html`<tr part=\"row\">${columns.map((column) => this.#renderCell(column, row))}</tr>`,\n )\n : html`<tr class=\"empty-row\">\n <td class=\"empty\" part=\"empty\" colspan=${Math.max(1, columns.length)}><slot name=\"empty\">${this.#translator.t('noData')}</slot></td>\n </tr>`}\n </tbody>\n </table>\n </div>`;\n }\n}\n\ndefineElement('uf-table', UfTable);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'uf-table': UfTable;\n }\n}\n",
568
- "components/tabs/tabs.ts": "import { LitElement, css, html, type PropertyDeclarations } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { defineElement } from '../../internal/define.js';\nimport { uniqueId } from '../../internal/slot.js';\nimport './tab.js';\nimport type { UfTab, UfTabPanel } from './tab.js';\n\nexport { UfTab, UfTabPanel } from './tab.js';\n\nexport interface TabChangeDetail {\n name: string;\n}\n\n/**\n * Tabs that switch between panels. Arrow keys move between tabs, Home and End\n * jump to the ends, and only the selected tab is in the tab order.\n *\n * @summary Organizes content into panels, one visible at a time.\n * @tag uf-tabs\n *\n * @slot - `<uf-tab>` and `<uf-tab-panel>` elements. Tabs are moved into the tab list automatically.\n * @slot nav - The tab list. You don't need to set this yourself.\n *\n * @event {CustomEvent<TabChangeDetail>} uf-tab-change - The selected tab changed.\n *\n * @csspart tablist - The element with `role=\"tablist\"`.\n * @csspart panels - The wrapper around the panels.\n *\n * @cssprop --uf-tabs-indicator-color - Color of the selected tab's underline.\n */\nexport class UfTabs extends LitElement {\n static override styles = css`\n :host {\n display: block;\n }\n\n .tablist {\n display: flex;\n gap: var(--uf-space-1);\n border-bottom: 1px solid var(--uf-color-border);\n overflow-x: auto;\n scrollbar-width: none;\n }\n\n :host([orientation='vertical']) {\n display: flex;\n gap: var(--uf-space-4);\n }\n\n :host([orientation='vertical']) .tablist {\n flex-direction: column;\n border-bottom: 0;\n border-inline-end: 1px solid var(--uf-color-border);\n overflow: visible;\n }\n\n .panels {\n flex: 1;\n min-width: 0;\n }\n `;\n\n static override properties: PropertyDeclarations = {\n active: { reflect: true },\n activation: { reflect: true },\n orientation: { reflect: true },\n label: {},\n };\n\n /** Name of the selected panel. Defaults to the first enabled tab. */\n declare active: string;\n /** `auto` selects a tab as soon as it gets focus; `manual` waits for Enter or Space. */\n declare activation: 'auto' | 'manual';\n /** Lays the tab list out horizontally or vertically. */\n declare orientation: 'horizontal' | 'vertical';\n /** Accessible name for the tab list. */\n declare label: string | undefined;\n\n readonly #id = uniqueId('uf-tabs');\n\n constructor() {\n super();\n this.active = '';\n this.activation = 'auto';\n this.orientation = 'horizontal';\n this.addEventListener('click', this.#onClick);\n this.addEventListener('keydown', this.#onKeyDown);\n }\n\n get #tabs(): UfTab[] {\n return [...this.querySelectorAll<UfTab>(':scope > uf-tab')];\n }\n\n get #panels(): UfTabPanel[] {\n return [...this.querySelectorAll<UfTabPanel>(':scope > uf-tab-panel')];\n }\n\n /** Selects the tab for the given panel name. */\n select(name: string): void {\n const tab = this.#tabs.find((t) => t.panel === name);\n if (tab && !tab.disabled) this.#activate(tab);\n }\n\n override updated(): void {\n this.#sync();\n }\n\n /** Wires up roles, ids and visibility on the light-DOM tabs and panels. */\n #sync(): void {\n const tabs = this.#tabs;\n const panels = this.#panels;\n const enabled = tabs.filter((t) => !t.disabled);\n const activeTab = enabled.find((t) => t.panel === this.active) ?? enabled[0];\n if (activeTab && this.active !== activeTab.panel) this.active = activeTab.panel;\n\n tabs.forEach((tab, i) => {\n tab.slot = 'nav';\n tab.id ||= `${this.#id}-tab-${i}`;\n const panel = panels.find((p) => p.name === tab.panel);\n const selected = tab === activeTab;\n tab.setAttribute('role', 'tab');\n tab.setAttribute('aria-selected', String(selected));\n tab.setAttribute('aria-disabled', String(tab.disabled));\n tab.tabIndex = selected ? 0 : -1;\n if (panel) {\n panel.id ||= `${this.#id}-panel-${i}`;\n tab.setAttribute('aria-controls', panel.id);\n panel.setAttribute('aria-labelledby', tab.id);\n }\n });\n\n for (const panel of panels) {\n panel.setAttribute('role', 'tabpanel');\n panel.tabIndex = 0;\n panel.hidden = panel.name !== activeTab?.panel;\n }\n }\n\n #activate(tab: UfTab): void {\n tab.focus();\n if (tab.panel === this.active) return;\n this.active = tab.panel;\n this.dispatchEvent(\n new CustomEvent<TabChangeDetail>('uf-tab-change', {\n bubbles: true,\n composed: true,\n detail: { name: tab.panel },\n }),\n );\n }\n\n #onClick = (event: MouseEvent): void => {\n const tab = (event.target as Element).closest('uf-tab');\n if (tab?.parentElement === this && !tab.disabled) this.#activate(tab);\n };\n\n #onKeyDown = (event: KeyboardEvent): void => {\n const current = (event.target as Element).closest('uf-tab');\n if (!current || current.parentElement !== this) return;\n\n const tabs = this.#tabs.filter((t) => !t.disabled);\n const index = tabs.indexOf(current);\n const vertical = this.orientation === 'vertical';\n const next = vertical ? 'ArrowDown' : 'ArrowRight';\n const prev = vertical ? 'ArrowUp' : 'ArrowLeft';\n\n let target: UfTab | undefined;\n if (event.key === next) target = tabs[(index + 1) % tabs.length];\n else if (event.key === prev) target = tabs[(index - 1 + tabs.length) % tabs.length];\n else if (event.key === 'Home') target = tabs[0];\n else if (event.key === 'End') target = tabs[tabs.length - 1];\n else if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.#activate(current);\n return;\n }\n if (!target) return;\n\n event.preventDefault();\n if (this.activation === 'auto') this.#activate(target);\n else target.focus();\n };\n\n override render() {\n return html`\n <div\n class=\"tablist\"\n part=\"tablist\"\n role=\"tablist\"\n aria-label=${ifDefined(this.label)}\n aria-orientation=${this.orientation}\n >\n <slot name=\"nav\" @slotchange=${() => this.#sync()}></slot>\n </div>\n <div class=\"panels\" part=\"panels\">\n <slot @slotchange=${() => this.#sync()}></slot>\n </div>\n `;\n }\n}\n\ndefineElement('uf-tabs', UfTabs);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'uf-tabs': UfTabs;\n }\n}\n",
568
+ "components/tabs/tabs.ts": "import { LitElement, css, html, type PropertyDeclarations } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { defineElement } from '../../internal/define.js';\nimport { uniqueId } from '../../internal/slot.js';\nimport './tab.js';\nimport type { UfTab, UfTabPanel } from './tab.js';\n\nexport { UfTab, UfTabPanel } from './tab.js';\n\nexport interface TabChangeDetail {\n name: string;\n}\n\n/**\n * Tabs that switch between panels. Arrow keys move between tabs, Home and End\n * jump to the ends, and only the selected tab is in the tab order.\n *\n * @summary Organizes content into panels, one visible at a time.\n * @tag uf-tabs\n *\n * @slot - `<uf-tab>` and `<uf-tab-panel>` elements. Tabs are moved into the tab list automatically.\n * @slot nav - The tab list. You don't need to set this yourself.\n *\n * @event {CustomEvent<TabChangeDetail>} uf-tab-change - The selected tab changed.\n *\n * @csspart tablist - The element with `role=\"tablist\"`.\n * @csspart panels - The wrapper around the panels.\n *\n * @cssprop --uf-tabs-indicator-color - Color of the selected tab's underline.\n */\nexport class UfTabs extends LitElement {\n static override styles = css`\n :host {\n display: block;\n }\n\n .tablist {\n display: flex;\n gap: var(--uf-space-1);\n border-bottom: 1px solid var(--uf-color-border);\n overflow-x: auto;\n scrollbar-width: none;\n }\n\n :host([orientation='vertical']) {\n display: flex;\n gap: var(--uf-space-4);\n }\n\n :host([orientation='vertical']) .tablist {\n flex-direction: column;\n border-bottom: 0;\n border-inline-end: 1px solid var(--uf-color-border);\n overflow: visible;\n }\n\n .panels {\n flex: 1;\n min-width: 0;\n }\n `;\n\n static override properties: PropertyDeclarations = {\n active: { reflect: true },\n activation: { reflect: true },\n orientation: { reflect: true },\n label: {},\n };\n\n /** Name of the selected panel. Defaults to the first enabled tab. */\n declare active: string;\n /** `auto` selects a tab as soon as it gets focus; `manual` waits for Enter or Space. */\n declare activation: 'auto' | 'manual';\n /** Lays the tab list out horizontally or vertically. */\n declare orientation: 'horizontal' | 'vertical';\n /** Accessible name for the tab list. */\n declare label: string | undefined;\n\n readonly #id = uniqueId('uf-tabs');\n\n constructor() {\n super();\n this.active = '';\n this.activation = 'auto';\n this.orientation = 'horizontal';\n this.addEventListener('click', this.#onClick);\n this.addEventListener('keydown', this.#onKeyDown);\n }\n\n get #tabs(): UfTab[] {\n return [...this.querySelectorAll<UfTab>(':scope > uf-tab')];\n }\n\n get #panels(): UfTabPanel[] {\n return [...this.querySelectorAll<UfTabPanel>(':scope > uf-tab-panel')];\n }\n\n /** Selects the tab for the given panel name. */\n select(name: string): void {\n const tab = this.#tabs.find((t) => t.panel === name);\n if (tab && !tab.disabled) this.#activate(tab);\n }\n\n // Picks the active tab before rendering: setting it after (in updated) would\n // render twice, which Lit warns about in development.\n override willUpdate(): void {\n this.#activeTab();\n }\n\n override updated(): void {\n this.#sync();\n }\n\n /** The tab to show: the one for `active`, or the first enabled one. Keeps `active` in step. */\n #activeTab() {\n const enabled = this.#tabs.filter((t) => !t.disabled);\n const activeTab = enabled.find((t) => t.panel === this.active) ?? enabled[0];\n if (activeTab && this.active !== activeTab.panel) this.active = activeTab.panel;\n return activeTab;\n }\n\n /** Wires up roles, ids and visibility on the light-DOM tabs and panels. */\n #sync(): void {\n const tabs = this.#tabs;\n const panels = this.#panels;\n const activeTab = this.#activeTab();\n\n tabs.forEach((tab, i) => {\n tab.slot = 'nav';\n tab.id ||= `${this.#id}-tab-${i}`;\n const panel = panels.find((p) => p.name === tab.panel);\n const selected = tab === activeTab;\n tab.setAttribute('role', 'tab');\n tab.setAttribute('aria-selected', String(selected));\n tab.setAttribute('aria-disabled', String(tab.disabled));\n tab.tabIndex = selected ? 0 : -1;\n if (panel) {\n panel.id ||= `${this.#id}-panel-${i}`;\n tab.setAttribute('aria-controls', panel.id);\n panel.setAttribute('aria-labelledby', tab.id);\n }\n });\n\n for (const panel of panels) {\n panel.setAttribute('role', 'tabpanel');\n panel.tabIndex = 0;\n panel.hidden = panel.name !== activeTab?.panel;\n }\n }\n\n #activate(tab: UfTab): void {\n tab.focus();\n if (tab.panel === this.active) return;\n this.active = tab.panel;\n this.dispatchEvent(\n new CustomEvent<TabChangeDetail>('uf-tab-change', {\n bubbles: true,\n composed: true,\n detail: { name: tab.panel },\n }),\n );\n }\n\n #onClick = (event: MouseEvent): void => {\n const tab = (event.target as Element).closest('uf-tab');\n if (tab?.parentElement === this && !tab.disabled) this.#activate(tab);\n };\n\n #onKeyDown = (event: KeyboardEvent): void => {\n const current = (event.target as Element).closest('uf-tab');\n if (!current || current.parentElement !== this) return;\n\n const tabs = this.#tabs.filter((t) => !t.disabled);\n const index = tabs.indexOf(current);\n const vertical = this.orientation === 'vertical';\n const next = vertical ? 'ArrowDown' : 'ArrowRight';\n const prev = vertical ? 'ArrowUp' : 'ArrowLeft';\n\n let target: UfTab | undefined;\n if (event.key === next) target = tabs[(index + 1) % tabs.length];\n else if (event.key === prev) target = tabs[(index - 1 + tabs.length) % tabs.length];\n else if (event.key === 'Home') target = tabs[0];\n else if (event.key === 'End') target = tabs[tabs.length - 1];\n else if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.#activate(current);\n return;\n }\n if (!target) return;\n\n event.preventDefault();\n if (this.activation === 'auto') this.#activate(target);\n else target.focus();\n };\n\n override render() {\n return html`\n <div\n class=\"tablist\"\n part=\"tablist\"\n role=\"tablist\"\n aria-label=${ifDefined(this.label)}\n aria-orientation=${this.orientation}\n >\n <slot name=\"nav\" @slotchange=${() => this.#sync()}></slot>\n </div>\n <div class=\"panels\" part=\"panels\">\n <slot @slotchange=${() => this.#sync()}></slot>\n </div>\n `;\n }\n}\n\ndefineElement('uf-tabs', UfTabs);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'uf-tabs': UfTabs;\n }\n}\n",
569
569
  "components/tabs/tab.ts": "import { LitElement, css, html, type PropertyDeclarations } from 'lit';\nimport { defineElement } from '../../internal/define.js';\n\n/**\n * A tab inside `<uf-tabs>`. Its `panel` names the `<uf-tab-panel>` it shows.\n *\n * @summary A tab in a tab list.\n * @tag uf-tab\n *\n * @slot - The tab label.\n *\n * @csspart base - The tab's inner wrapper.\n *\n * @cssstate active - The tab is selected.\n */\nexport class UfTab extends LitElement {\n static override styles = css`\n :host {\n position: relative;\n display: inline-flex;\n align-items: center;\n gap: var(--uf-space-2);\n padding: var(--uf-space-2) var(--uf-space-3);\n color: var(--uf-color-text-muted);\n font-family: var(--uf-font-family-sans);\n font-size: var(--uf-font-size-md);\n font-weight: var(--uf-font-weight-medium);\n white-space: nowrap;\n cursor: pointer;\n user-select: none;\n outline: none;\n border-radius: var(--uf-radius-sm);\n transition: color var(--uf-duration-fast) ease;\n }\n\n :host(:hover:not([disabled])) {\n color: var(--uf-color-text);\n }\n\n :host([aria-selected='true']) {\n color: var(--uf-color-text);\n }\n\n :host::after {\n content: '';\n position: absolute;\n inset: auto 0 -1px 0;\n height: 2px;\n border-radius: 2px;\n background: var(--uf-tabs-indicator-color, var(--uf-color-accent-strong));\n scale: 0 1;\n transition: scale var(--uf-duration-base) ease;\n }\n\n :host([aria-selected='true'])::after {\n scale: 1 1;\n }\n\n :host(:focus-visible) {\n outline: var(--uf-focus-ring-width) solid var(--uf-color-focus-ring);\n outline-offset: calc(var(--uf-focus-ring-width) * -1);\n }\n\n :host([disabled]) {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n @media (prefers-reduced-motion: reduce) {\n :host::after {\n transition: none;\n }\n }\n `;\n\n static override properties: PropertyDeclarations = {\n panel: { reflect: true },\n disabled: { type: Boolean, reflect: true },\n };\n\n /** Name of the `<uf-tab-panel>` this tab shows. */\n declare panel: string;\n /** Disables the tab. */\n declare disabled: boolean;\n\n constructor() {\n super();\n this.panel = '';\n this.disabled = false;\n }\n\n override render() {\n return html`<slot part=\"base\"></slot>`;\n }\n}\n\n/**\n * The content shown when its tab is selected.\n *\n * @summary A panel of content inside `<uf-tabs>`.\n * @tag uf-tab-panel\n *\n * @slot - The panel content.\n *\n * @cssprop --uf-tab-panel-padding - Padding around the content.\n */\nexport class UfTabPanel extends LitElement {\n static override styles = css`\n :host {\n display: block;\n padding: var(--uf-tab-panel-padding, var(--uf-space-4) 0);\n outline: none;\n }\n\n :host([hidden]) {\n display: none;\n }\n\n :host(:focus-visible) {\n outline: var(--uf-focus-ring-width) solid var(--uf-color-focus-ring);\n outline-offset: var(--uf-focus-ring-offset);\n border-radius: var(--uf-radius-sm);\n }\n `;\n\n static override properties: PropertyDeclarations = {\n name: { reflect: true },\n };\n\n /** Name the matching tab refers to with `panel`. */\n declare name: string;\n\n constructor() {\n super();\n this.name = '';\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n}\n\ndefineElement('uf-tab', UfTab);\ndefineElement('uf-tab-panel', UfTabPanel);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'uf-tab': UfTab;\n 'uf-tab-panel': UfTabPanel;\n }\n}\n",
570
570
  "components/textarea/textarea.ts": "import { css, html, type PropertyDeclarations, type PropertyValues } from 'lit';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { defineElement } from '../../internal/define.js';\nimport { controlBoxStyles, describedBy, fieldStyles, renderField, type FieldSize } from '../../internal/field.js';\nimport { FormControl } from '../../internal/form-control.js';\nimport { hostStyles } from '../../internal/shared.styles.js';\nimport { HasSlotController, uniqueId } from '../../internal/slot.js';\n\nexport type TextareaResize = 'none' | 'vertical' | 'auto';\n\n/**\n * A multi-line text field with a built-in label, hint and validation message.\n *\n * @summary Lets users enter multiple lines of text.\n * @tag uf-textarea\n *\n * @slot label - The label, when you need markup. Overrides `label`.\n * @slot hint - Help text below the field. Overrides `hint`.\n *\n * @event input - Fired on every keystroke.\n * @event change - Fired when the value is committed (blur).\n *\n * @csspart field - The wrapper around label, control, hint and error.\n * @csspart form-label - The label.\n * @csspart box - The bordered box around the textarea.\n * @csspart textarea - The native `<textarea>`.\n * @csspart hint - The hint text.\n * @csspart error - The validation message.\n *\n * @cssprop --uf-field-bg - Background of the box.\n * @cssprop --uf-field-border-color - Border color of the box.\n * @cssprop --uf-field-radius - Corner radius of the box.\n *\n * @cssstate user-invalid - The value is invalid and the user has interacted with the field.\n */\nexport class UfTextarea extends FormControl {\n static override styles = [\n hostStyles,\n fieldStyles,\n controlBoxStyles,\n css`\n .box {\n align-items: stretch;\n padding-block: var(--uf-space-2);\n }\n\n .native {\n min-height: 3lh;\n line-height: 1.5;\n resize: vertical;\n }\n\n :host([resize='none']) .native {\n resize: none;\n }\n\n /* Grows with its content where supported (field-sizing), otherwise resizable. */\n :host([resize='auto']) .native {\n field-sizing: content;\n resize: none;\n }\n `,\n ];\n\n protected static override formStateProperties: ReadonlySet<PropertyKey> = new Set([\n ...FormControl.formStateProperties,\n 'readonly',\n 'minlength',\n 'maxlength',\n ]);\n\n static override properties: PropertyDeclarations = {\n value: { attribute: false },\n defaultValue: { attribute: 'value' },\n label: {},\n hint: {},\n placeholder: {},\n rows: { type: Number },\n resize: { reflect: true },\n size: { reflect: true },\n readonly: { type: Boolean, reflect: true },\n autocomplete: {},\n minlength: { type: Number },\n maxlength: { type: Number },\n };\n\n /** Current value. */\n declare value: string;\n /** Initial value, restored on form reset. Set with the `value` attribute. */\n declare defaultValue: string;\n /** Visible label. */\n declare label: string | undefined;\n /** Help text below the field. */\n declare hint: string | undefined;\n /** Placeholder text. */\n declare placeholder: string | undefined;\n /** Visible number of lines. */\n declare rows: number;\n /** How the user can resize the field. `auto` grows with the content. */\n declare resize: TextareaResize;\n /** Size of the field. */\n declare size: FieldSize;\n /** Makes the field read-only. */\n declare readonly: boolean;\n /** Native `autocomplete` hint. */\n declare autocomplete: AutoFill | undefined;\n /** Minimum length. */\n declare minlength: number | undefined;\n /** Maximum length. */\n declare maxlength: number | undefined;\n\n readonly #slots = new HasSlotController(this, 'label', 'hint');\n readonly #id = uniqueId('uf-textarea');\n\n constructor() {\n super();\n this.value = '';\n this.defaultValue = '';\n this.rows = 4;\n this.resize = 'vertical';\n this.size = 'md';\n this.readonly = false;\n }\n\n get #textarea(): HTMLTextAreaElement | null {\n return this.renderRoot.querySelector('textarea');\n }\n\n /** Selects all text in the field. */\n select(): void {\n this.#textarea?.select();\n }\n\n override willUpdate(changed: PropertyValues<this>): void {\n if (changed.has('defaultValue') && this.value === (changed.get('defaultValue') ?? '')) {\n this.value = this.defaultValue ?? '';\n }\n }\n\n override updated(): void {\n this.syncFormState();\n }\n\n protected syncFormState(): void {\n const textarea = this.#textarea;\n if (!textarea) return;\n this.internals.setFormValue(this.value);\n this.setValidityFrom(textarea);\n }\n\n protected resetValue(): void {\n this.value = this.defaultValue ?? '';\n }\n\n /** @internal */\n formStateRestoreCallback(state: string | null): void {\n this.value = state ?? '';\n }\n\n #onInput = (event: Event): void => {\n this.value = (event.target as HTMLTextAreaElement).value;\n };\n\n #onChange = (): void => {\n this.markInteracted();\n this.emitChange();\n };\n\n override render() {\n const ids = { hintId: `${this.#id}-hint`, errorId: `${this.#id}-error` };\n const error = this.showInvalid ? this.validationMessage : '';\n const hasHintSlot = this.#slots.has('hint');\n\n return renderField({\n ...ids,\n controlId: this.#id,\n label: this.label,\n hasLabelSlot: this.#slots.has('label'),\n hint: this.hint,\n hasHintSlot,\n error,\n required: this.required,\n control: html`\n <div class=${classMap({ box: true, disabled: this.isDisabled })} part=\"box\">\n <textarea\n id=${this.#id}\n class=\"native\"\n part=\"textarea\"\n name=${ifDefined(this.name || undefined)}\n .value=${live(this.value)}\n rows=${this.rows}\n placeholder=${ifDefined(this.placeholder)}\n autocomplete=${ifDefined(this.autocomplete)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n ?required=${this.required}\n ?readonly=${this.readonly}\n ?disabled=${this.isDisabled}\n aria-invalid=${error ? 'true' : 'false'}\n aria-describedby=${ifDefined(describedBy({ ...ids, hint: this.hint, hasHintSlot, error }))}\n @input=${this.#onInput}\n @change=${this.#onChange}\n ></textarea>\n </div>\n `,\n });\n }\n}\n\ndefineElement('uf-textarea', UfTextarea);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'uf-textarea': UfTextarea;\n }\n}\n",
571
- "components/toast/toast.ts": "import { LitElement, css, html, nothing, type PropertyDeclarations } from 'lit';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { defineElement } from '../../internal/define.js';\nimport { Translator } from '../../internal/i18n.js';\nimport { iconSvg, icons } from '../../internal/icons.js';\n\nexport type ToastVariant = 'neutral' | 'info' | 'success' | 'warning' | 'danger';\nexport type ToasterPlacement = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';\n\nexport interface ToastOptions {\n /** Bold first line. */\n title?: string;\n /** Color and icon. `danger` toasts are announced assertively. */\n variant?: ToastVariant;\n /** Milliseconds before it hides. `0` keeps it until dismissed. Defaults to 5000. */\n duration?: number;\n /** Shows a dismiss button. Defaults to true. */\n closable?: boolean;\n}\n\nexport interface ToastHandle {\n /** Hides the toast now. */\n dismiss(): void;\n}\n\ninterface ToastItem extends Required<Omit<ToastOptions, 'title'>> {\n id: number;\n title?: string;\n message: string;\n leaving: boolean;\n}\n\ninterface Timer {\n handle: number;\n started: number;\n remaining: number;\n}\n\nconst variantIcons = {\n neutral: null,\n info: icons.info,\n success: icons['check-circle'],\n warning: icons['alert-triangle'],\n danger: icons['alert-circle'],\n} as const;\n\nconst MAX_TOASTS = 5;\nconst EXIT_MS = 200;\nlet nextId = 1;\n\n/**\n * The region that shows toasts. You rarely need to add it yourself: `toast()`\n * creates one on first use. Add it to choose a placement, or to hold\n * toasts in a specific place in the DOM.\n *\n * @summary Shows short, temporary notifications.\n * @tag uf-toaster\n *\n * @csspart region - The list holding the toasts.\n * @csspart toast - Each toast.\n * @csspart title - A toast's title.\n * @csspart message - A toast's message.\n * @csspart close-button - A toast's dismiss button.\n *\n * @cssprop --uf-toast-width - Width of each toast.\n * @cssprop --uf-toaster-offset - Distance from the viewport edges.\n */\nexport class UfToaster extends LitElement {\n static override styles = css`\n :host {\n --_offset: var(--uf-toaster-offset, var(--uf-space-4));\n position: fixed;\n inset: auto;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n overflow: visible;\n width: min(var(--uf-toast-width, 22rem), calc(100vw - 2 * var(--_offset)));\n font-family: var(--uf-font-family-sans);\n }\n\n :host([placement^='top']) {\n top: var(--_offset);\n }\n :host([placement^='bottom']) {\n bottom: var(--_offset);\n }\n :host([placement$='start']) {\n left: var(--_offset);\n }\n :host([placement$='end']) {\n right: var(--_offset);\n }\n :host([placement$='center']) {\n left: 50%;\n translate: -50% 0;\n }\n\n ol {\n display: flex;\n flex-direction: column;\n gap: var(--uf-space-2);\n margin: 0;\n padding: 0;\n list-style: none;\n }\n\n :host([placement^='bottom']) ol {\n flex-direction: column-reverse;\n }\n\n .toast {\n --_bg: var(--uf-color-toast-neutral-bg);\n --_border: var(--uf-color-toast-neutral-border);\n --_text: var(--uf-color-toast-neutral-text);\n display: flex;\n align-items: flex-start;\n gap: var(--uf-space-3);\n padding: var(--uf-space-3) var(--uf-space-3) var(--uf-space-3) var(--uf-space-4);\n border: 1px solid var(--_border);\n border-radius: var(--uf-radius-md);\n background: var(--_bg);\n color: var(--_text);\n font-size: var(--uf-font-size-md);\n line-height: 1.45;\n box-shadow: var(--uf-shadow-md);\n animation: enter var(--uf-duration-base) ease;\n }\n\n .toast.leaving {\n opacity: 0;\n translate: 0 0.25rem;\n transition:\n opacity ${EXIT_MS}ms ease,\n translate ${EXIT_MS}ms ease;\n }\n\n .info {\n --_bg: var(--uf-color-toast-info-bg);\n --_border: var(--uf-color-toast-info-border);\n --_text: var(--uf-color-toast-info-text);\n }\n .success {\n --_bg: var(--uf-color-toast-success-bg);\n --_border: var(--uf-color-toast-success-border);\n --_text: var(--uf-color-toast-success-text);\n }\n .warning {\n --_bg: var(--uf-color-toast-warning-bg);\n --_border: var(--uf-color-toast-warning-border);\n --_text: var(--uf-color-toast-warning-text);\n }\n .danger {\n --_bg: var(--uf-color-toast-danger-bg);\n --_border: var(--uf-color-toast-danger-border);\n --_text: var(--uf-color-toast-danger-text);\n }\n\n .icon {\n flex: none;\n width: 1.125rem;\n height: 1.125rem;\n margin-top: 0.1em;\n color: currentColor;\n }\n\n .content {\n flex: 1;\n min-width: 0;\n padding-block: 0.0625rem;\n }\n\n .title {\n display: block;\n font-weight: var(--uf-font-weight-semibold);\n }\n\n .title + .message {\n margin-top: 0.125rem;\n }\n\n\n .close {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 1.75rem;\n height: 1.75rem;\n margin: -0.125rem -0.25rem 0 0;\n padding: 0;\n border: 0;\n border-radius: var(--uf-radius-sm);\n background: transparent;\n color: inherit;\n opacity: 0.8;\n cursor: pointer;\n }\n\n .close:hover {\n background: color-mix(in srgb, currentColor 16%, transparent);\n opacity: 1;\n }\n\n .close:focus-visible {\n outline: var(--uf-focus-ring-width) solid var(--uf-color-focus-ring);\n outline-offset: 0;\n }\n\n .close .icon {\n width: 1rem;\n height: 1rem;\n margin: 0;\n color: inherit;\n }\n\n @keyframes enter {\n from {\n opacity: 0;\n translate: 0 0.5rem;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .toast {\n animation: none;\n }\n .toast.leaving {\n transition: none;\n }\n }\n `;\n\n static override properties: PropertyDeclarations = {\n placement: { reflect: true },\n label: {},\n };\n\n /** Corner or edge of the viewport where toasts appear. */\n declare placement: ToasterPlacement;\n /** Accessible name of the notification region. Defaults to \"Notifications\", or its translation. */\n declare label: string | undefined;\n\n #items: ToastItem[] = [];\n readonly #translator = new Translator(this);\n readonly #timers = new Map<number, Timer>();\n\n constructor() {\n super();\n this.placement = 'bottom-end';\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n // The host itself is a manual popover, so toasts render in the top layer.\n this.popover = 'manual';\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n for (const timer of this.#timers.values()) clearTimeout(timer.handle);\n this.#timers.clear();\n }\n\n /** Shows a toast in this region. Prefer the `toast()` function. */\n add(message: string, options: ToastOptions = {}): ToastHandle {\n const item: ToastItem = {\n id: nextId++,\n message,\n title: options.title,\n variant: options.variant ?? 'neutral',\n duration: options.duration ?? 5000,\n closable: options.closable ?? true,\n leaving: false,\n };\n this.#items = [...this.#items, item];\n const overflow = this.#items.filter((i) => !i.leaving).length - MAX_TOASTS;\n if (overflow > 0) this.#items.filter((i) => !i.leaving).slice(0, overflow).forEach((i) => this.dismiss(i.id));\n\n this.#bringToFront();\n if (item.duration > 0) this.#startTimer(item.id, item.duration);\n this.requestUpdate();\n return { dismiss: () => this.dismiss(item.id) };\n }\n\n /** Hides a toast by id. */\n dismiss(id: number): void {\n const item = this.#items.find((i) => i.id === id);\n if (!item || item.leaving) return;\n clearTimeout(this.#timers.get(id)?.handle);\n this.#timers.delete(id);\n item.leaving = true;\n this.requestUpdate();\n\n const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;\n setTimeout(() => {\n this.#items = this.#items.filter((i) => i.id !== id);\n if (!this.#items.length && this.matches(':popover-open')) this.hidePopover();\n this.requestUpdate();\n }, reduced ? 0 : EXIT_MS);\n }\n\n /** Re-shows the popover, so toasts appear above a dialog opened after the last one. */\n #bringToFront(): void {\n if (this.matches(':popover-open')) this.hidePopover();\n this.showPopover();\n }\n\n #startTimer(id: number, ms: number): void {\n this.#timers.set(id, { handle: window.setTimeout(() => this.dismiss(id), ms), started: Date.now(), remaining: ms });\n }\n\n #pause(id: number): void {\n const timer = this.#timers.get(id);\n if (!timer) return;\n clearTimeout(timer.handle);\n timer.remaining -= Date.now() - timer.started;\n }\n\n #resume(id: number): void {\n const timer = this.#timers.get(id);\n if (timer) this.#startTimer(id, Math.max(timer.remaining, 1000));\n }\n\n #renderToast(item: ToastItem) {\n const icon = variantIcons[item.variant];\n return html`\n <li\n class=${classMap({ toast: true, [item.variant]: true, leaving: item.leaving })}\n part=\"toast\"\n role=${item.variant === 'danger' ? 'alert' : nothing}\n @pointerenter=${() => this.#pause(item.id)}\n @pointerleave=${() => this.#resume(item.id)}\n @focusin=${() => this.#pause(item.id)}\n @focusout=${() => this.#resume(item.id)}\n >\n ${icon ? iconSvg(icon) : nothing}\n <div class=\"content\">\n ${item.title ? html`<strong class=\"title\" part=\"title\">${item.title}</strong>` : nothing}\n <div class=\"message\" part=\"message\">${item.message}</div>\n </div>\n ${item.closable\n ? html`<button class=\"close\" part=\"close-button\" type=\"button\" aria-label=${this.#translator.t('dismiss')} @click=${() => this.dismiss(item.id)}>\n ${iconSvg(icons.x)}\n </button>`\n : nothing}\n </li>\n `;\n }\n\n override render() {\n return html`\n <section aria-label=${this.label ?? this.#translator.t('notifications')}>\n <ol part=\"region\" aria-live=\"polite\" aria-relevant=\"additions\">\n ${repeat(this.#items, (item) => item.id, (item) => this.#renderToast(item))}\n </ol>\n </section>\n `;\n }\n}\n\ndefineElement('uf-toaster', UfToaster);\n\n/**\n * Shows a toast. Creates a `<uf-toaster>` on first use.\n *\n * @example toast('Saved', { variant: 'success' })\n */\nexport function toast(message: string, options?: ToastOptions): ToastHandle {\n let toaster = document.querySelector('uf-toaster');\n if (toaster) return toaster.add(message, options);\n\n // A live region must exist before content is added to it, or screen readers\n // may skip the first message. Create it now and add the toast a moment later.\n toaster = document.body.appendChild(document.createElement('uf-toaster'));\n let handle: ToastHandle | undefined;\n let dismissed = false;\n setTimeout(() => {\n if (!dismissed) handle = toaster.add(message, options);\n }, 100);\n return {\n dismiss() {\n dismissed = true;\n handle?.dismiss();\n },\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'uf-toaster': UfToaster;\n }\n}\n",
571
+ "components/toast/toast.ts": "import { LitElement, css, html, nothing, type PropertyDeclarations } from 'lit';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { defineElement } from '../../internal/define.js';\nimport { Translator } from '../../internal/i18n.js';\nimport { iconSvg, icons } from '../../internal/icons.js';\n\nexport type ToastVariant = 'neutral' | 'info' | 'success' | 'warning' | 'danger';\nexport type ToasterPlacement = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';\n\nexport interface ToastOptions {\n /** Bold first line. */\n title?: string;\n /** Color and icon. `danger` toasts are announced assertively. */\n variant?: ToastVariant;\n /** Milliseconds before it hides. `0` keeps it until dismissed. Defaults to 5000. */\n duration?: number;\n /** Shows a dismiss button. Defaults to true. */\n closable?: boolean;\n}\n\nexport interface ToastHandle {\n /** Hides the toast now. */\n dismiss(): void;\n}\n\ninterface ToastItem extends Required<Omit<ToastOptions, 'title'>> {\n id: number;\n title?: string;\n message: string;\n leaving: boolean;\n}\n\ninterface Timer {\n handle: number;\n started: number;\n remaining: number;\n}\n\nconst variantIcons = {\n neutral: null,\n info: icons.info,\n success: icons['check-circle'],\n warning: icons['alert-triangle'],\n danger: icons['alert-circle'],\n} as const;\n\nconst MAX_TOASTS = 5;\nconst EXIT_MS = 200;\nlet nextId = 1;\n\n/**\n * The region that shows toasts. You rarely need to add it yourself: `toast()`\n * creates one on first use. Add it to choose a placement, or to hold\n * toasts in a specific place in the DOM.\n *\n * @summary Shows short, temporary notifications.\n * @tag uf-toaster\n *\n * @csspart region - The list holding the toasts.\n * @csspart toast - Each toast.\n * @csspart title - A toast's title.\n * @csspart message - A toast's message.\n * @csspart close-button - A toast's dismiss button.\n *\n * @cssprop --uf-toast-width - Width of each toast.\n * @cssprop --uf-toaster-offset - Distance from the viewport edges.\n */\nexport class UfToaster extends LitElement {\n static override styles = css`\n :host {\n --_offset: var(--uf-toaster-offset, var(--uf-space-4));\n position: fixed;\n inset: auto;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n overflow: visible;\n width: min(var(--uf-toast-width, 22rem), calc(100vw - 2 * var(--_offset)));\n font-family: var(--uf-font-family-sans);\n }\n\n :host([placement^='top']) {\n top: var(--_offset);\n }\n :host([placement^='bottom']) {\n bottom: var(--_offset);\n }\n :host([placement$='start']) {\n left: var(--_offset);\n }\n :host([placement$='end']) {\n right: var(--_offset);\n }\n :host([placement$='center']) {\n left: 50%;\n translate: -50% 0;\n }\n\n ol {\n display: flex;\n flex-direction: column;\n gap: var(--uf-space-2);\n margin: 0;\n padding: 0;\n list-style: none;\n }\n\n :host([placement^='bottom']) ol {\n flex-direction: column-reverse;\n }\n\n .toast {\n --_bg: var(--uf-color-toast-neutral-bg);\n --_border: var(--uf-color-toast-neutral-border);\n --_text: var(--uf-color-toast-neutral-text);\n display: flex;\n align-items: flex-start;\n gap: var(--uf-space-3);\n padding: var(--uf-space-3) var(--uf-space-3) var(--uf-space-3) var(--uf-space-4);\n border: 1px solid var(--_border);\n border-radius: var(--uf-radius-md);\n background: var(--_bg);\n color: var(--_text);\n font-size: var(--uf-font-size-md);\n line-height: 1.45;\n box-shadow: var(--uf-shadow-md);\n animation: enter var(--uf-duration-base) ease;\n }\n\n .toast.leaving {\n opacity: 0;\n translate: 0 0.25rem;\n transition:\n opacity ${EXIT_MS}ms ease,\n translate ${EXIT_MS}ms ease;\n }\n\n .info {\n --_bg: var(--uf-color-toast-info-bg);\n --_border: var(--uf-color-toast-info-border);\n --_text: var(--uf-color-toast-info-text);\n }\n .success {\n --_bg: var(--uf-color-toast-success-bg);\n --_border: var(--uf-color-toast-success-border);\n --_text: var(--uf-color-toast-success-text);\n }\n .warning {\n --_bg: var(--uf-color-toast-warning-bg);\n --_border: var(--uf-color-toast-warning-border);\n --_text: var(--uf-color-toast-warning-text);\n }\n .danger {\n --_bg: var(--uf-color-toast-danger-bg);\n --_border: var(--uf-color-toast-danger-border);\n --_text: var(--uf-color-toast-danger-text);\n }\n\n .icon {\n flex: none;\n width: 1.125rem;\n height: 1.125rem;\n margin-top: 0.1em;\n color: currentColor;\n }\n\n .content {\n flex: 1;\n min-width: 0;\n padding-block: 0.0625rem;\n }\n\n .title {\n display: block;\n font-weight: var(--uf-font-weight-semibold);\n }\n\n .title + .message {\n margin-top: 0.125rem;\n }\n\n\n .close {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 1.75rem;\n height: 1.75rem;\n margin: -0.125rem -0.25rem 0 0;\n padding: 0;\n border: 0;\n border-radius: var(--uf-radius-sm);\n background: transparent;\n color: inherit;\n opacity: 0.8;\n cursor: pointer;\n }\n\n .close:hover {\n background: color-mix(in srgb, currentColor 16%, transparent);\n opacity: 1;\n }\n\n .close:focus-visible {\n outline: var(--uf-focus-ring-width) solid var(--uf-color-focus-ring);\n outline-offset: 0;\n }\n\n .close .icon {\n width: 1rem;\n height: 1rem;\n margin: 0;\n color: inherit;\n }\n\n @keyframes enter {\n from {\n opacity: 0;\n translate: 0 0.5rem;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .toast {\n animation: none;\n }\n .toast.leaving {\n transition: none;\n }\n }\n `;\n\n static override properties: PropertyDeclarations = {\n placement: { reflect: true },\n label: {},\n };\n\n /** Corner or edge of the viewport where toasts appear. */\n declare placement: ToasterPlacement;\n /** Accessible name of the notification region. Defaults to \"Notifications\", or its translation. */\n declare label: string | undefined;\n\n #items: ToastItem[] = [];\n readonly #translator = new Translator(this);\n readonly #timers = new Map<number, Timer>();\n\n constructor() {\n super();\n this.placement = 'bottom-end';\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n // The host itself is a manual popover, so toasts render in the top layer.\n this.popover = 'manual';\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n for (const timer of this.#timers.values()) clearTimeout(timer.handle);\n this.#timers.clear();\n }\n\n /** Shows a toast in this region. Prefer the `toast()` function. */\n add(message: string, options: ToastOptions = {}): ToastHandle {\n const item: ToastItem = {\n id: nextId++,\n message,\n title: options.title,\n variant: options.variant ?? 'neutral',\n duration: options.duration ?? 5000,\n closable: options.closable ?? true,\n leaving: false,\n };\n this.#items = [...this.#items, item];\n const overflow = this.#items.filter((i) => !i.leaving).length - MAX_TOASTS;\n if (overflow > 0) this.#items.filter((i) => !i.leaving).slice(0, overflow).forEach((i) => this.dismiss(i.id));\n\n this.#bringToFront();\n if (item.duration > 0) this.#startTimer(item.id, item.duration);\n this.requestUpdate();\n return { dismiss: () => this.dismiss(item.id) };\n }\n\n /** Hides a toast by id. */\n dismiss(id: number): void {\n const item = this.#items.find((i) => i.id === id);\n if (!item || item.leaving) return;\n clearTimeout(this.#timers.get(id)?.handle);\n this.#timers.delete(id);\n item.leaving = true;\n this.requestUpdate();\n\n const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;\n setTimeout(() => {\n this.#items = this.#items.filter((i) => i.id !== id);\n if (!this.#items.length && this.matches(':popover-open')) this.hidePopover();\n this.requestUpdate();\n }, reduced ? 0 : EXIT_MS);\n }\n\n /** Re-shows the popover, so toasts appear above a dialog opened after the last one. */\n #bringToFront(): void {\n if (this.matches(':popover-open')) this.hidePopover();\n this.showPopover();\n }\n\n #startTimer(id: number, ms: number): void {\n this.#timers.set(id, { handle: window.setTimeout(() => this.dismiss(id), ms), started: Date.now(), remaining: ms });\n }\n\n #pause(id: number): void {\n const timer = this.#timers.get(id);\n if (!timer) return;\n clearTimeout(timer.handle);\n timer.remaining -= Date.now() - timer.started;\n }\n\n #resume(id: number): void {\n const timer = this.#timers.get(id);\n if (timer) this.#startTimer(id, Math.max(timer.remaining, 1000));\n }\n\n #renderToast(item: ToastItem) {\n const icon = variantIcons[item.variant];\n return html`\n <li\n class=${classMap({ toast: true, [item.variant]: true, leaving: item.leaving })}\n part=\"toast\"\n role=${item.variant === 'danger' ? 'alert' : nothing}\n @pointerenter=${() => this.#pause(item.id)}\n @pointerleave=${() => this.#resume(item.id)}\n @focusin=${() => this.#pause(item.id)}\n @focusout=${() => this.#resume(item.id)}\n >\n ${icon ? iconSvg(icon) : nothing}\n <div class=\"content\">\n ${item.title ? html`<strong class=\"title\" part=\"title\">${item.title}</strong>` : nothing}\n <div class=\"message\" part=\"message\">${item.message}</div>\n </div>\n ${item.closable\n ? html`<button class=\"close\" part=\"close-button\" type=\"button\" aria-label=${this.#translator.t('dismiss')} @click=${() => this.dismiss(item.id)}>\n ${iconSvg(icons.x)}\n </button>`\n : nothing}\n </li>\n `;\n }\n\n override render() {\n return html`\n <section aria-label=${this.label ?? this.#translator.t('notifications')}>\n <ol part=\"region\" aria-live=\"polite\" aria-relevant=\"additions\">\n ${repeat(this.#items, (item) => item.id, (item) => this.#renderToast(item))}\n </ol>\n </section>\n `;\n }\n}\n\ndefineElement('uf-toaster', UfToaster);\n\n/**\n * Shows a toast. Creates a `<uf-toaster>` on first use. Does nothing on the\n * server, when rendering with SSR.\n *\n * @example toast('Saved', { variant: 'success' })\n */\nexport function toast(message: string, options?: ToastOptions): ToastHandle {\n // On the server (SSR) there is no page to show it on: do nothing.\n if (typeof document === 'undefined') return { dismiss() {} };\n let toaster = document.querySelector('uf-toaster');\n if (toaster) return toaster.add(message, options);\n\n // A live region must exist before content is added to it, or screen readers\n // may skip the first message. Create it now and add the toast a moment later.\n toaster = document.body.appendChild(document.createElement('uf-toaster'));\n let handle: ToastHandle | undefined;\n let dismissed = false;\n setTimeout(() => {\n if (!dismissed) handle = toaster.add(message, options);\n }, 100);\n return {\n dismiss() {\n dismissed = true;\n handle?.dismiss();\n },\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'uf-toaster': UfToaster;\n }\n}\n",
572
572
  "components/tooltip/tooltip.ts": "import { LitElement, css, html, type PropertyDeclarations, type PropertyValues } from 'lit';\nimport { defineElement } from '../../internal/define.js';\nimport { autoUpdate, positionFloating, type Placement } from '../../internal/position.js';\n\n/**\n * A short label that appears on hover and keyboard focus. Wrap the element it\n * describes. The text is also set as the trigger's `aria-description` (unless it\n * repeats the trigger's own label), so screen reader users get it too. Don't put\n * interactive content in a tooltip.\n *\n * @summary Shows a short hint for the element it wraps.\n * @tag uf-tooltip\n *\n * @slot - The element the tooltip describes.\n *\n * @csspart body - The tooltip bubble.\n *\n * @cssprop --uf-tooltip-bg - Background color.\n * @cssprop --uf-tooltip-color - Text color.\n * @cssprop --uf-tooltip-max-width - Maximum width.\n */\nexport class UfTooltip extends LitElement {\n static override styles = css`\n :host {\n display: contents;\n }\n\n .body {\n position: fixed;\n inset: auto;\n margin: 0;\n max-width: var(--uf-tooltip-max-width, 18rem);\n padding: var(--uf-space-1) var(--uf-space-2);\n border: 0;\n border-radius: var(--uf-radius-sm);\n background: var(--uf-tooltip-bg, var(--uf-color-text));\n color: var(--uf-tooltip-color, var(--uf-color-surface));\n font-family: var(--uf-font-family-sans);\n font-size: var(--uf-font-size-sm);\n line-height: 1.4;\n overflow: visible;\n opacity: 0;\n transition:\n opacity var(--uf-duration-fast) ease,\n overlay var(--uf-duration-fast) allow-discrete,\n display var(--uf-duration-fast) allow-discrete;\n }\n\n .body:popover-open {\n opacity: 1;\n }\n\n @starting-style {\n .body:popover-open {\n opacity: 0;\n }\n }\n `;\n\n static override properties: PropertyDeclarations = {\n content: {},\n placement: { reflect: true },\n disabled: { type: Boolean, reflect: true },\n delay: { type: Number },\n open: { type: Boolean, reflect: true },\n };\n\n /** The tooltip text. */\n declare content: string;\n /** Preferred side. Flips when there is no room. */\n declare placement: Placement;\n /** Turns the tooltip off. */\n declare disabled: boolean;\n /** Milliseconds to wait on hover before showing. Focus shows it immediately. */\n declare delay: number;\n /** Whether the tooltip is showing. */\n declare open: boolean;\n\n #timer = 0;\n #cleanup?: () => void;\n\n constructor() {\n super();\n this.content = '';\n this.placement = 'top';\n this.disabled = false;\n this.delay = 300;\n this.open = false;\n this.addEventListener('pointerenter', this.#onPointerEnter);\n this.addEventListener('pointerleave', this.#onLeave);\n this.addEventListener('focusin', this.#onFocusIn);\n this.addEventListener('focusout', this.#onLeave);\n }\n\n get #body(): HTMLElement | null {\n return this.renderRoot.querySelector('.body');\n }\n\n get #trigger(): HTMLElement | undefined {\n const slot = this.renderRoot.querySelector<HTMLSlotElement>('slot');\n return slot?.assignedElements()[0] as HTMLElement | undefined;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener('keydown', this.#onKeyDown);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener('keydown', this.#onKeyDown);\n clearTimeout(this.#timer);\n this.#cleanup?.();\n }\n\n /** Shows the tooltip, unless it's disabled. */\n show(): void {\n if (!this.disabled) this.open = true;\n }\n\n /** Hides the tooltip. */\n hide(): void {\n clearTimeout(this.#timer);\n this.open = false;\n }\n\n override updated(changed: PropertyValues<this>): void {\n const trigger = this.#trigger;\n if (trigger && changed.has('content')) {\n // Skip when the tooltip repeats the trigger's name (icon buttons), or it's read twice.\n const name = trigger.getAttribute('aria-label') ?? (trigger as HTMLElement & { label?: string }).label;\n if (this.content && this.content !== name) trigger.setAttribute('aria-description', this.content);\n else trigger.removeAttribute('aria-description');\n }\n const body = this.#body;\n if (!changed.has('open') || !body) return;\n\n if (this.open && trigger && !body.matches(':popover-open')) {\n body.showPopover();\n this.#cleanup = autoUpdate(trigger, body, () => positionFloating(trigger, body, this.placement, 6));\n } else if (!this.open && body.matches(':popover-open')) {\n body.hidePopover();\n this.#cleanup?.();\n this.#cleanup = undefined;\n }\n }\n\n #onPointerEnter = (): void => {\n clearTimeout(this.#timer);\n this.#timer = window.setTimeout(() => this.show(), this.delay);\n };\n\n #onFocusIn = (): void => this.show();\n\n #onLeave = (): void => this.hide();\n\n #onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape' && this.open) this.hide();\n };\n\n override render() {\n return html`\n <slot @slotchange=${() => this.requestUpdate('content')}></slot>\n <div class=\"body\" part=\"body\" popover=\"manual\" role=\"tooltip\">${this.content}</div>\n `;\n }\n}\n\ndefineElement('uf-tooltip', UfTooltip);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'uf-tooltip': UfTooltip;\n }\n}\n"
573
573
  },
574
- "tokens": "/* @unframed/tokens — generated by scripts/build.mjs, do not edit. */\n:root {\n --uf-palette-neutral-0: #ffffff;\n --uf-palette-neutral-50: #f7f6f9;\n --uf-palette-neutral-100: #efedf2;\n --uf-palette-neutral-200: #e1dfe6;\n --uf-palette-neutral-300: #c9c6d1;\n --uf-palette-neutral-400: #a29eae;\n --uf-palette-neutral-500: #7c778a;\n --uf-palette-neutral-600: #5d586b;\n --uf-palette-neutral-700: #464155;\n --uf-palette-neutral-750: #373442;\n --uf-palette-neutral-800: #302d38;\n --uf-palette-neutral-825: #28262e;\n --uf-palette-neutral-850: #212026;\n --uf-palette-neutral-900: #19191c;\n --uf-palette-neutral-925: #111312;\n --uf-palette-neutral-950: #0a0b08;\n --uf-palette-accent-50: #f3eefb;\n --uf-palette-accent-100: #e5dbf6;\n --uf-palette-accent-200: #cbb7ee;\n --uf-palette-accent-300: #ad8fe3;\n --uf-palette-accent-400: #9067d6;\n --uf-palette-accent-500: #7b47cc;\n --uf-palette-accent-600: #6930c3;\n --uf-palette-accent-700: #5726a3;\n --uf-palette-accent-800: #461f83;\n --uf-palette-accent-900: #361865;\n --uf-palette-accent-950: #1f0e3b;\n --uf-palette-danger-50: #fcedf0;\n --uf-palette-danger-100: #f8d3db;\n --uf-palette-danger-200: #f0a8b8;\n --uf-palette-danger-300: #e57d93;\n --uf-palette-danger-400: #d4566f;\n --uf-palette-danger-500: #b13650;\n --uf-palette-danger-600: #7c162e;\n --uf-palette-danger-700: #661126;\n --uf-palette-danger-800: #510d1e;\n --uf-palette-danger-900: #3d0a17;\n --uf-palette-danger-950: #24050d;\n --uf-palette-success-50: #f0fdf4;\n --uf-palette-success-100: #dcfce7;\n --uf-palette-success-400: #4ade80;\n --uf-palette-success-500: #22c55e;\n --uf-palette-success-600: #16a34a;\n --uf-palette-success-700: #15803d;\n --uf-palette-success-800: #166534;\n --uf-palette-success-950: #052e16;\n --uf-palette-warning-50: #fffbeb;\n --uf-palette-warning-100: #fef3c7;\n --uf-palette-warning-400: #fbbf24;\n --uf-palette-warning-500: #f59e0b;\n --uf-palette-warning-600: #d97706;\n --uf-palette-warning-700: #b45309;\n --uf-palette-warning-800: #92400e;\n --uf-palette-warning-950: #451a03;\n --uf-palette-info-50: #eef2fc;\n --uf-palette-info-100: #dbe3f8;\n --uf-palette-info-300: #93a8e6;\n --uf-palette-info-400: #6f88db;\n --uf-palette-info-600: #4763c9;\n --uf-palette-info-700: #3a51a8;\n --uf-palette-info-950: #121a36;\n --uf-palette-signal-blue: #4763c9;\n --uf-palette-signal-green: #1f7a66;\n --uf-palette-signal-orange: #f2a65a;\n --uf-palette-signal-orange-ink: #1b1407;\n --uf-font-family-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;\n --uf-font-family-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;\n --uf-font-size-sm: 0.8125rem;\n --uf-font-size-md: 0.875rem;\n --uf-font-size-lg: 1rem;\n --uf-font-weight-regular: 400;\n --uf-font-weight-medium: 500;\n --uf-font-weight-semibold: 600;\n --uf-radius-sm: 4px;\n --uf-radius-md: 8px;\n --uf-radius-lg: 12px;\n --uf-radius-full: 9999px;\n --uf-radius-control: 0px;\n --uf-space-1: 0.25rem;\n --uf-space-2: 0.5rem;\n --uf-space-3: 0.75rem;\n --uf-space-4: 1rem;\n --uf-space-5: 1.25rem;\n --uf-space-6: 1.5rem;\n --uf-size-control-sm: 2rem;\n --uf-size-control-md: 2.5rem;\n --uf-size-control-lg: 3rem;\n --uf-focus-ring-width: 2px;\n --uf-focus-ring-offset: 2px;\n --uf-duration-fast: 120ms;\n --uf-duration-base: 200ms;\n --uf-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.06);\n --uf-shadow-md: 0 4px 12px rgb(0 0 0 / 0.10), 0 1px 3px rgb(0 0 0 / 0.08);\n --uf-shadow-lg: 0 16px 40px rgb(0 0 0 / 0.18), 0 4px 12px rgb(0 0 0 / 0.10);\n}\n\n:root,\n[data-uf-theme='light'] {\n color-scheme: light;\n --uf-color-surface: var(--uf-palette-neutral-0);\n --uf-color-surface-raised: var(--uf-palette-neutral-50);\n --uf-color-surface-overlay: var(--uf-palette-neutral-0);\n --uf-color-surface-hover: var(--uf-palette-neutral-100);\n --uf-color-surface-active: var(--uf-palette-neutral-200);\n --uf-color-text: var(--uf-palette-neutral-925);\n --uf-color-text-muted: var(--uf-palette-neutral-600);\n --uf-color-border: var(--uf-palette-neutral-200);\n --uf-color-border-strong: var(--uf-palette-neutral-500);\n --uf-color-accent: var(--uf-palette-accent-600);\n --uf-color-accent-hover: var(--uf-palette-accent-700);\n --uf-color-accent-active: var(--uf-palette-accent-800);\n --uf-color-accent-strong: var(--uf-palette-accent-600);\n --uf-color-accent-subtle: var(--uf-palette-accent-50);\n --uf-color-on-accent: var(--uf-palette-neutral-0);\n --uf-color-accent-tint: var(--uf-palette-accent-100);\n --uf-color-accent-tint-hover: var(--uf-palette-accent-200);\n --uf-color-accent-tint-active: var(--uf-palette-accent-300);\n --uf-color-on-accent-tint: var(--uf-palette-accent-900);\n --uf-color-neutral-fill: var(--uf-palette-neutral-100);\n --uf-color-danger: var(--uf-palette-danger-500);\n --uf-color-danger-hover: var(--uf-palette-danger-600);\n --uf-color-danger-subtle: var(--uf-palette-danger-50);\n --uf-color-danger-text: var(--uf-palette-danger-500);\n --uf-color-on-danger: var(--uf-palette-neutral-0);\n --uf-color-success: var(--uf-palette-success-700);\n --uf-color-success-subtle: var(--uf-palette-success-50);\n --uf-color-warning: var(--uf-palette-warning-700);\n --uf-color-warning-subtle: var(--uf-palette-warning-50);\n --uf-color-info: var(--uf-palette-info-700);\n --uf-color-info-subtle: var(--uf-palette-info-50);\n --uf-color-focus-ring: var(--uf-palette-accent-600);\n --uf-color-backdrop: var(--uf-palette-neutral-950);\n --uf-color-toast-neutral-bg: var(--uf-palette-neutral-800);\n --uf-color-toast-neutral-border: var(--uf-palette-neutral-800);\n --uf-color-toast-neutral-text: var(--uf-palette-neutral-0);\n --uf-color-toast-info-bg: var(--uf-palette-signal-blue);\n --uf-color-toast-info-border: var(--uf-palette-signal-blue);\n --uf-color-toast-info-text: var(--uf-palette-neutral-0);\n --uf-color-toast-success-bg: var(--uf-palette-signal-green);\n --uf-color-toast-success-border: var(--uf-palette-signal-green);\n --uf-color-toast-success-text: var(--uf-palette-neutral-0);\n --uf-color-toast-warning-bg: var(--uf-palette-signal-orange);\n --uf-color-toast-warning-border: var(--uf-palette-signal-orange);\n --uf-color-toast-warning-text: var(--uf-palette-signal-orange-ink);\n --uf-color-toast-danger-bg: var(--uf-palette-danger-500);\n --uf-color-toast-danger-border: var(--uf-palette-danger-500);\n --uf-color-toast-danger-text: var(--uf-palette-neutral-0);\n --uf-shadow-raised: var(--uf-shadow-md);\n --uf-shadow-overlay: var(--uf-shadow-md);\n --uf-shadow-modal: var(--uf-shadow-lg);\n}\n\n[data-uf-theme='dark'] {\n color-scheme: dark;\n --uf-color-surface: var(--uf-palette-neutral-950);\n --uf-color-surface-raised: var(--uf-palette-neutral-925);\n --uf-color-surface-overlay: var(--uf-palette-neutral-900);\n --uf-color-surface-hover: var(--uf-palette-neutral-850);\n --uf-color-surface-active: var(--uf-palette-neutral-825);\n --uf-color-text: var(--uf-palette-neutral-50);\n --uf-color-text-muted: var(--uf-palette-neutral-400);\n --uf-color-border: var(--uf-palette-neutral-825);\n --uf-color-border-strong: var(--uf-palette-neutral-500);\n --uf-color-accent: var(--uf-palette-accent-600);\n --uf-color-accent-hover: var(--uf-palette-accent-500);\n --uf-color-accent-active: var(--uf-palette-accent-700);\n --uf-color-accent-strong: var(--uf-palette-accent-300);\n --uf-color-accent-subtle: var(--uf-palette-accent-950);\n --uf-color-on-accent: var(--uf-palette-neutral-0);\n --uf-color-accent-tint: var(--uf-palette-accent-800);\n --uf-color-accent-tint-hover: var(--uf-palette-accent-700);\n --uf-color-accent-tint-active: var(--uf-palette-accent-900);\n --uf-color-on-accent-tint: var(--uf-palette-accent-200);\n --uf-color-neutral-fill: var(--uf-palette-neutral-800);\n --uf-color-danger: var(--uf-palette-danger-600);\n --uf-color-danger-hover: var(--uf-palette-danger-500);\n --uf-color-danger-subtle: var(--uf-palette-danger-950);\n --uf-color-danger-text: var(--uf-palette-danger-300);\n --uf-color-on-danger: var(--uf-palette-neutral-0);\n --uf-color-success: var(--uf-palette-success-400);\n --uf-color-success-subtle: var(--uf-palette-success-950);\n --uf-color-warning: var(--uf-palette-warning-400);\n --uf-color-warning-subtle: var(--uf-palette-warning-950);\n --uf-color-info: var(--uf-palette-info-300);\n --uf-color-info-subtle: var(--uf-palette-info-950);\n --uf-color-focus-ring: var(--uf-palette-accent-400);\n --uf-color-backdrop: var(--uf-palette-neutral-950);\n --uf-color-toast-neutral-bg: var(--uf-palette-neutral-750);\n --uf-color-toast-neutral-border: var(--uf-palette-neutral-700);\n --uf-color-toast-neutral-text: var(--uf-palette-neutral-0);\n --uf-color-toast-info-bg: var(--uf-palette-signal-blue);\n --uf-color-toast-info-border: var(--uf-palette-signal-blue);\n --uf-color-toast-info-text: var(--uf-palette-neutral-0);\n --uf-color-toast-success-bg: var(--uf-palette-signal-green);\n --uf-color-toast-success-border: var(--uf-palette-signal-green);\n --uf-color-toast-success-text: var(--uf-palette-neutral-0);\n --uf-color-toast-warning-bg: var(--uf-palette-signal-orange);\n --uf-color-toast-warning-border: var(--uf-palette-signal-orange);\n --uf-color-toast-warning-text: var(--uf-palette-signal-orange-ink);\n --uf-color-toast-danger-bg: var(--uf-palette-danger-600);\n --uf-color-toast-danger-border: var(--uf-palette-danger-600);\n --uf-color-toast-danger-text: var(--uf-palette-neutral-0);\n --uf-shadow-raised: 0 0 0 1px color-mix(in srgb, var(--uf-palette-accent-400) 30%, transparent), 0 12px 32px -8px color-mix(in srgb, var(--uf-palette-accent-600) 55%, transparent);\n --uf-shadow-overlay: 0 0 0 1px color-mix(in srgb, var(--uf-palette-accent-400) 25%, transparent), 0 8px 24px -6px color-mix(in srgb, var(--uf-palette-accent-600) 50%, transparent);\n --uf-shadow-modal: 0 0 0 1px color-mix(in srgb, var(--uf-palette-accent-400) 30%, transparent), 0 24px 64px -12px color-mix(in srgb, var(--uf-palette-accent-600) 60%, transparent);\n}\n\n@media (prefers-color-scheme: dark) {\n :root:not([data-uf-theme='light']) {\n color-scheme: dark;\n --uf-color-surface: var(--uf-palette-neutral-950);\n --uf-color-surface-raised: var(--uf-palette-neutral-925);\n --uf-color-surface-overlay: var(--uf-palette-neutral-900);\n --uf-color-surface-hover: var(--uf-palette-neutral-850);\n --uf-color-surface-active: var(--uf-palette-neutral-825);\n --uf-color-text: var(--uf-palette-neutral-50);\n --uf-color-text-muted: var(--uf-palette-neutral-400);\n --uf-color-border: var(--uf-palette-neutral-825);\n --uf-color-border-strong: var(--uf-palette-neutral-500);\n --uf-color-accent: var(--uf-palette-accent-600);\n --uf-color-accent-hover: var(--uf-palette-accent-500);\n --uf-color-accent-active: var(--uf-palette-accent-700);\n --uf-color-accent-strong: var(--uf-palette-accent-300);\n --uf-color-accent-subtle: var(--uf-palette-accent-950);\n --uf-color-on-accent: var(--uf-palette-neutral-0);\n --uf-color-accent-tint: var(--uf-palette-accent-800);\n --uf-color-accent-tint-hover: var(--uf-palette-accent-700);\n --uf-color-accent-tint-active: var(--uf-palette-accent-900);\n --uf-color-on-accent-tint: var(--uf-palette-accent-200);\n --uf-color-neutral-fill: var(--uf-palette-neutral-800);\n --uf-color-danger: var(--uf-palette-danger-600);\n --uf-color-danger-hover: var(--uf-palette-danger-500);\n --uf-color-danger-subtle: var(--uf-palette-danger-950);\n --uf-color-danger-text: var(--uf-palette-danger-300);\n --uf-color-on-danger: var(--uf-palette-neutral-0);\n --uf-color-success: var(--uf-palette-success-400);\n --uf-color-success-subtle: var(--uf-palette-success-950);\n --uf-color-warning: var(--uf-palette-warning-400);\n --uf-color-warning-subtle: var(--uf-palette-warning-950);\n --uf-color-info: var(--uf-palette-info-300);\n --uf-color-info-subtle: var(--uf-palette-info-950);\n --uf-color-focus-ring: var(--uf-palette-accent-400);\n --uf-color-backdrop: var(--uf-palette-neutral-950);\n --uf-color-toast-neutral-bg: var(--uf-palette-neutral-750);\n --uf-color-toast-neutral-border: var(--uf-palette-neutral-700);\n --uf-color-toast-neutral-text: var(--uf-palette-neutral-0);\n --uf-color-toast-info-bg: var(--uf-palette-signal-blue);\n --uf-color-toast-info-border: var(--uf-palette-signal-blue);\n --uf-color-toast-info-text: var(--uf-palette-neutral-0);\n --uf-color-toast-success-bg: var(--uf-palette-signal-green);\n --uf-color-toast-success-border: var(--uf-palette-signal-green);\n --uf-color-toast-success-text: var(--uf-palette-neutral-0);\n --uf-color-toast-warning-bg: var(--uf-palette-signal-orange);\n --uf-color-toast-warning-border: var(--uf-palette-signal-orange);\n --uf-color-toast-warning-text: var(--uf-palette-signal-orange-ink);\n --uf-color-toast-danger-bg: var(--uf-palette-danger-600);\n --uf-color-toast-danger-border: var(--uf-palette-danger-600);\n --uf-color-toast-danger-text: var(--uf-palette-neutral-0);\n --uf-shadow-raised: 0 0 0 1px color-mix(in srgb, var(--uf-palette-accent-400) 30%, transparent), 0 12px 32px -8px color-mix(in srgb, var(--uf-palette-accent-600) 55%, transparent);\n --uf-shadow-overlay: 0 0 0 1px color-mix(in srgb, var(--uf-palette-accent-400) 25%, transparent), 0 8px 24px -6px color-mix(in srgb, var(--uf-palette-accent-600) 50%, transparent);\n --uf-shadow-modal: 0 0 0 1px color-mix(in srgb, var(--uf-palette-accent-400) 30%, transparent), 0 24px 64px -12px color-mix(in srgb, var(--uf-palette-accent-600) 60%, transparent);\n }\n}\n"
574
+ "tokens": "/* @unframed/tokens — generated by scripts/build.mjs, do not edit. */\n:root {\n --uf-palette-neutral-0: #ffffff;\n --uf-palette-neutral-50: #f7f6f9;\n --uf-palette-neutral-100: #efedf2;\n --uf-palette-neutral-200: #e1dfe6;\n --uf-palette-neutral-300: #c9c6d1;\n --uf-palette-neutral-400: #a29eae;\n --uf-palette-neutral-500: #7c778a;\n --uf-palette-neutral-600: #5d586b;\n --uf-palette-neutral-700: #464155;\n --uf-palette-neutral-750: #373442;\n --uf-palette-neutral-800: #302d38;\n --uf-palette-neutral-825: #28262e;\n --uf-palette-neutral-850: #212026;\n --uf-palette-neutral-900: #19191c;\n --uf-palette-neutral-925: #111312;\n --uf-palette-neutral-950: #0a0b08;\n --uf-palette-accent-50: #f3eefb;\n --uf-palette-accent-100: #e5dbf6;\n --uf-palette-accent-200: #cbb7ee;\n --uf-palette-accent-300: #ad8fe3;\n --uf-palette-accent-400: #9067d6;\n --uf-palette-accent-500: #7b47cc;\n --uf-palette-accent-600: #6930c3;\n --uf-palette-accent-700: #5726a3;\n --uf-palette-accent-800: #461f83;\n --uf-palette-accent-900: #361865;\n --uf-palette-accent-950: #1f0e3b;\n --uf-palette-danger-50: #fcedf0;\n --uf-palette-danger-100: #f8d3db;\n --uf-palette-danger-200: #f0a8b8;\n --uf-palette-danger-300: #e57d93;\n --uf-palette-danger-400: #d4566f;\n --uf-palette-danger-500: #b13650;\n --uf-palette-danger-600: #7c162e;\n --uf-palette-danger-700: #661126;\n --uf-palette-danger-800: #510d1e;\n --uf-palette-danger-900: #3d0a17;\n --uf-palette-danger-950: #24050d;\n --uf-palette-success-50: #f0fdf4;\n --uf-palette-success-100: #dcfce7;\n --uf-palette-success-400: #4ade80;\n --uf-palette-success-500: #22c55e;\n --uf-palette-success-600: #16a34a;\n --uf-palette-success-700: #15803d;\n --uf-palette-success-800: #166534;\n --uf-palette-success-950: #052e16;\n --uf-palette-warning-50: #fffbeb;\n --uf-palette-warning-100: #fef3c7;\n --uf-palette-warning-400: #fbbf24;\n --uf-palette-warning-500: #f59e0b;\n --uf-palette-warning-600: #d97706;\n --uf-palette-warning-700: #b45309;\n --uf-palette-warning-800: #92400e;\n --uf-palette-warning-950: #451a03;\n --uf-palette-info-50: #eef2fc;\n --uf-palette-info-100: #dbe3f8;\n --uf-palette-info-300: #93a8e6;\n --uf-palette-info-400: #6f88db;\n --uf-palette-info-600: #4763c9;\n --uf-palette-info-700: #3a51a8;\n --uf-palette-info-950: #121a36;\n --uf-palette-signal-blue: #4763c9;\n --uf-palette-signal-green: #1f7a66;\n --uf-palette-signal-orange: #f2a65a;\n --uf-palette-signal-orange-ink: #1b1407;\n --uf-font-family-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;\n --uf-font-family-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;\n --uf-font-size-sm: 0.8125rem;\n --uf-font-size-md: 0.875rem;\n --uf-font-size-lg: 1rem;\n --uf-font-weight-regular: 400;\n --uf-font-weight-medium: 500;\n --uf-font-weight-semibold: 600;\n --uf-radius-sm: 4px;\n --uf-radius-md: 8px;\n --uf-radius-lg: 12px;\n --uf-radius-full: 9999px;\n --uf-radius-control: 0px;\n --uf-space-1: 0.25rem;\n --uf-space-2: 0.5rem;\n --uf-space-3: 0.75rem;\n --uf-space-4: 1rem;\n --uf-space-5: 1.25rem;\n --uf-space-6: 1.5rem;\n --uf-size-control-sm: 2rem;\n --uf-size-control-md: 2.5rem;\n --uf-size-control-lg: 3rem;\n --uf-focus-ring-width: 2px;\n --uf-focus-ring-offset: 2px;\n --uf-duration-fast: 120ms;\n --uf-duration-base: 200ms;\n --uf-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.06);\n --uf-shadow-md: 0 4px 12px rgb(0 0 0 / 0.10), 0 1px 3px rgb(0 0 0 / 0.08);\n --uf-shadow-lg: 0 16px 40px rgb(0 0 0 / 0.18), 0 4px 12px rgb(0 0 0 / 0.10);\n}\n\n:root,\n[data-uf-theme='light'] {\n color-scheme: light;\n --uf-color-surface: var(--uf-palette-neutral-0);\n --uf-color-surface-raised: var(--uf-palette-neutral-50);\n --uf-color-surface-overlay: var(--uf-palette-neutral-0);\n --uf-color-surface-hover: var(--uf-palette-neutral-100);\n --uf-color-surface-active: var(--uf-palette-neutral-200);\n --uf-color-text: var(--uf-palette-neutral-925);\n --uf-color-text-muted: var(--uf-palette-neutral-600);\n --uf-color-border: var(--uf-palette-neutral-200);\n --uf-color-border-strong: var(--uf-palette-neutral-500);\n --uf-color-accent: var(--uf-palette-accent-600);\n --uf-color-accent-hover: var(--uf-palette-accent-700);\n --uf-color-accent-active: var(--uf-palette-accent-800);\n --uf-color-accent-strong: var(--uf-palette-accent-600);\n --uf-color-accent-subtle: var(--uf-palette-accent-50);\n --uf-color-on-accent: var(--uf-palette-neutral-0);\n --uf-color-accent-tint: var(--uf-palette-accent-100);\n --uf-color-accent-tint-hover: var(--uf-palette-accent-200);\n --uf-color-accent-tint-active: var(--uf-palette-accent-300);\n --uf-color-on-accent-tint: var(--uf-palette-accent-900);\n --uf-color-neutral-fill: var(--uf-palette-neutral-100);\n --uf-color-danger: var(--uf-palette-danger-500);\n --uf-color-danger-hover: var(--uf-palette-danger-600);\n --uf-color-danger-subtle: var(--uf-palette-danger-50);\n --uf-color-danger-text: var(--uf-palette-danger-500);\n --uf-color-on-danger: var(--uf-palette-neutral-0);\n --uf-color-success: var(--uf-palette-success-700);\n --uf-color-success-subtle: var(--uf-palette-success-50);\n --uf-color-warning: var(--uf-palette-warning-700);\n --uf-color-warning-subtle: var(--uf-palette-warning-50);\n --uf-color-info: var(--uf-palette-info-700);\n --uf-color-info-subtle: var(--uf-palette-info-50);\n --uf-color-focus-ring: var(--uf-palette-accent-600);\n --uf-color-backdrop: var(--uf-palette-neutral-950);\n --uf-color-toast-neutral-bg: var(--uf-palette-neutral-800);\n --uf-color-toast-neutral-border: var(--uf-palette-neutral-800);\n --uf-color-toast-neutral-text: var(--uf-palette-neutral-0);\n --uf-color-toast-info-bg: var(--uf-palette-signal-blue);\n --uf-color-toast-info-border: var(--uf-palette-signal-blue);\n --uf-color-toast-info-text: var(--uf-palette-neutral-0);\n --uf-color-toast-success-bg: var(--uf-palette-signal-green);\n --uf-color-toast-success-border: var(--uf-palette-signal-green);\n --uf-color-toast-success-text: var(--uf-palette-neutral-0);\n --uf-color-toast-warning-bg: var(--uf-palette-signal-orange);\n --uf-color-toast-warning-border: var(--uf-palette-signal-orange);\n --uf-color-toast-warning-text: var(--uf-palette-signal-orange-ink);\n --uf-color-toast-danger-bg: var(--uf-palette-danger-500);\n --uf-color-toast-danger-border: var(--uf-palette-danger-500);\n --uf-color-toast-danger-text: var(--uf-palette-neutral-0);\n --uf-shadow-raised: var(--uf-shadow-md);\n --uf-shadow-overlay: var(--uf-shadow-md);\n --uf-shadow-modal: var(--uf-shadow-lg);\n}\n\n[data-uf-theme='dark'] {\n color-scheme: dark;\n --uf-color-surface: var(--uf-palette-neutral-950);\n --uf-color-surface-raised: var(--uf-palette-neutral-925);\n --uf-color-surface-overlay: var(--uf-palette-neutral-900);\n --uf-color-surface-hover: var(--uf-palette-neutral-850);\n --uf-color-surface-active: var(--uf-palette-neutral-825);\n --uf-color-text: var(--uf-palette-neutral-50);\n --uf-color-text-muted: var(--uf-palette-neutral-400);\n --uf-color-border: var(--uf-palette-neutral-825);\n --uf-color-border-strong: var(--uf-palette-neutral-500);\n --uf-color-accent: var(--uf-palette-accent-600);\n --uf-color-accent-hover: var(--uf-palette-accent-500);\n --uf-color-accent-active: var(--uf-palette-accent-700);\n --uf-color-accent-strong: var(--uf-palette-accent-300);\n --uf-color-accent-subtle: var(--uf-palette-accent-950);\n --uf-color-on-accent: var(--uf-palette-neutral-0);\n --uf-color-accent-tint: var(--uf-palette-accent-800);\n --uf-color-accent-tint-hover: var(--uf-palette-accent-700);\n --uf-color-accent-tint-active: var(--uf-palette-accent-900);\n --uf-color-on-accent-tint: var(--uf-palette-accent-200);\n --uf-color-neutral-fill: var(--uf-palette-neutral-800);\n --uf-color-danger: var(--uf-palette-danger-600);\n --uf-color-danger-hover: var(--uf-palette-danger-500);\n --uf-color-danger-subtle: var(--uf-palette-danger-950);\n --uf-color-danger-text: var(--uf-palette-danger-300);\n --uf-color-on-danger: var(--uf-palette-neutral-0);\n --uf-color-success: var(--uf-palette-success-400);\n --uf-color-success-subtle: var(--uf-palette-success-950);\n --uf-color-warning: var(--uf-palette-warning-400);\n --uf-color-warning-subtle: var(--uf-palette-warning-950);\n --uf-color-info: var(--uf-palette-info-300);\n --uf-color-info-subtle: var(--uf-palette-info-950);\n --uf-color-focus-ring: var(--uf-palette-accent-400);\n --uf-color-backdrop: var(--uf-palette-neutral-950);\n --uf-color-toast-neutral-bg: var(--uf-palette-neutral-750);\n --uf-color-toast-neutral-border: var(--uf-palette-neutral-700);\n --uf-color-toast-neutral-text: var(--uf-palette-neutral-0);\n --uf-color-toast-info-bg: var(--uf-palette-signal-blue);\n --uf-color-toast-info-border: var(--uf-palette-signal-blue);\n --uf-color-toast-info-text: var(--uf-palette-neutral-0);\n --uf-color-toast-success-bg: var(--uf-palette-signal-green);\n --uf-color-toast-success-border: var(--uf-palette-signal-green);\n --uf-color-toast-success-text: var(--uf-palette-neutral-0);\n --uf-color-toast-warning-bg: var(--uf-palette-signal-orange);\n --uf-color-toast-warning-border: var(--uf-palette-signal-orange);\n --uf-color-toast-warning-text: var(--uf-palette-signal-orange-ink);\n --uf-color-toast-danger-bg: var(--uf-palette-danger-600);\n --uf-color-toast-danger-border: var(--uf-palette-danger-600);\n --uf-color-toast-danger-text: var(--uf-palette-neutral-0);\n --uf-shadow-raised: 0 0 0 1px color-mix(in srgb, var(--uf-palette-accent-400) 30%, transparent), 0 12px 32px -8px color-mix(in srgb, var(--uf-palette-accent-600) 55%, transparent);\n --uf-shadow-overlay: 0 0 0 1px color-mix(in srgb, var(--uf-palette-accent-400) 25%, transparent), 0 8px 24px -6px color-mix(in srgb, var(--uf-palette-accent-600) 50%, transparent);\n --uf-shadow-modal: 0 0 0 1px color-mix(in srgb, var(--uf-palette-accent-400) 30%, transparent), 0 24px 64px -12px color-mix(in srgb, var(--uf-palette-accent-600) 60%, transparent);\n}\n\n@media (prefers-color-scheme: dark) {\n :root:not([data-uf-theme='light']) {\n color-scheme: dark;\n --uf-color-surface: var(--uf-palette-neutral-950);\n --uf-color-surface-raised: var(--uf-palette-neutral-925);\n --uf-color-surface-overlay: var(--uf-palette-neutral-900);\n --uf-color-surface-hover: var(--uf-palette-neutral-850);\n --uf-color-surface-active: var(--uf-palette-neutral-825);\n --uf-color-text: var(--uf-palette-neutral-50);\n --uf-color-text-muted: var(--uf-palette-neutral-400);\n --uf-color-border: var(--uf-palette-neutral-825);\n --uf-color-border-strong: var(--uf-palette-neutral-500);\n --uf-color-accent: var(--uf-palette-accent-600);\n --uf-color-accent-hover: var(--uf-palette-accent-500);\n --uf-color-accent-active: var(--uf-palette-accent-700);\n --uf-color-accent-strong: var(--uf-palette-accent-300);\n --uf-color-accent-subtle: var(--uf-palette-accent-950);\n --uf-color-on-accent: var(--uf-palette-neutral-0);\n --uf-color-accent-tint: var(--uf-palette-accent-800);\n --uf-color-accent-tint-hover: var(--uf-palette-accent-700);\n --uf-color-accent-tint-active: var(--uf-palette-accent-900);\n --uf-color-on-accent-tint: var(--uf-palette-accent-200);\n --uf-color-neutral-fill: var(--uf-palette-neutral-800);\n --uf-color-danger: var(--uf-palette-danger-600);\n --uf-color-danger-hover: var(--uf-palette-danger-500);\n --uf-color-danger-subtle: var(--uf-palette-danger-950);\n --uf-color-danger-text: var(--uf-palette-danger-300);\n --uf-color-on-danger: var(--uf-palette-neutral-0);\n --uf-color-success: var(--uf-palette-success-400);\n --uf-color-success-subtle: var(--uf-palette-success-950);\n --uf-color-warning: var(--uf-palette-warning-400);\n --uf-color-warning-subtle: var(--uf-palette-warning-950);\n --uf-color-info: var(--uf-palette-info-300);\n --uf-color-info-subtle: var(--uf-palette-info-950);\n --uf-color-focus-ring: var(--uf-palette-accent-400);\n --uf-color-backdrop: var(--uf-palette-neutral-950);\n --uf-color-toast-neutral-bg: var(--uf-palette-neutral-750);\n --uf-color-toast-neutral-border: var(--uf-palette-neutral-700);\n --uf-color-toast-neutral-text: var(--uf-palette-neutral-0);\n --uf-color-toast-info-bg: var(--uf-palette-signal-blue);\n --uf-color-toast-info-border: var(--uf-palette-signal-blue);\n --uf-color-toast-info-text: var(--uf-palette-neutral-0);\n --uf-color-toast-success-bg: var(--uf-palette-signal-green);\n --uf-color-toast-success-border: var(--uf-palette-signal-green);\n --uf-color-toast-success-text: var(--uf-palette-neutral-0);\n --uf-color-toast-warning-bg: var(--uf-palette-signal-orange);\n --uf-color-toast-warning-border: var(--uf-palette-signal-orange);\n --uf-color-toast-warning-text: var(--uf-palette-signal-orange-ink);\n --uf-color-toast-danger-bg: var(--uf-palette-danger-600);\n --uf-color-toast-danger-border: var(--uf-palette-danger-600);\n --uf-color-toast-danger-text: var(--uf-palette-neutral-0);\n --uf-shadow-raised: 0 0 0 1px color-mix(in srgb, var(--uf-palette-accent-400) 30%, transparent), 0 12px 32px -8px color-mix(in srgb, var(--uf-palette-accent-600) 55%, transparent);\n --uf-shadow-overlay: 0 0 0 1px color-mix(in srgb, var(--uf-palette-accent-400) 25%, transparent), 0 8px 24px -6px color-mix(in srgb, var(--uf-palette-accent-600) 50%, transparent);\n --uf-shadow-modal: 0 0 0 1px color-mix(in srgb, var(--uf-palette-accent-400) 30%, transparent), 0 24px 64px -12px color-mix(in srgb, var(--uf-palette-accent-600) 60%, transparent);\n }\n}\n\n/* Before the components load: no flash of raw content on server-rendered pages. */\n:where(uf-accordion, uf-accordion-item, uf-avatar, uf-badge, uf-button, uf-calendar, uf-card, uf-checkbox, uf-checkbox-group, uf-combobox, uf-date-picker, uf-dialog, uf-dropdown, uf-icon, uf-input, uf-menu, uf-menu-item, uf-pagination, uf-popover, uf-radio, uf-radio-group, uf-select, uf-switch, uf-tab, uf-tab-panel, uf-table, uf-tabs, uf-textarea, uf-toaster, uf-tooltip):not(:defined) {\n visibility: hidden;\n}\n\n:where(uf-dialog, uf-toaster, uf-tab-panel):not(:defined),\n:where(uf-dropdown, uf-popover):not(:defined) > :not([slot]),\n:where(uf-select, uf-combobox):not(:defined) > :where(option, optgroup),\nuf-accordion-item:not(:defined):not([open]) > :not([slot]) {\n display: none;\n}\n"
575
575
  }
@@ -5,7 +5,7 @@ description: Builds UI with Unframed web components (@unframed/core, @unframed/r
5
5
 
6
6
  # Unframed UI
7
7
 
8
- Unframed 0.6.1: accessible UI components as standard custom elements (Lit). Every tag starts with `uf-`. They work in plain HTML and every framework; React, Vue and Angular have wrapper packages for typed props, events and form bindings.
8
+ Unframed 0.7.0: accessible UI components as standard custom elements (Lit). Every tag starts with `uf-`. They work in plain HTML and every framework; React, Vue and Angular have wrapper packages for typed props, events and form bindings.
9
9
 
10
10
  ## Before writing code
11
11
 
@@ -26,6 +26,7 @@ Unframed 0.6.1: accessible UI components as standard custom elements (Lit). Ever
26
26
  - **Dialogs.** Open with `open` or `.show()`; any child with `data-dialog="close"` closes it; cancel a close in `uf-request-close` with `preventDefault()`.
27
27
  - **Toasts.** `import { toast } from '@unframed/core'` and call `toast('Saved', { variant: 'success' })`; no element needed.
28
28
  - **Theming.** Change colors and shapes with `--uf-*` custom properties (global tokens, then per-component ones like `--uf-button-radius`), then `::part()`. Don't style internals any other way, and don't re-implement a component that exists. See [references/theming.md](references/theming.md).
29
+ - **Server-side rendering.** Works in Next.js, Nuxt and Angular SSR with no extra setup. In the Next.js App Router, `@unframed/react` components are client components already: use them in server components, and put event handlers and state in a `'use client'` file. Don't wrap them in `dynamic(..., { ssr: false })` or client-only guards.
29
30
  - **Translations.** Built-in texts (dialog close button, "No results", pagination labels, a few error messages) are English. Italian, French, German, Spanish and Portuguese are built in: `import it from '@unframed/core/locales/it'; setTranslations(it, 'it')` (codes `it`, `fr`, `de`, `es`, `pt`), once at startup. For other languages, pass the texts yourself: `setTranslations({ close: 'Zamknij', page: 'Strona {page}' }, 'pl')`; components follow the nearest `lang` attribute. Don't add `aria-label`s to override them.
30
31
  - **Dark mode** follows the OS; force it with `data-uf-theme="dark"` (or `"light"`) on any element.
31
32
 
@@ -1,4 +1,4 @@
1
- # Unframed 0.6.1 components
1
+ # Unframed 0.7.0 components
2
2
 
3
3
  ## Accordion
4
4
 
@@ -1,4 +1,4 @@
1
- # Using Unframed 0.6.1 in each framework
1
+ # Using Unframed 0.7.0 in each framework
2
2
 
3
3
  ## HTML & JavaScript
4
4
 
@@ -68,8 +68,8 @@ dialog.addEventListener('uf-hide', () => toast('Welcome aboard!', { variant: 'su
68
68
  <!doctype html>
69
69
  <html lang="en">
70
70
  <head>
71
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@unframed/tokens@0.2/dist/tokens.css" />
72
- <script type="module" src="https://cdn.jsdelivr.net/npm/@unframed/core@0.2/+esm"></script>
71
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@unframed/tokens@0.7/dist/tokens.css" />
72
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@unframed/core@0.7/+esm"></script>
73
73
  </head>
74
74
  <body>
75
75
  <uf-button variant="primary">It works</uf-button>