@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 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
vertical-align: middle;
|
|
6
|
+
/* Swapped per-phase by the :host([phase]) rules below, rather than
|
|
7
|
+
repeating color/opacity per rule -- same one-custom-property-per-tone
|
|
8
|
+
shape as lyra-tool-call-chip's --lyra-tool-call-chip-accent. */
|
|
9
|
+
--lyra-stream-status-dot-color: var(--lyra-color-text-quiet);
|
|
10
|
+
--lyra-stream-status-dot-opacity: 0.35;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* 'connecting' gets a dimmer, static brand dot -- present but deliberately
|
|
14
|
+
quieter than 'streaming' so the two are never confused at a glance. */
|
|
15
|
+
:host([phase='connecting']) {
|
|
16
|
+
--lyra-stream-status-dot-color: var(--lyra-color-brand);
|
|
17
|
+
--lyra-stream-status-dot-opacity: 0.6;
|
|
18
|
+
}
|
|
19
|
+
:host([phase='streaming']) {
|
|
20
|
+
--lyra-stream-status-dot-color: var(--lyra-color-brand);
|
|
21
|
+
--lyra-stream-status-dot-opacity: 1;
|
|
22
|
+
}
|
|
23
|
+
/* Warning, not danger -- see the class doc's "Visual" section for why a
|
|
24
|
+
stall defaults to the recoverable/actionable tone. */
|
|
25
|
+
:host([phase='stalled']) {
|
|
26
|
+
--lyra-stream-status-dot-color: var(--lyra-color-warning);
|
|
27
|
+
--lyra-stream-status-dot-opacity: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[part='base'] {
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: var(--lyra-space-s);
|
|
34
|
+
border-radius: var(--lyra-radius);
|
|
35
|
+
transition:
|
|
36
|
+
background-color var(--lyra-transition-base),
|
|
37
|
+
border-color var(--lyra-transition-base);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* The one "unmistakable" treatment the spec calls for: a stall tints the
|
|
41
|
+
whole row, not just the dot, so the message/actions read as one alert
|
|
42
|
+
unit rather than a plain dot next to unrelated-looking text. */
|
|
43
|
+
:host([phase='stalled']) [part='base'] {
|
|
44
|
+
padding: var(--lyra-space-xs) var(--lyra-space-s);
|
|
45
|
+
background: var(--lyra-color-warning-quiet);
|
|
46
|
+
border: 1px solid var(--lyra-color-warning);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[part='indicator'] {
|
|
50
|
+
flex: 0 0 auto;
|
|
51
|
+
inline-size: 0.5rem;
|
|
52
|
+
block-size: 0.5rem;
|
|
53
|
+
border-radius: 50%;
|
|
54
|
+
background: var(--lyra-stream-status-dot-color);
|
|
55
|
+
opacity: var(--lyra-stream-status-dot-opacity);
|
|
56
|
+
transition:
|
|
57
|
+
background-color var(--lyra-transition-base),
|
|
58
|
+
opacity var(--lyra-transition-base);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Only 'streaming' pulses -- a moving dot reads as "actively receiving
|
|
62
|
+
data right now"; every other phase (including 'stalled', which wants
|
|
63
|
+
steady attention via color/tint, not extra motion) stays static. Same
|
|
64
|
+
transition-cycle token/rationale as lyra-typing-indicator's pulse
|
|
65
|
+
variant -- see that component's styles for the full explanation of why
|
|
66
|
+
--lyra-transition-base (not -fast) is the right length for an ambient
|
|
67
|
+
loop. */
|
|
68
|
+
:host([phase='streaming']) [part='indicator'] {
|
|
69
|
+
animation: lyra-stream-status-pulse var(--lyra-transition-base) infinite;
|
|
70
|
+
}
|
|
71
|
+
@keyframes lyra-stream-status-pulse {
|
|
72
|
+
0%,
|
|
73
|
+
100% {
|
|
74
|
+
transform: scale(0.85);
|
|
75
|
+
opacity: 0.6;
|
|
76
|
+
}
|
|
77
|
+
50% {
|
|
78
|
+
transform: scale(1);
|
|
79
|
+
opacity: 1;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
@media (prefers-reduced-motion: reduce) {
|
|
83
|
+
[part='indicator'] {
|
|
84
|
+
animation: none !important;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
[part='message'] {
|
|
89
|
+
color: var(--lyra-color-warning);
|
|
90
|
+
font-size: 0.875rem;
|
|
91
|
+
font-weight: 600;
|
|
92
|
+
line-height: 1.3;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
[part='actions'] {
|
|
96
|
+
display: inline-flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
gap: var(--lyra-space-xs);
|
|
99
|
+
}
|
|
100
|
+
[part='actions'][hidden] {
|
|
101
|
+
display: none;
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
import '../markdown/markdown.js';
|
|
4
|
+
/** Runs {@link MARKDOWN_PATTERNS} against `text`, used whenever `markdown`
|
|
5
|
+
* is left unset (auto-detect). Exported so the heuristic is directly
|
|
6
|
+
* testable without going through the component's render cycle. */
|
|
7
|
+
export declare function looksLikeMarkdown(text: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* `<lyra-streaming-text>` — a token-coalescing incremental text renderer for
|
|
10
|
+
* streaming assistant output, with an optional blinking cursor and
|
|
11
|
+
* auto-detected Markdown rendering.
|
|
12
|
+
*
|
|
13
|
+
* The host is expected to assign the *entire* current text on every update
|
|
14
|
+
* to `content`, not a delta -- this component does no accumulation or
|
|
15
|
+
* ordering of its own. That matches how most streaming-UI state (SSE/
|
|
16
|
+
* WebSocket token accumulation into a growing string in application state)
|
|
17
|
+
* is already managed.
|
|
18
|
+
*
|
|
19
|
+
* Token-by-token streaming can update `content` far faster than a human can
|
|
20
|
+
* usefully perceive a re-render -- dozens of times a second for a fast
|
|
21
|
+
* model. Re-rendering on every single assignment thrashes layout for no
|
|
22
|
+
* visible benefit, so updates funnel through `Announcer`
|
|
23
|
+
* (`../../internal/announcer.js`), reused here purely as the generic
|
|
24
|
+
* "coalesce rapid calls, flush the latest" timing primitive its own class
|
|
25
|
+
* doc says other components should reuse -- with none of its usual
|
|
26
|
+
* DOM/ARIA plumbing (that's `<lyra-live-region>`'s job, not this
|
|
27
|
+
* component's). Within any `coalesce-ms` window, only the *last* `content`
|
|
28
|
+
* value assigned actually reaches the rendered DOM. Two cases always bypass
|
|
29
|
+
* the throttle and flush immediately instead of waiting out the window: the
|
|
30
|
+
* very first `content` assignment after mount (so an already-complete
|
|
31
|
+
* message never shows an artificial startup delay), and any transition of
|
|
32
|
+
* `streaming` between `true` and `false` in either direction (so the final
|
|
33
|
+
* chunk of a finished stream can never be left stranded mid-window, and a
|
|
34
|
+
* stream restarting on a reused element can never keep showing the
|
|
35
|
+
* previous stream's stale final content for the length of the window).
|
|
36
|
+
*
|
|
37
|
+
* `markdown` is a tri-state property, not a plain boolean: left unset (the
|
|
38
|
+
* default), it auto-detects via a lightweight regex heuristic (see
|
|
39
|
+
* `looksLikeMarkdown`) run against whatever text is currently displayed --
|
|
40
|
+
* good enough to route obviously-Markdown output through `<lyra-markdown>`
|
|
41
|
+
* without the host needing to know or declare it up front, at the cost of
|
|
42
|
+
* an occasional one-time mode flip if Markdown syntax only appears partway
|
|
43
|
+
* through a stream. Explicitly setting `markdown` to `true`/`false` always
|
|
44
|
+
* wins over the heuristic. Rendering itself is never reimplemented here:
|
|
45
|
+
* Markdown mode composes `<lyra-markdown>` (`../markdown/markdown.js`)
|
|
46
|
+
* directly, forwarding this component's own `streaming` through as that
|
|
47
|
+
* component's own forward-compatible `streaming` hint prop; plain-text mode
|
|
48
|
+
* renders into a `white-space: pre-wrap` span instead.
|
|
49
|
+
*
|
|
50
|
+
* The blinking cursor (shown only while `streaming` is `true`) degrades to
|
|
51
|
+
* a static, always-visible bar under `prefers-reduced-motion: reduce`
|
|
52
|
+
* rather than disabling the animation into an invisible frozen frame --
|
|
53
|
+
* the same pattern `<lyra-typing-indicator>`'s own `cursor` variant uses. In
|
|
54
|
+
* plain-text mode the cursor sits inline at the tail of the final
|
|
55
|
+
* character, since the text is one continuous inline flow; in Markdown
|
|
56
|
+
* mode it renders as its own trailing block below the rendered content
|
|
57
|
+
* instead of attempting to splice into whatever nested block Markdown
|
|
58
|
+
* happens to end with (a paragraph, a table cell, a list item, a fenced
|
|
59
|
+
* code block, …) -- genuinely interleaving into arbitrary rendered Markdown
|
|
60
|
+
* without reaching across `<lyra-markdown>`'s own shadow boundary isn't a
|
|
61
|
+
* tractable general solution, so this component doesn't attempt it.
|
|
62
|
+
*
|
|
63
|
+
* Purely presentational: no events, driven entirely by its properties. It
|
|
64
|
+
* also doesn't announce anything to assistive tech itself -- a host that
|
|
65
|
+
* needs streamed text announced already has `<lyra-live-region>` for that
|
|
66
|
+
* (composed, for example, inside `<lyra-chat-message>`).
|
|
67
|
+
*
|
|
68
|
+
* @customElement lyra-streaming-text
|
|
69
|
+
* @csspart base - The root container.
|
|
70
|
+
* @csspart cursor - The blinking (or, under reduced motion, static) cursor bar. Only rendered while `streaming` is `true`.
|
|
71
|
+
*/
|
|
72
|
+
export declare class LyraStreamingText extends LyraElement {
|
|
73
|
+
static styles: import("lit").CSSResultGroup[];
|
|
74
|
+
/** The full current text so far -- always the complete string, never a
|
|
75
|
+
* delta to append. */
|
|
76
|
+
content: string;
|
|
77
|
+
/** Shows the blinking cursor after the rendered text. Reflects, so a host
|
|
78
|
+
* can also target `lyra-streaming-text[streaming]` in CSS. */
|
|
79
|
+
streaming: boolean;
|
|
80
|
+
/** Trailing-edge coalesce window, in ms, for `content` updates -- see the
|
|
81
|
+
* class doc. */
|
|
82
|
+
coalesceMs: number;
|
|
83
|
+
/** `undefined` (default) auto-detects via `looksLikeMarkdown`; `true`/
|
|
84
|
+
* `false` force that rendering mode regardless of content. */
|
|
85
|
+
markdown?: boolean;
|
|
86
|
+
private displayedContent;
|
|
87
|
+
private lastScannedContent?;
|
|
88
|
+
private lastScannedResult;
|
|
89
|
+
private readonly coalescer;
|
|
90
|
+
constructor();
|
|
91
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
92
|
+
disconnectedCallback(): void;
|
|
93
|
+
/** Whether Markdown mode is actually in effect right now, resolving the
|
|
94
|
+
* tri-state `markdown` property against the memoized `looksLikeMarkdown`
|
|
95
|
+
* result for the currently-displayed content (see `lastScannedContent`/
|
|
96
|
+
* `lastScannedResult` above). */
|
|
97
|
+
private get effectiveMarkdown();
|
|
98
|
+
render(): TemplateResult;
|
|
99
|
+
}
|
|
100
|
+
declare global {
|
|
101
|
+
interface HTMLElementTagNameMap {
|
|
102
|
+
'lyra-streaming-text': LyraStreamingText;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
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 { Announcer } from '../../internal/announcer.js';
|
|
12
|
+
import '../markdown/markdown.js';
|
|
13
|
+
import { styles } from './streaming-text.styles.js';
|
|
14
|
+
const DEFAULT_COALESCE_MS = 50;
|
|
15
|
+
/**
|
|
16
|
+
* Lightweight, deliberately-imperfect signals that the currently-displayed
|
|
17
|
+
* text contains Markdown syntax worth routing through `<lyra-markdown>`
|
|
18
|
+
* rather than a plain `white-space: pre-wrap` node. Checked in order against
|
|
19
|
+
* the whole string; the first match short-circuits. None of these need to be
|
|
20
|
+
* airtight -- a false positive just renders ordinary prose through
|
|
21
|
+
* `<lyra-markdown>` (which renders plain prose fine); a false negative just
|
|
22
|
+
* renders literal `**`/backticks/etc. as plain text until more of the stream
|
|
23
|
+
* arrives.
|
|
24
|
+
*/
|
|
25
|
+
const MARKDOWN_PATTERNS = [
|
|
26
|
+
/^ {0,3}#{1,6}\s+\S/m, // ATX heading: "# Heading"
|
|
27
|
+
/```/, // fenced code block
|
|
28
|
+
/\*\*[^*\n]+\*\*/, // **bold**
|
|
29
|
+
/(?:^|[^\w])_[^_\n]+_(?:[^\w]|$)/, // _italic_
|
|
30
|
+
/`[^`\n]+`/, // inline code
|
|
31
|
+
/^ {0,3}[-*+]\s+\S/m, // bullet list item
|
|
32
|
+
/^ {0,3}\d+\.\s+\S/m, // numbered list item
|
|
33
|
+
/\[[^\]]+\]\([^)\s]+\)/, // [text](url)
|
|
34
|
+
/^ {0,3}>\s?\S/m, // blockquote
|
|
35
|
+
];
|
|
36
|
+
/** Runs {@link MARKDOWN_PATTERNS} against `text`, used whenever `markdown`
|
|
37
|
+
* is left unset (auto-detect). Exported so the heuristic is directly
|
|
38
|
+
* testable without going through the component's render cycle. */
|
|
39
|
+
export function looksLikeMarkdown(text) {
|
|
40
|
+
if (!text)
|
|
41
|
+
return false;
|
|
42
|
+
return MARKDOWN_PATTERNS.some((pattern) => pattern.test(text));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Tri-state boolean attribute converter for `markdown`. Lit's built-in
|
|
46
|
+
* `type: Boolean` converter is presence-based and can only ever represent
|
|
47
|
+
* two states (attribute present -> `true`, absent -> `false`) -- there's no
|
|
48
|
+
* way for it to also represent "not specified, auto-detect instead", which
|
|
49
|
+
* is the actual default this property needs. `markdown` (no value, or
|
|
50
|
+
* `="true"`) -> `true`; `markdown="false"` -> `false`; attribute entirely
|
|
51
|
+
* absent -> `undefined`.
|
|
52
|
+
*/
|
|
53
|
+
const optionalBooleanConverter = {
|
|
54
|
+
fromAttribute(value) {
|
|
55
|
+
if (value === null)
|
|
56
|
+
return undefined;
|
|
57
|
+
return value !== 'false';
|
|
58
|
+
},
|
|
59
|
+
toAttribute(value) {
|
|
60
|
+
if (value === undefined)
|
|
61
|
+
return null;
|
|
62
|
+
return value ? '' : 'false';
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* `<lyra-streaming-text>` — a token-coalescing incremental text renderer for
|
|
67
|
+
* streaming assistant output, with an optional blinking cursor and
|
|
68
|
+
* auto-detected Markdown rendering.
|
|
69
|
+
*
|
|
70
|
+
* The host is expected to assign the *entire* current text on every update
|
|
71
|
+
* to `content`, not a delta -- this component does no accumulation or
|
|
72
|
+
* ordering of its own. That matches how most streaming-UI state (SSE/
|
|
73
|
+
* WebSocket token accumulation into a growing string in application state)
|
|
74
|
+
* is already managed.
|
|
75
|
+
*
|
|
76
|
+
* Token-by-token streaming can update `content` far faster than a human can
|
|
77
|
+
* usefully perceive a re-render -- dozens of times a second for a fast
|
|
78
|
+
* model. Re-rendering on every single assignment thrashes layout for no
|
|
79
|
+
* visible benefit, so updates funnel through `Announcer`
|
|
80
|
+
* (`../../internal/announcer.js`), reused here purely as the generic
|
|
81
|
+
* "coalesce rapid calls, flush the latest" timing primitive its own class
|
|
82
|
+
* doc says other components should reuse -- with none of its usual
|
|
83
|
+
* DOM/ARIA plumbing (that's `<lyra-live-region>`'s job, not this
|
|
84
|
+
* component's). Within any `coalesce-ms` window, only the *last* `content`
|
|
85
|
+
* value assigned actually reaches the rendered DOM. Two cases always bypass
|
|
86
|
+
* the throttle and flush immediately instead of waiting out the window: the
|
|
87
|
+
* very first `content` assignment after mount (so an already-complete
|
|
88
|
+
* message never shows an artificial startup delay), and any transition of
|
|
89
|
+
* `streaming` between `true` and `false` in either direction (so the final
|
|
90
|
+
* chunk of a finished stream can never be left stranded mid-window, and a
|
|
91
|
+
* stream restarting on a reused element can never keep showing the
|
|
92
|
+
* previous stream's stale final content for the length of the window).
|
|
93
|
+
*
|
|
94
|
+
* `markdown` is a tri-state property, not a plain boolean: left unset (the
|
|
95
|
+
* default), it auto-detects via a lightweight regex heuristic (see
|
|
96
|
+
* `looksLikeMarkdown`) run against whatever text is currently displayed --
|
|
97
|
+
* good enough to route obviously-Markdown output through `<lyra-markdown>`
|
|
98
|
+
* without the host needing to know or declare it up front, at the cost of
|
|
99
|
+
* an occasional one-time mode flip if Markdown syntax only appears partway
|
|
100
|
+
* through a stream. Explicitly setting `markdown` to `true`/`false` always
|
|
101
|
+
* wins over the heuristic. Rendering itself is never reimplemented here:
|
|
102
|
+
* Markdown mode composes `<lyra-markdown>` (`../markdown/markdown.js`)
|
|
103
|
+
* directly, forwarding this component's own `streaming` through as that
|
|
104
|
+
* component's own forward-compatible `streaming` hint prop; plain-text mode
|
|
105
|
+
* renders into a `white-space: pre-wrap` span instead.
|
|
106
|
+
*
|
|
107
|
+
* The blinking cursor (shown only while `streaming` is `true`) degrades to
|
|
108
|
+
* a static, always-visible bar under `prefers-reduced-motion: reduce`
|
|
109
|
+
* rather than disabling the animation into an invisible frozen frame --
|
|
110
|
+
* the same pattern `<lyra-typing-indicator>`'s own `cursor` variant uses. In
|
|
111
|
+
* plain-text mode the cursor sits inline at the tail of the final
|
|
112
|
+
* character, since the text is one continuous inline flow; in Markdown
|
|
113
|
+
* mode it renders as its own trailing block below the rendered content
|
|
114
|
+
* instead of attempting to splice into whatever nested block Markdown
|
|
115
|
+
* happens to end with (a paragraph, a table cell, a list item, a fenced
|
|
116
|
+
* code block, …) -- genuinely interleaving into arbitrary rendered Markdown
|
|
117
|
+
* without reaching across `<lyra-markdown>`'s own shadow boundary isn't a
|
|
118
|
+
* tractable general solution, so this component doesn't attempt it.
|
|
119
|
+
*
|
|
120
|
+
* Purely presentational: no events, driven entirely by its properties. It
|
|
121
|
+
* also doesn't announce anything to assistive tech itself -- a host that
|
|
122
|
+
* needs streamed text announced already has `<lyra-live-region>` for that
|
|
123
|
+
* (composed, for example, inside `<lyra-chat-message>`).
|
|
124
|
+
*
|
|
125
|
+
* @customElement lyra-streaming-text
|
|
126
|
+
* @csspart base - The root container.
|
|
127
|
+
* @csspart cursor - The blinking (or, under reduced motion, static) cursor bar. Only rendered while `streaming` is `true`.
|
|
128
|
+
*/
|
|
129
|
+
export class LyraStreamingText extends LyraElement {
|
|
130
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
131
|
+
constructor() {
|
|
132
|
+
super();
|
|
133
|
+
/** The full current text so far -- always the complete string, never a
|
|
134
|
+
* delta to append. */
|
|
135
|
+
this.content = '';
|
|
136
|
+
/** Shows the blinking cursor after the rendered text. Reflects, so a host
|
|
137
|
+
* can also target `lyra-streaming-text[streaming]` in CSS. */
|
|
138
|
+
this.streaming = false;
|
|
139
|
+
/** Trailing-edge coalesce window, in ms, for `content` updates -- see the
|
|
140
|
+
* class doc. */
|
|
141
|
+
this.coalesceMs = DEFAULT_COALESCE_MS;
|
|
142
|
+
// The coalesced value actually rendered -- lags `content` by up to
|
|
143
|
+
// `coalesceMs` (or zero, for the immediate-flush cases documented above).
|
|
144
|
+
this.displayedContent = '';
|
|
145
|
+
this.lastScannedResult = false;
|
|
146
|
+
// Built in the constructor (not a class-field initializer) so it reads
|
|
147
|
+
// `this.coalesceMs` only after that property's own field initializer has
|
|
148
|
+
// already run and set the declared default -- same ordering rationale as
|
|
149
|
+
// lyra-live-region's identical constructor-built Announcer.
|
|
150
|
+
this.coalescer = new Announcer({
|
|
151
|
+
throttleMs: this.coalesceMs,
|
|
152
|
+
onFlush: (text) => {
|
|
153
|
+
this.displayedContent = text;
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
willUpdate(changed) {
|
|
158
|
+
if (changed.has('coalesceMs')) {
|
|
159
|
+
this.coalescer.throttleMs = this.coalesceMs;
|
|
160
|
+
}
|
|
161
|
+
if (changed.has('content')) {
|
|
162
|
+
// The very first content assignment after mount always flushes
|
|
163
|
+
// immediately -- an already-complete message (or the first chunk of a
|
|
164
|
+
// new one) shouldn't show an artificial startup delay just because a
|
|
165
|
+
// coalescing window technically applies to it.
|
|
166
|
+
this.coalescer.announce(this.content, { force: !this.hasUpdated });
|
|
167
|
+
}
|
|
168
|
+
// Neither a stream finishing nor a stream (re)starting on a reused
|
|
169
|
+
// element may leave stale content stranded inside an in-progress
|
|
170
|
+
// coalescing window -- force whatever `content` currently holds through
|
|
171
|
+
// immediately in both directions. Without the restart side of this, a
|
|
172
|
+
// reused element would keep showing the *previous* stream's final
|
|
173
|
+
// content for up to a full coalesce-ms window after a new stream had
|
|
174
|
+
// already begun. `changed.get('streaming')` is only defined for a real
|
|
175
|
+
// transition (never the initial mount value, per Lit's documented
|
|
176
|
+
// first-change semantics), so this can't misfire on connect.
|
|
177
|
+
if (changed.has('streaming') &&
|
|
178
|
+
changed.get('streaming') !== undefined &&
|
|
179
|
+
changed.get('streaming') !== this.streaming) {
|
|
180
|
+
this.coalescer.announce(this.content, { force: true });
|
|
181
|
+
}
|
|
182
|
+
if (changed.has('displayedContent') && this.displayedContent !== this.lastScannedContent) {
|
|
183
|
+
this.lastScannedContent = this.displayedContent;
|
|
184
|
+
this.lastScannedResult = looksLikeMarkdown(this.displayedContent);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
disconnectedCallback() {
|
|
188
|
+
super.disconnectedCallback();
|
|
189
|
+
this.coalescer.cancel();
|
|
190
|
+
}
|
|
191
|
+
/** Whether Markdown mode is actually in effect right now, resolving the
|
|
192
|
+
* tri-state `markdown` property against the memoized `looksLikeMarkdown`
|
|
193
|
+
* result for the currently-displayed content (see `lastScannedContent`/
|
|
194
|
+
* `lastScannedResult` above). */
|
|
195
|
+
get effectiveMarkdown() {
|
|
196
|
+
return this.markdown ?? this.lastScannedResult;
|
|
197
|
+
}
|
|
198
|
+
render() {
|
|
199
|
+
return html `
|
|
200
|
+
<div part="base">
|
|
201
|
+
${this.effectiveMarkdown
|
|
202
|
+
? html `<lyra-markdown .content=${this.displayedContent} .streaming=${this.streaming}></lyra-markdown>`
|
|
203
|
+
: html `<span class="plain">${this.displayedContent}</span>`}
|
|
204
|
+
${this.streaming ? html `<span part="cursor" aria-hidden="true"></span>` : nothing}
|
|
205
|
+
</div>
|
|
206
|
+
`;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
__decorate([
|
|
210
|
+
property()
|
|
211
|
+
], LyraStreamingText.prototype, "content", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
property({ type: Boolean, reflect: true })
|
|
214
|
+
], LyraStreamingText.prototype, "streaming", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
property({ type: Number, attribute: 'coalesce-ms' })
|
|
217
|
+
], LyraStreamingText.prototype, "coalesceMs", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
property({ attribute: 'markdown', converter: optionalBooleanConverter })
|
|
220
|
+
], LyraStreamingText.prototype, "markdown", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
state()
|
|
223
|
+
], LyraStreamingText.prototype, "displayedContent", void 0);
|
|
224
|
+
defineElement('streaming-text', LyraStreamingText);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
overflow-wrap: break-word;
|
|
6
|
+
/* Not derived from any --lyra-* token in tokens.styles.ts -- there's no
|
|
7
|
+
shared "inline cursor bar" token to resolve through, so this component
|
|
8
|
+
defines its own scoped custom properties, exactly the way
|
|
9
|
+
lyra-typing-indicator's --lyra-typing-cursor-width/-height do for its
|
|
10
|
+
own (near-identical) blinking cursor. */
|
|
11
|
+
--lyra-streaming-text-cursor-width: 0.125rem;
|
|
12
|
+
--lyra-streaming-text-cursor-height: 1em;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[part='base'] {
|
|
16
|
+
line-height: 1.6;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Plain-text path only (Markdown mode never renders this element) -- see
|
|
20
|
+
the class doc for why Markdown content can't share this same
|
|
21
|
+
white-space treatment. */
|
|
22
|
+
.plain {
|
|
23
|
+
white-space: pre-wrap;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* inline-block (not inline) so it participates in text layout on the same
|
|
27
|
+
line as the preceding content while still accepting a fixed block-size
|
|
28
|
+
for the bar -- in plain-text mode this sits at the visual tail of the
|
|
29
|
+
final wrapped line, immediately after the last character. */
|
|
30
|
+
[part='cursor'] {
|
|
31
|
+
display: inline-block;
|
|
32
|
+
vertical-align: text-bottom;
|
|
33
|
+
inline-size: var(--lyra-streaming-text-cursor-width);
|
|
34
|
+
block-size: var(--lyra-streaming-text-cursor-height);
|
|
35
|
+
margin-inline-start: var(--lyra-space-xs);
|
|
36
|
+
background: currentColor;
|
|
37
|
+
border-radius: var(--lyra-streaming-text-cursor-width);
|
|
38
|
+
animation: lyra-streaming-text-cursor-blink var(--lyra-transition-base) infinite;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Two adjacent keyframe stops (49% / 50%) either side of an instant flip,
|
|
42
|
+
same shape as lyra-typing-indicator's cursor variant, so the blink still
|
|
43
|
+
reads as a sharp on/off even under the token's own ease-out timing. */
|
|
44
|
+
@keyframes lyra-streaming-text-cursor-blink {
|
|
45
|
+
0%,
|
|
46
|
+
49% {
|
|
47
|
+
opacity: 1;
|
|
48
|
+
}
|
|
49
|
+
50%,
|
|
50
|
+
100% {
|
|
51
|
+
opacity: 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Degrades to a static, fully-visible bar -- never a frozen mid-blink
|
|
56
|
+
(invisible) frame. */
|
|
57
|
+
@media (prefers-reduced-motion: reduce) {
|
|
58
|
+
[part='cursor'] {
|
|
59
|
+
animation: none !important;
|
|
60
|
+
opacity: 1;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* `<lyra-switch>` — a boolean toggle-switch form control. Structurally the
|
|
5
|
+
* same idea as a checkbox (form-associated via `ElementInternals`, click and
|
|
6
|
+
* Space/Enter both toggle) but with switch semantics: `role="switch"` +
|
|
7
|
+
* `aria-checked` read to assistive tech as an on/off state rather than a
|
|
8
|
+
* checked/unchecked one, and there is no indeterminate state.
|
|
9
|
+
*
|
|
10
|
+
* `checked` is not a plain string, so this attaches `ElementInternals`
|
|
11
|
+
* directly and implements its own `updateValidity()` rather than using the
|
|
12
|
+
* `FormAssociated` mixin (that mixin's `value` accessor assumes a string —
|
|
13
|
+
* see `<lyra-combobox>` for the same direct-`ElementInternals` shape with a
|
|
14
|
+
* non-string value).
|
|
15
|
+
*
|
|
16
|
+
* @customElement lyra-switch
|
|
17
|
+
* @slot - Label text, rendered next to the track. Clicking it toggles the
|
|
18
|
+
* switch, the same as clicking a checkbox's associated `<label>`. If left
|
|
19
|
+
* empty, set `aria-label` on the host so the control still has an
|
|
20
|
+
* accessible name.
|
|
21
|
+
* @event lyra-change - The user toggled the switch (click or Space/Enter). `detail: { checked }`.
|
|
22
|
+
* @csspart base - The whole interactive control (`role="switch"`); wraps the track and label.
|
|
23
|
+
* @csspart track - The pill-shaped background.
|
|
24
|
+
* @csspart thumb - The circular knob that slides across the track.
|
|
25
|
+
* @csspart label - The wrapper around the default slot.
|
|
26
|
+
*/
|
|
27
|
+
export declare class LyraSwitch extends LyraElement {
|
|
28
|
+
static styles: import("lit").CSSResultGroup[];
|
|
29
|
+
static formAssociated: boolean;
|
|
30
|
+
static properties: {
|
|
31
|
+
checked: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
reflect: boolean;
|
|
34
|
+
noAccessor: boolean;
|
|
35
|
+
};
|
|
36
|
+
disabled: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
reflect: boolean;
|
|
39
|
+
noAccessor: boolean;
|
|
40
|
+
};
|
|
41
|
+
name: {
|
|
42
|
+
reflect: boolean;
|
|
43
|
+
noAccessor: boolean;
|
|
44
|
+
};
|
|
45
|
+
required: {
|
|
46
|
+
type: BooleanConstructor;
|
|
47
|
+
reflect: boolean;
|
|
48
|
+
noAccessor: boolean;
|
|
49
|
+
};
|
|
50
|
+
value: {
|
|
51
|
+
noAccessor: boolean;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
private hasLabelSlot;
|
|
55
|
+
private internals;
|
|
56
|
+
private validityController;
|
|
57
|
+
private _defaultChecked;
|
|
58
|
+
private _defaultCaptured;
|
|
59
|
+
private _fieldsetDisabled;
|
|
60
|
+
private _name;
|
|
61
|
+
private _checked;
|
|
62
|
+
private _disabled;
|
|
63
|
+
private _required;
|
|
64
|
+
private _value;
|
|
65
|
+
/** Whether the control is disabled explicitly or by an ancestor fieldset. */
|
|
66
|
+
get effectiveDisabled(): boolean;
|
|
67
|
+
get checked(): boolean;
|
|
68
|
+
set checked(next: boolean);
|
|
69
|
+
get disabled(): boolean;
|
|
70
|
+
set disabled(next: boolean);
|
|
71
|
+
/** The form submission key, reflected synchronously for native form APIs. */
|
|
72
|
+
get name(): string;
|
|
73
|
+
set name(next: string);
|
|
74
|
+
get required(): boolean;
|
|
75
|
+
set required(next: boolean);
|
|
76
|
+
get value(): string;
|
|
77
|
+
set value(next: string);
|
|
78
|
+
constructor();
|
|
79
|
+
get form(): HTMLFormElement | null;
|
|
80
|
+
get labels(): NodeList;
|
|
81
|
+
get validity(): ValidityState;
|
|
82
|
+
get validationMessage(): string;
|
|
83
|
+
get willValidate(): boolean;
|
|
84
|
+
connectedCallback(): void;
|
|
85
|
+
protected willUpdate(): void;
|
|
86
|
+
private updateValidity;
|
|
87
|
+
private syncFormState;
|
|
88
|
+
formResetCallback(): void;
|
|
89
|
+
formStateRestoreCallback(state: string | File | FormData | null, _mode?: 'restore' | 'autocomplete'): void;
|
|
90
|
+
formDisabledCallback(disabled: boolean): void;
|
|
91
|
+
checkValidity(): boolean;
|
|
92
|
+
reportValidity(): boolean;
|
|
93
|
+
private toggle;
|
|
94
|
+
private onClick;
|
|
95
|
+
private onKeyDown;
|
|
96
|
+
private onSlotChange;
|
|
97
|
+
render(): TemplateResult;
|
|
98
|
+
}
|
|
99
|
+
declare global {
|
|
100
|
+
interface HTMLElementTagNameMap {
|
|
101
|
+
'lyra-switch': LyraSwitch;
|
|
102
|
+
}
|
|
103
|
+
}
|