@aceshooting/lyra-ui 9.1.1 → 11.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/CHANGELOG.md +785 -0
- package/custom-elements.json +1 -1
- package/design-tokens.json +13 -0
- package/dist/cli/migrate-wa.mjs +216 -1
- package/dist/cli/migration-contract.json +1 -1
- package/dist/components/agent-tools/activity-feed/activity-feed.class.js +1 -1
- package/dist/components/agent-tools/activity-feed/activity-feed.styles.js +0 -16
- package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.js +1 -1
- package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.styles.js +7 -5
- package/dist/components/agent-tools/agent-run/agent-run.class.js +2 -2
- package/dist/components/agent-tools/agent-run/agent-run.styles.js +0 -13
- package/dist/components/agent-tools/agent-trace/agent-trace.styles.js +7 -4
- package/dist/components/agent-tools/approval-queue/approval-queue.styles.js +7 -5
- package/dist/components/agent-tools/artifact-panel/artifact-panel.styles.js +0 -3
- package/dist/components/agent-tools/browser-frame/browser-frame.styles.js +3 -5
- package/dist/components/agent-tools/commit-card/commit-card.styles.js +0 -10
- package/dist/components/agent-tools/compare-panel/compare-panel.styles.js +11 -6
- package/dist/components/agent-tools/confirm-bar/confirm-bar.styles.js +0 -46
- package/dist/components/agent-tools/eval-dataset/eval-dataset.styles.js +0 -7
- package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +2 -2
- package/dist/components/agent-tools/prompt-studio/prompt-studio.styles.js +0 -15
- package/dist/components/agent-tools/result-card/result-card.styles.js +0 -7
- package/dist/components/agent-tools/result-card/result-field.styles.js +0 -5
- package/dist/components/agent-tools/schema-viewer/schema-viewer.styles.js +0 -3
- package/dist/components/agent-tools/span-waterfall/span-waterfall.styles.js +0 -15
- package/dist/components/agent-tools/stack-trace/stack-trace.styles.js +0 -20
- package/dist/components/agent-tools/subagent-panel/subagent-panel.class.js +2 -2
- package/dist/components/agent-tools/subagent-panel/subagent-panel.styles.js +0 -3
- package/dist/components/agent-tools/task-list/task-list.styles.js +0 -15
- package/dist/components/agent-tools/terminal/terminal.class.d.ts +11 -6
- package/dist/components/agent-tools/terminal/terminal.class.js +4 -4
- package/dist/components/agent-tools/terminal/terminal.styles.js +0 -46
- package/dist/components/agent-tools/test-results/test-results.class.js +2 -2
- package/dist/components/agent-tools/test-results/test-results.styles.js +0 -5
- package/dist/components/agent-tools/thinking-panel/thinking-panel.styles.js +0 -41
- package/dist/components/agent-tools/tool-approval-dialog/tool-approval-dialog.styles.js +0 -41
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.styles.js +0 -30
- package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +6 -6
- package/dist/components/agent-tools/tool-param-form/tool-param-form.styles.js +0 -5
- package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.styles.js +0 -20
- package/dist/components/agent-tools/tool-result-view/tool-result-view.styles.js +0 -4
- package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.styles.js +0 -21
- package/dist/components/agent-tools/trace-tree/trace-tree.styles.js +7 -31
- package/dist/components/charts/chart/box-plot.class.d.ts +27 -0
- package/dist/components/charts/chart/box-plot.class.js +14 -4
- package/dist/components/charts/chart/box-plot.styles.js +28 -20
- package/dist/components/charts/chart/chart-colors.d.ts +1 -1
- package/dist/components/charts/chart/chart-colors.js +1 -1
- package/dist/components/charts/chart/chart-core-loader.d.ts +1 -0
- package/dist/components/charts/chart/chart-core-loader.js +1 -1
- package/dist/components/charts/chart/chart-feature-loader.d.ts +35 -0
- package/dist/components/charts/chart/chart-feature-loader.js +1 -1
- package/dist/components/charts/chart/chart.class.d.ts +120 -0
- package/dist/components/charts/chart/chart.class.js +16 -6
- package/dist/components/charts/chart/chart.styles.js +28 -27
- package/dist/components/charts/chart/lite-chart.class.d.ts +20 -1
- package/dist/components/charts/chart/lite-chart.class.js +4 -4
- package/dist/components/charts/chart/lite-chart.styles.js +0 -27
- package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +20 -0
- package/dist/components/conversation/agent-workspace/agent-workspace.class.js +3 -1
- package/dist/components/conversation/agent-workspace/agent-workspace.styles.js +3 -0
- package/dist/components/conversation/audio-visualizer/audio-visualizer.styles.js +0 -7
- package/dist/components/conversation/branch-picker/branch-picker.styles.js +0 -3
- package/dist/components/conversation/chat-composer/chat-composer.styles.js +0 -51
- package/dist/components/conversation/chat-message/chat-message.styles.js +7 -35
- package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
- package/dist/components/conversation/chat-viewport/chat-viewport.styles.js +0 -33
- package/dist/components/conversation/checkpoint/checkpoint.class.js +1 -1
- package/dist/components/conversation/checkpoint/checkpoint.styles.js +0 -3
- package/dist/components/conversation/code-block/code-block-shared.d.ts +5 -2
- package/dist/components/conversation/code-block/code-block.class.js +1 -1
- package/dist/components/conversation/code-block/code-block.styles.js +4 -95
- package/dist/components/conversation/code-block/code-loader.d.ts +11 -0
- package/dist/components/conversation/code-block/code-loader.js +1 -1
- package/dist/components/conversation/code-block/shiki-types.d.ts +12 -0
- package/dist/components/conversation/code-block/shiki-types.js +1 -1
- package/dist/components/conversation/conversation-item/conversation-item.styles.js +8 -54
- package/dist/components/conversation/generation-metrics/generation-metrics.class.js +2 -2
- package/dist/components/conversation/generation-metrics/generation-metrics.styles.js +0 -17
- package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
- package/dist/components/conversation/markdown/markdown.styles.js +0 -41
- package/dist/components/conversation/message-actions/message-actions.styles.js +0 -3
- package/dist/components/conversation/message-feedback/message-feedback.styles.js +0 -35
- package/dist/components/conversation/message-parts/message-parts.class.d.ts +1 -1
- package/dist/components/conversation/message-parts/message-parts.styles.js +0 -5
- package/dist/components/conversation/model-select/model-select.class.js +3 -3
- package/dist/components/conversation/model-select/model-select.styles.js +12 -47
- package/dist/components/conversation/model-settings-panel/model-settings-panel.styles.js +0 -6
- package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +3 -0
- package/dist/components/conversation/prompt-input/prompt-input.styles.js +0 -10
- package/dist/components/conversation/push-to-talk/push-to-talk.styles.js +0 -8
- package/dist/components/conversation/selection-toolbar/selection-toolbar.styles.js +1 -11
- package/dist/components/conversation/stream-status/stream-status.styles.js +0 -16
- package/dist/components/conversation/streaming-text/streaming-text.styles.js +0 -15
- package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +0 -5
- package/dist/components/conversation/thread-list/thread-list.styles.js +0 -23
- package/dist/components/conversation/transcript-feed/transcript-feed.class.d.ts +16 -4
- package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
- package/dist/components/conversation/transcript-feed/transcript-feed.styles.js +0 -1
- package/dist/components/conversation/typing-indicator/typing-indicator.styles.js +0 -23
- package/dist/components/conversation/usage-badge/usage-badge.styles.js +0 -3
- package/dist/components/conversation/voice-picker/voice-picker.class.js +3 -3
- package/dist/components/conversation/voice-picker/voice-picker.styles.js +9 -29
- package/dist/components/conversation/widget-renderer/resolve.d.ts +2 -0
- package/dist/components/conversation/widget-renderer/resolve.js +1 -1
- package/dist/components/data/calendar/calendar.class.d.ts +15 -2
- package/dist/components/data/calendar/calendar.class.js +2 -2
- package/dist/components/data/calendar/calendar.styles.js +2 -28
- package/dist/components/data/condition-builder/condition-builder.class.d.ts +10 -6
- package/dist/components/data/condition-builder/condition-builder.class.js +2 -2
- package/dist/components/data/condition-builder/condition-builder.styles.js +0 -6
- package/dist/components/data/context-meter/context-meter.styles.js +0 -24
- package/dist/components/data/data-grid/data-grid.class.js +3 -3
- package/dist/components/data/data-grid/data-grid.styles.js +0 -22
- package/dist/components/data/document-library/document-library.class.js +2 -2
- package/dist/components/data/document-library/document-library.styles.js +0 -4
- package/dist/components/data/env-list/env-list.class.js +1 -1
- package/dist/components/data/env-list/env-list.styles.js +7 -4
- package/dist/components/data/file-tree/file-tree.class.d.ts +12 -0
- package/dist/components/data/flow-canvas/flow-canvas.styles.js +12 -19
- package/dist/components/data/flow-controls/flow-controls.class.js +2 -2
- package/dist/components/data/flow-controls/flow-controls.styles.js +3 -36
- package/dist/components/data/flow-minimap/flow-minimap.class.js +1 -1
- package/dist/components/data/flow-minimap/flow-minimap.styles.js +0 -9
- package/dist/components/data/flow-node/flow-node.styles.js +0 -23
- package/dist/components/data/flow-run-status/flow-run-status.class.js +1 -1
- package/dist/components/data/flow-run-status/flow-run-status.styles.js +0 -7
- package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +0 -7
- package/dist/components/data/graph-query-builder/graph-query-builder.class.js +1 -1
- package/dist/components/data/graph-query-builder/graph-query-builder.styles.js +0 -10
- package/dist/components/data/heatmap/heatmap-scale.d.ts +20 -0
- package/dist/components/data/heatmap/heatmap-scale.js +1 -1
- package/dist/components/data/heatmap/heatmap.class.d.ts +117 -1
- package/dist/components/data/heatmap/heatmap.class.js +2 -2
- package/dist/components/data/heatmap/heatmap.styles.js +0 -54
- package/dist/components/data/pagination/pagination.styles.js +23 -46
- package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +34 -1
- package/dist/components/data/sequence-strip/sequence-strip.class.js +5 -2
- package/dist/components/data/sequence-strip/sequence-strip.styles.js +14 -20
- package/dist/components/data/sparkline/sparkline.class.js +1 -1
- package/dist/components/data/stat/stat.styles.js +0 -67
- package/dist/components/data/table/table.class.d.ts +42 -3
- package/dist/components/data/table/table.class.js +4 -4
- package/dist/components/data/table/table.styles.js +20 -91
- package/dist/components/data/timeline/timeline-item.styles.js +0 -30
- package/dist/components/data/timeline/timeline.class.d.ts +89 -1
- package/dist/components/data/timeline/timeline.class.js +2 -2
- package/dist/components/data/timeline/timeline.styles.js +111 -31
- package/dist/components/data/tree/tree-item.styles.js +1 -28
- package/dist/components/data/tree/tree.class.js +2 -2
- package/dist/components/data/tree/tree.styles.js +0 -6
- package/dist/components/data/word-cloud/word-cloud.styles.js +0 -5
- package/dist/components/forms/button/button.class.js +1 -1
- package/dist/components/forms/button/button.styles.js +0 -105
- package/dist/components/forms/checkbox/checkbox.class.d.ts +3 -0
- package/dist/components/forms/checkbox/checkbox.class.js +1 -1
- package/dist/components/forms/checkbox/checkbox.styles.js +0 -39
- package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +21 -2
- package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
- package/dist/components/forms/checkbox-group/checkbox-group.styles.js +0 -18
- package/dist/components/forms/code-editor/code-editor.styles.js +0 -30
- package/dist/components/forms/color-picker/color-picker.class.js +2 -2
- package/dist/components/forms/color-picker/color-picker.styles.js +0 -69
- package/dist/components/forms/combobox/combobox.class.d.ts +71 -3
- package/dist/components/forms/combobox/combobox.class.js +5 -3
- package/dist/components/forms/combobox/combobox.styles.js +31 -111
- package/dist/components/forms/combobox/option.styles.js +7 -1
- package/dist/components/forms/date-picker/date-input.class.js +1 -1
- package/dist/components/forms/date-picker/date-input.styles.js +12 -67
- package/dist/components/forms/date-picker/date-picker.class.d.ts +47 -0
- package/dist/components/forms/date-picker/date-picker.class.js +36 -22
- package/dist/components/forms/date-picker/date-picker.styles.js +82 -29
- package/dist/components/forms/emoji-picker/emoji-data-loader.d.ts +6 -3
- package/dist/components/forms/emoji-picker/emoji-data-loader.js +1 -1
- package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +8 -1
- package/dist/components/forms/emoji-picker/emoji-picker.class.js +1 -1
- package/dist/components/forms/emoji-picker/emoji-picker.styles.js +3 -41
- package/dist/components/forms/icon-button/icon-button.class.js +1 -1
- package/dist/components/forms/icon-button/icon-button.styles.js +0 -16
- package/dist/components/forms/input/input.styles.js +0 -54
- package/dist/components/forms/input/number-input.styles.d.ts +4 -5
- package/dist/components/forms/input/number-input.styles.js +0 -11
- package/dist/components/forms/input/time-input-shared.d.ts +11 -0
- package/dist/components/forms/input/time-input-shared.js +1 -1
- package/dist/components/forms/input/time-input.class.d.ts +11 -2
- package/dist/components/forms/input/time-input.class.js +1 -1
- package/dist/components/forms/input/time-input.styles.js +0 -6
- package/dist/components/forms/locale-picker/locale-picker.class.js +2 -2
- package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -26
- package/dist/components/forms/otp-input/otp-input.class.js +3 -3
- package/dist/components/forms/otp-input/otp-input.styles.js +0 -16
- package/dist/components/forms/phone-input/phone-input.class.d.ts +9 -1
- package/dist/components/forms/phone-input/phone-input.class.js +2 -2
- package/dist/components/forms/phone-input/phone-input.styles.js +0 -37
- package/dist/components/forms/radio/radio-button.styles.js +1 -30
- package/dist/components/forms/radio/radio-group.styles.js +0 -4
- package/dist/components/forms/radio/radio.styles.js +0 -44
- package/dist/components/forms/rubric-form/rubric-form.styles.js +0 -5
- package/dist/components/forms/select/select.class.js +1 -1
- package/dist/components/forms/select/select.styles.js +14 -114
- package/dist/components/forms/slider/slider.styles.js +0 -55
- package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +0 -11
- package/dist/components/forms/swatch-picker/swatch-picker.class.js +2 -2
- package/dist/components/forms/swatch-picker/swatch-picker.styles.js +0 -77
- package/dist/components/forms/switch/switch.class.d.ts +3 -0
- package/dist/components/forms/switch/switch.class.js +1 -1
- package/dist/components/forms/switch/switch.styles.js +0 -37
- package/dist/components/forms/textarea/textarea.styles.js +0 -28
- package/dist/components/forms/time-range/time-range.styles.js +12 -84
- package/dist/components/forms/token-input/token-input.class.d.ts +23 -9
- package/dist/components/forms/token-input/token-input.class.js +1 -1
- package/dist/components/forms/token-input/token-input.styles.js +1 -54
- package/dist/components/layout/app-rail/app-rail-item.class.js +2 -2
- package/dist/components/layout/app-rail/app-rail-item.styles.js +0 -13
- package/dist/components/layout/app-rail/app-rail.class.d.ts +5 -0
- package/dist/components/layout/app-rail/app-rail.class.js +1 -1
- package/dist/components/layout/app-rail/app-rail.styles.js +0 -46
- package/dist/components/layout/button-group/button-group.styles.js +0 -6
- package/dist/components/layout/card/card.class.d.ts +12 -0
- package/dist/components/layout/card/card.styles.js +3 -11
- package/dist/components/layout/carousel/carousel.styles.js +0 -1
- package/dist/components/layout/command-palette/command-palette.class.d.ts +8 -0
- package/dist/components/layout/command-palette/command-palette.class.js +3 -1
- package/dist/components/layout/command-palette/command-palette.styles.js +1 -13
- package/dist/components/layout/control-group/control-group.styles.js +0 -7
- package/dist/components/layout/dashboard-grid/dashboard-grid.styles.js +6 -25
- package/dist/components/layout/details/accordion.class.d.ts +13 -0
- package/dist/components/layout/details/accordion.class.js +1 -1
- package/dist/components/layout/details/details.class.js +1 -1
- package/dist/components/layout/details/details.styles.js +0 -12
- package/dist/components/layout/dock-panel/dock-panel.styles.js +0 -45
- package/dist/components/layout/drilldown-panel/drilldown-panel.class.d.ts +2 -0
- package/dist/components/layout/drilldown-panel/drilldown-panel.class.js +2 -2
- package/dist/components/layout/drilldown-panel/drilldown-panel.styles.js +0 -4
- package/dist/components/layout/filter-bar/filter-bar.class.js +1 -1
- package/dist/components/layout/filter-bar/filter-bar.styles.js +0 -9
- package/dist/components/layout/menu/menu-item.class.d.ts +5 -0
- package/dist/components/layout/menu/menu-item.class.js +1 -1
- package/dist/components/layout/menu/menu-item.styles.js +0 -49
- package/dist/components/layout/menu/menu-label.styles.js +0 -2
- package/dist/components/layout/menu/menu.styles.js +0 -18
- package/dist/components/layout/multi-split/multi-split.styles.js +0 -63
- package/dist/components/layout/page/page.class.d.ts +4 -0
- package/dist/components/layout/page/page.class.js +1 -1
- package/dist/components/layout/reorder-list/reorder-item.styles.js +0 -4
- package/dist/components/layout/responsive-panel/responsive-panel.styles.js +0 -27
- package/dist/components/layout/scroller/scroller.styles.js +0 -20
- package/dist/components/layout/segmented/segmented.class.d.ts +7 -1
- package/dist/components/layout/segmented/segmented.class.js +1 -1
- package/dist/components/layout/segmented/segmented.styles.js +69 -37
- package/dist/components/layout/split-panel/split-panel.styles.js +1 -7
- package/dist/components/layout/stepper/stepper.class.d.ts +8 -1
- package/dist/components/layout/stepper/stepper.class.js +1 -1
- package/dist/components/layout/stepper/stepper.styles.js +140 -41
- package/dist/components/layout/tab-group/tab-group.class.d.ts +4 -1
- package/dist/components/layout/tab-group/tab-group.styles.js +9 -75
- package/dist/components/layout/tab-group/tab.styles.js +0 -2
- package/dist/components/layout/virtual-list/virtual-list.class.d.ts +4 -4
- package/dist/components/layout/virtual-list/virtual-list.class.js +1 -1
- package/dist/components/layout/virtual-list/virtual-list.styles.js +0 -68
- package/dist/components/layout/widget/widget.class.d.ts +5 -1
- package/dist/components/layout/widget/widget.class.js +1 -1
- package/dist/components/layout/widget/widget.styles.js +97 -40
- package/dist/components/media/animated-image/animated-image.class.d.ts +3 -0
- package/dist/components/media/animated-image/animated-image.class.js +1 -1
- package/dist/components/media/animated-image/animated-image.styles.js +0 -28
- package/dist/components/media/attachment-chip/attachment-chip.class.d.ts +1 -1
- package/dist/components/media/attachment-chip/attachment-chip.class.js +1 -1
- package/dist/components/media/attachment-chip/attachment-chip.styles.js +0 -31
- package/dist/components/media/attachment-trigger/attachment-trigger.class.js +3 -3
- package/dist/components/media/attachment-trigger/attachment-trigger.styles.js +0 -40
- package/dist/components/media/av-player/av-player.class.d.ts +5 -6
- package/dist/components/media/av-player/av-player.class.js +1 -1
- package/dist/components/media/av-player/av-player.styles.js +0 -45
- package/dist/components/media/avatar/avatar.styles.js +3 -16
- package/dist/components/media/file-icon/file-icon.class.d.ts +1 -2
- package/dist/components/media/file-icon/file-icon.class.js +1 -1
- package/dist/components/media/file-input/file-input.class.d.ts +12 -0
- package/dist/components/media/file-input/file-input.styles.js +3 -24
- package/dist/components/media/flag/flag.class.d.ts +23 -1
- package/dist/components/media/flag/flag.class.js +4 -2
- package/dist/components/media/flag/flag.styles.js +7 -1
- package/dist/components/media/flag/language-map.d.ts +10 -0
- package/dist/components/media/flag/language-map.js +1 -1
- package/dist/components/media/image-comparer/image-comparer.styles.js +4 -33
- package/dist/components/media/image-viewer/image-viewer.class.js +0 -2
- package/dist/components/media/image-viewer/image-viewer.styles.js +7 -27
- package/dist/components/media/lightbox/lightbox.class.js +0 -2
- package/dist/components/media/lightbox/lightbox.styles.js +0 -21
- package/dist/components/media/map/map-loader.d.ts +19 -1
- package/dist/components/media/map/map-loader.js +1 -1
- package/dist/components/media/map/map.class.d.ts +178 -1
- package/dist/components/media/map/map.class.js +15 -3
- package/dist/components/media/map/map.styles.js +20 -17
- package/dist/components/media/media-card/media-card.class.d.ts +14 -3
- package/dist/components/media/media-card/media-card.class.js +1 -1
- package/dist/components/media/media-card/media-card.styles.js +2 -28
- package/dist/components/media/pan-zoom/pan-zoom.styles.js +0 -3
- package/dist/components/media/qr-code/qr-code.class.d.ts +3 -2
- package/dist/components/media/qr-code/qr-code.class.js +2 -2
- package/dist/components/media/qr-code/qr-code.styles.js +0 -3
- package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +2 -0
- package/dist/components/media/sequence-playback/sequence-playback.class.js +2 -1
- package/dist/components/media/sequence-playback/sequence-playback.styles.js +0 -19
- package/dist/components/media/video/video.class.d.ts +23 -2
- package/dist/components/media/video/video.class.js +3 -3
- package/dist/components/media/video/video.styles.js +4 -2
- package/dist/components/media/zoomable-frame/zoomable-frame.class.d.ts +3 -2
- package/dist/components/media/zoomable-frame/zoomable-frame.class.js +2 -2
- package/dist/components/media/zoomable-frame/zoomable-frame.styles.js +0 -5
- package/dist/components/overlays/alert/alert.styles.js +4 -2
- package/dist/components/overlays/badge/badge.styles.js +4 -48
- package/dist/components/overlays/badge/tag.styles.js +0 -14
- package/dist/components/overlays/callout/callout.styles.js +0 -11
- package/dist/components/overlays/chip/chip-group.styles.js +0 -18
- package/dist/components/overlays/chip/chip.styles.js +6 -69
- package/dist/components/overlays/dialog/confirm.d.ts +1 -4
- package/dist/components/overlays/dialog/confirm.js +1 -1
- package/dist/components/overlays/dialog/dialog.class.d.ts +32 -9
- package/dist/components/overlays/dialog/dialog.class.js +1 -1
- package/dist/components/overlays/dialog/dialog.styles.js +0 -43
- package/dist/components/overlays/drawer/drawer.class.d.ts +2 -2
- package/dist/components/overlays/drawer/drawer.styles.js +0 -9
- package/dist/components/overlays/empty/empty.styles.js +0 -12
- package/dist/components/overlays/kbd/kbd.styles.js +0 -8
- package/dist/components/overlays/overlay/dropdown.class.d.ts +1 -6
- package/dist/components/overlays/overlay/dropdown.class.js +2 -2
- package/dist/components/overlays/overlay/overlay.styles.js +0 -28
- package/dist/components/overlays/overlay/popover.class.d.ts +28 -4
- package/dist/components/overlays/overlay/popover.class.js +2 -2
- package/dist/components/overlays/overlay/tooltip.class.d.ts +10 -0
- package/dist/components/overlays/overlay/tooltip.class.js +1 -1
- package/dist/components/overlays/popup/popup.class.d.ts +1 -0
- package/dist/components/overlays/popup/popup.class.js +1 -1
- package/dist/components/overlays/popup/popup.styles.js +0 -15
- package/dist/components/overlays/progress/progress-ring.class.d.ts +9 -1
- package/dist/components/overlays/progress/progress-ring.class.js +3 -3
- package/dist/components/overlays/progress/progress.styles.js +0 -21
- package/dist/components/overlays/rating/rating.styles.js +0 -25
- package/dist/components/overlays/skeleton/skeleton.styles.js +0 -4
- package/dist/components/overlays/spinner/spinner.styles.js +0 -3
- package/dist/components/overlays/toast/toast-item.styles.js +3 -45
- package/dist/components/retrieval/chunk-inspector/chunk-inspector.styles.js +0 -35
- package/dist/components/retrieval/citation-badge/citation-badge.class.d.ts +2 -2
- package/dist/components/retrieval/citation-badge/citation-badge.class.js +3 -3
- package/dist/components/retrieval/citation-badge/citation-badge.styles.js +0 -20
- package/dist/components/retrieval/claim-evidence/claim-evidence.styles.js +0 -8
- package/dist/components/retrieval/community-card/community-card.class.d.ts +1 -0
- package/dist/components/retrieval/community-card/community-card.styles.js +0 -6
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +8 -12
- package/dist/components/retrieval/entity-card/entity-card.class.d.ts +4 -3
- package/dist/components/retrieval/entity-card/entity-card.class.js +1 -1
- package/dist/components/retrieval/entity-card/entity-card.styles.js +0 -12
- package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +10 -4
- package/dist/components/retrieval/entity-chip/entity-chip.class.js +3 -3
- package/dist/components/retrieval/entity-chip/entity-chip.styles.js +6 -9
- package/dist/components/retrieval/entity-dossier/entity-dossier.class.d.ts +19 -5
- package/dist/components/retrieval/graph/graph.class.d.ts +5 -0
- package/dist/components/retrieval/graph/graph.class.js +1 -1
- package/dist/components/retrieval/graph/graph.styles.js +0 -30
- package/dist/components/retrieval/graph-legend/graph-legend.styles.js +0 -3
- package/dist/components/retrieval/ingestion-queue/ingestion-queue.styles.js +0 -25
- package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.class.d.ts +2 -0
- package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.styles.js +0 -7
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +20 -6
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +2 -2
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.styles.js +0 -16
- package/dist/components/retrieval/mind-map/mind-map.class.d.ts +5 -3
- package/dist/components/retrieval/mind-map/mind-map.class.js +1 -1
- package/dist/components/retrieval/mind-map/mind-map.styles.js +0 -2
- package/dist/components/retrieval/neighbor-list/neighbor-list.class.d.ts +3 -2
- package/dist/components/retrieval/neighbor-list/neighbor-list.class.js +1 -1
- package/dist/components/retrieval/neighbor-list/neighbor-list.styles.js +0 -30
- package/dist/components/retrieval/node-palette/node-palette.styles.js +0 -11
- package/dist/components/retrieval/path-strip/path-strip.styles.js +0 -10
- package/dist/components/retrieval/provenance-panel/provenance-panel.class.d.ts +12 -3
- package/dist/components/retrieval/provenance-panel/provenance-panel.styles.js +0 -2
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.d.ts +3 -2
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +2 -2
- package/dist/components/retrieval/retrieval-results/retrieval-results.styles.js +0 -28
- package/dist/components/retrieval/retrieval-search/retrieval-search.styles.js +0 -4
- package/dist/components/retrieval/retrieval-trace/retrieval-trace.styles.js +0 -2
- package/dist/components/retrieval/source-card/source-card.styles.js +0 -13
- package/dist/components/retrieval/source-list/source-list.styles.js +0 -7
- package/dist/components/retrieval/source-picker/source-picker.styles.js +0 -7
- package/dist/components/utility/copy-button/copy-button.styles.js +0 -10
- package/dist/components/utility/diff-view/diff-view.styles.js +0 -14
- package/dist/components/utility/export-button/export-button.styles.js +0 -22
- package/dist/components/utility/icon/icon.styles.js +0 -6
- package/dist/components/utility/json-viewer/json-viewer.styles.js +2 -48
- package/dist/components/utility/known-date/known-date.class.d.ts +7 -3
- package/dist/components/utility/known-date/known-date.styles.js +10 -51
- package/dist/components/utility/live-region/live-region.styles.js +0 -4
- package/dist/components/utility/mention-popover/mention-popover.styles.js +0 -25
- package/dist/components/utility/poll-status/poll-status.styles.js +0 -4
- package/dist/components/utility/random-content/random-content.class.d.ts +22 -0
- package/dist/components/utility/random-content/random-content.class.js +3 -2
- package/dist/components/utility/random-content/random-content.styles.js +6 -13
- package/dist/components/utility/tour/tour.class.d.ts +4 -2
- package/dist/components/utility/tour/tour.class.js +3 -3
- package/dist/components/utility/tour/tour.styles.js +0 -13
- package/dist/components/utility/visually-hidden/visually-hidden.styles.js +0 -5
- package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
- package/dist/components/viewers/archive-viewer/archive-viewer.styles.d.ts +2 -2
- package/dist/components/viewers/archive-viewer/archive-viewer.styles.js +0 -10
- package/dist/components/viewers/csv-viewer/csv-viewer.class.js +1 -1
- package/dist/components/viewers/csv-viewer/csv-viewer.styles.js +0 -19
- package/dist/components/viewers/dataset-viewer/dataset-viewer.class.js +1 -1
- package/dist/components/viewers/dataset-viewer/dataset-viewer.styles.js +0 -15
- package/dist/components/viewers/document-compare/document-compare.styles.js +0 -3
- package/dist/components/viewers/document-preview/document-preview.styles.js +0 -25
- package/dist/components/viewers/document-viewer/document-viewer.class.d.ts +2 -1
- package/dist/components/viewers/document-viewer/document-viewer.class.js +1 -1
- package/dist/components/viewers/document-viewer/document-viewer.styles.js +0 -5
- package/dist/components/viewers/docx-viewer/docx-viewer.styles.js +0 -17
- package/dist/components/viewers/ebook-viewer/ebook-viewer.styles.js +0 -4
- package/dist/components/viewers/email-viewer/email-viewer.styles.js +0 -7
- package/dist/components/viewers/geojson-view/geojson-view.styles.js +0 -5
- package/dist/components/viewers/highlight-layer/highlight-layer.styles.js +0 -3
- package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +1 -1
- package/dist/components/viewers/notebook-viewer/notebook-viewer.styles.js +0 -38
- package/dist/components/viewers/page-rail/page-rail.class.js +1 -1
- package/dist/components/viewers/page-rail/page-rail.styles.js +0 -13
- package/dist/components/viewers/pdf-viewer/pdf-loader.d.ts +13 -2
- package/dist/components/viewers/pdf-viewer/pdf-loader.js +1 -1
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +32 -2
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +4 -4
- package/dist/components/viewers/pdf-viewer/pdf-viewer.styles.js +1 -27
- package/dist/components/viewers/pptx-viewer/pptx-viewer.styles.js +0 -3
- package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.js +1 -1
- package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.styles.js +0 -14
- package/dist/components/viewers/svg-viewer/svg-viewer.styles.js +0 -7
- package/dist/components/viewers/xml-viewer/xml-viewer.styles.js +2 -24
- package/dist/custom-elements-jsx.d.ts +72 -40
- package/dist/events.d.ts +43 -33
- package/dist/internal/agent-status-variants.d.ts +18 -0
- package/dist/internal/agent-status-variants.js +1 -0
- package/dist/internal/announcer.d.ts +8 -3
- package/dist/internal/announcer.js +1 -1
- package/dist/internal/autoloader-manifest.js +1 -1
- package/dist/internal/canvas-color.d.ts +16 -0
- package/dist/internal/canvas-color.js +1 -1
- package/dist/internal/catalog-picker.d.ts +0 -1
- package/dist/internal/catalog-picker.js +1 -1
- package/dist/internal/default-strings.generated.d.ts +1 -0
- package/dist/internal/default-strings.generated.js +1 -1
- package/dist/internal/dev-mode-attribute-warning.d.ts +27 -4
- package/dist/internal/dev-mode-attribute-warning.js +1 -1
- package/dist/internal/localization-runtime.js +1 -1
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +1 -1
- package/dist/internal/lyra-element.d.ts +13 -0
- package/dist/internal/lyra-element.js +1 -1
- package/dist/internal/media-controller.js +1 -1
- package/dist/internal/package-metadata.d.ts +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/scroll-overflow.d.ts +35 -13
- package/dist/internal/scroll-overflow.js +1 -1
- package/dist/internal/sizes.styles.js +0 -2
- package/dist/internal/specialist-tokens.styles.js +6 -11
- package/dist/internal/text-highlights.d.ts +4 -1
- package/dist/internal/text-highlights.js +1 -1
- package/dist/internal/tokens/palette.styles.js +0 -15
- package/dist/internal/tokens.styles.js +20 -113
- package/dist/lyra.d.ts +9 -6
- package/dist/styles/reservations.css +82 -0
- package/dist/svelte.d.ts +72 -40
- package/dist/translations/ar.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/pt-BR.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/zh-CN.js +1 -1
- package/dist/vue.d.ts +72 -40
- package/llms/components/lr-accordion-item.md +12 -3
- package/llms/components/lr-accordion.md +11 -2
- package/llms/components/lr-agent-eval-dashboard.md +1 -1
- package/llms/components/lr-agent-trace.md +3 -1
- package/llms/components/lr-agent-workspace.md +20 -0
- package/llms/components/lr-artifact-panel.md +10 -4
- package/llms/components/lr-attachment-chip.md +7 -4
- package/llms/components/lr-attachment-trigger.md +7 -4
- package/llms/components/lr-av-player.md +3 -1
- package/llms/components/lr-avatar.md +6 -6
- package/llms/components/lr-bar-chart.md +8 -6
- package/llms/components/lr-box-plot.md +15 -4
- package/llms/components/lr-browser-frame.md +7 -3
- package/llms/components/lr-bubble-chart.md +8 -6
- package/llms/components/lr-calendar.md +9 -2
- package/llms/components/lr-card.md +24 -0
- package/llms/components/lr-chart.md +45 -11
- package/llms/components/lr-chat-viewport.md +7 -2
- package/llms/components/lr-checkbox-group.md +13 -5
- package/llms/components/lr-checkbox.md +5 -2
- package/llms/components/lr-checkpoint.md +6 -2
- package/llms/components/lr-combobox.md +47 -8
- package/llms/components/lr-command-palette.md +4 -1
- package/llms/components/lr-confirm-bar.md +7 -3
- package/llms/components/lr-context-meter.md +12 -11
- package/llms/components/lr-conversation-item.md +7 -4
- package/llms/components/lr-date-input.md +22 -2
- package/llms/components/lr-date-picker.md +23 -3
- package/llms/components/lr-details.md +11 -2
- package/llms/components/lr-dialog.md +16 -10
- package/llms/components/lr-dock-panel.md +7 -10
- package/llms/components/lr-document-preview.md +6 -1
- package/llms/components/lr-document-viewer.md +3 -2
- package/llms/components/lr-doughnut-chart.md +8 -6
- package/llms/components/lr-drawer.md +3 -3
- package/llms/components/lr-entity-card.md +3 -3
- package/llms/components/lr-entity-chip.md +1 -1
- package/llms/components/lr-entity-dossier.md +4 -1
- package/llms/components/lr-file-input.md +2 -2
- package/llms/components/lr-flag.md +30 -8
- package/llms/components/lr-heatmap.md +46 -0
- package/llms/components/lr-histogram.md +7 -4
- package/llms/components/lr-icon.md +1 -1
- package/llms/components/lr-json-schema-viewer.md +2 -1
- package/llms/components/lr-knowledge-graph-explorer.md +8 -3
- package/llms/components/lr-known-date.md +4 -2
- package/llms/components/lr-line-chart.md +8 -6
- package/llms/components/lr-lite-chart.md +16 -6
- package/llms/components/lr-map.md +91 -10
- package/llms/components/lr-markdown-core.md +3 -2
- package/llms/components/lr-media-card.md +28 -12
- package/llms/components/lr-message-parts.md +2 -1
- package/llms/components/lr-model-select.md +9 -10
- package/llms/components/lr-model-settings-panel.md +9 -9
- package/llms/components/lr-neighbor-list.md +1 -1
- package/llms/components/lr-notebook-viewer.md +6 -3
- package/llms/components/lr-option.md +46 -7
- package/llms/components/lr-pdf-viewer.md +62 -2
- package/llms/components/lr-pie-chart.md +8 -6
- package/llms/components/lr-polar-area-chart.md +8 -6
- package/llms/components/lr-popover.md +25 -1
- package/llms/components/lr-progress-ring.md +8 -1
- package/llms/components/lr-prompt-studio.md +1 -1
- package/llms/components/lr-provenance-panel.md +4 -2
- package/llms/components/lr-qr-code.md +1 -1
- package/llms/components/lr-radar-chart.md +8 -6
- package/llms/components/lr-rag-eval-dashboard.md +2 -2
- package/llms/components/lr-random-content.md +13 -0
- package/llms/components/lr-reorder-item.md +6 -1
- package/llms/components/lr-reorder-list.md +6 -1
- package/llms/components/lr-responsive-panel.md +11 -7
- package/llms/components/lr-scatter-chart.md +8 -6
- package/llms/components/lr-sequence-strip.md +16 -2
- package/llms/components/lr-slider.md +12 -5
- package/llms/components/lr-sparkline.md +1 -1
- package/llms/components/lr-suggestion-chips.md +7 -2
- package/llms/components/lr-swatch-picker.md +5 -5
- package/llms/components/lr-switch.md +5 -2
- package/llms/components/lr-table.md +30 -4
- package/llms/components/lr-terminal.md +3 -1
- package/llms/components/lr-thread-list.md +8 -8
- package/llms/components/lr-time-input.md +6 -1
- package/llms/components/lr-timeline-item.md +24 -0
- package/llms/components/lr-timeline.md +25 -1
- package/llms/components/lr-token-input.md +7 -2
- package/llms/components/lr-tool-approval-dialog.md +7 -8
- package/llms/components/lr-tool-call-chip.md +5 -1
- package/llms/components/lr-tool-param-form.md +14 -12
- package/llms/components/lr-tool-result-dialog.md +11 -9
- package/llms/components/lr-tool-result-view.md +7 -6
- package/llms/components/lr-tool-select-dialog.md +18 -16
- package/llms/components/lr-trace-tree.md +3 -1
- package/llms/components/lr-usage-badge.md +4 -1
- package/llms/components/lr-video-playlist.md +1 -1
- package/llms/components/lr-virtual-list.md +22 -14
- package/llms/components/lr-voice-picker.md +8 -5
- package/llms/components/lr-widget-renderer.md +3 -3
- package/llms/components/lr-widget.md +1 -1
- package/llms/components/lr-word-cloud.md +6 -2
- package/llms/peers.md +12 -2
- package/llms/shared.md +70 -2
- package/llms/tokens.md +15 -1
- package/llms-full.txt +1335 -306
- package/package.json +17 -5
- package/vscode-css-data.json +93 -2
- package/vscode-html-data.json +513 -59
- package/web-types.json +457 -72
|
@@ -1 +1 @@
|
|
|
1
|
-
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{LitElement}from"lit";import{property}from"lit/decorators.js";import{captureFormInternals,ExternalLabelController}from"./form-control-labels.js";import{tokens}from"./tokens.styles.js";import{palette}from"./tokens/palette.styles.js";import{resolveIntlLocale}from"./intl-cache.js";import{warnUnknownAttributes}from"./dev-mode-attribute-warning.js";import{observeInheritedContext,beginInheritedContextUpdate,finishInheritedContextUpdate,markInheritedContextUpdateRendered,queueInheritedDirectionChange,recordInheritedDirectionRead,recordInheritedLocaleRead}from"./inherited-context-observer.js";import{canonicalizeLyraLocale,enableLyraLocaleCache,invalidateLyraLocaleCache,lyraLocaleCatalogVersion,peekLyraLocale,recordLyraOwnerDocumentConnection,resolveLyraDirection,resolveLyraString,resolveLyraLocale,snapshotLyraLocaleStrings,subscribeLyraLocaleForHost}from"./localization-runtime.js";const PUBLIC_COLLECTION_ENTRY_LIMIT=1e4,PUBLIC_COLLECTION_NODE_LIMIT=5e4,PUBLIC_COLLECTION_DEPTH_LIMIT=256,OMIT_COLLECTION_VALUE=Symbol("omit-public-collection-value");function snapshotRealm(view){const candidate=view;return{Array:candidate?.Array??Array,Date:candidate?.Date??Date,Map:candidate?.Map??Map,Object:candidate?.Object??Object,Set:candidate?.Set??Set}}function isRealmNeutralPlainRecord(value){try{const prototype=Object.getPrototypeOf(value);if(prototype===null)return!0;const constructor=Object.getOwnPropertyDescriptor(prototype,"constructor");return!!(constructor&&"value"in constructor&&typeof constructor.value=="function"&&constructor.value.name==="Object"&&Object.getPrototypeOf(prototype)===null)}catch{return!1}}function isArrayValue(value){try{return Array.isArray(value)}catch{return!1}}function isNativeArrayBufferView(value){try{return ArrayBuffer.isView(value)}catch{return!1}}function isImmutableBlob(value){if(typeof Blob>"u")return!1;const sizeGetter=Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get;if(!sizeGetter)return!1;try{return sizeGetter.call(value),!0}catch{return!1}}const MUTATING_DATE_METHODS=new Set(["setDate","setFullYear","setHours","setMilliseconds","setMinutes","setMonth","setSeconds","setTime","setUTCDate","setUTCFullYear","setUTCHours","setUTCMilliseconds","setUTCMinutes","setUTCMonth","setUTCSeconds","setYear"]);function nativeDateTime(value){try{return Date.prototype.getTime.call(value)}catch{return OMIT_COLLECTION_VALUE}}function snapshotReadonlyDate(source,time,budget){const target=new budget.realm.Date(time),boundMethods=new Map,rejectMutation=()=>{throw new TypeError("Cannot mutate a readonly Date snapshot")},snapshot=new Proxy(target,{get(date,key){if(MUTATING_DATE_METHODS.has(key))return rejectMutation;if(key==="constructor")return budget.realm.Date;const value=Reflect.get(date,key,date);if(typeof value!="function")return value;const cached=boundMethods.get(key);if(cached)return cached;const bound=value.bind(date);return boundMethods.set(key,bound),bound}});return rememberSnapshot(budget,source,snapshot),Object.freeze(snapshot)}function rememberSnapshot(budget,source,snapshot){budget.seen.set(source,snapshot),budget.additions.push(source)}function snapshotTransaction(budget,create){const remaining=budget.remaining,additions=budget.additions.length,result=create();if(result!==OMIT_COLLECTION_VALUE)return result;budget.remaining=remaining;for(let index=budget.additions.length-1;index>=additions;index-=1)budget.seen.delete(budget.additions[index]);return budget.additions.length=additions,OMIT_COLLECTION_VALUE}function emptyRealmArray(realm){return Object.freeze(new realm.Array)}function*ownEnumerableStringKeys(value){for(const key in value)Object.getOwnPropertyDescriptor(value,key)?.enumerable&&(yield key)}function snapshotDataRecord(value,keys,prototype,budget,depth,preserveRecordKeys,preserveCollectionItemKeys){const output=budget.realm.Object.create(prototype);rememberSnapshot(budget,value,output);try{for(const key of keys){const descriptor=Object.getOwnPropertyDescriptor(value,key);if(!descriptor?.enumerable||!("value"in descriptor))continue;if(budget.remaining<=0)return OMIT_COLLECTION_VALUE;budget.remaining-=1;const entry=preserveRecordKeys?.has(key)?descriptor.value:preserveCollectionItemKeys?.has(key)?snapshotIdentityCollection(descriptor.value,budget.realm,budget):snapshotCollectionValue(descriptor.value,budget,depth+1);if(entry===OMIT_COLLECTION_VALUE)return OMIT_COLLECTION_VALUE;Object.defineProperty(output,key,{value:entry,enumerable:!0,configurable:!1,writable:!1})}}catch{return OMIT_COLLECTION_VALUE}return Object.freeze(output)}function snapshotCollectionValue(value,budget,depth,preserveRecordKeys,preserveCollectionItemKeys,allowArrayPrefixTruncation=!1){if(value===null||typeof value!="object"&&typeof value!="function"||typeof value=="function")return value;if(budget.seen.has(value))return budget.seen.get(value);if(depth>PUBLIC_COLLECTION_DEPTH_LIMIT||budget.remaining<=0)return OMIT_COLLECTION_VALUE;if(isArrayValue(value)){let lengthDescriptor;try{lengthDescriptor=Object.getOwnPropertyDescriptor(value,"length")}catch{return allowArrayPrefixTruncation?emptyRealmArray(budget.realm):OMIT_COLLECTION_VALUE}if(!lengthDescriptor||!("value"in lengthDescriptor)||typeof lengthDescriptor.value!="number"||!Number.isSafeInteger(lengthDescriptor.value)||lengthDescriptor.value<0)return allowArrayPrefixTruncation?emptyRealmArray(budget.realm):OMIT_COLLECTION_VALUE;const sourceLength=lengthDescriptor.value;if(!allowArrayPrefixTruncation&&sourceLength>PUBLIC_COLLECTION_ENTRY_LIMIT)return OMIT_COLLECTION_VALUE;const length=Math.min(sourceLength,PUBLIC_COLLECTION_ENTRY_LIMIT),output=new budget.realm.Array(length);rememberSnapshot(budget,value,output);for(let index=0;index<length;index+=1){if(budget.remaining<=0){if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}if(!descriptor)continue;if(!("value"in descriptor)){if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}const entry=snapshotTransaction(budget,()=>(budget.remaining-=1,snapshotCollectionValue(descriptor.value,budget,depth+1)));if(entry===OMIT_COLLECTION_VALUE){if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}Object.defineProperty(output,index,{value:entry,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}if(isRealmNeutralPlainRecord(value)){let prototype;try{prototype=Object.getPrototypeOf(value)}catch{return OMIT_COLLECTION_VALUE}return snapshotDataRecord(value,ownEnumerableStringKeys(value),prototype===null?null:budget.realm.Object.prototype,budget,depth,preserveRecordKeys,preserveCollectionItemKeys)}const dateTime=nativeDateTime(value);if(dateTime!==OMIT_COLLECTION_VALUE)return snapshotReadonlyDate(value,dateTime,budget);const entries=nativeMapEntries(value);if(entries)return snapshotDetachedMap(value,entries,budget,depth);const values=nativeSetValues(value);if(values)return snapshotDetachedSet(value,values,budget,depth);if(isNativeArrayBufferView(value))return OMIT_COLLECTION_VALUE;const rect=snapshotDOMRect(value,budget);return rect!==OMIT_COLLECTION_VALUE?rect:isImmutableBlob(value)?value:OMIT_COLLECTION_VALUE}function snapshotPublicCollection(value,view){if(value===null||typeof value!="object"&&typeof value!="function")return value;const realm=snapshotRealm(view),budget={remaining:PUBLIC_COLLECTION_NODE_LIMIT,seen:new WeakMap,additions:[],realm},snapshot=snapshotTransaction(budget,()=>snapshotCollectionValue(value,budget,0,void 0,void 0,!0));if(snapshot!==OMIT_COLLECTION_VALUE)return snapshot;if(isArrayValue(value)||isNativeArrayBufferView(value))return emptyRealmArray(realm);if(typeof value=="object"){if(nativeMapEntries(value))return readonlyMapFacade(new realm.Map,realm);if(nativeSetValues(value))return readonlySetFacade(new realm.Set,realm);if(isRealmNeutralPlainRecord(value)){const prototype=Object.getPrototypeOf(value);return Object.freeze(realm.Object.create(prototype===null?null:realm.Object.prototype))}}return emptyRealmArray(realm)}function nativeMapEntries(value){try{return Map.prototype.entries.call(value)}catch{return}}function nativeSetValues(value){try{return Set.prototype.values.call(value)}catch{return}}function snapshotDOMRect(value,budget){if(typeof DOMRectReadOnly>"u")return OMIT_COLLECTION_VALUE;const nativePrototype=DOMRectReadOnly.prototype,output=budget.realm.Object.create(budget.realm.Object.prototype);for(const key of["x","y","width","height","top","right","bottom","left"]){let coordinate;try{const getter=Object.getOwnPropertyDescriptor(nativePrototype,key)?.get;if(!getter)return OMIT_COLLECTION_VALUE;coordinate=getter.call(value)}catch{return OMIT_COLLECTION_VALUE}if(typeof coordinate!="number"||!Number.isFinite(coordinate))return OMIT_COLLECTION_VALUE;Object.defineProperty(output,key,{value:coordinate,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}function readonlyMapFacade(backing,realm=snapshotRealm()){let facade;return facade=realm.Object.create(realm.Object.prototype),Object.defineProperties(facade,{size:{enumerable:!0,get:()=>backing.size},entries:{value:()=>backing.entries()},get:{value:key=>backing.get(key)},has:{value:key=>backing.has(key)},keys:{value:()=>backing.keys()},values:{value:()=>backing.values()},forEach:{value:(callback,thisArg)=>backing.forEach((entry,key)=>callback.call(thisArg,entry,key,facade))},[Symbol.iterator]:{value:()=>backing[Symbol.iterator]()}}),Object.freeze(facade)}function readonlySetFacade(backing,realm=snapshotRealm()){let facade;return facade=realm.Object.create(realm.Object.prototype),Object.defineProperties(facade,{size:{enumerable:!0,get:()=>backing.size},entries:{value:()=>backing.entries()},has:{value:entry=>backing.has(entry)},keys:{value:()=>backing.keys()},values:{value:()=>backing.values()},forEach:{value:(callback,thisArg)=>backing.forEach(entry=>callback.call(thisArg,entry,entry,facade))},[Symbol.iterator]:{value:()=>backing[Symbol.iterator]()}}),Object.freeze(facade)}function snapshotIdentityMap(entries,realm=snapshotRealm()){const backing=new realm.Map;for(let next=entries.next(),count=0;!next.done&&count<PUBLIC_COLLECTION_ENTRY_LIMIT;next=entries.next(),count+=1)backing.set(next.value[0],next.value[1]);return readonlyMapFacade(backing,realm)}function snapshotIdentitySet(values,realm=snapshotRealm()){const backing=new realm.Set;for(let next=values.next(),count=0;!next.done&&count<PUBLIC_COLLECTION_ENTRY_LIMIT;next=values.next(),count+=1)backing.add(next.value);return readonlySetFacade(backing,realm)}function snapshotDetachedMap(source,entries,budget,depth){const backing=new budget.realm.Map,facade=readonlyMapFacade(backing,budget.realm);rememberSnapshot(budget,source,facade);for(let count=0;count<PUBLIC_COLLECTION_ENTRY_LIMIT;count+=1){let next;try{next=entries.next()}catch{break}if(next.done||budget.remaining<=0)break;const pair=snapshotTransaction(budget,()=>{budget.remaining-=1;const key=snapshotCollectionValue(next.value[0],budget,depth+1);if(key===OMIT_COLLECTION_VALUE)return OMIT_COLLECTION_VALUE;const entry=snapshotCollectionValue(next.value[1],budget,depth+1);return entry===OMIT_COLLECTION_VALUE?OMIT_COLLECTION_VALUE:[key,entry]});pair!==OMIT_COLLECTION_VALUE&&backing.set(pair[0],pair[1])}return facade}function snapshotDetachedSet(source,values,budget,depth){const backing=new budget.realm.Set,facade=readonlySetFacade(backing,budget.realm);rememberSnapshot(budget,source,facade);for(let count=0;count<PUBLIC_COLLECTION_ENTRY_LIMIT;count+=1){let next;try{next=values.next()}catch{break}if(next.done||budget.remaining<=0)break;const entry=snapshotTransaction(budget,()=>(budget.remaining-=1,snapshotCollectionValue(next.value,budget,depth+1)));entry!==OMIT_COLLECTION_VALUE&&backing.add(entry)}return facade}function snapshotIdentityCollection(value,view,budget){const realm=snapshotRealm(view);if(budget&&value!==null&&(typeof value=="object"||typeof value=="function")&&budget.seen.has(value))return budget.seen.get(value);if(isArrayValue(value)){let lengthDescriptor;try{lengthDescriptor=Object.getOwnPropertyDescriptor(value,"length")}catch{return emptyRealmArray(realm)}const length=lengthDescriptor&&"value"in lengthDescriptor&&typeof lengthDescriptor.value=="number"&&Number.isSafeInteger(lengthDescriptor.value)&&lengthDescriptor.value>=0?Math.min(lengthDescriptor.value,PUBLIC_COLLECTION_ENTRY_LIMIT):0,output=new realm.Array(length);budget&&rememberSnapshot(budget,value,output);for(let index=0;index<length;index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}!descriptor||!("value"in descriptor)||Object.defineProperty(output,index,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}if(value===null||typeof value!="object")return value;const mapEntries=nativeMapEntries(value);if(mapEntries){const output=snapshotIdentityMap(mapEntries,realm);return budget&&rememberSnapshot(budget,value,output),output}const setValues=nativeSetValues(value);if(setValues){const output=snapshotIdentitySet(setValues,realm);return budget&&rememberSnapshot(budget,value,output),output}return emptyRealmArray(realm)}function snapshotEventDetail(value,view,preserveRootKeys,preserveCollectionItemKeys){if(value==null)return value;const budget={remaining:PUBLIC_COLLECTION_NODE_LIMIT,seen:new WeakMap,additions:[],realm:snapshotRealm(view)},snapshot=snapshotTransaction(budget,()=>snapshotCollectionValue(value,budget,0,preserveRootKeys,preserveCollectionItemKeys));return snapshot===OMIT_COLLECTION_VALUE?null:snapshot}const SEED_FIRST_RENDER_STATE=Symbol("lr-seed-first-render-state"),SLOT_PRESENCE_UNRESOLVED=Symbol("lr-slot-presence-unresolved"),REACTIVE_HOST_ATTRIBUTES=["aria-label","aria-describedby","lang","dir"],DIRECTION_HOST_ATTRIBUTES=["class","style","slot"];function trustedLyraConstructorChain(instance){const constructors=[];let prototype=Object.getPrototypeOf(instance);for(;prototype&&prototype!==LitElement.prototype;){const descriptor=Object.getOwnPropertyDescriptor(prototype,"constructor");typeof descriptor?.value=="function"&&constructors.push(descriptor.value),prototype=Object.getPrototypeOf(prototype)}return constructors}const collectionPolicyByPrototype=new WeakMap;function collectionPropertyPolicy(instance,name){const prototype=Object.getPrototypeOf(instance);let policies=collectionPolicyByPrototype.get(prototype);policies||(policies=new Map,collectionPolicyByPrototype.set(prototype,policies));const cached=policies.get(name);if(cached)return cached;let owns=!1,preservesItemIdentity=!1,preservesObjectIdentity=!1;for(const constructor of trustedLyraConstructorChain(instance)){const declared=constructor;Object.prototype.hasOwnProperty.call(constructor,"ownedCollectionProperties")&&declared.ownedCollectionProperties.includes(name)&&(owns=!0),Object.prototype.hasOwnProperty.call(constructor,"identityCollectionProperties")&&declared.identityCollectionProperties.includes(name)&&(preservesItemIdentity=!0),Object.prototype.hasOwnProperty.call(constructor,"identityCollectionObjectProperties")&&declared.identityCollectionObjectProperties.includes(name)&&(preservesObjectIdentity=!0)}const policy=Object.freeze({owns,preservesItemIdentity,preservesObjectIdentity});return policies.set(name,policy),policy}class LyraElement extends LitElement{static{this.styles=[palette,tokens]}static{this.ownedCollectionProperties=Object.freeze([])}static{this.identityCollectionProperties=Object.freeze([])}static{this.identityCollectionObjectProperties=Object.freeze([])}static{this.immutableEventDetails=Object.freeze([])}static{this.identityEventDetailProperties=Object.freeze({})}static{this.identityEventDetailCollectionItems=Object.freeze({})}static getPropertyDescriptor(name,key,options){const descriptor=super.getPropertyDescriptor(name,key,options);if(!descriptor?.set)return descriptor;const originalSet=descriptor.set;return{...descriptor,set(value){const policy=collectionPropertyPolicy(this,name);if(!policy.owns){originalSet.call(this,value);return}const ownerView=this.ownerDocument?.defaultView;originalSet.call(this,policy.preservesObjectIdentity&&value!==null&&typeof value=="object"&&!isArrayValue(value)?value:policy.preservesItemIdentity?snapshotIdentityCollection(value,ownerView):snapshotPublicCollection(value,ownerView))}}}static{this.defaultStrings=Object.freeze({})}static get observedAttributes(){return[...new Set([...super.observedAttributes,...REACTIVE_HOST_ATTRIBUTES,...DIRECTION_HOST_ATTRIBUTES])]}get strings(){return this.stringsValue}set strings(value){const previous=this.stringsValue;this.stringsValue=snapshotLyraLocaleStrings(value),this.requestUpdate("strings",previous)}constructor(){super(),this.locale="",this.stringsValue=snapshotLyraLocaleStrings({}),this.localeSubscriptionNeeded=!1,this.constructor.formAssociated&&this.addController(new ExternalLabelController(this))}attachInternals(){const internals=super.attachInternals();return captureFormInternals(this,internals),internals}connectedCallback(){this.hydratingServerShadow??=typeof Node>"u"||!this.hasUpdated&&this.shadowRoot!==null,super.connectedCallback(),warnUnknownAttributes(this,this.constructor.observedAttributes),recordLyraOwnerDocumentConnection(this),enableLyraLocaleCache(this),invalidateLyraLocaleCache(this),this.stopInheritedContextObservation?.(),this.stopInheritedContextObservation=observeInheritedContext(this),this.localeSubscriptionNeeded&&this.ensureLocaleSubscription(),this.lastLocalizedCatalogVersion!==void 0&&lyraLocaleCatalogVersion(resolveLyraLocale(this))!==this.lastLocalizedCatalogVersion&&this.requestUpdate();const deferred=this.deferredAfterUpdate;if(deferred){this.deferredAfterUpdate=void 0;for(const[key,callback]of deferred)this.scheduleAfterUpdate(callback,key)}}disconnectedCallback(){this.pendingLoadController?.abort(),this.pendingLoadController=void 0,this.stopLocaleSubscription?.(),this.stopLocaleSubscription=void 0,this.stopInheritedContextObservation?.(),this.stopInheritedContextObservation=void 0,invalidateLyraLocaleCache(this),super.disconnectedCallback()}adoptedCallback(){this.stopLocaleSubscription?.(),this.stopLocaleSubscription=void 0,invalidateLyraLocaleCache(this),this.isConnected&&this.localeSubscriptionNeeded&&this.ensureLocaleSubscription()}requestUpdate(name,oldValue,options){invalidateLyraLocaleCache(this),super.requestUpdate(name,oldValue,options)}performUpdate(){beginInheritedContextUpdate(this);try{super.performUpdate()}finally{finishInheritedContextUpdate(this)}}update(changedProperties){super.update(changedProperties),markInheritedContextUpdateRendered(this)}ensureLocaleSubscription(){this.localeSubscriptionNeeded=!0,!(!this.isConnected||this.stopLocaleSubscription)&&(this.stopLocaleSubscription=subscribeLyraLocaleForHost(this))}attributeChangedCallback(name,oldValue,value){const directionHostAttribute=oldValue!==value&&DIRECTION_HOST_ATTRIBUTES.includes(name);directionHostAttribute&&queueInheritedDirectionChange(this,name==="slot"),super.attributeChangedCallback(name,oldValue,value),oldValue!==value&&REACTIVE_HOST_ATTRIBUTES.includes(name)?this.requestUpdate():directionHostAttribute&&invalidateLyraLocaleCache(this)}seedFirstRenderState(seed){this.hasUpdated||this[SEED_FIRST_RENDER_STATE](seed)}[SEED_FIRST_RENDER_STATE](seed){if(!this.hydratingServerShadow){seed();return}const pending=this.deferredFirstRenderSeeds??=new Set;pending.add(seed),!(pending.size>1)&&this.updateComplete.then(()=>{setTimeout(()=>{this.hydratingServerShadow=!1;const seeds=this.deferredFirstRenderSeeds;this.deferredFirstRenderSeeds=void 0;for(const deferred of seeds??[])deferred();this.requestUpdate()},0)},()=>{this.hydratingServerShadow=!1,this.deferredFirstRenderSeeds=void 0})}updateBrowserDerivedState(update){this[SEED_FIRST_RENDER_STATE](update)}renderSlotPresence(present){return present||this[SLOT_PRESENCE_UNRESOLVED]()}[SLOT_PRESENCE_UNRESOLVED](){return typeof Node>"u"||this.hydratingServerShadow===!0}beginAbortableLoad(){this.pendingLoadController?.abort(),this.pendingLoadController=void 0;const AbortControllerCtor=this.ownerDocument?.defaultView?.AbortController;if(AbortControllerCtor)return this.pendingLoadController=new AbortControllerCtor,this.pendingLoadController.signal}scheduleAfterUpdate(callback,key="load"){const pending=this.afterUpdateCallbacks??=new Map;pending.has(key)||(pending.set(key,callback),!(pending.size>1)&&queueMicrotask(()=>{const due=this.afterUpdateCallbacks;if(this.afterUpdateCallbacks=void 0,!due)return;if(this.isConnected){for(const due_callback of due.values())due_callback();return}const held=this.deferredAfterUpdate??=new Map;for(const[heldKey,heldCallback]of due)held.has(heldKey)||held.set(heldKey,heldCallback)}))}localize(key,fallback,values){const message=resolveLyraString(this,key,this.strings,fallback,values,this.constructor.defaultStrings),locale=peekLyraLocale(this);return recordInheritedLocaleRead(this,locale),locale!==void 0&&(this.lastLocalizedCatalogVersion=lyraLocaleCatalogVersion(locale),this.ensureLocaleSubscription()),message}get effectiveMessageLocale(){if(this.locale)return canonicalizeLyraLocale(this.locale);const locale=resolveLyraLocale(this);return recordInheritedLocaleRead(this,locale),this.ensureLocaleSubscription(),locale}get effectiveLocale(){return resolveIntlLocale(this.effectiveMessageLocale)}get effectiveIntlLocale(){return this.effectiveLocale}get effectiveDirection(){const direction=resolveLyraDirection(this);return recordInheritedDirectionRead(this,direction),direction}addEventListener(type,listener,options){super.addEventListener(type,listener,options)}removeEventListener(type,listener,options){super.removeEventListener(type,listener,options)}emit(name,...args){const[detail,options]=args,ownerDocument=this.ownerDocument;let CustomEventCtor=ownerDocument?.defaultView?.CustomEvent;if(!CustomEventCtor&&ownerDocument)try{const candidate=ownerDocument.createEvent("CustomEvent").constructor;typeof candidate=="function"&&(CustomEventCtor=candidate)}catch{}CustomEventCtor??=globalThis.CustomEvent;let snapshotsDetail=!1;const identityDetailKeys=new Set,identityCollectionItemKeys=new Set;for(const constructor of trustedLyraConstructorChain(this)){if(Object.prototype.hasOwnProperty.call(constructor,"immutableEventDetails")&&constructor.immutableEventDetails.includes(name)&&(snapshotsDetail=!0),Object.prototype.hasOwnProperty.call(constructor,"identityEventDetailProperties"))for(const key of constructor.identityEventDetailProperties[name]??[])identityDetailKeys.add(key);if(Object.prototype.hasOwnProperty.call(constructor,"identityEventDetailCollectionItems"))for(const key of constructor.identityEventDetailCollectionItems[name]??[])identityCollectionItemKeys.add(key)}const event=new CustomEventCtor(name,{detail:detail===void 0?null:snapshotsDetail?snapshotEventDetail(detail,ownerDocument?.defaultView,identityDetailKeys,identityCollectionItemKeys):detail,bubbles:!0,composed:!0,cancelable:options?.cancelable??!1});return this.dispatchEvent(event),event}}__decorate([property({reflect:!0})],LyraElement.prototype,"locale",void 0),__decorate([property({attribute:!1})],LyraElement.prototype,"strings",null);export{LyraElement,SEED_FIRST_RENDER_STATE,SLOT_PRESENCE_UNRESOLVED};
|
|
1
|
+
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{LitElement}from"lit";import{property}from"lit/decorators.js";import{captureFormInternals,ExternalLabelController}from"./form-control-labels.js";import{tokens}from"./tokens.styles.js";import{palette}from"./tokens/palette.styles.js";import{resolveIntlLocale}from"./intl-cache.js";import{warnUnknownAttributes}from"./dev-mode-attribute-warning.js";import{observeInheritedContext,beginInheritedContextUpdate,finishInheritedContextUpdate,markInheritedContextUpdateRendered,queueInheritedDirectionChange,recordInheritedDirectionRead,recordInheritedLocaleRead}from"./inherited-context-observer.js";import{canonicalizeLyraLocale,enableLyraLocaleCache,invalidateLyraLocaleCache,lyraLocaleCatalogVersion,peekLyraLocale,recordLyraOwnerDocumentConnection,resolveLyraDirection,resolveLyraString,resolveLyraLocale,snapshotLyraLocaleStrings,subscribeLyraLocaleForHost}from"./localization-runtime.js";const PUBLIC_COLLECTION_ENTRY_LIMIT=1e4,PUBLIC_COLLECTION_NODE_LIMIT=5e4,PUBLIC_COLLECTION_DEPTH_LIMIT=256,OMIT_COLLECTION_VALUE=Symbol("omit-public-collection-value");function snapshotRealm(view){const candidate=view;return{Array:candidate?.Array??Array,Date:candidate?.Date??Date,Map:candidate?.Map??Map,Object:candidate?.Object??Object,Set:candidate?.Set??Set}}function isRealmNeutralPlainRecord(value){try{const prototype=Object.getPrototypeOf(value);if(prototype===null)return!0;const constructor=Object.getOwnPropertyDescriptor(prototype,"constructor");return!!(constructor&&"value"in constructor&&typeof constructor.value=="function"&&constructor.value.name==="Object"&&Object.getPrototypeOf(prototype)===null)}catch{return!1}}function isArrayValue(value){try{return Array.isArray(value)}catch{return!1}}function isNativeArrayBufferView(value){try{return ArrayBuffer.isView(value)}catch{return!1}}function isImmutableBlob(value){if(typeof Blob>"u")return!1;const sizeGetter=Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get;if(!sizeGetter)return!1;try{return sizeGetter.call(value),!0}catch{return!1}}const MUTATING_DATE_METHODS=new Set(["setDate","setFullYear","setHours","setMilliseconds","setMinutes","setMonth","setSeconds","setTime","setUTCDate","setUTCFullYear","setUTCHours","setUTCMilliseconds","setUTCMinutes","setUTCMonth","setUTCSeconds","setYear"]);function nativeDateTime(value){try{return Date.prototype.getTime.call(value)}catch{return OMIT_COLLECTION_VALUE}}function snapshotReadonlyDate(source,time,budget){const target=new budget.realm.Date(time),boundMethods=new Map,rejectMutation=()=>{throw new TypeError("Cannot mutate a readonly Date snapshot")},snapshot=new Proxy(target,{get(date,key){if(MUTATING_DATE_METHODS.has(key))return rejectMutation;if(key==="constructor")return budget.realm.Date;const value=Reflect.get(date,key,date);if(typeof value!="function")return value;const cached=boundMethods.get(key);if(cached)return cached;const bound=value.bind(date);return boundMethods.set(key,bound),bound}});return rememberSnapshot(budget,source,snapshot),Object.freeze(snapshot)}function rememberSnapshot(budget,source,snapshot){budget.seen.set(source,snapshot),budget.additions.push(source)}function snapshotTransaction(budget,create){const remaining=budget.remaining,additions=budget.additions.length,result=create();if(result!==OMIT_COLLECTION_VALUE)return result;budget.remaining=remaining;for(let index=budget.additions.length-1;index>=additions;index-=1)budget.seen.delete(budget.additions[index]);return budget.additions.length=additions,OMIT_COLLECTION_VALUE}function emptyRealmArray(realm){return Object.freeze(new realm.Array)}function*ownEnumerableStringKeys(value){for(const key in value)Object.getOwnPropertyDescriptor(value,key)?.enumerable&&(yield key)}function snapshotDataRecord(value,keys,prototype,budget,depth,preserveRecordKeys,preserveCollectionItemKeys){const output=budget.realm.Object.create(prototype);rememberSnapshot(budget,value,output);try{for(const key of keys){const descriptor=Object.getOwnPropertyDescriptor(value,key);if(!descriptor?.enumerable||!("value"in descriptor))continue;if(budget.remaining<=0)return OMIT_COLLECTION_VALUE;budget.remaining-=1;const entry=preserveRecordKeys?.has(key)?descriptor.value:preserveCollectionItemKeys?.has(key)?snapshotIdentityCollection(descriptor.value,budget.realm,budget):snapshotCollectionValue(descriptor.value,budget,depth+1);if(entry===OMIT_COLLECTION_VALUE)return OMIT_COLLECTION_VALUE;Object.defineProperty(output,key,{value:entry,enumerable:!0,configurable:!1,writable:!1})}}catch{return OMIT_COLLECTION_VALUE}return Object.freeze(output)}function snapshotCollectionValue(value,budget,depth,preserveRecordKeys,preserveCollectionItemKeys,allowArrayPrefixTruncation=!1){if(value===null||typeof value!="object"&&typeof value!="function"||typeof value=="function")return value;if(budget.seen.has(value))return budget.seen.get(value);if(depth>PUBLIC_COLLECTION_DEPTH_LIMIT||budget.remaining<=0)return OMIT_COLLECTION_VALUE;if(isArrayValue(value)){let lengthDescriptor;try{lengthDescriptor=Object.getOwnPropertyDescriptor(value,"length")}catch{return allowArrayPrefixTruncation?emptyRealmArray(budget.realm):OMIT_COLLECTION_VALUE}if(!lengthDescriptor||!("value"in lengthDescriptor)||typeof lengthDescriptor.value!="number"||!Number.isSafeInteger(lengthDescriptor.value)||lengthDescriptor.value<0)return allowArrayPrefixTruncation?emptyRealmArray(budget.realm):OMIT_COLLECTION_VALUE;const sourceLength=lengthDescriptor.value;if(!allowArrayPrefixTruncation&&sourceLength>PUBLIC_COLLECTION_ENTRY_LIMIT)return OMIT_COLLECTION_VALUE;const length=Math.min(sourceLength,PUBLIC_COLLECTION_ENTRY_LIMIT),output=new budget.realm.Array(length);rememberSnapshot(budget,value,output);for(let index=0;index<length;index+=1){if(budget.remaining<=0){if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}if(!descriptor)continue;if(!("value"in descriptor)){if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}const entry=snapshotTransaction(budget,()=>(budget.remaining-=1,snapshotCollectionValue(descriptor.value,budget,depth+1)));if(entry===OMIT_COLLECTION_VALUE){if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}Object.defineProperty(output,index,{value:entry,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}if(isRealmNeutralPlainRecord(value)){let prototype;try{prototype=Object.getPrototypeOf(value)}catch{return OMIT_COLLECTION_VALUE}return snapshotDataRecord(value,ownEnumerableStringKeys(value),prototype===null?null:budget.realm.Object.prototype,budget,depth,preserveRecordKeys,preserveCollectionItemKeys)}const dateTime=nativeDateTime(value);if(dateTime!==OMIT_COLLECTION_VALUE)return snapshotReadonlyDate(value,dateTime,budget);const entries=nativeMapEntries(value);if(entries)return snapshotDetachedMap(value,entries,budget,depth);const values=nativeSetValues(value);if(values)return snapshotDetachedSet(value,values,budget,depth);if(isNativeArrayBufferView(value))return OMIT_COLLECTION_VALUE;const rect=snapshotDOMRect(value,budget);return rect!==OMIT_COLLECTION_VALUE?rect:isImmutableBlob(value)?value:OMIT_COLLECTION_VALUE}function snapshotPublicCollection(value,view){if(value===null||typeof value!="object"&&typeof value!="function")return value;const realm=snapshotRealm(view),budget={remaining:PUBLIC_COLLECTION_NODE_LIMIT,seen:new WeakMap,additions:[],realm},snapshot=snapshotTransaction(budget,()=>snapshotCollectionValue(value,budget,0,void 0,void 0,!0));if(snapshot!==OMIT_COLLECTION_VALUE)return snapshot;if(isArrayValue(value)||isNativeArrayBufferView(value))return emptyRealmArray(realm);if(typeof value=="object"){if(nativeMapEntries(value))return readonlyMapFacade(new realm.Map,realm);if(nativeSetValues(value))return readonlySetFacade(new realm.Set,realm);if(isRealmNeutralPlainRecord(value)){const prototype=Object.getPrototypeOf(value);return Object.freeze(realm.Object.create(prototype===null?null:realm.Object.prototype))}}return emptyRealmArray(realm)}function nativeMapEntries(value){try{return Map.prototype.entries.call(value)}catch{return}}function nativeSetValues(value){try{return Set.prototype.values.call(value)}catch{return}}function snapshotDOMRect(value,budget){if(typeof DOMRectReadOnly>"u")return OMIT_COLLECTION_VALUE;const nativePrototype=DOMRectReadOnly.prototype,output=budget.realm.Object.create(budget.realm.Object.prototype);for(const key of["x","y","width","height","top","right","bottom","left"]){let coordinate;try{const getter=Object.getOwnPropertyDescriptor(nativePrototype,key)?.get;if(!getter)return OMIT_COLLECTION_VALUE;coordinate=getter.call(value)}catch{return OMIT_COLLECTION_VALUE}if(typeof coordinate!="number"||!Number.isFinite(coordinate))return OMIT_COLLECTION_VALUE;Object.defineProperty(output,key,{value:coordinate,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}function readonlyMapFacade(backing,realm=snapshotRealm()){let facade;return facade=realm.Object.create(realm.Object.prototype),Object.defineProperties(facade,{size:{enumerable:!0,get:()=>backing.size},entries:{value:()=>backing.entries()},get:{value:key=>backing.get(key)},has:{value:key=>backing.has(key)},keys:{value:()=>backing.keys()},values:{value:()=>backing.values()},forEach:{value:(callback,thisArg)=>backing.forEach((entry,key)=>callback.call(thisArg,entry,key,facade))},[Symbol.iterator]:{value:()=>backing[Symbol.iterator]()}}),Object.freeze(facade)}function readonlySetFacade(backing,realm=snapshotRealm()){let facade;return facade=realm.Object.create(realm.Object.prototype),Object.defineProperties(facade,{size:{enumerable:!0,get:()=>backing.size},entries:{value:()=>backing.entries()},has:{value:entry=>backing.has(entry)},keys:{value:()=>backing.keys()},values:{value:()=>backing.values()},forEach:{value:(callback,thisArg)=>backing.forEach(entry=>callback.call(thisArg,entry,entry,facade))},[Symbol.iterator]:{value:()=>backing[Symbol.iterator]()}}),Object.freeze(facade)}function snapshotIdentityMap(entries,realm=snapshotRealm()){const backing=new realm.Map;for(let next=entries.next(),count=0;!next.done&&count<PUBLIC_COLLECTION_ENTRY_LIMIT;next=entries.next(),count+=1)backing.set(next.value[0],next.value[1]);return readonlyMapFacade(backing,realm)}function snapshotIdentitySet(values,realm=snapshotRealm()){const backing=new realm.Set;for(let next=values.next(),count=0;!next.done&&count<PUBLIC_COLLECTION_ENTRY_LIMIT;next=values.next(),count+=1)backing.add(next.value);return readonlySetFacade(backing,realm)}function snapshotDetachedMap(source,entries,budget,depth){const backing=new budget.realm.Map,facade=readonlyMapFacade(backing,budget.realm);rememberSnapshot(budget,source,facade);for(let count=0;count<PUBLIC_COLLECTION_ENTRY_LIMIT;count+=1){let next;try{next=entries.next()}catch{break}if(next.done||budget.remaining<=0)break;const pair=snapshotTransaction(budget,()=>{budget.remaining-=1;const key=snapshotCollectionValue(next.value[0],budget,depth+1);if(key===OMIT_COLLECTION_VALUE)return OMIT_COLLECTION_VALUE;const entry=snapshotCollectionValue(next.value[1],budget,depth+1);return entry===OMIT_COLLECTION_VALUE?OMIT_COLLECTION_VALUE:[key,entry]});pair!==OMIT_COLLECTION_VALUE&&backing.set(pair[0],pair[1])}return facade}function snapshotDetachedSet(source,values,budget,depth){const backing=new budget.realm.Set,facade=readonlySetFacade(backing,budget.realm);rememberSnapshot(budget,source,facade);for(let count=0;count<PUBLIC_COLLECTION_ENTRY_LIMIT;count+=1){let next;try{next=values.next()}catch{break}if(next.done||budget.remaining<=0)break;const entry=snapshotTransaction(budget,()=>(budget.remaining-=1,snapshotCollectionValue(next.value,budget,depth+1)));entry!==OMIT_COLLECTION_VALUE&&backing.add(entry)}return facade}function snapshotIdentityCollection(value,view,budget){const realm=snapshotRealm(view);if(budget&&value!==null&&(typeof value=="object"||typeof value=="function")&&budget.seen.has(value))return budget.seen.get(value);if(isArrayValue(value)){let lengthDescriptor;try{lengthDescriptor=Object.getOwnPropertyDescriptor(value,"length")}catch{return emptyRealmArray(realm)}const length=lengthDescriptor&&"value"in lengthDescriptor&&typeof lengthDescriptor.value=="number"&&Number.isSafeInteger(lengthDescriptor.value)&&lengthDescriptor.value>=0?Math.min(lengthDescriptor.value,PUBLIC_COLLECTION_ENTRY_LIMIT):0,output=new realm.Array(length);budget&&rememberSnapshot(budget,value,output);for(let index=0;index<length;index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}!descriptor||!("value"in descriptor)||Object.defineProperty(output,index,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}if(value===null||typeof value!="object")return value;const mapEntries=nativeMapEntries(value);if(mapEntries){const output=snapshotIdentityMap(mapEntries,realm);return budget&&rememberSnapshot(budget,value,output),output}const setValues=nativeSetValues(value);if(setValues){const output=snapshotIdentitySet(setValues,realm);return budget&&rememberSnapshot(budget,value,output),output}return emptyRealmArray(realm)}function snapshotEventDetail(value,view,preserveRootKeys,preserveCollectionItemKeys){if(value==null)return value;const budget={remaining:PUBLIC_COLLECTION_NODE_LIMIT,seen:new WeakMap,additions:[],realm:snapshotRealm(view)},snapshot=snapshotTransaction(budget,()=>snapshotCollectionValue(value,budget,0,preserveRootKeys,preserveCollectionItemKeys));return snapshot===OMIT_COLLECTION_VALUE?null:snapshot}const SEED_FIRST_RENDER_STATE=Symbol("lr-seed-first-render-state"),SLOT_PRESENCE_UNRESOLVED=Symbol("lr-slot-presence-unresolved"),REACTIVE_HOST_ATTRIBUTES=["aria-label","aria-describedby","lang","dir"],DIRECTION_HOST_ATTRIBUTES=["class","style","slot"];function trustedLyraConstructorChain(instance){const constructors=[];let prototype=Object.getPrototypeOf(instance);for(;prototype&&prototype!==LitElement.prototype;){const descriptor=Object.getOwnPropertyDescriptor(prototype,"constructor");typeof descriptor?.value=="function"&&constructors.push(descriptor.value),prototype=Object.getPrototypeOf(prototype)}return constructors}const collectionPolicyByPrototype=new WeakMap;function collectionPropertyPolicy(instance,name){const prototype=Object.getPrototypeOf(instance);let policies=collectionPolicyByPrototype.get(prototype);policies||(policies=new Map,collectionPolicyByPrototype.set(prototype,policies));const cached=policies.get(name);if(cached)return cached;let owns=!1,preservesItemIdentity=!1,preservesObjectIdentity=!1;for(const constructor of trustedLyraConstructorChain(instance)){const declared=constructor;Object.prototype.hasOwnProperty.call(constructor,"ownedCollectionProperties")&&declared.ownedCollectionProperties.includes(name)&&(owns=!0),Object.prototype.hasOwnProperty.call(constructor,"identityCollectionProperties")&&declared.identityCollectionProperties.includes(name)&&(preservesItemIdentity=!0),Object.prototype.hasOwnProperty.call(constructor,"identityCollectionObjectProperties")&&declared.identityCollectionObjectProperties.includes(name)&&(preservesObjectIdentity=!0)}const policy=Object.freeze({owns,preservesItemIdentity,preservesObjectIdentity});return policies.set(name,policy),policy}class LyraElement extends LitElement{static{this.styles=[palette,tokens]}static{this.ownedCollectionProperties=Object.freeze([])}static{this.identityCollectionProperties=Object.freeze([])}static{this.identityCollectionObjectProperties=Object.freeze([])}static{this.immutableEventDetails=Object.freeze([])}static{this.identityEventDetailProperties=Object.freeze({})}static{this.identityEventDetailCollectionItems=Object.freeze({})}static getPropertyDescriptor(name,key,options){const descriptor=super.getPropertyDescriptor(name,key,options);if(!descriptor?.set)return descriptor;const originalSet=descriptor.set;return{...descriptor,set(value){const policy=collectionPropertyPolicy(this,name);if(!policy.owns){originalSet.call(this,value);return}const ownerView=this.ownerDocument?.defaultView;originalSet.call(this,policy.preservesObjectIdentity&&value!==null&&typeof value=="object"&&!isArrayValue(value)?value:policy.preservesItemIdentity?snapshotIdentityCollection(value,ownerView):snapshotPublicCollection(value,ownerView))}}}static{this.defaultStrings=Object.freeze({})}static get observedAttributes(){return[...new Set([...super.observedAttributes,...REACTIVE_HOST_ATTRIBUTES,...DIRECTION_HOST_ATTRIBUTES])]}get strings(){return this.stringsValue}set strings(value){const previous=this.stringsValue;this.stringsValue=snapshotLyraLocaleStrings(value),this.requestUpdate("strings",previous)}constructor(){super(),this.locale="",this.stringsValue=snapshotLyraLocaleStrings({}),this.localeSubscriptionNeeded=!1,this.constructor.formAssociated&&this.addController(new ExternalLabelController(this))}attachInternals(){const internals=super.attachInternals();return captureFormInternals(this,internals),internals}connectedCallback(){this.hydratingServerShadow??=typeof Node>"u"||!this.hasUpdated&&this.shadowRoot!==null,super.connectedCallback(),warnUnknownAttributes(this,this.constructor.observedAttributes,this.constructor.knownUnobservedAttributes??[]),recordLyraOwnerDocumentConnection(this),enableLyraLocaleCache(this),invalidateLyraLocaleCache(this),this.stopInheritedContextObservation?.(),this.stopInheritedContextObservation=observeInheritedContext(this),this.localeSubscriptionNeeded&&this.ensureLocaleSubscription(),this.lastLocalizedCatalogVersion!==void 0&&lyraLocaleCatalogVersion(resolveLyraLocale(this))!==this.lastLocalizedCatalogVersion&&this.requestUpdate();const deferred=this.deferredAfterUpdate;if(deferred){this.deferredAfterUpdate=void 0;for(const[key,callback]of deferred)this.scheduleAfterUpdate(callback,key)}}disconnectedCallback(){this.pendingLoadController?.abort(),this.pendingLoadController=void 0,this.stopLocaleSubscription?.(),this.stopLocaleSubscription=void 0,this.stopInheritedContextObservation?.(),this.stopInheritedContextObservation=void 0,invalidateLyraLocaleCache(this),super.disconnectedCallback()}adoptedCallback(){this.stopLocaleSubscription?.(),this.stopLocaleSubscription=void 0,invalidateLyraLocaleCache(this),this.isConnected&&this.localeSubscriptionNeeded&&this.ensureLocaleSubscription()}requestUpdate(name,oldValue,options){invalidateLyraLocaleCache(this),super.requestUpdate(name,oldValue,options)}performUpdate(){beginInheritedContextUpdate(this);try{super.performUpdate()}finally{finishInheritedContextUpdate(this)}}update(changedProperties){super.update(changedProperties),markInheritedContextUpdateRendered(this)}ensureLocaleSubscription(){this.localeSubscriptionNeeded=!0,!(!this.isConnected||this.stopLocaleSubscription)&&(this.stopLocaleSubscription=subscribeLyraLocaleForHost(this))}attributeChangedCallback(name,oldValue,value){const directionHostAttribute=oldValue!==value&&DIRECTION_HOST_ATTRIBUTES.includes(name);directionHostAttribute&&queueInheritedDirectionChange(this,name==="slot"),super.attributeChangedCallback(name,oldValue,value),oldValue!==value&&REACTIVE_HOST_ATTRIBUTES.includes(name)?this.requestUpdate():directionHostAttribute&&invalidateLyraLocaleCache(this)}seedFirstRenderState(seed){this.hasUpdated||this[SEED_FIRST_RENDER_STATE](seed)}[SEED_FIRST_RENDER_STATE](seed){if(!this.hydratingServerShadow){seed();return}const pending=this.deferredFirstRenderSeeds??=new Set;pending.add(seed),!(pending.size>1)&&this.updateComplete.then(()=>{setTimeout(()=>{this.hydratingServerShadow=!1;const seeds=this.deferredFirstRenderSeeds;this.deferredFirstRenderSeeds=void 0;for(const deferred of seeds??[])deferred();this.requestUpdate()},0)},()=>{this.hydratingServerShadow=!1,this.deferredFirstRenderSeeds=void 0})}updateBrowserDerivedState(update){this[SEED_FIRST_RENDER_STATE](update)}renderSlotPresence(present){return present||this[SLOT_PRESENCE_UNRESOLVED]()}[SLOT_PRESENCE_UNRESOLVED](){return typeof Node>"u"||this.hydratingServerShadow===!0}beginAbortableLoad(){this.pendingLoadController?.abort(),this.pendingLoadController=void 0;const AbortControllerCtor=this.ownerDocument?.defaultView?.AbortController;if(AbortControllerCtor)return this.pendingLoadController=new AbortControllerCtor,this.pendingLoadController.signal}scheduleAfterUpdate(callback,key="load"){const pending=this.afterUpdateCallbacks??=new Map;pending.has(key)||(pending.set(key,callback),!(pending.size>1)&&queueMicrotask(()=>{const due=this.afterUpdateCallbacks;if(this.afterUpdateCallbacks=void 0,!due)return;if(this.isConnected){for(const due_callback of due.values())due_callback();return}const held=this.deferredAfterUpdate??=new Map;for(const[heldKey,heldCallback]of due)held.has(heldKey)||held.set(heldKey,heldCallback)}))}localize(key,fallback,values){const message=resolveLyraString(this,key,this.strings,fallback,values,this.constructor.defaultStrings),locale=peekLyraLocale(this);return recordInheritedLocaleRead(this,locale),locale!==void 0&&(this.lastLocalizedCatalogVersion=lyraLocaleCatalogVersion(locale),this.ensureLocaleSubscription()),message}get effectiveMessageLocale(){if(this.locale)return canonicalizeLyraLocale(this.locale);const locale=resolveLyraLocale(this);return recordInheritedLocaleRead(this,locale),this.ensureLocaleSubscription(),locale}get effectiveLocale(){return resolveIntlLocale(this.effectiveMessageLocale)}get effectiveIntlLocale(){return this.effectiveLocale}get effectiveDirection(){const direction=resolveLyraDirection(this);return recordInheritedDirectionRead(this,direction),direction}addEventListener(type,listener,options){super.addEventListener(type,listener,options)}removeEventListener(type,listener,options){super.removeEventListener(type,listener,options)}emit(name,...args){const[detail,options]=args,ownerDocument=this.ownerDocument;let CustomEventCtor=ownerDocument?.defaultView?.CustomEvent;if(!CustomEventCtor&&ownerDocument)try{const candidate=ownerDocument.createEvent("CustomEvent").constructor;typeof candidate=="function"&&(CustomEventCtor=candidate)}catch{}CustomEventCtor??=globalThis.CustomEvent;let snapshotsDetail=!1;const identityDetailKeys=new Set,identityCollectionItemKeys=new Set;for(const constructor of trustedLyraConstructorChain(this)){if(Object.prototype.hasOwnProperty.call(constructor,"immutableEventDetails")&&constructor.immutableEventDetails.includes(name)&&(snapshotsDetail=!0),Object.prototype.hasOwnProperty.call(constructor,"identityEventDetailProperties"))for(const key of constructor.identityEventDetailProperties[name]??[])identityDetailKeys.add(key);if(Object.prototype.hasOwnProperty.call(constructor,"identityEventDetailCollectionItems"))for(const key of constructor.identityEventDetailCollectionItems[name]??[])identityCollectionItemKeys.add(key)}const event=new CustomEventCtor(name,{detail:detail===void 0?null:snapshotsDetail?snapshotEventDetail(detail,ownerDocument?.defaultView,identityDetailKeys,identityCollectionItemKeys):detail,bubbles:!0,composed:!0,cancelable:options?.cancelable??!1});return this.dispatchEvent(event),event}}__decorate([property({reflect:!0})],LyraElement.prototype,"locale",void 0),__decorate([property({attribute:!1})],LyraElement.prototype,"strings",null);export{LyraElement,SEED_FIRST_RENDER_STATE,SLOT_PRESENCE_UNRESOLVED};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{finiteRange}from"./numbers.js";import{safeMediaSrc}from"./safe-url.js";const MIN_NATIVE_PLAYBACK_RATE=.0625,MAX_NATIVE_PLAYBACK_RATE=16,NATIVE_MEDIA_RELAY_EVENTS=["ended","error","loadedmetadata","pause","play","timeupdate","volumechange"],CONTROLLER_EVENT_NAMES=[...NATIVE_MEDIA_RELAY_EVENTS,"durationchange","ratechange","seeked"],TRACK_KINDS=new Set(["subtitles","captions","descriptions","chapters","metadata"]),USER_SELECTABLE_TRACK_KINDS=new Set(["subtitles","captions","descriptions"]),SOURCE_ATTRIBUTES=["type","media"],TRACK_ATTRIBUTES=["srclang","label"];function isValidVolume(value){return typeof value=="number"&&Number.isFinite(value)&&value>=0&&value<=1}function isValidPlaybackRate(value){return typeof value=="number"&&Number.isFinite(value)&&value>=MIN_NATIVE_PLAYBACK_RATE&&value<=MAX_NATIVE_PLAYBACK_RATE}function mediaDuration(media){return finiteRange(media?.duration??0,0,0)}function directMediaChildren(media){return[...media.children].filter(child=>child.localName==="source"||child.localName==="track")}function textTracks(media){const tracks=[];for(let index=0;index<media.textTracks.length;index+=1){const track=media.textTracks[index];track&&tracks.push(track)}return tracks}function textTrackPreference(track,index){return{index,kind:track.kind,label:track.label,language:track.language}}function validTextTrackPreference(value){if(value===null||typeof value!="object")return!1;const candidate=value;return typeof candidate.index=="number"&&Number.isInteger(candidate.index)&&candidate.index>=0&&typeof candidate.kind=="string"&&typeof candidate.label=="string"&&typeof candidate.language=="string"}function hasOwn(value,key){return Object.prototype.hasOwnProperty.call(value,key)}function safeNativeMediaSource(value){return safeMediaSrc(value)}function cloneSafeMediaNodes(nodes,targetDocument){const clones=[];for(const node of nodes){if(node.nodeType!==1)continue;const source=node,url=safeMediaSrc(source.getAttribute("src"));if(!url)continue;if(source.localName==="source"){const clone2=targetDocument.createElement("source");clone2.setAttribute("src",url);for(const attribute of SOURCE_ATTRIBUTES){const value=source.getAttribute(attribute);value!==null&&clone2.setAttribute(attribute,value)}clones.push(clone2);continue}if(source.localName!=="track")continue;const kind=source.getAttribute("kind")?.toLowerCase()??"";if(!TRACK_KINDS.has(kind))continue;const clone=targetDocument.createElement("track");clone.setAttribute("src",url),clone.setAttribute("kind",kind);for(const attribute of TRACK_ATTRIBUTES){const value=source.getAttribute(attribute);value!==null&&clone.setAttribute(attribute,value)}source.hasAttribute("default")&&clone.setAttribute("default",""),clones.push(clone)}return clones}function canRequestFullscreen(element){return element?typeof element.requestFullscreen=="function"&&element.ownerDocument.fullscreenEnabled!==!1:!1}function canExitFullscreen(documentRef){return!!(documentRef&&typeof documentRef.exitFullscreen=="function")}function canRequestPictureInPicture(media){if(!media)return!1;const candidate=media,documentRef=media.ownerDocument;return media.localName==="video"&&typeof candidate.requestPictureInPicture=="function"&&documentRef.pictureInPictureEnabled!==!1&&candidate.disablePictureInPicture!==!0}class NativeMediaController{#media;#active=!0;#generation=0;#duration=0;#currentTime=0;#pendingCurrentTime=null;#listeners=new Map;#eventNames;#relayEvents;#preferences={};#hasPreferences=!1;#onEvent;constructor(target,options={}){this.target=target,this.#relayEvents=new Set(options.relayEvents??NATIVE_MEDIA_RELAY_EVENTS),this.#eventNames=new Set(options.events??CONTROLLER_EVENT_NAMES);for(const name of this.#relayEvents)this.#eventNames.add(name);this.#onEvent=options.onEvent}get element(){return this.#media}get generation(){return this.#generation}isCurrentGeneration(generation,media=this.#media){return this.#active&&generation===this.#generation&&media===this.#media}get duration(){return finiteRange(this.#duration||mediaDuration(this.#media),0,0)}get currentTime(){if(this.#pendingCurrentTime!==null)return this.#pendingCurrentTime;const max=this.duration>0?this.duration:Number.POSITIVE_INFINITY,nativeValue=this.#media?.currentTime;return finiteRange(nativeValue??this.#currentTime,this.#currentTime,0,max)}set currentTime(value){const max=this.duration>0?this.duration:Number.POSITIVE_INFINITY,next=finiteRange(value,0,0,max);if(this.#currentTime=next,!this.#media){this.#pendingCurrentTime=next;return}try{this.#media.currentTime=next,this.#pendingCurrentTime=null}catch{this.#pendingCurrentTime=next}}get volume(){const nativeValue=this.#media?.volume;return isValidVolume(nativeValue)?nativeValue:isValidVolume(this.#preferences.volume)?this.#preferences.volume:1}set volume(value){const next=finiteRange(value,this.volume,0,1);this.#preferences.volume=next,this.#hasPreferences=!0,this.#media&&(this.#media.volume=next)}get muted(){return this.#media?.muted??this.#preferences.muted??!1}set muted(value){const next=!!value;this.#preferences.muted=next,this.#hasPreferences=!0,this.#media&&(this.#media.muted=next)}get playbackRate(){const nativeValue=this.#media?.playbackRate;return isValidPlaybackRate(nativeValue)?nativeValue:isValidPlaybackRate(this.#preferences.playbackRate)?this.#preferences.playbackRate:1}set playbackRate(value){const next=finiteRange(value,1,MIN_NATIVE_PLAYBACK_RATE,MAX_NATIVE_PLAYBACK_RATE);this.#preferences.playbackRate=next,this.#hasPreferences=!0,this.#media&&(this.#media.playbackRate=next)}attach(media){if(media===this.#media){media&&this.#active&&this.#listeners.size===0&&this.#bindListeners();return}const previous=this.#media;previous&&(this.#rememberUserPreferences(previous),this.#unbindListeners(),this.#generation+=1,this.#active&&previous.pause()),this.#media=media??void 0,this.#duration=0,this.#currentTime=0,(previous||!media)&&(this.#pendingCurrentTime=null),media&&(this.#hasPreferences?this.applyUserPreferences(this.#preferences,media):this.#rememberUserPreferences(media),this.#active&&this.#bindListeners())}startGeneration(){return this.#rememberUserPreferences(this.#media),this.#unbindListeners(),this.#generation+=1,this.#media?.pause(),this.#duration=0,this.#currentTime=0,this.#pendingCurrentTime=null,this.#active&&this.#media&&this.#bindListeners(),this.#generation}disconnect(){this.#active&&(this.#rememberUserPreferences(this.#media),this.#active=!1,this.#unbindListeners(),this.#generation+=1,this.#media?.pause())}reconnect(){this.#active||(this.#active=!0,this.#generation+=1,this.#media&&(this.applyUserPreferences(this.#preferences,this.#media),this.#bindListeners()))}play(){return this.#media?.play()??Promise.resolve()}pause(){this.#media?.pause()}load(){this.#media&&(this.#rememberUserPreferences(this.#media),this.#unbindListeners(),this.#generation+=1,this.#duration=0,this.#currentTime=0,this.#pendingCurrentTime=null,this.#active&&this.#bindListeners(),this.#media.load())}unload(){const media=this.#media;if(media){this.startGeneration(),media.removeAttribute("src");for(const child of directMediaChildren(media))child.remove();media.load()}}setSources(sourceSet){const media=this.#media;if(!media)return!1;const rawSrc=typeof sourceSet.src=="string"?sourceSet.src.trim():sourceSet.src,hasDirectSrc=rawSrc!=null&&rawSrc!=="",directSrc=hasDirectSrc?safeMediaSrc(rawSrc):null;if(hasDirectSrc&&!directSrc)return(media.hasAttribute("src")||directMediaChildren(media).length>0)&&this.unload(),!1;const clones=cloneSafeMediaNodes(sourceSet.nodes??[],media.ownerDocument),hasSource=!!(directSrc||clones.some(node=>node.localName==="source"));this.startGeneration(),media.removeAttribute("src");for(const child of directMediaChildren(media))child.remove();directSrc&&media.setAttribute("src",directSrc);for(const clone of clones)media.append(clone);return media.load(),hasSource}captureUserPreferences(media=this.#media){if(!media)return{};const preferences={};isValidVolume(media.volume)&&(preferences.volume=media.volume),typeof media.muted=="boolean"&&(preferences.muted=media.muted),isValidPlaybackRate(media.playbackRate)&&(preferences.playbackRate=media.playbackRate);const tracks=textTracks(media),showingIndex=tracks.findIndex(track=>track.mode==="showing");return preferences.textTrack=showingIndex>=0&&tracks[showingIndex]?textTrackPreference(tracks[showingIndex],showingIndex):null,preferences}applyUserPreferences(preferences,media=this.#media){if(!media||preferences===null||typeof preferences!="object"||(isValidVolume(preferences.volume)&&(media.volume=preferences.volume,this.#preferences.volume=preferences.volume,this.#hasPreferences=!0),typeof preferences.muted=="boolean"&&(media.muted=preferences.muted,this.#preferences.muted=preferences.muted,this.#hasPreferences=!0),isValidPlaybackRate(preferences.playbackRate)&&(media.playbackRate=preferences.playbackRate,this.#preferences.playbackRate=preferences.playbackRate,this.#hasPreferences=!0),!hasOwn(preferences,"textTrack")))return;const requested=preferences.textTrack;if(requested!==null&&!validTextTrackPreference(requested))return;const tracks=textTracks(media);if(requested===null){for(const track of tracks)USER_SELECTABLE_TRACK_KINDS.has(track.kind)&&(track.mode="disabled");this.#preferences.textTrack=null,this.#hasPreferences=!0;return}const exact=tracks.find(track=>track.kind===requested.kind&&track.label===requested.label&&track.language===requested.language),indexed=tracks[requested.index],selected=exact??(indexed?.kind===requested.kind?indexed:void 0);if(selected){for(const track of tracks)USER_SELECTABLE_TRACK_KINDS.has(track.kind)&&(track.mode=track===selected?"showing":"disabled");this.#preferences.textTrack=textTrackPreference(selected,tracks.indexOf(selected)),this.#hasPreferences=!0}}#rememberUserPreferences(media){media&&(this.#preferences=this.captureUserPreferences(media),this.#hasPreferences=!0)}#bindListeners(){const media=this.#media;if(!media||!this.#active||this.#listeners.size>0)return;const generation=this.#generation;for(const name of this.#eventNames){const listener=event=>{if(!(!this.#active||generation!==this.#generation||media!==this.#media||event.currentTarget!==media)&&(this.#synchronizeNativeState(event.type),this.#onEvent?.(event,this),generation===this.#generation&&media===this.#media&&this.#relayEvents.has(event.type))){const EventConstructor=media.ownerDocument.defaultView?.Event??Event;this.target.dispatchEvent(new EventConstructor(event.type))}};media.addEventListener(name,listener),this.#listeners.set(name,listener)}}#unbindListeners(){const media=this.#media;if(media)for(const[name,listener]of this.#listeners)media.removeEventListener(name,listener);this.#listeners.clear()}#synchronizeNativeState(type){const media=this.#media;if(media){if((type==="loadedmetadata"||type==="durationchange")&&(this.#duration=mediaDuration(media),this.#pendingCurrentTime!==null)){const pending=this.#pendingCurrentTime;this.#pendingCurrentTime=null,this.currentTime=pending}if(type==="timeupdate"||type==="seeked"){const max=this.duration>0?this.duration:Number.POSITIVE_INFINITY;this.#currentTime=finiteRange(media.currentTime,this.#currentTime,0,max)}(type==="volumechange"||type==="ratechange")&&this.#rememberUserPreferences(media)}}}export{MAX_NATIVE_PLAYBACK_RATE,MIN_NATIVE_PLAYBACK_RATE,NATIVE_MEDIA_RELAY_EVENTS,NativeMediaController,canExitFullscreen,canRequestFullscreen,canRequestPictureInPicture,cloneSafeMediaNodes,safeNativeMediaSource};
|
|
1
|
+
import{finiteRange}from"./numbers.js";import{safeMediaSrc}from"./safe-url.js";const MIN_NATIVE_PLAYBACK_RATE=.0625,MAX_NATIVE_PLAYBACK_RATE=16,NATIVE_MEDIA_RELAY_EVENTS=["ended","error","loadedmetadata","pause","play","timeupdate","volumechange"],CONTROLLER_EVENT_NAMES=[...NATIVE_MEDIA_RELAY_EVENTS,"durationchange","ratechange","seeked"],TRACK_KINDS=new Set(["subtitles","captions","descriptions","chapters","metadata"]),USER_SELECTABLE_TRACK_KINDS=new Set(["subtitles","captions","descriptions"]),SOURCE_ATTRIBUTES=["type","media"],TRACK_ATTRIBUTES=["srclang","label"];function isValidVolume(value){return typeof value=="number"&&Number.isFinite(value)&&value>=0&&value<=1}function isValidPlaybackRate(value){return typeof value=="number"&&Number.isFinite(value)&&value>=MIN_NATIVE_PLAYBACK_RATE&&value<=MAX_NATIVE_PLAYBACK_RATE}function mediaDuration(media){return finiteRange(media?.duration??0,0,0)}function directMediaChildren(media){return[...media.children].filter(child=>child.localName==="source"||child.localName==="track")}function textTracks(media){const tracks=[];for(let index=0;index<media.textTracks.length;index+=1){const track=media.textTracks[index];track&&tracks.push(track)}return tracks}function textTrackPreference(track,index){return{index,kind:track.kind,label:track.label,language:track.language}}function validTextTrackPreference(value){if(value===null||typeof value!="object")return!1;const candidate=value;return typeof candidate.index=="number"&&Number.isInteger(candidate.index)&&candidate.index>=0&&typeof candidate.kind=="string"&&typeof candidate.label=="string"&&typeof candidate.language=="string"}function hasOwn(value,key){return Object.prototype.hasOwnProperty.call(value,key)}function safeNativeMediaSource(value){return safeMediaSrc(value)}function cloneSafeMediaNodes(nodes,targetDocument){const clones=[];for(const node of nodes){if(node.nodeType!==1)continue;const source=node,url=safeMediaSrc(source.getAttribute("src"));if(!url)continue;if(source.localName==="source"){const clone2=targetDocument.createElement("source");clone2.setAttribute("src",url);for(const attribute of SOURCE_ATTRIBUTES){const value=source.getAttribute(attribute);value!==null&&clone2.setAttribute(attribute,value)}clones.push(clone2);continue}if(source.localName!=="track")continue;const declaredKind=source.getAttribute("kind"),kind=declaredKind===null?"subtitles":declaredKind.toLowerCase();if(!TRACK_KINDS.has(kind))continue;const clone=targetDocument.createElement("track");clone.setAttribute("src",url),clone.setAttribute("kind",kind);for(const attribute of TRACK_ATTRIBUTES){const value=source.getAttribute(attribute);value!==null&&clone.setAttribute(attribute,value)}source.hasAttribute("default")&&clone.setAttribute("default",""),clones.push(clone)}return clones}function canRequestFullscreen(element){return element?typeof element.requestFullscreen=="function"&&element.ownerDocument.fullscreenEnabled!==!1:!1}function canExitFullscreen(documentRef){return!!(documentRef&&typeof documentRef.exitFullscreen=="function")}function canRequestPictureInPicture(media){if(!media)return!1;const candidate=media,documentRef=media.ownerDocument;return media.localName==="video"&&typeof candidate.requestPictureInPicture=="function"&&documentRef.pictureInPictureEnabled!==!1&&candidate.disablePictureInPicture!==!0}class NativeMediaController{#media;#active=!0;#generation=0;#duration=0;#currentTime=0;#pendingCurrentTime=null;#listeners=new Map;#eventNames;#relayEvents;#preferences={};#hasPreferences=!1;#onEvent;constructor(target,options={}){this.target=target,this.#relayEvents=new Set(options.relayEvents??NATIVE_MEDIA_RELAY_EVENTS),this.#eventNames=new Set(options.events??CONTROLLER_EVENT_NAMES);for(const name of this.#relayEvents)this.#eventNames.add(name);this.#onEvent=options.onEvent}get element(){return this.#media}get generation(){return this.#generation}isCurrentGeneration(generation,media=this.#media){return this.#active&&generation===this.#generation&&media===this.#media}get duration(){return finiteRange(this.#duration||mediaDuration(this.#media),0,0)}get currentTime(){if(this.#pendingCurrentTime!==null)return this.#pendingCurrentTime;const max=this.duration>0?this.duration:Number.POSITIVE_INFINITY,nativeValue=this.#media?.currentTime;return finiteRange(nativeValue??this.#currentTime,this.#currentTime,0,max)}set currentTime(value){const max=this.duration>0?this.duration:Number.POSITIVE_INFINITY,next=finiteRange(value,0,0,max);if(this.#currentTime=next,!this.#media){this.#pendingCurrentTime=next;return}try{this.#media.currentTime=next,this.#pendingCurrentTime=null}catch{this.#pendingCurrentTime=next}}get volume(){const nativeValue=this.#media?.volume;return isValidVolume(nativeValue)?nativeValue:isValidVolume(this.#preferences.volume)?this.#preferences.volume:1}set volume(value){const next=finiteRange(value,this.volume,0,1);this.#preferences.volume=next,this.#hasPreferences=!0,this.#media&&(this.#media.volume=next)}get muted(){return this.#media?.muted??this.#preferences.muted??!1}set muted(value){const next=!!value;this.#preferences.muted=next,this.#hasPreferences=!0,this.#media&&(this.#media.muted=next)}get playbackRate(){const nativeValue=this.#media?.playbackRate;return isValidPlaybackRate(nativeValue)?nativeValue:isValidPlaybackRate(this.#preferences.playbackRate)?this.#preferences.playbackRate:1}set playbackRate(value){const next=finiteRange(value,1,MIN_NATIVE_PLAYBACK_RATE,MAX_NATIVE_PLAYBACK_RATE);this.#preferences.playbackRate=next,this.#hasPreferences=!0,this.#media&&(this.#media.playbackRate=next)}attach(media){if(media===this.#media){media&&this.#active&&this.#listeners.size===0&&this.#bindListeners();return}const previous=this.#media;previous&&(this.#rememberUserPreferences(previous),this.#unbindListeners(),this.#generation+=1,this.#active&&previous.pause()),this.#media=media??void 0,this.#duration=0,this.#currentTime=0,(previous||!media)&&(this.#pendingCurrentTime=null),media&&(this.#hasPreferences?this.applyUserPreferences(this.#preferences,media):this.#rememberUserPreferences(media),this.#active&&this.#bindListeners())}startGeneration(){return this.#rememberUserPreferences(this.#media),this.#unbindListeners(),this.#generation+=1,this.#media?.pause(),this.#duration=0,this.#currentTime=0,this.#pendingCurrentTime=null,this.#active&&this.#media&&this.#bindListeners(),this.#generation}disconnect(){this.#active&&(this.#rememberUserPreferences(this.#media),this.#active=!1,this.#unbindListeners(),this.#generation+=1,this.#media?.pause())}reconnect(){this.#active||(this.#active=!0,this.#generation+=1,this.#media&&(this.applyUserPreferences(this.#preferences,this.#media),this.#bindListeners()))}play(){return this.#media?.play()??Promise.resolve()}pause(){this.#media?.pause()}load(){this.#media&&(this.#rememberUserPreferences(this.#media),this.#unbindListeners(),this.#generation+=1,this.#duration=0,this.#currentTime=0,this.#pendingCurrentTime=null,this.#active&&this.#bindListeners(),this.#media.load())}unload(){const media=this.#media;if(media){this.startGeneration(),media.removeAttribute("src");for(const child of directMediaChildren(media))child.remove();media.load()}}setSources(sourceSet){const media=this.#media;if(!media)return!1;const rawSrc=typeof sourceSet.src=="string"?sourceSet.src.trim():sourceSet.src,hasDirectSrc=rawSrc!=null&&rawSrc!=="",directSrc=hasDirectSrc?safeMediaSrc(rawSrc):null;if(hasDirectSrc&&!directSrc)return(media.hasAttribute("src")||directMediaChildren(media).length>0)&&this.unload(),!1;const clones=cloneSafeMediaNodes(sourceSet.nodes??[],media.ownerDocument),hasSource=!!(directSrc||clones.some(node=>node.localName==="source"));this.startGeneration(),media.removeAttribute("src");for(const child of directMediaChildren(media))child.remove();directSrc&&media.setAttribute("src",directSrc);for(const clone of clones)media.append(clone);return media.load(),hasSource}captureUserPreferences(media=this.#media){if(!media)return{};const preferences={};isValidVolume(media.volume)&&(preferences.volume=media.volume),typeof media.muted=="boolean"&&(preferences.muted=media.muted),isValidPlaybackRate(media.playbackRate)&&(preferences.playbackRate=media.playbackRate);const tracks=textTracks(media),showingIndex=tracks.findIndex(track=>track.mode==="showing");return preferences.textTrack=showingIndex>=0&&tracks[showingIndex]?textTrackPreference(tracks[showingIndex],showingIndex):null,preferences}applyUserPreferences(preferences,media=this.#media){if(!media||preferences===null||typeof preferences!="object"||(isValidVolume(preferences.volume)&&(media.volume=preferences.volume,this.#preferences.volume=preferences.volume,this.#hasPreferences=!0),typeof preferences.muted=="boolean"&&(media.muted=preferences.muted,this.#preferences.muted=preferences.muted,this.#hasPreferences=!0),isValidPlaybackRate(preferences.playbackRate)&&(media.playbackRate=preferences.playbackRate,this.#preferences.playbackRate=preferences.playbackRate,this.#hasPreferences=!0),!hasOwn(preferences,"textTrack")))return;const requested=preferences.textTrack;if(requested!==null&&!validTextTrackPreference(requested))return;const tracks=textTracks(media);if(requested===null){for(const track of tracks)USER_SELECTABLE_TRACK_KINDS.has(track.kind)&&(track.mode="disabled");this.#preferences.textTrack=null,this.#hasPreferences=!0;return}const exact=tracks.find(track=>track.kind===requested.kind&&track.label===requested.label&&track.language===requested.language),indexed=tracks[requested.index],selected=exact??(indexed?.kind===requested.kind?indexed:void 0);if(selected){for(const track of tracks)USER_SELECTABLE_TRACK_KINDS.has(track.kind)&&(track.mode=track===selected?"showing":"disabled");this.#preferences.textTrack=textTrackPreference(selected,tracks.indexOf(selected)),this.#hasPreferences=!0}}#rememberUserPreferences(media){media&&(this.#preferences=this.captureUserPreferences(media),this.#hasPreferences=!0)}#bindListeners(){const media=this.#media;if(!media||!this.#active||this.#listeners.size>0)return;const generation=this.#generation;for(const name of this.#eventNames){const listener=event=>{if(!(!this.#active||generation!==this.#generation||media!==this.#media||event.currentTarget!==media)&&(this.#synchronizeNativeState(event.type),this.#onEvent?.(event,this),generation===this.#generation&&media===this.#media&&this.#relayEvents.has(event.type))){const EventConstructor=media.ownerDocument.defaultView?.Event??Event;this.target.dispatchEvent(new EventConstructor(event.type))}};media.addEventListener(name,listener),this.#listeners.set(name,listener)}}#unbindListeners(){const media=this.#media;if(media)for(const[name,listener]of this.#listeners)media.removeEventListener(name,listener);this.#listeners.clear()}#synchronizeNativeState(type){const media=this.#media;if(media){if((type==="loadedmetadata"||type==="durationchange")&&(this.#duration=mediaDuration(media),this.#pendingCurrentTime!==null)){const pending=this.#pendingCurrentTime;this.#pendingCurrentTime=null,this.currentTime=pending}if(type==="timeupdate"||type==="seeked"){const max=this.duration>0?this.duration:Number.POSITIVE_INFINITY;this.#currentTime=finiteRange(media.currentTime,this.#currentTime,0,max)}(type==="volumechange"||type==="ratechange")&&this.#rememberUserPreferences(media)}}}export{MAX_NATIVE_PLAYBACK_RATE,MIN_NATIVE_PLAYBACK_RATE,NATIVE_MEDIA_RELAY_EVENTS,NativeMediaController,canExitFullscreen,canRequestFullscreen,canRequestPictureInPicture,cloneSafeMediaNodes,safeNativeMediaSource};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const LYRA_PACKAGE_NAME="@aceshooting/lyra-ui",LYRA_PACKAGE_VERSION="
|
|
1
|
+
const LYRA_PACKAGE_NAME="@aceshooting/lyra-ui",LYRA_PACKAGE_VERSION="11.0.0";export{LYRA_PACKAGE_NAME,LYRA_PACKAGE_VERSION};
|
|
@@ -1,24 +1,40 @@
|
|
|
1
1
|
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
-
/** Attribute this controller toggles on the tracked element
|
|
3
|
-
* root (never on the host), so it
|
|
2
|
+
/** Attribute this controller toggles on the tracked element whenever it overflows at all (in
|
|
3
|
+
* either logical direction). Lives in the component's own shadow root (never on the host), so it
|
|
4
|
+
* is an internal styling hook, not consumer-visible DOM. Kept alongside the normalized
|
|
5
|
+
* `SCROLL_START_ATTRIBUTE`/`SCROLL_END_ATTRIBUTE` pair below (not replaced by them) because it is
|
|
6
|
+
* the cheap "is there anything to gate on at all" check every consumer's CSS combines with one or
|
|
7
|
+
* both of the logical-edge attributes -- see any of `segmented.styles.ts`/`stepper.styles.ts`/
|
|
8
|
+
* `timeline.styles.ts`/`widget.styles.ts`/`tab-group.styles.ts` for the combined selector shape. */
|
|
4
9
|
export declare const SCROLL_OVERFLOW_ATTRIBUTE = "data-scroll-overflow";
|
|
10
|
+
/** Set on the tracked element while there is more content to reach by scrolling further toward its
|
|
11
|
+
* logical *start* (i.e. the track is not already at its start edge) -- RTL-aware via `isRtl()` on
|
|
12
|
+
* the tracked element itself, matching `<lr-tab-group>`'s original per-component computation. */
|
|
13
|
+
export declare const SCROLL_START_ATTRIBUTE = "data-scroll-start";
|
|
14
|
+
/** Set on the tracked element while there is more content to reach by scrolling further toward its
|
|
15
|
+
* logical *end*. See `SCROLL_START_ATTRIBUTE`. */
|
|
16
|
+
export declare const SCROLL_END_ATTRIBUTE = "data-scroll-end";
|
|
5
17
|
/**
|
|
6
|
-
* Tracks whether a horizontally scrollable track *actually* overflows,
|
|
7
|
-
*
|
|
8
|
-
* `--lr-scroll-fade-size` mask
|
|
18
|
+
* Tracks whether a horizontally scrollable track *actually* overflows, and -- since which logical
|
|
19
|
+
* edge(s) still have content to reach -- toggles three attributes on it so styles can gate an edge
|
|
20
|
+
* affordance (the `--lr-scroll-fade-size` mask, and in `<lr-tab-group>`'s case a pair of scroll
|
|
21
|
+
* buttons too) on there being something to scroll to, on the correct side:
|
|
22
|
+
* - `SCROLL_OVERFLOW_ATTRIBUTE` -- overflows at all, in either direction.
|
|
23
|
+
* - `SCROLL_START_ATTRIBUTE` / `SCROLL_END_ATTRIBUTE` -- there is more to reach toward that
|
|
24
|
+
* logical edge specifically, RTL-aware. A track already scrolled to its start no longer sets
|
|
25
|
+
* `SCROLL_START_ATTRIBUTE`, so a consumer combining `[data-scroll-overflow][data-scroll-end]`
|
|
26
|
+
* with `:not([data-scroll-start])` (the shape every one-sided mask rule in this library uses)
|
|
27
|
+
* fades only the reachable edge instead of dimming a side that is already fully in view.
|
|
9
28
|
*
|
|
10
|
-
* Why this exists: the
|
|
11
|
-
* `lr-
|
|
29
|
+
* Why this exists: the components carrying that mask (`lr-segmented`, `lr-tab-group`, `lr-stepper`,
|
|
30
|
+
* `lr-timeline`, `lr-widget`) used to paint it unconditionally, deliberately -- "a low-cost
|
|
12
31
|
* affordance for an overflowing row [that] does not need scroll-position JavaScript or observers".
|
|
13
32
|
* The cost of skipping the measurement is not low, though: on a track that fits, the fade is pure
|
|
14
33
|
* damage. At the default `2rem` per edge, a two-option `<lr-segmented>` (`Overall | Daily`) is
|
|
15
34
|
* narrower than its own two fades, so *both* labels render half-transparent against the page --
|
|
16
|
-
* reported as the control looking permanently disabled.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* rendering for the overflowing case this was always meant to serve. Per-edge fades keyed to
|
|
20
|
-
* `scrollLeft` would need a scroll listener on top of this; that is a separate feature, not a
|
|
21
|
-
* bug fix.
|
|
35
|
+
* reported as the control looking permanently disabled. A single symmetric boolean fixed that but
|
|
36
|
+
* introduced a smaller version of the same defect: a track scrolled fully to one edge still dims
|
|
37
|
+
* that edge, because the boolean alone carries no scroll-position information.
|
|
22
38
|
*
|
|
23
39
|
* Update sources are split, because they catch different changes:
|
|
24
40
|
* - `ResizeObserver` on the track -- the *container* got narrower/wider (viewport resize, a
|
|
@@ -26,6 +42,12 @@ export declare const SCROLL_OVERFLOW_ATTRIBUTE = "data-scroll-overflow";
|
|
|
26
42
|
* - `hostUpdated()` -- the *content* changed (segments added, a tab label re-localized). A
|
|
27
43
|
* `ResizeObserver` on the track observes only its own border box, which a content change
|
|
28
44
|
* inside a scroll container need not alter at all, so this is not redundant with the above.
|
|
45
|
+
* - `scroll` on the track -- the user (or a programmatic `scrollTo`/`scrollIntoView`) moved the
|
|
46
|
+
* scroll position without resizing anything or triggering a host update at all.
|
|
47
|
+
* - `observeExtra()` -- a descendant's own intrinsic geometry changed independently of the
|
|
48
|
+
* tracked element's border box (a slotted button's label growing, an icon loading in) without
|
|
49
|
+
* the tracked element's own box moving at all, which the plain `ResizeObserver` above cannot
|
|
50
|
+
* see on its own. See that method's own doc.
|
|
29
51
|
*
|
|
30
52
|
* @example
|
|
31
53
|
* // in the component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const SCROLL_OVERFLOW_ATTRIBUTE="data-scroll-overflow",TOLERANCE_PX=1;class ScrollOverflowController{#observer;#observed;#ownerWindow;constructor(host,resolve,onResize){this.resolve=resolve,this.onResize=onResize,host.addController(this)}hostConnected(){this.sync()}hostUpdated(){this.sync()}sync(){const element=this.resolve(),ownerWindow=element?.ownerDocument.defaultView??void 0;if(element!==this.#observed||ownerWindow!==this.#ownerWindow){this.resetObservation(),this.#observed=element??void 0,this.#ownerWindow=ownerWindow;const ResizeObserverConstructor=ownerWindow?.ResizeObserver;if(element&&ResizeObserverConstructor){const observer=new ResizeObserverConstructor(()=>{this.#observer!==observer||this.#observed!==element||element.ownerDocument.defaultView!==ownerWindow||(this.measure(),this.onResize?.())});this.#observer=observer,observer.observe(element)}}this.measure()}hostDisconnected(){this.resetObservation()}resetObservation(){this.#observer?.disconnect(),this.#observer=void 0,this.#observed=void 0,this.#ownerWindow=void 0}measure(){const element=this.#observed;if(!element)return;const
|
|
1
|
+
import{isRtl}from"./rtl.js";const SCROLL_OVERFLOW_ATTRIBUTE="data-scroll-overflow",SCROLL_START_ATTRIBUTE="data-scroll-start",SCROLL_END_ATTRIBUTE="data-scroll-end",TOLERANCE_PX=1;class ScrollOverflowController{#observer;#observed;#ownerWindow;#scrollTarget;#onScroll=()=>this.measure();constructor(host,resolve,onResize){this.resolve=resolve,this.onResize=onResize,host.addController(this)}hostConnected(){this.sync()}hostUpdated(){this.sync()}sync(){const element=this.resolve(),ownerWindow=element?.ownerDocument.defaultView??void 0;if(element!==this.#observed||ownerWindow!==this.#ownerWindow){this.resetObservation(),this.#observed=element??void 0,this.#ownerWindow=ownerWindow,element&&(element.addEventListener("scroll",this.#onScroll,{passive:!0}),this.#scrollTarget=element);const ResizeObserverConstructor=ownerWindow?.ResizeObserver;if(element&&ResizeObserverConstructor){const observer=new ResizeObserverConstructor(()=>{this.#observer!==observer||this.#observed!==element||element.ownerDocument.defaultView!==ownerWindow||(this.measure(),this.onResize?.())});this.#observer=observer,observer.observe(element)}}this.measure()}hostDisconnected(){this.resetObservation()}resetObservation(){this.#observer?.disconnect(),this.#observer=void 0,this.#observed=void 0,this.#ownerWindow=void 0,this.#scrollTarget?.removeEventListener("scroll",this.#onScroll),this.#scrollTarget=void 0}measure(){const element=this.#observed;if(!element)return;const extent=Math.max(0,element.scrollWidth-element.clientWidth),overflows=extent>TOLERANCE_PX;if(element.toggleAttribute(SCROLL_OVERFLOW_ATTRIBUTE,overflows),!overflows){element.toggleAttribute(SCROLL_START_ATTRIBUTE,!1),element.toggleAttribute(SCROLL_END_ATTRIBUTE,!1);return}const raw=isRtl(element)?-element.scrollLeft:element.scrollLeft,position=Math.max(0,Math.min(extent,raw));element.toggleAttribute(SCROLL_START_ATTRIBUTE,position>TOLERANCE_PX),element.toggleAttribute(SCROLL_END_ATTRIBUTE,position<extent-TOLERANCE_PX)}observeExtra(elements){if(this.#observer)for(const element of elements)this.#observer.observe(element)}}function observeScrollOverflow(host,resolve,onResize){return new ScrollOverflowController(host,resolve,onResize)}export{SCROLL_END_ATTRIBUTE,SCROLL_OVERFLOW_ATTRIBUTE,SCROLL_START_ATTRIBUTE,ScrollOverflowController,observeScrollOverflow};
|
|
@@ -7,8 +7,6 @@ import{css}from"lit";const sizes=css`
|
|
|
7
7
|
--lr-form-control-height-l: var(--lr-theme-form-control-height-l, 3rem);
|
|
8
8
|
--lr-form-control-height-xl: var(--lr-theme-form-control-height-xl, 3.5rem);
|
|
9
9
|
|
|
10
|
-
/* The default tier is "m"; these :host declarations ARE that tier, so a :host([size='m']) block
|
|
11
|
-
would only restate them. */
|
|
12
10
|
--lr-form-control-height: var(--lr-form-control-height-m);
|
|
13
11
|
--lr-form-control-font-size: var(--lr-font-size-m);
|
|
14
12
|
--lr-form-control-padding-inline: var(--lr-space-m);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import{css}from"lit";const lightSpecialistTokens=css`
|
|
2
|
-
/* chart fallback ramp: generated (light) -- see scripts/generate-chart-palette.mjs */
|
|
3
2
|
--lr-color-chart-1: var(--lr-theme-color-chart-1, #0e006e);
|
|
4
3
|
--lr-color-chart-2: var(--lr-theme-color-chart-2, #4d011a);
|
|
5
4
|
--lr-color-chart-3: var(--lr-theme-color-chart-3, #862002);
|
|
@@ -8,7 +7,6 @@ import{css}from"lit";const lightSpecialistTokens=css`
|
|
|
8
7
|
--lr-color-chart-6: var(--lr-theme-color-chart-6, #935e7c);
|
|
9
8
|
--lr-color-chart-7: var(--lr-theme-color-chart-7, #de6906);
|
|
10
9
|
--lr-color-chart-8: var(--lr-theme-color-chart-8, #8f81d3);
|
|
11
|
-
/* chart fallback ramp: end */
|
|
12
10
|
--lr-graph-cat-1: var(--lr-theme-graph-cat-1, #8250df);
|
|
13
11
|
--lr-graph-cat-2: var(--lr-theme-graph-cat-2, #bf3989);
|
|
14
12
|
--lr-graph-cat-3: var(--lr-theme-graph-cat-3, #0a7d91);
|
|
@@ -17,7 +15,6 @@ import{css}from"lit";const lightSpecialistTokens=css`
|
|
|
17
15
|
--lr-graph-cat-6: var(--lr-theme-graph-cat-6, #f470b8);
|
|
18
16
|
--lr-graph-cat-7: var(--lr-theme-graph-cat-7, #52d6e8);
|
|
19
17
|
--lr-graph-cat-8: var(--lr-theme-graph-cat-8, #c9d1d9);
|
|
20
|
-
/* terminal ramp: generated (light) -- see scripts/generate-terminal-palette.mjs */
|
|
21
18
|
--lr-terminal-color-black: var(--lr-theme-terminal-color-black, #2b2b2b);
|
|
22
19
|
--lr-terminal-color-red: var(--lr-theme-terminal-color-red, #901114);
|
|
23
20
|
--lr-terminal-color-green: var(--lr-theme-terminal-color-green, #015e15);
|
|
@@ -50,9 +47,7 @@ import{css}from"lit";const lightSpecialistTokens=css`
|
|
|
50
47
|
--lr-terminal-bg-bright-magenta: var(--lr-theme-terminal-bg-bright-magenta, #d6b4f0);
|
|
51
48
|
--lr-terminal-bg-bright-cyan: var(--lr-theme-terminal-bg-bright-cyan, #8dd2da);
|
|
52
49
|
--lr-terminal-bg-bright-white: var(--lr-theme-terminal-bg-bright-white, #d1d1d1);
|
|
53
|
-
/* terminal ramp: end */
|
|
54
50
|
`,darkSpecialistTokens=css`
|
|
55
|
-
/* chart fallback ramp: generated (dark) -- see scripts/generate-chart-palette.mjs */
|
|
56
51
|
--lr-color-chart-1: var(--lr-theme-color-chart-1, #bbff94);
|
|
57
52
|
--lr-color-chart-2: var(--lr-theme-color-chart-2, #ffbce8);
|
|
58
53
|
--lr-color-chart-3: var(--lr-theme-color-chart-3, #2bd66a);
|
|
@@ -61,7 +56,6 @@ import{css}from"lit";const lightSpecialistTokens=css`
|
|
|
61
56
|
--lr-color-chart-6: var(--lr-theme-color-chart-6, #9b6b90);
|
|
62
57
|
--lr-color-chart-7: var(--lr-theme-color-chart-7, #db3a29);
|
|
63
58
|
--lr-color-chart-8: var(--lr-theme-color-chart-8, #555de3);
|
|
64
|
-
/* chart fallback ramp: end */
|
|
65
59
|
--lr-graph-cat-1: var(--lr-theme-graph-cat-1, #b58cff);
|
|
66
60
|
--lr-graph-cat-2: var(--lr-theme-graph-cat-2, #ff7ab2);
|
|
67
61
|
--lr-graph-cat-3: var(--lr-theme-graph-cat-3, #4fd1c5);
|
|
@@ -70,7 +64,6 @@ import{css}from"lit";const lightSpecialistTokens=css`
|
|
|
70
64
|
--lr-graph-cat-6: var(--lr-theme-graph-cat-6, #ff91c8);
|
|
71
65
|
--lr-graph-cat-7: var(--lr-theme-graph-cat-7, #79e2ef);
|
|
72
66
|
--lr-graph-cat-8: var(--lr-theme-graph-cat-8, #e4e7eb);
|
|
73
|
-
/* terminal ramp: generated (dark) -- see scripts/generate-terminal-palette.mjs */
|
|
74
67
|
--lr-terminal-color-black: var(--lr-theme-terminal-color-black, #929292);
|
|
75
68
|
--lr-terminal-color-red: var(--lr-theme-terminal-color-red, #f9786c);
|
|
76
69
|
--lr-terminal-color-green: var(--lr-theme-terminal-color-green, #67bb6b);
|
|
@@ -103,7 +96,6 @@ import{css}from"lit";const lightSpecialistTokens=css`
|
|
|
103
96
|
--lr-terminal-bg-bright-magenta: var(--lr-theme-terminal-bg-bright-magenta, #73548a);
|
|
104
97
|
--lr-terminal-bg-bright-cyan: var(--lr-theme-terminal-bg-bright-cyan, #286f76);
|
|
105
98
|
--lr-terminal-bg-bright-white: var(--lr-theme-terminal-bg-bright-white, #696969);
|
|
106
|
-
/* terminal ramp: end */
|
|
107
99
|
`,forcedColorSpecialistTokens=css`
|
|
108
100
|
--lr-color-chart-1: Highlight;
|
|
109
101
|
--lr-color-chart-2: LinkText;
|
|
@@ -125,7 +117,6 @@ import{css}from"lit";const lightSpecialistTokens=css`
|
|
|
125
117
|
:host {${lightSpecialistTokens}
|
|
126
118
|
}
|
|
127
119
|
|
|
128
|
-
/* @media (prefers-color-scheme: dark) */
|
|
129
120
|
@media (prefers-color-scheme: dark) {
|
|
130
121
|
:host(:not([data-lr-theme='light'])) {${darkSpecialistTokens}
|
|
131
122
|
}
|
|
@@ -136,9 +127,13 @@ import{css}from"lit";const lightSpecialistTokens=css`
|
|
|
136
127
|
:host(:not([data-lr-theme='light'])):host-context([data-lr-theme='dark']) {${darkSpecialistTokens}
|
|
137
128
|
}
|
|
138
129
|
|
|
139
|
-
/* @media (forced-colors: active) */
|
|
140
130
|
@media (forced-colors: active) {
|
|
141
|
-
:host
|
|
131
|
+
:host,
|
|
132
|
+
:host(:not([data-lr-theme='light'])),
|
|
133
|
+
:host([data-lr-theme='dark']) {${forcedColorSpecialistTokens}
|
|
134
|
+
}
|
|
135
|
+
:host(:not([data-lr-theme='light'])):host-context(.lr-dark),
|
|
136
|
+
:host(:not([data-lr-theme='light'])):host-context([data-lr-theme='dark']) {${forcedColorSpecialistTokens}
|
|
142
137
|
}
|
|
143
138
|
}
|
|
144
139
|
`;export{specialistTokens};
|
|
@@ -11,7 +11,10 @@ export interface HighlightHandle {
|
|
|
11
11
|
/** Marks (or clears, with `null`) this owner's single active-state range. */
|
|
12
12
|
setActive(range: Range | null): void;
|
|
13
13
|
/** Applies a one-shot emphasis flash to `range` for `durationMs` (default 1800, matching
|
|
14
|
-
* `--lr-transition-ambient`'s default), then clears it automatically.
|
|
14
|
+
* `--lr-transition-ambient`'s default), then clears it automatically. `durationMs` is routed
|
|
15
|
+
* through `finiteDuration()`: a non-finite value (`NaN`/`Infinity`, e.g. from an untyped
|
|
16
|
+
* caller) falls back to the 1800ms default rather than firing immediately or never, and a
|
|
17
|
+
* negative value clamps to 0 -- the clear still runs on a fresh async timer, never inline. */
|
|
15
18
|
flash(range: Range, durationMs?: number): void;
|
|
16
19
|
/** Removes every range this owner painted, across every tone/active/flash state. */
|
|
17
20
|
release(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{TEXT_QUOTE_LIMITS}from"./text-quote.js";const TONE_NAMES=["accent","success","warning","danger","neutral"],DEFAULT_FLASH_MS=1800,FALLBACK_RANGE_LIMIT=200,FALLBACK_MARK_LIMIT=200,documentStates=new WeakMap,failedDocumentRealms=new WeakMap;function defaultDocument(){return typeof document>"u"?null:document}function highlightRealm(doc){const view=doc?.defaultView;if(!view)return null;const globals=view,ctor=globals.Highlight,registry=globals.CSS?.highlights;return typeof ctor=="function"&®istry&&typeof registry.set=="function"?{ctor,registry}:null}function matchesRealm(left,right){return left?.ctor===right.ctor&&left.registry===right.registry}function supportsCustomHighlights(doc=defaultDocument()){const realm=highlightRealm(doc);return realm!==null&&(!doc||!matchesRealm(failedDocumentRealms.get(doc),realm))}function highlightName(tone){return`lr-highlight-${tone}`}function stateForDocument(doc,realm){const existing=documentStates.get(doc);if(existing?.ctor===realm.ctor&&existing.registry===realm.registry)return existing;const state={...realm,highlightObjects:new Map,ownersByName:new Map},entries=[...TONE_NAMES.map(tone=>[highlightName(tone),0]),["lr-highlight-active",1],["lr-highlight-flash",2]];for(const[name,priority]of entries){const highlight=new realm.ctor;highlight.priority=priority,state.highlightObjects.set(name,highlight),state.ownersByName.set(name,new Map),realm.registry.set(name,highlight)}return documentStates.set(doc,state),state}function replaceCssOwned(state,name,owner,ranges){const highlight=state.highlightObjects.get(name),owners=state.ownersByName.get(name);if(!highlight||!owners)return;const previous=owners.get(owner);if(previous)for(const r of previous)highlight.delete(r);const next=new Set(ranges);for(const r of next)highlight.add(r);next.size>0?owners.set(owner,next):owners.delete(owner)}function splitTextNodeAtRange(range,textNode){const start=textNode===range.startContainer?range.startOffset:0,end=textNode===range.endContainer?range.endOffset:textNode.data.length;let target=textNode;return end<target.data.length&&target.splitText(end),start>0&&(target=target.splitText(start)),target}function nextNodeWithin(node,root){if(node.firstChild)return node.firstChild;let cursor=node;for(;cursor&&cursor!==root;){if(cursor.nextSibling)return cursor.nextSibling;cursor=cursor.parentNode}return null}function wrapRangeInMarks(range,name,tone,doc,budget){const ancestor=range.commonAncestorContainer,textNodeType=doc.defaultView?.Node.TEXT_NODE??3,covered=[];let node=ancestor;for(;node&&budget.traversalNodes>0&&budget.codeUnits>0;){if(budget.traversalNodes--,node.nodeType===textNodeType){const textNode=node;if(textNode.data.length>budget.codeUnits){budget.codeUnits=0;break}budget.codeUnits-=textNode.data.length;try{if(textNode.data.length>0&&range.intersectsNode(textNode)&&(covered.push(textNode),covered.length>budget.marks))return[]}catch{return[]}}node=nextNodeWithin(node,ancestor)}if(node)return[];const marks=[];for(const textNode of covered){const inRange=splitTextNodeAtRange(range,textNode);if(!inRange.data)continue;const mark=doc.createElement("mark");if(mark.setAttribute("data-lr-highlight-tone",tone),mark.setAttribute("data-lr-highlight-name",name),mark.setAttribute("role","mark"),inRange.parentNode?.insertBefore(mark,inRange),mark.appendChild(inRange),marks.push(mark),budget.marks--,budget.marks<=0)break}return marks}function unwrapMark(mark){const parent=mark.parentNode;if(!parent)return;const before=mark.previousSibling,firstMoved=mark.firstChild;for(;mark.firstChild;)parent.insertBefore(mark.firstChild,mark);const after=mark.nextSibling;parent.removeChild(mark);let cursor=before?.nodeType===Node.TEXT_NODE?before:firstMoved??after,localSteps=0;for(;cursor&&cursor.parentNode===parent&&localSteps++<4&&cursor.nodeType===Node.TEXT_NODE;){const text=cursor;if(text.data===""){const next2=text.nextSibling;text.remove(),cursor=next2;continue}const next=text.nextSibling;if(next?.nodeType!==Node.TEXT_NODE)break;text.appendData(next.data),next.remove()}}function acquireFallbackHandle(_owner,doc){const marksByName=new Map,view=doc.defaultView;function clear(name){for(const mark of marksByName.get(name)??[])unwrapMark(mark);marksByName.set(name,[])}function paint(name,tone,ranges){clear(name);const marks=[],budget={traversalNodes:TEXT_QUOTE_LIMITS.maxTraversalNodes,codeUnits:TEXT_QUOTE_LIMITS.maxCorpusCodeUnits,marks:FALLBACK_MARK_LIMIT},count=Math.min(ranges.length,FALLBACK_RANGE_LIMIT);for(let index=0;index<count&&budget.traversalNodes>0&&budget.codeUnits>0&&budget.marks>0;index++)marks.push(...wrapRangeInMarks(ranges[index],name,tone,doc,budget));marksByName.set(name,marks)}let flashTimer,flashGeneration=0;function cancelFlashTimer(){flashGeneration+=1,flashTimer!==void 0&&view?.clearTimeout(flashTimer),flashTimer=void 0}return{setRanges(tone,ranges){paint(highlightName(tone),tone,ranges)},setActive(range){paint("lr-highlight-active","accent",range?[range]:[])},flash(range,durationMs=DEFAULT_FLASH_MS){if(cancelFlashTimer(),paint("lr-highlight-flash","accent",[range]),!view)return;const generation=flashGeneration;let handle=0;handle=view.setTimeout(()=>{generation!==flashGeneration||flashTimer!==handle||(flashTimer=void 0,clear("lr-highlight-flash"))},durationMs),flashTimer=handle},release(){cancelFlashTimer();for(const name of marksByName.keys())clear(name)}}}function acquireCssHandle(owner,state,view){let flashTimer,flashGeneration=0;function cancelFlashTimer(){flashGeneration+=1,flashTimer!==void 0&&view.clearTimeout(flashTimer),flashTimer=void 0}return{setRanges(tone,ranges){replaceCssOwned(state,highlightName(tone),owner,ranges)},setActive(range){replaceCssOwned(state,"lr-highlight-active",owner,range?[range]:[])},flash(range,durationMs=DEFAULT_FLASH_MS){cancelFlashTimer(),replaceCssOwned(state,"lr-highlight-flash",owner,[range]);const generation=flashGeneration;let handle=0;handle=view.setTimeout(()=>{generation!==flashGeneration||flashTimer!==handle||(flashTimer=void 0,replaceCssOwned(state,"lr-highlight-flash",owner,[]))},durationMs),flashTimer=handle},release(){cancelFlashTimer();for(const name of state.highlightObjects.keys())replaceCssOwned(state,name,owner,[])}}}function inertHighlightHandle(){return{setRanges:()=>{},setActive:()=>{},flash:()=>{},release:()=>{}}}function acquireHighlightHandle(owner,doc=defaultDocument()){if(!doc)return inertHighlightHandle();const realm=highlightRealm(doc);if(realm&&doc.defaultView&&!matchesRealm(failedDocumentRealms.get(doc),realm))try{const handle=acquireCssHandle(owner,stateForDocument(doc,realm),doc.defaultView);return failedDocumentRealms.delete(doc),handle}catch{failedDocumentRealms.set(doc,realm)}return acquireFallbackHandle(owner,doc)}export{acquireHighlightHandle,supportsCustomHighlights};
|
|
1
|
+
import{TEXT_QUOTE_LIMITS}from"./text-quote.js";import{finiteDuration}from"./numbers.js";const TONE_NAMES=["accent","success","warning","danger","neutral"],DEFAULT_FLASH_MS=1800,FALLBACK_RANGE_LIMIT=200,FALLBACK_MARK_LIMIT=200,documentStates=new WeakMap,failedDocumentRealms=new WeakMap;function defaultDocument(){return typeof document>"u"?null:document}function highlightRealm(doc){const view=doc?.defaultView;if(!view)return null;const globals=view,ctor=globals.Highlight,registry=globals.CSS?.highlights;return typeof ctor=="function"&®istry&&typeof registry.set=="function"?{ctor,registry}:null}function matchesRealm(left,right){return left?.ctor===right.ctor&&left.registry===right.registry}function supportsCustomHighlights(doc=defaultDocument()){const realm=highlightRealm(doc);return realm!==null&&(!doc||!matchesRealm(failedDocumentRealms.get(doc),realm))}function highlightName(tone){return`lr-highlight-${tone}`}function stateForDocument(doc,realm){const existing=documentStates.get(doc);if(existing?.ctor===realm.ctor&&existing.registry===realm.registry)return existing;const state={...realm,highlightObjects:new Map,ownersByName:new Map},entries=[...TONE_NAMES.map(tone=>[highlightName(tone),0]),["lr-highlight-active",1],["lr-highlight-flash",2]];for(const[name,priority]of entries){const highlight=new realm.ctor;highlight.priority=priority,state.highlightObjects.set(name,highlight),state.ownersByName.set(name,new Map),realm.registry.set(name,highlight)}return documentStates.set(doc,state),state}function replaceCssOwned(state,name,owner,ranges){const highlight=state.highlightObjects.get(name),owners=state.ownersByName.get(name);if(!highlight||!owners)return;const previous=owners.get(owner);if(previous)for(const r of previous)highlight.delete(r);const next=new Set(ranges);for(const r of next)highlight.add(r);next.size>0?owners.set(owner,next):owners.delete(owner)}function splitTextNodeAtRange(range,textNode){const start=textNode===range.startContainer?range.startOffset:0,end=textNode===range.endContainer?range.endOffset:textNode.data.length;let target=textNode;return end<target.data.length&&target.splitText(end),start>0&&(target=target.splitText(start)),target}function nextNodeWithin(node,root){if(node.firstChild)return node.firstChild;let cursor=node;for(;cursor&&cursor!==root;){if(cursor.nextSibling)return cursor.nextSibling;cursor=cursor.parentNode}return null}function wrapRangeInMarks(range,name,tone,doc,budget){const ancestor=range.commonAncestorContainer,textNodeType=doc.defaultView?.Node.TEXT_NODE??3,covered=[];let node=ancestor;for(;node&&budget.traversalNodes>0&&budget.codeUnits>0;){if(budget.traversalNodes--,node.nodeType===textNodeType){const textNode=node;if(textNode.data.length>budget.codeUnits){budget.codeUnits=0;break}budget.codeUnits-=textNode.data.length;try{if(textNode.data.length>0&&range.intersectsNode(textNode)&&(covered.push(textNode),covered.length>budget.marks))return[]}catch{return[]}}node=nextNodeWithin(node,ancestor)}if(node)return[];const marks=[];for(const textNode of covered){const inRange=splitTextNodeAtRange(range,textNode);if(!inRange.data)continue;const mark=doc.createElement("mark");if(mark.setAttribute("data-lr-highlight-tone",tone),mark.setAttribute("data-lr-highlight-name",name),mark.setAttribute("role","mark"),inRange.parentNode?.insertBefore(mark,inRange),mark.appendChild(inRange),marks.push(mark),budget.marks--,budget.marks<=0)break}return marks}function unwrapMark(mark){const parent=mark.parentNode;if(!parent)return;const before=mark.previousSibling,firstMoved=mark.firstChild;for(;mark.firstChild;)parent.insertBefore(mark.firstChild,mark);const after=mark.nextSibling;parent.removeChild(mark);let cursor=before?.nodeType===Node.TEXT_NODE?before:firstMoved??after,localSteps=0;for(;cursor&&cursor.parentNode===parent&&localSteps++<4&&cursor.nodeType===Node.TEXT_NODE;){const text=cursor;if(text.data===""){const next2=text.nextSibling;text.remove(),cursor=next2;continue}const next=text.nextSibling;if(next?.nodeType!==Node.TEXT_NODE)break;text.appendData(next.data),next.remove()}}function acquireFallbackHandle(_owner,doc){const marksByName=new Map,view=doc.defaultView;function clear(name){for(const mark of marksByName.get(name)??[])unwrapMark(mark);marksByName.set(name,[])}function paint(name,tone,ranges){clear(name);const marks=[],budget={traversalNodes:TEXT_QUOTE_LIMITS.maxTraversalNodes,codeUnits:TEXT_QUOTE_LIMITS.maxCorpusCodeUnits,marks:FALLBACK_MARK_LIMIT},count=Math.min(ranges.length,FALLBACK_RANGE_LIMIT);for(let index=0;index<count&&budget.traversalNodes>0&&budget.codeUnits>0&&budget.marks>0;index++)marks.push(...wrapRangeInMarks(ranges[index],name,tone,doc,budget));marksByName.set(name,marks)}let flashTimer,flashGeneration=0;function cancelFlashTimer(){flashGeneration+=1,flashTimer!==void 0&&view?.clearTimeout(flashTimer),flashTimer=void 0}return{setRanges(tone,ranges){paint(highlightName(tone),tone,ranges)},setActive(range){paint("lr-highlight-active","accent",range?[range]:[])},flash(range,durationMs=DEFAULT_FLASH_MS){if(cancelFlashTimer(),paint("lr-highlight-flash","accent",[range]),!view)return;const generation=flashGeneration;let handle=0;handle=view.setTimeout(()=>{generation!==flashGeneration||flashTimer!==handle||(flashTimer=void 0,clear("lr-highlight-flash"))},finiteDuration(durationMs,DEFAULT_FLASH_MS)),flashTimer=handle},release(){cancelFlashTimer();for(const name of marksByName.keys())clear(name)}}}function acquireCssHandle(owner,state,view){let flashTimer,flashGeneration=0;function cancelFlashTimer(){flashGeneration+=1,flashTimer!==void 0&&view.clearTimeout(flashTimer),flashTimer=void 0}return{setRanges(tone,ranges){replaceCssOwned(state,highlightName(tone),owner,ranges)},setActive(range){replaceCssOwned(state,"lr-highlight-active",owner,range?[range]:[])},flash(range,durationMs=DEFAULT_FLASH_MS){cancelFlashTimer(),replaceCssOwned(state,"lr-highlight-flash",owner,[range]);const generation=flashGeneration;let handle=0;handle=view.setTimeout(()=>{generation!==flashGeneration||flashTimer!==handle||(flashTimer=void 0,replaceCssOwned(state,"lr-highlight-flash",owner,[]))},finiteDuration(durationMs,DEFAULT_FLASH_MS)),flashTimer=handle},release(){cancelFlashTimer();for(const name of state.highlightObjects.keys())replaceCssOwned(state,name,owner,[])}}}function inertHighlightHandle(){return{setRanges:()=>{},setActive:()=>{},flash:()=>{},release:()=>{}}}function acquireHighlightHandle(owner,doc=defaultDocument()){if(!doc)return inertHighlightHandle();const realm=highlightRealm(doc);if(realm&&doc.defaultView&&!matchesRealm(failedDocumentRealms.get(doc),realm))try{const handle=acquireCssHandle(owner,stateForDocument(doc,realm),doc.defaultView);return failedDocumentRealms.delete(doc),handle}catch{failedDocumentRealms.set(doc,realm)}return acquireFallbackHandle(owner,doc)}export{acquireHighlightHandle,supportsCustomHighlights};
|
|
@@ -163,21 +163,6 @@ import{css}from"lit";const palette=css`
|
|
|
163
163
|
--lr-color-neutral-on-loud: var(--lr-theme-color-neutral-on-loud, var(--lr-ramp-neutral-05));
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
/* Deliberately a SEPARATE rule from the one above, not another selector in its list. A selector
|
|
167
|
-
list is not forgiving: Firefox and Safari ship no :host-context(), so one of these in the same
|
|
168
|
-
list would invalidate the whole list and take the supported :host([data-lr-theme='dark'])
|
|
169
|
-
branch down with it -- silently dropping the entire dark grid in two of the three engines.
|
|
170
|
-
Split, each engine keeps whatever it understands.
|
|
171
|
-
|
|
172
|
-
Those engines still resolve an ancestor .lr-dark correctly, just by a different route:
|
|
173
|
-
theme.css declares the mode's values as ordinary custom properties on .lr-dark, and custom
|
|
174
|
-
properties inherit through the shadow boundary. This rule is the no-theme.css convenience
|
|
175
|
-
path, not the contract.
|
|
176
|
-
|
|
177
|
-
The :host(:not(...)) half keeps a light island inside a dark subtree light: without it this
|
|
178
|
-
rule sits later at equal specificity and beats the light :host block. It has to be written as
|
|
179
|
-
its own :host() pseudo -- a bare :not([data-lr-theme='light']) appended to :host-context()
|
|
180
|
-
matches nothing at all, because the shadow host is featureless. */
|
|
181
166
|
:host(:not([data-lr-theme='light'])):host-context(.lr-dark),
|
|
182
167
|
:host(:not([data-lr-theme='light'])):host-context([data-lr-theme='dark']) {
|
|
183
168
|
--lr-color-brand-fill-quiet: var(--lr-theme-color-brand-fill-quiet, var(--lr-ramp-brand-30));
|