@aceshooting/lyra-ui 1.1.0 → 2.0.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 +12 -1
- package/custom-elements.json +21460 -8489
- package/dist/components/app-rail/app-rail.d.ts +171 -0
- package/dist/components/app-rail/app-rail.js +483 -0
- package/dist/components/app-rail/app-rail.styles.d.ts +1 -0
- package/dist/components/app-rail/app-rail.styles.js +125 -0
- package/dist/components/attachment-chip/attachment-chip.d.ts +114 -0
- package/dist/components/attachment-chip/attachment-chip.js +312 -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 +83 -0
- package/dist/components/attachment-trigger/attachment-trigger.js +258 -0
- package/dist/components/attachment-trigger/attachment-trigger.styles.d.ts +1 -0
- package/dist/components/attachment-trigger/attachment-trigger.styles.js +68 -0
- package/dist/components/chart/box-plot.js +11 -1
- 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 +12 -2
- package/dist/components/chart/chart.js +121 -14
- package/dist/components/chart/histogram-bin.d.ts +4 -1
- package/dist/components/chart/histogram-bin.js +24 -14
- package/dist/components/chart/lite-chart.d.ts +63 -0
- package/dist/components/chart/lite-chart.js +181 -23
- package/dist/components/chart/lite-chart.styles.js +9 -0
- package/dist/components/chat-composer/chat-composer.d.ts +92 -0
- package/dist/components/chat-composer/chat-composer.js +285 -0
- package/dist/components/chat-composer/chat-composer.styles.d.ts +1 -0
- package/dist/components/chat-composer/chat-composer.styles.js +135 -0
- package/dist/components/chat-message/chat-message.d.ts +113 -0
- package/dist/components/chat-message/chat-message.js +291 -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 +59 -0
- package/dist/components/checkbox/checkbox.js +230 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
- package/dist/components/checkbox/checkbox.styles.js +70 -0
- package/dist/components/chip/chip-group.d.ts +56 -0
- package/dist/components/chip/chip-group.js +124 -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 +115 -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 +300 -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 +89 -0
- package/dist/components/code-block/code-block.js +317 -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 +44 -0
- package/dist/components/code-block/code-loader.js +79 -0
- package/dist/components/combobox/combobox.d.ts +19 -1
- package/dist/components/combobox/combobox.js +84 -14
- 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 +150 -0
- package/dist/components/context-meter/context-meter.styles.d.ts +1 -0
- package/dist/components/context-meter/context-meter.styles.js +120 -0
- package/dist/components/conversation-item/conversation-item.d.ts +128 -0
- package/dist/components/conversation-item/conversation-item.js +322 -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/date-input.d.ts +24 -0
- package/dist/components/date-picker/date-input.js +134 -22
- package/dist/components/date-picker/date-picker.d.ts +7 -0
- package/dist/components/date-picker/date-picker.js +85 -16
- package/dist/components/dialog/confirm.d.ts +40 -0
- package/dist/components/dialog/confirm.js +79 -0
- package/dist/components/dialog/dialog.d.ts +85 -0
- package/dist/components/dialog/dialog.js +272 -0
- package/dist/components/dialog/dialog.styles.d.ts +1 -0
- package/dist/components/dialog/dialog.styles.js +52 -0
- package/dist/components/dock-panel/dock-panel.d.ts +134 -0
- package/dist/components/dock-panel/dock-panel.js +345 -0
- package/dist/components/dock-panel/dock-panel.styles.d.ts +1 -0
- package/dist/components/dock-panel/dock-panel.styles.js +145 -0
- package/dist/components/document-preview/document-preview.d.ts +135 -0
- package/dist/components/document-preview/document-preview.js +372 -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/export-button/csv.js +1 -1
- package/dist/components/export-button/export-button.js +2 -0
- package/dist/components/flag/flag.d.ts +42 -5
- package/dist/components/flag/flag.js +70 -3
- package/dist/components/gauge/gauge.js +19 -10
- package/dist/components/generation-status/generation-status.d.ts +109 -0
- package/dist/components/generation-status/generation-status.js +273 -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/heatmap/calendar-grid.d.ts +4 -1
- package/dist/components/heatmap/calendar-grid.js +25 -12
- package/dist/components/heatmap/heatmap-scale.d.ts +6 -0
- package/dist/components/heatmap/heatmap-scale.js +7 -1
- package/dist/components/heatmap/heatmap.d.ts +89 -3
- package/dist/components/heatmap/heatmap.js +158 -29
- package/dist/components/json-viewer/json-viewer.d.ts +53 -0
- package/dist/components/json-viewer/json-viewer.js +283 -0
- package/dist/components/json-viewer/json-viewer.styles.d.ts +1 -0
- package/dist/components/json-viewer/json-viewer.styles.js +176 -0
- package/dist/components/kbd/kbd.d.ts +77 -0
- package/dist/components/kbd/kbd.js +214 -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 +81 -0
- package/dist/components/live-region/live-region.js +153 -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 +8 -6
- package/dist/components/map/map.js +44 -8
- package/dist/components/markdown/markdown-loader.d.ts +34 -0
- package/dist/components/markdown/markdown-loader.js +43 -0
- package/dist/components/markdown/markdown.d.ts +81 -0
- package/dist/components/markdown/markdown.js +284 -0
- package/dist/components/markdown/markdown.styles.d.ts +1 -0
- package/dist/components/markdown/markdown.styles.js +82 -0
- package/dist/components/media-card/media-card.d.ts +122 -0
- package/dist/components/media-card/media-card.js +295 -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 +200 -0
- package/dist/components/mention-popover/mention-popover.js +475 -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 +62 -0
- package/dist/components/menu/menu-item.js +119 -0
- package/dist/components/menu/menu-item.styles.d.ts +1 -0
- package/dist/components/menu/menu-item.styles.js +67 -0
- package/dist/components/menu/menu.d.ts +143 -0
- package/dist/components/menu/menu.js +365 -0
- package/dist/components/menu/menu.styles.d.ts +1 -0
- package/dist/components/menu/menu.styles.js +66 -0
- package/dist/components/model-select/model-select.d.ts +125 -0
- package/dist/components/model-select/model-select.js +490 -0
- package/dist/components/model-select/model-select.styles.d.ts +1 -0
- package/dist/components/model-select/model-select.styles.js +189 -0
- package/dist/components/model-settings-panel/model-settings-panel.d.ts +69 -0
- package/dist/components/model-settings-panel/model-settings-panel.js +145 -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 +13 -1
- package/dist/components/playback/playback.js +47 -14
- package/dist/components/responsive-panel/responsive-panel.d.ts +150 -0
- package/dist/components/responsive-panel/responsive-panel.js +365 -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 +44 -0
- package/dist/components/result-card/result-card.js +83 -0
- package/dist/components/result-card/result-card.styles.d.ts +1 -0
- package/dist/components/result-card/result-card.styles.js +50 -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 +45 -1
- package/dist/components/select/select.js +114 -17
- package/dist/components/select/select.styles.js +26 -2
- package/dist/components/slider/slider.d.ts +89 -0
- package/dist/components/slider/slider.js +352 -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 +92 -0
- package/dist/components/source-card/source-card.js +148 -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 +122 -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 +27 -13
- package/dist/components/split/split.d.ts +93 -1
- package/dist/components/split/split.js +284 -15
- package/dist/components/split/split.styles.js +30 -0
- package/dist/components/stat/stat.d.ts +22 -1
- package/dist/components/stat/stat.js +49 -3
- package/dist/components/stat/stat.styles.js +20 -0
- package/dist/components/stream-status/stream-status.d.ts +110 -0
- package/dist/components/stream-status/stream-status.js +210 -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 +98 -0
- package/dist/components/streaming-text/streaming-text.js +209 -0
- package/dist/components/streaming-text/streaming-text.styles.d.ts +1 -0
- package/dist/components/streaming-text/streaming-text.styles.js +62 -0
- package/dist/components/switch/switch.d.ts +58 -0
- package/dist/components/switch/switch.js +179 -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 +73 -4
- package/dist/components/table/table.js +169 -20
- package/dist/components/table/table.styles.js +6 -1
- package/dist/components/tabs/tabs.d.ts +51 -0
- package/dist/components/tabs/tabs.js +190 -0
- package/dist/components/tabs/tabs.styles.d.ts +1 -0
- package/dist/components/tabs/tabs.styles.js +63 -0
- package/dist/components/thinking-panel/thinking-panel.d.ts +121 -0
- package/dist/components/thinking-panel/thinking-panel.js +235 -0
- package/dist/components/thinking-panel/thinking-panel.styles.d.ts +1 -0
- package/dist/components/thinking-panel/thinking-panel.styles.js +117 -0
- package/dist/components/toast/toast-item.d.ts +1 -0
- package/dist/components/toast/toast-item.js +31 -6
- package/dist/components/tool-approval-dialog/tool-approval-dialog.d.ts +130 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.js +403 -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 +89 -0
- package/dist/components/tool-call-chip/tool-call-chip.js +288 -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 +145 -0
- package/dist/components/tool-param-form/tool-param-form.js +366 -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 +102 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.js +393 -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 +81 -0
- package/dist/components/tool-result-view/registry.js +84 -0
- package/dist/components/tool-result-view/tool-result-view.d.ts +55 -0
- package/dist/components/tool-result-view/tool-result-view.js +138 -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 +439 -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 +182 -0
- package/dist/components/tree/tree-node.d.ts +11 -2
- package/dist/components/tree/tree-node.js +16 -6
- package/dist/components/tree/tree.d.ts +8 -2
- package/dist/components/tree/tree.js +18 -11
- package/dist/components/typing-indicator/typing-indicator.d.ts +60 -0
- package/dist/components/typing-indicator/typing-indicator.js +96 -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 +173 -0
- package/dist/components/virtual-list/virtual-list.js +461 -0
- package/dist/components/virtual-list/virtual-list.styles.d.ts +1 -0
- package/dist/components/virtual-list/virtual-list.styles.js +44 -0
- package/dist/components/widget/widget.d.ts +10 -0
- package/dist/components/widget/widget.js +24 -1
- package/dist/components/widget/widget.styles.js +9 -2
- package/dist/components/word-cloud/word-cloud-layout.js +14 -1
- package/dist/components/word-cloud/word-cloud.d.ts +6 -0
- package/dist/components/word-cloud/word-cloud.js +25 -14
- package/dist/components/word-cloud/word-cloud.styles.js +4 -2
- package/dist/internal/announcer.d.ts +57 -0
- package/dist/internal/announcer.js +71 -0
- package/dist/internal/form-associated.d.ts +1 -0
- package/dist/internal/form-associated.js +55 -11
- package/dist/internal/group-by-recency.d.ts +50 -0
- package/dist/internal/group-by-recency.js +80 -0
- package/dist/internal/rtl.d.ts +23 -0
- package/dist/internal/rtl.js +28 -0
- package/dist/internal/scroll-lock.d.ts +10 -5
- package/dist/internal/scroll-lock.js +30 -14
- package/dist/internal/tokens.styles.js +6 -0
- package/dist/lyra.d.ts +130 -31
- package/dist/lyra.js +94 -26
- package/llms-full.txt +3921 -32
- package/llms.txt +16 -1
- package/package.json +23 -5
- 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 -12
- package/dist/components/chart/lite-chart.stories.js +0 -98
- 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 -5
- package/dist/components/flag/flag.stories.js +0 -17
- 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 -22
- package/dist/components/heatmap/heatmap.stories.js +0 -154
- 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 -19
- package/dist/components/select/select.stories.js +0 -75
- 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 -8
- package/dist/components/stat/stat.stories.js +0 -64
- 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 -7
- package/dist/components/widget/widget.stories.js +0 -41
- 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,291 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, nothing, svg } from 'lit';
|
|
8
|
+
import { property, state, query } from 'lit/decorators.js';
|
|
9
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
|
+
import { defineElement } from '../../internal/prefix.js';
|
|
11
|
+
import { nextId } from '../../internal/a11y.js';
|
|
12
|
+
import { chevronIcon } from '../../internal/icons.js';
|
|
13
|
+
import '../live-region/live-region.js';
|
|
14
|
+
import { styles } from './chat-message.styles.js';
|
|
15
|
+
// Mirrors the shared icon set's viewBox/stroke conventions
|
|
16
|
+
// (internal/icons.ts's chevronIcon()/closeIcon()/etc.) without adding a
|
|
17
|
+
// retry glyph to that module -- it's off limits here -- so this one-off icon
|
|
18
|
+
// still reads as part of the same visual language as the rest of the
|
|
19
|
+
// library's inline icons. Same approach lyra-checkbox's own local
|
|
20
|
+
// checkmark/indeterminate glyphs take for the identical reason.
|
|
21
|
+
const ICON_VIEW_BOX = '0 0 24 24';
|
|
22
|
+
const ICON_STROKE_WIDTH = '1.75';
|
|
23
|
+
function retryIcon() {
|
|
24
|
+
return svg `
|
|
25
|
+
<svg
|
|
26
|
+
width="1em"
|
|
27
|
+
height="1em"
|
|
28
|
+
viewBox=${ICON_VIEW_BOX}
|
|
29
|
+
fill="none"
|
|
30
|
+
stroke="currentColor"
|
|
31
|
+
stroke-width=${ICON_STROKE_WIDTH}
|
|
32
|
+
stroke-linecap="round"
|
|
33
|
+
stroke-linejoin="round"
|
|
34
|
+
aria-hidden="true"
|
|
35
|
+
focusable="false"
|
|
36
|
+
><polyline points="1 4 1 10 7 10"></polyline><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"></path></svg>
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
/** `hour:minute` in the runtime's default locale -- the sensible baseline
|
|
40
|
+
* this library (with no i18n system of its own) can offer without
|
|
41
|
+
* hardcoding English strings; `formatTimestamp` overrides it. */
|
|
42
|
+
function defaultFormatTimestamp(date) {
|
|
43
|
+
return new Intl.DateTimeFormat(undefined, { hour: 'numeric', minute: '2-digit' }).format(date);
|
|
44
|
+
}
|
|
45
|
+
/** Visible (not just color-coded) text for every non-resting status --
|
|
46
|
+
* `'sent'` renders nothing here, it's the resting state. */
|
|
47
|
+
const STATUS_TEXT = {
|
|
48
|
+
sending: 'Sending…',
|
|
49
|
+
streaming: 'Responding…',
|
|
50
|
+
failed: 'Failed to send',
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* `<lyra-chat-message>` — a role-based message bubble *shell* for a chat/
|
|
54
|
+
* agent conversation surface. It renders none of the message content itself:
|
|
55
|
+
* the default slot carries whatever a consumer wants to display (plain
|
|
56
|
+
* text, a `<lyra-markdown>`, a custom template, anything at all) and this
|
|
57
|
+
* component only supplies the surrounding chrome — alignment/coloring by
|
|
58
|
+
* `role`, an avatar/badges header row, an optional collapse toggle, an
|
|
59
|
+
* attachments strip, and a status-aware footer (a live-updating status dot +
|
|
60
|
+
* text, the formatted `timestamp`, a built-in retry affordance for
|
|
61
|
+
* `status="failed"`, and an `actions` slot for everything else).
|
|
62
|
+
*
|
|
63
|
+
* No built-in copy button is rendered. Deciding what "the copyable text" of
|
|
64
|
+
* an arbitrary slotted message even means (plain text? the rendered
|
|
65
|
+
* markdown source? something else?) is exactly the kind of content
|
|
66
|
+
* interpretation this shell deliberately stays out of — slot a copy control
|
|
67
|
+
* into `actions` instead. Firing `lyra-copy` (`detail: { text }`) from that
|
|
68
|
+
* control keeps the event name consistent with `<lyra-json-viewer>`'s own
|
|
69
|
+
* copy affordance, for anything listening at the conversation-surface level.
|
|
70
|
+
*
|
|
71
|
+
* Accessibility of `status`: the current status is always available as
|
|
72
|
+
* plain visible text (`[part="status-text"]`), never color alone. A
|
|
73
|
+
* transition *to* `"failed"`, or *from* `"streaming"` to `"sent"` (a stream
|
|
74
|
+
* finishing), is additionally announced through an internal
|
|
75
|
+
* `<lyra-live-region>` (see that component's header for the throttled-
|
|
76
|
+
* announcement wiring this composes) so a screen-reader user who isn't
|
|
77
|
+
* currently focused on this message still learns about it. This differs
|
|
78
|
+
* from `<lyra-typing-indicator>`'s deliberately simpler `role="status"`
|
|
79
|
+
* approach — that component only ever has one thing to announce (its own
|
|
80
|
+
* mount); this one has a `status` that can flip between several values
|
|
81
|
+
* across a single element's lifetime, which is exactly the coalescing job
|
|
82
|
+
* `<lyra-live-region>` exists for.
|
|
83
|
+
*
|
|
84
|
+
* `role` is a message-author role (`user`/`assistant`/`system`, matching
|
|
85
|
+
* the vocabulary of every chat/completion API), *not* a WAI-ARIA role, so
|
|
86
|
+
* it reflects to a `data-role` attribute rather than the bare `role`
|
|
87
|
+
* attribute — `role="user"` would collide with `Element`'s own ARIA `role`
|
|
88
|
+
* accessor and is not a valid ARIA role token to begin with.
|
|
89
|
+
*
|
|
90
|
+
* @customElement lyra-chat-message
|
|
91
|
+
* @slot - The message body.
|
|
92
|
+
* @slot avatar - An avatar/icon for the message author.
|
|
93
|
+
* @slot badges - Small status/metric chips (e.g. token count, latency, model name) — entirely app-supplied; this component computes none of that itself.
|
|
94
|
+
* @slot actions - Action controls (e.g. copy, retry), rendered at the end of the footer.
|
|
95
|
+
* @slot attachments - File/image attachment chips, rendered below the message body.
|
|
96
|
+
* @event lyra-retry - Fired by the built-in retry button, only rendered when `status="failed"`.
|
|
97
|
+
* @event lyra-collapse-toggle - `detail: boolean` (the new `collapsed` state) — fired when the user activates the built-in collapse button.
|
|
98
|
+
* @csspart bubble - The message bubble root.
|
|
99
|
+
* @csspart header - The row above the message body — avatar, badges, and the collapse toggle. Hidden entirely when none of those have anything to show.
|
|
100
|
+
* @csspart avatar - The wrapper around the `avatar` slot.
|
|
101
|
+
* @csspart badges - The wrapper around the `badges` slot.
|
|
102
|
+
* @csspart collapse-button - The built-in collapse/expand toggle (only rendered when `collapsible`).
|
|
103
|
+
* @csspart body - The wrapper around the default slot (the message content). Hidden while `collapsed`.
|
|
104
|
+
* @csspart attachments - The wrapper around the `attachments` slot.
|
|
105
|
+
* @csspart footer - The row below the message body — status, timestamp, retry, and actions. Hidden entirely when none of those have anything to show.
|
|
106
|
+
* @csspart status-indicator - A small decorative (`aria-hidden`) dot reflecting `status`; absent while `status="sent"`.
|
|
107
|
+
* @csspart status-text - The visible text twin of `status-indicator` — carries the state in text, not just color.
|
|
108
|
+
* @csspart timestamp - The formatted `timestamp`, rendered in a `<time>` element.
|
|
109
|
+
* @csspart retry-button - The built-in retry button (only rendered when `status="failed"`).
|
|
110
|
+
* @csspart actions - The wrapper around the `actions` slot.
|
|
111
|
+
*/
|
|
112
|
+
export class LyraChatMessage extends LyraElement {
|
|
113
|
+
constructor() {
|
|
114
|
+
super(...arguments);
|
|
115
|
+
/** Who authored the message. Reflects to `data-role` — see the class doc. */
|
|
116
|
+
this.role = 'assistant';
|
|
117
|
+
/** Delivery/generation state. Drives the footer's status dot/text and, for
|
|
118
|
+
* `"failed"`, the bubble's danger treatment and the built-in retry button. */
|
|
119
|
+
this.status = 'sent';
|
|
120
|
+
/** Shows the built-in collapse/expand toggle in the header. */
|
|
121
|
+
this.collapsible = false;
|
|
122
|
+
/** Whether the message body is currently hidden. Effective whenever set,
|
|
123
|
+
* independent of `collapsible` — `collapsible` only controls whether the
|
|
124
|
+
* built-in toggle button is rendered, mirroring `lyra-widget`'s identical
|
|
125
|
+
* `collapsible`/`collapsed` pair. */
|
|
126
|
+
this.collapsed = false;
|
|
127
|
+
this.hasAvatarSlot = false;
|
|
128
|
+
this.hasBadgesSlot = false;
|
|
129
|
+
this.hasAttachmentsSlot = false;
|
|
130
|
+
this.hasActionsSlot = false;
|
|
131
|
+
this.bodyId = nextId('chat-message-body');
|
|
132
|
+
this.onAvatarSlotChange = (e) => {
|
|
133
|
+
this.hasAvatarSlot = e.target.assignedElements({ flatten: true }).length > 0;
|
|
134
|
+
};
|
|
135
|
+
this.onBadgesSlotChange = (e) => {
|
|
136
|
+
this.hasBadgesSlot = e.target.assignedElements({ flatten: true }).length > 0;
|
|
137
|
+
};
|
|
138
|
+
this.onAttachmentsSlotChange = (e) => {
|
|
139
|
+
this.hasAttachmentsSlot = e.target.assignedElements({ flatten: true }).length > 0;
|
|
140
|
+
};
|
|
141
|
+
this.onActionsSlotChange = (e) => {
|
|
142
|
+
this.hasActionsSlot = e.target.assignedElements({ flatten: true }).length > 0;
|
|
143
|
+
};
|
|
144
|
+
this.toggleCollapsed = () => {
|
|
145
|
+
this.collapsed = !this.collapsed;
|
|
146
|
+
this.emit('lyra-collapse-toggle', this.collapsed);
|
|
147
|
+
};
|
|
148
|
+
this.onRetryClick = () => {
|
|
149
|
+
this.emit('lyra-retry');
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
153
|
+
willUpdate() {
|
|
154
|
+
if (!this.hasUpdated) {
|
|
155
|
+
this.hasAvatarSlot = this.hasSlotted('avatar');
|
|
156
|
+
this.hasBadgesSlot = this.hasSlotted('badges');
|
|
157
|
+
this.hasAttachmentsSlot = this.hasSlotted('attachments');
|
|
158
|
+
this.hasActionsSlot = this.hasSlotted('actions');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// `changed.get('status')` is `undefined` on the very first update (Lit
|
|
162
|
+
// only records the *first* old value seen since the last completed
|
|
163
|
+
// update, and the constructor's own field-initializer assignment is that
|
|
164
|
+
// first change, from the truly-unset internal slot) -- so this naturally
|
|
165
|
+
// skips announcing whatever status a message happens to mount with, and
|
|
166
|
+
// only ever fires for a real, later transition.
|
|
167
|
+
updated(changed) {
|
|
168
|
+
if (changed.has('status')) {
|
|
169
|
+
this.announceStatusChange(changed.get('status'));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
hasSlotted(name) {
|
|
173
|
+
return Array.from(this.children).some((el) => el.getAttribute('slot') === name);
|
|
174
|
+
}
|
|
175
|
+
get normalizedTimestamp() {
|
|
176
|
+
if (this.timestamp === undefined)
|
|
177
|
+
return undefined;
|
|
178
|
+
const date = this.timestamp instanceof Date ? this.timestamp : new Date(this.timestamp);
|
|
179
|
+
return Number.isNaN(date.getTime()) ? undefined : date;
|
|
180
|
+
}
|
|
181
|
+
get statusText() {
|
|
182
|
+
return this.status === 'sent' ? undefined : STATUS_TEXT[this.status];
|
|
183
|
+
}
|
|
184
|
+
announceStatusChange(previous) {
|
|
185
|
+
if (previous === undefined || previous === this.status)
|
|
186
|
+
return;
|
|
187
|
+
const region = this.liveRegion;
|
|
188
|
+
if (!region)
|
|
189
|
+
return;
|
|
190
|
+
if (this.status === 'failed') {
|
|
191
|
+
region.mode = 'assertive';
|
|
192
|
+
region.announce('Message failed to send.', { force: true });
|
|
193
|
+
}
|
|
194
|
+
else if (previous === 'streaming' && this.status === 'sent') {
|
|
195
|
+
region.mode = 'polite';
|
|
196
|
+
region.announce('Message complete.', { force: true });
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
render() {
|
|
200
|
+
const ts = this.normalizedTimestamp;
|
|
201
|
+
const formatter = this.formatTimestamp ?? defaultFormatTimestamp;
|
|
202
|
+
const statusText = this.statusText;
|
|
203
|
+
const showHeader = this.hasAvatarSlot || this.hasBadgesSlot || this.collapsible;
|
|
204
|
+
// `statusText` is already truthy whenever `status === 'failed'`, so it
|
|
205
|
+
// alone covers that case here too.
|
|
206
|
+
const showFooter = Boolean(statusText) || Boolean(ts) || this.hasActionsSlot;
|
|
207
|
+
return html `
|
|
208
|
+
<div part="bubble">
|
|
209
|
+
<div part="header" ?hidden=${!showHeader}>
|
|
210
|
+
<span part="avatar" ?hidden=${!this.hasAvatarSlot}
|
|
211
|
+
><slot name="avatar" @slotchange=${this.onAvatarSlotChange}></slot
|
|
212
|
+
></span>
|
|
213
|
+
<span part="badges" ?hidden=${!this.hasBadgesSlot}
|
|
214
|
+
><slot name="badges" @slotchange=${this.onBadgesSlotChange}></slot
|
|
215
|
+
></span>
|
|
216
|
+
${this.collapsible
|
|
217
|
+
? html `<button
|
|
218
|
+
part="collapse-button"
|
|
219
|
+
type="button"
|
|
220
|
+
aria-expanded=${this.collapsed ? 'false' : 'true'}
|
|
221
|
+
aria-controls=${this.bodyId}
|
|
222
|
+
aria-label=${this.collapsed ? 'Expand message' : 'Collapse message'}
|
|
223
|
+
@click=${this.toggleCollapsed}
|
|
224
|
+
>
|
|
225
|
+
<span class="chevron" style=${`transform:rotate(${this.collapsed ? '0deg' : '90deg'})`}
|
|
226
|
+
>${chevronIcon()}</span
|
|
227
|
+
>
|
|
228
|
+
</button>`
|
|
229
|
+
: nothing}
|
|
230
|
+
</div>
|
|
231
|
+
<div part="body" id=${this.bodyId} ?hidden=${this.collapsed}>
|
|
232
|
+
<slot></slot>
|
|
233
|
+
</div>
|
|
234
|
+
<div part="attachments" ?hidden=${!this.hasAttachmentsSlot}>
|
|
235
|
+
<slot name="attachments" @slotchange=${this.onAttachmentsSlotChange}></slot>
|
|
236
|
+
</div>
|
|
237
|
+
<div part="footer" ?hidden=${!showFooter}>
|
|
238
|
+
${statusText
|
|
239
|
+
? html `<span part="status-indicator" aria-hidden="true"></span><span part="status-text"
|
|
240
|
+
>${statusText}</span
|
|
241
|
+
>`
|
|
242
|
+
: nothing}
|
|
243
|
+
${ts ? html `<time part="timestamp" datetime=${ts.toISOString()}>${formatter(ts)}</time>` : nothing}
|
|
244
|
+
${this.status === 'failed'
|
|
245
|
+
? html `<button part="retry-button" type="button" @click=${this.onRetryClick}>
|
|
246
|
+
${retryIcon()}<span>Retry</span>
|
|
247
|
+
</button>`
|
|
248
|
+
: nothing}
|
|
249
|
+
<span part="actions" ?hidden=${!this.hasActionsSlot}
|
|
250
|
+
><slot name="actions" @slotchange=${this.onActionsSlotChange}></slot
|
|
251
|
+
></span>
|
|
252
|
+
</div>
|
|
253
|
+
<lyra-live-region></lyra-live-region>
|
|
254
|
+
</div>
|
|
255
|
+
`;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
__decorate([
|
|
259
|
+
property({ reflect: true, attribute: 'data-role' })
|
|
260
|
+
], LyraChatMessage.prototype, "role", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
property({ reflect: true })
|
|
263
|
+
], LyraChatMessage.prototype, "status", void 0);
|
|
264
|
+
__decorate([
|
|
265
|
+
property({ attribute: false })
|
|
266
|
+
], LyraChatMessage.prototype, "timestamp", void 0);
|
|
267
|
+
__decorate([
|
|
268
|
+
property({ attribute: false })
|
|
269
|
+
], LyraChatMessage.prototype, "formatTimestamp", void 0);
|
|
270
|
+
__decorate([
|
|
271
|
+
property({ type: Boolean, reflect: true })
|
|
272
|
+
], LyraChatMessage.prototype, "collapsible", void 0);
|
|
273
|
+
__decorate([
|
|
274
|
+
property({ type: Boolean, reflect: true })
|
|
275
|
+
], LyraChatMessage.prototype, "collapsed", void 0);
|
|
276
|
+
__decorate([
|
|
277
|
+
state()
|
|
278
|
+
], LyraChatMessage.prototype, "hasAvatarSlot", void 0);
|
|
279
|
+
__decorate([
|
|
280
|
+
state()
|
|
281
|
+
], LyraChatMessage.prototype, "hasBadgesSlot", void 0);
|
|
282
|
+
__decorate([
|
|
283
|
+
state()
|
|
284
|
+
], LyraChatMessage.prototype, "hasAttachmentsSlot", void 0);
|
|
285
|
+
__decorate([
|
|
286
|
+
state()
|
|
287
|
+
], LyraChatMessage.prototype, "hasActionsSlot", void 0);
|
|
288
|
+
__decorate([
|
|
289
|
+
query('lyra-live-region')
|
|
290
|
+
], LyraChatMessage.prototype, "liveRegion", void 0);
|
|
291
|
+
defineElement('chat-message', LyraChatMessage);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
/* Component-specific -- no shared --wa-*/--lyra-* "conversation bubble
|
|
6
|
+
width" token exists to resolve through, same rationale as
|
|
7
|
+
--lyra-json-viewer-max-height in json-viewer.styles.ts. */
|
|
8
|
+
--lyra-chat-message-max-width: 80%;
|
|
9
|
+
font-size: 0.875rem;
|
|
10
|
+
line-height: 1.5;
|
|
11
|
+
}
|
|
12
|
+
[part='bubble'] {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: var(--lyra-space-xs);
|
|
16
|
+
max-inline-size: var(--lyra-chat-message-max-width);
|
|
17
|
+
padding: var(--lyra-space-m);
|
|
18
|
+
border: 1px solid var(--lyra-color-border);
|
|
19
|
+
border-radius: var(--lyra-radius);
|
|
20
|
+
background: var(--lyra-color-surface);
|
|
21
|
+
overflow-wrap: anywhere;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* -- role ---------------------------------------------------------------
|
|
25
|
+
The role property reflects to 'data-role' rather than the bare 'role'
|
|
26
|
+
attribute -- see the class doc for why -- so these selectors key off
|
|
27
|
+
'data-role'. */
|
|
28
|
+
:host([data-role='user']) [part='bubble'] {
|
|
29
|
+
margin-inline-start: auto;
|
|
30
|
+
background: var(--lyra-color-brand-quiet);
|
|
31
|
+
border-color: transparent;
|
|
32
|
+
}
|
|
33
|
+
:host([data-role='assistant']) [part='bubble'] {
|
|
34
|
+
margin-inline-end: auto;
|
|
35
|
+
}
|
|
36
|
+
:host([data-role='system']) [part='bubble'] {
|
|
37
|
+
margin-inline-end: auto;
|
|
38
|
+
color: var(--lyra-color-text-quiet);
|
|
39
|
+
font-style: italic;
|
|
40
|
+
border-style: dashed;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* -- status ---------------------------------------------------------------
|
|
44
|
+
'failed' gets an unmistakable treatment that does not rely on color
|
|
45
|
+
alone (see [part='status-text']); 'streaming' is a quieter accent plus
|
|
46
|
+
the pulsing dot below. */
|
|
47
|
+
:host([status='failed']) [part='bubble'] {
|
|
48
|
+
border-color: var(--lyra-color-danger);
|
|
49
|
+
background: var(--lyra-color-danger-quiet);
|
|
50
|
+
}
|
|
51
|
+
:host([status='streaming']) [part='bubble'] {
|
|
52
|
+
border-color: var(--lyra-color-brand);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[part='header'] {
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
gap: var(--lyra-space-xs);
|
|
59
|
+
}
|
|
60
|
+
[part='header'][hidden],
|
|
61
|
+
[part='avatar'][hidden],
|
|
62
|
+
[part='badges'][hidden],
|
|
63
|
+
[part='attachments'][hidden],
|
|
64
|
+
[part='footer'][hidden],
|
|
65
|
+
[part='actions'][hidden],
|
|
66
|
+
[part='body'][hidden] {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
[part='avatar'] {
|
|
70
|
+
flex: 0 0 auto;
|
|
71
|
+
display: inline-flex;
|
|
72
|
+
}
|
|
73
|
+
[part='badges'] {
|
|
74
|
+
flex: 1 1 auto;
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-wrap: wrap;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: var(--lyra-space-xs);
|
|
79
|
+
min-inline-size: 0;
|
|
80
|
+
}
|
|
81
|
+
[part='collapse-button'] {
|
|
82
|
+
flex: 0 0 auto;
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
min-inline-size: var(--lyra-icon-button-size);
|
|
87
|
+
min-block-size: var(--lyra-icon-button-size);
|
|
88
|
+
margin-inline-start: auto;
|
|
89
|
+
border: none;
|
|
90
|
+
background: transparent;
|
|
91
|
+
color: var(--lyra-color-text-quiet);
|
|
92
|
+
border-radius: var(--lyra-radius);
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
}
|
|
95
|
+
[part='collapse-button']:hover {
|
|
96
|
+
background: var(--lyra-color-brand-quiet);
|
|
97
|
+
color: var(--lyra-color-brand);
|
|
98
|
+
}
|
|
99
|
+
[part='collapse-button']:focus-visible,
|
|
100
|
+
[part='retry-button']:focus-visible {
|
|
101
|
+
outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
|
|
102
|
+
outline-offset: var(--lyra-focus-ring-offset);
|
|
103
|
+
}
|
|
104
|
+
[part='collapse-button'] .chevron {
|
|
105
|
+
display: inline-flex;
|
|
106
|
+
transition: transform var(--lyra-transition-fast);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[part='attachments'] {
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-wrap: wrap;
|
|
112
|
+
gap: var(--lyra-space-xs);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
[part='footer'] {
|
|
116
|
+
display: flex;
|
|
117
|
+
align-items: center;
|
|
118
|
+
gap: var(--lyra-space-xs);
|
|
119
|
+
font-size: 0.75rem;
|
|
120
|
+
color: var(--lyra-color-text-quiet);
|
|
121
|
+
}
|
|
122
|
+
[part='actions'] {
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: center;
|
|
125
|
+
gap: var(--lyra-space-xs);
|
|
126
|
+
margin-inline-start: auto;
|
|
127
|
+
}
|
|
128
|
+
[part='timestamp'] {
|
|
129
|
+
white-space: nowrap;
|
|
130
|
+
}
|
|
131
|
+
/* [part='timestamp']/[part='actions'] inherit the footer's own quiet
|
|
132
|
+
text color by default; against the danger-quiet bubble background a
|
|
133
|
+
'failed' message gets underneath it, that muted color's contrast ratio
|
|
134
|
+
drops below 4.5:1 (verified via axe's color-contrast rule), so the
|
|
135
|
+
whole footer switches to the same --lyra-color-danger already used for
|
|
136
|
+
[part='status-text'] instead. */
|
|
137
|
+
:host([status='failed']) [part='footer'] {
|
|
138
|
+
color: var(--lyra-color-danger);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
[part='status-indicator'] {
|
|
142
|
+
flex: 0 0 auto;
|
|
143
|
+
inline-size: 0.5rem;
|
|
144
|
+
block-size: 0.5rem;
|
|
145
|
+
border-radius: 50%;
|
|
146
|
+
background: var(--lyra-color-text-quiet);
|
|
147
|
+
}
|
|
148
|
+
:host([status='streaming']) [part='status-indicator'] {
|
|
149
|
+
background: var(--lyra-color-brand);
|
|
150
|
+
animation: lyra-chat-message-pulse 1.5s ease-in-out infinite;
|
|
151
|
+
}
|
|
152
|
+
:host([status='failed']) [part='status-indicator'] {
|
|
153
|
+
background: var(--lyra-color-danger);
|
|
154
|
+
}
|
|
155
|
+
[part='status-text'] {
|
|
156
|
+
white-space: nowrap;
|
|
157
|
+
}
|
|
158
|
+
:host([status='failed']) [part='status-text'] {
|
|
159
|
+
color: var(--lyra-color-danger);
|
|
160
|
+
font-weight: 600;
|
|
161
|
+
}
|
|
162
|
+
@keyframes lyra-chat-message-pulse {
|
|
163
|
+
0%,
|
|
164
|
+
100% {
|
|
165
|
+
opacity: 1;
|
|
166
|
+
}
|
|
167
|
+
50% {
|
|
168
|
+
opacity: 0.35;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
[part='retry-button'] {
|
|
173
|
+
flex: 0 0 auto;
|
|
174
|
+
display: inline-flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
gap: var(--lyra-space-xs);
|
|
177
|
+
padding: 0.125rem var(--lyra-space-xs);
|
|
178
|
+
border: 1px solid var(--lyra-color-danger);
|
|
179
|
+
border-radius: var(--lyra-radius);
|
|
180
|
+
background: transparent;
|
|
181
|
+
color: var(--lyra-color-danger);
|
|
182
|
+
font: inherit;
|
|
183
|
+
font-size: 0.75rem;
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
}
|
|
186
|
+
[part='retry-button']:hover {
|
|
187
|
+
background: var(--lyra-color-danger-quiet);
|
|
188
|
+
}
|
|
189
|
+
[part='retry-button'] svg {
|
|
190
|
+
inline-size: 0.875em;
|
|
191
|
+
block-size: 0.875em;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
@media (prefers-reduced-motion: reduce) {
|
|
195
|
+
[part='status-indicator'] {
|
|
196
|
+
animation: none !important;
|
|
197
|
+
opacity: 1;
|
|
198
|
+
}
|
|
199
|
+
[part='collapse-button'] .chevron {
|
|
200
|
+
transition: none !important;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
`;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* `<lyra-checkbox>` — a boolean form control. Structurally the same idea as
|
|
5
|
+
* `<lyra-switch>` (form-associated via `ElementInternals`, click and
|
|
6
|
+
* Space/Enter both toggle) but with checkbox semantics: `role="checkbox"` +
|
|
7
|
+
* an `aria-checked` that can also be `"mixed"`, and a visual box/checkmark
|
|
8
|
+
* instead of a track/thumb.
|
|
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 — see `<lyra-combobox>` for the same
|
|
13
|
+
* direct-`ElementInternals` shape with a non-string value.
|
|
14
|
+
*
|
|
15
|
+
* @customElement lyra-checkbox
|
|
16
|
+
* @slot - Label text, rendered next to the box. Clicking it toggles the
|
|
17
|
+
* checkbox, the same as clicking a native checkbox's associated `<label>`.
|
|
18
|
+
* If left empty, set `aria-label` on the host so the control still has an
|
|
19
|
+
* accessible name.
|
|
20
|
+
* @event lyra-change - The user toggled the checkbox (click or Space/Enter).
|
|
21
|
+
* `detail: { checked }`. Not fired for a programmatic `.checked` assignment.
|
|
22
|
+
* @csspart base - The whole interactive control (`role="checkbox"`); wraps the box and label.
|
|
23
|
+
* @csspart box - The small square that shows the checkmark/indeterminate dash.
|
|
24
|
+
* @csspart checkmark - The checkmark (or indeterminate dash) glyph inside the box.
|
|
25
|
+
* @csspart label - The wrapper around the default slot.
|
|
26
|
+
*/
|
|
27
|
+
export declare class LyraCheckbox extends LyraElement {
|
|
28
|
+
static styles: import("lit").CSSResultGroup[];
|
|
29
|
+
static formAssociated: boolean;
|
|
30
|
+
checked: boolean;
|
|
31
|
+
indeterminate: boolean;
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
required: boolean;
|
|
34
|
+
name: string;
|
|
35
|
+
value: string;
|
|
36
|
+
private hasLabelSlot;
|
|
37
|
+
private internals;
|
|
38
|
+
private _defaultChecked;
|
|
39
|
+
private _defaultCaptured;
|
|
40
|
+
constructor();
|
|
41
|
+
connectedCallback(): void;
|
|
42
|
+
protected willUpdate(): void;
|
|
43
|
+
private updateValidity;
|
|
44
|
+
protected updated(changed: PropertyValues): void;
|
|
45
|
+
formResetCallback(): void;
|
|
46
|
+
formDisabledCallback(disabled: boolean): void;
|
|
47
|
+
checkValidity(): boolean;
|
|
48
|
+
reportValidity(): boolean;
|
|
49
|
+
private toggle;
|
|
50
|
+
private onClick;
|
|
51
|
+
private onKeyDown;
|
|
52
|
+
private onSlotChange;
|
|
53
|
+
render(): TemplateResult;
|
|
54
|
+
}
|
|
55
|
+
declare global {
|
|
56
|
+
interface HTMLElementTagNameMap {
|
|
57
|
+
'lyra-checkbox': LyraCheckbox;
|
|
58
|
+
}
|
|
59
|
+
}
|