@aceshooting/lyra-ui 2.4.0 → 2.6.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 +34 -4
- package/custom-elements.json +959 -89
- package/dist/components/app-rail/app-rail-item.class.d.ts.map +1 -1
- package/dist/components/app-rail/app-rail-item.class.js +6 -1
- package/dist/components/app-rail/app-rail-item.class.js.map +1 -1
- package/dist/components/app-rail/app-rail.class.js +1 -1
- package/dist/components/app-rail/app-rail.class.js.map +1 -1
- package/dist/components/attachment-chip/attachment-chip.class.d.ts.map +1 -1
- package/dist/components/attachment-chip/attachment-chip.class.js +13 -5
- package/dist/components/attachment-chip/attachment-chip.class.js.map +1 -1
- package/dist/components/attachment-trigger/attachment-trigger.class.d.ts +4 -4
- package/dist/components/attachment-trigger/attachment-trigger.class.d.ts.map +1 -1
- package/dist/components/attachment-trigger/attachment-trigger.class.js +8 -7
- package/dist/components/attachment-trigger/attachment-trigger.class.js.map +1 -1
- package/dist/components/avatar/avatar.class.d.ts +26 -12
- package/dist/components/avatar/avatar.class.d.ts.map +1 -1
- package/dist/components/avatar/avatar.class.js +60 -13
- package/dist/components/avatar/avatar.class.js.map +1 -1
- package/dist/components/avatar/avatar.styles.d.ts.map +1 -1
- package/dist/components/avatar/avatar.styles.js +16 -1
- package/dist/components/avatar/avatar.styles.js.map +1 -1
- package/dist/components/chart/box-plot.class.d.ts.map +1 -1
- package/dist/components/chart/box-plot.class.js +26 -14
- package/dist/components/chart/box-plot.class.js.map +1 -1
- package/dist/components/chart/chart.class.d.ts.map +1 -1
- package/dist/components/chart/chart.class.js +21 -6
- package/dist/components/chart/chart.class.js.map +1 -1
- package/dist/components/chart/histogram.class.d.ts +1 -0
- package/dist/components/chart/histogram.class.d.ts.map +1 -1
- package/dist/components/chart/histogram.class.js +8 -2
- package/dist/components/chart/histogram.class.js.map +1 -1
- package/dist/components/chart/lite-chart.class.d.ts +5 -3
- package/dist/components/chart/lite-chart.class.d.ts.map +1 -1
- package/dist/components/chart/lite-chart.class.js +27 -18
- package/dist/components/chart/lite-chart.class.js.map +1 -1
- package/dist/components/chart/lite-chart.d.ts +1 -0
- package/dist/components/chart/lite-chart.d.ts.map +1 -1
- package/dist/components/chart/lite-chart.js +1 -0
- package/dist/components/chart/lite-chart.js.map +1 -1
- package/dist/components/chart/lite-chart.styles.js +7 -7
- package/dist/components/chat-composer/chat-composer.class.js +1 -1
- package/dist/components/chat-composer/chat-composer.class.js.map +1 -1
- package/dist/components/chat-message/chat-message.class.d.ts +8 -1
- package/dist/components/chat-message/chat-message.class.d.ts.map +1 -1
- package/dist/components/chat-message/chat-message.class.js +16 -7
- package/dist/components/chat-message/chat-message.class.js.map +1 -1
- package/dist/components/chat-message/chat-message.styles.d.ts.map +1 -1
- package/dist/components/chat-message/chat-message.styles.js +15 -0
- package/dist/components/chat-message/chat-message.styles.js.map +1 -1
- package/dist/components/checkbox/checkbox.class.d.ts.map +1 -1
- package/dist/components/checkbox/checkbox.class.js +1 -1
- package/dist/components/checkbox/checkbox.class.js.map +1 -1
- package/dist/components/chip/chip-group.class.d.ts +4 -1
- package/dist/components/chip/chip-group.class.d.ts.map +1 -1
- package/dist/components/chip/chip-group.class.js.map +1 -1
- package/dist/components/chip/chip.class.d.ts +31 -13
- package/dist/components/chip/chip.class.d.ts.map +1 -1
- package/dist/components/chip/chip.class.js +46 -18
- package/dist/components/chip/chip.class.js.map +1 -1
- package/dist/components/chip/chip.styles.d.ts.map +1 -1
- package/dist/components/chip/chip.styles.js +6 -1
- package/dist/components/chip/chip.styles.js.map +1 -1
- package/dist/components/citation-badge/citation-badge.class.d.ts +5 -1
- package/dist/components/citation-badge/citation-badge.class.d.ts.map +1 -1
- package/dist/components/citation-badge/citation-badge.class.js +15 -12
- package/dist/components/citation-badge/citation-badge.class.js.map +1 -1
- package/dist/components/code-block/code-block-core.class.d.ts +3 -0
- package/dist/components/code-block/code-block-core.class.d.ts.map +1 -1
- package/dist/components/code-block/code-block-core.class.js +4 -3
- package/dist/components/code-block/code-block-core.class.js.map +1 -1
- package/dist/components/code-block/code-block-shared.d.ts +18 -0
- package/dist/components/code-block/code-block-shared.d.ts.map +1 -0
- package/dist/components/code-block/code-block-shared.js +21 -0
- package/dist/components/code-block/code-block-shared.js.map +1 -0
- package/dist/components/code-block/code-block.class.d.ts +3 -0
- package/dist/components/code-block/code-block.class.d.ts.map +1 -1
- package/dist/components/code-block/code-block.class.js +4 -10
- package/dist/components/code-block/code-block.class.js.map +1 -1
- package/dist/components/code-block/code-block.styles.d.ts.map +1 -1
- package/dist/components/code-block/code-block.styles.js +9 -0
- package/dist/components/code-block/code-block.styles.js.map +1 -1
- package/dist/components/combobox/combobox.class.d.ts +3 -2
- package/dist/components/combobox/combobox.class.d.ts.map +1 -1
- package/dist/components/combobox/combobox.class.js +15 -13
- package/dist/components/combobox/combobox.class.js.map +1 -1
- package/dist/components/combobox/combobox.styles.d.ts.map +1 -1
- package/dist/components/combobox/combobox.styles.js +3 -0
- package/dist/components/combobox/combobox.styles.js.map +1 -1
- package/dist/components/context-meter/context-meter.class.d.ts +7 -0
- package/dist/components/context-meter/context-meter.class.d.ts.map +1 -1
- package/dist/components/context-meter/context-meter.class.js +30 -12
- package/dist/components/context-meter/context-meter.class.js.map +1 -1
- package/dist/components/conversation-item/conversation-item.class.js +2 -2
- package/dist/components/conversation-item/conversation-item.class.js.map +1 -1
- package/dist/components/date-picker/date-input.class.d.ts +3 -1
- package/dist/components/date-picker/date-input.class.d.ts.map +1 -1
- package/dist/components/date-picker/date-input.class.js +16 -9
- package/dist/components/date-picker/date-input.class.js.map +1 -1
- package/dist/components/date-picker/date-picker.class.d.ts +6 -2
- package/dist/components/date-picker/date-picker.class.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.class.js +23 -6
- package/dist/components/date-picker/date-picker.class.js.map +1 -1
- package/dist/components/date-picker/date-picker.styles.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.styles.js +16 -1
- package/dist/components/date-picker/date-picker.styles.js.map +1 -1
- package/dist/components/dialog/confirm.d.ts +2 -2
- package/dist/components/dialog/confirm.d.ts.map +1 -1
- package/dist/components/dialog/confirm.js +10 -7
- package/dist/components/dialog/confirm.js.map +1 -1
- package/dist/components/diff-view/diff-view.class.d.ts +3 -0
- package/dist/components/diff-view/diff-view.class.d.ts.map +1 -1
- package/dist/components/diff-view/diff-view.class.js +24 -3
- package/dist/components/diff-view/diff-view.class.js.map +1 -1
- package/dist/components/dock-panel/dock-panel.class.js +2 -2
- package/dist/components/dock-panel/dock-panel.class.js.map +1 -1
- package/dist/components/document-preview/document-preview.class.d.ts.map +1 -1
- package/dist/components/document-preview/document-preview.class.js +11 -11
- package/dist/components/document-preview/document-preview.class.js.map +1 -1
- package/dist/components/document-preview/document-preview.styles.d.ts.map +1 -1
- package/dist/components/document-preview/document-preview.styles.js +6 -1
- package/dist/components/document-preview/document-preview.styles.js.map +1 -1
- package/dist/components/empty/empty.styles.js +1 -1
- package/dist/components/export-button/export-button.class.d.ts +17 -1
- package/dist/components/export-button/export-button.class.d.ts.map +1 -1
- package/dist/components/export-button/export-button.class.js +36 -4
- package/dist/components/export-button/export-button.class.js.map +1 -1
- package/dist/components/file-input/file-input.class.d.ts +4 -0
- package/dist/components/file-input/file-input.class.d.ts.map +1 -1
- package/dist/components/file-input/file-input.class.js +16 -6
- package/dist/components/file-input/file-input.class.js.map +1 -1
- package/dist/components/file-input/file-input.styles.d.ts.map +1 -1
- package/dist/components/file-input/file-input.styles.js +0 -7
- package/dist/components/file-input/file-input.styles.js.map +1 -1
- package/dist/components/gauge/gauge.class.d.ts.map +1 -1
- package/dist/components/gauge/gauge.class.js +16 -6
- package/dist/components/gauge/gauge.class.js.map +1 -1
- package/dist/components/generation-status/generation-status.class.d.ts.map +1 -1
- package/dist/components/generation-status/generation-status.class.js +39 -20
- package/dist/components/generation-status/generation-status.class.js.map +1 -1
- package/dist/components/graph/graph.class.d.ts +10 -0
- package/dist/components/graph/graph.class.d.ts.map +1 -1
- package/dist/components/graph/graph.class.js +35 -9
- package/dist/components/graph/graph.class.js.map +1 -1
- package/dist/components/graph/graph.styles.d.ts.map +1 -1
- package/dist/components/graph/graph.styles.js +4 -0
- package/dist/components/graph/graph.styles.js.map +1 -1
- package/dist/components/heatmap/heatmap.class.d.ts +34 -11
- package/dist/components/heatmap/heatmap.class.d.ts.map +1 -1
- package/dist/components/heatmap/heatmap.class.js +80 -27
- package/dist/components/heatmap/heatmap.class.js.map +1 -1
- package/dist/components/heatmap/heatmap.styles.js +1 -1
- package/dist/components/json-viewer/json-viewer.class.d.ts.map +1 -1
- package/dist/components/json-viewer/json-viewer.class.js +20 -5
- package/dist/components/json-viewer/json-viewer.class.js.map +1 -1
- package/dist/components/kbd/kbd.class.d.ts +13 -3
- package/dist/components/kbd/kbd.class.d.ts.map +1 -1
- package/dist/components/kbd/kbd.class.js +57 -33
- package/dist/components/kbd/kbd.class.js.map +1 -1
- package/dist/components/map/map.class.d.ts +4 -0
- package/dist/components/map/map.class.d.ts.map +1 -1
- package/dist/components/map/map.class.js +24 -2
- package/dist/components/map/map.class.js.map +1 -1
- package/dist/components/map/map.styles.d.ts.map +1 -1
- package/dist/components/map/map.styles.js +5 -0
- package/dist/components/map/map.styles.js.map +1 -1
- package/dist/components/markdown/markdown.class.d.ts +3 -0
- package/dist/components/markdown/markdown.class.d.ts.map +1 -1
- package/dist/components/markdown/markdown.class.js +3 -0
- package/dist/components/markdown/markdown.class.js.map +1 -1
- package/dist/components/media-card/media-card.class.d.ts +4 -1
- package/dist/components/media-card/media-card.class.d.ts.map +1 -1
- package/dist/components/media-card/media-card.class.js +6 -4
- package/dist/components/media-card/media-card.class.js.map +1 -1
- package/dist/components/mention-popover/mention-popover.class.d.ts +9 -0
- package/dist/components/mention-popover/mention-popover.class.d.ts.map +1 -1
- package/dist/components/mention-popover/mention-popover.class.js +14 -2
- package/dist/components/mention-popover/mention-popover.class.js.map +1 -1
- package/dist/components/menu/menu.class.d.ts +21 -2
- package/dist/components/menu/menu.class.d.ts.map +1 -1
- package/dist/components/menu/menu.class.js +40 -9
- package/dist/components/menu/menu.class.js.map +1 -1
- package/dist/components/model-select/model-select.class.d.ts +9 -0
- package/dist/components/model-select/model-select.class.d.ts.map +1 -1
- package/dist/components/model-select/model-select.class.js +19 -4
- package/dist/components/model-select/model-select.class.js.map +1 -1
- package/dist/components/model-settings-panel/model-settings-panel.class.d.ts.map +1 -1
- package/dist/components/model-settings-panel/model-settings-panel.class.js +4 -3
- package/dist/components/model-settings-panel/model-settings-panel.class.js.map +1 -1
- package/dist/components/playback/playback.class.d.ts +4 -0
- package/dist/components/playback/playback.class.d.ts.map +1 -1
- package/dist/components/playback/playback.class.js +6 -2
- package/dist/components/playback/playback.class.js.map +1 -1
- package/dist/components/poll-status/poll-status.class.d.ts +3 -2
- package/dist/components/poll-status/poll-status.class.d.ts.map +1 -1
- package/dist/components/poll-status/poll-status.class.js +10 -7
- package/dist/components/poll-status/poll-status.class.js.map +1 -1
- package/dist/components/poll-status/poll-status.styles.d.ts.map +1 -1
- package/dist/components/poll-status/poll-status.styles.js +7 -1
- package/dist/components/poll-status/poll-status.styles.js.map +1 -1
- package/dist/components/segmented/segmented.class.d.ts +9 -0
- package/dist/components/segmented/segmented.class.d.ts.map +1 -1
- package/dist/components/segmented/segmented.class.js +13 -3
- package/dist/components/segmented/segmented.class.js.map +1 -1
- package/dist/components/segmented/segmented.styles.d.ts.map +1 -1
- package/dist/components/segmented/segmented.styles.js +7 -0
- package/dist/components/segmented/segmented.styles.js.map +1 -1
- package/dist/components/select/select.class.d.ts +7 -1
- package/dist/components/select/select.class.d.ts.map +1 -1
- package/dist/components/select/select.class.js +14 -4
- package/dist/components/select/select.class.js.map +1 -1
- package/dist/components/skeleton/skeleton.class.d.ts.map +1 -1
- package/dist/components/skeleton/skeleton.class.js +2 -1
- package/dist/components/skeleton/skeleton.class.js.map +1 -1
- package/dist/components/skeleton/skeleton.styles.d.ts.map +1 -1
- package/dist/components/skeleton/skeleton.styles.js +1 -0
- package/dist/components/skeleton/skeleton.styles.js.map +1 -1
- package/dist/components/source-card/source-card.class.d.ts +5 -1
- package/dist/components/source-card/source-card.class.d.ts.map +1 -1
- package/dist/components/source-card/source-card.class.js.map +1 -1
- package/dist/components/source-list/source-list.class.d.ts +8 -7
- package/dist/components/source-list/source-list.class.d.ts.map +1 -1
- package/dist/components/source-list/source-list.class.js +9 -8
- package/dist/components/source-list/source-list.class.js.map +1 -1
- package/dist/components/source-list/source-list.styles.d.ts.map +1 -1
- package/dist/components/source-list/source-list.styles.js +10 -0
- package/dist/components/source-list/source-list.styles.js.map +1 -1
- package/dist/components/sparkline/sparkline.styles.js +2 -2
- package/dist/components/split/split.class.d.ts +1 -1
- package/dist/components/split/split.class.d.ts.map +1 -1
- package/dist/components/split/split.class.js +6 -1
- package/dist/components/split/split.class.js.map +1 -1
- package/dist/components/stat/stat.class.js +2 -2
- package/dist/components/stat/stat.class.js.map +1 -1
- package/dist/components/stepper/stepper.class.d.ts +6 -1
- package/dist/components/stepper/stepper.class.d.ts.map +1 -1
- package/dist/components/stepper/stepper.class.js +4 -1
- package/dist/components/stepper/stepper.class.js.map +1 -1
- package/dist/components/stream-status/stream-status.class.d.ts.map +1 -1
- package/dist/components/stream-status/stream-status.class.js +5 -11
- package/dist/components/stream-status/stream-status.class.js.map +1 -1
- package/dist/components/stream-status/stream-status.styles.d.ts.map +1 -1
- package/dist/components/stream-status/stream-status.styles.js +4 -5
- package/dist/components/stream-status/stream-status.styles.js.map +1 -1
- package/dist/components/switch/switch.class.d.ts.map +1 -1
- package/dist/components/switch/switch.class.js +1 -1
- package/dist/components/switch/switch.class.js.map +1 -1
- package/dist/components/table/table.class.d.ts +12 -0
- package/dist/components/table/table.class.d.ts.map +1 -1
- package/dist/components/table/table.class.js +13 -2
- package/dist/components/table/table.class.js.map +1 -1
- package/dist/components/table/table.styles.d.ts.map +1 -1
- package/dist/components/table/table.styles.js +3 -0
- package/dist/components/table/table.styles.js.map +1 -1
- package/dist/components/textarea/textarea.class.d.ts +48 -0
- package/dist/components/textarea/textarea.class.d.ts.map +1 -0
- package/dist/components/textarea/textarea.class.js +80 -0
- package/dist/components/textarea/textarea.class.js.map +1 -0
- package/dist/components/textarea/textarea.d.ts +2 -0
- package/dist/components/textarea/textarea.d.ts.map +1 -0
- package/dist/components/textarea/textarea.js +5 -0
- package/dist/components/textarea/textarea.js.map +1 -0
- package/dist/components/textarea/textarea.styles.d.ts +2 -0
- package/dist/components/textarea/textarea.styles.d.ts.map +1 -0
- package/dist/components/textarea/textarea.styles.js +31 -0
- package/dist/components/textarea/textarea.styles.js.map +1 -0
- package/dist/components/thinking-panel/thinking-panel.class.d.ts +2 -1
- package/dist/components/thinking-panel/thinking-panel.class.d.ts.map +1 -1
- package/dist/components/thinking-panel/thinking-panel.class.js +14 -5
- package/dist/components/thinking-panel/thinking-panel.class.js.map +1 -1
- package/dist/components/time-range/time-range.class.d.ts +8 -3
- package/dist/components/time-range/time-range.class.d.ts.map +1 -1
- package/dist/components/time-range/time-range.class.js +10 -5
- package/dist/components/time-range/time-range.class.js.map +1 -1
- package/dist/components/time-range/time-range.styles.d.ts.map +1 -1
- package/dist/components/time-range/time-range.styles.js +16 -0
- package/dist/components/time-range/time-range.styles.js.map +1 -1
- package/dist/components/toast/toast-item.class.js +2 -2
- package/dist/components/toast/toast-item.class.js.map +1 -1
- package/dist/components/tool-approval-dialog/tool-approval-dialog.class.d.ts.map +1 -1
- package/dist/components/tool-approval-dialog/tool-approval-dialog.class.js +11 -6
- package/dist/components/tool-approval-dialog/tool-approval-dialog.class.js.map +1 -1
- package/dist/components/tool-call-chip/tool-call-chip.class.d.ts +8 -4
- package/dist/components/tool-call-chip/tool-call-chip.class.d.ts.map +1 -1
- package/dist/components/tool-call-chip/tool-call-chip.class.js +46 -16
- package/dist/components/tool-call-chip/tool-call-chip.class.js.map +1 -1
- package/dist/components/tool-param-form/tool-param-form.class.d.ts +3 -0
- package/dist/components/tool-param-form/tool-param-form.class.d.ts.map +1 -1
- package/dist/components/tool-param-form/tool-param-form.class.js +21 -16
- package/dist/components/tool-param-form/tool-param-form.class.js.map +1 -1
- package/dist/components/tool-param-form/tool-param-form.styles.d.ts.map +1 -1
- package/dist/components/tool-param-form/tool-param-form.styles.js +5 -0
- package/dist/components/tool-param-form/tool-param-form.styles.js.map +1 -1
- package/dist/components/tool-result-dialog/tool-result-dialog.class.d.ts +5 -5
- package/dist/components/tool-result-dialog/tool-result-dialog.class.d.ts.map +1 -1
- package/dist/components/tool-result-dialog/tool-result-dialog.class.js +18 -10
- package/dist/components/tool-result-dialog/tool-result-dialog.class.js.map +1 -1
- package/dist/components/tool-result-view/registry.d.ts +3 -3
- package/dist/components/tool-result-view/registry.js +3 -3
- package/dist/components/tool-select-dialog/tool-select-dialog.class.d.ts.map +1 -1
- package/dist/components/tool-select-dialog/tool-select-dialog.class.js +27 -9
- package/dist/components/tool-select-dialog/tool-select-dialog.class.js.map +1 -1
- package/dist/components/tree/tree-node.class.d.ts +1 -0
- package/dist/components/tree/tree-node.class.d.ts.map +1 -1
- package/dist/components/tree/tree-node.class.js +3 -66
- package/dist/components/tree/tree-node.class.js.map +1 -1
- package/dist/components/tree/tree-node.styles.d.ts +2 -0
- package/dist/components/tree/tree-node.styles.d.ts.map +1 -0
- package/dist/components/tree/tree-node.styles.js +68 -0
- package/dist/components/tree/tree-node.styles.js.map +1 -0
- package/dist/components/tree/tree.class.d.ts +3 -1
- package/dist/components/tree/tree.class.d.ts.map +1 -1
- package/dist/components/tree/tree.class.js +6 -1
- package/dist/components/tree/tree.class.js.map +1 -1
- package/dist/components/typing-indicator/typing-indicator.class.d.ts +14 -11
- package/dist/components/typing-indicator/typing-indicator.class.d.ts.map +1 -1
- package/dist/components/typing-indicator/typing-indicator.class.js +16 -12
- package/dist/components/typing-indicator/typing-indicator.class.js.map +1 -1
- package/dist/components/typing-indicator/typing-indicator.styles.js +18 -18
- package/dist/components/typing-indicator/typing-indicator.styles.js.map +1 -1
- package/dist/components/widget/widget.class.d.ts +39 -8
- package/dist/components/widget/widget.class.d.ts.map +1 -1
- package/dist/components/widget/widget.class.js +58 -17
- package/dist/components/widget/widget.class.js.map +1 -1
- package/dist/components/widget/widget.styles.d.ts.map +1 -1
- package/dist/components/widget/widget.styles.js +3 -2
- package/dist/components/widget/widget.styles.js.map +1 -1
- package/dist/components/word-cloud/word-cloud.class.d.ts +6 -0
- package/dist/components/word-cloud/word-cloud.class.d.ts.map +1 -1
- package/dist/components/word-cloud/word-cloud.class.js +22 -8
- package/dist/components/word-cloud/word-cloud.class.js.map +1 -1
- package/dist/internal/group-by-recency.d.ts +3 -2
- package/dist/internal/group-by-recency.d.ts.map +1 -1
- package/dist/internal/group-by-recency.js.map +1 -1
- package/dist/internal/localization.d.ts +1 -1
- package/dist/internal/localization.d.ts.map +1 -1
- package/dist/internal/localization.js +205 -0
- package/dist/internal/localization.js.map +1 -1
- package/dist/internal/root-registration-allowlist.d.ts +1 -1
- package/dist/internal/root-registration-allowlist.d.ts.map +1 -1
- package/dist/internal/root-registration-allowlist.js +1 -0
- package/dist/internal/root-registration-allowlist.js.map +1 -1
- package/dist/internal/tokens.styles.d.ts.map +1 -1
- package/dist/internal/tokens.styles.js +6 -2
- package/dist/internal/tokens.styles.js.map +1 -1
- package/dist/lyra.d.ts +17 -0
- package/dist/lyra.d.ts.map +1 -1
- package/dist/lyra.js +2 -0
- package/dist/lyra.js.map +1 -1
- package/llms-full.txt +48 -4
- package/llms.txt +1 -1
- package/package.json +4 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TemplateResult } from 'lit';
|
|
1
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
2
|
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
3
|
export type ChipTone = 'neutral' | 'brand' | 'success' | 'warning' | 'danger';
|
|
4
4
|
export interface ChipRemoveDetail {
|
|
@@ -8,6 +8,10 @@ export interface ChipSelectDetail {
|
|
|
8
8
|
value?: string;
|
|
9
9
|
selected: boolean;
|
|
10
10
|
}
|
|
11
|
+
export interface LyraChipEventMap {
|
|
12
|
+
'lyra-remove': CustomEvent<ChipRemoveDetail>;
|
|
13
|
+
'lyra-chip-select': CustomEvent<ChipSelectDetail>;
|
|
14
|
+
}
|
|
11
15
|
/**
|
|
12
16
|
* `<lyra-chip>` — a small, content-agnostic pill for a short label: a tag, an
|
|
13
17
|
* active-filter/scope indicator, etc. Distinct from `<lyra-attachment-chip>`
|
|
@@ -38,35 +42,49 @@ export interface ChipSelectDetail {
|
|
|
38
42
|
* Enter/Space while focused — native `<button>` behavior). `detail: { value }`
|
|
39
43
|
* — `value` is `undefined` when the `value` prop was never set. Only
|
|
40
44
|
* rendered while `removable`.
|
|
41
|
-
* @event lyra-chip-select - Fired on click, or Enter/Space while focused,
|
|
42
|
-
*
|
|
43
|
-
* toggled its own `selected` state by the
|
|
45
|
+
* @event lyra-chip-select - Fired on click, or Enter/Space while focused, once the chip has
|
|
46
|
+
* opted into toggle mode (via `selected` or `toggleable`) and `removable` is not set.
|
|
47
|
+
* `detail: { value, selected }` -- the chip has already toggled its own `selected` state by the
|
|
48
|
+
* time this fires.
|
|
44
49
|
* @csspart base - The pill's root container.
|
|
45
50
|
* @csspart icon - Wrapper around the `icon` slot. Hidden entirely while empty.
|
|
46
51
|
* @csspart label - Wrapper around the default slot.
|
|
47
52
|
* @csspart remove-button - The remove (×) affordance, only rendered while `removable`.
|
|
48
53
|
*/
|
|
49
|
-
export declare class LyraChip extends LyraElement {
|
|
54
|
+
export declare class LyraChip extends LyraElement<LyraChipEventMap> {
|
|
50
55
|
static styles: import("lit").CSSResultGroup[];
|
|
51
56
|
/** Status/emphasis color. `neutral` (the default) reads as plain/unstyled. */
|
|
52
57
|
tone: ChipTone;
|
|
53
58
|
/** Shows the remove (×) button. */
|
|
54
59
|
removable: boolean;
|
|
55
|
-
/** Opt-in toggle/pressed mode --
|
|
60
|
+
/** Opt-in toggle/pressed mode -- the current pressed value. Setting `selected` (to `true`, the
|
|
61
|
+
* common way to start a chip already pressed) opts the chip into toggle mode automatically, so
|
|
62
|
+
* `<lyra-chip selected>` alone is enough: `[part='base']` becomes focusable and
|
|
56
63
|
* keyboard-activatable (Enter/Space, mirroring native `<button>` behavior), reflects
|
|
57
|
-
* `aria-pressed`, and toggles on click/activation, emitting `lyra-chip-select`.
|
|
58
|
-
* (
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* `
|
|
64
|
+
* `aria-pressed`, and toggles on click/activation, emitting `lyra-chip-select`. That opt-in
|
|
65
|
+
* (tracked by `toggleable`, see below) persists once made, so toggling `selected` back to
|
|
66
|
+
* `false` never strips the chip's interactivity -- a chip a user has clicked "off" must stay
|
|
67
|
+
* clickable to turn it back "on". Has no effect (no interactive semantics added to
|
|
68
|
+
* `[part='base']`) when combined with `removable`, since the remove button already nests inside
|
|
69
|
+
* `[part='base']` -- axe-core's `nested-interactive` rule forbids a focusable descendant of a
|
|
70
|
+
* `role="button"` ancestor, and this component's two real use cases (a chart-series visibility
|
|
71
|
+
* toggle, a category filter chip) never need both at once. `false` (the default, with
|
|
72
|
+
* `toggleable` also left at its default) reproduces today's exact passive-label-pill output. */
|
|
63
73
|
selected: boolean;
|
|
74
|
+
/** Explicit opt-in into `selected`'s toggle/pressed interactive mode, independent of the
|
|
75
|
+
* *current* value of `selected`. Setting `selected` to `true` at any point opts in
|
|
76
|
+
* automatically (see its doc comment) and keeps this `true` from then on, which is enough for
|
|
77
|
+
* a chip that starts already pressed. Set `toggleable` directly for a chip that must be
|
|
78
|
+
* clickable from the outset while starting **unselected** -- e.g. an initially-inactive
|
|
79
|
+
* category filter chip -- since `selected`'s own default (`false`) can't be distinguished from
|
|
80
|
+
* "never opted in" on its own. */
|
|
81
|
+
toggleable: boolean;
|
|
64
82
|
/** Opaque consumer bookkeeping value — never read, validated, or rendered
|
|
65
83
|
* by this component itself, only ever echoed back verbatim (including
|
|
66
84
|
* `undefined` if never set) in `lyra-remove`'s detail. */
|
|
67
85
|
value?: string;
|
|
68
86
|
private hasIconSlot;
|
|
69
|
-
protected willUpdate(): void;
|
|
87
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
70
88
|
private onIconSlotChange;
|
|
71
89
|
private get labelText();
|
|
72
90
|
private get accessibleRemoveLabel();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chip.class.d.ts","sourceRoot":"","sources":["../../../src/components/chip/chip.class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"chip.class.d.ts","sourceRoot":"","sources":["../../../src/components/chip/chip.class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE9E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAI7D,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE9E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAC7C,kBAAkB,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAC;CACnD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBAAa,QAAS,SAAQ,WAAW,CAAC,gBAAgB,CAAC;IACzD,MAAM,CAAC,MAAM,iCAAgC;IAE7C,8EAA8E;IACjD,IAAI,EAAE,QAAQ,CAAa;IAExD,mCAAmC;IACS,SAAS,UAAS;IAE9D;;;;;;;;;;;;qGAYiG;IACrD,QAAQ,UAAS;IAE7D;;;;;;uCAMmC;IACS,UAAU,UAAS;IAE/D;;+DAE2D;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IAMlB,OAAO,CAAC,WAAW,CAAS;IAErC,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAWlD;IAED,OAAO,CAAC,gBAAgB,CAEtB;IAWF,OAAO,KAAK,SAAS,GAUpB;IAED,OAAO,KAAK,qBAAqB,GAGhC;IAED,OAAO,CAAC,aAAa,CAEnB;IAEF,OAAO,CAAC,WAAW,CAIjB;IAEF,OAAO,CAAC,aAAa,CAMnB;IAEF,MAAM,IAAI,cAAc,CA0BvB;CACF;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|
|
@@ -39,9 +39,10 @@ import { styles } from './chip.styles.js';
|
|
|
39
39
|
* Enter/Space while focused — native `<button>` behavior). `detail: { value }`
|
|
40
40
|
* — `value` is `undefined` when the `value` prop was never set. Only
|
|
41
41
|
* rendered while `removable`.
|
|
42
|
-
* @event lyra-chip-select - Fired on click, or Enter/Space while focused,
|
|
43
|
-
*
|
|
44
|
-
* toggled its own `selected` state by the
|
|
42
|
+
* @event lyra-chip-select - Fired on click, or Enter/Space while focused, once the chip has
|
|
43
|
+
* opted into toggle mode (via `selected` or `toggleable`) and `removable` is not set.
|
|
44
|
+
* `detail: { value, selected }` -- the chip has already toggled its own `selected` state by the
|
|
45
|
+
* time this fires.
|
|
45
46
|
* @csspart base - The pill's root container.
|
|
46
47
|
* @csspart icon - Wrapper around the `icon` slot. Hidden entirely while empty.
|
|
47
48
|
* @csspart label - Wrapper around the default slot.
|
|
@@ -54,15 +55,28 @@ export class LyraChip extends LyraElement {
|
|
|
54
55
|
this.tone = 'neutral';
|
|
55
56
|
/** Shows the remove (×) button. */
|
|
56
57
|
this.removable = false;
|
|
57
|
-
/** Opt-in toggle/pressed mode --
|
|
58
|
+
/** Opt-in toggle/pressed mode -- the current pressed value. Setting `selected` (to `true`, the
|
|
59
|
+
* common way to start a chip already pressed) opts the chip into toggle mode automatically, so
|
|
60
|
+
* `<lyra-chip selected>` alone is enough: `[part='base']` becomes focusable and
|
|
58
61
|
* keyboard-activatable (Enter/Space, mirroring native `<button>` behavior), reflects
|
|
59
|
-
* `aria-pressed`, and toggles on click/activation, emitting `lyra-chip-select`.
|
|
60
|
-
* (
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* `
|
|
62
|
+
* `aria-pressed`, and toggles on click/activation, emitting `lyra-chip-select`. That opt-in
|
|
63
|
+
* (tracked by `toggleable`, see below) persists once made, so toggling `selected` back to
|
|
64
|
+
* `false` never strips the chip's interactivity -- a chip a user has clicked "off" must stay
|
|
65
|
+
* clickable to turn it back "on". Has no effect (no interactive semantics added to
|
|
66
|
+
* `[part='base']`) when combined with `removable`, since the remove button already nests inside
|
|
67
|
+
* `[part='base']` -- axe-core's `nested-interactive` rule forbids a focusable descendant of a
|
|
68
|
+
* `role="button"` ancestor, and this component's two real use cases (a chart-series visibility
|
|
69
|
+
* toggle, a category filter chip) never need both at once. `false` (the default, with
|
|
70
|
+
* `toggleable` also left at its default) reproduces today's exact passive-label-pill output. */
|
|
65
71
|
this.selected = false;
|
|
72
|
+
/** Explicit opt-in into `selected`'s toggle/pressed interactive mode, independent of the
|
|
73
|
+
* *current* value of `selected`. Setting `selected` to `true` at any point opts in
|
|
74
|
+
* automatically (see its doc comment) and keeps this `true` from then on, which is enough for
|
|
75
|
+
* a chip that starts already pressed. Set `toggleable` directly for a chip that must be
|
|
76
|
+
* clickable from the outset while starting **unselected** -- e.g. an initially-inactive
|
|
77
|
+
* category filter chip -- since `selected`'s own default (`false`) can't be distinguished from
|
|
78
|
+
* "never opted in" on its own. */
|
|
79
|
+
this.toggleable = false;
|
|
66
80
|
// A `[part]` always contains a literal `<slot>` child regardless of
|
|
67
81
|
// assigned content, so `:empty` never matches — real emptiness is tracked
|
|
68
82
|
// in JS instead, the same fix `<lyra-stat>`'s `hasIcon`/
|
|
@@ -90,10 +104,17 @@ export class LyraChip extends LyraElement {
|
|
|
90
104
|
};
|
|
91
105
|
}
|
|
92
106
|
static { this.styles = [LyraElement.styles, styles]; }
|
|
93
|
-
willUpdate() {
|
|
107
|
+
willUpdate(changed) {
|
|
94
108
|
if (!this.hasUpdated) {
|
|
95
109
|
this.hasIconSlot = Array.from(this.children).some((el) => el.getAttribute('slot') === 'icon');
|
|
96
110
|
}
|
|
111
|
+
// Sticky opt-in: once `selected` has been true at any point, `toggleable` latches on and
|
|
112
|
+
// never resets, so toggling `selected` back to false later can't un-opt the chip out of
|
|
113
|
+
// toggle mode. `toggleable` can also be set directly up front for a chip that starts
|
|
114
|
+
// unselected (selected's own default) but must still be interactive from the outset.
|
|
115
|
+
if (changed.has('selected') && this.selected) {
|
|
116
|
+
this.toggleable = true;
|
|
117
|
+
}
|
|
97
118
|
}
|
|
98
119
|
// Only the default slot's own content counts toward the remove button's
|
|
99
120
|
// accessible name — text incidentally living inside the (decorative)
|
|
@@ -114,18 +135,22 @@ export class LyraChip extends LyraElement {
|
|
|
114
135
|
}
|
|
115
136
|
get accessibleRemoveLabel() {
|
|
116
137
|
const text = this.labelText;
|
|
117
|
-
return text ?
|
|
138
|
+
return text ? this.localize('removeWithContext', undefined, { label: text }) : this.localize('remove');
|
|
118
139
|
}
|
|
119
140
|
render() {
|
|
120
|
-
|
|
141
|
+
// `toggleMode` is sticky (see `toggleable`'s doc comment) and gates the chip's structural
|
|
142
|
+
// interactivity, so it survives `selected` toggling back to false. `pressed` tracks only the
|
|
143
|
+
// *current* value, for `aria-pressed`.
|
|
144
|
+
const toggleMode = this.toggleable && !this.removable;
|
|
145
|
+
const pressed = this.selected && !this.removable;
|
|
121
146
|
return html `
|
|
122
147
|
<span
|
|
123
148
|
part="base"
|
|
124
|
-
role=${
|
|
125
|
-
tabindex=${
|
|
126
|
-
aria-pressed=${
|
|
127
|
-
@click=${
|
|
128
|
-
@keydown=${
|
|
149
|
+
role=${toggleMode ? 'button' : nothing}
|
|
150
|
+
tabindex=${toggleMode ? '0' : nothing}
|
|
151
|
+
aria-pressed=${pressed ? 'true' : nothing}
|
|
152
|
+
@click=${toggleMode ? this.onBaseClick : nothing}
|
|
153
|
+
@keydown=${toggleMode ? this.onBaseKeyDown : nothing}
|
|
129
154
|
>
|
|
130
155
|
<span part="icon" aria-hidden="true" ?hidden=${!this.hasIconSlot}>
|
|
131
156
|
<slot name="icon" @slotchange=${this.onIconSlotChange}></slot>
|
|
@@ -149,6 +174,9 @@ __decorate([
|
|
|
149
174
|
__decorate([
|
|
150
175
|
property({ type: Boolean, reflect: true })
|
|
151
176
|
], LyraChip.prototype, "selected", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
property({ type: Boolean, reflect: true })
|
|
179
|
+
], LyraChip.prototype, "toggleable", void 0);
|
|
152
180
|
__decorate([
|
|
153
181
|
property()
|
|
154
182
|
], LyraChip.prototype, "value", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chip.class.js","sourceRoot":"","sources":["../../../src/components/chip/chip.class.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"chip.class.js","sourceRoot":"","sources":["../../../src/components/chip/chip.class.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAA4C,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAkB1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;A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E,OAAO,EAAE,IAAI,EAAE,CAAC;2CAAmB;AAelB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAkB;AASjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAoB;AAKnD;IAAX,QAAQ,EAAE;uCAAgB;AAMV;IAAhB,KAAK,EAAE;6CAA6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chip.styles.d.ts","sourceRoot":"","sources":["../../../src/components/chip/chip.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"chip.styles.d.ts","sourceRoot":"","sources":["../../../src/components/chip/chip.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAwIlB,CAAC"}
|
|
@@ -68,7 +68,12 @@ export const styles = css `
|
|
|
68
68
|
}
|
|
69
69
|
[part='base'][aria-pressed='true'] {
|
|
70
70
|
background: var(--lyra-chip-bg);
|
|
71
|
-
|
|
71
|
+
/* Falls back to --lyra-chip-accent (today's exact value) so every
|
|
72
|
+
existing consumer, including all 4 \`tone\` variants, renders
|
|
73
|
+
byte-identical when unset. A consumer with a per-item arbitrary
|
|
74
|
+
color sets --lyra-chip-pressed-border directly, leaving
|
|
75
|
+
--lyra-chip-accent (and therefore the label text color) untouched. */
|
|
76
|
+
border-color: var(--lyra-chip-pressed-border, var(--lyra-chip-accent));
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
[part='icon'] {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chip.styles.js","sourceRoot":"","sources":["../../../src/components/chip/chip.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"chip.styles.js","sourceRoot":"","sources":["../../../src/components/chip/chip.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwIxB,CAAC"}
|
|
@@ -10,6 +10,10 @@ export interface CitationOpenDetail {
|
|
|
10
10
|
index: number;
|
|
11
11
|
href?: string;
|
|
12
12
|
}
|
|
13
|
+
export interface LyraCitationBadgeEventMap {
|
|
14
|
+
'lyra-citation-activate': CustomEvent<CitationActivateDetail>;
|
|
15
|
+
'lyra-citation-open': CustomEvent<CitationOpenDetail>;
|
|
16
|
+
}
|
|
13
17
|
/**
|
|
14
18
|
* `<lyra-citation-badge>` — an inline `[n]` citation marker with a hover/
|
|
15
19
|
* focus preview popover and confidence/verification-status coloring. Used
|
|
@@ -64,7 +68,7 @@ export interface CitationOpenDetail {
|
|
|
64
68
|
* @csspart index - The citation number.
|
|
65
69
|
* @csspart popover - The floating preview panel (only meaningful while open).
|
|
66
70
|
*/
|
|
67
|
-
export declare class LyraCitationBadge extends LyraElement {
|
|
71
|
+
export declare class LyraCitationBadge extends LyraElement<LyraCitationBadgeEventMap> {
|
|
68
72
|
static styles: import("lit").CSSResultGroup[];
|
|
69
73
|
/** The citation number shown, e.g. `3` renders as `[3]`. */
|
|
70
74
|
index: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"citation-badge.class.d.ts","sourceRoot":"","sources":["../../../src/components/citation-badge/citation-badge.class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE9E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAK7D,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,UAAU,GAAG,YAAY,CAAC;AAEpG,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"citation-badge.class.d.ts","sourceRoot":"","sources":["../../../src/components/citation-badge/citation-badge.class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE9E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAK7D,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,UAAU,GAAG,YAAY,CAAC;AAEpG,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,yBAAyB;IACxC,wBAAwB,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAC9D,oBAAoB,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;CACvD;AAmCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,qBAAa,iBAAkB,SAAQ,WAAW,CAAC,yBAAyB,CAAC;IAC3E,MAAM,CAAC,MAAM,iCAAgC;IAE7C,4DAA4D;IACh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|
11
11
|
import { nextId } from '../../internal/a11y.js';
|
|
12
12
|
import { styles } from './citation-badge.styles.js';
|
|
13
|
-
/**
|
|
14
|
-
* accessible name — `
|
|
15
|
-
* rather than announcing a meaningless
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
/** Localization key for the visible (not just color-coded) status word,
|
|
14
|
+
* folded into the computed accessible name — `null` for `default` omits the
|
|
15
|
+
* status clause entirely rather than announcing a meaningless
|
|
16
|
+
* "Citation 3, Default". */
|
|
17
|
+
const STATUS_MESSAGE_KEY = {
|
|
18
|
+
default: null,
|
|
19
|
+
high: 'citationHighConfidence',
|
|
20
|
+
medium: 'citationMediumConfidence',
|
|
21
|
+
low: 'citationLowConfidence',
|
|
22
|
+
verified: 'citationVerified',
|
|
23
|
+
unverified: 'citationUnverified',
|
|
23
24
|
};
|
|
24
25
|
// A short grace period before the popover actually hides on pointer-leave/
|
|
25
26
|
// focus-out, so moving the mouse from the badge into the popover itself (to
|
|
@@ -213,8 +214,10 @@ export class LyraCitationBadge extends LyraElement {
|
|
|
213
214
|
get accessibleLabel() {
|
|
214
215
|
if (this.label)
|
|
215
216
|
return this.label;
|
|
216
|
-
const
|
|
217
|
-
|
|
217
|
+
const key = STATUS_MESSAGE_KEY[this.status];
|
|
218
|
+
const statusText = key ? this.localize(key) : '';
|
|
219
|
+
const citationLabel = this.localize('citation', undefined, { index: this.index });
|
|
220
|
+
return statusText ? `${citationLabel}, ${statusText}` : citationLabel;
|
|
218
221
|
}
|
|
219
222
|
// Named showPreview/hidePreviewNow (not show/hidePopover) to avoid
|
|
220
223
|
// colliding with the standard HTML Popover API's own
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"citation-badge.class.js","sourceRoot":"","sources":["../../../src/components/citation-badge/citation-badge.class.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAA4C,MAAM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E,WAAW,EAAE,CAAC;mDAAe;AAIxC;IAAX,QAAQ,EAAE;+CAAW;AAGV;IAAX,QAAQ,EAAE;gDAAY;AAMN;IAAhB,KAAK,EAAE;yDAAgC;AACvB;IAAhB,KAAK,EAAE;sDAA6B;AAEL;IAA/B,KAAK,CAAC,eAAe,CAAC;mDAAsC;AAC1B;IAAlC,KAAK,CAAC,kBAAkB,CAAC;oDAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-block-core.class.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/code-block-core.class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAG9E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAI7D,OAAO,EAAqE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"code-block-core.class.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/code-block-core.class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAG9E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAI7D,OAAO,EAAqE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG9H,OAAO,+BAA+B,CAAC;AA4BvC,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,WAAW,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3C,aAAa,EAAE,WAAW,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACpD;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,qBAAa,iBAAkB,SAAQ,WAAW,CAAC,yBAAyB,CAAC;IAC3E,MAAM,CAAC,MAAM,iCAAgC;IAE7C,2BAA2B;IACf,IAAI,SAAM;IAEtB;;;2EAGuE;IAC3D,QAAQ,SAAM;IAE1B,oDAAoD;IACxC,QAAQ,SAAM;IAE1B,oEAAoE;IACxB,WAAW,UAAS;IAEhE;4CACwC;IACI,SAAS,UAAS;IAE9D,sDAAsD;IACV,QAAQ,UAAQ;IAE5D;wDACoD;IACb,SAAS,SAAM;IAEtD;;;4CAGwC;IACR,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAM;IAO1E,OAAO,CAAC,eAAe,CAAuB;IAK9C,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO,CAAC,UAAU,CAAS;IAEpC,OAAO,CAAC,WAAW,CAAC,CAA8B;IAKlD,OAAO,CAAC,cAAc,CAAK;IAE3B,OAAO,CAAC,aAAa,CAAC,CAAgC;IAEtD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;IAEpD,iBAAiB,IAAI,IAAI,CAQxB;IAED,oBAAoB,IAAI,IAAI,CAG3B;IAKD,OAAO,CAAC,kBAAkB;IAS1B,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAKlD;IAED,SAAS,CAAC,OAAO,IAAI,IAAI,CAIxB;IAED,OAAO,CAAC,aAAa;IA0CrB,OAAO,CAAC,QAAQ;IAoBhB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,IAAI,CAQV;IAEF,OAAO,CAAC,eAAe,CAGrB;IAEF,OAAO,CAAC,YAAY;IA4CpB,MAAM,IAAI,cAAc,CA0BvB;CACF;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,sBAAsB,EAAE,iBAAiB,CAAC;KAC3C;CACF"}
|
|
@@ -12,6 +12,7 @@ import { nextId } from '../../internal/a11y.js';
|
|
|
12
12
|
import { chevronIcon } from '../../internal/icons.js';
|
|
13
13
|
import { loadShikiHighlighterCore, SHIKI_THEMES } from './code-loader.js';
|
|
14
14
|
import { styles } from './code-block.styles.js';
|
|
15
|
+
import { codeBlockToggleLabel, codeBlockCopyLabel, codeBlockBodyLabel } from './code-block-shared.js';
|
|
15
16
|
import '../skeleton/skeleton.class.js';
|
|
16
17
|
/** How long the copy button's confirmation state lasts before reverting. */
|
|
17
18
|
const COPY_CONFIRM_MS = 1500;
|
|
@@ -267,7 +268,7 @@ export class LyraCodeBlockCore extends LyraElement {
|
|
|
267
268
|
type="button"
|
|
268
269
|
aria-expanded=${this.collapsed ? 'false' : 'true'}
|
|
269
270
|
aria-controls=${this.bodyId}
|
|
270
|
-
aria-label=${
|
|
271
|
+
aria-label=${codeBlockToggleLabel(this.localize.bind(this), this.collapsed)}
|
|
271
272
|
@click=${this.toggleCollapsed}
|
|
272
273
|
>
|
|
273
274
|
<span class="chevron" aria-hidden="true">${chevronIcon()}</span>
|
|
@@ -281,7 +282,7 @@ export class LyraCodeBlockCore extends LyraElement {
|
|
|
281
282
|
<button
|
|
282
283
|
part="copy-button"
|
|
283
284
|
type="button"
|
|
284
|
-
aria-label=${this.
|
|
285
|
+
aria-label=${codeBlockCopyLabel(this.localize.bind(this), this.justCopied)}
|
|
285
286
|
@click=${this.copy}
|
|
286
287
|
>
|
|
287
288
|
${this.justCopied ? this.localize('copied') : this.localize('copy')}
|
|
@@ -304,7 +305,7 @@ export class LyraCodeBlockCore extends LyraElement {
|
|
|
304
305
|
const hasHeader = !!this.filename || !!this.language || this.copyable || this.collapsible;
|
|
305
306
|
const showSkeleton = !this.shikiReady && !!this.language && !!this.preSuppliedGrammar();
|
|
306
307
|
const bodyHidden = this.collapsible && this.collapsed;
|
|
307
|
-
const bodyLabel = this.
|
|
308
|
+
const bodyLabel = codeBlockBodyLabel(this.localize.bind(this), this.filename, this.language);
|
|
308
309
|
return html `
|
|
309
310
|
<div part="base">
|
|
310
311
|
${hasHeader ? this.renderHeader() : nothing}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-block-core.class.js","sourceRoot":"","sources":["../../../src/components/code-block/code-block-core.class.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAA4C,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAsD,MAAM,kBAAkB,CAAC;AAC9H,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,+BAA+B,CAAC;AAEvC,4EAA4E;AAC5E,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B;;;;;;;;;;;GAWG;AACH,MAAM,eAAe,GAAG;IACtB,IAAI,EAAE,uBAAuB;IAC7B,GAAG,CAAC,IAAqB;QACvB,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;IAClC,CAAC;IACD,IAAI,CAAC,IAAqB;QACxB,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CACF,CAAC;
|
|
1
|
+
{"version":3,"file":"code-block-core.class.js","sourceRoot":"","sources":["../../../src/components/code-block/code-block-core.class.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAA4C,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CA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AI,CAAA,gDAAgD;YACtD,CAAC,CAAC,IAAI,CAAC,eAAe,KAAK,IAAI;gBAC7B,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC;gBAClC,CAAC,CAAC,IAAI,CAAA,qCAAqC,IAAI,CAAC,IAAI,eAAe;;;KAG5E,CAAC;IACJ,CAAC;CACF;AAjQa;IAAX,QAAQ,EAAE;+CAAW;AAMV;IAAX,QAAQ,EAAE;mDAAe;AAGd;IAAX,QAAQ,EAAE;mDAAe;AAGkB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sDAAqB;AAIpB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDAAmB;AAGlB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDAAiB;AAIrB;IAAtC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;oDAAgB;AAMtB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oDAAoD;AAOlE;IAAhB,KAAK,EAAE;0DAA+C;AAKtC;IAAhB,KAAK,EAAE;qDAA4B;AAEnB;IAAhB,KAAK,EAAE;qDAA4B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Localized label helpers shared by `<lyra-code-block>` and
|
|
3
|
+
* `<lyra-code-block-core>`. Both components render an otherwise-identical
|
|
4
|
+
* header/body, and pulling just the `this.localize()` call sites out into
|
|
5
|
+
* one place keeps their i18n behavior from silently drifting apart the way
|
|
6
|
+
* it previously did between the two.
|
|
7
|
+
*/
|
|
8
|
+
/** Matches `LyraElement.localize()`'s signature so either component's bound
|
|
9
|
+
* method can be passed straight through. */
|
|
10
|
+
export type LyraLocalizeFn = (key: string, fallback?: string, values?: Record<string, string | number>) => string;
|
|
11
|
+
/** The collapse/expand header toggle button's `aria-label`. */
|
|
12
|
+
export declare function codeBlockToggleLabel(localize: LyraLocalizeFn, collapsed: boolean): string;
|
|
13
|
+
/** The copy-to-clipboard header button's `aria-label`. */
|
|
14
|
+
export declare function codeBlockCopyLabel(localize: LyraLocalizeFn, justCopied: boolean): string;
|
|
15
|
+
/** The `[part="body"]` region's `aria-label`: the filename when set, else a
|
|
16
|
+
* language-aware "Code" region label. */
|
|
17
|
+
export declare function codeBlockBodyLabel(localize: LyraLocalizeFn, filename: string, language: string): string;
|
|
18
|
+
//# sourceMappingURL=code-block-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-block-shared.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/code-block-shared.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;6CAC6C;AAC7C,MAAM,MAAM,cAAc,GAAG,CAC3B,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KACrC,MAAM,CAAC;AAEZ,+DAA+D;AAC/D,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAEzF;AAED,0DAA0D;AAC1D,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,CAExF;AAED;0CAC0C;AAC1C,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Localized label helpers shared by `<lyra-code-block>` and
|
|
3
|
+
* `<lyra-code-block-core>`. Both components render an otherwise-identical
|
|
4
|
+
* header/body, and pulling just the `this.localize()` call sites out into
|
|
5
|
+
* one place keeps their i18n behavior from silently drifting apart the way
|
|
6
|
+
* it previously did between the two.
|
|
7
|
+
*/
|
|
8
|
+
/** The collapse/expand header toggle button's `aria-label`. */
|
|
9
|
+
export function codeBlockToggleLabel(localize, collapsed) {
|
|
10
|
+
return collapsed ? localize('expandCode') : localize('collapseCode');
|
|
11
|
+
}
|
|
12
|
+
/** The copy-to-clipboard header button's `aria-label`. */
|
|
13
|
+
export function codeBlockCopyLabel(localize, justCopied) {
|
|
14
|
+
return justCopied ? localize('copiedToClipboard') : localize('copyCode');
|
|
15
|
+
}
|
|
16
|
+
/** The `[part="body"]` region's `aria-label`: the filename when set, else a
|
|
17
|
+
* language-aware "Code" region label. */
|
|
18
|
+
export function codeBlockBodyLabel(localize, filename, language) {
|
|
19
|
+
return filename || (language ? localize('codeRegionWithLanguage', undefined, { language }) : localize('codeRegion'));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=code-block-shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-block-shared.js","sourceRoot":"","sources":["../../../src/components/code-block/code-block-shared.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,+DAA+D;AAC/D,MAAM,UAAU,oBAAoB,CAAC,QAAwB,EAAE,SAAkB;IAC/E,OAAO,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;AACvE,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,kBAAkB,CAAC,QAAwB,EAAE,UAAmB;IAC9E,OAAO,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC3E,CAAC;AAED;0CAC0C;AAC1C,MAAM,UAAU,kBAAkB,CAAC,QAAwB,EAAE,QAAgB,EAAE,QAAgB;IAC7F,OAAO,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,wBAAwB,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;AACvH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-block.class.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/code-block.class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAG9E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAI7D,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"code-block.class.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/code-block.class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAG9E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAI7D,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,+BAA+B,CAAC;AA4BvC,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,WAAW,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3C,aAAa,EAAE,WAAW,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACpD;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,qBAAa,aAAc,SAAQ,WAAW,CAAC,qBAAqB,CAAC;IACnE,MAAM,CAAC,MAAM,iCAAgC;IAE7C,2BAA2B;IACf,IAAI,SAAM;IAEtB;;;qCAGiC;IACrB,QAAQ,SAAM;IAE1B,oDAAoD;IACxC,QAAQ,SAAM;IAE1B,oEAAoE;IACxB,WAAW,UAAS;IAEhE;4CACwC;IACI,SAAS,UAAS;IAE9D,sDAAsD;IACV,QAAQ,UAAQ;IAE5D;wDACoD;IACb,SAAS,SAAM;IAEtD;;;;;;;;;;8DAU0D;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAE/E;;;;;;iDAM6C;IACa,aAAa,UAAS;IAMvE,OAAO,CAAC,eAAe,CAAuB;IAK9C,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO,CAAC,UAAU,CAAS;IAEpC,OAAO,CAAC,WAAW,CAAC,CAA0B;IAK9C,OAAO,CAAC,cAAc,CAAK;IAE3B,OAAO,CAAC,aAAa,CAAC,CAAgC;IAEtD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;IAEpD,iBAAiB,IAAI,IAAI,CAQxB;IAED,oBAAoB,IAAI,IAAI,CAG3B;IAMD,OAAO,CAAC,kBAAkB;IAS1B,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAWlD;IAED,SAAS,CAAC,OAAO,IAAI,IAAI,CAOxB;IAED,OAAO,CAAC,aAAa;IA6CrB,OAAO,CAAC,QAAQ;IAoBhB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,IAAI,CAQV;IAEF,OAAO,CAAC,eAAe,CAGrB;IAEF,OAAO,CAAC,YAAY;IA4CpB,MAAM,IAAI,cAAc,CA2BvB;CACF;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,aAAa,CAAC;KAClC;CACF"}
|
|
@@ -12,6 +12,7 @@ import { nextId } from '../../internal/a11y.js';
|
|
|
12
12
|
import { chevronIcon } from '../../internal/icons.js';
|
|
13
13
|
import { loadShikiHighlighter, loadShikiLanguage, loadShikiHighlighterCore, SHIKI_THEMES, } from './code-loader.js';
|
|
14
14
|
import { styles } from './code-block.styles.js';
|
|
15
|
+
import { codeBlockToggleLabel, codeBlockCopyLabel, codeBlockBodyLabel } from './code-block-shared.js';
|
|
15
16
|
import '../skeleton/skeleton.class.js';
|
|
16
17
|
/** How long the copy button's confirmation state lasts before reverting. */
|
|
17
18
|
const COPY_CONFIRM_MS = 1500;
|
|
@@ -298,9 +299,7 @@ export class LyraCodeBlock extends LyraElement {
|
|
|
298
299
|
type="button"
|
|
299
300
|
aria-expanded=${this.collapsed ? 'false' : 'true'}
|
|
300
301
|
aria-controls=${this.bodyId}
|
|
301
|
-
aria-label=${this.collapsed
|
|
302
|
-
? this.localize('expandCode')
|
|
303
|
-
: this.localize('collapseCode')}
|
|
302
|
+
aria-label=${codeBlockToggleLabel(this.localize.bind(this), this.collapsed)}
|
|
304
303
|
@click=${this.toggleCollapsed}
|
|
305
304
|
>
|
|
306
305
|
<span class="chevron" aria-hidden="true">${chevronIcon()}</span>
|
|
@@ -314,9 +313,7 @@ export class LyraCodeBlock extends LyraElement {
|
|
|
314
313
|
<button
|
|
315
314
|
part="copy-button"
|
|
316
315
|
type="button"
|
|
317
|
-
aria-label=${this.justCopied
|
|
318
|
-
? this.localize('copiedToClipboard')
|
|
319
|
-
: this.localize('copyCode')}
|
|
316
|
+
aria-label=${codeBlockCopyLabel(this.localize.bind(this), this.justCopied)}
|
|
320
317
|
@click=${this.copy}
|
|
321
318
|
>
|
|
322
319
|
${this.justCopied ? this.localize('copied') : this.localize('copy')}
|
|
@@ -340,10 +337,7 @@ export class LyraCodeBlock extends LyraElement {
|
|
|
340
337
|
// See updated()'s identical condition for why languagesOnly is excluded here too.
|
|
341
338
|
const showSkeleton = !this.shikiReady && !this.languagesOnly && !!this.language && !this.preSuppliedGrammar();
|
|
342
339
|
const bodyHidden = this.collapsible && this.collapsed;
|
|
343
|
-
const bodyLabel = this.filename
|
|
344
|
-
(this.language
|
|
345
|
-
? this.localize('codeRegionWithLanguage', undefined, { language: this.language })
|
|
346
|
-
: this.localize('codeRegion'));
|
|
340
|
+
const bodyLabel = codeBlockBodyLabel(this.localize.bind(this), this.filename, this.language);
|
|
347
341
|
return html `
|
|
348
342
|
<div part="base">
|
|
349
343
|
${hasHeader ? this.renderHeader() : nothing}
|