@aceshooting/lyra-ui 1.2.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 +11 -0
- package/custom-elements.json +23341 -11202
- 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 +1 -2
- package/dist/components/chart/chart.js +67 -12
- 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 +54 -0
- package/dist/components/chart/lite-chart.js +140 -22
- 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 +29 -13
- package/dist/components/flag/flag.js +39 -13
- 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 +74 -0
- package/dist/components/heatmap/heatmap.js +135 -23
- 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 +43 -2
- package/dist/components/select/select.js +150 -17
- 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 +6 -1
- package/dist/components/stat/stat.js +8 -2
- 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/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 +3 -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 +3836 -17
- 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 -14
- package/dist/components/chart/lite-chart.stories.js +0 -114
- package/dist/components/chart/pie-chart.stories.d.ts +0 -5
- package/dist/components/chart/pie-chart.stories.js +0 -26
- package/dist/components/chart/polar-area-chart.stories.d.ts +0 -5
- package/dist/components/chart/polar-area-chart.stories.js +0 -20
- package/dist/components/chart/radar-chart.stories.d.ts +0 -5
- package/dist/components/chart/radar-chart.stories.js +0 -20
- package/dist/components/chart/scatter-chart.stories.d.ts +0 -5
- package/dist/components/chart/scatter-chart.stories.js +0 -31
- package/dist/components/combobox/combobox.stories.d.ts +0 -24
- package/dist/components/combobox/combobox.stories.js +0 -102
- package/dist/components/date-picker/date-input.stories.d.ts +0 -10
- package/dist/components/date-picker/date-input.stories.js +0 -48
- package/dist/components/date-picker/date-picker.stories.d.ts +0 -10
- package/dist/components/date-picker/date-picker.stories.js +0 -25
- package/dist/components/empty/empty.stories.d.ts +0 -7
- package/dist/components/empty/empty.stories.js +0 -34
- package/dist/components/export-button/export-button.stories.d.ts +0 -7
- package/dist/components/export-button/export-button.stories.js +0 -37
- package/dist/components/file-input/file-input.stories.d.ts +0 -7
- package/dist/components/file-input/file-input.stories.js +0 -19
- package/dist/components/flag/flag.stories.d.ts +0 -6
- package/dist/components/flag/flag.stories.js +0 -31
- package/dist/components/gauge/gauge.stories.d.ts +0 -8
- package/dist/components/gauge/gauge.stories.js +0 -19
- package/dist/components/graph/graph.stories.d.ts +0 -8
- package/dist/components/graph/graph.stories.js +0 -68
- package/dist/components/heatmap/heatmap.stories.d.ts +0 -27
- package/dist/components/heatmap/heatmap.stories.js +0 -179
- package/dist/components/map/map.stories.d.ts +0 -15
- package/dist/components/map/map.stories.js +0 -135
- package/dist/components/playback/playback.stories.d.ts +0 -7
- package/dist/components/playback/playback.stories.js +0 -16
- package/dist/components/select/select.stories.d.ts +0 -21
- package/dist/components/select/select.stories.js +0 -91
- package/dist/components/skeleton/skeleton.stories.d.ts +0 -5
- package/dist/components/skeleton/skeleton.stories.js +0 -16
- package/dist/components/sparkline/sparkline.stories.d.ts +0 -11
- package/dist/components/sparkline/sparkline.stories.js +0 -39
- package/dist/components/split/split.stories.d.ts +0 -7
- package/dist/components/split/split.stories.js +0 -36
- package/dist/components/stat/stat.stories.d.ts +0 -9
- package/dist/components/stat/stat.stories.js +0 -81
- package/dist/components/table/table.stories.d.ts +0 -12
- package/dist/components/table/table.stories.js +0 -67
- package/dist/components/time-range/time-range.stories.d.ts +0 -8
- package/dist/components/time-range/time-range.stories.js +0 -26
- package/dist/components/toast/toast.stories.d.ts +0 -8
- package/dist/components/toast/toast.stories.js +0 -72
- package/dist/components/tree/tree.stories.d.ts +0 -9
- package/dist/components/tree/tree.stories.js +0 -52
- package/dist/components/widget/widget.stories.d.ts +0 -9
- package/dist/components/widget/widget.stories.js +0 -74
- package/dist/components/word-cloud/word-cloud.stories.d.ts +0 -10
- package/dist/components/word-cloud/word-cloud.stories.js +0 -55
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
import type { LyraModelCatalog } from '../model-select/model-select.js';
|
|
4
|
+
import '../model-select/model-select.js';
|
|
5
|
+
import '../slider/slider.js';
|
|
6
|
+
export type ModelSettingsPanelLayout = 'vertical' | 'compact';
|
|
7
|
+
/** The full current settings shape, re-emitted on every `lyra-change`
|
|
8
|
+
* regardless of which child control actually triggered it. */
|
|
9
|
+
export interface ModelSettingsChangeDetail {
|
|
10
|
+
modelValue: string;
|
|
11
|
+
inCatalog: boolean;
|
|
12
|
+
temperature: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* `<lyra-model-settings-panel>` — a fixed composition of `<lyra-model-select>`
|
|
16
|
+
* and `<lyra-slider>` into one agent-configuration card: pick a provider's
|
|
17
|
+
* model, then tune its sampling temperature. Not a generic layout shell (no
|
|
18
|
+
* slots) — it exists so a consumer doesn't have to re-wire the same two
|
|
19
|
+
* child `lyra-change` events into one combined settings object by hand every
|
|
20
|
+
* time this pairing comes up.
|
|
21
|
+
*
|
|
22
|
+
* Every prop here is a plain pass-through to (or mirror of) the matching
|
|
23
|
+
* child control's own prop of the same/similar name; see the child
|
|
24
|
+
* components themselves for the exact semantics of `catalog`/`allowCustom`
|
|
25
|
+
* and `temperatureMin`/`temperatureMax`/`temperatureStep`.
|
|
26
|
+
*
|
|
27
|
+
* @customElement lyra-model-settings-panel
|
|
28
|
+
* @event lyra-change - Either child control changed. `detail: { modelValue: string; inCatalog: boolean; temperature: number }` — always the full current settings, not just whatever changed.
|
|
29
|
+
* @csspart base - The outermost wrapping container.
|
|
30
|
+
* @csspart model-row - The row wrapping the internal `lyra-model-select`.
|
|
31
|
+
* @csspart temperature-row - The row wrapping the temperature label/slider/value.
|
|
32
|
+
* @csspart temperature-label - The visible "Temperature" caption.
|
|
33
|
+
* @csspart temperature-value - The visible current temperature readout.
|
|
34
|
+
*/
|
|
35
|
+
export declare class LyraModelSettingsPanel extends LyraElement {
|
|
36
|
+
static styles: import("lit").CSSResultGroup[];
|
|
37
|
+
/** Informational provider badge, passed straight through to the internal `lyra-model-select`. */
|
|
38
|
+
provider: string;
|
|
39
|
+
/** The model list, passed straight through to the internal `lyra-model-select`. */
|
|
40
|
+
catalog?: LyraModelCatalog;
|
|
41
|
+
/** The current model id. */
|
|
42
|
+
modelValue: string;
|
|
43
|
+
/** Let the model control accept a value outside `catalog`; passed straight through. */
|
|
44
|
+
allowCustom: boolean;
|
|
45
|
+
/** The current sampling temperature. */
|
|
46
|
+
temperature: number;
|
|
47
|
+
temperatureMin: number;
|
|
48
|
+
temperatureMax: number;
|
|
49
|
+
temperatureStep: number;
|
|
50
|
+
/** `vertical` stacks full-width rows with visible labels; `compact` runs
|
|
51
|
+
* the same two rows side by side with a smaller temperature caption, for
|
|
52
|
+
* toolbars/sidebars where the vertical layout's height doesn't fit. */
|
|
53
|
+
layout: ModelSettingsPanelLayout;
|
|
54
|
+
/** Whether `modelValue` is present in `catalog` — recomputed fresh from
|
|
55
|
+
* scratch (like `lyra-model-select`'s own `effectiveEntries`) rather than
|
|
56
|
+
* cached from the last child event, so it's still correct when
|
|
57
|
+
* `modelValue` was assigned directly instead of via the child's own
|
|
58
|
+
* `lyra-change`. */
|
|
59
|
+
private get inCatalog();
|
|
60
|
+
private emitChange;
|
|
61
|
+
private onModelChange;
|
|
62
|
+
private onTemperatureChange;
|
|
63
|
+
render(): TemplateResult;
|
|
64
|
+
}
|
|
65
|
+
declare global {
|
|
66
|
+
interface HTMLElementTagNameMap {
|
|
67
|
+
'lyra-model-settings-panel': LyraModelSettingsPanel;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
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 } from 'lit';
|
|
8
|
+
import { property } from 'lit/decorators.js';
|
|
9
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
|
+
import { defineElement } from '../../internal/prefix.js';
|
|
11
|
+
import { styles } from './model-settings-panel.styles.js';
|
|
12
|
+
import '../model-select/model-select.js';
|
|
13
|
+
import '../slider/slider.js';
|
|
14
|
+
const DEFAULT_TEMPERATURE_MIN = 0;
|
|
15
|
+
const DEFAULT_TEMPERATURE_MAX = 2;
|
|
16
|
+
const DEFAULT_TEMPERATURE_STEP = 0.1;
|
|
17
|
+
// Midpoint of the default [0, 2] range -- a reasonable provider-agnostic
|
|
18
|
+
// starting point. Reassign `temperature` yourself if your provider's own
|
|
19
|
+
// default differs (OpenAI and Anthropic both default to 1, which this matches).
|
|
20
|
+
const DEFAULT_TEMPERATURE = 1;
|
|
21
|
+
/**
|
|
22
|
+
* `<lyra-model-settings-panel>` — a fixed composition of `<lyra-model-select>`
|
|
23
|
+
* and `<lyra-slider>` into one agent-configuration card: pick a provider's
|
|
24
|
+
* model, then tune its sampling temperature. Not a generic layout shell (no
|
|
25
|
+
* slots) — it exists so a consumer doesn't have to re-wire the same two
|
|
26
|
+
* child `lyra-change` events into one combined settings object by hand every
|
|
27
|
+
* time this pairing comes up.
|
|
28
|
+
*
|
|
29
|
+
* Every prop here is a plain pass-through to (or mirror of) the matching
|
|
30
|
+
* child control's own prop of the same/similar name; see the child
|
|
31
|
+
* components themselves for the exact semantics of `catalog`/`allowCustom`
|
|
32
|
+
* and `temperatureMin`/`temperatureMax`/`temperatureStep`.
|
|
33
|
+
*
|
|
34
|
+
* @customElement lyra-model-settings-panel
|
|
35
|
+
* @event lyra-change - Either child control changed. `detail: { modelValue: string; inCatalog: boolean; temperature: number }` — always the full current settings, not just whatever changed.
|
|
36
|
+
* @csspart base - The outermost wrapping container.
|
|
37
|
+
* @csspart model-row - The row wrapping the internal `lyra-model-select`.
|
|
38
|
+
* @csspart temperature-row - The row wrapping the temperature label/slider/value.
|
|
39
|
+
* @csspart temperature-label - The visible "Temperature" caption.
|
|
40
|
+
* @csspart temperature-value - The visible current temperature readout.
|
|
41
|
+
*/
|
|
42
|
+
export class LyraModelSettingsPanel extends LyraElement {
|
|
43
|
+
constructor() {
|
|
44
|
+
super(...arguments);
|
|
45
|
+
/** Informational provider badge, passed straight through to the internal `lyra-model-select`. */
|
|
46
|
+
this.provider = '';
|
|
47
|
+
/** The current model id. */
|
|
48
|
+
this.modelValue = '';
|
|
49
|
+
/** Let the model control accept a value outside `catalog`; passed straight through. */
|
|
50
|
+
this.allowCustom = false;
|
|
51
|
+
/** The current sampling temperature. */
|
|
52
|
+
this.temperature = DEFAULT_TEMPERATURE;
|
|
53
|
+
this.temperatureMin = DEFAULT_TEMPERATURE_MIN;
|
|
54
|
+
this.temperatureMax = DEFAULT_TEMPERATURE_MAX;
|
|
55
|
+
this.temperatureStep = DEFAULT_TEMPERATURE_STEP;
|
|
56
|
+
/** `vertical` stacks full-width rows with visible labels; `compact` runs
|
|
57
|
+
* the same two rows side by side with a smaller temperature caption, for
|
|
58
|
+
* toolbars/sidebars where the vertical layout's height doesn't fit. */
|
|
59
|
+
this.layout = 'vertical';
|
|
60
|
+
this.onModelChange = (e) => {
|
|
61
|
+
this.modelValue = e.detail.value;
|
|
62
|
+
this.emitChange();
|
|
63
|
+
};
|
|
64
|
+
this.onTemperatureChange = (e) => {
|
|
65
|
+
this.temperature = e.detail.value;
|
|
66
|
+
this.emitChange();
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
70
|
+
/** Whether `modelValue` is present in `catalog` — recomputed fresh from
|
|
71
|
+
* scratch (like `lyra-model-select`'s own `effectiveEntries`) rather than
|
|
72
|
+
* cached from the last child event, so it's still correct when
|
|
73
|
+
* `modelValue` was assigned directly instead of via the child's own
|
|
74
|
+
* `lyra-change`. */
|
|
75
|
+
get inCatalog() {
|
|
76
|
+
const catalog = this.catalog;
|
|
77
|
+
if (!catalog || catalog.length === 0)
|
|
78
|
+
return false;
|
|
79
|
+
return catalog.some((entry) => (typeof entry === 'string' ? entry === this.modelValue : entry.id === this.modelValue));
|
|
80
|
+
}
|
|
81
|
+
emitChange() {
|
|
82
|
+
this.emit('lyra-change', {
|
|
83
|
+
modelValue: this.modelValue,
|
|
84
|
+
inCatalog: this.inCatalog,
|
|
85
|
+
temperature: this.temperature,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
render() {
|
|
89
|
+
return html `
|
|
90
|
+
<div part="base">
|
|
91
|
+
<div part="model-row">
|
|
92
|
+
<lyra-model-select
|
|
93
|
+
.provider=${this.provider}
|
|
94
|
+
.catalog=${this.catalog}
|
|
95
|
+
.value=${this.modelValue}
|
|
96
|
+
.allowCustom=${this.allowCustom}
|
|
97
|
+
placeholder="Select a model…"
|
|
98
|
+
@lyra-change=${this.onModelChange}
|
|
99
|
+
></lyra-model-select>
|
|
100
|
+
</div>
|
|
101
|
+
<div part="temperature-row">
|
|
102
|
+
<span part="temperature-label">Temperature</span>
|
|
103
|
+
<lyra-slider
|
|
104
|
+
.label=${'Temperature'}
|
|
105
|
+
.min=${this.temperatureMin}
|
|
106
|
+
.max=${this.temperatureMax}
|
|
107
|
+
.step=${this.temperatureStep}
|
|
108
|
+
.valueAsNumber=${this.temperature}
|
|
109
|
+
.showValue=${false}
|
|
110
|
+
@lyra-change=${this.onTemperatureChange}
|
|
111
|
+
></lyra-slider>
|
|
112
|
+
<span part="temperature-value">${this.temperature}</span>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
`;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
__decorate([
|
|
119
|
+
property()
|
|
120
|
+
], LyraModelSettingsPanel.prototype, "provider", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
property({ attribute: false })
|
|
123
|
+
], LyraModelSettingsPanel.prototype, "catalog", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
property({ attribute: 'model-value' })
|
|
126
|
+
], LyraModelSettingsPanel.prototype, "modelValue", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
property({ type: Boolean, attribute: 'allow-custom' })
|
|
129
|
+
], LyraModelSettingsPanel.prototype, "allowCustom", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
property({ type: Number })
|
|
132
|
+
], LyraModelSettingsPanel.prototype, "temperature", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
property({ type: Number, attribute: 'temperature-min' })
|
|
135
|
+
], LyraModelSettingsPanel.prototype, "temperatureMin", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
property({ type: Number, attribute: 'temperature-max' })
|
|
138
|
+
], LyraModelSettingsPanel.prototype, "temperatureMax", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
property({ type: Number, attribute: 'temperature-step' })
|
|
141
|
+
], LyraModelSettingsPanel.prototype, "temperatureStep", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
property({ reflect: true })
|
|
144
|
+
], LyraModelSettingsPanel.prototype, "layout", void 0);
|
|
145
|
+
defineElement('model-settings-panel', LyraModelSettingsPanel);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
inline-size: 100%;
|
|
6
|
+
max-inline-size: 28rem;
|
|
7
|
+
}
|
|
8
|
+
[part='base'] {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: var(--lyra-space-l);
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
padding: var(--lyra-space-l);
|
|
14
|
+
border: 1px solid var(--lyra-color-border);
|
|
15
|
+
border-radius: var(--lyra-radius);
|
|
16
|
+
background: var(--lyra-color-surface);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
[part='model-row'] {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: var(--lyra-space-xs);
|
|
23
|
+
min-inline-size: 0;
|
|
24
|
+
}
|
|
25
|
+
/* The nested control's own max-inline-size (24rem, sized for a standalone
|
|
26
|
+
dropdown) would otherwise clip a full-width row inside this card. */
|
|
27
|
+
[part='model-row'] lyra-model-select {
|
|
28
|
+
inline-size: 100%;
|
|
29
|
+
max-inline-size: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[part='temperature-row'] {
|
|
33
|
+
display: grid;
|
|
34
|
+
grid-template-columns: auto 1fr auto;
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: var(--lyra-space-s);
|
|
37
|
+
min-inline-size: 0;
|
|
38
|
+
}
|
|
39
|
+
[part='temperature-row'] lyra-slider {
|
|
40
|
+
min-inline-size: 0;
|
|
41
|
+
}
|
|
42
|
+
[part='temperature-label'] {
|
|
43
|
+
font-size: 0.8125rem;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
color: var(--lyra-color-text);
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
}
|
|
48
|
+
[part='temperature-value'] {
|
|
49
|
+
font-size: 0.8125rem;
|
|
50
|
+
color: var(--lyra-color-text-quiet);
|
|
51
|
+
font-variant-numeric: tabular-nums;
|
|
52
|
+
min-inline-size: 2.5ch;
|
|
53
|
+
text-align: end;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Compact layout: the two rows sit side by side instead of stacked, and
|
|
57
|
+
the temperature caption shrinks to an uppercase micro-label -- a denser
|
|
58
|
+
treatment for toolbars/sidebars where the vertical layout's full-height
|
|
59
|
+
rows don't fit. */
|
|
60
|
+
:host([layout='compact']) {
|
|
61
|
+
max-inline-size: none;
|
|
62
|
+
}
|
|
63
|
+
:host([layout='compact']) [part='base'] {
|
|
64
|
+
flex-direction: row;
|
|
65
|
+
flex-wrap: wrap;
|
|
66
|
+
align-items: flex-start;
|
|
67
|
+
gap: var(--lyra-space-m);
|
|
68
|
+
padding: var(--lyra-space-m);
|
|
69
|
+
}
|
|
70
|
+
:host([layout='compact']) [part='model-row'],
|
|
71
|
+
:host([layout='compact']) [part='temperature-row'] {
|
|
72
|
+
flex: 1 1 12rem;
|
|
73
|
+
min-inline-size: 10rem;
|
|
74
|
+
}
|
|
75
|
+
:host([layout='compact']) [part='temperature-label'] {
|
|
76
|
+
font-size: 0.6875rem;
|
|
77
|
+
font-weight: 700;
|
|
78
|
+
text-transform: uppercase;
|
|
79
|
+
letter-spacing: 0.04em;
|
|
80
|
+
color: var(--lyra-color-text-quiet);
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
@@ -13,10 +13,19 @@ import { LyraElement } from '../../internal/lyra-element.js';
|
|
|
13
13
|
*/
|
|
14
14
|
export declare class LyraPlayback extends LyraElement {
|
|
15
15
|
static styles: import("lit").CSSResultGroup[];
|
|
16
|
+
static properties: {
|
|
17
|
+
playing: {
|
|
18
|
+
type: BooleanConstructor;
|
|
19
|
+
reflect: boolean;
|
|
20
|
+
noAccessor: boolean;
|
|
21
|
+
};
|
|
22
|
+
loop: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
16
26
|
length: number;
|
|
17
27
|
index: number;
|
|
18
28
|
intervalMs: number;
|
|
19
|
-
playing: boolean;
|
|
20
29
|
loop: boolean;
|
|
21
30
|
/**
|
|
22
31
|
* Re-declared as a Lit reactive property (shadowing the inherited plain
|
|
@@ -27,6 +36,9 @@ export declare class LyraPlayback extends LyraElement {
|
|
|
27
36
|
*/
|
|
28
37
|
hidden: boolean;
|
|
29
38
|
private timer?;
|
|
39
|
+
private _playing;
|
|
40
|
+
get playing(): boolean;
|
|
41
|
+
set playing(next: boolean);
|
|
30
42
|
/** Largest index reachable at the current `length` (never negative). */
|
|
31
43
|
private get maxIndex();
|
|
32
44
|
disconnectedCallback(): void;
|
|
@@ -10,6 +10,14 @@ import { LyraElement } from '../../internal/lyra-element.js';
|
|
|
10
10
|
import { defineElement } from '../../internal/prefix.js';
|
|
11
11
|
import { playIcon, pauseIcon } from '../../internal/icons.js';
|
|
12
12
|
import { styles } from './playback.styles.js';
|
|
13
|
+
const MIN_INTERVAL_MS = 16; // ~one animation frame; prevents a near-zero-delay tick loop
|
|
14
|
+
let warnedInvalidInterval = false;
|
|
15
|
+
function warnInvalidInterval(value) {
|
|
16
|
+
if (warnedInvalidInterval)
|
|
17
|
+
return;
|
|
18
|
+
warnedInvalidInterval = true;
|
|
19
|
+
console.warn(`<lyra-playback> received a non-finite or non-positive interval-ms (${value}); clamping to ${MIN_INTERVAL_MS}ms.`);
|
|
20
|
+
}
|
|
13
21
|
/**
|
|
14
22
|
* `<lyra-playback>` — steps an index through `[0, length)` on a fixed
|
|
15
23
|
* interval (play/pause), the common building block behind ad-hoc
|
|
@@ -27,7 +35,10 @@ export class LyraPlayback extends LyraElement {
|
|
|
27
35
|
this.length = 0;
|
|
28
36
|
this.index = 0;
|
|
29
37
|
this.intervalMs = 900;
|
|
30
|
-
|
|
38
|
+
// `playing` is declared via `static properties` above (noAccessor) with a
|
|
39
|
+
// hand-written accessor below, so a direct `el.playing = true/false`
|
|
40
|
+
// assignment always drives the real timer — not just calls through
|
|
41
|
+
// play()/pause().
|
|
31
42
|
this.loop = true;
|
|
32
43
|
/**
|
|
33
44
|
* Re-declared as a Lit reactive property (shadowing the inherited plain
|
|
@@ -37,8 +48,36 @@ export class LyraPlayback extends LyraElement {
|
|
|
37
48
|
* `reflect: true` preserves the native attribute-reflection behavior.
|
|
38
49
|
*/
|
|
39
50
|
this.hidden = false;
|
|
51
|
+
this._playing = false;
|
|
40
52
|
}
|
|
41
53
|
static { this.styles = [LyraElement.styles, styles]; }
|
|
54
|
+
static { this.properties = {
|
|
55
|
+
playing: { type: Boolean, reflect: true, noAccessor: true },
|
|
56
|
+
loop: { type: Boolean },
|
|
57
|
+
}; }
|
|
58
|
+
get playing() {
|
|
59
|
+
return this._playing;
|
|
60
|
+
}
|
|
61
|
+
set playing(next) {
|
|
62
|
+
const old = this._playing;
|
|
63
|
+
if (next === old)
|
|
64
|
+
return;
|
|
65
|
+
this._playing = next;
|
|
66
|
+
if (next) {
|
|
67
|
+
if (this.length <= 1) {
|
|
68
|
+
this._playing = false;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
this.emit('lyra-play');
|
|
72
|
+
this.scheduleTick();
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
window.clearTimeout(this.timer);
|
|
76
|
+
this.timer = undefined;
|
|
77
|
+
this.emit('lyra-pause');
|
|
78
|
+
}
|
|
79
|
+
this.requestUpdate('playing', old);
|
|
80
|
+
}
|
|
42
81
|
/** Largest index reachable at the current `length` (never negative). */
|
|
43
82
|
get maxIndex() {
|
|
44
83
|
return Math.max(0, this.length - 1);
|
|
@@ -68,21 +107,16 @@ export class LyraPlayback extends LyraElement {
|
|
|
68
107
|
if (this.playing || this.length <= 1)
|
|
69
108
|
return;
|
|
70
109
|
this.playing = true;
|
|
71
|
-
this.emit('lyra-play');
|
|
72
|
-
this.scheduleTick();
|
|
73
110
|
}
|
|
74
111
|
/** Stop playback. */
|
|
75
112
|
pause() {
|
|
76
113
|
if (!this.playing)
|
|
77
114
|
return;
|
|
78
|
-
window.clearTimeout(this.timer);
|
|
79
|
-
this.timer = undefined;
|
|
80
115
|
this.playing = false;
|
|
81
|
-
this.emit('lyra-pause');
|
|
82
116
|
}
|
|
83
117
|
/** Toggle between playing and paused. */
|
|
84
118
|
toggle() {
|
|
85
|
-
this.playing
|
|
119
|
+
this.playing = !this.playing;
|
|
86
120
|
}
|
|
87
121
|
// A self-rescheduling `setTimeout` (rather than one long-lived
|
|
88
122
|
// `setInterval`) so `intervalMs` is re-read fresh before every tick, the
|
|
@@ -90,11 +124,16 @@ export class LyraPlayback extends LyraElement {
|
|
|
90
124
|
// `interval-ms` live takes effect on the very next step instead of only
|
|
91
125
|
// after a pause/play cycle.
|
|
92
126
|
scheduleTick() {
|
|
127
|
+
let delay = this.intervalMs;
|
|
128
|
+
if (!Number.isFinite(delay) || delay < MIN_INTERVAL_MS) {
|
|
129
|
+
warnInvalidInterval(delay);
|
|
130
|
+
delay = MIN_INTERVAL_MS;
|
|
131
|
+
}
|
|
93
132
|
this.timer = window.setTimeout(() => {
|
|
94
133
|
this.tick();
|
|
95
134
|
if (this.playing)
|
|
96
135
|
this.scheduleTick();
|
|
97
|
-
},
|
|
136
|
+
}, delay);
|
|
98
137
|
}
|
|
99
138
|
tick() {
|
|
100
139
|
const next = this.index + 1;
|
|
@@ -164,12 +203,6 @@ __decorate([
|
|
|
164
203
|
__decorate([
|
|
165
204
|
property({ type: Number, attribute: 'interval-ms' })
|
|
166
205
|
], LyraPlayback.prototype, "intervalMs", void 0);
|
|
167
|
-
__decorate([
|
|
168
|
-
property({ type: Boolean, reflect: true })
|
|
169
|
-
], LyraPlayback.prototype, "playing", void 0);
|
|
170
|
-
__decorate([
|
|
171
|
-
property({ type: Boolean })
|
|
172
|
-
], LyraPlayback.prototype, "loop", void 0);
|
|
173
206
|
__decorate([
|
|
174
207
|
property({ type: Boolean, reflect: true })
|
|
175
208
|
], LyraPlayback.prototype, "hidden", void 0);
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
/** The `mode` property's literal value -- `'auto'` tracks the viewport
|
|
4
|
+
* breakpoint live; `'inline'`/`'overlay'` force that presentation
|
|
5
|
+
* regardless of viewport width. */
|
|
6
|
+
export type ResponsivePanelMode = 'inline' | 'overlay' | 'auto';
|
|
7
|
+
/** What `mode` actually resolves to once the breakpoint is taken into
|
|
8
|
+
* account -- `'auto'` never appears here. */
|
|
9
|
+
export type ResponsivePanelEffectiveMode = 'inline' | 'overlay';
|
|
10
|
+
export type ResponsivePanelVariant = 'fullscreen' | 'bottom-sheet';
|
|
11
|
+
/** Reason the panel was closed, forwarded as the `lyra-close` event detail --
|
|
12
|
+
* mirrors lyra-dialog's own `DialogCloseReason` shape. `'escape'` and
|
|
13
|
+
* `'backdrop'` are emitted by the overlay presentation's own built-in
|
|
14
|
+
* dismiss triggers (they can't occur while inline, since there's no
|
|
15
|
+
* backdrop/document-keydown trap wired up then); any other string is
|
|
16
|
+
* whatever a caller passes to `close()`. */
|
|
17
|
+
export type ResponsivePanelCloseReason = 'escape' | 'backdrop' | 'api' | string;
|
|
18
|
+
export interface ResponsivePanelModeChangeDetail {
|
|
19
|
+
mode: ResponsivePanelEffectiveMode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Pure resolution of the `mode` prop + current viewport into the actual
|
|
23
|
+
* presentation. Kept separate from the `matchMedia` listener wiring below so
|
|
24
|
+
* it's independently unit-testable, and so the live-viewport-response logic
|
|
25
|
+
* can be exercised in tests by calling it (or the instance method that wraps
|
|
26
|
+
* it) directly instead of needing control over the real browser window,
|
|
27
|
+
* which `@web/test-runner` doesn't give.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveEffectiveMode(mode: ResponsivePanelMode, belowBreakpoint: boolean): ResponsivePanelEffectiveMode;
|
|
30
|
+
/**
|
|
31
|
+
* `<lyra-responsive-panel>` — the same slotted content either docked inline
|
|
32
|
+
* in the page's normal layout flow (desktop) or presented as a full-screen/
|
|
33
|
+
* bottom-sheet overlay (mobile), depending on viewport width. Typical uses:
|
|
34
|
+
* a settings panel or a conversation-history sidebar that's a permanent
|
|
35
|
+
* docked pane on a wide screen but a modal on a phone.
|
|
36
|
+
*
|
|
37
|
+
* Breakpoint detection uses `matchMedia('(max-width: ' + mobileBreakpoint +
|
|
38
|
+
* ')')`, re-evaluated live while connected -- resizing/rotating a device
|
|
39
|
+
* that crosses the breakpoint while `mode="auto"` (the default) updates the
|
|
40
|
+
* effective presentation without unmounting or re-creating the slotted
|
|
41
|
+
* content: inline and overlay presentation share the exact same shadow DOM
|
|
42
|
+
* structure (only a css class, and the overlay-only `role`/`aria-modal`
|
|
43
|
+
* attributes and backdrop element, differ), so lit-html's diffing keeps
|
|
44
|
+
* `[part="body"]` and its `<slot>` as the same DOM node across the
|
|
45
|
+
* transition -- scroll position and focus inside the slotted content survive
|
|
46
|
+
* it for free, with no extra bookkeeping required. The one exception is
|
|
47
|
+
* focus: crossing the breakpoint while already open does *not* forcibly
|
|
48
|
+
* move focus into the panel (unlike an `open` transition, which does) --
|
|
49
|
+
* doing so on a resize could yank focus away from an input the user is
|
|
50
|
+
* actively typing into inside the now-newly-modal panel, which is worse UX
|
|
51
|
+
* than a modal that's very briefly missing its initial focus placement.
|
|
52
|
+
*
|
|
53
|
+
* The overlay presentation duplicates lyra-dialog's `role="dialog"` +
|
|
54
|
+
* focus-trap + Escape/backdrop-dismiss + scroll-lock mechanics locally
|
|
55
|
+
* rather than nesting a `<lyra-dialog>` inside this component's shadow DOM,
|
|
56
|
+
* per the established precedent for every overlay-shaped component in this
|
|
57
|
+
* family (see lyra-dialog's own module doc).
|
|
58
|
+
*
|
|
59
|
+
* @customElement lyra-responsive-panel
|
|
60
|
+
* @slot - The panel body.
|
|
61
|
+
* @slot header - Optional header content, rendered above the body.
|
|
62
|
+
* @slot footer - Optional footer content (e.g. action buttons), rendered below the body.
|
|
63
|
+
* @event lyra-close - `detail: ResponsivePanelCloseReason`. Fired by the overlay presentation's
|
|
64
|
+
* built-in dismiss triggers (Escape, backdrop click) and by any `close()` call, in either
|
|
65
|
+
* presentation -- a plain `open = false` property write does not fire it (matching
|
|
66
|
+
* lyra-dialog's own precedent: only going through `close()` counts as a dismissal), and this
|
|
67
|
+
* is deliberately the same event/semantics in both presentations, rather than only being
|
|
68
|
+
* meaningful for the overlay case, so a consumer only has to wire up one listener regardless
|
|
69
|
+
* of which presentation is currently active.
|
|
70
|
+
* @event lyra-mode-change - `detail: ResponsivePanelModeChangeDetail`. Fired whenever the
|
|
71
|
+
* *effective* mode (not the `mode` prop's literal value, which may be `'auto'`) changes between
|
|
72
|
+
* `'inline'` and `'overlay'` -- crossing the breakpoint while `mode="auto"`, or the host
|
|
73
|
+
* reassigning `mode` to a value that changes the effective presentation. Never fired for the
|
|
74
|
+
* initial render, only for a live change thereafter.
|
|
75
|
+
* @csspart base - The root wrapper; `display: none` while closed, positioned `fixed` while open
|
|
76
|
+
* and in the overlay presentation.
|
|
77
|
+
* @csspart backdrop - The full-viewport scrim behind the panel -- only rendered in the overlay
|
|
78
|
+
* presentation.
|
|
79
|
+
* @csspart panel - The panel surface itself (`role="dialog"` while open and in the overlay
|
|
80
|
+
* presentation).
|
|
81
|
+
* @csspart header - The wrapper around the `header` slot.
|
|
82
|
+
* @csspart body - The wrapper around the default slot.
|
|
83
|
+
* @csspart footer - The wrapper around the `footer` slot.
|
|
84
|
+
*/
|
|
85
|
+
export declare class LyraResponsivePanel extends LyraElement {
|
|
86
|
+
static styles: import("lit").CSSResultGroup[];
|
|
87
|
+
/** Whether the panel is open. In the inline presentation this just means visible/mounted; in
|
|
88
|
+
* the overlay presentation this is the actual modal open/closed state. */
|
|
89
|
+
open: boolean;
|
|
90
|
+
/** `'auto'` (default) tracks `mobile-breakpoint` live; `'inline'`/`'overlay'` force that
|
|
91
|
+
* presentation regardless of viewport width. */
|
|
92
|
+
mode: ResponsivePanelMode;
|
|
93
|
+
/** Only affects the overlay presentation's visual treatment -- `'fullscreen'` (default) covers
|
|
94
|
+
* the whole viewport; `'bottom-sheet'` slides up from the bottom and doesn't cover the full
|
|
95
|
+
* height. */
|
|
96
|
+
variant: ResponsivePanelVariant;
|
|
97
|
+
/** Accessible name for the overlay presentation's `role="dialog"`. Unused in the inline
|
|
98
|
+
* presentation, which has no dialog semantics to name. */
|
|
99
|
+
label: string;
|
|
100
|
+
/** CSS length passed to `matchMedia` as `(max-width: <this>)` to decide, in `mode="auto"`,
|
|
101
|
+
* whether the effective presentation is `'overlay'` (below/at this width) or `'inline'`
|
|
102
|
+
* (above it). */
|
|
103
|
+
mobileBreakpoint: string;
|
|
104
|
+
private belowBreakpoint;
|
|
105
|
+
private effectiveMode;
|
|
106
|
+
private hasHeaderSlot;
|
|
107
|
+
private hasFooterSlot;
|
|
108
|
+
private mediaQuery?;
|
|
109
|
+
private releaseScrollLock?;
|
|
110
|
+
private lastTrigger?;
|
|
111
|
+
/** Whether the overlay-only mechanics (scroll-lock, document Escape/Tab trap) are currently
|
|
112
|
+
* engaged -- derived from `effectiveMode === 'overlay' && open`, tracked separately from those
|
|
113
|
+
* two properties so willUpdate can diff "was engaged" vs "should be engaged now" regardless of
|
|
114
|
+
* which of the two changed. */
|
|
115
|
+
private overlayChromeActive;
|
|
116
|
+
private isFirstUpdate;
|
|
117
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
118
|
+
protected updated(changed: PropertyValues): void;
|
|
119
|
+
connectedCallback(): void;
|
|
120
|
+
disconnectedCallback(): void;
|
|
121
|
+
private setupMediaQuery;
|
|
122
|
+
private onMediaChange;
|
|
123
|
+
/** The breakpoint-response logic itself, kept callable independently of the
|
|
124
|
+
* `matchMedia` listener that normally drives it -- tests invoke this
|
|
125
|
+
* directly to simulate crossing the breakpoint. */
|
|
126
|
+
private handleBreakpointChange;
|
|
127
|
+
private onHeaderSlotChange;
|
|
128
|
+
private onFooterSlotChange;
|
|
129
|
+
/**
|
|
130
|
+
* Close the panel. `reason` is forwarded as the `lyra-close` detail --
|
|
131
|
+
* built-in overlay triggers pass `'escape'`/`'backdrop'`; a consumer's own
|
|
132
|
+
* close affordance (e.g. a footer button, or a docked panel's own toggle)
|
|
133
|
+
* should call this directly with its own reason string. Fires in both
|
|
134
|
+
* presentations (see the class doc's `lyra-close` note) but only returns
|
|
135
|
+
* focus to the trigger that opened it when the overlay presentation is
|
|
136
|
+
* active, since the inline presentation never took focus away from
|
|
137
|
+
* anything to begin with.
|
|
138
|
+
*/
|
|
139
|
+
close(reason?: ResponsivePanelCloseReason): void;
|
|
140
|
+
private onBackdropClick;
|
|
141
|
+
private onDocKeyDown;
|
|
142
|
+
private getFocusableElements;
|
|
143
|
+
private getActiveElement;
|
|
144
|
+
render(): TemplateResult;
|
|
145
|
+
}
|
|
146
|
+
declare global {
|
|
147
|
+
interface HTMLElementTagNameMap {
|
|
148
|
+
'lyra-responsive-panel': LyraResponsivePanel;
|
|
149
|
+
}
|
|
150
|
+
}
|