@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
|
@@ -8,6 +8,7 @@ import { html, svg } from 'lit';
|
|
|
8
8
|
import { property } from 'lit/decorators.js';
|
|
9
9
|
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
10
|
import { defineElement } from '../../internal/prefix.js';
|
|
11
|
+
import { finiteNumber } from '../../internal/numbers.js';
|
|
11
12
|
import { styles } from './gauge.styles.js';
|
|
12
13
|
// Radial gauge sweeps 270° (like a speedometer), leaving a 90° gap at the bottom.
|
|
13
14
|
const SWEEP_DEG = 270;
|
|
@@ -44,7 +45,11 @@ const RADIAL_ARC_LENGTH = (SWEEP_DEG / 360) * 2 * Math.PI * RADIUS;
|
|
|
44
45
|
* generic gauge widget exists in Web Awesome.
|
|
45
46
|
*
|
|
46
47
|
* @customElement lyra-gauge
|
|
47
|
-
* @csspart base
|
|
48
|
+
* @csspart base - The root `<svg>`.
|
|
49
|
+
* @csspart track - The background track arc/line.
|
|
50
|
+
* @csspart fill - The animated fill arc/line.
|
|
51
|
+
* @csspart value - The value text.
|
|
52
|
+
* @csspart label - The label text.
|
|
48
53
|
*/
|
|
49
54
|
export class LyraGauge extends LyraElement {
|
|
50
55
|
constructor() {
|
|
@@ -56,29 +61,52 @@ export class LyraGauge extends LyraElement {
|
|
|
56
61
|
this.label = '';
|
|
57
62
|
}
|
|
58
63
|
static { this.styles = [LyraElement.styles, styles]; }
|
|
64
|
+
// Normalizes a reversed min > max domain by swapping lo/hi, but only once
|
|
65
|
+
// both bounds are finite -- shared by `ratio` (fill geometry) and
|
|
66
|
+
// `willUpdate` (aria-value* trio) so the two can never silently diverge.
|
|
67
|
+
get domain() {
|
|
68
|
+
const min = finiteNumber(this.min, 0);
|
|
69
|
+
const max = finiteNumber(this.max, 100);
|
|
70
|
+
return { lo: Math.min(min, max), hi: Math.max(min, max) };
|
|
71
|
+
}
|
|
59
72
|
get ratio() {
|
|
60
|
-
if (
|
|
73
|
+
if (!Number.isFinite(this.value))
|
|
74
|
+
return 0;
|
|
75
|
+
const { lo, hi } = this.domain;
|
|
76
|
+
if (!Number.isFinite(lo) || !Number.isFinite(hi))
|
|
61
77
|
return 0;
|
|
62
|
-
const span =
|
|
63
|
-
return Math.min(1, Math.max(0, (this.value -
|
|
78
|
+
const span = hi - lo || 1;
|
|
79
|
+
return Math.min(1, Math.max(0, (this.value - lo) / span));
|
|
80
|
+
}
|
|
81
|
+
/** The text rendered/announced for the current value: `valueLabel` when set,
|
|
82
|
+
* else the numeric `value`, blanked (like the ARIA attributes and fill) when
|
|
83
|
+
* `value` is non-finite (NaN/undefined/Infinity/-Infinity). */
|
|
84
|
+
get displayText() {
|
|
85
|
+
return this.valueLabel || (!Number.isFinite(this.value) ? '' : String(this.value));
|
|
64
86
|
}
|
|
65
87
|
willUpdate() {
|
|
66
88
|
this.setAttribute('role', 'meter');
|
|
67
|
-
|
|
68
|
-
|
|
89
|
+
// Normalize a reversed min > max domain the same way `ratio` does, so the
|
|
90
|
+
// announced aria-value* trio always agrees with the visual fill instead
|
|
91
|
+
// of aria-valuenow pinning to one bound regardless of `value` (and
|
|
92
|
+
// aria-valuemin/valuemax reporting an inverted, invalid ARIA range).
|
|
93
|
+
const { lo, hi } = this.domain;
|
|
94
|
+
const finiteTrio = Number.isFinite(this.value) && Number.isFinite(lo) && Number.isFinite(hi);
|
|
95
|
+
if (finiteTrio) {
|
|
96
|
+
const clamped = Math.min(hi, Math.max(lo, this.value));
|
|
69
97
|
this.setAttribute('aria-valuenow', String(clamped));
|
|
70
98
|
}
|
|
71
99
|
else {
|
|
72
100
|
this.removeAttribute('aria-valuenow');
|
|
73
101
|
}
|
|
74
|
-
if (
|
|
102
|
+
if (Number.isFinite(lo))
|
|
103
|
+
this.setAttribute('aria-valuemin', String(lo));
|
|
104
|
+
else
|
|
75
105
|
this.removeAttribute('aria-valuemin');
|
|
106
|
+
if (Number.isFinite(hi))
|
|
107
|
+
this.setAttribute('aria-valuemax', String(hi));
|
|
76
108
|
else
|
|
77
|
-
this.setAttribute('aria-valuemin', String(this.min));
|
|
78
|
-
if (isNaN(this.max))
|
|
79
109
|
this.removeAttribute('aria-valuemax');
|
|
80
|
-
else
|
|
81
|
-
this.setAttribute('aria-valuemax', String(this.max));
|
|
82
110
|
if (this.label)
|
|
83
111
|
this.setAttribute('aria-label', this.label);
|
|
84
112
|
else
|
|
@@ -89,7 +117,7 @@ export class LyraGauge extends LyraElement {
|
|
|
89
117
|
this.removeAttribute('aria-valuetext');
|
|
90
118
|
}
|
|
91
119
|
renderRadial() {
|
|
92
|
-
const text = this.
|
|
120
|
+
const text = this.displayText;
|
|
93
121
|
// Dashoffset counts down from the full arc length (nothing revealed) to 0
|
|
94
122
|
// (whole sweep revealed) as ratio goes 0 -> 1 — the classic "draw an SVG
|
|
95
123
|
// path" technique, which transitions smoothly via plain CSS.
|
|
@@ -108,7 +136,7 @@ export class LyraGauge extends LyraElement {
|
|
|
108
136
|
</svg>`;
|
|
109
137
|
}
|
|
110
138
|
renderLinear() {
|
|
111
|
-
const text = this.
|
|
139
|
+
const text = this.displayText;
|
|
112
140
|
const dashoffset = LINEAR_LENGTH * (1 - this.ratio);
|
|
113
141
|
return html `<svg part="base" viewBox="0 0 100 20" preserveAspectRatio="none">
|
|
114
142
|
<line part="track" x1="0" y1=${LINEAR_BAR_Y} x2="100" y2=${LINEAR_BAR_Y} stroke-width=${LINEAR_STROKE}></line>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* `<lyra-generation-status>` — a compact, ticking status readout shown
|
|
5
|
+
* alongside an in-progress AI response: elapsed time, token count, and
|
|
6
|
+
* token-throughput, plus a built-in Stop button. Renders as e.g.
|
|
7
|
+
* `12.3s · 340 tokens · 27 tok/s [Stop]`.
|
|
8
|
+
*
|
|
9
|
+
* This is deliberately a *different* concern than the already-landed
|
|
10
|
+
* `<lyra-stream-status>`: that component is about transport/connection
|
|
11
|
+
* health (idle/connecting/streaming/stalled, heartbeat-aware stall
|
|
12
|
+
* detection), while this one is a user-facing metrics readout for a
|
|
13
|
+
* generation that both components' hosts typically already know is
|
|
14
|
+
* healthily in progress. Neither imports or depends on the other, and a
|
|
15
|
+
* consumer building a full generation UI is expected to compose both side by
|
|
16
|
+
* side rather than pick one.
|
|
17
|
+
*
|
|
18
|
+
* `active` drives an internal ~1s `setInterval` ticker that recomputes the
|
|
19
|
+
* elapsed-time display (a plain interval is sufficient here -- unlike
|
|
20
|
+
* `<lyra-stream-status>`'s stall timer, this never needs to be armed with a
|
|
21
|
+
* precise deadline, only to refresh a display roughly once a second). The
|
|
22
|
+
* elapsed clock's start instant is `started-at` when set (an epoch-ms
|
|
23
|
+
* timestamp -- lets a host that already knows exactly when generation began,
|
|
24
|
+
* e.g. from its own request-dispatch timestamp, feed that in directly and
|
|
25
|
+
* survive this component being created slightly later than that instant);
|
|
26
|
+
* when `started-at` is unset, this component falls back to capturing
|
|
27
|
+
* `Date.now()` itself at the moment `active` flips from `false`/unset to
|
|
28
|
+
* `true`, so the ticker still starts from a sensible instant with zero
|
|
29
|
+
* required host bookkeeping. The ticker is cleared whenever `active` becomes
|
|
30
|
+
* `false` and on disconnect; the display is left at whatever it last showed
|
|
31
|
+
* (frozen, not reset to zero) -- a static "Generated in 12.3s" reads better
|
|
32
|
+
* as a completed-state summary than the readout blanking out the instant
|
|
33
|
+
* generation ends.
|
|
34
|
+
*
|
|
35
|
+
* `tokens-per-second`, when the host supplies it directly (e.g. from its own
|
|
36
|
+
* smoothed/windowed rate calculation), is always used as-is. When omitted,
|
|
37
|
+
* this component derives a live figure itself from `token-count` divided by
|
|
38
|
+
* elapsed seconds -- but only once at least one full second of elapsed time
|
|
39
|
+
* has accumulated, since dividing by a sub-second elapsed window can produce
|
|
40
|
+
* wildly-swinging, misleading early readings (e.g. 3 tokens in 40ms reading
|
|
41
|
+
* as "75 tok/s"). A host that wants a stable figure from the very first tick
|
|
42
|
+
* should supply `tokens-per-second` itself. The tokens segment and the
|
|
43
|
+
* throughput segment are independently optional: either, both, or neither
|
|
44
|
+
* may render depending on what's available, per each property's own doc.
|
|
45
|
+
*
|
|
46
|
+
* Accessibility: this readout ticks roughly once per second while active,
|
|
47
|
+
* which is exactly the kind of high-frequency update
|
|
48
|
+
* `<lyra-live-region>`/`Announcer` (`../../internal/announcer.js`) exists to
|
|
49
|
+
* *prevent* from being read aloud verbatim -- routing a per-second numeric
|
|
50
|
+
* tick through even a throttled announcer would still narrate a new number
|
|
51
|
+
* to a screen-reader user roughly once every throttle window for as long as
|
|
52
|
+
* generation runs, which is noise, not information. This component
|
|
53
|
+
* therefore carries no `role="status"`/`aria-live` of its own and never
|
|
54
|
+
* announces anything; a host that wants generation-start/-end announced
|
|
55
|
+
* should pair this with something that announces state *transitions* (e.g.
|
|
56
|
+
* `<lyra-typing-indicator>`'s mount-time announcement), not this ticking
|
|
57
|
+
* readout. The one genuinely actionable, infrequent control here -- the Stop
|
|
58
|
+
* button -- gets a normal, always-present `aria-label`, no different from
|
|
59
|
+
* any other icon-only button in this library.
|
|
60
|
+
*
|
|
61
|
+
* @customElement lyra-generation-status
|
|
62
|
+
* @event lyra-stop - The built-in Stop button was clicked. No detail payload.
|
|
63
|
+
* @csspart base - The root inline layout container.
|
|
64
|
+
* @csspart elapsed - The elapsed-time segment, e.g. `"12.3s"`. Always rendered (reads `"0.0s"` before the component has ever been active).
|
|
65
|
+
* @csspart tokens - The token-count segment, e.g. `"340 tokens"`. Only rendered when `token-count` is set.
|
|
66
|
+
* @csspart throughput - The throughput segment, e.g. `"27 tok/s"`. Only rendered when a value is available (host-supplied or derived; see the class doc).
|
|
67
|
+
* @csspart stop-button - The built-in Stop button. Only rendered while `show-stop` is true.
|
|
68
|
+
*/
|
|
69
|
+
export declare class LyraGenerationStatus extends LyraElement {
|
|
70
|
+
static styles: import("lit").CSSResultGroup[];
|
|
71
|
+
/** Whether generation is currently in progress. The elapsed-time ticker
|
|
72
|
+
* runs only while this is `true` (see the class doc). */
|
|
73
|
+
active: boolean;
|
|
74
|
+
/** Epoch-ms timestamp of when generation began. Optional -- when unset (or
|
|
75
|
+
* when set to a value that fails to parse as a finite number, e.g. an
|
|
76
|
+
* ISO-8601 date string) while `active` is `true`, this component captures
|
|
77
|
+
* the current time itself the moment `active` becomes `true` and counts
|
|
78
|
+
* from there instead (see the class doc). */
|
|
79
|
+
startedAt?: number;
|
|
80
|
+
/** Running token count so far. Omitted from the readout entirely (no
|
|
81
|
+
* `tokens` segment) while unset. */
|
|
82
|
+
tokenCount?: number;
|
|
83
|
+
/** Host-computed tokens/sec figure, used as-is when set. When unset, this
|
|
84
|
+
* component derives a live figure from `token-count` and elapsed time
|
|
85
|
+
* itself once one is available -- see the class doc for the exact rule
|
|
86
|
+
* and why. */
|
|
87
|
+
tokensPerSecond?: number;
|
|
88
|
+
/** Whether the built-in Stop button renders at all. Defaults to `true`.
|
|
89
|
+
* Uses {@link showStopConverter} rather than Lit's default presence-based
|
|
90
|
+
* `type: Boolean` handling, so a plain-HTML consumer with no way to write
|
|
91
|
+
* a `.showStop` property binding can still turn this off with
|
|
92
|
+
* `show-stop="false"`; a Lit template can do the same with either that
|
|
93
|
+
* attribute string or a `.showStop=${false}` property binding. */
|
|
94
|
+
showStop: boolean;
|
|
95
|
+
private elapsedMs;
|
|
96
|
+
private tickTimer?;
|
|
97
|
+
private fallbackStartMs?;
|
|
98
|
+
connectedCallback(): void;
|
|
99
|
+
disconnectedCallback(): void;
|
|
100
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
101
|
+
protected updated(changed: PropertyValues): void;
|
|
102
|
+
private startTicker;
|
|
103
|
+
private stopTicker;
|
|
104
|
+
private get validStartedAt();
|
|
105
|
+
private computeElapsedMs;
|
|
106
|
+
/** `tokens-per-second` when set; otherwise a derived figure once enough
|
|
107
|
+
* elapsed time has accumulated for it to be meaningful; otherwise
|
|
108
|
+
* `undefined` (the throughput segment doesn't render at all). */
|
|
109
|
+
private get effectiveTokensPerSecond();
|
|
110
|
+
private onStopClick;
|
|
111
|
+
render(): TemplateResult;
|
|
112
|
+
}
|
|
113
|
+
declare global {
|
|
114
|
+
interface HTMLElementTagNameMap {
|
|
115
|
+
'lyra-generation-status': LyraGenerationStatus;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,327 @@
|
|
|
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 } from 'lit/decorators.js';
|
|
9
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
|
+
import { defineElement } from '../../internal/prefix.js';
|
|
11
|
+
import { styles } from './generation-status.styles.js';
|
|
12
|
+
// Mirrors the shared icon set's viewBox/stroke conventions
|
|
13
|
+
// (internal/icons.ts's chevronIcon()/closeIcon()/etc.) without adding a
|
|
14
|
+
// stop glyph to that module -- it's off limits here -- so this one-off icon
|
|
15
|
+
// still reads as part of the same visual language as the rest of the
|
|
16
|
+
// library's inline icons. Identical shape to `<lyra-chat-composer>`'s own
|
|
17
|
+
// local `stopIcon()` (the conventional filled-square "stop generating"
|
|
18
|
+
// glyph), duplicated rather than imported since these are two independently
|
|
19
|
+
// consumable components with no dependency between them.
|
|
20
|
+
function stopIcon() {
|
|
21
|
+
return svg `
|
|
22
|
+
<svg
|
|
23
|
+
width="1em"
|
|
24
|
+
height="1em"
|
|
25
|
+
viewBox="0 0 24 24"
|
|
26
|
+
fill="currentColor"
|
|
27
|
+
stroke="none"
|
|
28
|
+
aria-hidden="true"
|
|
29
|
+
focusable="false"
|
|
30
|
+
><rect x="6" y="6" width="12" height="12" rx="1.5"></rect></svg>
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
/** `4200` -> `"4.2s"`; `65000` -> `"1m 5s"`. Sub-minute durations get one
|
|
34
|
+
* decimal place of seconds (the common case: most single generations finish
|
|
35
|
+
* in single-digit seconds, where whole-second precision would look static
|
|
36
|
+
* between ticks); once a full minute is reached, `"Xm Ys"` reads better than
|
|
37
|
+
* a fractional-minute or a 3-4 digit seconds count. The `59.95` cutoff (not
|
|
38
|
+
* a plain `60`) exists so a value that *rounds* to `"60.0s"` at one-decimal
|
|
39
|
+
* precision is displayed as `"1m 0s"` instead -- without it, the two
|
|
40
|
+
* branches could each independently round the same instant to a different
|
|
41
|
+
* minute. */
|
|
42
|
+
function formatElapsed(ms) {
|
|
43
|
+
const totalSeconds = Math.max(0, ms) / 1000;
|
|
44
|
+
if (totalSeconds < 59.95) {
|
|
45
|
+
return `${(Math.round(totalSeconds * 10) / 10).toFixed(1)}s`;
|
|
46
|
+
}
|
|
47
|
+
const wholeSeconds = Math.round(totalSeconds);
|
|
48
|
+
const minutes = Math.floor(wholeSeconds / 60);
|
|
49
|
+
const seconds = wholeSeconds % 60;
|
|
50
|
+
return `${minutes}m ${seconds}s`;
|
|
51
|
+
}
|
|
52
|
+
/** `340` -> `"340 tokens"`; `1` -> `"1 token"`. Same plain singular/plural
|
|
53
|
+
* ternary `<lyra-json-viewer>`'s array/object summary already uses -- this
|
|
54
|
+
* library has no general i18n/pluralization system (see
|
|
55
|
+
* `<lyra-source-list>`'s class doc for that stance), but a two-way English
|
|
56
|
+
* ternary for one fixed noun is a different, much smaller thing than a
|
|
57
|
+
* general pluralization engine, and reads better than an unconditional
|
|
58
|
+
* "1 tokens". */
|
|
59
|
+
function formatTokenCount(count) {
|
|
60
|
+
const rounded = Math.max(0, Math.round(count));
|
|
61
|
+
return `${rounded} ${rounded === 1 ? 'token' : 'tokens'}`;
|
|
62
|
+
}
|
|
63
|
+
/** `27.4` -> `"27 tok/s"`; `3.2` -> `"3.2 tok/s"`. Same shape as this file's
|
|
64
|
+
* `formatElapsed`/`<lyra-tool-call-chip>`'s `formatDuration`: the low end of
|
|
65
|
+
* the range (where a whole-number rounding would flatten every early
|
|
66
|
+
* reading to the same "0" or "1") gets one decimal place, while anything at
|
|
67
|
+
* or above 10 tok/s rounds to a whole number, which is plenty precise for a
|
|
68
|
+
* live-updating throughput figure. */
|
|
69
|
+
function formatThroughput(value) {
|
|
70
|
+
const clamped = Math.max(0, value);
|
|
71
|
+
const rounded = clamped < 10 ? Math.round(clamped * 10) / 10 : Math.round(clamped);
|
|
72
|
+
return `${rounded} tok/s`;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* String-aware boolean attribute converter for `show-stop`. Lit's built-in
|
|
76
|
+
* `type: Boolean` converter is presence-based -- the attribute's mere
|
|
77
|
+
* presence (regardless of its string value) maps to `true`, so a plain-
|
|
78
|
+
* markup consumer writing the literal `show-stop="false"` would actually get
|
|
79
|
+
* the button *shown*, the opposite of what that string reads as (the same
|
|
80
|
+
* bug class `<lyra-streaming-text>`'s `optionalBooleanConverter` and
|
|
81
|
+
* `<lyra-line-chart>`'s `WithoutBeginAtZero` story both document). Unlike
|
|
82
|
+
* `<lyra-streaming-text>`'s tri-state converter, this property's default is
|
|
83
|
+
* `true`, not "unset" -- so this one only needs two states: attribute absent
|
|
84
|
+
* (or removed) -> `true` (the default); `show-stop="false"` -> `false`;
|
|
85
|
+
* anything else present (no value, `="true"`, ...) -> `true`.
|
|
86
|
+
*/
|
|
87
|
+
const showStopConverter = {
|
|
88
|
+
fromAttribute(value) {
|
|
89
|
+
return value !== 'false';
|
|
90
|
+
},
|
|
91
|
+
toAttribute(value) {
|
|
92
|
+
// `true` is this property's default, so there's nothing worth reflecting
|
|
93
|
+
// for it; only the non-default `false` needs an attribute at all.
|
|
94
|
+
return value ? null : 'false';
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* `<lyra-generation-status>` — a compact, ticking status readout shown
|
|
99
|
+
* alongside an in-progress AI response: elapsed time, token count, and
|
|
100
|
+
* token-throughput, plus a built-in Stop button. Renders as e.g.
|
|
101
|
+
* `12.3s · 340 tokens · 27 tok/s [Stop]`.
|
|
102
|
+
*
|
|
103
|
+
* This is deliberately a *different* concern than the already-landed
|
|
104
|
+
* `<lyra-stream-status>`: that component is about transport/connection
|
|
105
|
+
* health (idle/connecting/streaming/stalled, heartbeat-aware stall
|
|
106
|
+
* detection), while this one is a user-facing metrics readout for a
|
|
107
|
+
* generation that both components' hosts typically already know is
|
|
108
|
+
* healthily in progress. Neither imports or depends on the other, and a
|
|
109
|
+
* consumer building a full generation UI is expected to compose both side by
|
|
110
|
+
* side rather than pick one.
|
|
111
|
+
*
|
|
112
|
+
* `active` drives an internal ~1s `setInterval` ticker that recomputes the
|
|
113
|
+
* elapsed-time display (a plain interval is sufficient here -- unlike
|
|
114
|
+
* `<lyra-stream-status>`'s stall timer, this never needs to be armed with a
|
|
115
|
+
* precise deadline, only to refresh a display roughly once a second). The
|
|
116
|
+
* elapsed clock's start instant is `started-at` when set (an epoch-ms
|
|
117
|
+
* timestamp -- lets a host that already knows exactly when generation began,
|
|
118
|
+
* e.g. from its own request-dispatch timestamp, feed that in directly and
|
|
119
|
+
* survive this component being created slightly later than that instant);
|
|
120
|
+
* when `started-at` is unset, this component falls back to capturing
|
|
121
|
+
* `Date.now()` itself at the moment `active` flips from `false`/unset to
|
|
122
|
+
* `true`, so the ticker still starts from a sensible instant with zero
|
|
123
|
+
* required host bookkeeping. The ticker is cleared whenever `active` becomes
|
|
124
|
+
* `false` and on disconnect; the display is left at whatever it last showed
|
|
125
|
+
* (frozen, not reset to zero) -- a static "Generated in 12.3s" reads better
|
|
126
|
+
* as a completed-state summary than the readout blanking out the instant
|
|
127
|
+
* generation ends.
|
|
128
|
+
*
|
|
129
|
+
* `tokens-per-second`, when the host supplies it directly (e.g. from its own
|
|
130
|
+
* smoothed/windowed rate calculation), is always used as-is. When omitted,
|
|
131
|
+
* this component derives a live figure itself from `token-count` divided by
|
|
132
|
+
* elapsed seconds -- but only once at least one full second of elapsed time
|
|
133
|
+
* has accumulated, since dividing by a sub-second elapsed window can produce
|
|
134
|
+
* wildly-swinging, misleading early readings (e.g. 3 tokens in 40ms reading
|
|
135
|
+
* as "75 tok/s"). A host that wants a stable figure from the very first tick
|
|
136
|
+
* should supply `tokens-per-second` itself. The tokens segment and the
|
|
137
|
+
* throughput segment are independently optional: either, both, or neither
|
|
138
|
+
* may render depending on what's available, per each property's own doc.
|
|
139
|
+
*
|
|
140
|
+
* Accessibility: this readout ticks roughly once per second while active,
|
|
141
|
+
* which is exactly the kind of high-frequency update
|
|
142
|
+
* `<lyra-live-region>`/`Announcer` (`../../internal/announcer.js`) exists to
|
|
143
|
+
* *prevent* from being read aloud verbatim -- routing a per-second numeric
|
|
144
|
+
* tick through even a throttled announcer would still narrate a new number
|
|
145
|
+
* to a screen-reader user roughly once every throttle window for as long as
|
|
146
|
+
* generation runs, which is noise, not information. This component
|
|
147
|
+
* therefore carries no `role="status"`/`aria-live` of its own and never
|
|
148
|
+
* announces anything; a host that wants generation-start/-end announced
|
|
149
|
+
* should pair this with something that announces state *transitions* (e.g.
|
|
150
|
+
* `<lyra-typing-indicator>`'s mount-time announcement), not this ticking
|
|
151
|
+
* readout. The one genuinely actionable, infrequent control here -- the Stop
|
|
152
|
+
* button -- gets a normal, always-present `aria-label`, no different from
|
|
153
|
+
* any other icon-only button in this library.
|
|
154
|
+
*
|
|
155
|
+
* @customElement lyra-generation-status
|
|
156
|
+
* @event lyra-stop - The built-in Stop button was clicked. No detail payload.
|
|
157
|
+
* @csspart base - The root inline layout container.
|
|
158
|
+
* @csspart elapsed - The elapsed-time segment, e.g. `"12.3s"`. Always rendered (reads `"0.0s"` before the component has ever been active).
|
|
159
|
+
* @csspart tokens - The token-count segment, e.g. `"340 tokens"`. Only rendered when `token-count` is set.
|
|
160
|
+
* @csspart throughput - The throughput segment, e.g. `"27 tok/s"`. Only rendered when a value is available (host-supplied or derived; see the class doc).
|
|
161
|
+
* @csspart stop-button - The built-in Stop button. Only rendered while `show-stop` is true.
|
|
162
|
+
*/
|
|
163
|
+
export class LyraGenerationStatus extends LyraElement {
|
|
164
|
+
constructor() {
|
|
165
|
+
super(...arguments);
|
|
166
|
+
/** Whether generation is currently in progress. The elapsed-time ticker
|
|
167
|
+
* runs only while this is `true` (see the class doc). */
|
|
168
|
+
this.active = false;
|
|
169
|
+
/** Whether the built-in Stop button renders at all. Defaults to `true`.
|
|
170
|
+
* Uses {@link showStopConverter} rather than Lit's default presence-based
|
|
171
|
+
* `type: Boolean` handling, so a plain-HTML consumer with no way to write
|
|
172
|
+
* a `.showStop` property binding can still turn this off with
|
|
173
|
+
* `show-stop="false"`; a Lit template can do the same with either that
|
|
174
|
+
* attribute string or a `.showStop=${false}` property binding. */
|
|
175
|
+
this.showStop = true;
|
|
176
|
+
// Recomputed on activation and on every ~1s tick; frozen (not reset) once
|
|
177
|
+
// `active` goes false -- see the class doc's "ticker" paragraph.
|
|
178
|
+
this.elapsedMs = 0;
|
|
179
|
+
this.onStopClick = () => {
|
|
180
|
+
this.emit('lyra-stop');
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
184
|
+
// A re-parenting host (e.g. a virtualized/reordering list) disconnects and
|
|
185
|
+
// reconnects this element without ever toggling `active` -- `willUpdate`/
|
|
186
|
+
// `updated` only react to *changes* of `active`, so with no override here
|
|
187
|
+
// a still-active element would come back with `disconnectedCallback`'s
|
|
188
|
+
// cleared ticker never restarted, freezing the readout even though
|
|
189
|
+
// `active` (still `true`) says generation is ongoing. Restarting from
|
|
190
|
+
// `computeElapsedMs()` (rather than resuming a stale in-flight interval)
|
|
191
|
+
// matches how `startTicker()` already re-baselines on every fresh start.
|
|
192
|
+
connectedCallback() {
|
|
193
|
+
super.connectedCallback();
|
|
194
|
+
if (this.active) {
|
|
195
|
+
this.elapsedMs = this.computeElapsedMs();
|
|
196
|
+
this.startTicker();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
disconnectedCallback() {
|
|
200
|
+
super.disconnectedCallback();
|
|
201
|
+
this.stopTicker();
|
|
202
|
+
}
|
|
203
|
+
// Recomputing `elapsedMs` here (rather than in `updated()`) matters: Lit
|
|
204
|
+
// runs `willUpdate()` *before* render, as part of the same update pass, so
|
|
205
|
+
// a property set here is picked up by this same render with no extra
|
|
206
|
+
// cycle. Setting a reactive property from inside `updated()` instead would
|
|
207
|
+
// schedule a *second* update after the first has already completed (Lit
|
|
208
|
+
// warns about exactly this in dev mode) -- meaning a caller doing
|
|
209
|
+
// `el.active = true; await el.updateComplete;` would still observe the
|
|
210
|
+
// stale pre-activation `elapsedMs` once that first promise resolves.
|
|
211
|
+
//
|
|
212
|
+
// `changed.has('active')` fires on the very first update too when the
|
|
213
|
+
// element mounts already `active` (the parsed-attribute/property value
|
|
214
|
+
// differs from the `false` field-initializer default that was seen first)
|
|
215
|
+
// -- same mechanism `<lyra-stream-status>`'s `onPhaseChanged` relies on to
|
|
216
|
+
// arm its stall timer on a `phase="streaming"` mount, so mounting this
|
|
217
|
+
// component already active correctly seeds `elapsedMs` with no separate
|
|
218
|
+
// first-update special case needed.
|
|
219
|
+
willUpdate(changed) {
|
|
220
|
+
if (changed.has('active') && this.active) {
|
|
221
|
+
if (this.validStartedAt == null)
|
|
222
|
+
this.fallbackStartMs = Date.now();
|
|
223
|
+
this.elapsedMs = this.computeElapsedMs();
|
|
224
|
+
}
|
|
225
|
+
else if (this.active && changed.has('startedAt')) {
|
|
226
|
+
// A `started-at` that arrives (or changes) mid-generation should
|
|
227
|
+
// immediately re-baseline the displayed elapsed time rather than wait
|
|
228
|
+
// up to ~1s for the next tick.
|
|
229
|
+
this.elapsedMs = this.computeElapsedMs();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// Starting/stopping the interval is a genuine side effect (not a reactive-
|
|
233
|
+
// property write), so it belongs in `updated()`, unlike the `elapsedMs`
|
|
234
|
+
// computation above.
|
|
235
|
+
updated(changed) {
|
|
236
|
+
if (changed.has('active')) {
|
|
237
|
+
if (this.active)
|
|
238
|
+
this.startTicker();
|
|
239
|
+
else
|
|
240
|
+
this.stopTicker();
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
startTicker() {
|
|
244
|
+
this.stopTicker();
|
|
245
|
+
// Setting `elapsedMs` here (unlike inside `updated()`, see that method's
|
|
246
|
+
// doc) is fine: an interval callback is a wholly separate future task,
|
|
247
|
+
// not a continuation of an in-progress Lit update, so this starts a
|
|
248
|
+
// normal, self-contained update cycle rather than a same-tick "second
|
|
249
|
+
// update" scheduled mid-render.
|
|
250
|
+
this.tickTimer = setInterval(() => {
|
|
251
|
+
this.elapsedMs = this.computeElapsedMs();
|
|
252
|
+
}, 1000);
|
|
253
|
+
}
|
|
254
|
+
stopTicker() {
|
|
255
|
+
if (this.tickTimer !== undefined) {
|
|
256
|
+
clearInterval(this.tickTimer);
|
|
257
|
+
this.tickTimer = undefined;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
// `startedAt` is host-supplied and, unlike `tokenCount`/`tokensPerSecond`
|
|
261
|
+
// (both already guarded at their read sites), had no `Number.isFinite`
|
|
262
|
+
// check of its own -- a non-numeric `started-at` attribute (e.g. an
|
|
263
|
+
// ISO-8601 date string that failed the `type: Number` conversion, landing
|
|
264
|
+
// as `NaN`) would flow straight into `Date.now() - start`, permanently
|
|
265
|
+
// rendering the literal text "NaNm NaNs" with no fallback or recovery.
|
|
266
|
+
// Treating an invalid value the same as "unset" here restores this
|
|
267
|
+
// property's own documented fallback-clock behavior instead.
|
|
268
|
+
get validStartedAt() {
|
|
269
|
+
return this.startedAt != null && Number.isFinite(this.startedAt) ? this.startedAt : undefined;
|
|
270
|
+
}
|
|
271
|
+
computeElapsedMs() {
|
|
272
|
+
const start = this.validStartedAt ?? this.fallbackStartMs;
|
|
273
|
+
return start == null ? 0 : Math.max(0, Date.now() - start);
|
|
274
|
+
}
|
|
275
|
+
/** `tokens-per-second` when set; otherwise a derived figure once enough
|
|
276
|
+
* elapsed time has accumulated for it to be meaningful; otherwise
|
|
277
|
+
* `undefined` (the throughput segment doesn't render at all). */
|
|
278
|
+
get effectiveTokensPerSecond() {
|
|
279
|
+
if (this.tokensPerSecond != null && Number.isFinite(this.tokensPerSecond)) {
|
|
280
|
+
return this.tokensPerSecond;
|
|
281
|
+
}
|
|
282
|
+
if (this.tokenCount != null && Number.isFinite(this.tokenCount)) {
|
|
283
|
+
const elapsedSeconds = this.elapsedMs / 1000;
|
|
284
|
+
if (elapsedSeconds >= 1)
|
|
285
|
+
return this.tokenCount / elapsedSeconds;
|
|
286
|
+
}
|
|
287
|
+
return undefined;
|
|
288
|
+
}
|
|
289
|
+
render() {
|
|
290
|
+
const hasTokens = this.tokenCount != null && Number.isFinite(this.tokenCount);
|
|
291
|
+
const throughput = this.effectiveTokensPerSecond;
|
|
292
|
+
const hasThroughput = throughput !== undefined;
|
|
293
|
+
return html `
|
|
294
|
+
<div part="base">
|
|
295
|
+
<span part="elapsed">${formatElapsed(this.elapsedMs)}</span>
|
|
296
|
+
${hasTokens ? html `<span part="tokens">${formatTokenCount(this.tokenCount)}</span>` : nothing}
|
|
297
|
+
${hasThroughput ? html `<span part="throughput">${formatThroughput(throughput)}</span>` : nothing}
|
|
298
|
+
${this.showStop
|
|
299
|
+
? html `
|
|
300
|
+
<button part="stop-button" type="button" aria-label="Stop generating" @click=${this.onStopClick}>
|
|
301
|
+
${stopIcon()}
|
|
302
|
+
</button>
|
|
303
|
+
`
|
|
304
|
+
: nothing}
|
|
305
|
+
</div>
|
|
306
|
+
`;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
__decorate([
|
|
310
|
+
property({ type: Boolean, reflect: true })
|
|
311
|
+
], LyraGenerationStatus.prototype, "active", void 0);
|
|
312
|
+
__decorate([
|
|
313
|
+
property({ type: Number, attribute: 'started-at' })
|
|
314
|
+
], LyraGenerationStatus.prototype, "startedAt", void 0);
|
|
315
|
+
__decorate([
|
|
316
|
+
property({ type: Number, attribute: 'token-count' })
|
|
317
|
+
], LyraGenerationStatus.prototype, "tokenCount", void 0);
|
|
318
|
+
__decorate([
|
|
319
|
+
property({ type: Number, attribute: 'tokens-per-second' })
|
|
320
|
+
], LyraGenerationStatus.prototype, "tokensPerSecond", void 0);
|
|
321
|
+
__decorate([
|
|
322
|
+
property({ attribute: 'show-stop', converter: showStopConverter })
|
|
323
|
+
], LyraGenerationStatus.prototype, "showStop", void 0);
|
|
324
|
+
__decorate([
|
|
325
|
+
state()
|
|
326
|
+
], LyraGenerationStatus.prototype, "elapsedMs", void 0);
|
|
327
|
+
defineElement('generation-status', LyraGenerationStatus);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
vertical-align: middle;
|
|
6
|
+
max-inline-size: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
[part='base'] {
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
max-inline-size: 100%;
|
|
13
|
+
font-size: 0.8125rem;
|
|
14
|
+
line-height: 1.3;
|
|
15
|
+
color: var(--lyra-color-text-quiet);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
[part='elapsed'] {
|
|
19
|
+
/* Full-strength text, not the quieter --lyra-color-text-quiet the rest
|
|
20
|
+
of the readout uses -- elapsed time is the one figure this component
|
|
21
|
+
always shows (tokens/throughput are optional), so it gets the higher-
|
|
22
|
+
contrast treatment to read as the primary value at a glance. */
|
|
23
|
+
color: var(--lyra-color-text);
|
|
24
|
+
font-variant-numeric: tabular-nums;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
}
|
|
27
|
+
[part='tokens'],
|
|
28
|
+
[part='throughput'] {
|
|
29
|
+
font-variant-numeric: tabular-nums;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Segments are joined with a middot rather than a flex gap + separate
|
|
34
|
+
separator element, so a segment that doesn't render (tokens/throughput
|
|
35
|
+
are both optional, see the class doc) never leaves a dangling
|
|
36
|
+
double-gap -- the dot only ever appears immediately before a segment
|
|
37
|
+
that's actually present. */
|
|
38
|
+
[part='tokens']::before,
|
|
39
|
+
[part='throughput']::before {
|
|
40
|
+
content: '·';
|
|
41
|
+
margin-inline: 0.4em;
|
|
42
|
+
opacity: 0.6;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[part='stop-button'] {
|
|
46
|
+
flex: 0 0 auto;
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
/* Same "shrink the shared icon-button token for a compact inline
|
|
51
|
+
control" idiom as lyra-attachment-chip's retry-/remove-button. */
|
|
52
|
+
min-inline-size: min(var(--lyra-icon-button-size), 1.75rem);
|
|
53
|
+
min-block-size: min(var(--lyra-icon-button-size), 1.75rem);
|
|
54
|
+
margin-inline-start: var(--lyra-space-s);
|
|
55
|
+
padding: 0;
|
|
56
|
+
border: 1px solid var(--lyra-color-border);
|
|
57
|
+
border-radius: 50%;
|
|
58
|
+
background: var(--lyra-color-surface);
|
|
59
|
+
color: var(--lyra-color-text);
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
-webkit-tap-highlight-color: transparent;
|
|
62
|
+
transition:
|
|
63
|
+
background-color var(--lyra-transition-fast),
|
|
64
|
+
border-color var(--lyra-transition-fast),
|
|
65
|
+
color var(--lyra-transition-fast);
|
|
66
|
+
}
|
|
67
|
+
[part='stop-button']:hover {
|
|
68
|
+
border-color: var(--lyra-color-brand);
|
|
69
|
+
color: var(--lyra-color-brand);
|
|
70
|
+
}
|
|
71
|
+
[part='stop-button']:focus-visible {
|
|
72
|
+
outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
|
|
73
|
+
outline-offset: var(--lyra-focus-ring-offset);
|
|
74
|
+
}
|
|
75
|
+
[part='stop-button'] svg {
|
|
76
|
+
display: block;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@media (prefers-reduced-motion: reduce) {
|
|
80
|
+
[part='stop-button'] {
|
|
81
|
+
transition: none !important;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
`;
|