@f-ewald/components 1.46.0 → 1.47.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/README.md +1 -0
- package/custom-elements.json +4589 -2400
- package/dist/address-autocomplete.d.ts +9 -44
- package/dist/address-autocomplete.d.ts.map +1 -1
- package/dist/address-autocomplete.js +16 -597
- package/dist/address-autocomplete.js.map +1 -1
- package/dist/app-shell.d.ts.map +1 -1
- package/dist/app-shell.js +12 -5
- package/dist/app-shell.js.map +1 -1
- package/dist/autocomplete-base.d.ts +79 -0
- package/dist/autocomplete-base.d.ts.map +1 -0
- package/dist/autocomplete-base.js +679 -0
- package/dist/autocomplete-base.js.map +1 -0
- package/dist/autocomplete-input.d.ts +9 -44
- package/dist/autocomplete-input.d.ts.map +1 -1
- package/dist/autocomplete-input.js +18 -647
- package/dist/autocomplete-input.js.map +1 -1
- package/dist/calendar-day.d.ts +0 -2
- package/dist/calendar-day.d.ts.map +1 -1
- package/dist/calendar-day.js +3 -30
- package/dist/calendar-day.js.map +1 -1
- package/dist/calendar-month.d.ts +3 -2
- package/dist/calendar-month.d.ts.map +1 -1
- package/dist/calendar-month.js +5 -3
- package/dist/calendar-month.js.map +1 -1
- package/dist/calendar-timeline-base.d.ts +7 -2
- package/dist/calendar-timeline-base.d.ts.map +1 -1
- package/dist/calendar-timeline-base.js +35 -4
- package/dist/calendar-timeline-base.js.map +1 -1
- package/dist/calendar-week.d.ts +0 -2
- package/dist/calendar-week.d.ts.map +1 -1
- package/dist/calendar-week.js +5 -32
- package/dist/calendar-week.js.map +1 -1
- package/dist/cron-schedule.d.ts.map +1 -1
- package/dist/cron-schedule.js +4 -2
- package/dist/cron-schedule.js.map +1 -1
- package/dist/distribution-chart.d.ts +1 -0
- package/dist/distribution-chart.d.ts.map +1 -1
- package/dist/distribution-chart.js +23 -2
- package/dist/distribution-chart.js.map +1 -1
- package/dist/drop-zone.d.ts +78 -0
- package/dist/drop-zone.d.ts.map +1 -0
- package/dist/drop-zone.js +479 -0
- package/dist/drop-zone.js.map +1 -0
- package/dist/icons.d.ts +2 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +2 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.js +13 -10
- package/dist/mcp-server.js.map +1 -1
- package/dist/multi-select.d.ts.map +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/multi-select.js.map +1 -1
- package/dist/price-history-chart.d.ts.map +1 -1
- package/dist/price-history-chart.js +12 -7
- package/dist/price-history-chart.js.map +1 -1
- package/dist/range-slider.d.ts.map +1 -1
- package/dist/range-slider.js +1 -1
- package/dist/range-slider.js.map +1 -1
- package/dist/ui-checkbox.d.ts.map +1 -1
- package/dist/ui-checkbox.js +1 -1
- package/dist/ui-checkbox.js.map +1 -1
- package/dist/utils/calendar.d.ts +19 -1
- package/dist/utils/calendar.d.ts.map +1 -1
- package/dist/utils/calendar.js +34 -2
- package/dist/utils/calendar.js.map +1 -1
- package/dist/utils/cron.d.ts.map +1 -1
- package/dist/utils/cron.js +19 -10
- package/dist/utils/cron.js.map +1 -1
- package/dist/utils/layer-stack.d.ts +2 -0
- package/dist/utils/layer-stack.d.ts.map +1 -1
- package/dist/utils/layer-stack.js +4 -0
- package/dist/utils/layer-stack.js.map +1 -1
- package/docs/address-autocomplete.md +7 -7
- package/docs/autocomplete-input.md +5 -5
- package/docs/drop-zone.md +87 -0
- package/docs/icons.md +1 -0
- package/llms.txt +42 -2
- package/package.json +1 -1
package/dist/multi-select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-select.js","sourceRoot":"","sources":["../src/multi-select.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,UAAU,EACV,GAAG,EACH,IAAI,EACJ,OAAO,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EA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AC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAA0C;AAMf;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;gDAAiB;AAOjB;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;8CAAmB;AAEvD;IAAhB,KAAK,EAAE;0CAAuB;AACd;IAAhB,KAAK,EAAE;iDAA2B;AAClB;IAAhB,KAAK,EAAE;2CAAsC;AAC7B;IAAhB,KAAK,EAAE;kDAA+B;AAjc5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAkrCvB","sourcesContent":["import {\n LitElement,\n css,\n html,\n nothing,\n type PropertyValues,\n type TemplateResult,\n} from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconCheckCircle, iconChevronRight, iconX } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nlet instanceCount = 0;\n\n/**\n * Presentation variant of {@link MultiSelect}.\n *\n * - `\"dropdown\"` (default): a compact trigger that opens a listbox popover.\n * - `\"list\"`: a persistently visible, bordered list surface with no popover.\n */\nexport type MultiSelectVariant = \"dropdown\" | \"list\";\n\n/** A single selectable option. */\nexport interface MultiSelectOption {\n value: string;\n label: string;\n /** Optional pre-rendered icon template displayed before the label. */\n icon?: TemplateResult;\n /** Square icon size in pixels. Defaults to 16 when `icon` is set. */\n iconSize?: number;\n /** When true, the option can neither be selected nor removed via the UI. */\n disabled?: boolean;\n}\n\n/**\n * A form-associated multi-select: a trigger showing a compact summary of the\n * current selection, opening a multi-selectable listbox popover, with an\n * optional removable-chip list of the chosen values. A drop-in generic\n * replacement for a native `<select multiple>` — set `name` on the element\n * itself and each\n * selected value is submitted as a repeated `name=value` entry, matching native\n * multiple-select semantics; `new FormData(form).getAll(name)` and\n * `form.reset()` work unchanged.\n *\n * The trigger visually follows `form-select`: a `2rem` field showing the\n * `placeholder` when empty, the single selected label when one value is chosen,\n * and `N selected` when several are. Set `show-chips` to additionally render\n * the selected values as compact chips below the trigger, each with an\n * accessible `32px` remove control; chips are off by default and the region\n * reserves no space while nothing is selected. Like `form-select`, the host is\n * `display: block` and fills its container by default; constrain the host\n * (`multi-select { display: inline-block; }`) to shrink it to its content\n * instead.\n *\n * Set `searchable` to replace the button trigger with an editable combobox that\n * infix-filters the predefined options by case-insensitive label. Typed text is\n * only a query: `values` changes exclusively when options are toggled, and an\n * uncommitted query is discarded when the list closes.\n *\n * The `variant` chooses between two presentations, and `searchable` applies to\n * both:\n *\n * - `\"dropdown\"` (default) is the popover form described above: a compact\n * trigger (button, or search combobox when `searchable`) that opens a\n * multi-selectable listbox on demand, closes on outside click / Escape, and\n * shows a chevron.\n * - `\"list\"` renders the options as a persistently visible, bordered surface\n * with no popover, no chevron, and no `open` host state; it never registers\n * outside-click listeners. Its scroll viewport is sized to roughly\n * `visibleRows` `2rem` rows (see `visible-rows`). When not `searchable` the\n * `listbox` itself is focusable and drives Arrow/Home/End/Enter/Space keyboard\n * navigation via `aria-activedescendant`; when `searchable` a `2rem` search\n * field sits above the list and owns navigation, and Escape only clears the\n * query instead of hiding the list.\n *\n * @element multi-select\n * @fires change - Fired with `{ values: string[] }` (a copied array) when a\n * value is added or removed through the UI. Programmatic `values` assignments\n * do not fire it.\n */\n@customElement(\"multi-select\")\nexport class MultiSelect extends LitElement {\n static formAssociated = true;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n position: relative;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n }\n .control {\n position: relative;\n }\n button.trigger {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.25rem;\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n }\n button.trigger:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n button.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n button.trigger:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .trigger-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .trigger-label.placeholder {\n color: var(--ui-text-muted, #64748b);\n }\n .search-trigger {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.25rem;\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: text;\n }\n .search-trigger:hover:not(.disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .search-trigger:not(.disabled):focus-within {\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .search-trigger.disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n input.search-input {\n min-width: 0;\n flex: 1;\n box-sizing: border-box;\n padding: 0.5rem 0 0.5rem 0.75rem;\n color: inherit;\n background: transparent;\n border: 0;\n outline: 0;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n input.search-input::placeholder {\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-medium, 500);\n opacity: 1;\n }\n .chevron {\n display: flex;\n flex: 0 0 auto;\n margin-right: 0.75rem;\n color: var(--ui-text-muted, #64748b);\n pointer-events: none;\n transform: rotate(90deg);\n transition: transform 150ms ease;\n }\n button.trigger .chevron {\n margin-right: 0;\n }\n :host([open]) .chevron {\n transform: rotate(-90deg);\n }\n ul.options {\n position: absolute;\n top: 100%;\n left: 0;\n z-index: 10;\n min-width: 100%;\n max-height: 40vh;\n overflow-y: auto;\n scrollbar-gutter: stable;\n margin: 0.25rem 0 0;\n padding: 0.25rem 0;\n list-style: none;\n white-space: nowrap;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n }\n ul.options::-webkit-scrollbar {\n width: 0.75rem;\n }\n ul.options::-webkit-scrollbar-thumb {\n background: var(--ui-border, #e2e8f0);\n border: 0.25rem solid transparent;\n border-radius: var(--ui-radius-pill, 9999px);\n background-clip: padding-box;\n }\n .list-control {\n display: flex;\n flex-direction: column;\n }\n .search-field {\n display: flex;\n align-items: center;\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n margin-bottom: 0.25rem;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: text;\n }\n .search-field:not(.disabled):focus-within {\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .search-field.disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n input.list-search {\n padding-right: 0.75rem;\n }\n ul.options.persistent {\n position: static;\n z-index: auto;\n min-width: 0;\n max-height: none;\n margin: 0;\n box-sizing: border-box;\n border-radius: var(--ui-radius, 0.5rem);\n box-shadow: none;\n }\n ul.options.persistent.disabled {\n cursor: not-allowed;\n opacity: 0.6;\n pointer-events: none;\n }\n ul.options.persistent:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n li {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n }\n li.active,\n li:hover:not([aria-disabled=\"true\"]) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n li[aria-selected=\"true\"] {\n font-weight: var(--ui-font-weight-semibold, 600);\n color: var(--ui-primary, #4f46e5);\n }\n li[aria-disabled=\"true\"] {\n cursor: not-allowed;\n color: var(--ui-text-muted, #64748b);\n opacity: 0.6;\n }\n .check {\n display: inline-flex;\n flex: 0 0 auto;\n width: 14px;\n height: 14px;\n align-items: center;\n justify-content: center;\n color: var(--ui-primary, #4f46e5);\n }\n .check.hidden {\n visibility: hidden;\n }\n .check > svg {\n width: 100%;\n height: 100%;\n }\n .option-content {\n display: inline-flex;\n min-width: 0;\n flex: 1;\n align-items: center;\n gap: 0.5rem;\n }\n .option-icon {\n display: inline-flex;\n width: var(--multi-select-icon-size);\n height: var(--multi-select-icon-size);\n flex: 0 0 var(--multi-select-icon-size);\n align-items: center;\n justify-content: center;\n }\n .option-icon > svg {\n width: 100%;\n height: 100%;\n }\n .option-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n li.no-options {\n display: block;\n padding: 0.5rem 0.75rem;\n color: var(--ui-text-muted, #64748b);\n cursor: default;\n font-style: italic;\n }\n .chips {\n display: flex;\n flex-wrap: wrap;\n gap: 0.25rem;\n margin-top: 0.25rem;\n /* Pin the chips row to the control's resolved width (0 width +\n min-width 100%) so a long selected label ellipsizes instead of\n contributing its content width and widening the control. */\n width: 0;\n min-width: 100%;\n box-sizing: border-box;\n }\n .chip {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n max-width: 100%;\n box-sizing: border-box;\n padding-left: 0.5rem;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface-muted, #f8fafc);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n }\n .chip-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .chip-remove {\n display: inline-flex;\n flex: 0 0 auto;\n width: 2rem;\n height: 2rem;\n align-items: center;\n justify-content: center;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n background: transparent;\n border: 0;\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: pointer;\n }\n .chip-remove:hover:not(:disabled) {\n color: var(--ui-danger, #dc2626);\n }\n .chip-remove:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .chip-remove:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .chip-remove > svg {\n width: 18px;\n height: 18px;\n }\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n @media (prefers-reduced-motion: reduce) {\n .chevron {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n button.trigger:focus-visible,\n .search-trigger:not(.disabled):focus-within,\n .search-field:not(.disabled):focus-within,\n ul.options.persistent:focus-visible,\n .chip-remove:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n button.trigger:disabled,\n .search-trigger.disabled,\n .search-field.disabled,\n ul.options.persistent.disabled,\n .chip-remove:disabled,\n li[aria-disabled=\"true\"] {\n color: GrayText;\n opacity: 1;\n }\n li.active,\n li:hover:not([aria-disabled=\"true\"]) {\n color: HighlightText;\n background: Highlight;\n }\n li[aria-selected=\"true\"] {\n color: Highlight;\n }\n li.active[aria-selected=\"true\"],\n li[aria-selected=\"true\"]:hover {\n color: HighlightText;\n }\n .chip {\n border-color: CanvasText;\n }\n }\n `,\n ];\n\n /** The full list of selectable options. */\n @property({ attribute: false }) options: MultiSelectOption[] = [];\n /**\n * The currently selected values. Programmatic assignments are deduplicated\n * while preserving order and never fire `change`.\n */\n @property({ attribute: false }) values: string[] = [];\n /** Form control name; each selected value submits under it. */\n @property() name = \"\";\n /** Accessible label applied to the trigger. */\n @property() label = \"\";\n /** Text shown on the trigger when nothing is selected. */\n @property() placeholder = \"Select options\";\n /** Disables the whole control, preventing the popover from opening. */\n @property({ type: Boolean }) disabled = false;\n /** Marks the control as required for native form validation. */\n @property({ type: Boolean }) required = false;\n /**\n * Enables editable, case-insensitive infix filtering by option label.\n * Typed text never becomes a selected value.\n */\n @property({ type: Boolean, reflect: true }) searchable = false;\n /** Maximum number of selectable values; `0` (default) means unlimited. */\n @property({ type: Number }) max = 0;\n /**\n * Presentation variant. `\"dropdown\"` (default) opens a popover listbox;\n * `\"list\"` renders a persistently visible, bordered list surface. Reflected\n * so consumers can style by `[variant=\"list\"]`.\n */\n @property({ reflect: true }) variant: MultiSelectVariant = \"dropdown\";\n /**\n * Number of `2rem` rows the `list` variant's scroll viewport shows before it\n * scrolls, mirroring a native `<select size>`. Normalized to an integer of at\n * least `1` (default `5`); ignored by the `dropdown` variant.\n */\n @property({ type: Number, attribute: \"visible-rows\" }) visibleRows = 5;\n /**\n * When true, the selected values are also rendered as removable chips below\n * the trigger, each with an accessible `32px` remove control. Off by default:\n * the trigger already summarizes the selection, and values can be toggled off\n * in the listbox. Applies to both variants.\n */\n @property({ type: Boolean, attribute: \"show-chips\" }) showChips = false;\n\n @state() private _open = false;\n @state() private _activeIndex = -1;\n @state() private _query: string | null = null;\n @state() private _formDisabled = false;\n\n #internals = this.attachInternals();\n #defaultValues: string[] | null = null;\n #listboxPointerDown = false;\n #suppressNextBlur = false;\n #restoringSearchFocus = false;\n #searchSelection: [number | null, number | null] | null = null;\n #isComposing = false;\n #compositionJustEnded = false;\n #compositionEndTimer: ReturnType<typeof setTimeout> | null = null;\n #blurTimer: ReturnType<typeof setTimeout> | null = null;\n readonly #listboxId = `multi-select-listbox-${++instanceCount}`;\n\n /** Whether the host or an ancestor fieldset currently disables the control. */\n get #isDisabled(): boolean {\n return this.disabled || this._formDisabled;\n }\n\n /** `visibleRows` normalized to a whole number of rows, at least `1`. */\n get #rows(): number {\n const raw = this.visibleRows;\n if (!Number.isFinite(raw)) return 5;\n const floored = Math.floor(raw);\n return floored < 1 ? 1 : floored;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n if (this.#blurTimer) clearTimeout(this.#blurTimer);\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#blurTimer = null;\n this.#compositionEndTimer = null;\n this.#listboxPointerDown = false;\n this.#suppressNextBlur = false;\n this.#searchSelection = null;\n this.#isComposing = false;\n this.#compositionJustEnded = false;\n this.#close();\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated && this.#defaultValues === null) {\n this.#defaultValues = this.#dedupe(this.values);\n }\n if (changed.has(\"values\")) {\n const deduped = this.#dedupe(this.values);\n if (\n deduped.length !== this.values.length ||\n deduped.some((value, index) => value !== this.values[index])\n ) {\n this.values = deduped;\n }\n }\n if (\n (changed.has(\"disabled\") || changed.has(\"searchable\") || changed.has(\"variant\")) &&\n (this.#isDisabled || changed.has(\"searchable\") || changed.has(\"variant\"))\n ) {\n this.#close();\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"_open\")) {\n this.toggleAttribute(\"open\", this._open);\n if (this._open) {\n window.addEventListener(\"mousedown\", this.#onWindowMousedown, true);\n } else {\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n }\n }\n if (changed.has(\"values\") || changed.has(\"name\")) this.#syncFormValue();\n if (\n changed.has(\"values\") ||\n changed.has(\"required\") ||\n changed.has(\"disabled\") ||\n changed.has(\"_formDisabled\")\n ) {\n this.#syncValidity();\n }\n if (\n (changed.has(\"_activeIndex\") || changed.has(\"_query\") || changed.has(\"options\")) &&\n (this._open || this.variant === \"list\") &&\n this._activeIndex >= 0\n ) {\n this.renderRoot\n .querySelector<HTMLElement>(`#${this.#listboxId}-option-${this._activeIndex}`)\n ?.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n }\n }\n\n /** Restores the selection captured at first render, per the form contract. */\n formResetCallback(): void {\n this.values = this.#defaultValues ? [...this.#defaultValues] : [];\n this.#close();\n }\n\n /** Mirrors an ancestor fieldset's disabled state and closes the popover. */\n formDisabledCallback(disabled: boolean): void {\n this._formDisabled = disabled;\n if (disabled) this.#close();\n }\n\n /** Restores the selection from the saved form state on navigation/autofill. */\n formStateRestoreCallback(state: string | File | FormData | null): void {\n if (typeof state !== \"string\") return;\n try {\n const parsed: unknown = JSON.parse(state);\n if (Array.isArray(parsed)) {\n this.values = parsed.filter((item): item is string => typeof item === \"string\");\n }\n } catch {\n /* ignore malformed restore state */\n }\n }\n\n #syncFormValue(): void {\n const values = this.values;\n if (!this.name || values.length === 0) {\n this.#internals.setFormValue(null);\n return;\n }\n const data = new FormData();\n for (const value of values) data.append(this.name, value);\n this.#internals.setFormValue(data, JSON.stringify(values));\n }\n\n #syncValidity(): void {\n const anchor = this.#anchorElement();\n if (this.#isDisabled) {\n this.#internals.setValidity({});\n return;\n }\n if (this.required && this.values.length === 0) {\n this.#internals.setValidity(\n { valueMissing: true },\n \"Please select at least one option.\",\n anchor ?? undefined,\n );\n } else {\n this.#internals.setValidity({});\n }\n }\n\n #anchorElement(): HTMLElement | null {\n return this.renderRoot.querySelector<HTMLElement>(\n \"button.trigger, input.search-input, ul.persistent\",\n );\n }\n\n #dedupe(values: readonly string[]): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n for (const value of values) {\n if (seen.has(value)) continue;\n seen.add(value);\n result.push(value);\n }\n return result;\n }\n\n /** First option matching `value`, so duplicate values resolve deterministically. */\n #optionByValue(value: string): MultiSelectOption | undefined {\n return this.options.find((option) => option.value === value);\n }\n\n #labelFor(value: string): string {\n return this.#optionByValue(value)?.label ?? value;\n }\n\n #summaryText(): string {\n if (this.values.length === 0) return this.placeholder;\n if (this.values.length === 1) return this.#labelFor(this.values[0]);\n return `${this.values.length} selected`;\n }\n\n #liveText(): string {\n if (this.values.length === 0) return \"No options selected\";\n if (this.values.length === 1) return `${this.#labelFor(this.values[0])} selected`;\n return `${this.values.length} options selected`;\n }\n\n #visibleOptions(): MultiSelectOption[] {\n if (!this.searchable || this._query === null) return this.options;\n const needle = this._query.trim().toLocaleLowerCase();\n if (!needle) return this.options;\n return this.options.filter((option) =>\n option.label.toLocaleLowerCase().includes(needle),\n );\n }\n\n /** Whether `value` is currently at the selection cap and cannot be added. */\n #atCap(value: string): boolean {\n return (\n this.max > 0 && this.values.length >= this.max && !this.values.includes(value)\n );\n }\n\n #isOptionDisabled(option: MultiSelectOption): boolean {\n return Boolean(option.disabled) || this.#atCap(option.value) || this.#isDisabled;\n }\n\n #toggleOption(option: MultiSelectOption): void {\n if (this.#isDisabled || option.disabled) return;\n if (this.values.includes(option.value)) {\n this.#commit(this.values.filter((value) => value !== option.value));\n return;\n }\n if (this.#atCap(option.value)) return;\n this.#commit([...this.values, option.value]);\n }\n\n #removeValue(value: string): void {\n if (this.#isDisabled) return;\n if (!this.values.includes(value)) return;\n this.#commit(this.values.filter((existing) => existing !== value));\n }\n\n #commit(next: string[]): void {\n this.values = this.#dedupe(next);\n this.dispatchEvent(\n new CustomEvent(\"change\", {\n detail: { values: [...this.values] },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n #onWindowMousedown = (e: MouseEvent): void => {\n if (!e.composedPath().includes(this)) this.#close();\n };\n\n #onFocusOut = (e: FocusEvent): void => {\n if (this.#listboxPointerDown || this.#suppressNextBlur) return;\n const next = e.relatedTarget;\n // Focus leaving to body/null (e.g. a pointer press on a non-focusable\n // element inside the component) is handled by the outside-mousedown\n // listener; only a genuine Tab-out to another element closes here.\n if (!(next instanceof Node)) return;\n if (this === next || this.renderRoot.contains(next)) return;\n this.#close();\n };\n\n #toggle(): void {\n if (this.#isDisabled) return;\n if (this._open) this.#close();\n else this.#open();\n }\n\n #open(): void {\n if (this.#isDisabled) return;\n this._query = null;\n this._open = true;\n this._activeIndex = this.#initialActiveIndex();\n }\n\n #close(): void {\n this._open = false;\n this._query = null;\n this._activeIndex = -1;\n this.#searchSelection = null;\n }\n\n #initialActiveIndex(): number {\n const options = this.#visibleOptions();\n if (options.length === 0) return -1;\n if (this._query !== null) return 0;\n const selectedIndex = options.findIndex((option) =>\n this.values.includes(option.value),\n );\n return selectedIndex >= 0 ? selectedIndex : 0;\n }\n\n #moveActive(delta: number): void {\n const options = this.#visibleOptions();\n if (options.length === 0) return;\n const n = options.length;\n this._activeIndex = (this._activeIndex + delta + n) % n;\n }\n\n #toggleActive(): void {\n const options = this.#visibleOptions();\n const option = options[this._activeIndex] ?? options[0];\n if (option) this.#toggleOption(option);\n }\n\n #onTriggerKeydown(e: KeyboardEvent): void {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!this._open) {\n this.#open();\n return;\n }\n if (e.key === \"ArrowDown\") this.#moveActive(1);\n else if (e.key === \"ArrowUp\") this.#moveActive(-1);\n else this.#toggleActive();\n } else if ((e.key === \"Home\" || e.key === \"End\") && this._open) {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Escape\" && this._open) {\n e.preventDefault();\n this.#close();\n }\n }\n\n #onSearchFocus(e: FocusEvent): void {\n if (this.#isDisabled) return;\n if (this.#blurTimer) {\n clearTimeout(this.#blurTimer);\n this.#blurTimer = null;\n }\n if (!this._open) this.#open();\n if (!this.#restoringSearchFocus) (e.currentTarget as HTMLInputElement).select();\n }\n\n #onSearchClick(): void {\n if (!this._open) this.#open();\n }\n\n #onSearchMousedown(e: MouseEvent): void {\n if (e.button !== 0) e.preventDefault();\n }\n\n /** Seeds the active option when the persistent (non-searchable) list focuses. */\n #onListFocus(): void {\n if (this.#isDisabled || this.searchable) return;\n if (this._activeIndex < 0) this._activeIndex = this.#initialActiveIndex();\n }\n\n /** Keyboard navigation for the focusable, non-searchable persistent list. */\n #onListKeydown(e: KeyboardEvent): void {\n if (this.#isDisabled || this.searchable) return;\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n if (this._activeIndex < 0) this._activeIndex = this.#initialActiveIndex();\n else this.#moveActive(e.key === \"ArrowDown\" ? 1 : -1);\n } else if (e.key === \"Home\" || e.key === \"End\") {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n this.#toggleActive();\n }\n // Escape intentionally does nothing: the list is never hidden.\n }\n\n /** Infix-filters the persistent list as the searchable-list query changes. */\n #onListSearchInput(e: InputEvent): void {\n this._query = (e.currentTarget as HTMLInputElement).value;\n const options = this.#visibleOptions();\n this._activeIndex = options.length > 0 ? 0 : -1;\n }\n\n /** Keyboard navigation for the search field above a searchable persistent list. */\n #onListSearchKeydown(e: KeyboardEvent): void {\n if (e.isComposing || e.keyCode === 229 || this.#isComposing || this.#compositionJustEnded) {\n return;\n }\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n this.#moveActive(e.key === \"ArrowDown\" ? 1 : -1);\n } else if (e.key === \"Home\" || e.key === \"End\") {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n this.#toggleActive();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n this._query = null;\n const options = this.#visibleOptions();\n this._activeIndex = options.length > 0 ? 0 : -1;\n } else if (\n e.key === \"Backspace\" &&\n (e.currentTarget as HTMLInputElement).value === \"\" &&\n this.values.length > 0\n ) {\n e.preventDefault();\n this.#removeValue(this.values[this.values.length - 1]);\n }\n }\n\n #onSearchInput(e: InputEvent): void {\n this._query = (e.currentTarget as HTMLInputElement).value;\n this._open = true;\n const options = this.#visibleOptions();\n this._activeIndex = options.length > 0 ? 0 : -1;\n }\n\n #onSearchKeydown(e: KeyboardEvent): void {\n if (e.isComposing || e.keyCode === 229 || this.#isComposing || this.#compositionJustEnded) {\n return;\n }\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n if (!this._open) {\n this.#open();\n return;\n }\n this.#moveActive(e.key === \"ArrowDown\" ? 1 : -1);\n } else if ((e.key === \"Home\" || e.key === \"End\") && this._open) {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Enter\" && this._open) {\n e.preventDefault();\n this.#toggleActive();\n } else if (e.key === \"Escape\" && this._open) {\n e.preventDefault();\n this.#close();\n } else if (\n e.key === \"Backspace\" &&\n (e.currentTarget as HTMLInputElement).value === \"\" &&\n this.values.length > 0\n ) {\n e.preventDefault();\n this.#removeValue(this.values[this.values.length - 1]);\n }\n }\n\n #onSearchBlur(): void {\n if (this.#blurTimer) clearTimeout(this.#blurTimer);\n this.#blurTimer = setTimeout(() => {\n this.#blurTimer = null;\n if (!this._open) return;\n if (!this.#listboxPointerDown && !this.#suppressNextBlur) this.#close();\n });\n }\n\n #focusSearchInput(e: MouseEvent): void {\n if (\n e.button !== 0 ||\n this.#isDisabled ||\n e.composedPath()[0] instanceof HTMLInputElement\n ) {\n return;\n }\n e.preventDefault();\n const input = this.renderRoot.querySelector<HTMLInputElement>(\"input.search-input\");\n if (!this._open) this.#open();\n input?.focus();\n input?.select();\n }\n\n #onCompositionStart(): void {\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = null;\n this.#compositionJustEnded = false;\n this.#isComposing = true;\n }\n\n #onCompositionEnd(): void {\n this.#isComposing = false;\n this.#compositionJustEnded = true;\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = setTimeout(() => {\n this.#compositionJustEnded = false;\n this.#compositionEndTimer = null;\n });\n }\n\n #onListboxMousedown(e: MouseEvent): void {\n if (e.button !== 0) return;\n this.#listboxPointerDown = true;\n this.#suppressNextBlur = true;\n const input = this.renderRoot.querySelector<HTMLInputElement>(\"input.search-input\");\n this.#searchSelection = input ? [input.selectionStart, input.selectionEnd] : null;\n window.addEventListener(\n \"mouseup\",\n () => {\n this.#listboxPointerDown = false;\n if (this._open) {\n const searchInput =\n this.renderRoot.querySelector<HTMLInputElement>(\"input.search-input\");\n if (searchInput) {\n this.#restoringSearchFocus = true;\n searchInput.focus({ preventScroll: true });\n this.#restoringSearchFocus = false;\n const [start, end] = this.#searchSelection ?? [null, null];\n if (start !== null && end !== null) searchInput.setSelectionRange(start, end);\n }\n }\n this.#searchSelection = null;\n setTimeout(() => {\n this.#suppressNextBlur = false;\n });\n },\n { capture: true, once: true },\n );\n }\n\n #onOptionMousedown(e: MouseEvent, option: MultiSelectOption): void {\n if (e.button !== 0) return;\n const optionElement = e.currentTarget as HTMLElement;\n const listbox = optionElement.parentElement;\n if (listbox) {\n const scrollbarWidth = listbox.offsetWidth - listbox.clientWidth;\n const bounds = listbox.getBoundingClientRect();\n const isRtl = getComputedStyle(listbox).direction === \"rtl\";\n const inScrollbarGutter = isRtl\n ? e.clientX <= bounds.left + scrollbarWidth\n : e.clientX >= bounds.right - scrollbarWidth;\n if (scrollbarWidth > 0 && inScrollbarGutter) return;\n }\n e.preventDefault();\n if (this.#isOptionDisabled(option)) return;\n this.#toggleOption(option);\n if (this.variant === \"list\" && !this.searchable && !this.#isDisabled) {\n this.renderRoot\n .querySelector<HTMLElement>(\"ul.persistent\")\n ?.focus({ preventScroll: true });\n }\n }\n\n #optionIconSize(option: MultiSelectOption): number {\n const size = option.iconSize ?? 16;\n return Number.isFinite(size) && size > 0 ? size : 16;\n }\n\n #renderOptionIcon(option: MultiSelectOption) {\n if (!option.icon) return nothing;\n return html`\n <span\n class=\"option-icon\"\n style=${`--multi-select-icon-size: ${this.#optionIconSize(option)}px`}\n aria-hidden=\"true\"\n >\n ${option.icon}\n </span>\n `;\n }\n\n /** The shared `<li role=\"option\">` items for both variants' listboxes. */\n private renderOptionItems(options: MultiSelectOption[]) {\n return html`\n ${options.map((option, index) => {\n const selected = this.values.includes(option.value);\n const disabled = this.#isOptionDisabled(option);\n return html`\n <li\n id=${`${this.#listboxId}-option-${index}`}\n role=\"option\"\n aria-selected=${selected}\n aria-disabled=${disabled ? \"true\" : nothing}\n class=${index === this._activeIndex ? \"active\" : \"\"}\n @mousedown=${(e: MouseEvent) => this.#onOptionMousedown(e, option)}\n >\n <span class=\"check ${selected ? \"\" : \"hidden\"}\" aria-hidden=\"true\">\n ${iconCheckCircle(14)}\n </span>\n <span class=\"option-content\">\n ${this.#renderOptionIcon(option)}\n <span class=\"option-label\">${option.label}</span>\n </span>\n </li>\n `;\n })}\n ${options.length === 0\n ? html`<li class=\"no-options\" role=\"presentation\">\n <span role=\"status\">No options found</span>\n </li>`\n : nothing}\n `;\n }\n\n private renderListbox() {\n if (!this._open) return nothing;\n const options = this.#visibleOptions();\n return html`\n <ul\n id=${this.#listboxId}\n class=\"options\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n aria-label=${this.label ? `${this.label} options` : \"Options\"}\n @mousedown=${(e: MouseEvent) => this.#onListboxMousedown(e)}\n >\n ${this.renderOptionItems(options)}\n </ul>\n `;\n }\n\n private renderChips() {\n if (!this.showChips || this.values.length === 0) return nothing;\n return html`\n <div class=\"chips\">\n ${this.values.map((value) => {\n const label = this.#labelFor(value);\n return html`\n <span class=\"chip\">\n <span class=\"chip-label\">${label}</span>\n <button\n type=\"button\"\n class=\"chip-remove\"\n aria-label=${`Remove ${label}`}\n ?disabled=${this.#isDisabled}\n @click=${() => this.#removeValue(value)}\n >\n ${iconX(18)}\n </button>\n </span>\n `;\n })}\n </div>\n `;\n }\n\n private renderSearchTrigger() {\n const activeDescendant =\n this._open && this._activeIndex >= 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n return html`\n <div\n class=\"search-trigger ${this.#isDisabled ? \"disabled\" : \"\"}\"\n @mousedown=${(e: MouseEvent) => this.#focusSearchInput(e)}\n >\n <input\n type=\"text\"\n class=\"search-input\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-expanded=${this._open}\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n aria-label=${this.label || \"Select options\"}\n placeholder=${this.#summaryText()}\n autocomplete=\"off\"\n ?disabled=${this.#isDisabled}\n .value=${this._query ?? \"\"}\n @mousedown=${(e: MouseEvent) => this.#onSearchMousedown(e)}\n @focus=${(e: FocusEvent) => this.#onSearchFocus(e)}\n @click=${() => this.#onSearchClick()}\n @input=${(e: InputEvent) => this.#onSearchInput(e)}\n @compositionstart=${() => this.#onCompositionStart()}\n @compositionend=${() => this.#onCompositionEnd()}\n @keydown=${(e: KeyboardEvent) => this.#onSearchKeydown(e)}\n @blur=${() => this.#onSearchBlur()}\n />\n <span class=\"chevron\">${iconChevronRight(14)}</span>\n </div>\n `;\n }\n\n private renderButtonTrigger() {\n const activeDescendant =\n this._open && this._activeIndex >= 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n const empty = this.values.length === 0;\n return html`\n <button\n type=\"button\"\n class=\"trigger\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded=${this._open}\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n aria-label=${this.label || nothing}\n ?disabled=${this.#isDisabled}\n @click=${() => this.#toggle()}\n @keydown=${(e: KeyboardEvent) => this.#onTriggerKeydown(e)}\n >\n <span class=\"trigger-label ${empty ? \"placeholder\" : \"\"}\">${this.#summaryText()}</span>\n <span class=\"chevron\">${iconChevronRight(14)}</span>\n </button>\n `;\n }\n\n private renderListSearch() {\n const activeDescendant =\n this._activeIndex >= 0 ? `${this.#listboxId}-option-${this._activeIndex}` : nothing;\n return html`\n <div class=\"search-field ${this.#isDisabled ? \"disabled\" : \"\"}\">\n <input\n type=\"text\"\n class=\"search-input list-search\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-expanded=\"true\"\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n aria-label=${this.label || \"Select options\"}\n placeholder=${this.#summaryText()}\n autocomplete=\"off\"\n ?disabled=${this.#isDisabled}\n .value=${this._query ?? \"\"}\n @input=${(e: InputEvent) => this.#onListSearchInput(e)}\n @compositionstart=${() => this.#onCompositionStart()}\n @compositionend=${() => this.#onCompositionEnd()}\n @keydown=${(e: KeyboardEvent) => this.#onListSearchKeydown(e)}\n />\n </div>\n `;\n }\n\n private renderPersistentList() {\n const options = this.#visibleOptions();\n const focusable = !this.searchable && !this.#isDisabled;\n const activeDescendant =\n !this.searchable && this._activeIndex >= 0 && options.length > 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n return html`\n <ul\n id=${this.#listboxId}\n class=\"options persistent ${this.#isDisabled ? \"disabled\" : \"\"}\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n aria-label=${this.label ? `${this.label} options` : \"Options\"}\n aria-disabled=${this.#isDisabled ? \"true\" : nothing}\n tabindex=${focusable ? \"0\" : nothing}\n aria-activedescendant=${activeDescendant}\n style=${`height: calc(${this.#rows} * 2rem + 0.5rem + 2px)`}\n @mousedown=${(e: MouseEvent) => this.#onListboxMousedown(e)}\n @focus=${() => this.#onListFocus()}\n @keydown=${(e: KeyboardEvent) => this.#onListKeydown(e)}\n >\n ${this.renderOptionItems(options)}\n </ul>\n `;\n }\n\n private renderListVariant() {\n return html`\n <div class=\"control list-control\">\n ${this.searchable ? this.renderListSearch() : nothing}\n ${this.renderPersistentList()}\n </div>\n ${this.renderChips()}\n <span class=\"sr-only\" aria-live=\"polite\">${this.#liveText()}</span>\n `;\n }\n\n override render() {\n if (this.variant === \"list\") return this.renderListVariant();\n return html`\n <div class=\"control\" @focusout=${(e: FocusEvent) => this.#onFocusOut(e)}>\n ${this.searchable ? this.renderSearchTrigger() : this.renderButtonTrigger()}\n ${this.renderListbox()}\n </div>\n ${this.renderChips()}\n <span class=\"sr-only\" aria-live=\"polite\">${this.#liveText()}</span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"multi-select\": MultiSelect;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"multi-select.js","sourceRoot":"","sources":["../src/multi-select.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,UAAU,EACV,GAAG,EACH,IAAI,EACJ,OAAO,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,IAAI,aAAa,GAAG,CAAC,CAAC;AAsBtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,KAAK,EAAE;0CAAuB;AACd;IAAhB,KAAK,EAAE;iDAA2B;AAClB;IAAhB,KAAK,EAAE;2CAAsC;AAC7B;IAAhB,KAAK,EAAE;kDAA+B;AAjc5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAkrCvB","sourcesContent":["import {\n LitElement,\n css,\n html,\n nothing,\n type PropertyValues,\n type TemplateResult,\n} from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconCheckCircle, iconChevronRight, iconX } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nlet instanceCount = 0;\n\n/**\n * Presentation variant of {@link MultiSelect}.\n *\n * - `\"dropdown\"` (default): a compact trigger that opens a listbox popover.\n * - `\"list\"`: a persistently visible, bordered list surface with no popover.\n */\nexport type MultiSelectVariant = \"dropdown\" | \"list\";\n\n/** A single selectable option. */\nexport interface MultiSelectOption {\n value: string;\n label: string;\n /** Optional pre-rendered icon template displayed before the label. */\n icon?: TemplateResult;\n /** Square icon size in pixels. Defaults to 16 when `icon` is set. */\n iconSize?: number;\n /** When true, the option can neither be selected nor removed via the UI. */\n disabled?: boolean;\n}\n\n/**\n * A form-associated multi-select: a trigger showing a compact summary of the\n * current selection, opening a multi-selectable listbox popover, with an\n * optional removable-chip list of the chosen values. A drop-in generic\n * replacement for a native `<select multiple>` — set `name` on the element\n * itself and each\n * selected value is submitted as a repeated `name=value` entry, matching native\n * multiple-select semantics; `new FormData(form).getAll(name)` and\n * `form.reset()` work unchanged.\n *\n * The trigger visually follows `form-select`: a `2rem` field showing the\n * `placeholder` when empty, the single selected label when one value is chosen,\n * and `N selected` when several are. Set `show-chips` to additionally render\n * the selected values as compact chips below the trigger, each with an\n * accessible `32px` remove control; chips are off by default and the region\n * reserves no space while nothing is selected. Like `form-select`, the host is\n * `display: block` and fills its container by default; constrain the host\n * (`multi-select { display: inline-block; }`) to shrink it to its content\n * instead.\n *\n * Set `searchable` to replace the button trigger with an editable combobox that\n * infix-filters the predefined options by case-insensitive label. Typed text is\n * only a query: `values` changes exclusively when options are toggled, and an\n * uncommitted query is discarded when the list closes.\n *\n * The `variant` chooses between two presentations, and `searchable` applies to\n * both:\n *\n * - `\"dropdown\"` (default) is the popover form described above: a compact\n * trigger (button, or search combobox when `searchable`) that opens a\n * multi-selectable listbox on demand, closes on outside click / Escape, and\n * shows a chevron.\n * - `\"list\"` renders the options as a persistently visible, bordered surface\n * with no popover, no chevron, and no `open` host state; it never registers\n * outside-click listeners. Its scroll viewport is sized to roughly\n * `visibleRows` `2rem` rows (see `visible-rows`). When not `searchable` the\n * `listbox` itself is focusable and drives Arrow/Home/End/Enter/Space keyboard\n * navigation via `aria-activedescendant`; when `searchable` a `2rem` search\n * field sits above the list and owns navigation, and Escape only clears the\n * query instead of hiding the list.\n *\n * @element multi-select\n * @fires change - Fired with `{ values: string[] }` (a copied array) when a\n * value is added or removed through the UI. Programmatic `values` assignments\n * do not fire it.\n */\n@customElement(\"multi-select\")\nexport class MultiSelect extends LitElement {\n static formAssociated = true;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n position: relative;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n }\n .control {\n position: relative;\n }\n button.trigger {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.25rem;\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n }\n button.trigger:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n button.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n button.trigger:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .trigger-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .trigger-label.placeholder {\n color: var(--ui-text-muted, #64748b);\n }\n .search-trigger {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.25rem;\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: text;\n }\n .search-trigger:hover:not(.disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .search-trigger:not(.disabled):focus-within {\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .search-trigger.disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n input.search-input {\n min-width: 0;\n flex: 1;\n box-sizing: border-box;\n padding: 0.5rem 0 0.5rem 0.75rem;\n color: inherit;\n background: transparent;\n border: 0;\n outline: 0;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n input.search-input::placeholder {\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-medium, 500);\n opacity: 1;\n }\n .chevron {\n display: flex;\n flex: 0 0 auto;\n margin-right: 0.75rem;\n color: var(--ui-text-muted, #64748b);\n pointer-events: none;\n transform: rotate(90deg);\n transition: transform 150ms ease;\n }\n button.trigger .chevron {\n margin-right: 0;\n }\n :host([open]) .chevron {\n transform: rotate(-90deg);\n }\n ul.options {\n position: absolute;\n top: 100%;\n left: 0;\n z-index: 10;\n min-width: 100%;\n max-height: 40vh;\n overflow-y: auto;\n scrollbar-gutter: stable;\n margin: 0.25rem 0 0;\n padding: 0.25rem 0;\n list-style: none;\n white-space: nowrap;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n }\n ul.options::-webkit-scrollbar {\n width: 0.75rem;\n }\n ul.options::-webkit-scrollbar-thumb {\n background: var(--ui-border, #e2e8f0);\n border: 0.25rem solid transparent;\n border-radius: var(--ui-radius-pill, 9999px);\n background-clip: padding-box;\n }\n .list-control {\n display: flex;\n flex-direction: column;\n }\n .search-field {\n display: flex;\n align-items: center;\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n margin-bottom: 0.25rem;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: text;\n }\n .search-field:not(.disabled):focus-within {\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .search-field.disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n input.list-search {\n padding-right: 0.75rem;\n }\n ul.options.persistent {\n position: static;\n z-index: auto;\n min-width: 0;\n max-height: none;\n margin: 0;\n box-sizing: border-box;\n border-radius: var(--ui-radius, 0.5rem);\n box-shadow: none;\n }\n ul.options.persistent.disabled {\n cursor: not-allowed;\n opacity: 0.6;\n pointer-events: none;\n }\n ul.options.persistent:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n li {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n }\n li.active,\n li:hover:not([aria-disabled=\"true\"]) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n li[aria-selected=\"true\"] {\n font-weight: var(--ui-font-weight-semibold, 600);\n color: var(--ui-primary, #4f46e5);\n }\n li[aria-disabled=\"true\"] {\n cursor: not-allowed;\n color: var(--ui-text-muted, #64748b);\n opacity: 0.6;\n }\n .check {\n display: inline-flex;\n flex: 0 0 auto;\n width: 14px;\n height: 14px;\n align-items: center;\n justify-content: center;\n color: var(--ui-primary, #4f46e5);\n }\n .check.hidden {\n visibility: hidden;\n }\n .check > svg {\n width: 100%;\n height: 100%;\n }\n .option-content {\n display: inline-flex;\n min-width: 0;\n flex: 1;\n align-items: center;\n gap: 0.5rem;\n }\n .option-icon {\n display: inline-flex;\n width: var(--multi-select-icon-size);\n height: var(--multi-select-icon-size);\n flex: 0 0 var(--multi-select-icon-size);\n align-items: center;\n justify-content: center;\n }\n .option-icon > svg {\n width: 100%;\n height: 100%;\n }\n .option-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n li.no-options {\n display: block;\n padding: 0.5rem 0.75rem;\n color: var(--ui-text-muted, #64748b);\n cursor: default;\n font-style: italic;\n }\n .chips {\n display: flex;\n flex-wrap: wrap;\n gap: 0.25rem;\n margin-top: 0.25rem;\n /* Pin the chips row to the control's resolved width (0 width +\n min-width 100%) so a long selected label ellipsizes instead of\n contributing its content width and widening the control. */\n width: 0;\n min-width: 100%;\n box-sizing: border-box;\n }\n .chip {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n max-width: 100%;\n box-sizing: border-box;\n padding-left: 0.5rem;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface-muted, #f8fafc);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n }\n .chip-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .chip-remove {\n display: inline-flex;\n flex: 0 0 auto;\n width: 2rem;\n height: 2rem;\n align-items: center;\n justify-content: center;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n background: transparent;\n border: 0;\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: pointer;\n }\n .chip-remove:hover:not(:disabled) {\n color: var(--ui-danger, #dc2626);\n }\n .chip-remove:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .chip-remove:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .chip-remove > svg {\n width: 18px;\n height: 18px;\n }\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n @media (prefers-reduced-motion: reduce) {\n .chevron {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n button.trigger:focus-visible,\n .search-trigger:not(.disabled):focus-within,\n .search-field:not(.disabled):focus-within,\n ul.options.persistent:focus-visible,\n .chip-remove:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n button.trigger:disabled,\n .search-trigger.disabled,\n .search-field.disabled,\n ul.options.persistent.disabled,\n .chip-remove:disabled,\n li[aria-disabled=\"true\"] {\n color: GrayText;\n opacity: 1;\n }\n li.active,\n li:hover:not([aria-disabled=\"true\"]) {\n color: HighlightText;\n background: Highlight;\n }\n li[aria-selected=\"true\"] {\n color: Highlight;\n }\n li.active[aria-selected=\"true\"],\n li[aria-selected=\"true\"]:hover {\n color: HighlightText;\n }\n .chip {\n border-color: CanvasText;\n }\n }\n `,\n ];\n\n /** The full list of selectable options. */\n @property({ attribute: false }) options: MultiSelectOption[] = [];\n /**\n * The currently selected values. Programmatic assignments are deduplicated\n * while preserving order and never fire `change`.\n */\n @property({ attribute: false }) values: string[] = [];\n /** Form control name; each selected value submits under it. */\n @property() name = \"\";\n /** Accessible label applied to the trigger. */\n @property() label = \"\";\n /** Text shown on the trigger when nothing is selected. */\n @property() placeholder = \"Select options\";\n /** Disables the whole control, preventing the popover from opening. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n /** Marks the control as required for native form validation. */\n @property({ type: Boolean }) required = false;\n /**\n * Enables editable, case-insensitive infix filtering by option label.\n * Typed text never becomes a selected value.\n */\n @property({ type: Boolean, reflect: true }) searchable = false;\n /** Maximum number of selectable values; `0` (default) means unlimited. */\n @property({ type: Number }) max = 0;\n /**\n * Presentation variant. `\"dropdown\"` (default) opens a popover listbox;\n * `\"list\"` renders a persistently visible, bordered list surface. Reflected\n * so consumers can style by `[variant=\"list\"]`.\n */\n @property({ reflect: true }) variant: MultiSelectVariant = \"dropdown\";\n /**\n * Number of `2rem` rows the `list` variant's scroll viewport shows before it\n * scrolls, mirroring a native `<select size>`. Normalized to an integer of at\n * least `1` (default `5`); ignored by the `dropdown` variant.\n */\n @property({ type: Number, attribute: \"visible-rows\" }) visibleRows = 5;\n /**\n * When true, the selected values are also rendered as removable chips below\n * the trigger, each with an accessible `32px` remove control. Off by default:\n * the trigger already summarizes the selection, and values can be toggled off\n * in the listbox. Applies to both variants.\n */\n @property({ type: Boolean, attribute: \"show-chips\" }) showChips = false;\n\n @state() private _open = false;\n @state() private _activeIndex = -1;\n @state() private _query: string | null = null;\n @state() private _formDisabled = false;\n\n #internals = this.attachInternals();\n #defaultValues: string[] | null = null;\n #listboxPointerDown = false;\n #suppressNextBlur = false;\n #restoringSearchFocus = false;\n #searchSelection: [number | null, number | null] | null = null;\n #isComposing = false;\n #compositionJustEnded = false;\n #compositionEndTimer: ReturnType<typeof setTimeout> | null = null;\n #blurTimer: ReturnType<typeof setTimeout> | null = null;\n readonly #listboxId = `multi-select-listbox-${++instanceCount}`;\n\n /** Whether the host or an ancestor fieldset currently disables the control. */\n get #isDisabled(): boolean {\n return this.disabled || this._formDisabled;\n }\n\n /** `visibleRows` normalized to a whole number of rows, at least `1`. */\n get #rows(): number {\n const raw = this.visibleRows;\n if (!Number.isFinite(raw)) return 5;\n const floored = Math.floor(raw);\n return floored < 1 ? 1 : floored;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n if (this.#blurTimer) clearTimeout(this.#blurTimer);\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#blurTimer = null;\n this.#compositionEndTimer = null;\n this.#listboxPointerDown = false;\n this.#suppressNextBlur = false;\n this.#searchSelection = null;\n this.#isComposing = false;\n this.#compositionJustEnded = false;\n this.#close();\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated && this.#defaultValues === null) {\n this.#defaultValues = this.#dedupe(this.values);\n }\n if (changed.has(\"values\")) {\n const deduped = this.#dedupe(this.values);\n if (\n deduped.length !== this.values.length ||\n deduped.some((value, index) => value !== this.values[index])\n ) {\n this.values = deduped;\n }\n }\n if (\n (changed.has(\"disabled\") || changed.has(\"searchable\") || changed.has(\"variant\")) &&\n (this.#isDisabled || changed.has(\"searchable\") || changed.has(\"variant\"))\n ) {\n this.#close();\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"_open\")) {\n this.toggleAttribute(\"open\", this._open);\n if (this._open) {\n window.addEventListener(\"mousedown\", this.#onWindowMousedown, true);\n } else {\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n }\n }\n if (changed.has(\"values\") || changed.has(\"name\")) this.#syncFormValue();\n if (\n changed.has(\"values\") ||\n changed.has(\"required\") ||\n changed.has(\"disabled\") ||\n changed.has(\"_formDisabled\")\n ) {\n this.#syncValidity();\n }\n if (\n (changed.has(\"_activeIndex\") || changed.has(\"_query\") || changed.has(\"options\")) &&\n (this._open || this.variant === \"list\") &&\n this._activeIndex >= 0\n ) {\n this.renderRoot\n .querySelector<HTMLElement>(`#${this.#listboxId}-option-${this._activeIndex}`)\n ?.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n }\n }\n\n /** Restores the selection captured at first render, per the form contract. */\n formResetCallback(): void {\n this.values = this.#defaultValues ? [...this.#defaultValues] : [];\n this.#close();\n }\n\n /** Mirrors an ancestor fieldset's disabled state and closes the popover. */\n formDisabledCallback(disabled: boolean): void {\n this._formDisabled = disabled;\n if (disabled) this.#close();\n }\n\n /** Restores the selection from the saved form state on navigation/autofill. */\n formStateRestoreCallback(state: string | File | FormData | null): void {\n if (typeof state !== \"string\") return;\n try {\n const parsed: unknown = JSON.parse(state);\n if (Array.isArray(parsed)) {\n this.values = parsed.filter((item): item is string => typeof item === \"string\");\n }\n } catch {\n /* ignore malformed restore state */\n }\n }\n\n #syncFormValue(): void {\n const values = this.values;\n if (!this.name || values.length === 0) {\n this.#internals.setFormValue(null);\n return;\n }\n const data = new FormData();\n for (const value of values) data.append(this.name, value);\n this.#internals.setFormValue(data, JSON.stringify(values));\n }\n\n #syncValidity(): void {\n const anchor = this.#anchorElement();\n if (this.#isDisabled) {\n this.#internals.setValidity({});\n return;\n }\n if (this.required && this.values.length === 0) {\n this.#internals.setValidity(\n { valueMissing: true },\n \"Please select at least one option.\",\n anchor ?? undefined,\n );\n } else {\n this.#internals.setValidity({});\n }\n }\n\n #anchorElement(): HTMLElement | null {\n return this.renderRoot.querySelector<HTMLElement>(\n \"button.trigger, input.search-input, ul.persistent\",\n );\n }\n\n #dedupe(values: readonly string[]): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n for (const value of values) {\n if (seen.has(value)) continue;\n seen.add(value);\n result.push(value);\n }\n return result;\n }\n\n /** First option matching `value`, so duplicate values resolve deterministically. */\n #optionByValue(value: string): MultiSelectOption | undefined {\n return this.options.find((option) => option.value === value);\n }\n\n #labelFor(value: string): string {\n return this.#optionByValue(value)?.label ?? value;\n }\n\n #summaryText(): string {\n if (this.values.length === 0) return this.placeholder;\n if (this.values.length === 1) return this.#labelFor(this.values[0]);\n return `${this.values.length} selected`;\n }\n\n #liveText(): string {\n if (this.values.length === 0) return \"No options selected\";\n if (this.values.length === 1) return `${this.#labelFor(this.values[0])} selected`;\n return `${this.values.length} options selected`;\n }\n\n #visibleOptions(): MultiSelectOption[] {\n if (!this.searchable || this._query === null) return this.options;\n const needle = this._query.trim().toLocaleLowerCase();\n if (!needle) return this.options;\n return this.options.filter((option) =>\n option.label.toLocaleLowerCase().includes(needle),\n );\n }\n\n /** Whether `value` is currently at the selection cap and cannot be added. */\n #atCap(value: string): boolean {\n return (\n this.max > 0 && this.values.length >= this.max && !this.values.includes(value)\n );\n }\n\n #isOptionDisabled(option: MultiSelectOption): boolean {\n return Boolean(option.disabled) || this.#atCap(option.value) || this.#isDisabled;\n }\n\n #toggleOption(option: MultiSelectOption): void {\n if (this.#isDisabled || option.disabled) return;\n if (this.values.includes(option.value)) {\n this.#commit(this.values.filter((value) => value !== option.value));\n return;\n }\n if (this.#atCap(option.value)) return;\n this.#commit([...this.values, option.value]);\n }\n\n #removeValue(value: string): void {\n if (this.#isDisabled) return;\n if (!this.values.includes(value)) return;\n this.#commit(this.values.filter((existing) => existing !== value));\n }\n\n #commit(next: string[]): void {\n this.values = this.#dedupe(next);\n this.dispatchEvent(\n new CustomEvent(\"change\", {\n detail: { values: [...this.values] },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n #onWindowMousedown = (e: MouseEvent): void => {\n if (!e.composedPath().includes(this)) this.#close();\n };\n\n #onFocusOut = (e: FocusEvent): void => {\n if (this.#listboxPointerDown || this.#suppressNextBlur) return;\n const next = e.relatedTarget;\n // Focus leaving to body/null (e.g. a pointer press on a non-focusable\n // element inside the component) is handled by the outside-mousedown\n // listener; only a genuine Tab-out to another element closes here.\n if (!(next instanceof Node)) return;\n if (this === next || this.renderRoot.contains(next)) return;\n this.#close();\n };\n\n #toggle(): void {\n if (this.#isDisabled) return;\n if (this._open) this.#close();\n else this.#open();\n }\n\n #open(): void {\n if (this.#isDisabled) return;\n this._query = null;\n this._open = true;\n this._activeIndex = this.#initialActiveIndex();\n }\n\n #close(): void {\n this._open = false;\n this._query = null;\n this._activeIndex = -1;\n this.#searchSelection = null;\n }\n\n #initialActiveIndex(): number {\n const options = this.#visibleOptions();\n if (options.length === 0) return -1;\n if (this._query !== null) return 0;\n const selectedIndex = options.findIndex((option) =>\n this.values.includes(option.value),\n );\n return selectedIndex >= 0 ? selectedIndex : 0;\n }\n\n #moveActive(delta: number): void {\n const options = this.#visibleOptions();\n if (options.length === 0) return;\n const n = options.length;\n this._activeIndex = (this._activeIndex + delta + n) % n;\n }\n\n #toggleActive(): void {\n const options = this.#visibleOptions();\n const option = options[this._activeIndex] ?? options[0];\n if (option) this.#toggleOption(option);\n }\n\n #onTriggerKeydown(e: KeyboardEvent): void {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!this._open) {\n this.#open();\n return;\n }\n if (e.key === \"ArrowDown\") this.#moveActive(1);\n else if (e.key === \"ArrowUp\") this.#moveActive(-1);\n else this.#toggleActive();\n } else if ((e.key === \"Home\" || e.key === \"End\") && this._open) {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Escape\" && this._open) {\n e.preventDefault();\n this.#close();\n }\n }\n\n #onSearchFocus(e: FocusEvent): void {\n if (this.#isDisabled) return;\n if (this.#blurTimer) {\n clearTimeout(this.#blurTimer);\n this.#blurTimer = null;\n }\n if (!this._open) this.#open();\n if (!this.#restoringSearchFocus) (e.currentTarget as HTMLInputElement).select();\n }\n\n #onSearchClick(): void {\n if (!this._open) this.#open();\n }\n\n #onSearchMousedown(e: MouseEvent): void {\n if (e.button !== 0) e.preventDefault();\n }\n\n /** Seeds the active option when the persistent (non-searchable) list focuses. */\n #onListFocus(): void {\n if (this.#isDisabled || this.searchable) return;\n if (this._activeIndex < 0) this._activeIndex = this.#initialActiveIndex();\n }\n\n /** Keyboard navigation for the focusable, non-searchable persistent list. */\n #onListKeydown(e: KeyboardEvent): void {\n if (this.#isDisabled || this.searchable) return;\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n if (this._activeIndex < 0) this._activeIndex = this.#initialActiveIndex();\n else this.#moveActive(e.key === \"ArrowDown\" ? 1 : -1);\n } else if (e.key === \"Home\" || e.key === \"End\") {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n this.#toggleActive();\n }\n // Escape intentionally does nothing: the list is never hidden.\n }\n\n /** Infix-filters the persistent list as the searchable-list query changes. */\n #onListSearchInput(e: InputEvent): void {\n this._query = (e.currentTarget as HTMLInputElement).value;\n const options = this.#visibleOptions();\n this._activeIndex = options.length > 0 ? 0 : -1;\n }\n\n /** Keyboard navigation for the search field above a searchable persistent list. */\n #onListSearchKeydown(e: KeyboardEvent): void {\n if (e.isComposing || e.keyCode === 229 || this.#isComposing || this.#compositionJustEnded) {\n return;\n }\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n this.#moveActive(e.key === \"ArrowDown\" ? 1 : -1);\n } else if (e.key === \"Home\" || e.key === \"End\") {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n this.#toggleActive();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n this._query = null;\n const options = this.#visibleOptions();\n this._activeIndex = options.length > 0 ? 0 : -1;\n } else if (\n e.key === \"Backspace\" &&\n (e.currentTarget as HTMLInputElement).value === \"\" &&\n this.values.length > 0\n ) {\n e.preventDefault();\n this.#removeValue(this.values[this.values.length - 1]);\n }\n }\n\n #onSearchInput(e: InputEvent): void {\n this._query = (e.currentTarget as HTMLInputElement).value;\n this._open = true;\n const options = this.#visibleOptions();\n this._activeIndex = options.length > 0 ? 0 : -1;\n }\n\n #onSearchKeydown(e: KeyboardEvent): void {\n if (e.isComposing || e.keyCode === 229 || this.#isComposing || this.#compositionJustEnded) {\n return;\n }\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n if (!this._open) {\n this.#open();\n return;\n }\n this.#moveActive(e.key === \"ArrowDown\" ? 1 : -1);\n } else if ((e.key === \"Home\" || e.key === \"End\") && this._open) {\n e.preventDefault();\n const options = this.#visibleOptions();\n this._activeIndex = e.key === \"Home\" ? 0 : options.length - 1;\n } else if (e.key === \"Enter\" && this._open) {\n e.preventDefault();\n this.#toggleActive();\n } else if (e.key === \"Escape\" && this._open) {\n e.preventDefault();\n this.#close();\n } else if (\n e.key === \"Backspace\" &&\n (e.currentTarget as HTMLInputElement).value === \"\" &&\n this.values.length > 0\n ) {\n e.preventDefault();\n this.#removeValue(this.values[this.values.length - 1]);\n }\n }\n\n #onSearchBlur(): void {\n if (this.#blurTimer) clearTimeout(this.#blurTimer);\n this.#blurTimer = setTimeout(() => {\n this.#blurTimer = null;\n if (!this._open) return;\n if (!this.#listboxPointerDown && !this.#suppressNextBlur) this.#close();\n });\n }\n\n #focusSearchInput(e: MouseEvent): void {\n if (\n e.button !== 0 ||\n this.#isDisabled ||\n e.composedPath()[0] instanceof HTMLInputElement\n ) {\n return;\n }\n e.preventDefault();\n const input = this.renderRoot.querySelector<HTMLInputElement>(\"input.search-input\");\n if (!this._open) this.#open();\n input?.focus();\n input?.select();\n }\n\n #onCompositionStart(): void {\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = null;\n this.#compositionJustEnded = false;\n this.#isComposing = true;\n }\n\n #onCompositionEnd(): void {\n this.#isComposing = false;\n this.#compositionJustEnded = true;\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = setTimeout(() => {\n this.#compositionJustEnded = false;\n this.#compositionEndTimer = null;\n });\n }\n\n #onListboxMousedown(e: MouseEvent): void {\n if (e.button !== 0) return;\n this.#listboxPointerDown = true;\n this.#suppressNextBlur = true;\n const input = this.renderRoot.querySelector<HTMLInputElement>(\"input.search-input\");\n this.#searchSelection = input ? [input.selectionStart, input.selectionEnd] : null;\n window.addEventListener(\n \"mouseup\",\n () => {\n this.#listboxPointerDown = false;\n if (this._open) {\n const searchInput =\n this.renderRoot.querySelector<HTMLInputElement>(\"input.search-input\");\n if (searchInput) {\n this.#restoringSearchFocus = true;\n searchInput.focus({ preventScroll: true });\n this.#restoringSearchFocus = false;\n const [start, end] = this.#searchSelection ?? [null, null];\n if (start !== null && end !== null) searchInput.setSelectionRange(start, end);\n }\n }\n this.#searchSelection = null;\n setTimeout(() => {\n this.#suppressNextBlur = false;\n });\n },\n { capture: true, once: true },\n );\n }\n\n #onOptionMousedown(e: MouseEvent, option: MultiSelectOption): void {\n if (e.button !== 0) return;\n const optionElement = e.currentTarget as HTMLElement;\n const listbox = optionElement.parentElement;\n if (listbox) {\n const scrollbarWidth = listbox.offsetWidth - listbox.clientWidth;\n const bounds = listbox.getBoundingClientRect();\n const isRtl = getComputedStyle(listbox).direction === \"rtl\";\n const inScrollbarGutter = isRtl\n ? e.clientX <= bounds.left + scrollbarWidth\n : e.clientX >= bounds.right - scrollbarWidth;\n if (scrollbarWidth > 0 && inScrollbarGutter) return;\n }\n e.preventDefault();\n if (this.#isOptionDisabled(option)) return;\n this.#toggleOption(option);\n if (this.variant === \"list\" && !this.searchable && !this.#isDisabled) {\n this.renderRoot\n .querySelector<HTMLElement>(\"ul.persistent\")\n ?.focus({ preventScroll: true });\n }\n }\n\n #optionIconSize(option: MultiSelectOption): number {\n const size = option.iconSize ?? 16;\n return Number.isFinite(size) && size > 0 ? size : 16;\n }\n\n #renderOptionIcon(option: MultiSelectOption) {\n if (!option.icon) return nothing;\n return html`\n <span\n class=\"option-icon\"\n style=${`--multi-select-icon-size: ${this.#optionIconSize(option)}px`}\n aria-hidden=\"true\"\n >\n ${option.icon}\n </span>\n `;\n }\n\n /** The shared `<li role=\"option\">` items for both variants' listboxes. */\n private renderOptionItems(options: MultiSelectOption[]) {\n return html`\n ${options.map((option, index) => {\n const selected = this.values.includes(option.value);\n const disabled = this.#isOptionDisabled(option);\n return html`\n <li\n id=${`${this.#listboxId}-option-${index}`}\n role=\"option\"\n aria-selected=${selected}\n aria-disabled=${disabled ? \"true\" : nothing}\n class=${index === this._activeIndex ? \"active\" : \"\"}\n @mousedown=${(e: MouseEvent) => this.#onOptionMousedown(e, option)}\n >\n <span class=\"check ${selected ? \"\" : \"hidden\"}\" aria-hidden=\"true\">\n ${iconCheckCircle(14)}\n </span>\n <span class=\"option-content\">\n ${this.#renderOptionIcon(option)}\n <span class=\"option-label\">${option.label}</span>\n </span>\n </li>\n `;\n })}\n ${options.length === 0\n ? html`<li class=\"no-options\" role=\"presentation\">\n <span role=\"status\">No options found</span>\n </li>`\n : nothing}\n `;\n }\n\n private renderListbox() {\n if (!this._open) return nothing;\n const options = this.#visibleOptions();\n return html`\n <ul\n id=${this.#listboxId}\n class=\"options\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n aria-label=${this.label ? `${this.label} options` : \"Options\"}\n @mousedown=${(e: MouseEvent) => this.#onListboxMousedown(e)}\n >\n ${this.renderOptionItems(options)}\n </ul>\n `;\n }\n\n private renderChips() {\n if (!this.showChips || this.values.length === 0) return nothing;\n return html`\n <div class=\"chips\">\n ${this.values.map((value) => {\n const label = this.#labelFor(value);\n return html`\n <span class=\"chip\">\n <span class=\"chip-label\">${label}</span>\n <button\n type=\"button\"\n class=\"chip-remove\"\n aria-label=${`Remove ${label}`}\n ?disabled=${this.#isDisabled}\n @click=${() => this.#removeValue(value)}\n >\n ${iconX(18)}\n </button>\n </span>\n `;\n })}\n </div>\n `;\n }\n\n private renderSearchTrigger() {\n const activeDescendant =\n this._open && this._activeIndex >= 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n return html`\n <div\n class=\"search-trigger ${this.#isDisabled ? \"disabled\" : \"\"}\"\n @mousedown=${(e: MouseEvent) => this.#focusSearchInput(e)}\n >\n <input\n type=\"text\"\n class=\"search-input\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-expanded=${this._open}\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n aria-label=${this.label || \"Select options\"}\n placeholder=${this.#summaryText()}\n autocomplete=\"off\"\n ?disabled=${this.#isDisabled}\n .value=${this._query ?? \"\"}\n @mousedown=${(e: MouseEvent) => this.#onSearchMousedown(e)}\n @focus=${(e: FocusEvent) => this.#onSearchFocus(e)}\n @click=${() => this.#onSearchClick()}\n @input=${(e: InputEvent) => this.#onSearchInput(e)}\n @compositionstart=${() => this.#onCompositionStart()}\n @compositionend=${() => this.#onCompositionEnd()}\n @keydown=${(e: KeyboardEvent) => this.#onSearchKeydown(e)}\n @blur=${() => this.#onSearchBlur()}\n />\n <span class=\"chevron\">${iconChevronRight(14)}</span>\n </div>\n `;\n }\n\n private renderButtonTrigger() {\n const activeDescendant =\n this._open && this._activeIndex >= 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n const empty = this.values.length === 0;\n return html`\n <button\n type=\"button\"\n class=\"trigger\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded=${this._open}\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n aria-label=${this.label || nothing}\n ?disabled=${this.#isDisabled}\n @click=${() => this.#toggle()}\n @keydown=${(e: KeyboardEvent) => this.#onTriggerKeydown(e)}\n >\n <span class=\"trigger-label ${empty ? \"placeholder\" : \"\"}\">${this.#summaryText()}</span>\n <span class=\"chevron\">${iconChevronRight(14)}</span>\n </button>\n `;\n }\n\n private renderListSearch() {\n const activeDescendant =\n this._activeIndex >= 0 ? `${this.#listboxId}-option-${this._activeIndex}` : nothing;\n return html`\n <div class=\"search-field ${this.#isDisabled ? \"disabled\" : \"\"}\">\n <input\n type=\"text\"\n class=\"search-input list-search\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-expanded=\"true\"\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n aria-label=${this.label || \"Select options\"}\n placeholder=${this.#summaryText()}\n autocomplete=\"off\"\n ?disabled=${this.#isDisabled}\n .value=${this._query ?? \"\"}\n @input=${(e: InputEvent) => this.#onListSearchInput(e)}\n @compositionstart=${() => this.#onCompositionStart()}\n @compositionend=${() => this.#onCompositionEnd()}\n @keydown=${(e: KeyboardEvent) => this.#onListSearchKeydown(e)}\n />\n </div>\n `;\n }\n\n private renderPersistentList() {\n const options = this.#visibleOptions();\n const focusable = !this.searchable && !this.#isDisabled;\n const activeDescendant =\n !this.searchable && this._activeIndex >= 0 && options.length > 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n return html`\n <ul\n id=${this.#listboxId}\n class=\"options persistent ${this.#isDisabled ? \"disabled\" : \"\"}\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n aria-label=${this.label ? `${this.label} options` : \"Options\"}\n aria-disabled=${this.#isDisabled ? \"true\" : nothing}\n tabindex=${focusable ? \"0\" : nothing}\n aria-activedescendant=${activeDescendant}\n style=${`height: calc(${this.#rows} * 2rem + 0.5rem + 2px)`}\n @mousedown=${(e: MouseEvent) => this.#onListboxMousedown(e)}\n @focus=${() => this.#onListFocus()}\n @keydown=${(e: KeyboardEvent) => this.#onListKeydown(e)}\n >\n ${this.renderOptionItems(options)}\n </ul>\n `;\n }\n\n private renderListVariant() {\n return html`\n <div class=\"control list-control\">\n ${this.searchable ? this.renderListSearch() : nothing}\n ${this.renderPersistentList()}\n </div>\n ${this.renderChips()}\n <span class=\"sr-only\" aria-live=\"polite\">${this.#liveText()}</span>\n `;\n }\n\n override render() {\n if (this.variant === \"list\") return this.renderListVariant();\n return html`\n <div class=\"control\" @focusout=${(e: FocusEvent) => this.#onFocusOut(e)}>\n ${this.searchable ? this.renderSearchTrigger() : this.renderButtonTrigger()}\n ${this.renderListbox()}\n </div>\n ${this.renderChips()}\n <span class=\"sr-only\" aria-live=\"polite\">${this.#liveText()}</span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"multi-select\": MultiSelect;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price-history-chart.d.ts","sourceRoot":"","sources":["../src/price-history-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"price-history-chart.d.ts","sourceRoot":"","sources":["../src/price-history-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AAQjD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAsBD;;;;;;;;;;GAUG;AACH,qBACa,iBAAkB,SAAQ,UAAU;IACpB,OAAO,EAAE,UAAU,EAAE,CAAM;IACjB,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAU;IAC5B,UAAU,SAAK;IAE7D,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,WAAW,CAAuB;IAEnD,OAAO,CAAC,GAAG,CAA+B;IAEjC,iBAAiB,SAOzB;IAEQ,oBAAoB,SAI5B;IAED,OAAO,KAAK,WAAW,GAItB;IAED,OAAO,KAAK,KAAK,GAEhB;IAED,OAAgB,MAAM,4BAiDpB;IAEF,OAAO,CAAC,aAAa;IA8CZ,MAAM,yCAoFd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,iBAAiB,CAAC;KAC1C;CACF"}
|
|
@@ -10,6 +10,11 @@ import { scaleTime, scaleLinear } from "d3-scale";
|
|
|
10
10
|
import { line, area } from "d3-shape";
|
|
11
11
|
import { min, max } from "d3-array";
|
|
12
12
|
import { tokens } from "./tokens.js";
|
|
13
|
+
import { parseIsoDate } from "./utils/calendar.js";
|
|
14
|
+
/** Reads a date-only `"YYYY-MM-DD"` as local midnight (not UTC); any other string goes through `Date`. */
|
|
15
|
+
function toDate(date) {
|
|
16
|
+
return parseIsoDate(date) ?? new Date(date);
|
|
17
|
+
}
|
|
13
18
|
function fmtMoney(n) {
|
|
14
19
|
return `$${n.toLocaleString("en-US")}`;
|
|
15
20
|
}
|
|
@@ -58,7 +63,7 @@ let PriceHistoryChart = class PriceHistoryChart extends LitElement {
|
|
|
58
63
|
get validPoints() {
|
|
59
64
|
return this.history
|
|
60
65
|
.filter((h) => h.price != null && h.date != null)
|
|
61
|
-
.sort((a, b) =>
|
|
66
|
+
.sort((a, b) => toDate(a.date).getTime() - toDate(b.date).getTime());
|
|
62
67
|
}
|
|
63
68
|
get showY() {
|
|
64
69
|
return this.yLabels === "always" || (this.yLabels === "auto" && this._width >= 260);
|
|
@@ -128,7 +133,7 @@ let PriceHistoryChart = class PriceHistoryChart extends LitElement {
|
|
|
128
133
|
const plotH = Math.max(H - MT - MB, 1);
|
|
129
134
|
const bottomY = MT + plotH;
|
|
130
135
|
const prices = points.map((p) => p.price);
|
|
131
|
-
const dates = points.map((p) =>
|
|
136
|
+
const dates = points.map((p) => toDate(p.date));
|
|
132
137
|
const minPrice = min(prices);
|
|
133
138
|
const maxPrice = max(prices);
|
|
134
139
|
const pad = (maxPrice - minPrice) * 0.05 || maxPrice * 0.05;
|
|
@@ -139,15 +144,15 @@ let PriceHistoryChart = class PriceHistoryChart extends LitElement {
|
|
|
139
144
|
.domain([minPrice - pad, maxPrice + pad])
|
|
140
145
|
.range([bottomY, MT]);
|
|
141
146
|
const lineFn = line()
|
|
142
|
-
.x((p) => xScale(
|
|
147
|
+
.x((p) => xScale(toDate(p.date)))
|
|
143
148
|
.y((p) => yScale(p.price));
|
|
144
149
|
const areaFn = area()
|
|
145
|
-
.x((p) => xScale(
|
|
150
|
+
.x((p) => xScale(toDate(p.date)))
|
|
146
151
|
.y0(bottomY)
|
|
147
152
|
.y1((p) => yScale(p.price));
|
|
148
153
|
const plotted = points.map((p) => ({
|
|
149
154
|
...p,
|
|
150
|
-
x: xScale(
|
|
155
|
+
x: xScale(toDate(p.date)),
|
|
151
156
|
y: yScale(p.price),
|
|
152
157
|
}));
|
|
153
158
|
return { points, plotted, H, MT, ML, MR, plotW, plotH, bottomY, minPrice, maxPrice, xScale, yScale, lineFn, areaFn };
|
|
@@ -162,7 +167,7 @@ let PriceHistoryChart = class PriceHistoryChart extends LitElement {
|
|
|
162
167
|
const hIdx = this._hoveredIdx;
|
|
163
168
|
const hovPt = hIdx !== null ? plotted[hIdx] : null;
|
|
164
169
|
const tooltipEl = hovPt ? (() => {
|
|
165
|
-
const tipText = `${fmtMoney(hovPt.price)} · ${hovPt.date ?
|
|
170
|
+
const tipText = `${fmtMoney(hovPt.price)} · ${hovPt.date ? toDate(hovPt.date).toLocaleDateString("en-US", { month: "short", year: "numeric" }) : ""} · ${hovPt.eventType}`;
|
|
166
171
|
const tipW = Math.min(tipText.length * 6.5 + 16, this._width - ML - MR);
|
|
167
172
|
const tipH = 24;
|
|
168
173
|
const tipGap = 8;
|
|
@@ -200,7 +205,7 @@ let PriceHistoryChart = class PriceHistoryChart extends LitElement {
|
|
|
200
205
|
}) : [];
|
|
201
206
|
const firstPoint = points[0];
|
|
202
207
|
const lastPoint = points[points.length - 1];
|
|
203
|
-
const formatDate = (date) =>
|
|
208
|
+
const formatDate = (date) => toDate(date).toLocaleDateString("en-US", { month: "short", year: "numeric" });
|
|
204
209
|
const summary = `${points.length} price points from ${formatDate(firstPoint.date)} at ${fmtMoney(firstPoint.price)} ` +
|
|
205
210
|
`to ${formatDate(lastPoint.date)} at ${fmtMoney(lastPoint.price)}.`;
|
|
206
211
|
return html `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price-history-chart.js","sourceRoot":"","sources":["../src/price-history-chart.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAcrC,SAAS,QAAQ,CAAC,CAAS;IACzB,OAAO,IAAI,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;AACzC,CAAC;AAED,SAAS,aAAa,CAAC,CAAS;IAC9B,IAAI,CAAC,IAAI,SAAS;QAAE,OAAO,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAC7D,IAAI,CAAC,IAAI,KAAK;QAAE,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;IACpD,OAAO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;IAAhB,KAAK,EAAE;sDAA2C;AANxC,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAyN7B","sourcesContent":["import { LitElement, css, html, svg } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { scaleTime, scaleLinear } from \"d3-scale\";\nimport { line, area } from \"d3-shape\";\nimport { min, max } from \"d3-array\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface PricePoint {\n date: string | null;\n price: number | null;\n eventType: string;\n source?: string | null;\n}\n\ninterface PlottedPoint extends PricePoint {\n x: number;\n y: number;\n}\n\nfunction fmtMoney(n: number): string {\n return `$${n.toLocaleString(\"en-US\")}`;\n}\n\nfunction fmtMoneyShort(n: number): string {\n if (n >= 1_000_000) return `$${(n / 1_000_000).toFixed(1)}M`;\n if (n >= 1_000) return `$${Math.round(n / 1_000)}K`;\n return `$${n.toLocaleString(\"en-US\")}`;\n}\n\n/**\n * D3-powered SVG line chart for property price history.\n *\n * Uses scaleTime (X) + scaleLinear (Y) from d3-scale and line/area path\n * generators from d3-shape. Adapts to container width via ResizeObserver.\n *\n * @element price-history-chart\n * @prop history - Array of price points (points with null price/date are skipped).\n * @prop yLabels - \"auto\" (default) | \"always\" | \"never\"\n * @prop maxXLabels - Max X-axis date ticks (default 3).\n */\n@customElement(\"price-history-chart\")\nexport class PriceHistoryChart extends LitElement {\n @property({ type: Array }) history: PricePoint[] = [];\n @property({ attribute: \"y-labels\" }) yLabels: \"auto\" | \"always\" | \"never\" = \"auto\";\n @property({ type: Number, attribute: \"max-x-labels\" }) maxXLabels = 3;\n\n @state() private _width = 0;\n @state() private _hoveredIdx: number | null = null;\n\n private _ro: ResizeObserver | null = null;\n\n override connectedCallback() {\n super.connectedCallback();\n this._ro = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) this._width = entry.contentRect.width;\n });\n this._ro.observe(this);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this._ro?.disconnect();\n this._ro = null;\n }\n\n private get validPoints(): PricePoint[] {\n return this.history\n .filter((h) => h.price != null && h.date != null)\n .sort((a, b) => new Date(a.date!).getTime() - new Date(b.date!).getTime());\n }\n\n private get showY(): boolean {\n return this.yLabels === \"always\" || (this.yLabels === \"auto\" && this._width >= 260);\n }\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n width: 100%;\n }\n .wrap {\n position: relative;\n width: 100%;\n }\n svg {\n display: block;\n overflow: visible;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .axis-label {\n fill: var(--ui-text-muted, #64748b);\n }\n .grid-line {\n stroke: var(--ui-border, #e2e8f0);\n }\n .series-line {\n stroke: var(--ui-primary, #4f46e5);\n }\n .series-gradient {\n stop-color: var(--ui-primary, #4f46e5);\n }\n .series-point {\n fill: var(--ui-primary, #4f46e5);\n stroke: var(--ui-on-accent, #ffffff);\n cursor: pointer;\n }\n .tooltip {\n fill: var(--ui-tooltip, #0f172a);\n }\n .tooltip-label {\n fill: var(--ui-tooltip-text, #ffffff);\n }\n `,\n ];\n\n private computeLayout() {\n if (this._width < 10) return null;\n const points = this.validPoints;\n if (points.length < 2) return null;\n\n const H = 180;\n const MT = 20;\n const MB = 30;\n const MR = 12;\n const ML = this.showY ? 56 : 12;\n const plotW = Math.max(this._width - ML - MR, 1);\n const plotH = Math.max(H - MT - MB, 1);\n const bottomY = MT + plotH;\n\n const prices = points.map((p) => p.price!);\n const dates = points.map((p) => new Date(p.date!));\n const minPrice = min(prices)!;\n const maxPrice = max(prices)!;\n const pad = (maxPrice - minPrice) * 0.05 || maxPrice * 0.05;\n\n const xScale = scaleTime()\n .domain([min(dates)!, max(dates)!])\n .range([ML, ML + plotW]);\n\n const yScale = scaleLinear()\n .domain([minPrice - pad, maxPrice + pad])\n .range([bottomY, MT]);\n\n const lineFn = line<PricePoint>()\n .x((p) => xScale(new Date(p.date!)))\n .y((p) => yScale(p.price!));\n\n const areaFn = area<PricePoint>()\n .x((p) => xScale(new Date(p.date!)))\n .y0(bottomY)\n .y1((p) => yScale(p.price!));\n\n const plotted: PlottedPoint[] = points.map((p) => ({\n ...p,\n x: xScale(new Date(p.date!)),\n y: yScale(p.price!),\n }));\n\n return { points, plotted, H, MT, ML, MR, plotW, plotH, bottomY, minPrice, maxPrice, xScale, yScale, lineFn, areaFn };\n }\n\n override render() {\n const layout = this.computeLayout();\n if (!layout) return html``;\n\n const { points, plotted, H, MT, ML, MR, plotW, plotH, xScale, yScale, lineFn, areaFn } = layout;\n\n const lineD = lineFn(points) ?? \"\";\n const areaD = areaFn(points) ?? \"\";\n\n const hIdx = this._hoveredIdx;\n const hovPt = hIdx !== null ? plotted[hIdx] : null;\n\n const tooltipEl = hovPt ? (() => {\n const tipText = `${fmtMoney(hovPt.price!)} · ${hovPt.date ? new Date(hovPt.date).toLocaleDateString(\"en-US\", { month: \"short\", year: \"numeric\" }) : \"\"} · ${hovPt.eventType}`;\n const tipW = Math.min(tipText.length * 6.5 + 16, this._width - ML - MR);\n const tipH = 24;\n const tipGap = 8;\n const above = hovPt.y > plotH / 2 + MT;\n const tipRectY = above ? hovPt.y - tipGap - tipH : hovPt.y + tipGap;\n const tipX = Math.min(Math.max(hovPt.x - tipW / 2, ML), this._width - MR - tipW);\n return svg`\n <g pointer-events=\"none\">\n <rect class=\"tooltip\" x=\"${tipX}\" y=\"${tipRectY}\" width=\"${tipW}\" height=\"${tipH}\"\n rx=\"4\" />\n <text class=\"tooltip-label\" x=\"${tipX + tipW / 2}\" y=\"${tipRectY + 15.5}\"\n text-anchor=\"middle\" font-size=\"11\">${tipText}</text>\n </g>\n `;\n })() : \"\";\n\n const xTicks = xScale.ticks(this.maxXLabels).map((d, i, arr) => {\n const x = xScale(d);\n const label = d.toLocaleDateString(\"en-US\", { month: \"short\", year: \"numeric\" });\n const anchor = i === 0 ? \"start\" : i === arr.length - 1 ? \"end\" : \"middle\";\n return svg`\n <text class=\"axis-label\" x=\"${x}\" y=\"${H - 6}\" text-anchor=\"${anchor}\" font-size=\"10\">${label}</text>\n `;\n });\n\n const yTicks = this.showY ? yScale.ticks(3).map((v, i, arr) => {\n const y = yScale(v);\n const isFirst = i === 0;\n const isLast = i === arr.length - 1;\n return svg`\n <line class=\"grid-line\" x1=\"${ML - 4}\" y1=\"${y}\" x2=\"${ML + plotW}\" y2=\"${y}\"\n stroke-width=\"1\" />\n ${isFirst || isLast ? svg`\n <text class=\"axis-label\" x=\"${ML - 6}\" y=\"${y + 4}\" text-anchor=\"end\" font-size=\"10\">${fmtMoneyShort(v)}</text>\n ` : \"\"}\n `;\n }) : [];\n\n const firstPoint = points[0];\n const lastPoint = points[points.length - 1];\n const formatDate = (date: string | null) =>\n new Date(date!).toLocaleDateString(\"en-US\", { month: \"short\", year: \"numeric\" });\n const summary =\n `${points.length} price points from ${formatDate(firstPoint.date)} at ${fmtMoney(firstPoint.price!)} ` +\n `to ${formatDate(lastPoint.date)} at ${fmtMoney(lastPoint.price!)}.`;\n\n return html`\n <div class=\"wrap\">\n <svg width=\"${this._width}\" height=\"${H}\" role=\"img\" aria-label=${summary}>\n <defs>\n <linearGradient id=\"phg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop class=\"series-gradient\" offset=\"0%\" stop-opacity=\"0.25\" />\n <stop class=\"series-gradient\" offset=\"100%\" stop-opacity=\"0\" />\n </linearGradient>\n </defs>\n ${yTicks}\n <path d=\"${areaD}\" fill=\"url(#phg)\" />\n <path class=\"series-line\" d=\"${lineD}\" fill=\"none\" stroke-width=\"2.5\"\n stroke-linejoin=\"round\" stroke-linecap=\"round\" />\n ${plotted.map((p, i) => svg`\n <circle class=\"series-point\" cx=\"${p.x}\" cy=\"${p.y}\" r=\"${i === hIdx ? 7 : 5}\"\n stroke-width=\"2\"\n @pointerenter=${() => { this._hoveredIdx = i; }}\n @pointerleave=${() => { this._hoveredIdx = null; }} />\n `)}\n ${xTicks}\n ${tooltipEl}\n </svg>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"price-history-chart\": PriceHistoryChart;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"price-history-chart.js","sourceRoot":"","sources":["../src/price-history-chart.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAcnD,0GAA0G;AAC1G,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,QAAQ,CAAC,CAAS;IACzB,OAAO,IAAI,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;AACzC,CAAC;AAED,SAAS,aAAa,CAAC,CAAS;IAC9B,IAAI,CAAC,IAAI,SAAS;QAAE,OAAO,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAC7D,IAAI,CAAC,IAAI,KAAK;QAAE,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;IACpD,OAAO,IAAI,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CA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sourcesContent":["import { LitElement, css, html, svg } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { scaleTime, scaleLinear } from \"d3-scale\";\nimport { line, area } from \"d3-shape\";\nimport { min, max } from \"d3-array\";\nimport { tokens } from \"./tokens.js\";\nimport { parseIsoDate } from \"./utils/calendar.js\";\n\nexport interface PricePoint {\n date: string | null;\n price: number | null;\n eventType: string;\n source?: string | null;\n}\n\ninterface PlottedPoint extends PricePoint {\n x: number;\n y: number;\n}\n\n/** Reads a date-only `\"YYYY-MM-DD\"` as local midnight (not UTC); any other string goes through `Date`. */\nfunction toDate(date: string): Date {\n return parseIsoDate(date) ?? new Date(date);\n}\n\nfunction fmtMoney(n: number): string {\n return `$${n.toLocaleString(\"en-US\")}`;\n}\n\nfunction fmtMoneyShort(n: number): string {\n if (n >= 1_000_000) return `$${(n / 1_000_000).toFixed(1)}M`;\n if (n >= 1_000) return `$${Math.round(n / 1_000)}K`;\n return `$${n.toLocaleString(\"en-US\")}`;\n}\n\n/**\n * D3-powered SVG line chart for property price history.\n *\n * Uses scaleTime (X) + scaleLinear (Y) from d3-scale and line/area path\n * generators from d3-shape. Adapts to container width via ResizeObserver.\n *\n * @element price-history-chart\n * @prop history - Array of price points (points with null price/date are skipped).\n * @prop yLabels - \"auto\" (default) | \"always\" | \"never\"\n * @prop maxXLabels - Max X-axis date ticks (default 3).\n */\n@customElement(\"price-history-chart\")\nexport class PriceHistoryChart extends LitElement {\n @property({ type: Array }) history: PricePoint[] = [];\n @property({ attribute: \"y-labels\" }) yLabels: \"auto\" | \"always\" | \"never\" = \"auto\";\n @property({ type: Number, attribute: \"max-x-labels\" }) maxXLabels = 3;\n\n @state() private _width = 0;\n @state() private _hoveredIdx: number | null = null;\n\n private _ro: ResizeObserver | null = null;\n\n override connectedCallback() {\n super.connectedCallback();\n this._ro = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) this._width = entry.contentRect.width;\n });\n this._ro.observe(this);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this._ro?.disconnect();\n this._ro = null;\n }\n\n private get validPoints(): PricePoint[] {\n return this.history\n .filter((h) => h.price != null && h.date != null)\n .sort((a, b) => toDate(a.date!).getTime() - toDate(b.date!).getTime());\n }\n\n private get showY(): boolean {\n return this.yLabels === \"always\" || (this.yLabels === \"auto\" && this._width >= 260);\n }\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n width: 100%;\n }\n .wrap {\n position: relative;\n width: 100%;\n }\n svg {\n display: block;\n overflow: visible;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .axis-label {\n fill: var(--ui-text-muted, #64748b);\n }\n .grid-line {\n stroke: var(--ui-border, #e2e8f0);\n }\n .series-line {\n stroke: var(--ui-primary, #4f46e5);\n }\n .series-gradient {\n stop-color: var(--ui-primary, #4f46e5);\n }\n .series-point {\n fill: var(--ui-primary, #4f46e5);\n stroke: var(--ui-on-accent, #ffffff);\n cursor: pointer;\n }\n .tooltip {\n fill: var(--ui-tooltip, #0f172a);\n }\n .tooltip-label {\n fill: var(--ui-tooltip-text, #ffffff);\n }\n `,\n ];\n\n private computeLayout() {\n if (this._width < 10) return null;\n const points = this.validPoints;\n if (points.length < 2) return null;\n\n const H = 180;\n const MT = 20;\n const MB = 30;\n const MR = 12;\n const ML = this.showY ? 56 : 12;\n const plotW = Math.max(this._width - ML - MR, 1);\n const plotH = Math.max(H - MT - MB, 1);\n const bottomY = MT + plotH;\n\n const prices = points.map((p) => p.price!);\n const dates = points.map((p) => toDate(p.date!));\n const minPrice = min(prices)!;\n const maxPrice = max(prices)!;\n const pad = (maxPrice - minPrice) * 0.05 || maxPrice * 0.05;\n\n const xScale = scaleTime()\n .domain([min(dates)!, max(dates)!])\n .range([ML, ML + plotW]);\n\n const yScale = scaleLinear()\n .domain([minPrice - pad, maxPrice + pad])\n .range([bottomY, MT]);\n\n const lineFn = line<PricePoint>()\n .x((p) => xScale(toDate(p.date!)))\n .y((p) => yScale(p.price!));\n\n const areaFn = area<PricePoint>()\n .x((p) => xScale(toDate(p.date!)))\n .y0(bottomY)\n .y1((p) => yScale(p.price!));\n\n const plotted: PlottedPoint[] = points.map((p) => ({\n ...p,\n x: xScale(toDate(p.date!)),\n y: yScale(p.price!),\n }));\n\n return { points, plotted, H, MT, ML, MR, plotW, plotH, bottomY, minPrice, maxPrice, xScale, yScale, lineFn, areaFn };\n }\n\n override render() {\n const layout = this.computeLayout();\n if (!layout) return html``;\n\n const { points, plotted, H, MT, ML, MR, plotW, plotH, xScale, yScale, lineFn, areaFn } = layout;\n\n const lineD = lineFn(points) ?? \"\";\n const areaD = areaFn(points) ?? \"\";\n\n const hIdx = this._hoveredIdx;\n const hovPt = hIdx !== null ? plotted[hIdx] : null;\n\n const tooltipEl = hovPt ? (() => {\n const tipText = `${fmtMoney(hovPt.price!)} · ${hovPt.date ? toDate(hovPt.date).toLocaleDateString(\"en-US\", { month: \"short\", year: \"numeric\" }) : \"\"} · ${hovPt.eventType}`;\n const tipW = Math.min(tipText.length * 6.5 + 16, this._width - ML - MR);\n const tipH = 24;\n const tipGap = 8;\n const above = hovPt.y > plotH / 2 + MT;\n const tipRectY = above ? hovPt.y - tipGap - tipH : hovPt.y + tipGap;\n const tipX = Math.min(Math.max(hovPt.x - tipW / 2, ML), this._width - MR - tipW);\n return svg`\n <g pointer-events=\"none\">\n <rect class=\"tooltip\" x=\"${tipX}\" y=\"${tipRectY}\" width=\"${tipW}\" height=\"${tipH}\"\n rx=\"4\" />\n <text class=\"tooltip-label\" x=\"${tipX + tipW / 2}\" y=\"${tipRectY + 15.5}\"\n text-anchor=\"middle\" font-size=\"11\">${tipText}</text>\n </g>\n `;\n })() : \"\";\n\n const xTicks = xScale.ticks(this.maxXLabels).map((d, i, arr) => {\n const x = xScale(d);\n const label = d.toLocaleDateString(\"en-US\", { month: \"short\", year: \"numeric\" });\n const anchor = i === 0 ? \"start\" : i === arr.length - 1 ? \"end\" : \"middle\";\n return svg`\n <text class=\"axis-label\" x=\"${x}\" y=\"${H - 6}\" text-anchor=\"${anchor}\" font-size=\"10\">${label}</text>\n `;\n });\n\n const yTicks = this.showY ? yScale.ticks(3).map((v, i, arr) => {\n const y = yScale(v);\n const isFirst = i === 0;\n const isLast = i === arr.length - 1;\n return svg`\n <line class=\"grid-line\" x1=\"${ML - 4}\" y1=\"${y}\" x2=\"${ML + plotW}\" y2=\"${y}\"\n stroke-width=\"1\" />\n ${isFirst || isLast ? svg`\n <text class=\"axis-label\" x=\"${ML - 6}\" y=\"${y + 4}\" text-anchor=\"end\" font-size=\"10\">${fmtMoneyShort(v)}</text>\n ` : \"\"}\n `;\n }) : [];\n\n const firstPoint = points[0];\n const lastPoint = points[points.length - 1];\n const formatDate = (date: string | null) =>\n toDate(date!).toLocaleDateString(\"en-US\", { month: \"short\", year: \"numeric\" });\n const summary =\n `${points.length} price points from ${formatDate(firstPoint.date)} at ${fmtMoney(firstPoint.price!)} ` +\n `to ${formatDate(lastPoint.date)} at ${fmtMoney(lastPoint.price!)}.`;\n\n return html`\n <div class=\"wrap\">\n <svg width=\"${this._width}\" height=\"${H}\" role=\"img\" aria-label=${summary}>\n <defs>\n <linearGradient id=\"phg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop class=\"series-gradient\" offset=\"0%\" stop-opacity=\"0.25\" />\n <stop class=\"series-gradient\" offset=\"100%\" stop-opacity=\"0\" />\n </linearGradient>\n </defs>\n ${yTicks}\n <path d=\"${areaD}\" fill=\"url(#phg)\" />\n <path class=\"series-line\" d=\"${lineD}\" fill=\"none\" stroke-width=\"2.5\"\n stroke-linejoin=\"round\" stroke-linecap=\"round\" />\n ${plotted.map((p, i) => svg`\n <circle class=\"series-point\" cx=\"${p.x}\" cy=\"${p.y}\" r=\"${i === hIdx ? 7 : 5}\"\n stroke-width=\"2\"\n @pointerenter=${() => { this._hoveredIdx = i; }}\n @pointerleave=${() => { this._hoveredIdx = null; }} />\n `)}\n ${xTicks}\n ${tooltipEl}\n </svg>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"price-history-chart\": PriceHistoryChart;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-slider.d.ts","sourceRoot":"","sources":["../src/range-slider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAIjE;;;;;;;;;;;;;;GAcG;AACH,qBACa,WAAY,SAAQ,UAAU;;IACzC,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAgB,MAAM,4BA2GpB;IAEF,qBAAqB;IACO,GAAG,SAAK;IACpC,qBAAqB;IACO,GAAG,SAAO;IACtC,sBAAsB;IACM,IAAI,SAAK;IACrC,qBAAqB;IACO,KAAK,SAAK;IACtC,2EAA2E;
|
|
1
|
+
{"version":3,"file":"range-slider.d.ts","sourceRoot":"","sources":["../src/range-slider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAIjE;;;;;;;;;;;;;;GAcG;AACH,qBACa,WAAY,SAAQ,UAAU;;IACzC,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAgB,MAAM,4BA2GpB;IAEF,qBAAqB;IACO,GAAG,SAAK;IACpC,qBAAqB;IACO,GAAG,SAAO;IACtC,sBAAsB;IACM,IAAI,SAAK;IACrC,qBAAqB;IACO,KAAK,SAAK;IACtC,2EAA2E;IAC/B,QAAQ,UAAS;IAC7D,uBAAuB;IACX,IAAI,SAAM;IAEb,OAAO,CAAC,aAAa,CAAS;IAevC,UAAmB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAG3D;IAED,0EAA0E;IAC1E,iBAAiB,IAAI,IAAI,CAExB;IAED,qDAAqD;IACrD,oBAAoB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAE5C;IAED,mEAAmE;IACnE,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI,CAIrE;IAsBQ,MAAM,yCAcd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|
package/dist/range-slider.js
CHANGED
|
@@ -229,7 +229,7 @@ __decorate([
|
|
|
229
229
|
property({ type: Number })
|
|
230
230
|
], RangeSlider.prototype, "value", void 0);
|
|
231
231
|
__decorate([
|
|
232
|
-
property({ type: Boolean })
|
|
232
|
+
property({ type: Boolean, reflect: true })
|
|
233
233
|
], RangeSlider.prototype, "disabled", void 0);
|
|
234
234
|
__decorate([
|
|
235
235
|
property()
|
package/dist/range-slider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-slider.js","sourceRoot":"","sources":["../src/range-slider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;;GAcG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAgHL,qBAAqB;QACO,QAAG,GAAG,CAAC,CAAC;QACpC,qBAAqB;QACO,QAAG,GAAG,GAAG,CAAC;QACtC,sBAAsB;QACM,SAAI,GAAG,CAAC,CAAC;QACrC,qBAAqB;QACO,UAAK,GAAG,CAAC,CAAC;QACtC,2EAA2E;QAC9C,aAAQ,GAAG,KAAK,CAAC;QAC9C,uBAAuB;QACX,SAAI,GAAG,EAAE,CAAC;QAEL,kBAAa,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AC,IAAI,CAAC,KAAK,CAAC;oBACf,IAAI,CAAC,WAAW;iBACnB,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;kBAC7B,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;;KAE5C,CAAC;IACJ,CAAC;CACF,CAAA;AApF6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAS;AAER;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAW;AAEV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAU;AAET;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAW;AAET;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAkB;AAElC;IAAX,QAAQ,EAAE;yCAAW;AAEL;IAAhB,KAAK,EAAE;kDAA+B;AA7H5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAqMvB","sourcesContent":["import { LitElement, css, html, type PropertyValues } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A form-associated numeric range slider, usable standalone or inside a\n * native `<form>`. Wraps a native `<input type=\"range\">` (kept for its free\n * keyboard, drag, and screen-reader support) restyled to match this\n * package's track/fill visual language (`stat-meter`, `percent-bar-chart`)\n * instead of the browser-default appearance. Purely a value control — no\n * built-in label; wrap in `form-field` for a labeled field, or render a\n * value readout next to it (see the playground example), matching\n * `autocomplete-input`/`form-select`.\n *\n * @element range-slider\n * @fires input - Fires continuously while dragging/typing; detail: `{ value }`.\n * @fires change - Fires once the value is committed (drag released, arrow\n * key released); detail: `{ value }`.\n */\n@customElement(\"range-slider\")\nexport class RangeSlider extends LitElement {\n static formAssociated = true;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n input[type=\"range\"] {\n -webkit-appearance: none;\n appearance: none;\n width: 100%;\n height: 2rem;\n margin: 0;\n background: transparent;\n cursor: pointer;\n }\n input[type=\"range\"]:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n /* Track */\n input[type=\"range\"]::-webkit-slider-runnable-track {\n height: 0.375rem;\n border-radius: var(--ui-radius-pill, 9999px);\n /* A hard-stop background gradient used as a two-tone fill trick —\n its color-stops can't themselves hold a gradient value, so this\n reads --ui-button-accent (a solid stand-in), not\n --ui-button-background directly. */\n background: linear-gradient(\n to right,\n var(--ui-button-accent, var(--ui-primary, #4f46e5)) 0%,\n var(--ui-button-accent, var(--ui-primary, #4f46e5)) var(--range-percent, 0%),\n var(--ui-surface-muted, #f8fafc) var(--range-percent, 0%),\n var(--ui-surface-muted, #f8fafc) 100%\n );\n }\n input[type=\"range\"]::-moz-range-track {\n height: 0.375rem;\n border-radius: var(--ui-radius-pill, 9999px);\n background: var(--ui-surface-muted, #f8fafc);\n }\n input[type=\"range\"]::-moz-range-progress {\n height: 0.375rem;\n border-radius: var(--ui-radius-pill, 9999px);\n background: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n }\n /* Thumb */\n input[type=\"range\"]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 1rem;\n height: 1rem;\n /* WebKit centers the thumb on the input's full 2rem box, not the\n thinner custom track — nudge it up to align with the track.\n A transform offset (not margin) so it isn't a spacing-grid value. */\n transform: translateY(-0.3125rem);\n border-radius: var(--ui-radius-circle, 50%);\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border: 2px solid var(--ui-surface, #ffffff);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n input[type=\"range\"]::-moz-range-thumb {\n width: 1rem;\n height: 1rem;\n border-radius: var(--ui-radius-circle, 50%);\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border: 2px solid var(--ui-surface, #ffffff);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n input[type=\"range\"]:disabled::-webkit-slider-thumb {\n background: var(--ui-text-muted, #64748b);\n }\n input[type=\"range\"]:disabled::-moz-range-thumb {\n background: var(--ui-text-muted, #64748b);\n }\n input[type=\"range\"]:focus-visible {\n outline: none;\n }\n input[type=\"range\"]:focus-visible::-webkit-slider-thumb {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n input[type=\"range\"]:focus-visible::-moz-range-thumb {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n @media (prefers-reduced-motion: no-preference) {\n input[type=\"range\"]::-webkit-slider-thumb {\n transition: box-shadow 120ms ease;\n }\n input[type=\"range\"]::-moz-range-thumb {\n transition: box-shadow 120ms ease;\n }\n }\n @media (forced-colors: active) {\n input[type=\"range\"]::-webkit-slider-runnable-track {\n background: Canvas;\n border: 1px solid CanvasText;\n }\n input[type=\"range\"]::-webkit-slider-thumb {\n background: Highlight;\n border-color: Canvas;\n }\n input[type=\"range\"]:focus-visible::-webkit-slider-thumb {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n /** Minimum value. */\n @property({ type: Number }) min = 0;\n /** Maximum value. */\n @property({ type: Number }) max = 100;\n /** Step increment. */\n @property({ type: Number }) step = 1;\n /** Current value. */\n @property({ type: Number }) value = 0;\n /** Disables interaction; merged with an ancestor `<fieldset disabled>`. */\n @property({ type: Boolean }) disabled = false;\n /** Form field name. */\n @property() name = \"\";\n\n @state() private _formDisabled = false;\n\n #internals = this.attachInternals();\n #defaultValue = 0;\n\n /** Whether the host or an ancestor fieldset currently disables the control. */\n get #isDisabled(): boolean {\n return this.disabled || this._formDisabled;\n }\n\n get #percent(): number {\n const range = this.max - this.min || 1;\n return ((this.value - this.min) / range) * 100;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated) this.#defaultValue = this.value;\n if (changed.has(\"value\")) this.#internals.setFormValue(String(this.value));\n }\n\n /** Resets to the value present at first render, per the form contract. */\n formResetCallback(): void {\n this.value = this.#defaultValue;\n }\n\n /** Mirrors an ancestor fieldset's disabled state. */\n formDisabledCallback(disabled: boolean): void {\n this._formDisabled = disabled;\n }\n\n /** Restores the value from saved form state (bfcache/autofill). */\n formStateRestoreCallback(state: string | File | FormData | null): void {\n if (typeof state !== \"string\") return;\n const parsed = Number(state);\n if (!Number.isNaN(parsed)) this.value = parsed;\n }\n\n // The native input's own \"input\"/\"change\" events are composed (cross the\n // shadow boundary) — stop them so only our re-dispatched CustomEvent\n // (carrying `detail.value`) reaches consumers, matching text-area.ts's fix\n // for the same issue. Otherwise the native event bubbles out afterwards\n // too, re-invoking the same listener with a plain Event whose `detail` is\n // undefined, crashing consumer code that reads `e.detail.value`.\n #onInput(e: Event): void {\n e.stopPropagation();\n const input = e.target as HTMLInputElement;\n this.value = Number(input.value);\n this.dispatchEvent(new CustomEvent(\"input\", { detail: { value: this.value }, bubbles: true, composed: true }));\n }\n\n #onChange(e: Event): void {\n e.stopPropagation();\n const input = e.target as HTMLInputElement;\n this.value = Number(input.value);\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value: this.value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <input\n type=\"range\"\n style=${`--range-percent: ${this.#percent}%`}\n min=${this.min}\n max=${this.max}\n step=${this.step}\n .value=${String(this.value)}\n ?disabled=${this.#isDisabled}\n @input=${(e: Event) => this.#onInput(e)}\n @change=${(e: Event) => this.#onChange(e)}\n />\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"range-slider\": RangeSlider;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"range-slider.js","sourceRoot":"","sources":["../src/range-slider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EA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ADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAqMvB","sourcesContent":["import { LitElement, css, html, type PropertyValues } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A form-associated numeric range slider, usable standalone or inside a\n * native `<form>`. Wraps a native `<input type=\"range\">` (kept for its free\n * keyboard, drag, and screen-reader support) restyled to match this\n * package's track/fill visual language (`stat-meter`, `percent-bar-chart`)\n * instead of the browser-default appearance. Purely a value control — no\n * built-in label; wrap in `form-field` for a labeled field, or render a\n * value readout next to it (see the playground example), matching\n * `autocomplete-input`/`form-select`.\n *\n * @element range-slider\n * @fires input - Fires continuously while dragging/typing; detail: `{ value }`.\n * @fires change - Fires once the value is committed (drag released, arrow\n * key released); detail: `{ value }`.\n */\n@customElement(\"range-slider\")\nexport class RangeSlider extends LitElement {\n static formAssociated = true;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n input[type=\"range\"] {\n -webkit-appearance: none;\n appearance: none;\n width: 100%;\n height: 2rem;\n margin: 0;\n background: transparent;\n cursor: pointer;\n }\n input[type=\"range\"]:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n /* Track */\n input[type=\"range\"]::-webkit-slider-runnable-track {\n height: 0.375rem;\n border-radius: var(--ui-radius-pill, 9999px);\n /* A hard-stop background gradient used as a two-tone fill trick —\n its color-stops can't themselves hold a gradient value, so this\n reads --ui-button-accent (a solid stand-in), not\n --ui-button-background directly. */\n background: linear-gradient(\n to right,\n var(--ui-button-accent, var(--ui-primary, #4f46e5)) 0%,\n var(--ui-button-accent, var(--ui-primary, #4f46e5)) var(--range-percent, 0%),\n var(--ui-surface-muted, #f8fafc) var(--range-percent, 0%),\n var(--ui-surface-muted, #f8fafc) 100%\n );\n }\n input[type=\"range\"]::-moz-range-track {\n height: 0.375rem;\n border-radius: var(--ui-radius-pill, 9999px);\n background: var(--ui-surface-muted, #f8fafc);\n }\n input[type=\"range\"]::-moz-range-progress {\n height: 0.375rem;\n border-radius: var(--ui-radius-pill, 9999px);\n background: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n }\n /* Thumb */\n input[type=\"range\"]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 1rem;\n height: 1rem;\n /* WebKit centers the thumb on the input's full 2rem box, not the\n thinner custom track — nudge it up to align with the track.\n A transform offset (not margin) so it isn't a spacing-grid value. */\n transform: translateY(-0.3125rem);\n border-radius: var(--ui-radius-circle, 50%);\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border: 2px solid var(--ui-surface, #ffffff);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n input[type=\"range\"]::-moz-range-thumb {\n width: 1rem;\n height: 1rem;\n border-radius: var(--ui-radius-circle, 50%);\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border: 2px solid var(--ui-surface, #ffffff);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n input[type=\"range\"]:disabled::-webkit-slider-thumb {\n background: var(--ui-text-muted, #64748b);\n }\n input[type=\"range\"]:disabled::-moz-range-thumb {\n background: var(--ui-text-muted, #64748b);\n }\n input[type=\"range\"]:focus-visible {\n outline: none;\n }\n input[type=\"range\"]:focus-visible::-webkit-slider-thumb {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n input[type=\"range\"]:focus-visible::-moz-range-thumb {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n @media (prefers-reduced-motion: no-preference) {\n input[type=\"range\"]::-webkit-slider-thumb {\n transition: box-shadow 120ms ease;\n }\n input[type=\"range\"]::-moz-range-thumb {\n transition: box-shadow 120ms ease;\n }\n }\n @media (forced-colors: active) {\n input[type=\"range\"]::-webkit-slider-runnable-track {\n background: Canvas;\n border: 1px solid CanvasText;\n }\n input[type=\"range\"]::-webkit-slider-thumb {\n background: Highlight;\n border-color: Canvas;\n }\n input[type=\"range\"]:focus-visible::-webkit-slider-thumb {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n /** Minimum value. */\n @property({ type: Number }) min = 0;\n /** Maximum value. */\n @property({ type: Number }) max = 100;\n /** Step increment. */\n @property({ type: Number }) step = 1;\n /** Current value. */\n @property({ type: Number }) value = 0;\n /** Disables interaction; merged with an ancestor `<fieldset disabled>`. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n /** Form field name. */\n @property() name = \"\";\n\n @state() private _formDisabled = false;\n\n #internals = this.attachInternals();\n #defaultValue = 0;\n\n /** Whether the host or an ancestor fieldset currently disables the control. */\n get #isDisabled(): boolean {\n return this.disabled || this._formDisabled;\n }\n\n get #percent(): number {\n const range = this.max - this.min || 1;\n return ((this.value - this.min) / range) * 100;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated) this.#defaultValue = this.value;\n if (changed.has(\"value\")) this.#internals.setFormValue(String(this.value));\n }\n\n /** Resets to the value present at first render, per the form contract. */\n formResetCallback(): void {\n this.value = this.#defaultValue;\n }\n\n /** Mirrors an ancestor fieldset's disabled state. */\n formDisabledCallback(disabled: boolean): void {\n this._formDisabled = disabled;\n }\n\n /** Restores the value from saved form state (bfcache/autofill). */\n formStateRestoreCallback(state: string | File | FormData | null): void {\n if (typeof state !== \"string\") return;\n const parsed = Number(state);\n if (!Number.isNaN(parsed)) this.value = parsed;\n }\n\n // The native input's own \"input\"/\"change\" events are composed (cross the\n // shadow boundary) — stop them so only our re-dispatched CustomEvent\n // (carrying `detail.value`) reaches consumers, matching text-area.ts's fix\n // for the same issue. Otherwise the native event bubbles out afterwards\n // too, re-invoking the same listener with a plain Event whose `detail` is\n // undefined, crashing consumer code that reads `e.detail.value`.\n #onInput(e: Event): void {\n e.stopPropagation();\n const input = e.target as HTMLInputElement;\n this.value = Number(input.value);\n this.dispatchEvent(new CustomEvent(\"input\", { detail: { value: this.value }, bubbles: true, composed: true }));\n }\n\n #onChange(e: Event): void {\n e.stopPropagation();\n const input = e.target as HTMLInputElement;\n this.value = Number(input.value);\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value: this.value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <input\n type=\"range\"\n style=${`--range-percent: ${this.#percent}%`}\n min=${this.min}\n max=${this.max}\n step=${this.step}\n .value=${String(this.value)}\n ?disabled=${this.#isDisabled}\n @input=${(e: Event) => this.#onInput(e)}\n @change=${(e: Event) => this.#onChange(e)}\n />\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"range-slider\": RangeSlider;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-checkbox.d.ts","sourceRoot":"","sources":["../src/ui-checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAK/F;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAgB,MAAM,4BA4EpB;IAEF,kCAAkC;IACL,OAAO,UAAS;IAC7C,8EAA8E;IACjD,aAAa,UAAS;IACnD,2EAA2E;
|
|
1
|
+
{"version":3,"file":"ui-checkbox.d.ts","sourceRoot":"","sources":["../src/ui-checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAK/F;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAgB,MAAM,4BA4EpB;IAEF,kCAAkC;IACL,OAAO,UAAS;IAC7C,8EAA8E;I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