@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,439 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, nothing } from 'lit';
|
|
8
|
+
import { property, state } from 'lit/decorators.js';
|
|
9
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
|
+
import { defineElement } from '../../internal/prefix.js';
|
|
11
|
+
import { lockScroll } from '../../internal/scroll-lock.js';
|
|
12
|
+
import { nextId } from '../../internal/a11y.js';
|
|
13
|
+
import { styles } from './tool-select-dialog.styles.js';
|
|
14
|
+
import '../checkbox/checkbox.js';
|
|
15
|
+
import '../switch/switch.js';
|
|
16
|
+
const OTHER_CATEGORY = 'Other';
|
|
17
|
+
const FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
18
|
+
// Shadow-piercing so both a slotted custom element's real focusable target
|
|
19
|
+
// (footer content) and a directly-rendered one (the search input, the
|
|
20
|
+
// use-defaults <lyra-switch>, each row's <lyra-checkbox> -- all live in this
|
|
21
|
+
// component's own shadow tree, not projected via <slot>) are found even
|
|
22
|
+
// though the tag itself doesn't match FOCUSABLE_SELECTOR. Deliberately
|
|
23
|
+
// duplicated from lyra-dialog's/lyra-tool-result-dialog's identical helper
|
|
24
|
+
// rather than imported/shared -- this component is its own standalone
|
|
25
|
+
// overlay and must not depend on either (see this file's class doc).
|
|
26
|
+
function collectFocusable(el) {
|
|
27
|
+
const result = [];
|
|
28
|
+
if (el.matches(FOCUSABLE_SELECTOR)) {
|
|
29
|
+
result.push(el);
|
|
30
|
+
}
|
|
31
|
+
if (el instanceof HTMLSlotElement) {
|
|
32
|
+
for (const assigned of el.assignedElements({ flatten: true })) {
|
|
33
|
+
result.push(...collectFocusable(assigned));
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
const container = el.shadowRoot ?? el;
|
|
38
|
+
for (const child of Array.from(container.children)) {
|
|
39
|
+
result.push(...collectFocusable(child));
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
/** Whether `el` is actually laid out/paintable -- `checkVisibility()` (falling
|
|
44
|
+
* back to `getClientRects().length` where unsupported) correctly follows
|
|
45
|
+
* flattened-tree/slot assignment, unlike `offsetParent`. Mirrors
|
|
46
|
+
* lyra-dialog's/lyra-tool-result-dialog's identical helper. */
|
|
47
|
+
function isRendered(el) {
|
|
48
|
+
return el.checkVisibility ? el.checkVisibility() : el.getClientRects().length > 0;
|
|
49
|
+
}
|
|
50
|
+
/** Default `filter`: case-insensitive substring match against the tool's name and description. */
|
|
51
|
+
function defaultFilter(tool, query) {
|
|
52
|
+
return tool.name.toLowerCase().includes(query) || (tool.description ?? '').toLowerCase().includes(query);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* `<lyra-tool-select-dialog>` — a category-grouped, filterable, searchable
|
|
56
|
+
* tool-enablement dialog for picking which agent tools are available in a
|
|
57
|
+
* conversation.
|
|
58
|
+
*
|
|
59
|
+
* This is its own standalone overlay implementation (`role="dialog"`,
|
|
60
|
+
* focus-trapped, Escape/backdrop-dismissible, scroll-locking) rather than
|
|
61
|
+
* nesting a `<lyra-dialog>` in its shadow template — see `<lyra-dialog>`'s
|
|
62
|
+
* own header comment for why a new overlay component in this library
|
|
63
|
+
* duplicates that pattern locally instead of composing the previous one.
|
|
64
|
+
*
|
|
65
|
+
* `useDefaults` is a single top-level switch: while `true`, every per-tool
|
|
66
|
+
* checkbox below renders disabled (still reflecting whatever `selected`
|
|
67
|
+
* holds — a consumer should populate that with its own default tool set
|
|
68
|
+
* whenever `useDefaults` is true) and a hint explains that turning the
|
|
69
|
+
* switch off is how to customize. Turning it off is the "customize"
|
|
70
|
+
* affordance — it's the only thing that both flips `useDefaults` to `false`
|
|
71
|
+
* *and* unlocks the per-tool checkboxes for editing, so there's exactly one
|
|
72
|
+
* control for that transition rather than a separate button duplicating it.
|
|
73
|
+
*
|
|
74
|
+
* There is no built-in footer/close button — like `<lyra-dialog>`, dismissal
|
|
75
|
+
* happens via Escape, a backdrop click, or a consumer's own `footer`-slotted
|
|
76
|
+
* action calling `close()`. This also means the search input is the very
|
|
77
|
+
* first focusable element in the panel with no special-casing needed, so
|
|
78
|
+
* it's what receives focus on open (see `updated()`).
|
|
79
|
+
*
|
|
80
|
+
* @customElement lyra-tool-select-dialog
|
|
81
|
+
* @slot footer - Optional action buttons (e.g. a "Done" button), rendered in a bottom row.
|
|
82
|
+
* Changes already apply live via `lyra-change`, so this is optional.
|
|
83
|
+
* @event lyra-change - The enabled-tool selection or the `useDefaults` toggle changed.
|
|
84
|
+
* `detail: { selected: string[], useDefaults: boolean }`.
|
|
85
|
+
* @event lyra-close - `detail: ToolSelectDialogCloseReason`. Fired exactly once per dismissal,
|
|
86
|
+
* via Escape, a backdrop click, or a `close()` call.
|
|
87
|
+
* @csspart backdrop - The full-viewport scrim behind the panel.
|
|
88
|
+
* @csspart panel - The dialog panel itself (`role="dialog"` while open).
|
|
89
|
+
* @csspart header - The wrapper around the title/subtitle.
|
|
90
|
+
* @csspart title - The dialog's heading.
|
|
91
|
+
* @csspart subtitle - The "N of M tools enabled" summary line.
|
|
92
|
+
* @csspart search-row - The wrapper around the search input.
|
|
93
|
+
* @csspart search-input - The filter text input.
|
|
94
|
+
* @csspart defaults-row - The wrapper around the use-defaults switch and its hint.
|
|
95
|
+
* @csspart defaults-toggle - The built-in `<lyra-switch>` bound to `useDefaults`.
|
|
96
|
+
* @csspart defaults-hint - The "turn off to customize" hint, shown only while `useDefaults` is true.
|
|
97
|
+
* @csspart body - The scrollable wrapper around the grouped tool list.
|
|
98
|
+
* @csspart empty - The "no tools" / "no matches" message.
|
|
99
|
+
* @csspart category - A single category's wrapper (`role="group"`).
|
|
100
|
+
* @csspart category-heading - A category's heading.
|
|
101
|
+
* @csspart category-count - The visible tool count next to a category heading.
|
|
102
|
+
* @csspart category-list - The `<ul>` of tool rows within a category.
|
|
103
|
+
* @csspart tool-row - A single tool's `<li>` row.
|
|
104
|
+
* @csspart tool-checkbox - A row's `<lyra-checkbox>`.
|
|
105
|
+
* @csspart tool-name - A row's name text (plus its `icon`, if set).
|
|
106
|
+
* @csspart tool-icon - A row's leading icon glyph, when `icon` is set.
|
|
107
|
+
* @csspart tool-description - A row's optional description text.
|
|
108
|
+
* @csspart tool-disabled-reason - A disabled row's `disabledReason` text.
|
|
109
|
+
* @csspart footer - The wrapper around the `footer` slot.
|
|
110
|
+
*/
|
|
111
|
+
export class LyraToolSelectDialog extends LyraElement {
|
|
112
|
+
constructor() {
|
|
113
|
+
super(...arguments);
|
|
114
|
+
/** Whether the dialog is open. Set this (or call `close()`) — there is no separate `show()`/`hide()` pair. */
|
|
115
|
+
this.open = false;
|
|
116
|
+
/** The full set of tools a consumer offers, across all categories. */
|
|
117
|
+
this.tools = [];
|
|
118
|
+
/** The currently-enabled tool ids. */
|
|
119
|
+
this.selected = [];
|
|
120
|
+
/** Whether the conversation is using the default tool set (`true`) or a custom selection (`false`) — see the class doc for the exact interaction with `selected`/per-tool editing. */
|
|
121
|
+
this.useDefaults = false;
|
|
122
|
+
/** The dialog's visible heading and accessible name. */
|
|
123
|
+
this.label = 'Select tools';
|
|
124
|
+
this.searchPlaceholder = 'Search tools…';
|
|
125
|
+
/** Overrides the built-in case-insensitive name/description substring match. */
|
|
126
|
+
this.filter = null;
|
|
127
|
+
this.query = '';
|
|
128
|
+
this.hasFooterSlot = false;
|
|
129
|
+
this.titleId = nextId('tool-select-dialog-title');
|
|
130
|
+
// Stable per-category heading ids, keyed by category name -- generated
|
|
131
|
+
// once (not regenerated every render/keystroke) so a category's
|
|
132
|
+
// aria-labelledby target keeps the same id across re-renders.
|
|
133
|
+
this.categoryIds = new Map();
|
|
134
|
+
this.onFooterSlotChange = (e) => {
|
|
135
|
+
this.hasFooterSlot = e.target.assignedElements({ flatten: true }).length > 0;
|
|
136
|
+
};
|
|
137
|
+
this.onBackdropClick = () => {
|
|
138
|
+
this.close('backdrop');
|
|
139
|
+
};
|
|
140
|
+
this.onDocKeyDown = (e) => {
|
|
141
|
+
if (!this.open)
|
|
142
|
+
return;
|
|
143
|
+
if (e.key === 'Escape') {
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
this.close('escape');
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (e.key !== 'Tab')
|
|
149
|
+
return;
|
|
150
|
+
const focusable = this.getFocusableElements();
|
|
151
|
+
if (focusable.length === 0) {
|
|
152
|
+
e.preventDefault();
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const first = focusable[0];
|
|
156
|
+
const last = focusable[focusable.length - 1];
|
|
157
|
+
const active = this.getActiveElement();
|
|
158
|
+
if (e.shiftKey && active === first) {
|
|
159
|
+
e.preventDefault();
|
|
160
|
+
last.focus();
|
|
161
|
+
}
|
|
162
|
+
else if (!e.shiftKey && active === last) {
|
|
163
|
+
e.preventDefault();
|
|
164
|
+
first.focus();
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
this.onSearchInput = (e) => {
|
|
168
|
+
this.query = e.target.value;
|
|
169
|
+
};
|
|
170
|
+
this.onDefaultsToggle = (e) => {
|
|
171
|
+
this.useDefaults = e.detail.checked;
|
|
172
|
+
this.emitChange();
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
176
|
+
willUpdate(changed) {
|
|
177
|
+
if (!this.hasUpdated) {
|
|
178
|
+
this.hasFooterSlot = Array.from(this.children).some((el) => el.getAttribute('slot') === 'footer');
|
|
179
|
+
}
|
|
180
|
+
if (changed.has('open')) {
|
|
181
|
+
if (this.open) {
|
|
182
|
+
// Captured here (before render) rather than from a click event on
|
|
183
|
+
// some specific internal control -- like lyra-dialog, a trigger
|
|
184
|
+
// typically lives *outside* this component entirely, so "whatever
|
|
185
|
+
// had focus right before open" is the only generally correct
|
|
186
|
+
// definition of "the trigger".
|
|
187
|
+
const active = this.getActiveElement();
|
|
188
|
+
this.lastTrigger = active instanceof HTMLElement ? active : undefined;
|
|
189
|
+
this.releaseScrollLock = lockScroll();
|
|
190
|
+
document.addEventListener('keydown', this.onDocKeyDown);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
this.releaseScrollLock?.();
|
|
194
|
+
this.releaseScrollLock = undefined;
|
|
195
|
+
document.removeEventListener('keydown', this.onDocKeyDown);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// Runs after render (not willUpdate) so [part="panel"] and its contents
|
|
200
|
+
// have already landed in the DOM before the focus call below can rely on
|
|
201
|
+
// them -- mirrors lyra-dialog's/lyra-tool-result-dialog's identical
|
|
202
|
+
// ordering rationale.
|
|
203
|
+
updated(changed) {
|
|
204
|
+
if (changed.has('open') && this.open) {
|
|
205
|
+
const first = this.getFocusableElements()[0];
|
|
206
|
+
if (first) {
|
|
207
|
+
first.focus();
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
this.shadowRoot?.querySelector('[part="panel"]')?.focus();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
connectedCallback() {
|
|
215
|
+
super.connectedCallback();
|
|
216
|
+
// A reconnect (e.g. a drag-and-drop reparent keeping this same element
|
|
217
|
+
// instance) fires disconnectedCallback then connectedCallback
|
|
218
|
+
// synchronously with no update in between, so willUpdate never reruns to
|
|
219
|
+
// notice `open` is still true -- restore the scroll lock/trap it dropped.
|
|
220
|
+
if (this.hasUpdated && this.open && !this.releaseScrollLock) {
|
|
221
|
+
this.releaseScrollLock = lockScroll();
|
|
222
|
+
document.addEventListener('keydown', this.onDocKeyDown);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
disconnectedCallback() {
|
|
226
|
+
super.disconnectedCallback();
|
|
227
|
+
this.releaseScrollLock?.();
|
|
228
|
+
this.releaseScrollLock = undefined;
|
|
229
|
+
document.removeEventListener('keydown', this.onDocKeyDown);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Close the dialog and return focus to whatever had it before the dialog
|
|
233
|
+
* opened. `reason` is forwarded as the `lyra-close` detail — built-in
|
|
234
|
+
* triggers pass `'escape'`/`'backdrop'`; a consumer's own close affordance
|
|
235
|
+
* (e.g. a footer Done button) should call this directly with its own
|
|
236
|
+
* reason string, so every dismissal path funnels through the same event
|
|
237
|
+
* instead of the consumer having to also toggle `open` itself.
|
|
238
|
+
*/
|
|
239
|
+
close(reason = 'api') {
|
|
240
|
+
if (!this.open)
|
|
241
|
+
return;
|
|
242
|
+
this.open = false;
|
|
243
|
+
this.emit('lyra-close', reason);
|
|
244
|
+
this.lastTrigger?.focus();
|
|
245
|
+
}
|
|
246
|
+
// Bounds Tab/Shift+Tab to the panel while open. Order follows the search
|
|
247
|
+
// input, then the use-defaults switch, then each visible tool row's
|
|
248
|
+
// checkbox, then the footer slot -- the same order the flattened tree
|
|
249
|
+
// already tabs through (mirrors lyra-tool-result-dialog's identical
|
|
250
|
+
// header-buttons-then-body-then-footer ordering rationale).
|
|
251
|
+
getFocusableElements() {
|
|
252
|
+
const root = this.shadowRoot;
|
|
253
|
+
if (!root)
|
|
254
|
+
return [];
|
|
255
|
+
const searchInput = root.querySelector('[part="search-input"]');
|
|
256
|
+
const defaultsToggle = root.querySelector('[part="defaults-toggle"]');
|
|
257
|
+
const checkboxes = Array.from(root.querySelectorAll('[part="tool-checkbox"]'));
|
|
258
|
+
const fromSlot = (selector) => {
|
|
259
|
+
const slot = root.querySelector(selector);
|
|
260
|
+
return slot ? slot.assignedElements({ flatten: true }).flatMap(collectFocusable) : [];
|
|
261
|
+
};
|
|
262
|
+
return [
|
|
263
|
+
...(searchInput ? collectFocusable(searchInput) : []),
|
|
264
|
+
...(defaultsToggle ? collectFocusable(defaultsToggle) : []),
|
|
265
|
+
...checkboxes.flatMap(collectFocusable),
|
|
266
|
+
...fromSlot('slot[name="footer"]'),
|
|
267
|
+
].filter(isRendered);
|
|
268
|
+
}
|
|
269
|
+
getActiveElement() {
|
|
270
|
+
let active = document.activeElement;
|
|
271
|
+
while (active) {
|
|
272
|
+
const inner = active.shadowRoot?.activeElement ?? null;
|
|
273
|
+
if (!inner)
|
|
274
|
+
break;
|
|
275
|
+
active = inner;
|
|
276
|
+
}
|
|
277
|
+
return active;
|
|
278
|
+
}
|
|
279
|
+
emitChange() {
|
|
280
|
+
this.emit('lyra-change', {
|
|
281
|
+
selected: [...this.selected],
|
|
282
|
+
useDefaults: this.useDefaults,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
onToolToggle(tool, e) {
|
|
286
|
+
const set = new Set(this.selected);
|
|
287
|
+
e.detail.checked ? set.add(tool.id) : set.delete(tool.id);
|
|
288
|
+
this.selected = [...set];
|
|
289
|
+
this.emitChange();
|
|
290
|
+
}
|
|
291
|
+
categoryId(category) {
|
|
292
|
+
let id = this.categoryIds.get(category);
|
|
293
|
+
if (!id) {
|
|
294
|
+
id = nextId('tool-select-dialog-category');
|
|
295
|
+
this.categoryIds.set(category, id);
|
|
296
|
+
}
|
|
297
|
+
return id;
|
|
298
|
+
}
|
|
299
|
+
/** Tools grouped by `category` (first-seen order), with an uncategorized
|
|
300
|
+
* bucket always last, then filtered by the active search query -- a
|
|
301
|
+
* category left with zero matches is dropped entirely rather than
|
|
302
|
+
* rendered as an empty heading. */
|
|
303
|
+
get groups() {
|
|
304
|
+
const order = [];
|
|
305
|
+
const byCategory = new Map();
|
|
306
|
+
for (const tool of this.tools) {
|
|
307
|
+
const category = tool.category?.trim() || OTHER_CATEGORY;
|
|
308
|
+
let bucket = byCategory.get(category);
|
|
309
|
+
if (!bucket) {
|
|
310
|
+
bucket = [];
|
|
311
|
+
byCategory.set(category, bucket);
|
|
312
|
+
if (category !== OTHER_CATEGORY)
|
|
313
|
+
order.push(category);
|
|
314
|
+
}
|
|
315
|
+
bucket.push(tool);
|
|
316
|
+
}
|
|
317
|
+
if (byCategory.has(OTHER_CATEGORY))
|
|
318
|
+
order.push(OTHER_CATEGORY);
|
|
319
|
+
const q = this.query.trim().toLowerCase();
|
|
320
|
+
const matches = q ? (tool) => (this.filter ?? defaultFilter)(tool, q) : () => true;
|
|
321
|
+
return order
|
|
322
|
+
.map((category) => ({ category, tools: byCategory.get(category).filter(matches) }))
|
|
323
|
+
.filter((group) => group.tools.length > 0);
|
|
324
|
+
}
|
|
325
|
+
renderTool(tool) {
|
|
326
|
+
const rowDisabled = Boolean(tool.disabled) || this.useDefaults;
|
|
327
|
+
return html `
|
|
328
|
+
<li part="tool-row" ?data-disabled=${rowDisabled}>
|
|
329
|
+
<lyra-checkbox
|
|
330
|
+
part="tool-checkbox"
|
|
331
|
+
value=${tool.id}
|
|
332
|
+
?checked=${this.selected.includes(tool.id)}
|
|
333
|
+
?disabled=${rowDisabled}
|
|
334
|
+
@lyra-change=${(e) => this.onToolToggle(tool, e)}
|
|
335
|
+
>
|
|
336
|
+
<span part="tool-name">
|
|
337
|
+
${tool.icon ? html `<span part="tool-icon" aria-hidden="true">${tool.icon}</span>` : nothing}${tool.name}
|
|
338
|
+
</span>
|
|
339
|
+
${tool.description ? html `<span part="tool-description">${tool.description}</span>` : nothing}
|
|
340
|
+
</lyra-checkbox>
|
|
341
|
+
${tool.disabled && tool.disabledReason
|
|
342
|
+
? html `<p part="tool-disabled-reason">${tool.disabledReason}</p>`
|
|
343
|
+
: nothing}
|
|
344
|
+
</li>
|
|
345
|
+
`;
|
|
346
|
+
}
|
|
347
|
+
renderCategory(group) {
|
|
348
|
+
const headingId = this.categoryId(group.category);
|
|
349
|
+
return html `
|
|
350
|
+
<div part="category" role="group" aria-labelledby=${headingId}>
|
|
351
|
+
<h3 part="category-heading" id=${headingId}>
|
|
352
|
+
${group.category}<span part="category-count">${group.tools.length}</span>
|
|
353
|
+
</h3>
|
|
354
|
+
<ul part="category-list">
|
|
355
|
+
${group.tools.map((tool) => this.renderTool(tool))}
|
|
356
|
+
</ul>
|
|
357
|
+
</div>
|
|
358
|
+
`;
|
|
359
|
+
}
|
|
360
|
+
render() {
|
|
361
|
+
const groups = this.groups;
|
|
362
|
+
const hasTools = this.tools.length > 0;
|
|
363
|
+
return html `
|
|
364
|
+
<div part="backdrop" @click=${this.onBackdropClick}></div>
|
|
365
|
+
<div
|
|
366
|
+
part="panel"
|
|
367
|
+
role=${this.open ? 'dialog' : nothing}
|
|
368
|
+
aria-modal=${this.open ? 'true' : nothing}
|
|
369
|
+
aria-labelledby=${this.titleId}
|
|
370
|
+
tabindex="-1"
|
|
371
|
+
>
|
|
372
|
+
<div part="header">
|
|
373
|
+
<h2 part="title" id=${this.titleId}>${this.label}</h2>
|
|
374
|
+
<p part="subtitle" ?hidden=${!hasTools}>${this.selected.length} of ${this.tools.length} tools enabled</p>
|
|
375
|
+
</div>
|
|
376
|
+
<div part="search-row">
|
|
377
|
+
<input
|
|
378
|
+
part="search-input"
|
|
379
|
+
type="search"
|
|
380
|
+
.value=${this.query}
|
|
381
|
+
placeholder=${this.searchPlaceholder}
|
|
382
|
+
aria-label=${this.searchPlaceholder}
|
|
383
|
+
@input=${this.onSearchInput}
|
|
384
|
+
/>
|
|
385
|
+
</div>
|
|
386
|
+
<div part="defaults-row">
|
|
387
|
+
<lyra-switch
|
|
388
|
+
part="defaults-toggle"
|
|
389
|
+
?checked=${this.useDefaults}
|
|
390
|
+
@lyra-change=${this.onDefaultsToggle}
|
|
391
|
+
>
|
|
392
|
+
Use default tools
|
|
393
|
+
</lyra-switch>
|
|
394
|
+
${this.useDefaults
|
|
395
|
+
? html `<p part="defaults-hint">Turn off to choose individual tools.</p>`
|
|
396
|
+
: nothing}
|
|
397
|
+
</div>
|
|
398
|
+
<div part="body">
|
|
399
|
+
${groups.length === 0
|
|
400
|
+
? html `<p part="empty">
|
|
401
|
+
${hasTools ? html `No tools match "${this.query}".` : 'No tools available.'}
|
|
402
|
+
</p>`
|
|
403
|
+
: groups.map((group) => this.renderCategory(group))}
|
|
404
|
+
</div>
|
|
405
|
+
<div part="footer" ?hidden=${!this.hasFooterSlot}>
|
|
406
|
+
<slot name="footer" @slotchange=${this.onFooterSlotChange}></slot>
|
|
407
|
+
</div>
|
|
408
|
+
</div>
|
|
409
|
+
`;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
__decorate([
|
|
413
|
+
property({ type: Boolean, reflect: true })
|
|
414
|
+
], LyraToolSelectDialog.prototype, "open", void 0);
|
|
415
|
+
__decorate([
|
|
416
|
+
property({ attribute: false })
|
|
417
|
+
], LyraToolSelectDialog.prototype, "tools", void 0);
|
|
418
|
+
__decorate([
|
|
419
|
+
property({ attribute: false })
|
|
420
|
+
], LyraToolSelectDialog.prototype, "selected", void 0);
|
|
421
|
+
__decorate([
|
|
422
|
+
property({ type: Boolean, reflect: true, attribute: 'use-defaults' })
|
|
423
|
+
], LyraToolSelectDialog.prototype, "useDefaults", void 0);
|
|
424
|
+
__decorate([
|
|
425
|
+
property()
|
|
426
|
+
], LyraToolSelectDialog.prototype, "label", void 0);
|
|
427
|
+
__decorate([
|
|
428
|
+
property({ attribute: 'search-placeholder' })
|
|
429
|
+
], LyraToolSelectDialog.prototype, "searchPlaceholder", void 0);
|
|
430
|
+
__decorate([
|
|
431
|
+
property({ attribute: false })
|
|
432
|
+
], LyraToolSelectDialog.prototype, "filter", void 0);
|
|
433
|
+
__decorate([
|
|
434
|
+
state()
|
|
435
|
+
], LyraToolSelectDialog.prototype, "query", void 0);
|
|
436
|
+
__decorate([
|
|
437
|
+
state()
|
|
438
|
+
], LyraToolSelectDialog.prototype, "hasFooterSlot", void 0);
|
|
439
|
+
defineElement('tool-select-dialog', LyraToolSelectDialog);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
/* Backdrop scrim color -- component-specific so a host can retheme it
|
|
5
|
+
without a raw literal leaking into the public API (no shared
|
|
6
|
+
--wa-*-overlay token exists in the design system to resolve through,
|
|
7
|
+
same rationale as lyra-dialog's --lyra-dialog-overlay-color and
|
|
8
|
+
lyra-tool-result-dialog's --lyra-tool-result-dialog-overlay-color). */
|
|
9
|
+
--lyra-tool-select-dialog-overlay-color: rgb(0 0 0 / 0.5);
|
|
10
|
+
display: none;
|
|
11
|
+
position: fixed;
|
|
12
|
+
inset: 0;
|
|
13
|
+
z-index: 1000;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
padding: var(--lyra-space-l);
|
|
17
|
+
}
|
|
18
|
+
:host([open]) {
|
|
19
|
+
display: flex;
|
|
20
|
+
}
|
|
21
|
+
[part='backdrop'] {
|
|
22
|
+
position: absolute;
|
|
23
|
+
inset: 0;
|
|
24
|
+
background: var(--lyra-tool-select-dialog-overlay-color);
|
|
25
|
+
}
|
|
26
|
+
[part='panel'] {
|
|
27
|
+
position: relative;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
inline-size: min(30rem, 100%);
|
|
31
|
+
block-size: min(38rem, 100%);
|
|
32
|
+
background: var(--lyra-color-surface);
|
|
33
|
+
border: 1px solid var(--lyra-color-border);
|
|
34
|
+
border-radius: var(--lyra-radius);
|
|
35
|
+
box-shadow: var(--lyra-shadow);
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
}
|
|
38
|
+
[part='header'] {
|
|
39
|
+
padding: var(--lyra-space-l) var(--lyra-space-l) 0;
|
|
40
|
+
}
|
|
41
|
+
[part='title'] {
|
|
42
|
+
margin: 0;
|
|
43
|
+
font-size: 1rem;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
}
|
|
46
|
+
[part='subtitle'] {
|
|
47
|
+
margin: var(--lyra-space-xs) 0 0;
|
|
48
|
+
font-size: 0.8125rem;
|
|
49
|
+
color: var(--lyra-color-text-quiet);
|
|
50
|
+
}
|
|
51
|
+
[part='subtitle'][hidden] {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[part='search-row'] {
|
|
56
|
+
padding: var(--lyra-space-m) var(--lyra-space-l) 0;
|
|
57
|
+
}
|
|
58
|
+
[part='search-input'] {
|
|
59
|
+
inline-size: 100%;
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
padding: var(--lyra-space-s) var(--lyra-space-m);
|
|
62
|
+
border: 1px solid var(--lyra-color-border);
|
|
63
|
+
border-radius: var(--lyra-radius);
|
|
64
|
+
background: var(--lyra-color-surface);
|
|
65
|
+
color: inherit;
|
|
66
|
+
font: inherit;
|
|
67
|
+
}
|
|
68
|
+
[part='search-input']:focus-visible {
|
|
69
|
+
outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
|
|
70
|
+
outline-offset: var(--lyra-focus-ring-offset);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
[part='defaults-row'] {
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
gap: var(--lyra-space-xs);
|
|
77
|
+
padding: var(--lyra-space-m) var(--lyra-space-l);
|
|
78
|
+
border-block-end: 1px solid var(--lyra-color-border);
|
|
79
|
+
}
|
|
80
|
+
[part='defaults-hint'] {
|
|
81
|
+
margin: 0;
|
|
82
|
+
padding-inline-start: calc(var(--lyra-icon-button-size) * 0.7);
|
|
83
|
+
font-size: 0.75rem;
|
|
84
|
+
color: var(--lyra-color-text-quiet);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
[part='body'] {
|
|
88
|
+
flex: 1 1 auto;
|
|
89
|
+
min-block-size: 0;
|
|
90
|
+
overflow: auto;
|
|
91
|
+
padding: var(--lyra-space-m) var(--lyra-space-l) var(--lyra-space-l);
|
|
92
|
+
}
|
|
93
|
+
[part='empty'] {
|
|
94
|
+
margin: 0;
|
|
95
|
+
padding: var(--lyra-space-l) 0;
|
|
96
|
+
color: var(--lyra-color-text-quiet);
|
|
97
|
+
font-size: 0.875rem;
|
|
98
|
+
text-align: center;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
[part='category'] {
|
|
102
|
+
margin-block-end: var(--lyra-space-l);
|
|
103
|
+
}
|
|
104
|
+
[part='category']:last-child {
|
|
105
|
+
margin-block-end: 0;
|
|
106
|
+
}
|
|
107
|
+
[part='category-heading'] {
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: baseline;
|
|
110
|
+
gap: var(--lyra-space-xs);
|
|
111
|
+
margin: 0 0 var(--lyra-space-s);
|
|
112
|
+
font-size: 0.75rem;
|
|
113
|
+
font-weight: 700;
|
|
114
|
+
text-transform: uppercase;
|
|
115
|
+
letter-spacing: 0.04em;
|
|
116
|
+
color: var(--lyra-color-text-quiet);
|
|
117
|
+
}
|
|
118
|
+
[part='category-count'] {
|
|
119
|
+
font-weight: 400;
|
|
120
|
+
text-transform: none;
|
|
121
|
+
letter-spacing: normal;
|
|
122
|
+
}
|
|
123
|
+
[part='category-list'] {
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
gap: var(--lyra-space-s);
|
|
127
|
+
margin: 0;
|
|
128
|
+
padding: 0;
|
|
129
|
+
list-style: none;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
[part='tool-row'] {
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
gap: var(--lyra-space-xs);
|
|
136
|
+
}
|
|
137
|
+
[part='tool-row'][data-disabled] [part='tool-checkbox'] {
|
|
138
|
+
opacity: var(--lyra-opacity-disabled);
|
|
139
|
+
}
|
|
140
|
+
[part='tool-checkbox'] {
|
|
141
|
+
align-items: flex-start;
|
|
142
|
+
}
|
|
143
|
+
[part='tool-checkbox']::part(label) {
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
gap: 0.125rem;
|
|
147
|
+
}
|
|
148
|
+
[part='tool-name'] {
|
|
149
|
+
display: inline-flex;
|
|
150
|
+
align-items: center;
|
|
151
|
+
gap: var(--lyra-space-xs);
|
|
152
|
+
font-size: 0.875rem;
|
|
153
|
+
font-weight: 600;
|
|
154
|
+
color: var(--lyra-color-text);
|
|
155
|
+
}
|
|
156
|
+
[part='tool-icon'] {
|
|
157
|
+
line-height: 1;
|
|
158
|
+
}
|
|
159
|
+
[part='tool-description'] {
|
|
160
|
+
display: block;
|
|
161
|
+
font-size: 0.8125rem;
|
|
162
|
+
color: var(--lyra-color-text-quiet);
|
|
163
|
+
}
|
|
164
|
+
[part='tool-disabled-reason'] {
|
|
165
|
+
margin: 0;
|
|
166
|
+
padding-inline-start: calc(var(--lyra-icon-button-size) * 0.7);
|
|
167
|
+
font-size: 0.75rem;
|
|
168
|
+
color: var(--lyra-color-warning);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
[part='footer'] {
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
justify-content: flex-end;
|
|
175
|
+
gap: var(--lyra-space-s);
|
|
176
|
+
padding: var(--lyra-space-m) var(--lyra-space-l);
|
|
177
|
+
border-block-start: 1px solid var(--lyra-color-border);
|
|
178
|
+
}
|
|
179
|
+
[part='footer'][hidden] {
|
|
180
|
+
display: none;
|
|
181
|
+
}
|
|
182
|
+
`;
|
|
@@ -14,7 +14,7 @@ import type { TreeItem } from './tree.js';
|
|
|
14
14
|
*
|
|
15
15
|
* @customElement lyra-tree-node
|
|
16
16
|
* @event lyra-node-toggle - `detail: { id, expanded }`, fired when this node is expanded or collapsed (via `expand()`/`collapse()`, the toggle button, or ArrowRight/ArrowLeft).
|
|
17
|
-
* @event lyra-node-select - `detail: { id }`, fired when this node's primary action is activated (via `select()`, clicking its
|
|
17
|
+
* @event lyra-node-select - `detail: { id }`, fired when this node's primary action is activated (via `select()`, clicking anywhere in its row, or Enter/Space).
|
|
18
18
|
* @csspart row, toggle, label, badge
|
|
19
19
|
*/
|
|
20
20
|
export declare class LyraTreeNode extends LyraElement {
|
|
@@ -32,7 +32,16 @@ export declare class LyraTreeNode extends LyraElement {
|
|
|
32
32
|
expand(): void;
|
|
33
33
|
/** Collapse this node (no-op if already collapsed or a leaf). */
|
|
34
34
|
collapse(): void;
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Fire this item's primary "select" action (Enter/Space, or clicking
|
|
37
|
+
* anywhere in the row). Emits *before* calling `.focus()`: `<lyra-tree>`'s
|
|
38
|
+
* `onNodeActivate` listener for `lyra-node-select` runs synchronously
|
|
39
|
+
* (native `dispatchEvent` is sync) and updates `activeId`, which pushes
|
|
40
|
+
* `tabIndex = 0` down onto this node via its own render -- calling
|
|
41
|
+
* `.focus()` after that emit, rather than before, means real DOM focus
|
|
42
|
+
* lands correctly the very first time a previously-inactive node is
|
|
43
|
+
* clicked, not one render late.
|
|
44
|
+
*/
|
|
36
45
|
select(): void;
|
|
37
46
|
/** See `cascadeUpdateComplete` and the matching override on `<lyra-tree>`. */
|
|
38
47
|
protected getUpdateComplete(): Promise<boolean>;
|