@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LyraChart } from './chart.js';
|
|
1
|
+
import { LyraChart, lockChartType } from './chart.js';
|
|
2
2
|
import { defineElement } from '../../internal/prefix.js';
|
|
3
3
|
/**
|
|
4
4
|
* `<lyra-polar-area-chart>` — `<lyra-chart>` with `type` locked to `"polarArea"`.
|
|
@@ -7,21 +7,5 @@ import { defineElement } from '../../internal/prefix.js';
|
|
|
7
7
|
*/
|
|
8
8
|
export class LyraPolarAreaChart extends LyraChart {
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
// default value — `LyraChart` declares it as a plain (decorator-managed)
|
|
12
|
-
// class field, and TypeScript forbids a subclass from re-declaring a base
|
|
13
|
-
// field as a getter/setter pair via ordinary class syntax (TS2611) — so the
|
|
14
|
-
// accessor pair is installed directly on the prototype instead, which is
|
|
15
|
-
// runtime-equivalent (same shadowing semantics as a class-syntax override)
|
|
16
|
-
// without tripping that check.
|
|
17
|
-
Object.defineProperty(LyraPolarAreaChart.prototype, 'type', {
|
|
18
|
-
configurable: true,
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get() {
|
|
21
|
-
return 'polarArea';
|
|
22
|
-
},
|
|
23
|
-
set(_v) {
|
|
24
|
-
/* locked to 'polarArea'; direct writes are ignored */
|
|
25
|
-
},
|
|
26
|
-
});
|
|
10
|
+
lockChartType(LyraPolarAreaChart, 'polarArea');
|
|
27
11
|
defineElement('polar-area-chart', LyraPolarAreaChart);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LyraChart } from './chart.js';
|
|
1
|
+
import { LyraChart, lockChartType } from './chart.js';
|
|
2
2
|
import { defineElement } from '../../internal/prefix.js';
|
|
3
3
|
/**
|
|
4
4
|
* `<lyra-radar-chart>` — `<lyra-chart>` with `type` locked to `"radar"`.
|
|
@@ -7,21 +7,5 @@ import { defineElement } from '../../internal/prefix.js';
|
|
|
7
7
|
*/
|
|
8
8
|
export class LyraRadarChart extends LyraChart {
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
// default value — `LyraChart` declares it as a plain (decorator-managed)
|
|
12
|
-
// class field, and TypeScript forbids a subclass from re-declaring a base
|
|
13
|
-
// field as a getter/setter pair via ordinary class syntax (TS2611) — so the
|
|
14
|
-
// accessor pair is installed directly on the prototype instead, which is
|
|
15
|
-
// runtime-equivalent (same shadowing semantics as a class-syntax override)
|
|
16
|
-
// without tripping that check.
|
|
17
|
-
Object.defineProperty(LyraRadarChart.prototype, 'type', {
|
|
18
|
-
configurable: true,
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get() {
|
|
21
|
-
return 'radar';
|
|
22
|
-
},
|
|
23
|
-
set(_v) {
|
|
24
|
-
/* locked to 'radar'; direct writes are ignored */
|
|
25
|
-
},
|
|
26
|
-
});
|
|
10
|
+
lockChartType(LyraRadarChart, 'radar');
|
|
27
11
|
defineElement('radar-chart', LyraRadarChart);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LyraChart } from './chart.js';
|
|
1
|
+
import { LyraChart, lockChartType } from './chart.js';
|
|
2
2
|
import { defineElement } from '../../internal/prefix.js';
|
|
3
3
|
/**
|
|
4
4
|
* `<lyra-scatter-chart>` — `<lyra-chart>` with `type` locked to `"scatter"`. Feed
|
|
@@ -8,21 +8,5 @@ import { defineElement } from '../../internal/prefix.js';
|
|
|
8
8
|
*/
|
|
9
9
|
export class LyraScatterChart extends LyraChart {
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
// default value — `LyraChart` declares it as a plain (decorator-managed)
|
|
13
|
-
// class field, and TypeScript forbids a subclass from re-declaring a base
|
|
14
|
-
// field as a getter/setter pair via ordinary class syntax (TS2611) — so the
|
|
15
|
-
// accessor pair is installed directly on the prototype instead, which is
|
|
16
|
-
// runtime-equivalent (same shadowing semantics as a class-syntax override)
|
|
17
|
-
// without tripping that check.
|
|
18
|
-
Object.defineProperty(LyraScatterChart.prototype, 'type', {
|
|
19
|
-
configurable: true,
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get() {
|
|
22
|
-
return 'scatter';
|
|
23
|
-
},
|
|
24
|
-
set(_v) {
|
|
25
|
-
/* locked to 'scatter'; direct writes are ignored */
|
|
26
|
-
},
|
|
27
|
-
});
|
|
11
|
+
lockChartType(LyraScatterChart, 'scatter');
|
|
28
12
|
defineElement('scatter-chart', LyraScatterChart);
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
export type ChatComposerStatus = 'idle' | 'sending' | 'streaming';
|
|
4
|
+
declare const LyraChatComposer_base: typeof LyraElement & (new (...args: any[]) => import("../../internal/form-associated.js").FormAssociatedInterface);
|
|
5
|
+
/**
|
|
6
|
+
* `<lyra-chat-composer>` — the message input for a chat/agent conversation
|
|
7
|
+
* surface: an auto-resizing textarea plus a send/stop button. Form-
|
|
8
|
+
* associated via the `FormAssociated` mixin (see `<lyra-date-input>` for the
|
|
9
|
+
* same shape), so it participates in native `<form>` submission/validation/
|
|
10
|
+
* reset like any other text control — `name`/`value`/`disabled`/`required`/
|
|
11
|
+
* `checkValidity()`/`reportValidity()` all come from that mixin.
|
|
12
|
+
*
|
|
13
|
+
* Auto-resize reads the textarea's own *computed* line-height/padding/
|
|
14
|
+
* border at runtime (`resizeTextarea()`) rather than assuming a fixed
|
|
15
|
+
* px-per-row constant, so it stays correct under a consumer's own font-size/
|
|
16
|
+
* line-height overrides. It grows between `min-rows` and `max-rows`, then
|
|
17
|
+
* switches to internal scrolling. A `ResizeObserver` on the textarea itself
|
|
18
|
+
* re-runs the same fit whenever its *width* changes (a responsive
|
|
19
|
+
* breakpoint, a sidebar toggling, a window resize, an orientation change)
|
|
20
|
+
* even though `value`/`min-rows`/`max-rows` never did -- a narrower box
|
|
21
|
+
* wraps the same text across more lines, so the previously-fitted height
|
|
22
|
+
* would otherwise go stale and clip content with no scrollbar to reveal it.
|
|
23
|
+
*
|
|
24
|
+
* Enter-to-send (only active while `submit-on-enter` is true, the default):
|
|
25
|
+
* plain Enter submits and is prevented from inserting a newline; Shift+Enter
|
|
26
|
+
* always inserts a newline no matter what; an IME composition step (checked
|
|
27
|
+
* via `isComposing`, with `keyCode === 229` as a defense-in-depth fallback
|
|
28
|
+
* for browsers that report `isComposing` inconsistently on the
|
|
29
|
+
* compositionend-adjacent keydown) is never treated as a submit trigger;
|
|
30
|
+
* and while `status` isn't `"idle"` Enter is left alone to insert a newline
|
|
31
|
+
* too, rather than trying to submit again -- there is nothing meaningful to
|
|
32
|
+
* submit while a previous message is still sending/streaming, and the
|
|
33
|
+
* textarea deliberately stays interactive (see `disabled` below) so a user
|
|
34
|
+
* can keep composing their next message in the meantime.
|
|
35
|
+
*
|
|
36
|
+
* `lyra-submit`'s `detail.value` is always the exact, untrimmed current
|
|
37
|
+
* value (`detail.value === value` at the moment it fires) -- trimming is
|
|
38
|
+
* left to the consumer so it never silently diverges from what `value`
|
|
39
|
+
* itself reports. Submitting does not clear `value`; the consumer clears it
|
|
40
|
+
* once the submission has actually been accepted (so e.g. a failed send can
|
|
41
|
+
* leave the text in place for retry).
|
|
42
|
+
*
|
|
43
|
+
* @customElement lyra-chat-composer
|
|
44
|
+
* @slot leading - Content rendered before the textarea (e.g. an attach-file trigger button).
|
|
45
|
+
* @slot chips - An attachment tray rendered above the input row (e.g. files queued for this message).
|
|
46
|
+
* @slot trailing - Overrides the built-in send/stop button entirely when it has assigned content.
|
|
47
|
+
* @event lyra-input - Fired on every user-driven edit of the textarea (not a programmatic `.value` assignment). `detail: { value }`.
|
|
48
|
+
* @event lyra-submit - Fired by Enter (per `submit-on-enter`) or the built-in button while `status="idle"`. `detail: { value }`.
|
|
49
|
+
* @event lyra-stop - Fired by the built-in button while `status` is `"sending"` or `"streaming"`. No detail.
|
|
50
|
+
* @csspart base - The bordered root container.
|
|
51
|
+
* @csspart chips - The wrapper around the `chips` slot. Hidden entirely when the slot is empty.
|
|
52
|
+
* @csspart row - The row holding the leading slot, textarea, and trailing slot/button.
|
|
53
|
+
* @csspart leading - The wrapper around the `leading` slot. Hidden entirely when the slot is empty.
|
|
54
|
+
* @csspart textarea - The auto-resizing `<textarea>` itself.
|
|
55
|
+
* @csspart trailing - The wrapper around the `trailing` slot and the built-in `action-button`.
|
|
56
|
+
* @csspart action-button - The built-in send/stop button. Absent from the accessibility tree's meaningful content whenever `trailing` has assigned content. Style its busy treatment via `:host([status='sending'])`/`:host([status='streaming'])`.
|
|
57
|
+
*/
|
|
58
|
+
export declare class LyraChatComposer extends LyraChatComposer_base {
|
|
59
|
+
static styles: import("lit").CSSResultGroup[];
|
|
60
|
+
placeholder: string;
|
|
61
|
+
minRows: number;
|
|
62
|
+
maxRows: number;
|
|
63
|
+
status: ChatComposerStatus;
|
|
64
|
+
submitOnEnter: boolean;
|
|
65
|
+
private hasLeadingSlot;
|
|
66
|
+
private hasChipsSlot;
|
|
67
|
+
private hasTrailingSlot;
|
|
68
|
+
private touched;
|
|
69
|
+
private textareaEl?;
|
|
70
|
+
private textareaResizeObserver?;
|
|
71
|
+
private textareaResizeRaf?;
|
|
72
|
+
constructor();
|
|
73
|
+
protected willUpdate(): void;
|
|
74
|
+
protected firstUpdated(changed: PropertyValues): void;
|
|
75
|
+
disconnectedCallback(): void;
|
|
76
|
+
protected updated(changed: PropertyValues): void;
|
|
77
|
+
formResetCallback(): void;
|
|
78
|
+
private hasSlotted;
|
|
79
|
+
/**
|
|
80
|
+
* Grows/shrinks the textarea between `min-rows` and `max-rows`, reading
|
|
81
|
+
* the *computed* line-height/padding/border back out of the element at
|
|
82
|
+
* call time instead of assuming a fixed px-per-row figure -- correct
|
|
83
|
+
* whatever font-size/line-height a consumer's own CSS ends up applying.
|
|
84
|
+
* Past `max-rows` the box stops growing and switches to internal
|
|
85
|
+
* scrolling (`overflow-y: auto`).
|
|
86
|
+
*/
|
|
87
|
+
private resizeTextarea;
|
|
88
|
+
/**
|
|
89
|
+
* Re-fits the textarea whenever its own box *width* changes, independent
|
|
90
|
+
* of any `value`/`min-rows`/`max-rows` update -- `updated()` above only
|
|
91
|
+
* reacts to those, so a pure layout change (a responsive breakpoint, a
|
|
92
|
+
* sidebar collapsing/expanding, a window resize, an orientation change)
|
|
93
|
+
* would otherwise leave the height pinned at whatever it last was, even
|
|
94
|
+
* though the same text now wraps across a different number of lines.
|
|
95
|
+
* Mirrors split.ts's `collapseResizeObserver`/virtual-list.ts's
|
|
96
|
+
* `containerResizeObserver`/lite-chart.ts's `resizeObserver`.
|
|
97
|
+
*
|
|
98
|
+
* Only reacts to an actual inline-size change rather than calling
|
|
99
|
+
* `resizeTextarea()` unconditionally on every callback: `resizeTextarea()`
|
|
100
|
+
* itself sets `ta.style.height`, a *block*-size change on the very element
|
|
101
|
+
* being observed, which would otherwise re-trigger this same observer
|
|
102
|
+
* every tick. Diffing against the last-seen width (same technique as
|
|
103
|
+
* split.ts keying its collapse state off `contentBoxSize[0].inlineSize`)
|
|
104
|
+
* keeps a same-width, height-only callback from doing anything.
|
|
105
|
+
*
|
|
106
|
+
* The actual recompute is deferred one animation frame rather than run
|
|
107
|
+
* synchronously inside the callback: `ResizeObserver`'s spec re-delivers,
|
|
108
|
+
* within the same notification pass, to any observed element resized by
|
|
109
|
+
* its own callback -- mutating `ta.style.height` synchronously here would
|
|
110
|
+
* do exactly that to the very box just observed, and the browser reports
|
|
111
|
+
* it as "ResizeObserver loop completed with undelivered notifications"
|
|
112
|
+
* (a real, user-visible console error, not just noise). Deferring the
|
|
113
|
+
* mutation to the next frame -- outside that notification pass -- avoids
|
|
114
|
+
* ever resizing the observed element from inside its own callback.
|
|
115
|
+
*/
|
|
116
|
+
private armTextareaResizeObserver;
|
|
117
|
+
private onTextareaInput;
|
|
118
|
+
private onTextareaKeyDown;
|
|
119
|
+
private onActionClick;
|
|
120
|
+
private submit;
|
|
121
|
+
private onLeadingSlotChange;
|
|
122
|
+
private onChipsSlotChange;
|
|
123
|
+
private onTrailingSlotChange;
|
|
124
|
+
private onTextareaBlur;
|
|
125
|
+
private renderActionButton;
|
|
126
|
+
render(): TemplateResult;
|
|
127
|
+
}
|
|
128
|
+
declare global {
|
|
129
|
+
interface HTMLElementTagNameMap {
|
|
130
|
+
'lyra-chat-composer': LyraChatComposer;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export {};
|
|
@@ -0,0 +1,366 @@
|
|
|
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, svg } from 'lit';
|
|
8
|
+
import { property, state, query } from 'lit/decorators.js';
|
|
9
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
|
+
import { FormAssociated } from '../../internal/form-associated.js';
|
|
11
|
+
import { defineElement } from '../../internal/prefix.js';
|
|
12
|
+
import { styles } from './chat-composer.styles.js';
|
|
13
|
+
// Mirrors the shared icon set's viewBox/stroke conventions
|
|
14
|
+
// (internal/icons.ts's chevronIcon()/closeIcon()/etc.) without adding
|
|
15
|
+
// send/stop glyphs to that module -- it's off limits here -- so these
|
|
16
|
+
// one-off icons still read as part of the same visual language as the rest
|
|
17
|
+
// of the library's inline icons. Same approach lyra-checkbox's and
|
|
18
|
+
// lyra-chat-message's own local glyphs take for the identical reason.
|
|
19
|
+
const ICON_VIEW_BOX = '0 0 24 24';
|
|
20
|
+
const ICON_STROKE_WIDTH = '1.75';
|
|
21
|
+
function sendIcon() {
|
|
22
|
+
return svg `
|
|
23
|
+
<svg
|
|
24
|
+
width="1em"
|
|
25
|
+
height="1em"
|
|
26
|
+
viewBox=${ICON_VIEW_BOX}
|
|
27
|
+
fill="none"
|
|
28
|
+
stroke="currentColor"
|
|
29
|
+
stroke-width=${ICON_STROKE_WIDTH}
|
|
30
|
+
stroke-linecap="round"
|
|
31
|
+
stroke-linejoin="round"
|
|
32
|
+
aria-hidden="true"
|
|
33
|
+
focusable="false"
|
|
34
|
+
><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
37
|
+
/** A filled square -- the conventional "stop generating" glyph. */
|
|
38
|
+
function stopIcon() {
|
|
39
|
+
return svg `
|
|
40
|
+
<svg
|
|
41
|
+
width="1em"
|
|
42
|
+
height="1em"
|
|
43
|
+
viewBox=${ICON_VIEW_BOX}
|
|
44
|
+
fill="currentColor"
|
|
45
|
+
stroke="none"
|
|
46
|
+
aria-hidden="true"
|
|
47
|
+
focusable="false"
|
|
48
|
+
><rect x="6" y="6" width="12" height="12" rx="1.5"></rect></svg>
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* `<lyra-chat-composer>` — the message input for a chat/agent conversation
|
|
53
|
+
* surface: an auto-resizing textarea plus a send/stop button. Form-
|
|
54
|
+
* associated via the `FormAssociated` mixin (see `<lyra-date-input>` for the
|
|
55
|
+
* same shape), so it participates in native `<form>` submission/validation/
|
|
56
|
+
* reset like any other text control — `name`/`value`/`disabled`/`required`/
|
|
57
|
+
* `checkValidity()`/`reportValidity()` all come from that mixin.
|
|
58
|
+
*
|
|
59
|
+
* Auto-resize reads the textarea's own *computed* line-height/padding/
|
|
60
|
+
* border at runtime (`resizeTextarea()`) rather than assuming a fixed
|
|
61
|
+
* px-per-row constant, so it stays correct under a consumer's own font-size/
|
|
62
|
+
* line-height overrides. It grows between `min-rows` and `max-rows`, then
|
|
63
|
+
* switches to internal scrolling. A `ResizeObserver` on the textarea itself
|
|
64
|
+
* re-runs the same fit whenever its *width* changes (a responsive
|
|
65
|
+
* breakpoint, a sidebar toggling, a window resize, an orientation change)
|
|
66
|
+
* even though `value`/`min-rows`/`max-rows` never did -- a narrower box
|
|
67
|
+
* wraps the same text across more lines, so the previously-fitted height
|
|
68
|
+
* would otherwise go stale and clip content with no scrollbar to reveal it.
|
|
69
|
+
*
|
|
70
|
+
* Enter-to-send (only active while `submit-on-enter` is true, the default):
|
|
71
|
+
* plain Enter submits and is prevented from inserting a newline; Shift+Enter
|
|
72
|
+
* always inserts a newline no matter what; an IME composition step (checked
|
|
73
|
+
* via `isComposing`, with `keyCode === 229` as a defense-in-depth fallback
|
|
74
|
+
* for browsers that report `isComposing` inconsistently on the
|
|
75
|
+
* compositionend-adjacent keydown) is never treated as a submit trigger;
|
|
76
|
+
* and while `status` isn't `"idle"` Enter is left alone to insert a newline
|
|
77
|
+
* too, rather than trying to submit again -- there is nothing meaningful to
|
|
78
|
+
* submit while a previous message is still sending/streaming, and the
|
|
79
|
+
* textarea deliberately stays interactive (see `disabled` below) so a user
|
|
80
|
+
* can keep composing their next message in the meantime.
|
|
81
|
+
*
|
|
82
|
+
* `lyra-submit`'s `detail.value` is always the exact, untrimmed current
|
|
83
|
+
* value (`detail.value === value` at the moment it fires) -- trimming is
|
|
84
|
+
* left to the consumer so it never silently diverges from what `value`
|
|
85
|
+
* itself reports. Submitting does not clear `value`; the consumer clears it
|
|
86
|
+
* once the submission has actually been accepted (so e.g. a failed send can
|
|
87
|
+
* leave the text in place for retry).
|
|
88
|
+
*
|
|
89
|
+
* @customElement lyra-chat-composer
|
|
90
|
+
* @slot leading - Content rendered before the textarea (e.g. an attach-file trigger button).
|
|
91
|
+
* @slot chips - An attachment tray rendered above the input row (e.g. files queued for this message).
|
|
92
|
+
* @slot trailing - Overrides the built-in send/stop button entirely when it has assigned content.
|
|
93
|
+
* @event lyra-input - Fired on every user-driven edit of the textarea (not a programmatic `.value` assignment). `detail: { value }`.
|
|
94
|
+
* @event lyra-submit - Fired by Enter (per `submit-on-enter`) or the built-in button while `status="idle"`. `detail: { value }`.
|
|
95
|
+
* @event lyra-stop - Fired by the built-in button while `status` is `"sending"` or `"streaming"`. No detail.
|
|
96
|
+
* @csspart base - The bordered root container.
|
|
97
|
+
* @csspart chips - The wrapper around the `chips` slot. Hidden entirely when the slot is empty.
|
|
98
|
+
* @csspart row - The row holding the leading slot, textarea, and trailing slot/button.
|
|
99
|
+
* @csspart leading - The wrapper around the `leading` slot. Hidden entirely when the slot is empty.
|
|
100
|
+
* @csspart textarea - The auto-resizing `<textarea>` itself.
|
|
101
|
+
* @csspart trailing - The wrapper around the `trailing` slot and the built-in `action-button`.
|
|
102
|
+
* @csspart action-button - The built-in send/stop button. Absent from the accessibility tree's meaningful content whenever `trailing` has assigned content. Style its busy treatment via `:host([status='sending'])`/`:host([status='streaming'])`.
|
|
103
|
+
*/
|
|
104
|
+
export class LyraChatComposer extends FormAssociated(LyraElement) {
|
|
105
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
106
|
+
constructor() {
|
|
107
|
+
super();
|
|
108
|
+
this.placeholder = '';
|
|
109
|
+
this.minRows = 1;
|
|
110
|
+
this.maxRows = 8;
|
|
111
|
+
this.status = 'idle';
|
|
112
|
+
this.submitOnEnter = true;
|
|
113
|
+
this.hasLeadingSlot = false;
|
|
114
|
+
this.hasChipsSlot = false;
|
|
115
|
+
this.hasTrailingSlot = false;
|
|
116
|
+
this.touched = false;
|
|
117
|
+
this.onTextareaInput = (e) => {
|
|
118
|
+
this.value = e.target.value;
|
|
119
|
+
this.emit('lyra-input', { value: this.value });
|
|
120
|
+
};
|
|
121
|
+
this.onTextareaKeyDown = (e) => {
|
|
122
|
+
if (e.key !== 'Enter')
|
|
123
|
+
return;
|
|
124
|
+
// Shift+Enter always inserts a newline, regardless of submit-on-enter --
|
|
125
|
+
// leave the browser's own default action alone.
|
|
126
|
+
if (e.shiftKey)
|
|
127
|
+
return;
|
|
128
|
+
// submit-on-enter="false": Enter always inserts a newline too.
|
|
129
|
+
if (!this.submitOnEnter)
|
|
130
|
+
return;
|
|
131
|
+
// An IME composition step (e.g. confirming a Japanese/Chinese/Korean
|
|
132
|
+
// candidate) must never be treated as "the user pressed Enter to send" --
|
|
133
|
+
// keyCode 229 is a defense-in-depth fallback for browsers that report
|
|
134
|
+
// isComposing inconsistently on the compositionend-adjacent keydown.
|
|
135
|
+
if (e.isComposing || e.keyCode === 229)
|
|
136
|
+
return;
|
|
137
|
+
// Nothing meaningful to (re-)submit while already sending/streaming --
|
|
138
|
+
// fall through to the default newline insertion instead, so the
|
|
139
|
+
// textarea stays a normal place to keep composing the next message.
|
|
140
|
+
if (this.status !== 'idle')
|
|
141
|
+
return;
|
|
142
|
+
e.preventDefault();
|
|
143
|
+
this.submit();
|
|
144
|
+
};
|
|
145
|
+
this.onActionClick = () => {
|
|
146
|
+
if (this.effectiveDisabled)
|
|
147
|
+
return;
|
|
148
|
+
if (this.status === 'idle') {
|
|
149
|
+
this.submit();
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this.emit('lyra-stop');
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
this.onLeadingSlotChange = (e) => {
|
|
156
|
+
this.hasLeadingSlot = e.target.assignedElements({ flatten: true }).length > 0;
|
|
157
|
+
};
|
|
158
|
+
this.onChipsSlotChange = (e) => {
|
|
159
|
+
this.hasChipsSlot = e.target.assignedElements({ flatten: true }).length > 0;
|
|
160
|
+
};
|
|
161
|
+
this.onTrailingSlotChange = (e) => {
|
|
162
|
+
this.hasTrailingSlot = e.target.assignedElements({ flatten: true }).length > 0;
|
|
163
|
+
};
|
|
164
|
+
this.onTextareaBlur = () => {
|
|
165
|
+
this.touched = true;
|
|
166
|
+
};
|
|
167
|
+
this.addEventListener('invalid', () => {
|
|
168
|
+
this.touched = true;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
willUpdate() {
|
|
172
|
+
if (!this.hasUpdated) {
|
|
173
|
+
this.hasLeadingSlot = this.hasSlotted('leading');
|
|
174
|
+
this.hasChipsSlot = this.hasSlotted('chips');
|
|
175
|
+
this.hasTrailingSlot = this.hasSlotted('trailing');
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
firstUpdated(changed) {
|
|
179
|
+
super.firstUpdated(changed);
|
|
180
|
+
this.resizeTextarea();
|
|
181
|
+
this.armTextareaResizeObserver();
|
|
182
|
+
}
|
|
183
|
+
disconnectedCallback() {
|
|
184
|
+
super.disconnectedCallback();
|
|
185
|
+
this.textareaResizeObserver?.disconnect();
|
|
186
|
+
if (this.textareaResizeRaf !== undefined)
|
|
187
|
+
cancelAnimationFrame(this.textareaResizeRaf);
|
|
188
|
+
this.textareaResizeRaf = undefined;
|
|
189
|
+
}
|
|
190
|
+
updated(changed) {
|
|
191
|
+
super.updated(changed);
|
|
192
|
+
if (changed.has('value') || changed.has('minRows') || changed.has('maxRows')) {
|
|
193
|
+
this.resizeTextarea();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
formResetCallback() {
|
|
197
|
+
super.formResetCallback();
|
|
198
|
+
this.touched = false;
|
|
199
|
+
}
|
|
200
|
+
hasSlotted(name) {
|
|
201
|
+
return Array.from(this.children).some((el) => el.getAttribute('slot') === name);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Grows/shrinks the textarea between `min-rows` and `max-rows`, reading
|
|
205
|
+
* the *computed* line-height/padding/border back out of the element at
|
|
206
|
+
* call time instead of assuming a fixed px-per-row figure -- correct
|
|
207
|
+
* whatever font-size/line-height a consumer's own CSS ends up applying.
|
|
208
|
+
* Past `max-rows` the box stops growing and switches to internal
|
|
209
|
+
* scrolling (`overflow-y: auto`).
|
|
210
|
+
*/
|
|
211
|
+
resizeTextarea() {
|
|
212
|
+
const ta = this.textareaEl;
|
|
213
|
+
if (!ta)
|
|
214
|
+
return;
|
|
215
|
+
const cs = getComputedStyle(ta);
|
|
216
|
+
const lineHeight = parseFloat(cs.lineHeight) || parseFloat(cs.fontSize) * 1.2;
|
|
217
|
+
const paddingBlock = parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom);
|
|
218
|
+
const borderBlock = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth);
|
|
219
|
+
const minRows = Math.max(1, this.minRows || 1);
|
|
220
|
+
const maxRows = Math.max(minRows, this.maxRows || minRows);
|
|
221
|
+
const minHeight = lineHeight * minRows + paddingBlock + borderBlock;
|
|
222
|
+
const maxHeight = lineHeight * maxRows + paddingBlock + borderBlock;
|
|
223
|
+
// Collapse first so a shrinking edit (e.g. deleting a wrapped line)
|
|
224
|
+
// reports its true scrollHeight rather than the previous, taller,
|
|
225
|
+
// explicitly-set height.
|
|
226
|
+
ta.style.height = 'auto';
|
|
227
|
+
// scrollHeight never includes border, so it's added back in to compare
|
|
228
|
+
// apples-to-apples against min/maxHeight, both of which are border-box
|
|
229
|
+
// figures (this component inherits box-sizing: border-box from
|
|
230
|
+
// LyraElement's tokens.styles.ts).
|
|
231
|
+
const contentHeight = ta.scrollHeight + borderBlock;
|
|
232
|
+
const next = Math.min(Math.max(contentHeight, minHeight), maxHeight);
|
|
233
|
+
ta.style.height = `${next}px`;
|
|
234
|
+
ta.style.overflowY = contentHeight > maxHeight ? 'auto' : 'hidden';
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Re-fits the textarea whenever its own box *width* changes, independent
|
|
238
|
+
* of any `value`/`min-rows`/`max-rows` update -- `updated()` above only
|
|
239
|
+
* reacts to those, so a pure layout change (a responsive breakpoint, a
|
|
240
|
+
* sidebar collapsing/expanding, a window resize, an orientation change)
|
|
241
|
+
* would otherwise leave the height pinned at whatever it last was, even
|
|
242
|
+
* though the same text now wraps across a different number of lines.
|
|
243
|
+
* Mirrors split.ts's `collapseResizeObserver`/virtual-list.ts's
|
|
244
|
+
* `containerResizeObserver`/lite-chart.ts's `resizeObserver`.
|
|
245
|
+
*
|
|
246
|
+
* Only reacts to an actual inline-size change rather than calling
|
|
247
|
+
* `resizeTextarea()` unconditionally on every callback: `resizeTextarea()`
|
|
248
|
+
* itself sets `ta.style.height`, a *block*-size change on the very element
|
|
249
|
+
* being observed, which would otherwise re-trigger this same observer
|
|
250
|
+
* every tick. Diffing against the last-seen width (same technique as
|
|
251
|
+
* split.ts keying its collapse state off `contentBoxSize[0].inlineSize`)
|
|
252
|
+
* keeps a same-width, height-only callback from doing anything.
|
|
253
|
+
*
|
|
254
|
+
* The actual recompute is deferred one animation frame rather than run
|
|
255
|
+
* synchronously inside the callback: `ResizeObserver`'s spec re-delivers,
|
|
256
|
+
* within the same notification pass, to any observed element resized by
|
|
257
|
+
* its own callback -- mutating `ta.style.height` synchronously here would
|
|
258
|
+
* do exactly that to the very box just observed, and the browser reports
|
|
259
|
+
* it as "ResizeObserver loop completed with undelivered notifications"
|
|
260
|
+
* (a real, user-visible console error, not just noise). Deferring the
|
|
261
|
+
* mutation to the next frame -- outside that notification pass -- avoids
|
|
262
|
+
* ever resizing the observed element from inside its own callback.
|
|
263
|
+
*/
|
|
264
|
+
armTextareaResizeObserver() {
|
|
265
|
+
const ta = this.textareaEl;
|
|
266
|
+
if (!ta || this.textareaResizeObserver)
|
|
267
|
+
return;
|
|
268
|
+
let lastWidth = ta.getBoundingClientRect().width;
|
|
269
|
+
this.textareaResizeObserver = new ResizeObserver((entries) => {
|
|
270
|
+
const box = entries[0]?.contentBoxSize?.[0];
|
|
271
|
+
const width = box ? box.inlineSize : (entries[0]?.contentRect.width ?? lastWidth);
|
|
272
|
+
// A sub-pixel-only difference (common with fractional layout/zoom)
|
|
273
|
+
// isn't worth a recompute.
|
|
274
|
+
if (Math.abs(width - lastWidth) < 0.5)
|
|
275
|
+
return;
|
|
276
|
+
lastWidth = width;
|
|
277
|
+
if (this.textareaResizeRaf !== undefined)
|
|
278
|
+
cancelAnimationFrame(this.textareaResizeRaf);
|
|
279
|
+
this.textareaResizeRaf = requestAnimationFrame(() => {
|
|
280
|
+
this.textareaResizeRaf = undefined;
|
|
281
|
+
this.resizeTextarea();
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
this.textareaResizeObserver.observe(ta);
|
|
285
|
+
}
|
|
286
|
+
submit() {
|
|
287
|
+
this.emit('lyra-submit', { value: this.value });
|
|
288
|
+
}
|
|
289
|
+
renderActionButton() {
|
|
290
|
+
const busy = this.status !== 'idle';
|
|
291
|
+
return html `
|
|
292
|
+
<button
|
|
293
|
+
part="action-button"
|
|
294
|
+
type="button"
|
|
295
|
+
aria-label=${busy ? 'Stop generating' : 'Send message'}
|
|
296
|
+
?disabled=${this.effectiveDisabled}
|
|
297
|
+
@click=${this.onActionClick}
|
|
298
|
+
>
|
|
299
|
+
${busy ? stopIcon() : sendIcon()}
|
|
300
|
+
</button>
|
|
301
|
+
`;
|
|
302
|
+
}
|
|
303
|
+
render() {
|
|
304
|
+
return html `
|
|
305
|
+
<div part="base">
|
|
306
|
+
<div part="chips" ?hidden=${!this.hasChipsSlot}>
|
|
307
|
+
<slot name="chips" @slotchange=${this.onChipsSlotChange}></slot>
|
|
308
|
+
</div>
|
|
309
|
+
<div part="row">
|
|
310
|
+
<span part="leading" ?hidden=${!this.hasLeadingSlot}>
|
|
311
|
+
<slot name="leading" @slotchange=${this.onLeadingSlotChange}></slot>
|
|
312
|
+
</span>
|
|
313
|
+
<textarea
|
|
314
|
+
part="textarea"
|
|
315
|
+
aria-label=${this.placeholder || 'Message'}
|
|
316
|
+
aria-required=${this.required ? 'true' : 'false'}
|
|
317
|
+
aria-invalid=${this.touched && !this.internals.validity.valid ? 'true' : 'false'}
|
|
318
|
+
.value=${this.value}
|
|
319
|
+
placeholder=${this.placeholder}
|
|
320
|
+
rows=${Math.max(1, this.minRows || 1)}
|
|
321
|
+
?required=${this.required}
|
|
322
|
+
?disabled=${this.effectiveDisabled}
|
|
323
|
+
@input=${this.onTextareaInput}
|
|
324
|
+
@keydown=${this.onTextareaKeyDown}
|
|
325
|
+
@blur=${this.onTextareaBlur}
|
|
326
|
+
></textarea>
|
|
327
|
+
<span part="trailing">
|
|
328
|
+
<slot name="trailing" @slotchange=${this.onTrailingSlotChange}></slot>
|
|
329
|
+
${this.hasTrailingSlot ? nothing : this.renderActionButton()}
|
|
330
|
+
</span>
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
`;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
__decorate([
|
|
337
|
+
property()
|
|
338
|
+
], LyraChatComposer.prototype, "placeholder", void 0);
|
|
339
|
+
__decorate([
|
|
340
|
+
property({ type: Number, attribute: 'min-rows' })
|
|
341
|
+
], LyraChatComposer.prototype, "minRows", void 0);
|
|
342
|
+
__decorate([
|
|
343
|
+
property({ type: Number, attribute: 'max-rows' })
|
|
344
|
+
], LyraChatComposer.prototype, "maxRows", void 0);
|
|
345
|
+
__decorate([
|
|
346
|
+
property({ reflect: true })
|
|
347
|
+
], LyraChatComposer.prototype, "status", void 0);
|
|
348
|
+
__decorate([
|
|
349
|
+
property({ type: Boolean, reflect: true, attribute: 'submit-on-enter' })
|
|
350
|
+
], LyraChatComposer.prototype, "submitOnEnter", void 0);
|
|
351
|
+
__decorate([
|
|
352
|
+
state()
|
|
353
|
+
], LyraChatComposer.prototype, "hasLeadingSlot", void 0);
|
|
354
|
+
__decorate([
|
|
355
|
+
state()
|
|
356
|
+
], LyraChatComposer.prototype, "hasChipsSlot", void 0);
|
|
357
|
+
__decorate([
|
|
358
|
+
state()
|
|
359
|
+
], LyraChatComposer.prototype, "hasTrailingSlot", void 0);
|
|
360
|
+
__decorate([
|
|
361
|
+
state()
|
|
362
|
+
], LyraChatComposer.prototype, "touched", void 0);
|
|
363
|
+
__decorate([
|
|
364
|
+
query('textarea')
|
|
365
|
+
], LyraChatComposer.prototype, "textareaEl", void 0);
|
|
366
|
+
defineElement('chat-composer', LyraChatComposer);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|