@aceshooting/lyra-ui 1.2.0 → 2.1.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 +98 -14
- package/custom-elements.json +30279 -12124
- package/dist/components/app-rail/app-rail-item.d.ts +30 -0
- package/dist/components/app-rail/app-rail-item.js +68 -0
- package/dist/components/app-rail/app-rail-item.styles.d.ts +1 -0
- package/dist/components/app-rail/app-rail-item.styles.js +65 -0
- package/dist/components/app-rail/app-rail.d.ts +168 -0
- package/dist/components/app-rail/app-rail.js +419 -0
- package/dist/components/app-rail/app-rail.styles.d.ts +1 -0
- package/dist/components/app-rail/app-rail.styles.js +128 -0
- package/dist/components/attachment-chip/attachment-chip.d.ts +141 -0
- package/dist/components/attachment-chip/attachment-chip.js +356 -0
- package/dist/components/attachment-chip/attachment-chip.styles.d.ts +1 -0
- package/dist/components/attachment-chip/attachment-chip.styles.js +184 -0
- package/dist/components/attachment-trigger/attachment-trigger.d.ts +96 -0
- package/dist/components/attachment-trigger/attachment-trigger.js +270 -0
- package/dist/components/attachment-trigger/attachment-trigger.styles.d.ts +1 -0
- package/dist/components/attachment-trigger/attachment-trigger.styles.js +90 -0
- package/dist/components/chart/bar-chart.js +2 -18
- package/dist/components/chart/box-plot.d.ts +25 -1
- package/dist/components/chart/box-plot.js +147 -7
- package/dist/components/chart/box-plot.styles.js +13 -0
- package/dist/components/chart/bubble-chart.js +2 -18
- package/dist/components/chart/chart-loader.d.ts +44 -13
- package/dist/components/chart/chart-loader.js +65 -18
- package/dist/components/chart/chart.d.ts +55 -12
- package/dist/components/chart/chart.js +247 -49
- package/dist/components/chart/doughnut-chart.js +2 -18
- package/dist/components/chart/histogram-bin.d.ts +7 -1
- package/dist/components/chart/histogram-bin.js +32 -14
- package/dist/components/chart/histogram.js +8 -16
- package/dist/components/chart/line-chart.js +2 -18
- package/dist/components/chart/lite-chart.d.ts +134 -3
- package/dist/components/chart/lite-chart.js +382 -67
- package/dist/components/chart/lite-chart.styles.js +9 -0
- package/dist/components/chart/pie-chart.js +2 -18
- package/dist/components/chart/polar-area-chart.js +2 -18
- package/dist/components/chart/radar-chart.js +2 -18
- package/dist/components/chart/scatter-chart.js +2 -18
- package/dist/components/chat-composer/chat-composer.d.ts +133 -0
- package/dist/components/chat-composer/chat-composer.js +366 -0
- package/dist/components/chat-composer/chat-composer.styles.d.ts +1 -0
- package/dist/components/chat-composer/chat-composer.styles.js +145 -0
- package/dist/components/chat-message/chat-message.d.ts +141 -0
- package/dist/components/chat-message/chat-message.js +331 -0
- package/dist/components/chat-message/chat-message.styles.d.ts +1 -0
- package/dist/components/chat-message/chat-message.styles.js +203 -0
- package/dist/components/checkbox/checkbox.d.ts +117 -0
- package/dist/components/checkbox/checkbox.js +353 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
- package/dist/components/checkbox/checkbox.styles.js +77 -0
- package/dist/components/chip/chip-group.d.ts +56 -0
- package/dist/components/chip/chip-group.js +130 -0
- package/dist/components/chip/chip-group.styles.d.ts +1 -0
- package/dist/components/chip/chip-group.styles.js +57 -0
- package/dist/components/chip/chip.d.ts +64 -0
- package/dist/components/chip/chip.js +122 -0
- package/dist/components/chip/chip.styles.d.ts +1 -0
- package/dist/components/chip/chip.styles.js +115 -0
- package/dist/components/citation-badge/citation-badge.d.ts +113 -0
- package/dist/components/citation-badge/citation-badge.js +318 -0
- package/dist/components/citation-badge/citation-badge.styles.d.ts +1 -0
- package/dist/components/citation-badge/citation-badge.styles.js +96 -0
- package/dist/components/code-block/code-block.d.ts +127 -0
- package/dist/components/code-block/code-block.js +382 -0
- package/dist/components/code-block/code-block.styles.d.ts +1 -0
- package/dist/components/code-block/code-block.styles.js +187 -0
- package/dist/components/code-block/code-loader.d.ts +87 -0
- package/dist/components/code-block/code-loader.js +142 -0
- package/dist/components/combobox/combobox.d.ts +65 -6
- package/dist/components/combobox/combobox.js +258 -48
- package/dist/components/combobox/combobox.styles.js +3 -3
- package/dist/components/combobox/option.d.ts +5 -1
- package/dist/components/combobox/option.js +35 -0
- package/dist/components/context-meter/context-meter.d.ts +53 -0
- package/dist/components/context-meter/context-meter.js +159 -0
- package/dist/components/context-meter/context-meter.styles.d.ts +1 -0
- package/dist/components/context-meter/context-meter.styles.js +114 -0
- package/dist/components/conversation-item/conversation-item.d.ts +125 -0
- package/dist/components/conversation-item/conversation-item.js +331 -0
- package/dist/components/conversation-item/conversation-item.styles.d.ts +1 -0
- package/dist/components/conversation-item/conversation-item.styles.js +155 -0
- package/dist/components/date-picker/calendar-core.d.ts +24 -0
- package/dist/components/date-picker/calendar-core.js +51 -4
- package/dist/components/date-picker/date-input.d.ts +100 -9
- package/dist/components/date-picker/date-input.js +383 -66
- package/dist/components/date-picker/date-picker.d.ts +35 -4
- package/dist/components/date-picker/date-picker.js +171 -44
- package/dist/components/dialog/confirm.d.ts +40 -0
- package/dist/components/dialog/confirm.js +76 -0
- package/dist/components/dialog/dialog.d.ts +129 -0
- package/dist/components/dialog/dialog.js +288 -0
- package/dist/components/dialog/dialog.styles.d.ts +1 -0
- package/dist/components/dialog/dialog.styles.js +96 -0
- package/dist/components/dock-panel/dock-panel.d.ts +142 -0
- package/dist/components/dock-panel/dock-panel.js +359 -0
- package/dist/components/dock-panel/dock-panel.styles.d.ts +1 -0
- package/dist/components/dock-panel/dock-panel.styles.js +159 -0
- package/dist/components/document-preview/document-preview.d.ts +143 -0
- package/dist/components/document-preview/document-preview.js +388 -0
- package/dist/components/document-preview/document-preview.styles.d.ts +1 -0
- package/dist/components/document-preview/document-preview.styles.js +191 -0
- package/dist/components/empty/empty.d.ts +1 -2
- package/dist/components/empty/empty.js +18 -12
- package/dist/components/empty/empty.styles.js +0 -3
- package/dist/components/export-button/csv.js +1 -1
- package/dist/components/export-button/export-button.d.ts +12 -0
- package/dist/components/export-button/export-button.js +35 -5
- package/dist/components/export-button/export-button.styles.js +5 -1
- package/dist/components/file-input/accept.js +2 -0
- package/dist/components/file-input/file-input.d.ts +10 -1
- package/dist/components/file-input/file-input.js +36 -5
- package/dist/components/flag/flag.d.ts +29 -13
- package/dist/components/flag/flag.js +54 -14
- package/dist/components/flag/flag.styles.js +1 -1
- package/dist/components/flag/language-map.d.ts +4 -1
- package/dist/components/flag/language-map.js +6 -3
- package/dist/components/gauge/gauge.d.ts +10 -1
- package/dist/components/gauge/gauge.js +41 -13
- package/dist/components/generation-status/generation-status.d.ts +117 -0
- package/dist/components/generation-status/generation-status.js +327 -0
- package/dist/components/generation-status/generation-status.styles.d.ts +1 -0
- package/dist/components/generation-status/generation-status.styles.js +84 -0
- package/dist/components/graph/graph.d.ts +37 -3
- package/dist/components/graph/graph.js +132 -20
- package/dist/components/heatmap/calendar-grid.d.ts +19 -7
- package/dist/components/heatmap/calendar-grid.js +42 -18
- package/dist/components/heatmap/heatmap-scale.d.ts +11 -1
- package/dist/components/heatmap/heatmap-scale.js +14 -2
- package/dist/components/heatmap/heatmap.d.ts +227 -12
- package/dist/components/heatmap/heatmap.js +488 -93
- package/dist/components/json-viewer/json-viewer.d.ts +70 -0
- package/dist/components/json-viewer/json-viewer.js +361 -0
- package/dist/components/json-viewer/json-viewer.styles.d.ts +1 -0
- package/dist/components/json-viewer/json-viewer.styles.js +177 -0
- package/dist/components/kbd/kbd.d.ts +77 -0
- package/dist/components/kbd/kbd.js +231 -0
- package/dist/components/kbd/kbd.styles.d.ts +1 -0
- package/dist/components/kbd/kbd.styles.js +52 -0
- package/dist/components/live-region/live-region.d.ts +90 -0
- package/dist/components/live-region/live-region.js +189 -0
- package/dist/components/live-region/live-region.styles.d.ts +1 -0
- package/dist/components/live-region/live-region.styles.js +10 -0
- package/dist/components/map/map.d.ts +32 -7
- package/dist/components/map/map.js +133 -32
- package/dist/components/markdown/markdown-loader.d.ts +58 -0
- package/dist/components/markdown/markdown-loader.js +77 -0
- package/dist/components/markdown/markdown.d.ts +119 -0
- package/dist/components/markdown/markdown.js +389 -0
- package/dist/components/markdown/markdown.styles.d.ts +1 -0
- package/dist/components/markdown/markdown.styles.js +88 -0
- package/dist/components/media-card/media-card.d.ts +130 -0
- package/dist/components/media-card/media-card.js +273 -0
- package/dist/components/media-card/media-card.styles.d.ts +1 -0
- package/dist/components/media-card/media-card.styles.js +132 -0
- package/dist/components/mention-popover/mention-popover.d.ts +203 -0
- package/dist/components/mention-popover/mention-popover.js +493 -0
- package/dist/components/mention-popover/mention-popover.styles.d.ts +1 -0
- package/dist/components/mention-popover/mention-popover.styles.js +101 -0
- package/dist/components/menu/menu-item.d.ts +91 -0
- package/dist/components/menu/menu-item.js +206 -0
- package/dist/components/menu/menu-item.styles.d.ts +1 -0
- package/dist/components/menu/menu-item.styles.js +75 -0
- package/dist/components/menu/menu.d.ts +167 -0
- package/dist/components/menu/menu.js +461 -0
- package/dist/components/menu/menu.styles.d.ts +1 -0
- package/dist/components/menu/menu.styles.js +67 -0
- package/dist/components/model-select/model-select.d.ts +170 -0
- package/dist/components/model-select/model-select.js +588 -0
- package/dist/components/model-select/model-select.styles.d.ts +1 -0
- package/dist/components/model-select/model-select.styles.js +203 -0
- package/dist/components/model-settings-panel/model-settings-panel.d.ts +93 -0
- package/dist/components/model-settings-panel/model-settings-panel.js +209 -0
- package/dist/components/model-settings-panel/model-settings-panel.styles.d.ts +1 -0
- package/dist/components/model-settings-panel/model-settings-panel.styles.js +82 -0
- package/dist/components/playback/playback.d.ts +19 -3
- package/dist/components/playback/playback.js +109 -33
- package/dist/components/playback/playback.styles.js +6 -1
- package/dist/components/responsive-panel/responsive-panel.d.ts +163 -0
- package/dist/components/responsive-panel/responsive-panel.js +363 -0
- package/dist/components/responsive-panel/responsive-panel.styles.d.ts +1 -0
- package/dist/components/responsive-panel/responsive-panel.styles.js +103 -0
- package/dist/components/result-card/result-card.d.ts +50 -0
- package/dist/components/result-card/result-card.js +89 -0
- package/dist/components/result-card/result-card.styles.d.ts +1 -0
- package/dist/components/result-card/result-card.styles.js +49 -0
- package/dist/components/result-card/result-field.d.ts +36 -0
- package/dist/components/result-card/result-field.js +87 -0
- package/dist/components/result-card/result-field.styles.d.ts +1 -0
- package/dist/components/result-card/result-field.styles.js +32 -0
- package/dist/components/select/select.d.ts +84 -4
- package/dist/components/select/select.js +251 -36
- package/dist/components/skeleton/skeleton.d.ts +3 -0
- package/dist/components/skeleton/skeleton.js +7 -1
- package/dist/components/skeleton/skeleton.styles.js +5 -4
- package/dist/components/slider/slider.d.ts +141 -0
- package/dist/components/slider/slider.js +467 -0
- package/dist/components/slider/slider.styles.d.ts +1 -0
- package/dist/components/slider/slider.styles.js +87 -0
- package/dist/components/source-card/source-card.d.ts +104 -0
- package/dist/components/source-card/source-card.js +195 -0
- package/dist/components/source-card/source-card.styles.d.ts +1 -0
- package/dist/components/source-card/source-card.styles.js +69 -0
- package/dist/components/source-list/source-list.d.ts +63 -0
- package/dist/components/source-list/source-list.js +130 -0
- package/dist/components/source-list/source-list.styles.d.ts +1 -0
- package/dist/components/source-list/source-list.styles.js +59 -0
- package/dist/components/sparkline/sparkline.js +58 -20
- package/dist/components/split/split.d.ts +224 -5
- package/dist/components/split/split.js +617 -43
- package/dist/components/split/split.styles.js +47 -0
- package/dist/components/stat/stat.d.ts +15 -4
- package/dist/components/stat/stat.js +53 -12
- package/dist/components/stream-status/stream-status.d.ts +126 -0
- package/dist/components/stream-status/stream-status.js +292 -0
- package/dist/components/stream-status/stream-status.styles.d.ts +1 -0
- package/dist/components/stream-status/stream-status.styles.js +103 -0
- package/dist/components/streaming-text/streaming-text.d.ts +104 -0
- package/dist/components/streaming-text/streaming-text.js +224 -0
- package/dist/components/streaming-text/streaming-text.styles.d.ts +1 -0
- package/dist/components/streaming-text/streaming-text.styles.js +63 -0
- package/dist/components/switch/switch.d.ts +103 -0
- package/dist/components/switch/switch.js +250 -0
- package/dist/components/switch/switch.styles.d.ts +1 -0
- package/dist/components/switch/switch.styles.js +75 -0
- package/dist/components/table/table.d.ts +89 -5
- package/dist/components/table/table.js +243 -26
- package/dist/components/table/table.styles.js +6 -1
- package/dist/components/tabs/tabs.d.ts +74 -0
- package/dist/components/tabs/tabs.js +254 -0
- package/dist/components/tabs/tabs.styles.d.ts +1 -0
- package/dist/components/tabs/tabs.styles.js +74 -0
- package/dist/components/thinking-panel/thinking-panel.d.ts +123 -0
- package/dist/components/thinking-panel/thinking-panel.js +260 -0
- package/dist/components/thinking-panel/thinking-panel.styles.d.ts +1 -0
- package/dist/components/thinking-panel/thinking-panel.styles.js +123 -0
- package/dist/components/time-range/time-range.d.ts +59 -2
- package/dist/components/time-range/time-range.js +163 -67
- package/dist/components/toast/toast-item.d.ts +12 -2
- package/dist/components/toast/toast-item.js +106 -44
- package/dist/components/toast/toast-item.styles.js +59 -28
- package/dist/components/toast/toast.js +17 -5
- package/dist/components/toast/toaster.js +10 -1
- package/dist/components/tool-approval-dialog/tool-approval-dialog.d.ts +131 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.js +329 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.d.ts +1 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.js +160 -0
- package/dist/components/tool-call-chip/tool-call-chip.d.ts +105 -0
- package/dist/components/tool-call-chip/tool-call-chip.js +349 -0
- package/dist/components/tool-call-chip/tool-call-chip.styles.d.ts +1 -0
- package/dist/components/tool-call-chip/tool-call-chip.styles.js +203 -0
- package/dist/components/tool-param-form/tool-param-form.d.ts +206 -0
- package/dist/components/tool-param-form/tool-param-form.js +610 -0
- package/dist/components/tool-param-form/tool-param-form.styles.d.ts +1 -0
- package/dist/components/tool-param-form/tool-param-form.styles.js +75 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.d.ts +122 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.js +358 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.styles.d.ts +1 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.styles.js +176 -0
- package/dist/components/tool-result-view/registry.d.ts +73 -0
- package/dist/components/tool-result-view/registry.js +89 -0
- package/dist/components/tool-result-view/tool-result-view.d.ts +58 -0
- package/dist/components/tool-result-view/tool-result-view.js +152 -0
- package/dist/components/tool-result-view/tool-result-view.styles.d.ts +1 -0
- package/dist/components/tool-result-view/tool-result-view.styles.js +13 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.d.ts +151 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.js +350 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.styles.d.ts +1 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.styles.js +191 -0
- package/dist/components/tree/tree-node.d.ts +15 -3
- package/dist/components/tree/tree-node.js +20 -7
- package/dist/components/tree/tree.d.ts +25 -10
- package/dist/components/tree/tree.js +39 -31
- package/dist/components/typing-indicator/typing-indicator.d.ts +70 -0
- package/dist/components/typing-indicator/typing-indicator.js +108 -0
- package/dist/components/typing-indicator/typing-indicator.styles.d.ts +1 -0
- package/dist/components/typing-indicator/typing-indicator.styles.js +132 -0
- package/dist/components/virtual-list/virtual-list.d.ts +210 -0
- package/dist/components/virtual-list/virtual-list.js +607 -0
- package/dist/components/virtual-list/virtual-list.styles.d.ts +1 -0
- package/dist/components/virtual-list/virtual-list.styles.js +56 -0
- package/dist/components/widget/widget.d.ts +5 -4
- package/dist/components/widget/widget.js +54 -120
- package/dist/components/widget/widget.styles.js +8 -2
- package/dist/components/word-cloud/word-cloud-layout.d.ts +7 -0
- package/dist/components/word-cloud/word-cloud-layout.js +29 -2
- package/dist/components/word-cloud/word-cloud.d.ts +28 -2
- package/dist/components/word-cloud/word-cloud.js +69 -19
- package/dist/components/word-cloud/word-cloud.styles.js +16 -3
- package/dist/internal/anchored-validity.d.ts +1 -0
- package/dist/internal/anchored-validity.js +86 -0
- package/dist/internal/announcer.d.ts +57 -0
- package/dist/internal/announcer.js +71 -0
- package/dist/internal/form-associated.d.ts +8 -0
- package/dist/internal/form-associated.js +98 -15
- package/dist/internal/group-by-recency.d.ts +50 -0
- package/dist/internal/group-by-recency.js +80 -0
- package/dist/internal/numbers.d.ts +12 -0
- package/dist/internal/numbers.js +26 -0
- package/dist/internal/overlay-manager.d.ts +51 -0
- package/dist/internal/overlay-manager.js +523 -0
- package/dist/internal/positioner.js +27 -3
- package/dist/internal/rtl.d.ts +23 -0
- package/dist/internal/rtl.js +28 -0
- package/dist/internal/safe-url.d.ts +12 -0
- package/dist/internal/safe-url.js +41 -0
- package/dist/internal/scroll-lock.d.ts +10 -5
- package/dist/internal/scroll-lock.js +30 -14
- package/dist/internal/tokens.styles.js +22 -10
- package/dist/lyra.d.ts +133 -31
- package/dist/lyra.js +96 -26
- package/llms-full.txt +4546 -183
- package/llms.txt +21 -5
- package/package.json +41 -6
- package/dist/components/chart/bar-chart.stories.d.ts +0 -5
- package/dist/components/chart/bar-chart.stories.js +0 -20
- package/dist/components/chart/box-plot.stories.d.ts +0 -5
- package/dist/components/chart/box-plot.stories.js +0 -29
- package/dist/components/chart/bubble-chart.stories.d.ts +0 -5
- package/dist/components/chart/bubble-chart.stories.js +0 -26
- package/dist/components/chart/chart.stories.d.ts +0 -32
- package/dist/components/chart/chart.stories.js +0 -141
- package/dist/components/chart/doughnut-chart.stories.d.ts +0 -5
- package/dist/components/chart/doughnut-chart.stories.js +0 -26
- package/dist/components/chart/histogram.stories.d.ts +0 -5
- package/dist/components/chart/histogram.stories.js +0 -17
- package/dist/components/chart/line-chart.stories.d.ts +0 -22
- package/dist/components/chart/line-chart.stories.js +0 -99
- package/dist/components/chart/lite-chart.stories.d.ts +0 -14
- package/dist/components/chart/lite-chart.stories.js +0 -114
- package/dist/components/chart/pie-chart.stories.d.ts +0 -5
- package/dist/components/chart/pie-chart.stories.js +0 -26
- package/dist/components/chart/polar-area-chart.stories.d.ts +0 -5
- package/dist/components/chart/polar-area-chart.stories.js +0 -20
- package/dist/components/chart/radar-chart.stories.d.ts +0 -5
- package/dist/components/chart/radar-chart.stories.js +0 -20
- package/dist/components/chart/scatter-chart.stories.d.ts +0 -5
- package/dist/components/chart/scatter-chart.stories.js +0 -31
- package/dist/components/combobox/combobox.stories.d.ts +0 -24
- package/dist/components/combobox/combobox.stories.js +0 -102
- package/dist/components/date-picker/date-input.stories.d.ts +0 -10
- package/dist/components/date-picker/date-input.stories.js +0 -48
- package/dist/components/date-picker/date-picker.stories.d.ts +0 -10
- package/dist/components/date-picker/date-picker.stories.js +0 -25
- package/dist/components/empty/empty.stories.d.ts +0 -7
- package/dist/components/empty/empty.stories.js +0 -34
- package/dist/components/export-button/export-button.stories.d.ts +0 -7
- package/dist/components/export-button/export-button.stories.js +0 -37
- package/dist/components/file-input/file-input.stories.d.ts +0 -7
- package/dist/components/file-input/file-input.stories.js +0 -19
- package/dist/components/flag/flag.stories.d.ts +0 -6
- package/dist/components/flag/flag.stories.js +0 -31
- package/dist/components/gauge/gauge.stories.d.ts +0 -8
- package/dist/components/gauge/gauge.stories.js +0 -19
- package/dist/components/graph/graph.stories.d.ts +0 -8
- package/dist/components/graph/graph.stories.js +0 -68
- package/dist/components/heatmap/heatmap.stories.d.ts +0 -27
- package/dist/components/heatmap/heatmap.stories.js +0 -179
- package/dist/components/map/map.stories.d.ts +0 -15
- package/dist/components/map/map.stories.js +0 -135
- package/dist/components/playback/playback.stories.d.ts +0 -7
- package/dist/components/playback/playback.stories.js +0 -16
- package/dist/components/select/select.stories.d.ts +0 -21
- package/dist/components/select/select.stories.js +0 -91
- package/dist/components/skeleton/skeleton.stories.d.ts +0 -5
- package/dist/components/skeleton/skeleton.stories.js +0 -16
- package/dist/components/sparkline/sparkline.stories.d.ts +0 -11
- package/dist/components/sparkline/sparkline.stories.js +0 -39
- package/dist/components/split/split.stories.d.ts +0 -7
- package/dist/components/split/split.stories.js +0 -36
- package/dist/components/stat/stat.stories.d.ts +0 -9
- package/dist/components/stat/stat.stories.js +0 -81
- package/dist/components/table/table.stories.d.ts +0 -12
- package/dist/components/table/table.stories.js +0 -67
- package/dist/components/time-range/time-range.stories.d.ts +0 -8
- package/dist/components/time-range/time-range.stories.js +0 -26
- package/dist/components/toast/toast.stories.d.ts +0 -8
- package/dist/components/toast/toast.stories.js +0 -72
- package/dist/components/tree/tree.stories.d.ts +0 -9
- package/dist/components/tree/tree.stories.js +0 -52
- package/dist/components/widget/widget.stories.d.ts +0 -9
- package/dist/components/widget/widget.stories.js +0 -74
- package/dist/components/word-cloud/word-cloud.stories.d.ts +0 -10
- package/dist/components/word-cloud/word-cloud.stories.js +0 -55
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, nothing } from 'lit';
|
|
8
|
+
import { property, state } from 'lit/decorators.js';
|
|
9
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
|
+
import { defineElement } from '../../internal/prefix.js';
|
|
11
|
+
import { place } from '../../internal/positioner.js';
|
|
12
|
+
import { nextId } from '../../internal/a11y.js';
|
|
13
|
+
import { chevronIcon } from '../../internal/icons.js';
|
|
14
|
+
import { AnchoredValidityController, VALIDITY_ANCHOR } from '../../internal/anchored-validity.js';
|
|
15
|
+
import { styles } from './model-select.styles.js';
|
|
16
|
+
/**
|
|
17
|
+
* `<lyra-model-select>` — a provider/model picker that renders as a closed
|
|
18
|
+
* dropdown when a fixed `catalog` is available, or as a filterable free-text
|
|
19
|
+
* combobox when it isn't (or when `allow-custom` explicitly permits typing
|
|
20
|
+
* something outside the catalog). Built directly on the shared
|
|
21
|
+
* trigger-button/aria-activedescendant listbox technique `<lyra-select>` uses
|
|
22
|
+
* and the filter-as-you-type suggestion-popup technique `<lyra-combobox>`
|
|
23
|
+
* uses — not by composing either element, since the mode switch and the
|
|
24
|
+
* stale-value handling below are specific to this control.
|
|
25
|
+
*
|
|
26
|
+
* A `value` that isn't present in `catalog` (e.g. a model id saved from a
|
|
27
|
+
* provider whose live catalog has since changed) is never silently dropped:
|
|
28
|
+
* `effectiveEntries` appends it to the rendered option list as a synthetic,
|
|
29
|
+
* visually-distinct row (dashed border, italic label, "not in catalog"
|
|
30
|
+
* badge — see `model-select.styles.ts`) computed fresh from `catalog` +
|
|
31
|
+
* `value` on every render, without ever mutating the `catalog` property
|
|
32
|
+
* itself.
|
|
33
|
+
*
|
|
34
|
+
* @customElement lyra-model-select
|
|
35
|
+
* @event lyra-change - The selected/typed value changed. `detail: { value: string; inCatalog: boolean }`.
|
|
36
|
+
* @csspart form-control-label - The `<label>` element (only rendered — and only contributes to the
|
|
37
|
+
* accessible name — once `label` is non-empty).
|
|
38
|
+
* @csspart trigger - The trigger button (closed-dropdown mode's positioning anchor).
|
|
39
|
+
* @csspart combobox - The text-input container (free-text mode's positioning anchor).
|
|
40
|
+
* @csspart combobox-input - The free-text mode's text input.
|
|
41
|
+
* @csspart provider-badge - The optional leading `provider` label.
|
|
42
|
+
* @csspart listbox - The options popover (shared by both modes).
|
|
43
|
+
* @csspart option - An option row.
|
|
44
|
+
* @csspart option-label - An option row's label.
|
|
45
|
+
* @csspart option-badge - The "not in catalog" badge on a synthetic stale-value row.
|
|
46
|
+
* @csspart expand-icon - The dropdown indicator.
|
|
47
|
+
*/
|
|
48
|
+
export class LyraModelSelect extends LyraElement {
|
|
49
|
+
static { this.formAssociated = true; }
|
|
50
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
51
|
+
static { this.properties = {
|
|
52
|
+
disabled: { type: Boolean, reflect: true, noAccessor: true },
|
|
53
|
+
required: { type: Boolean, reflect: true, noAccessor: true },
|
|
54
|
+
value: { noAccessor: true },
|
|
55
|
+
name: { reflect: true, noAccessor: true },
|
|
56
|
+
}; }
|
|
57
|
+
constructor() {
|
|
58
|
+
super();
|
|
59
|
+
/** Informational only — e.g. `'ollama'`. Rendered as a small leading badge for display grouping. */
|
|
60
|
+
this.provider = '';
|
|
61
|
+
/** Let the user type/commit a value that isn't in `catalog`, even when `catalog` is non-empty. */
|
|
62
|
+
this.allowCustom = false;
|
|
63
|
+
/**
|
|
64
|
+
* Optional visible title above the control, mirroring `lyra-select`'s
|
|
65
|
+
* `label` exactly: rendered via a `part="form-control-label"` `<label>`
|
|
66
|
+
* paired with the control's id, and — once non-empty — it takes over as
|
|
67
|
+
* the accessible-name source (the `aria-label` fallback below is then only
|
|
68
|
+
* emitted when the host has an explicit `aria-label` override, same
|
|
69
|
+
* precedence as `lyra-select`). Leaving it empty (the default) keeps
|
|
70
|
+
* today's `aria-label || placeholder || 'Model'` chain untouched.
|
|
71
|
+
*/
|
|
72
|
+
this.label = '';
|
|
73
|
+
this.placeholder = '';
|
|
74
|
+
this.open = false;
|
|
75
|
+
this.activeIndex = -1;
|
|
76
|
+
// Free-text mode's live input text. Only meaningful while `open` — the
|
|
77
|
+
// input is otherwise controlled by the committed value's label (see
|
|
78
|
+
// `renderFreeText`), so this never needs resetting on commit/hide.
|
|
79
|
+
this.query = '';
|
|
80
|
+
// Set on first blur; gates the `data-invalid` reflection below so
|
|
81
|
+
// validity styling never flashes on first render (matches lyra-select).
|
|
82
|
+
this.touched = false;
|
|
83
|
+
this.listId = nextId('model-select-list');
|
|
84
|
+
this.controlId = nextId('model-select-control');
|
|
85
|
+
this._value = '';
|
|
86
|
+
this._fieldsetDisabled = false;
|
|
87
|
+
this._name = '';
|
|
88
|
+
this._disabled = false;
|
|
89
|
+
this._required = false;
|
|
90
|
+
// What `form.reset()` restores to — captured from the `value` *content
|
|
91
|
+
// attribute* only, mirroring native `<input>`/`FormAssociated`'s
|
|
92
|
+
// `_defaultValue` (see internal/form-associated.ts). There's no child
|
|
93
|
+
// markup here to seed a declarative default from (unlike lyra-select's
|
|
94
|
+
// `<lyra-option selected>`), so the initial attribute is the only source.
|
|
95
|
+
this._defaultValue = '';
|
|
96
|
+
this.onDocPointer = (e) => {
|
|
97
|
+
if (!e.composedPath().includes(this))
|
|
98
|
+
this.hide();
|
|
99
|
+
};
|
|
100
|
+
// -- Closed-dropdown mode (trigger button) --------------------------------
|
|
101
|
+
this.onTriggerClick = () => {
|
|
102
|
+
if (this.effectiveDisabled)
|
|
103
|
+
return;
|
|
104
|
+
this.open ? this.hide() : this.show();
|
|
105
|
+
};
|
|
106
|
+
this.onTriggerBlur = () => {
|
|
107
|
+
this.touched = true;
|
|
108
|
+
this.hide();
|
|
109
|
+
};
|
|
110
|
+
this.onTriggerKeyDown = (e) => {
|
|
111
|
+
const rows = this.effectiveEntries;
|
|
112
|
+
switch (e.key) {
|
|
113
|
+
case 'ArrowDown':
|
|
114
|
+
e.preventDefault();
|
|
115
|
+
if (!this.open)
|
|
116
|
+
return this.show();
|
|
117
|
+
this.activeIndex = Math.min(rows.length - 1, this.activeIndex + 1);
|
|
118
|
+
break;
|
|
119
|
+
case 'ArrowUp':
|
|
120
|
+
e.preventDefault();
|
|
121
|
+
if (!this.open)
|
|
122
|
+
return this.show();
|
|
123
|
+
this.activeIndex = Math.max(0, this.activeIndex - 1);
|
|
124
|
+
break;
|
|
125
|
+
case 'Enter':
|
|
126
|
+
case ' ':
|
|
127
|
+
if (this.open) {
|
|
128
|
+
e.preventDefault();
|
|
129
|
+
if (this.activeIndex >= 0 && rows[this.activeIndex]) {
|
|
130
|
+
this.selectEntry(rows[this.activeIndex]);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
this.hide();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
case 'Escape':
|
|
138
|
+
if (this.open) {
|
|
139
|
+
e.preventDefault();
|
|
140
|
+
this.hide();
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
case 'Home':
|
|
144
|
+
if (this.open) {
|
|
145
|
+
e.preventDefault();
|
|
146
|
+
this.activeIndex = 0;
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
case 'End':
|
|
150
|
+
if (this.open) {
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
this.activeIndex = rows.length - 1;
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
// -- Free-text mode (text input) ------------------------------------------
|
|
158
|
+
this.onComboMouseDown = (e) => {
|
|
159
|
+
if (this.effectiveDisabled)
|
|
160
|
+
return;
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
this.renderRoot.querySelector('[part="combobox-input"]')?.focus();
|
|
163
|
+
};
|
|
164
|
+
this.onInputFocus = () => {
|
|
165
|
+
// Seed the editable text from the *current* value each time a fresh
|
|
166
|
+
// editing session starts, not on every keystroke (onInput overwrites
|
|
167
|
+
// `query` directly) — otherwise a same-session reopen via ArrowDown
|
|
168
|
+
// after Escape would clobber the just-reverted text right back to
|
|
169
|
+
// whatever the user had typed before Escape.
|
|
170
|
+
if (!this.open)
|
|
171
|
+
this.query = this.labelFor(this.value);
|
|
172
|
+
this.show();
|
|
173
|
+
};
|
|
174
|
+
this.onInput = (e) => {
|
|
175
|
+
this.query = e.target.value;
|
|
176
|
+
this.activeIndex = -1;
|
|
177
|
+
this.show();
|
|
178
|
+
};
|
|
179
|
+
this.onInputBlur = () => {
|
|
180
|
+
this.touched = true;
|
|
181
|
+
this.hide();
|
|
182
|
+
};
|
|
183
|
+
this.onInputKeyDown = (e) => {
|
|
184
|
+
const rows = this.filteredEntries;
|
|
185
|
+
switch (e.key) {
|
|
186
|
+
case 'ArrowDown':
|
|
187
|
+
e.preventDefault();
|
|
188
|
+
if (!this.open)
|
|
189
|
+
return this.show();
|
|
190
|
+
this.activeIndex = Math.min(rows.length - 1, this.activeIndex + 1);
|
|
191
|
+
break;
|
|
192
|
+
case 'ArrowUp':
|
|
193
|
+
e.preventDefault();
|
|
194
|
+
if (!this.open)
|
|
195
|
+
return this.show();
|
|
196
|
+
this.activeIndex = Math.max(0, this.activeIndex - 1);
|
|
197
|
+
break;
|
|
198
|
+
case 'Enter':
|
|
199
|
+
if (this.open) {
|
|
200
|
+
e.preventDefault();
|
|
201
|
+
this.commitFreeText();
|
|
202
|
+
}
|
|
203
|
+
break;
|
|
204
|
+
case 'Escape':
|
|
205
|
+
if (this.open) {
|
|
206
|
+
e.preventDefault();
|
|
207
|
+
this.query = this.labelFor(this.value);
|
|
208
|
+
this.hide();
|
|
209
|
+
}
|
|
210
|
+
break;
|
|
211
|
+
case 'Home':
|
|
212
|
+
if (this.open) {
|
|
213
|
+
e.preventDefault();
|
|
214
|
+
this.activeIndex = 0;
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
case 'End':
|
|
218
|
+
if (this.open) {
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
this.activeIndex = rows.length - 1;
|
|
221
|
+
}
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
// -- Shared listbox ---------------------------------------------------
|
|
226
|
+
// Delegated onto [part="listbox"] rather than one closure pair allocated
|
|
227
|
+
// per row per render — resolves the target row via closest('[part="option"]')
|
|
228
|
+
// + a data-value lookup, mirroring lyra-select/lyra-combobox.
|
|
229
|
+
this.onListboxMouseDown = (e) => {
|
|
230
|
+
if (e.target.closest('[part="option"]'))
|
|
231
|
+
e.preventDefault();
|
|
232
|
+
};
|
|
233
|
+
this.onListboxClick = (e) => {
|
|
234
|
+
if (this.effectiveDisabled)
|
|
235
|
+
return;
|
|
236
|
+
const optionEl = e.target.closest('[part="option"]');
|
|
237
|
+
const value = optionEl?.dataset.value;
|
|
238
|
+
if (value === undefined)
|
|
239
|
+
return;
|
|
240
|
+
const entry = (this.closedMode ? this.effectiveEntries : this.filteredEntries).find((e2) => e2.id === value);
|
|
241
|
+
if (entry)
|
|
242
|
+
this.selectEntry(entry);
|
|
243
|
+
};
|
|
244
|
+
this.internals = this.attachInternals();
|
|
245
|
+
this.validityController = new AnchoredValidityController(this, this.internals, () => this[VALIDITY_ANCHOR]());
|
|
246
|
+
// Native <input> always has a submission value ("") from construction —
|
|
247
|
+
// without this, a control whose `value` is never touched is entirely
|
|
248
|
+
// absent from FormData instead of present as "" (see form-associated.ts).
|
|
249
|
+
this.internals.setFormValue('');
|
|
250
|
+
}
|
|
251
|
+
get form() {
|
|
252
|
+
return this.internals.form;
|
|
253
|
+
}
|
|
254
|
+
get labels() {
|
|
255
|
+
return this.internals.labels;
|
|
256
|
+
}
|
|
257
|
+
get validity() {
|
|
258
|
+
return this.internals.validity;
|
|
259
|
+
}
|
|
260
|
+
get validationMessage() {
|
|
261
|
+
return this.internals.validationMessage;
|
|
262
|
+
}
|
|
263
|
+
get willValidate() {
|
|
264
|
+
return this.internals.willValidate;
|
|
265
|
+
}
|
|
266
|
+
/** @internal */
|
|
267
|
+
[VALIDITY_ANCHOR]() {
|
|
268
|
+
return this.renderRoot?.querySelector('[part="trigger"], [part="combobox-input"]') ?? null;
|
|
269
|
+
}
|
|
270
|
+
connectedCallback() {
|
|
271
|
+
super.connectedCallback();
|
|
272
|
+
this.updateValidity();
|
|
273
|
+
}
|
|
274
|
+
disconnectedCallback() {
|
|
275
|
+
super.disconnectedCallback();
|
|
276
|
+
this.cleanup?.();
|
|
277
|
+
this.cleanup = undefined;
|
|
278
|
+
document.removeEventListener('pointerdown', this.onDocPointer);
|
|
279
|
+
// Reset so a reconnect (e.g. a drag-drop reparent) re-triggers
|
|
280
|
+
// `updated()`'s `open`-driven branch -- without this, `open` stays
|
|
281
|
+
// `true` across the disconnect/reconnect and `changed.has('open')` never
|
|
282
|
+
// fires again, leaving the listbox rendered open with no positioning and
|
|
283
|
+
// no outside-click listener.
|
|
284
|
+
this.open = false;
|
|
285
|
+
}
|
|
286
|
+
attributeChangedCallback(name, old, val) {
|
|
287
|
+
super.attributeChangedCallback(name, old, val);
|
|
288
|
+
if (name === 'value')
|
|
289
|
+
this._defaultValue = this._value;
|
|
290
|
+
}
|
|
291
|
+
/** The current model id (empty string when nothing is selected). */
|
|
292
|
+
get value() {
|
|
293
|
+
return this._value;
|
|
294
|
+
}
|
|
295
|
+
set value(next) {
|
|
296
|
+
const old = this._value;
|
|
297
|
+
this._value = next ?? '';
|
|
298
|
+
this.internals.setFormValue(this._value);
|
|
299
|
+
this.updateValidity();
|
|
300
|
+
this.requestUpdate('value', old);
|
|
301
|
+
}
|
|
302
|
+
/** The form submission key, reflected synchronously for native form APIs. */
|
|
303
|
+
get name() {
|
|
304
|
+
return this._name;
|
|
305
|
+
}
|
|
306
|
+
set name(next) {
|
|
307
|
+
const old = this._name;
|
|
308
|
+
this._name = next ?? '';
|
|
309
|
+
if (this._name) {
|
|
310
|
+
this.setAttribute('name', this._name);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
this.removeAttribute('name');
|
|
314
|
+
}
|
|
315
|
+
this.requestUpdate('name', old);
|
|
316
|
+
}
|
|
317
|
+
get disabled() {
|
|
318
|
+
return this._disabled;
|
|
319
|
+
}
|
|
320
|
+
set disabled(next) {
|
|
321
|
+
const old = this._disabled;
|
|
322
|
+
this._disabled = Boolean(next);
|
|
323
|
+
this.toggleAttribute('disabled', this._disabled);
|
|
324
|
+
if (this._disabled)
|
|
325
|
+
this.hide();
|
|
326
|
+
this.requestUpdate('disabled', old);
|
|
327
|
+
}
|
|
328
|
+
get required() {
|
|
329
|
+
return this._required;
|
|
330
|
+
}
|
|
331
|
+
set required(next) {
|
|
332
|
+
const old = this._required;
|
|
333
|
+
this._required = Boolean(next);
|
|
334
|
+
this.toggleAttribute('required', this._required);
|
|
335
|
+
this.updateValidity();
|
|
336
|
+
this.requestUpdate('required', old);
|
|
337
|
+
}
|
|
338
|
+
/** Whether the control is disabled explicitly or by an ancestor fieldset. */
|
|
339
|
+
get effectiveDisabled() {
|
|
340
|
+
return this.disabled || this._fieldsetDisabled;
|
|
341
|
+
}
|
|
342
|
+
updateValidity() {
|
|
343
|
+
if (this.required && !this._value) {
|
|
344
|
+
this.validityController.setValidity({ valueMissing: true }, 'Please choose a model.');
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
this.validityController.setValidity({});
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
formResetCallback() {
|
|
351
|
+
this.value = this._defaultValue;
|
|
352
|
+
}
|
|
353
|
+
formStateRestoreCallback(state, _mode) {
|
|
354
|
+
this.value = typeof state === 'string' ? state : '';
|
|
355
|
+
}
|
|
356
|
+
formDisabledCallback(disabled) {
|
|
357
|
+
this._fieldsetDisabled = disabled;
|
|
358
|
+
if (disabled)
|
|
359
|
+
this.hide();
|
|
360
|
+
this.requestUpdate();
|
|
361
|
+
}
|
|
362
|
+
checkValidity() {
|
|
363
|
+
return this.internals.checkValidity();
|
|
364
|
+
}
|
|
365
|
+
reportValidity() {
|
|
366
|
+
return this.internals.reportValidity();
|
|
367
|
+
}
|
|
368
|
+
/** `catalog`, normalized to `{ id, label }[]` regardless of the plain-string-array shorthand. */
|
|
369
|
+
get normalizedCatalog() {
|
|
370
|
+
const raw = this.catalog;
|
|
371
|
+
if (!raw || raw.length === 0)
|
|
372
|
+
return [];
|
|
373
|
+
return raw.map((item) => (typeof item === 'string' ? { id: item, label: item } : item));
|
|
374
|
+
}
|
|
375
|
+
/** Closed-dropdown-with-listbox mode vs. free-text filterable mode — see class doc. */
|
|
376
|
+
get closedMode() {
|
|
377
|
+
return this.normalizedCatalog.length > 0 && !this.allowCustom;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* `normalizedCatalog` plus, when `value` isn't one of its ids, a synthetic
|
|
381
|
+
* trailing row for it — recomputed from scratch on every access so it
|
|
382
|
+
* always reflects the *current* `catalog`/`value`, never a snapshot from
|
|
383
|
+
* whenever `value` happened to be assigned.
|
|
384
|
+
*/
|
|
385
|
+
get effectiveEntries() {
|
|
386
|
+
const catalog = this.normalizedCatalog;
|
|
387
|
+
const entries = catalog.map((e) => ({ ...e, synthetic: false }));
|
|
388
|
+
if (catalog.length > 0 && this._value && !catalog.some((e) => e.id === this._value)) {
|
|
389
|
+
entries.push({ id: this._value, label: this._value, synthetic: true });
|
|
390
|
+
}
|
|
391
|
+
return entries;
|
|
392
|
+
}
|
|
393
|
+
/** `effectiveEntries` filtered by the typed `query` (free-text mode only; id or label substring, case-insensitive). */
|
|
394
|
+
get filteredEntries() {
|
|
395
|
+
const q = this.query.trim().toLowerCase();
|
|
396
|
+
if (!q)
|
|
397
|
+
return this.effectiveEntries;
|
|
398
|
+
return this.effectiveEntries.filter((e) => e.id.toLowerCase().includes(q) || e.label.toLowerCase().includes(q));
|
|
399
|
+
}
|
|
400
|
+
labelFor(id) {
|
|
401
|
+
if (!id)
|
|
402
|
+
return '';
|
|
403
|
+
return this.effectiveEntries.find((e) => e.id === id)?.label ?? id;
|
|
404
|
+
}
|
|
405
|
+
show() {
|
|
406
|
+
if (this.open || this.effectiveDisabled)
|
|
407
|
+
return;
|
|
408
|
+
this.open = true;
|
|
409
|
+
}
|
|
410
|
+
hide() {
|
|
411
|
+
if (!this.open)
|
|
412
|
+
return;
|
|
413
|
+
this.open = false;
|
|
414
|
+
this.activeIndex = -1;
|
|
415
|
+
}
|
|
416
|
+
updated(changed) {
|
|
417
|
+
const reposition = changed.has('open') || (this.open && (changed.has('catalog') || changed.has('allowCustom')));
|
|
418
|
+
if (reposition) {
|
|
419
|
+
this.cleanup?.();
|
|
420
|
+
this.cleanup = undefined;
|
|
421
|
+
if (this.open) {
|
|
422
|
+
document.addEventListener('pointerdown', this.onDocPointer);
|
|
423
|
+
const anchor = this.renderRoot.querySelector(this.closedMode ? '[part="trigger"]' : '[part="combobox"]');
|
|
424
|
+
const listbox = this.renderRoot.querySelector('[part="listbox"]');
|
|
425
|
+
if (anchor && listbox)
|
|
426
|
+
this.cleanup = place(anchor, listbox);
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
document.removeEventListener('pointerdown', this.onDocPointer);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
if (changed.has('required') || changed.has('touched') || changed.has('value')) {
|
|
433
|
+
this.toggleAttribute('data-invalid', this.touched && !this.internals.validity.valid);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
commitValue(next) {
|
|
437
|
+
const inCatalog = this.normalizedCatalog.some((e) => e.id === next);
|
|
438
|
+
this.value = next;
|
|
439
|
+
this.hide();
|
|
440
|
+
this.emit('lyra-change', { value: next, inCatalog });
|
|
441
|
+
}
|
|
442
|
+
selectEntry(entry) {
|
|
443
|
+
this.commitValue(entry.id);
|
|
444
|
+
}
|
|
445
|
+
/** Enter in free-text mode: commit the highlighted suggestion, else the raw typed text. */
|
|
446
|
+
commitFreeText() {
|
|
447
|
+
const rows = this.filteredEntries;
|
|
448
|
+
if (this.activeIndex >= 0 && rows[this.activeIndex]) {
|
|
449
|
+
this.commitValue(rows[this.activeIndex].id);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
this.commitValue(this.query.trim());
|
|
453
|
+
}
|
|
454
|
+
renderRows(rows, activeId) {
|
|
455
|
+
return rows.map((entry, i) => {
|
|
456
|
+
const id = `${this.listId}-opt-${i}`;
|
|
457
|
+
const selected = entry.id === this._value;
|
|
458
|
+
return html `<div
|
|
459
|
+
part="option"
|
|
460
|
+
id=${id}
|
|
461
|
+
role="option"
|
|
462
|
+
data-value=${entry.id}
|
|
463
|
+
?data-synthetic=${entry.synthetic}
|
|
464
|
+
aria-selected=${selected ? 'true' : 'false'}
|
|
465
|
+
?data-active=${id === activeId}
|
|
466
|
+
>
|
|
467
|
+
<span part="option-label">${entry.label}</span>
|
|
468
|
+
${entry.synthetic ? html `<span part="option-badge">not in catalog</span>` : ''}
|
|
469
|
+
</div>`;
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
renderListbox(rows, activeId, emptyText) {
|
|
473
|
+
return html `
|
|
474
|
+
<div
|
|
475
|
+
part="listbox"
|
|
476
|
+
id=${this.listId}
|
|
477
|
+
role="listbox"
|
|
478
|
+
@mousedown=${this.onListboxMouseDown}
|
|
479
|
+
@click=${this.onListboxClick}
|
|
480
|
+
>
|
|
481
|
+
${rows.length === 0
|
|
482
|
+
? html `<div class="empty" role="option" aria-selected="false" aria-disabled="true">${emptyText}</div>`
|
|
483
|
+
: this.renderRows(rows, activeId)}
|
|
484
|
+
</div>
|
|
485
|
+
`;
|
|
486
|
+
}
|
|
487
|
+
/** `part="form-control-label"` — see `label`'s doc comment for its precedence over `aria-label`. */
|
|
488
|
+
renderLabel() {
|
|
489
|
+
return html `<label part="form-control-label" for=${this.controlId} ?hidden=${!this.label}>${this.label}</label>`;
|
|
490
|
+
}
|
|
491
|
+
renderClosed() {
|
|
492
|
+
const rows = this.effectiveEntries;
|
|
493
|
+
const activeId = this.activeIndex >= 0 && rows[this.activeIndex] ? `${this.listId}-opt-${this.activeIndex}` : '';
|
|
494
|
+
const hasValue = this._value.length > 0;
|
|
495
|
+
const hasLabel = this.label.length > 0;
|
|
496
|
+
return html `
|
|
497
|
+
${this.renderLabel()}
|
|
498
|
+
<button
|
|
499
|
+
id=${this.controlId}
|
|
500
|
+
part="trigger"
|
|
501
|
+
type="button"
|
|
502
|
+
role="combobox"
|
|
503
|
+
aria-haspopup="listbox"
|
|
504
|
+
aria-expanded=${this.open ? 'true' : 'false'}
|
|
505
|
+
aria-controls=${this.listId}
|
|
506
|
+
aria-activedescendant=${activeId}
|
|
507
|
+
aria-label=${this.getAttribute('aria-label') || (hasLabel ? nothing : this.placeholder || 'Model')}
|
|
508
|
+
aria-required=${this.required ? 'true' : 'false'}
|
|
509
|
+
aria-invalid=${this.touched && !this.internals.validity.valid ? 'true' : 'false'}
|
|
510
|
+
?disabled=${this.effectiveDisabled}
|
|
511
|
+
@click=${this.onTriggerClick}
|
|
512
|
+
@keydown=${this.onTriggerKeyDown}
|
|
513
|
+
@blur=${this.onTriggerBlur}
|
|
514
|
+
>
|
|
515
|
+
${this.provider ? html `<span part="provider-badge">${this.provider}</span>` : ''}
|
|
516
|
+
<span class="trigger-label" ?data-placeholder=${!hasValue}
|
|
517
|
+
>${hasValue ? this.labelFor(this._value) : this.placeholder}</span
|
|
518
|
+
>
|
|
519
|
+
<span part="expand-icon" aria-hidden="true">${chevronIcon()}</span>
|
|
520
|
+
</button>
|
|
521
|
+
${this.renderListbox(rows, activeId, 'No models')}
|
|
522
|
+
`;
|
|
523
|
+
}
|
|
524
|
+
renderFreeText() {
|
|
525
|
+
const rows = this.filteredEntries;
|
|
526
|
+
const activeId = this.activeIndex >= 0 && rows[this.activeIndex] ? `${this.listId}-opt-${this.activeIndex}` : '';
|
|
527
|
+
const hasLabel = this.label.length > 0;
|
|
528
|
+
return html `
|
|
529
|
+
${this.renderLabel()}
|
|
530
|
+
<div part="combobox" @mousedown=${this.onComboMouseDown}>
|
|
531
|
+
${this.provider ? html `<span part="provider-badge">${this.provider}</span>` : ''}
|
|
532
|
+
<input
|
|
533
|
+
id=${this.controlId}
|
|
534
|
+
part="combobox-input"
|
|
535
|
+
role="combobox"
|
|
536
|
+
aria-label=${this.getAttribute('aria-label') || (hasLabel ? nothing : this.placeholder || 'Model')}
|
|
537
|
+
aria-expanded=${this.open ? 'true' : 'false'}
|
|
538
|
+
aria-controls=${this.listId}
|
|
539
|
+
aria-activedescendant=${activeId}
|
|
540
|
+
aria-autocomplete="list"
|
|
541
|
+
aria-required=${this.required ? 'true' : 'false'}
|
|
542
|
+
aria-invalid=${this.touched && !this.internals.validity.valid ? 'true' : 'false'}
|
|
543
|
+
autocomplete="off"
|
|
544
|
+
.value=${this.open ? this.query : this.labelFor(this._value)}
|
|
545
|
+
placeholder=${this.placeholder}
|
|
546
|
+
?disabled=${this.effectiveDisabled}
|
|
547
|
+
@input=${this.onInput}
|
|
548
|
+
@keydown=${this.onInputKeyDown}
|
|
549
|
+
@focus=${this.onInputFocus}
|
|
550
|
+
@blur=${this.onInputBlur}
|
|
551
|
+
/>
|
|
552
|
+
<span part="expand-icon" aria-hidden="true">${chevronIcon()}</span>
|
|
553
|
+
</div>
|
|
554
|
+
${this.renderListbox(rows, activeId, 'No matches')}
|
|
555
|
+
`;
|
|
556
|
+
}
|
|
557
|
+
render() {
|
|
558
|
+
return this.closedMode ? this.renderClosed() : this.renderFreeText();
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
__decorate([
|
|
562
|
+
property()
|
|
563
|
+
], LyraModelSelect.prototype, "provider", void 0);
|
|
564
|
+
__decorate([
|
|
565
|
+
property({ attribute: false })
|
|
566
|
+
], LyraModelSelect.prototype, "catalog", void 0);
|
|
567
|
+
__decorate([
|
|
568
|
+
property({ type: Boolean, reflect: true, attribute: 'allow-custom' })
|
|
569
|
+
], LyraModelSelect.prototype, "allowCustom", void 0);
|
|
570
|
+
__decorate([
|
|
571
|
+
property()
|
|
572
|
+
], LyraModelSelect.prototype, "label", void 0);
|
|
573
|
+
__decorate([
|
|
574
|
+
property()
|
|
575
|
+
], LyraModelSelect.prototype, "placeholder", void 0);
|
|
576
|
+
__decorate([
|
|
577
|
+
property({ type: Boolean, reflect: true })
|
|
578
|
+
], LyraModelSelect.prototype, "open", void 0);
|
|
579
|
+
__decorate([
|
|
580
|
+
state()
|
|
581
|
+
], LyraModelSelect.prototype, "activeIndex", void 0);
|
|
582
|
+
__decorate([
|
|
583
|
+
state()
|
|
584
|
+
], LyraModelSelect.prototype, "query", void 0);
|
|
585
|
+
__decorate([
|
|
586
|
+
state()
|
|
587
|
+
], LyraModelSelect.prototype, "touched", void 0);
|
|
588
|
+
defineElement('model-select', LyraModelSelect);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|