@aceshooting/lyra-ui 9.1.0 → 10.0.1
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 +843 -0
- package/README.md +7 -0
- package/custom-elements.json +1 -1
- package/dist/cli/migrate-wa.mjs +52 -0
- package/dist/cli/migration-contract.json +1 -1
- package/dist/components/agent-tools/activity-feed/activity-feed.class.js +2 -2
- 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 +9 -7
- 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.class.js +1 -1
- 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.class.js +1 -1
- package/dist/components/agent-tools/browser-frame/browser-frame.styles.js +3 -5
- package/dist/components/agent-tools/commit-card/commit-card.class.js +1 -1
- 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.class.js +2 -2
- package/dist/components/agent-tools/confirm-bar/confirm-bar.styles.js +0 -46
- package/dist/components/agent-tools/context-inspector/context-inspector.class.js +1 -1
- package/dist/components/agent-tools/eval-dataset/eval-dataset.styles.js +0 -7
- package/dist/components/agent-tools/eval-result/eval-result.class.js +1 -1
- package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +2 -2
- package/dist/components/agent-tools/policy-summary/policy-summary.class.js +1 -1
- 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 +2 -5
- package/dist/components/agent-tools/span-waterfall/span-waterfall.class.js +1 -1
- 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 +1 -4
- package/dist/components/agent-tools/task-list/task-list.class.js +2 -2
- 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.class.js +1 -1
- 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.class.js +2 -2
- 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.class.js +2 -2
- 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.class.js +2 -2
- package/dist/components/agent-tools/trace-tree/trace-tree.styles.js +7 -31
- package/dist/components/charts/chart/bar-chart.class.js +1 -1
- package/dist/components/charts/chart/box-plot.styles.js +0 -20
- package/dist/components/charts/chart/bubble-chart.class.js +1 -1
- 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 +93 -0
- package/dist/components/charts/chart/chart.class.js +3 -3
- package/dist/components/charts/chart/chart.styles.js +0 -27
- package/dist/components/charts/chart/doughnut-chart.class.js +1 -1
- package/dist/components/charts/chart/histogram.class.js +1 -1
- package/dist/components/charts/chart/line-chart.class.js +1 -1
- 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/charts/chart/pie-chart.class.js +1 -1
- package/dist/components/charts/chart/polar-area-chart.class.js +1 -1
- package/dist/components/charts/chart/radar-chart.class.js +1 -1
- package/dist/components/charts/chart/scatter-chart.class.js +1 -1
- 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.class.js +2 -2
- package/dist/components/conversation/chat-message/chat-message.styles.js +13 -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/realtime-session/realtime-session.styles.js +1 -1
- 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 +5 -19
- 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.class.js +1 -1
- 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/file-tree/file-tree.class.js +1 -1
- 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 +85 -2
- 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.class.js +1 -1
- 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 +1 -106
- 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.js +2 -2
- package/dist/components/forms/combobox/combobox.styles.js +22 -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 +1 -0
- package/dist/components/forms/date-picker/date-picker.class.js +22 -20
- package/dist/components/forms/date-picker/date-picker.styles.js +36 -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 +3 -38
- 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 +5 -13
- 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.class.js +1 -1
- 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.class.js +1 -1
- package/dist/components/layout/multi-split/multi-split.styles.js +8 -51
- 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 +2 -2
- package/dist/components/media/attachment-chip/attachment-chip.styles.js +0 -31
- package/dist/components/media/attachment-trigger/attachment-trigger.class.d.ts +1 -1
- package/dist/components/media/attachment-trigger/attachment-trigger.class.js +4 -4
- 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.class.js +1 -1
- package/dist/components/media/file-input/file-input.styles.js +3 -24
- package/dist/components/media/flag/flag.class.d.ts +20 -0
- 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 +2 -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 +141 -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 +2 -13
- 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 +12 -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.class.js +1 -1
- 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 +9 -1
- 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 +2 -2
- package/dist/components/overlays/popup/popup.class.d.ts +1 -0
- package/dist/components/overlays/popup/popup.class.js +2 -2
- 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 +2 -5
- 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.class.js +1 -1
- 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/entity-dossier/entity-dossier.class.js +1 -1
- 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/grounding-summary/grounding-summary.class.js +2 -2
- 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 +6 -11
- package/dist/components/retrieval/memory-panel/memory-panel.class.js +1 -1
- 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.class.js +1 -1
- 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.class.js +1 -1
- 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.class.js +1 -1
- 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/contact-viewer/contact-viewer.class.js +1 -1
- 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.class.js +1 -1
- 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.class.js +1 -1
- 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 +56 -37
- 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 +30 -0
- package/dist/internal/dev-mode-attribute-warning.js +1 -0
- 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 +19 -113
- package/dist/lyra.d.ts +8 -5
- package/dist/styles/reservations.css +82 -0
- package/dist/svelte.d.ts +56 -37
- 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 +56 -37
- 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 +9 -6
- package/llms/components/lr-av-player.md +3 -1
- package/llms/components/lr-avatar.md +6 -6
- package/llms/components/lr-bar-chart.md +4 -3
- package/llms/components/lr-box-plot.md +1 -1
- package/llms/components/lr-browser-frame.md +7 -3
- package/llms/components/lr-bubble-chart.md +4 -3
- package/llms/components/lr-calendar.md +9 -2
- package/llms/components/lr-card.md +24 -0
- package/llms/components/lr-chart.md +32 -8
- 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 +5 -2
- 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-details.md +11 -2
- package/llms/components/lr-dialog.md +15 -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 +4 -3
- 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 +20 -5
- package/llms/components/lr-heatmap.md +29 -1
- package/llms/components/lr-histogram.md +3 -1
- 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 +4 -3
- package/llms/components/lr-lite-chart.md +16 -6
- package/llms/components/lr-map.md +72 -8
- 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 +5 -2
- package/llms/components/lr-pdf-viewer.md +62 -2
- package/llms/components/lr-pie-chart.md +4 -3
- package/llms/components/lr-polar-area-chart.md +4 -3
- package/llms/components/lr-popover.md +5 -0
- 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 +4 -3
- 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 +4 -3
- 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/index.md +1 -1
- package/llms/peers.md +13 -3
- package/llms/shared.md +83 -2
- package/llms-full.txt +1159 -288
- package/package.json +19 -7
- package/vscode-css-data.json +37 -2
- package/vscode-html-data.json +402 -45
- package/web-types.json +300 -56
|
@@ -22,9 +22,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
|
|
|
22
22
|
[part='form-control-label'][hidden] {
|
|
23
23
|
display: none;
|
|
24
24
|
}
|
|
25
|
-
/* This control accepts required and renders a visible label like every other field in the
|
|
26
|
-
library, so it marks it the same way -- the [hidden] rule above is what keeps the marker from
|
|
27
|
-
orphaning a stray glyph when no label is set. */
|
|
28
25
|
${formControlRequiredMarker}
|
|
29
26
|
|
|
30
27
|
.control-row {
|
|
@@ -60,8 +57,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
|
|
|
60
57
|
[part='trigger']:hover:not(:disabled) {
|
|
61
58
|
border-color: var(--lr-color-brand);
|
|
62
59
|
}
|
|
63
|
-
/* Hover recolors the border only; the press additionally fills the trigger, mixing its resting
|
|
64
|
-
surface toward the text color so the pressed state escalates hover instead of restating it. */
|
|
65
60
|
[part='trigger']:active:not(:disabled) {
|
|
66
61
|
border-color: var(--lr-color-brand);
|
|
67
62
|
background: color-mix(in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active));
|
|
@@ -143,8 +138,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
|
|
|
143
138
|
justify-content: center;
|
|
144
139
|
inline-size: max(var(--lr-icon-button-size), var(--lr-form-control-height));
|
|
145
140
|
block-size: max(var(--lr-icon-button-size), var(--lr-form-control-height));
|
|
146
|
-
/* Compact picker chrome may be smaller than the WCAG interaction floor; the independent
|
|
147
|
-
preview action never is. Large tiers grow the action with the field. */
|
|
148
141
|
min-inline-size: var(--lr-icon-button-size);
|
|
149
142
|
min-block-size: var(--lr-icon-button-size);
|
|
150
143
|
border: var(--lr-border-width-thin) solid var(--lr-color-border);
|
|
@@ -176,16 +169,8 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
|
|
|
176
169
|
position: fixed;
|
|
177
170
|
z-index: var(--lr-layer-dropdown);
|
|
178
171
|
box-sizing: border-box;
|
|
179
|
-
/* Clamped against internal/positioner.js's place()-published available-space custom
|
|
180
|
-
properties (see menu.styles.ts's/combobox.styles.ts's identical [part='listbox']
|
|
181
|
-
treatment) so this popup can't overflow off-screen on a short/keyboard-shrunk viewport. */
|
|
182
172
|
max-block-size: min(var(--lr-size-18rem), var(--lr-positioner-available-block-size, var(--lr-size-18rem)));
|
|
183
173
|
overflow-y: auto;
|
|
184
|
-
/* Pinned explicitly alongside overflow-y -- per the CSS overflow spec, once one axis is
|
|
185
|
-
forced non-'visible', the other axis's used value also computes to 'auto' (never stays
|
|
186
|
-
'visible'), risking a phantom empty horizontal scrollbar from sub-pixel rounding (the same
|
|
187
|
-
bug lr-tab-group' tablist was fixed for). inline-size is max-content below, so this axis never
|
|
188
|
-
actually needs to scroll. */
|
|
189
174
|
overflow-x: hidden;
|
|
190
175
|
inline-size: max-content;
|
|
191
176
|
min-inline-size: min(var(--lr-size-12rem), var(--lr-positioner-available-inline-size, var(--lr-size-12rem)));
|
|
@@ -194,7 +179,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
|
|
|
194
179
|
background: var(--lr-color-surface);
|
|
195
180
|
border: var(--lr-border-width-thin) solid var(--lr-color-border);
|
|
196
181
|
border-radius: var(--lr-voice-picker-radius, var(--_lr-voice-picker-radius-default));
|
|
197
|
-
/* Anchored overlay: a positioner-placed listbox floating over page content, not a modal layer. */
|
|
198
182
|
box-shadow: var(--lr-shadow-m);
|
|
199
183
|
visibility: hidden;
|
|
200
184
|
opacity: 0;
|
|
@@ -230,12 +214,19 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
|
|
|
230
214
|
text-align: start;
|
|
231
215
|
cursor: pointer;
|
|
232
216
|
}
|
|
217
|
+
[part='option'][aria-selected='true'] {
|
|
218
|
+
border-color: var(--lr-voice-picker-option-selected-border, var(--lr-color-brand));
|
|
219
|
+
color: var(--lr-voice-picker-option-selected-color, var(--lr-color-brand));
|
|
220
|
+
background: var(--lr-voice-picker-option-selected-bg, transparent);
|
|
221
|
+
font-weight: var(
|
|
222
|
+
--lr-voice-picker-option-selected-font-weight,
|
|
223
|
+
var(--lr-font-weight-semibold)
|
|
224
|
+
);
|
|
225
|
+
}
|
|
233
226
|
[part='option']:hover,
|
|
234
227
|
[part='option'][data-active] {
|
|
235
228
|
background: var(--lr-voice-picker-option-active-bg, var(--lr-color-brand-quiet));
|
|
236
229
|
}
|
|
237
|
-
/* Mixes the SAME --lr-voice-picker-option-active-bg the hover/active-descendant rule above uses,
|
|
238
|
-
so a consumer retinting the highlight gets a matching pressed step for free. */
|
|
239
230
|
[part='option']:active {
|
|
240
231
|
background: color-mix(
|
|
241
232
|
in oklab,
|
|
@@ -243,15 +234,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
|
|
|
243
234
|
var(--lr-color-mix-partner) var(--lr-color-mix-active)
|
|
244
235
|
);
|
|
245
236
|
}
|
|
246
|
-
[part='option'][aria-selected='true'] {
|
|
247
|
-
border-color: var(--lr-voice-picker-option-selected-border, var(--lr-color-brand));
|
|
248
|
-
color: var(--lr-voice-picker-option-selected-color, var(--lr-color-brand));
|
|
249
|
-
background: var(--lr-voice-picker-option-selected-bg, transparent);
|
|
250
|
-
font-weight: var(
|
|
251
|
-
--lr-voice-picker-option-selected-font-weight,
|
|
252
|
-
var(--lr-font-weight-semibold)
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
237
|
[part='option-label'] {
|
|
256
238
|
flex: 1 1 auto;
|
|
257
239
|
min-inline-size: 0;
|
|
@@ -301,8 +283,6 @@ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/for
|
|
|
301
283
|
background: var(--lr-voice-picker-preview-hover-bg, var(--lr-color-brand-quiet));
|
|
302
284
|
color: var(--lr-voice-picker-preview-hover-color, var(--lr-color-brand));
|
|
303
285
|
}
|
|
304
|
-
/* Mixes the SAME --lr-voice-picker-preview-hover-bg the rule above uses, so a consumer retinting
|
|
305
|
-
the hover fill gets a matching pressed step without a second custom property to keep in sync. */
|
|
306
286
|
[part='option-preview']:active {
|
|
307
287
|
background: color-mix(
|
|
308
288
|
in oklab,
|
|
@@ -25,6 +25,8 @@ export interface LyraWidgetDocument {
|
|
|
25
25
|
/**
|
|
26
26
|
* Creates an immediate, bounded, frozen version-two document snapshot. Widget-owned structure and
|
|
27
27
|
* prop records are copied; opaque prop values and action payloads intentionally retain identity.
|
|
28
|
+
* String children and string prop values are truncated to `WIDGET_MAX_STRING_LENGTH`, the same
|
|
29
|
+
* silent admission ceiling the depth/node/prop budgets apply here.
|
|
28
30
|
* Malformed, cyclic, duplicate-id, or hostile input throws `TypeError` before a document escapes.
|
|
29
31
|
*/
|
|
30
32
|
export declare function createWidgetDocument(root: LyraWidgetNode): LyraWidgetDocument;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isWidgetTypeRegistry}from"./registry.js";import{readWidgetPointer,WIDGET_MAX_DEPTH,WIDGET_MAX_NODES,WIDGET_MAX_PROPS_PER_NODE,WIDGET_MAX_WARNINGS}from"../../../internal/widget-resolver.js";const DOCUMENT_INVALID=Symbol("invalid-widget-document"),DOCUMENT_MISSING=Symbol("missing-widget-document-field");function readDocumentField(input,key){try{return Object.hasOwn(input,key)?Reflect.get(input,key):DOCUMENT_MISSING}catch{return DOCUMENT_INVALID}}function snapshotDocumentProps(input){const output={};let admitted=0;try{for(const key in input){if(!Object.hasOwn(input,key))continue;if(admitted>=WIDGET_MAX_PROPS_PER_NODE)break;const value=Reflect.get(input,key);admitted+=1,output[key]=value}}catch{return DOCUMENT_INVALID}return Object.freeze(output)}function snapshotDocumentNode(input,depth,context){if(depth>WIDGET_MAX_DEPTH||context.remaining<=0)return null;if(context.remaining-=1,input===null||typeof input!="object"||Array.isArray(input)||context.ancestors.has(input))return DOCUMENT_INVALID;const type=readDocumentField(input,"type");if(typeof type!="string")return DOCUMENT_INVALID;const id=readDocumentField(input,"id"),slot=readDocumentField(input,"slot"),actionId=readDocumentField(input,"actionId"),propsInput=readDocumentField(input,"props"),childrenInput=readDocumentField(input,"children");if([id,slot,actionId,propsInput,childrenInput].includes(DOCUMENT_INVALID)||id!==DOCUMENT_MISSING&&(typeof id!="string"||id.length===0||id!==id.trim()))return DOCUMENT_INVALID;if(typeof id=="string"){if(context.ids.has(id))return DOCUMENT_INVALID;context.ids.add(id)}if(slot!==DOCUMENT_MISSING&&(typeof slot!="string"||slot.length===0||slot!==slot.trim())||actionId!==DOCUMENT_MISSING&&(typeof actionId!="string"||actionId.length===0||actionId!==actionId.trim())||propsInput!==DOCUMENT_MISSING&&(propsInput===null||typeof propsInput!="object"||Array.isArray(propsInput))||childrenInput!==DOCUMENT_MISSING&&!Array.isArray(childrenInput))return DOCUMENT_INVALID;const props=propsInput===DOCUMENT_MISSING?void 0:snapshotDocumentProps(propsInput);if(props===DOCUMENT_INVALID)return DOCUMENT_INVALID;let payload=DOCUMENT_MISSING;if(actionId!==DOCUMENT_MISSING&&(payload=readDocumentField(input,"payload"),payload===DOCUMENT_INVALID))return DOCUMENT_INVALID;const children=[];if(childrenInput!==DOCUMENT_MISSING&&depth<WIDGET_MAX_DEPTH){const length=readDocumentField(childrenInput,"length");if(typeof length!="number"||!Number.isSafeInteger(length)||length<0)return DOCUMENT_INVALID;context.ancestors.add(input);try{for(let index=0;index<length&&context.remaining>0;index++){const child=readDocumentField(childrenInput,index);if(child===DOCUMENT_INVALID||child===DOCUMENT_MISSING)return DOCUMENT_INVALID;if(typeof child=="string"){context.remaining-=1,children.push(child);continue}const snapshot=snapshotDocumentNode(child,depth+1,context);if(snapshot===DOCUMENT_INVALID)return DOCUMENT_INVALID;snapshot&&children.push(snapshot)}}finally{context.ancestors.delete(input)}}return Object.freeze({type,...typeof id=="string"?{id}:{},...typeof slot=="string"?{slot}:{},...typeof actionId=="string"?{actionId,payload:payload===DOCUMENT_MISSING?void 0:payload}:{},...props===void 0?{}:{props},...children.length===0?{}:{children:Object.freeze(children)}})}function createWidgetDocument(root){const snapshot=snapshotDocumentNode(root,0,{ancestors:new Set,ids:new Set,remaining:WIDGET_MAX_NODES});if(snapshot===DOCUMENT_INVALID||snapshot===null)throw new TypeError("A widget document root must be a valid bounded widget node.");return Object.freeze({version:"2",root:snapshot})}const WARNING_SUPPRESSION_KEY="__warning-cap__",INVALID=Symbol("invalid-widget-input"),ROW_COL_PROP_ENUMS={gap:["s","m","l"],align:["start","center","end","stretch"],justify:["start","center","end","between"]};function warnOnce(ctx,key,message){if(!ctx.warned.has(key)){if(ctx.warned.size>=WIDGET_MAX_WARNINGS){if(ctx.warned.has(WARNING_SUPPRESSION_KEY))return;ctx.warned.add(WARNING_SUPPRESSION_KEY),(ctx.warn??console.warn)(`[lr-widget-renderer] suppressed further diagnostics after ${WIDGET_MAX_WARNINGS} unique warnings`);return}ctx.warned.add(key),(ctx.warn??console.warn)(`[lr-widget-renderer] ${message}`)}}function isBinding(value){return!!(value&&typeof value=="object"&&!Array.isArray(value)&&typeof value.$bind=="string")}function resolveValue(value,ctx){if(!isBinding(value))return{value};const resolved=readWidgetPointer(ctx.bindingState,value.$bind);return{value:resolved===void 0?value.fallback:resolved,path:value.$bind}}function consumeNodeBudget(snapshot){return snapshot.remaining<=0?(warnOnce(snapshot.resolve,"__node-cap__",`stopped resolving after the ${WIDGET_MAX_NODES}-node cap was reached`),!1):(snapshot.remaining--,!0)}function snapshotProps(input,type,ctx){const out={};let visited=0;for(const key in input){if(visited>=WIDGET_MAX_PROPS_PER_NODE){warnOnce(ctx,`__prop-cap__:${type}`,`stopped reading props on type "${type}" after the ${WIDGET_MAX_PROPS_PER_NODE}-prop cap was reached`);break}visited++,Object.hasOwn(input,key)&&(out[key]=input[key])}return out}function definitionFor(type,registry){return registry.get(type)}function snapshotNode(input,depth,snapshot){if(depth>WIDGET_MAX_DEPTH)return warnOnce(snapshot.resolve,"__depth-cap__",`stopped resolving after the ${WIDGET_MAX_DEPTH}-level depth cap was reached`),null;if(!consumeNodeBudget(snapshot))return null;if(input===null||typeof input!="object"||Array.isArray(input)||snapshot.ancestors.has(input))return INVALID;const candidate=input,type=candidate.type;if(typeof type!="string")return INVALID;if(!(type==="row"||type==="col"||type==="text")&&!definitionFor(type,snapshot.resolve.registry))return{type};const id=candidate.id;if(id!==void 0&&(typeof id!="string"||id.length===0||id!==id.trim()))return INVALID;const slot=candidate.slot;if(slot!==void 0&&(typeof slot!="string"||slot.length===0||slot!==slot.trim()))return INVALID;const actionId=candidate.actionId;if(actionId!==void 0&&(typeof actionId!="string"||actionId.length===0||actionId!==actionId.trim()))return INVALID;const propsInput=candidate.props;if(propsInput!==void 0&&(propsInput===null||typeof propsInput!="object"||Array.isArray(propsInput)))return INVALID;const childrenInput=candidate.children;if(childrenInput!==void 0&&!Array.isArray(childrenInput))return INVALID;const node={type,...id!==void 0?{id}:{},...slot!==void 0?{slot}:{},...actionId!==void 0?{actionId,payload:candidate.payload}:{},...propsInput!==void 0?{props:snapshotProps(propsInput,type,snapshot.resolve)}:{}};if(childrenInput===void 0||depth===WIDGET_MAX_DEPTH)return childrenInput&&childrenInput.length>0&&warnOnce(snapshot.resolve,"__depth-cap__",`stopped resolving after the ${WIDGET_MAX_DEPTH}-level depth cap was reached`),node;const children=[];snapshot.ancestors.add(input);try{const childCount=childrenInput.length;for(let index=0;index<childCount;index++){if(snapshot.remaining<=0){consumeNodeBudget(snapshot);break}const child=childrenInput[index];if(typeof child=="string"){if(!consumeNodeBudget(snapshot))break;children.push(child);continue}const accepted=snapshotNode(child,depth+1,snapshot);if(accepted===INVALID)return INVALID;accepted&&children.push(accepted)}}finally{snapshot.ancestors.delete(input)}return children.length>0?{...node,children}:node}function filterRowColProps(props){const out={};if(!props)return out;for(const[key,allowed]of Object.entries(ROW_COL_PROP_ENUMS)){const value=props[key];typeof value=="string"&&allowed.includes(value)&&(out[key]=value)}return out}function filterMappedProps(props,def,ctx,type){const out={},bindings=[],allowlist=def.props??{};if(props)for(const[key,rawValue]of Object.entries(props)){const expectedType=allowlist[key],{value,path}=resolveValue(rawValue,ctx);if(expectedType===void 0||typeof value!==expectedType){warnOnce(ctx,`${type}:${key}`,`skipped disallowed or mistyped prop "${key}" on type "${type}"`);continue}out[key]=value,path&&bindings.push({prop:key,path,event:def.bindings?.[key]?.event})}return{props:{...out,...def.forcedProps??{}},bindings}}function containsInteractive(node){return node.kind==="text"?!1:node.interactive||node.children.some(containsInteractive)}function resolveChild(value,ctx,path){return typeof value=="string"?{nodeKey:`path:${path}`,nodePath:path,kind:"text",text:value}:resolveNode(value,ctx,path)}function resolveNode(node,ctx,path){const authoredId=node.id,nodeKey=authoredId?`id:${authoredId}`:`path:${path}`;let kind,tag,interactive=!1,props,actionEvent,bindings=[],slots=[];if(node.type==="row"||node.type==="col")kind=node.type==="row"?"builtin-row":"builtin-col",props=filterRowColProps(node.props);else if(node.type==="text"){kind="builtin-text";const resolved=resolveValue(node.props?.value,ctx);if(props=typeof resolved.value=="string"||typeof resolved.value=="number"?{value:String(resolved.value)}:{},resolved.path){if(!authoredId)throw warnOnce(ctx,`__required-id__:${path}`,"rejected bound text without a stable id"),new TypeError("A bound widget node requires a stable id.");bindings=[{prop:"value",path:resolved.path}]}}else{const def=definitionFor(node.type,ctx.registry);if(!def)return warnOnce(ctx,node.type,`skipped unknown widget type "${node.type}" (and its subtree)`),null;kind="mapped",tag=def.tag,interactive=def.interaction==="control";const filtered=filterMappedProps(node.props,def,ctx,node.type);if(props=filtered.props,bindings=filtered.bindings,slots=def.slots??[],node.actionId!==void 0&&def.action&&(actionEvent=def.action.event),(actionEvent||bindings.length>0)&&!authoredId)throw warnOnce(ctx,`__required-id__:${path}`,`rejected stateful or actionable type "${node.type}" without a stable id`),new TypeError("A stateful or actionable widget node requires a stable id.")}const children=[];for(let index=0;index<(node.children?.length??0);index++){const resolvedChild=resolveChild(node.children[index],ctx,`${path}.${index}`);if(resolvedChild){if(interactive&&containsInteractive(resolvedChild)){warnOnce(ctx,`__nested-interactive__:${node.type}`,`skipped a control descendant inside control type "${node.type}"`);continue}resolvedChild.slot!==void 0&&!slots.includes(resolvedChild.slot)&&(resolvedChild.slot=void 0),children.push(resolvedChild)}}return{nodeId:authoredId,nodeKey,nodePath:path,kind,tag,interactive,props,actionEvent,actionId:actionEvent?node.actionId:void 0,payload:actionEvent?node.payload:void 0,bindings,children,slot:node.slot}}function hasDuplicateAuthoredIds(root,ctx){const counts=new Map,pending=[root];for(;pending.length>0;){const node=pending.pop();node.id&&counts.set(node.id,(counts.get(node.id)??0)+1);for(const child of node.children??[])typeof child!="string"&&pending.push(child)}let duplicate=!1;for(const[id,count]of counts)count<2||(duplicate=!0,warnOnce(ctx,`__duplicate-id__:${id}`,`rejected duplicate widget id "${id}"`));return duplicate}function resolveTree(root,ctx){if(root==null)return null;if(!isWidgetTypeRegistry(ctx.registry))throw new TypeError("A widget renderer registry must be created with createWidgetTypeRegistry().");const snapshot=snapshotNode(root,0,{resolve:ctx,ancestors:new Set,remaining:WIDGET_MAX_NODES});return snapshot===INVALID||snapshot===null||hasDuplicateAuthoredIds(snapshot,ctx)?null:resolveNode(snapshot,ctx,"0")}export{createWidgetDocument,resolveTree};
|
|
1
|
+
import{isWidgetTypeRegistry}from"./registry.js";import{readWidgetPointer,WIDGET_MAX_DEPTH,WIDGET_MAX_NODES,WIDGET_MAX_PROPS_PER_NODE,WIDGET_MAX_WARNINGS}from"../../../internal/widget-resolver.js";const WIDGET_MAX_STRING_LENGTH=16384;function truncateWidgetString(value){if(value.length<=WIDGET_MAX_STRING_LENGTH)return value;const capped=value.slice(0,WIDGET_MAX_STRING_LENGTH),last=capped.charCodeAt(capped.length-1);return last>=55296&&last<=56319?capped.slice(0,-1):capped}const DOCUMENT_INVALID=Symbol("invalid-widget-document"),DOCUMENT_MISSING=Symbol("missing-widget-document-field");function readDocumentField(input,key){try{return Object.hasOwn(input,key)?Reflect.get(input,key):DOCUMENT_MISSING}catch{return DOCUMENT_INVALID}}function snapshotDocumentProps(input){const output={};let admitted=0;try{for(const key in input){if(!Object.hasOwn(input,key))continue;if(admitted>=WIDGET_MAX_PROPS_PER_NODE)break;const value=Reflect.get(input,key);admitted+=1,output[key]=typeof value=="string"?truncateWidgetString(value):value}}catch{return DOCUMENT_INVALID}return Object.freeze(output)}function snapshotDocumentNode(input,depth,context){if(depth>WIDGET_MAX_DEPTH||context.remaining<=0)return null;if(context.remaining-=1,input===null||typeof input!="object"||Array.isArray(input)||context.ancestors.has(input))return DOCUMENT_INVALID;const type=readDocumentField(input,"type");if(typeof type!="string")return DOCUMENT_INVALID;const id=readDocumentField(input,"id"),slot=readDocumentField(input,"slot"),actionId=readDocumentField(input,"actionId"),propsInput=readDocumentField(input,"props"),childrenInput=readDocumentField(input,"children");if([id,slot,actionId,propsInput,childrenInput].includes(DOCUMENT_INVALID)||id!==DOCUMENT_MISSING&&(typeof id!="string"||id.length===0||id!==id.trim()))return DOCUMENT_INVALID;if(typeof id=="string"){if(context.ids.has(id))return DOCUMENT_INVALID;context.ids.add(id)}if(slot!==DOCUMENT_MISSING&&(typeof slot!="string"||slot.length===0||slot!==slot.trim())||actionId!==DOCUMENT_MISSING&&(typeof actionId!="string"||actionId.length===0||actionId!==actionId.trim())||propsInput!==DOCUMENT_MISSING&&(propsInput===null||typeof propsInput!="object"||Array.isArray(propsInput))||childrenInput!==DOCUMENT_MISSING&&!Array.isArray(childrenInput))return DOCUMENT_INVALID;const props=propsInput===DOCUMENT_MISSING?void 0:snapshotDocumentProps(propsInput);if(props===DOCUMENT_INVALID)return DOCUMENT_INVALID;let payload=DOCUMENT_MISSING;if(actionId!==DOCUMENT_MISSING&&(payload=readDocumentField(input,"payload"),payload===DOCUMENT_INVALID))return DOCUMENT_INVALID;const children=[];if(childrenInput!==DOCUMENT_MISSING&&depth<WIDGET_MAX_DEPTH){const length=readDocumentField(childrenInput,"length");if(typeof length!="number"||!Number.isSafeInteger(length)||length<0)return DOCUMENT_INVALID;context.ancestors.add(input);try{for(let index=0;index<length&&context.remaining>0;index++){const child=readDocumentField(childrenInput,index);if(child===DOCUMENT_INVALID||child===DOCUMENT_MISSING)return DOCUMENT_INVALID;if(typeof child=="string"){context.remaining-=1,children.push(truncateWidgetString(child));continue}const snapshot=snapshotDocumentNode(child,depth+1,context);if(snapshot===DOCUMENT_INVALID)return DOCUMENT_INVALID;snapshot&&children.push(snapshot)}}finally{context.ancestors.delete(input)}}return Object.freeze({type,...typeof id=="string"?{id}:{},...typeof slot=="string"?{slot}:{},...typeof actionId=="string"?{actionId,payload:payload===DOCUMENT_MISSING?void 0:payload}:{},...props===void 0?{}:{props},...children.length===0?{}:{children:Object.freeze(children)}})}function createWidgetDocument(root){const snapshot=snapshotDocumentNode(root,0,{ancestors:new Set,ids:new Set,remaining:WIDGET_MAX_NODES});if(snapshot===DOCUMENT_INVALID||snapshot===null)throw new TypeError("A widget document root must be a valid bounded widget node.");return Object.freeze({version:"2",root:snapshot})}const WARNING_SUPPRESSION_KEY="__warning-cap__",INVALID=Symbol("invalid-widget-input"),ROW_COL_PROP_ENUMS={gap:["s","m","l"],align:["start","center","end","stretch"],justify:["start","center","end","between"]};function warnOnce(ctx,key,message){if(!ctx.warned.has(key)){if(ctx.warned.size>=WIDGET_MAX_WARNINGS){if(ctx.warned.has(WARNING_SUPPRESSION_KEY))return;ctx.warned.add(WARNING_SUPPRESSION_KEY),(ctx.warn??console.warn)(`[lr-widget-renderer] suppressed further diagnostics after ${WIDGET_MAX_WARNINGS} unique warnings`);return}ctx.warned.add(key),(ctx.warn??console.warn)(`[lr-widget-renderer] ${message}`)}}function capResolvedString(value,ctx,key,subject){const capped=truncateWidgetString(value);return capped.length!==value.length&&warnOnce(ctx,`__string-cap__:${key}`,`truncated ${subject} after the ${WIDGET_MAX_STRING_LENGTH}-character string cap was reached`),capped}function isBinding(value){return!!(value&&typeof value=="object"&&!Array.isArray(value)&&typeof value.$bind=="string")}function resolveValue(value,ctx){if(!isBinding(value))return{value};const resolved=readWidgetPointer(ctx.bindingState,value.$bind);return{value:resolved===void 0?value.fallback:resolved,path:value.$bind}}function consumeNodeBudget(snapshot){return snapshot.remaining<=0?(warnOnce(snapshot.resolve,"__node-cap__",`stopped resolving after the ${WIDGET_MAX_NODES}-node cap was reached`),!1):(snapshot.remaining--,!0)}function snapshotProps(input,type,ctx){const out={};let visited=0;for(const key in input){if(visited>=WIDGET_MAX_PROPS_PER_NODE){warnOnce(ctx,`__prop-cap__:${type}`,`stopped reading props on type "${type}" after the ${WIDGET_MAX_PROPS_PER_NODE}-prop cap was reached`);break}visited++,Object.hasOwn(input,key)&&(out[key]=input[key])}return out}function definitionFor(type,registry){return registry.get(type)}function snapshotNode(input,depth,snapshot){if(depth>WIDGET_MAX_DEPTH)return warnOnce(snapshot.resolve,"__depth-cap__",`stopped resolving after the ${WIDGET_MAX_DEPTH}-level depth cap was reached`),null;if(!consumeNodeBudget(snapshot))return null;if(input===null||typeof input!="object"||Array.isArray(input)||snapshot.ancestors.has(input))return INVALID;const candidate=input,type=candidate.type;if(typeof type!="string")return INVALID;if(!(type==="row"||type==="col"||type==="text")&&!definitionFor(type,snapshot.resolve.registry))return{type};const id=candidate.id;if(id!==void 0&&(typeof id!="string"||id.length===0||id!==id.trim()))return INVALID;const slot=candidate.slot;if(slot!==void 0&&(typeof slot!="string"||slot.length===0||slot!==slot.trim()))return INVALID;const actionId=candidate.actionId;if(actionId!==void 0&&(typeof actionId!="string"||actionId.length===0||actionId!==actionId.trim()))return INVALID;const propsInput=candidate.props;if(propsInput!==void 0&&(propsInput===null||typeof propsInput!="object"||Array.isArray(propsInput)))return INVALID;const childrenInput=candidate.children;if(childrenInput!==void 0&&!Array.isArray(childrenInput))return INVALID;const node={type,...id!==void 0?{id}:{},...slot!==void 0?{slot}:{},...actionId!==void 0?{actionId,payload:candidate.payload}:{},...propsInput!==void 0?{props:snapshotProps(propsInput,type,snapshot.resolve)}:{}};if(childrenInput===void 0||depth===WIDGET_MAX_DEPTH)return childrenInput&&childrenInput.length>0&&warnOnce(snapshot.resolve,"__depth-cap__",`stopped resolving after the ${WIDGET_MAX_DEPTH}-level depth cap was reached`),node;const children=[];snapshot.ancestors.add(input);try{const childCount=childrenInput.length;for(let index=0;index<childCount;index++){if(snapshot.remaining<=0){consumeNodeBudget(snapshot);break}const child=childrenInput[index];if(typeof child=="string"){if(!consumeNodeBudget(snapshot))break;children.push(child);continue}const accepted=snapshotNode(child,depth+1,snapshot);if(accepted===INVALID)return INVALID;accepted&&children.push(accepted)}}finally{snapshot.ancestors.delete(input)}return children.length>0?{...node,children}:node}function filterRowColProps(props){const out={};if(!props)return out;for(const[key,allowed]of Object.entries(ROW_COL_PROP_ENUMS)){const value=props[key];typeof value=="string"&&allowed.includes(value)&&(out[key]=value)}return out}function filterMappedProps(props,def,ctx,type){const out={},bindings=[],allowlist=def.props??{};if(props)for(const[key,rawValue]of Object.entries(props)){const expectedType=allowlist[key],{value,path}=resolveValue(rawValue,ctx);if(expectedType===void 0||typeof value!==expectedType){warnOnce(ctx,`${type}:${key}`,`skipped disallowed or mistyped prop "${key}" on type "${type}"`);continue}out[key]=typeof value=="string"?capResolvedString(value,ctx,`${type}:${key}`,`string prop "${key}" on type "${type}"`):value,path&&bindings.push({prop:key,path,event:def.bindings?.[key]?.event})}return{props:{...out,...def.forcedProps??{}},bindings}}function containsInteractive(node){return node.kind==="text"?!1:node.interactive||node.children.some(containsInteractive)}function resolveChild(value,ctx,path){return typeof value=="string"?{nodeKey:`path:${path}`,nodePath:path,kind:"text",text:capResolvedString(value,ctx,"__text__","a text child")}:resolveNode(value,ctx,path)}function resolveNode(node,ctx,path){const authoredId=node.id,nodeKey=authoredId?`id:${authoredId}`:`path:${path}`;let kind,tag,interactive=!1,props,actionEvent,bindings=[],slots=[];if(node.type==="row"||node.type==="col")kind=node.type==="row"?"builtin-row":"builtin-col",props=filterRowColProps(node.props);else if(node.type==="text"){kind="builtin-text";const resolved=resolveValue(node.props?.value,ctx);if(props=typeof resolved.value=="string"||typeof resolved.value=="number"?{value:capResolvedString(String(resolved.value),ctx,"__text-value__",'the "value" of a built-in text node')}:{},resolved.path){if(!authoredId)throw warnOnce(ctx,`__required-id__:${path}`,"rejected bound text without a stable id"),new TypeError("A bound widget node requires a stable id.");bindings=[{prop:"value",path:resolved.path}]}}else{const def=definitionFor(node.type,ctx.registry);if(!def)return warnOnce(ctx,node.type,`skipped unknown widget type "${node.type}" (and its subtree)`),null;kind="mapped",tag=def.tag,interactive=def.interaction==="control";const filtered=filterMappedProps(node.props,def,ctx,node.type);if(props=filtered.props,bindings=filtered.bindings,slots=def.slots??[],node.actionId!==void 0&&def.action&&(actionEvent=def.action.event),(actionEvent||bindings.length>0)&&!authoredId)throw warnOnce(ctx,`__required-id__:${path}`,`rejected stateful or actionable type "${node.type}" without a stable id`),new TypeError("A stateful or actionable widget node requires a stable id.")}const children=[];for(let index=0;index<(node.children?.length??0);index++){const resolvedChild=resolveChild(node.children[index],ctx,`${path}.${index}`);if(resolvedChild){if(interactive&&containsInteractive(resolvedChild)){warnOnce(ctx,`__nested-interactive__:${node.type}`,`skipped a control descendant inside control type "${node.type}"`);continue}resolvedChild.slot!==void 0&&!slots.includes(resolvedChild.slot)&&(resolvedChild.slot=void 0),children.push(resolvedChild)}}return{nodeId:authoredId,nodeKey,nodePath:path,kind,tag,interactive,props,actionEvent,actionId:actionEvent?node.actionId:void 0,payload:actionEvent?node.payload:void 0,bindings,children,slot:node.slot}}function hasDuplicateAuthoredIds(root,ctx){const counts=new Map,pending=[root];for(;pending.length>0;){const node=pending.pop();node.id&&counts.set(node.id,(counts.get(node.id)??0)+1);for(const child of node.children??[])typeof child!="string"&&pending.push(child)}let duplicate=!1;for(const[id,count]of counts)count<2||(duplicate=!0,warnOnce(ctx,`__duplicate-id__:${id}`,`rejected duplicate widget id "${id}"`));return duplicate}function resolveTree(root,ctx){if(root==null)return null;if(!isWidgetTypeRegistry(ctx.registry))throw new TypeError("A widget renderer registry must be created with createWidgetTypeRegistry().");const snapshot=snapshotNode(root,0,{resolve:ctx,ancestors:new Set,remaining:WIDGET_MAX_NODES});return snapshot===INVALID||snapshot===null||hasDuplicateAuthoredIds(snapshot,ctx)?null:resolveNode(snapshot,ctx,"0")}export{WIDGET_MAX_STRING_LENGTH,createWidgetDocument,resolveTree};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type TemplateResult } from 'lit';
|
|
2
2
|
import { LyraElement } from '../../../internal/lyra-element.js';
|
|
3
|
+
import type { LyraDatePickerFirstDayOfWeek } from '../../forms/date-picker/date-picker.class.js';
|
|
3
4
|
export interface CalendarEvent {
|
|
4
5
|
readonly id?: string;
|
|
5
6
|
readonly date: string;
|
|
@@ -20,6 +21,10 @@ export interface LyraCalendarEventMap {
|
|
|
20
21
|
}
|
|
21
22
|
/** The two display modes `view` accepts. */
|
|
22
23
|
export type CalendarView = 'month' | 'agenda';
|
|
24
|
+
/** The shared closed weekday vocabulary `lr-date-picker`/`lr-date-input` already accept
|
|
25
|
+
* (`'auto'`, then `'sun'` through `'sat'`) -- reusing {@link LyraDatePickerFirstDayOfWeek}
|
|
26
|
+
* instead of a parallel string union. */
|
|
27
|
+
export type LyraCalendarFirstDayOfWeek = LyraDatePickerFirstDayOfWeek;
|
|
23
28
|
/** `<lr-calendar>` — responsive month calendar with event markers and agenda mode.
|
|
24
29
|
*
|
|
25
30
|
* Month-view event markers are real buttons inside each focusable gridcell, so
|
|
@@ -29,6 +34,11 @@ export type CalendarView = 'month' | 'agenda';
|
|
|
29
34
|
* Public collection properties take bounded, clone-owned readonly snapshots. Create a new
|
|
30
35
|
* collection and reassign it after changes; mutating the assigned array does not update the view.
|
|
31
36
|
*
|
|
37
|
+
* `firstDayOfWeek` defaults to `'auto'`, deriving the week start from `effectiveLocale` (via the
|
|
38
|
+
* shared `resolveFirstDayOfWeek()` contract also used by `lr-date-picker`/`lr-date-input`), and
|
|
39
|
+
* also accepts one of the shared weekday-name tokens (`'sun'` through `'sat'`) for an explicit,
|
|
40
|
+
* locale-independent week start.
|
|
41
|
+
*
|
|
32
42
|
* @customElement lr-calendar
|
|
33
43
|
* @event lr-date-select - A calendar date was selected.
|
|
34
44
|
* @event lr-event-select - An event was selected.
|
|
@@ -72,11 +82,14 @@ export declare class LyraCalendar extends LyraElement<LyraCalendarEventMap> {
|
|
|
72
82
|
private _view;
|
|
73
83
|
get view(): CalendarView;
|
|
74
84
|
set view(value: CalendarView);
|
|
75
|
-
firstDayOfWeek:
|
|
85
|
+
firstDayOfWeek: LyraCalendarFirstDayOfWeek;
|
|
76
86
|
accessibleLabel: string;
|
|
77
87
|
private focusedDate;
|
|
78
88
|
private get viewStart();
|
|
79
|
-
/** `firstDayOfWeek`
|
|
89
|
+
/** `firstDayOfWeek` resolved into the 0–6 range `monthMatrix`/`weekdayLabels` expect --
|
|
90
|
+
* `'auto'`, a weekday-name token, or any other malformed token all go through the shared
|
|
91
|
+
* `resolveFirstDayOfWeek()` contract, which derives `'auto'` from `effectiveLocale` and falls
|
|
92
|
+
* back to Sunday (0) for anything else. */
|
|
80
93
|
private get normalizedFirstDayOfWeek();
|
|
81
94
|
private changeMonth;
|
|
82
95
|
private selectDate;
|
|
@@ -1,2 +1,2 @@
|
|
|
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{html}from"lit";import{property,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{formatISO,monthMatrix,parseISO,weekdayLabels}from"../../forms/date-picker/calendar-core.js";import{sanitizeCssColor}from"../../../internal/safe-css.js";import{
|
|
2
|
-
${this.view==="agenda"?html`<div part="agenda">${agenda.length?agenda.map(event=>{const date=parseISO(event.date);return html`<button part="agenda-event" type="button" @click=${()=>this.emit("lr-event-select",{event})}><strong>${date?agendaDateFmt.format(date):event.date}</strong> ${event.title}</button>`}):html`<p>${this.localize("calendarEmpty")}</p>`}</div>`:html`<div part="weekdays">${this.weekdays().map(day=>html`<span part="weekday">${day}</span>`)}</div><div part="grid" role="grid" aria-label=${monthTitle}>${weeks.map(week=>html`<div part="week" role="row">${week.map(date=>{const dateIso=formatISO(date),dayEvents=eventsByDate?.get(dateIso)??[];return html`<div part="day" role="gridcell" data-date=${dateIso} data-outside=${date.getMonth()!==start.getMonth()?"true":"false"} data-today=${dateIso===today?"true":"false"} data-selected=${dateIso===this.value?"true":"false"} aria-selected=${dateIso===this.value?"true":"false"} aria-label=${dayLabelFmt.format(date)} tabindex=${dateIso===anchor?"0":"-1"} @click=${event=>{(event.target===event.currentTarget||event.target.getAttribute("part")==="date")&&this.selectDate(dateIso)}} @keydown=${event=>{event.target===event.currentTarget&&this.onDayKeyDown(event,date)}}><span part="date">${dayNumberFmt.format(date.getDate())}</span>${dayEvents.map(item=>{const bg=item.color?sanitizeCssColor(item.color):void 0;return html`<button part="event" type="button" style=${styleMap(bg?{backgroundColor:bg}:{})} @click=${event=>{event.stopPropagation(),this.emit("lr-event-select",{event:item})}}>${item.title}</button>`})}</div>`})}</div>`)}</div>`}</section>`}}__decorate([property({attribute:!1})],LyraCalendar.prototype,"events",void 0),__decorate([property()],LyraCalendar.prototype,"value",void 0),__decorate([property({attribute:"view-date"})],LyraCalendar.prototype,"viewDate",void 0),__decorate([property({reflect:!0})],LyraCalendar.prototype,"view",null),__decorate([property({
|
|
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{html}from"lit";import{property,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{formatISO,monthMatrix,parseISO,resolveFirstDayOfWeek,weekdayLabels}from"../../forms/date-picker/calendar-core.js";import{sanitizeCssColor}from"../../../internal/safe-css.js";import{styles}from"./calendar.styles.js";import{getDateTimeFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{LYRA_DEFAULT_calendarEmpty,LYRA_DEFAULT_calendarLabel,LYRA_DEFAULT_calendarNextMonth,LYRA_DEFAULT_calendarPreviousMonth}from"../../../internal/default-strings.generated.js";const monthStart=date=>new Date(date.getFullYear(),date.getMonth(),1);class LyraCalendar extends LyraElement{constructor(){super(...arguments),this.events=[],this.value="",this.viewDate=formatISO(new Date).slice(0,7)+"-01",this._view="month",this.firstDayOfWeek="auto",this.accessibleLabel="",this.focusedDate=""}static{this.defaultStrings={...super.defaultStrings,calendarEmpty:LYRA_DEFAULT_calendarEmpty,calendarLabel:LYRA_DEFAULT_calendarLabel,calendarNextMonth:LYRA_DEFAULT_calendarNextMonth,calendarPreviousMonth:LYRA_DEFAULT_calendarPreviousMonth}}static{this.ownedCollectionProperties=Object.freeze(["events"])}static{this.identityCollectionProperties=Object.freeze(["events"])}static{this.styles=[LyraElement.styles,styles]}get view(){return this._view}set view(value){const normalized=value==="agenda"?"agenda":"month",previous=this._view;if(previous===normalized){value!==normalized&&this.requestUpdate("view",previous);return}this._view=normalized,this.requestUpdate("view",previous)}get viewStart(){const parsed=new Date(`${this.viewDate}T00:00:00`);return Number.isNaN(parsed.valueOf())?monthStart(new Date):monthStart(parsed)}get normalizedFirstDayOfWeek(){return resolveFirstDayOfWeek(this.firstDayOfWeek,this.effectiveLocale)}changeMonth(delta){const next=new Date(this.viewStart.getFullYear(),this.viewStart.getMonth()+delta,1);this.viewDate=formatISO(next),this.emit("lr-view-change",{viewDate:this.viewDate})}selectDate(date){this.value=date,this.focusedDate=date,this.emit("lr-date-select",{date})}bucketEventsByDate(){const buckets=new Map;for(const event of this.events){const bucket=buckets.get(event.date);bucket?bucket.push(event):buckets.set(event.date,[event])}return buckets}weeks(){const start=this.viewStart;return monthMatrix(start.getFullYear(),start.getMonth(),this.normalizedFirstDayOfWeek)}gridBounds(weeks){return[weeks[0][0],weeks[weeks.length-1][6]]}onDayKeyDown(event,date){let delta=0;if(event.key==="ArrowLeft")delta=this.effectiveDirection==="rtl"?1:-1;else if(event.key==="ArrowRight")delta=this.effectiveDirection==="rtl"?-1:1;else if(event.key==="ArrowUp")delta=-7;else if(event.key==="ArrowDown")delta=7;else if(event.key==="Enter"||event.key===" "){event.preventDefault(),this.selectDate(formatISO(date));return}else return;event.preventDefault();const next=new Date(date);next.setDate(next.getDate()+delta);const[gridFirst,gridLast]=this.gridBounds(this.weeks());(next<gridFirst||next>gridLast)&&(this.viewDate=formatISO(monthStart(next)),this.emit("lr-view-change",{viewDate:this.viewDate})),this.focusedDate=formatISO(next),queueMicrotask(()=>this.renderRoot.querySelector(`[data-date="${this.focusedDate}"]`)?.focus())}weekdays(){return weekdayLabels(this.normalizedFirstDayOfWeek,"short",this.effectiveLocale)}updated(changed){super.updated(changed),this.getAttribute("view")!==this._view&&this.setAttribute("view",this._view)}render(){const start=this.viewStart,weeks=this.weeks(),monthTitle=getDateTimeFormat(this.effectiveLocale,{month:"long",year:"numeric"}).format(start),today=formatISO(new Date),label=this.accessibleLabel||this.localize("calendarLabel"),dayLabelFmt=getDateTimeFormat(this.effectiveLocale,{dateStyle:"full"}),agendaDateFmt=getDateTimeFormat(this.effectiveLocale,{dateStyle:"medium"}),dayNumberFmt=getNumberFormat(this.effectiveLocale),agenda=this.events.filter(event=>event.date.startsWith(formatISO(start).slice(0,7))).sort((a,b)=>a.date<b.date?-1:a.date>b.date?1:0),eventsByDate=this.view==="month"?this.bucketEventsByDate():void 0,[gridFirst,gridLast]=this.gridBounds(weeks),rawAnchor=this.focusedDate||this.value||today,rawAnchorDate=parseISO(rawAnchor),anchor=rawAnchorDate&&rawAnchorDate>=gridFirst&&rawAnchorDate<=gridLast?rawAnchor:formatISO(start);return html`<section aria-label=${label}><header part="header navigation"><button part="nav previous-button" type="button" aria-label=${this.localize("calendarPreviousMonth")} @click=${()=>this.changeMonth(-1)}><span part="nav-glyph" aria-hidden="true">‹</span></button><span part="title">${monthTitle}</span><button part="nav next-button" type="button" aria-label=${this.localize("calendarNextMonth")} @click=${()=>this.changeMonth(1)}><span part="nav-glyph" aria-hidden="true">›</span></button></header>
|
|
2
|
+
${this.view==="agenda"?html`<div part="agenda">${agenda.length?agenda.map(event=>{const date=parseISO(event.date);return html`<button part="agenda-event" type="button" @click=${()=>this.emit("lr-event-select",{event})}><strong>${date?agendaDateFmt.format(date):event.date}</strong> ${event.title}</button>`}):html`<p>${this.localize("calendarEmpty")}</p>`}</div>`:html`<div part="weekdays">${this.weekdays().map(day=>html`<span part="weekday">${day}</span>`)}</div><div part="grid" role="grid" aria-label=${monthTitle}>${weeks.map(week=>html`<div part="week" role="row">${week.map(date=>{const dateIso=formatISO(date),dayEvents=eventsByDate?.get(dateIso)??[];return html`<div part="day" role="gridcell" data-date=${dateIso} data-outside=${date.getMonth()!==start.getMonth()?"true":"false"} data-today=${dateIso===today?"true":"false"} data-selected=${dateIso===this.value?"true":"false"} aria-selected=${dateIso===this.value?"true":"false"} aria-label=${dayLabelFmt.format(date)} tabindex=${dateIso===anchor?"0":"-1"} @click=${event=>{(event.target===event.currentTarget||event.target.getAttribute("part")==="date")&&this.selectDate(dateIso)}} @keydown=${event=>{event.target===event.currentTarget&&this.onDayKeyDown(event,date)}}><span part="date">${dayNumberFmt.format(date.getDate())}</span>${dayEvents.map(item=>{const bg=item.color?sanitizeCssColor(item.color):void 0;return html`<button part="event" type="button" style=${styleMap(bg?{backgroundColor:bg}:{})} @click=${event=>{event.stopPropagation(),this.emit("lr-event-select",{event:item})}}>${item.title}</button>`})}</div>`})}</div>`)}</div>`}</section>`}}__decorate([property({attribute:!1})],LyraCalendar.prototype,"events",void 0),__decorate([property()],LyraCalendar.prototype,"value",void 0),__decorate([property({attribute:"view-date"})],LyraCalendar.prototype,"viewDate",void 0),__decorate([property({reflect:!0})],LyraCalendar.prototype,"view",null),__decorate([property({attribute:"first-day-of-week"})],LyraCalendar.prototype,"firstDayOfWeek",void 0),__decorate([property({attribute:"aria-label"})],LyraCalendar.prototype,"accessibleLabel",void 0),__decorate([state()],LyraCalendar.prototype,"focusedDate",void 0);export{LyraCalendar};
|
|
@@ -2,43 +2,25 @@ import{css}from"lit";const styles=css`
|
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
min-inline-size: 0;
|
|
5
|
-
/* Establishes the containment context the narrow-panel @container query below depends on --
|
|
6
|
-
without this, that query can only ever fire if a consumer's page happens to independently
|
|
7
|
-
declare container-type on some ancestor whose box crosses the same threshold, making it
|
|
8
|
-
effectively dead code out of the box. */
|
|
9
5
|
container-type: inline-size;
|
|
10
6
|
contain-intrinsic-inline-size: var(--lr-size-20rem);
|
|
11
7
|
}
|
|
12
8
|
[part~='header'] { display: flex; align-items: center; justify-content: space-between; gap: var(--lr-space-s); margin-block-end: var(--lr-space-s); }
|
|
13
9
|
[part='title'] { font-weight: var(--lr-font-weight-semibold); }
|
|
14
|
-
/* justify-content on both axes: the nav buttons carry a single icon-only glyph (nav-glyph),
|
|
15
|
-
far narrower than the min-inline-size hit-area floor below, and the default
|
|
16
|
-
justify-content (normal => flex-start) dumped all that slack on the trailing side, leaving
|
|
17
|
-
the chevron visibly off-centre in its button. Only takes effect when there IS slack, so a
|
|
18
|
-
nav box whose content already fills it renders exactly as before. */
|
|
19
10
|
[part~='nav'] { display: flex; justify-content: center; align-items: center; gap: var(--lr-space-xs); min-inline-size: var(--lr-icon-button-size); min-block-size: var(--lr-icon-button-size); }
|
|
20
|
-
/* Both navigation buttons expose the shared nav part plus a purpose-specific part. */
|
|
21
11
|
button[part~='nav'], [part='day'] { min-inline-size: var(--lr-icon-button-size); min-block-size: var(--lr-icon-button-size); border: var(--lr-border-width-thin) solid var(--lr-color-border); background: var(--lr-color-surface); color: var(--lr-color-text); cursor: pointer; }
|
|
22
12
|
button[part~='nav'] { padding-inline: var(--lr-space-s); border-radius: var(--lr-radius); }
|
|
23
13
|
button[part~='nav']:hover, [part='agenda-event']:hover { background: var(--lr-color-brand-quiet); }
|
|
24
|
-
/* Pressed: the same hovered fill carried further toward --lr-color-mix-partner (which follows the
|
|
25
|
-
text colour), so the step is visible in either theme instead of relying on a fixed lighten. */
|
|
26
14
|
button[part~='nav']:active, [part='agenda-event']:active { background: color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)); }
|
|
27
15
|
button[part~='nav']:focus-visible, [part='agenda-event']:focus-visible {
|
|
28
16
|
outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);
|
|
29
17
|
outline-offset: calc(var(--lr-focus-ring-offset) * -1);
|
|
30
18
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
correct behavior while focused. */
|
|
19
|
+
[part='day'][data-outside='true'] { color: var(--lr-calendar-day-outside-color, var(--lr-color-text-quiet)); background: var(--lr-calendar-day-outside-bg, var(--lr-color-surface)); }
|
|
20
|
+
[part='day'][data-today='true'] { outline: var(--lr-border-width-medium) solid var(--lr-calendar-day-today-outline-color, var(--lr-color-brand)); outline-offset: calc(var(--lr-border-width-medium) * -1); }
|
|
34
21
|
[part='day'][data-selected='true'] {
|
|
35
22
|
background: var(--lr-calendar-day-selected-bg, var(--lr-color-brand-quiet));
|
|
36
23
|
}
|
|
37
|
-
/* MUST stay before the :hover/:active rules below: both this and [part='day']:hover/:active are
|
|
38
|
-
equal specificity (0,2,0), so source order alone decides, and hovering or pressing an
|
|
39
|
-
already-selected day needs to layer its own feedback rather than have the static selected fill
|
|
40
|
-
win outright. Mirrors env-list.styles.ts's [aria-pressed='true']-before-:active fix for the
|
|
41
|
-
same masking shape. */
|
|
42
24
|
[part='day']:hover {
|
|
43
25
|
background: var(--lr-color-brand-quiet);
|
|
44
26
|
}
|
|
@@ -54,16 +36,8 @@ import{css}from"lit";const styles=css`
|
|
|
54
36
|
[part='grid'] { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border); border-inline-start: var(--lr-border-width-thin) solid var(--lr-color-border); }
|
|
55
37
|
[part='week'] { display: contents; }
|
|
56
38
|
[part='day'] { display: flex; flex-direction: column; align-items: stretch; min-block-size: var(--lr-calendar-day-min-block-size, var(--lr-size-6rem)); padding: var(--lr-space-xs); border-block-start: 0; border-inline-start: 0; text-align: start; }
|
|
57
|
-
[part='day'][data-outside='true'] { color: var(--lr-calendar-day-outside-color, var(--lr-color-text-quiet)); background: var(--lr-calendar-day-outside-bg, var(--lr-color-surface)); }
|
|
58
|
-
[part='day'][data-today='true'] { outline: var(--lr-border-width-medium) solid var(--lr-calendar-day-today-outline-color, var(--lr-color-brand)); outline-offset: calc(var(--lr-border-width-medium) * -1); }
|
|
59
39
|
[part='date'] { font-weight: var(--lr-font-weight-semibold); }
|
|
60
40
|
[part='event'] { overflow: hidden; box-sizing: border-box; inline-size: 100%; min-inline-size: var(--lr-size-1-5rem); min-block-size: var(--lr-size-1-5rem); margin-block-start: var(--lr-space-2xs); padding: var(--lr-space-2xs); border: 0; border-radius: var(--lr-radius); background: var(--lr-color-brand); color: var(--lr-color-on-brand); font: inherit; font-size: var(--lr-font-size-sm); text-align: start; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
|
|
61
|
-
/* An event chip's fill is per-event data (CalendarEvent.color) written as an inline
|
|
62
|
-
background-color by calendar.class.ts, and an inline declaration beats every stylesheet rule --
|
|
63
|
-
so the pointer feedback is painted as a background-IMAGE overlay rather than swapped into
|
|
64
|
-
background-color. The overlay composites over whatever fill the chip actually carries
|
|
65
|
-
(including a pure white or pure black one, which the filter: brightness() this replaces left
|
|
66
|
-
completely unchanged) and paints under the label instead of recolouring it. */
|
|
67
41
|
[part='event']:hover {
|
|
68
42
|
background-image: linear-gradient(
|
|
69
43
|
color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-hover)),
|
|
@@ -76,12 +76,16 @@ export interface LyraConditionBuilderEventMap {
|
|
|
76
76
|
* relationship/path queries over a knowledge graph, a genuinely different data model from this
|
|
77
77
|
* one's flat tabular field/operator/value conditions — they never share a file or a value type.
|
|
78
78
|
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* This component never mutates `fields`/`value` in place
|
|
84
|
-
*
|
|
79
|
+
* A host supplies `fields` (the available columns, each with a `ConditionBuilderFieldType` that
|
|
80
|
+
* determines its offered operators and value control) and `value` (a plain, serializable
|
|
81
|
+
* `{ combinator, conditions }` object — safe to persist or send to a backend as-is, the same shape
|
|
82
|
+
* convention as this package's `<lr-rubric-form>`/`<lr-filter-bar>`).
|
|
83
|
+
* This component never mutates `fields`/`value` in place — inputs are clone-owned — and never calls
|
|
84
|
+
* out to storage/network itself. It does advance its own copy of `value` on each edit and *then*
|
|
85
|
+
* emits `lr-input` with the complete next state: the same "update, then emit; reassign to control"
|
|
86
|
+
* round-trip `<lr-source-picker>`'s `selectedSourceIds` and `<lr-retrieval-search>`'s `filters`
|
|
87
|
+
* establish. `lr-input` is not cancelable, so a host validating an edit reassigns `value` in its
|
|
88
|
+
* handler rather than vetoing the change before it renders. A non-finite value on a
|
|
85
89
|
* field declared as `number` normalizes to `undefined`, whether it arrives through the controlled
|
|
86
90
|
* model, later field metadata, or an overflowing user-input string, so JSON never turns it into
|
|
87
91
|
* an unrelated `null` condition.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{html,nothing}from"lit";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{nextId}from"../../../internal/a11y.js";import{styles}from"./condition-builder.styles.js";import{activeElementIn}from"../../../internal/active-element.js";import{LYRA_DEFAULT_queryBuilderAddCondition,LYRA_DEFAULT_queryBuilderBooleanFalse,LYRA_DEFAULT_queryBuilderBooleanTrue,LYRA_DEFAULT_queryBuilderCombinatorAnd,LYRA_DEFAULT_queryBuilderCombinatorLabel,LYRA_DEFAULT_queryBuilderCombinatorOr,LYRA_DEFAULT_queryBuilderEmpty,LYRA_DEFAULT_queryBuilderFieldLabel,LYRA_DEFAULT_queryBuilderFieldPlaceholder,LYRA_DEFAULT_queryBuilderLabel,LYRA_DEFAULT_queryBuilderNoFields,LYRA_DEFAULT_queryBuilderOperatorAfter,LYRA_DEFAULT_queryBuilderOperatorBefore,LYRA_DEFAULT_queryBuilderOperatorContains,LYRA_DEFAULT_queryBuilderOperatorEndsWith,LYRA_DEFAULT_queryBuilderOperatorEquals,LYRA_DEFAULT_queryBuilderOperatorGreaterThan,LYRA_DEFAULT_queryBuilderOperatorGreaterThanOrEqual,LYRA_DEFAULT_queryBuilderOperatorIn,LYRA_DEFAULT_queryBuilderOperatorIsEmpty,LYRA_DEFAULT_queryBuilderOperatorIsNotEmpty,LYRA_DEFAULT_queryBuilderOperatorLabel,LYRA_DEFAULT_queryBuilderOperatorLessThan,LYRA_DEFAULT_queryBuilderOperatorLessThanOrEqual,LYRA_DEFAULT_queryBuilderOperatorNotEquals,LYRA_DEFAULT_queryBuilderOperatorNotIn,LYRA_DEFAULT_queryBuilderOperatorOnOrAfter,LYRA_DEFAULT_queryBuilderOperatorOnOrBefore,LYRA_DEFAULT_queryBuilderOperatorPlaceholder,LYRA_DEFAULT_queryBuilderOperatorStartsWith,LYRA_DEFAULT_queryBuilderRemoveCondition,LYRA_DEFAULT_queryBuilderValueLabel,LYRA_DEFAULT_queryBuilderValuePlaceholder}from"../../../internal/default-strings.generated.js";function selectValue(el){return Array.isArray(el.value)?el.value[0]??"":el.value}const MAX_FIELDS=200,MAX_CONDITIONS=200,MAX_OPTIONS=500,MAX_TEXT=256,EMPTY_FIELDS=Object.freeze([]),EMPTY_OPTIONS=Object.freeze([]),EMPTY_VALUE=Object.freeze({combinator:"and",conditions:Object.freeze([])}),STRING_OPERATORS=["eq","neq","contains","startsWith","endsWith","isEmpty","isNotEmpty"],NUMBER_OPERATORS=["eq","neq","gt","gte","lt","lte","isEmpty","isNotEmpty"],BOOLEAN_OPERATORS=["eq","neq"],DATE_OPERATORS=["eq","neq","gt","gte","lt","lte","isEmpty","isNotEmpty"],ENUM_OPERATORS=["eq","neq","in","notIn","isEmpty","isNotEmpty"];function defaultOperatorsForType(type){switch(type){case"string":return STRING_OPERATORS;case"number":return NUMBER_OPERATORS;case"boolean":return BOOLEAN_OPERATORS;case"date":return DATE_OPERATORS;case"enum":return ENUM_OPERATORS}}function isUnaryOperator(op){return op==="isEmpty"||op==="isNotEmpty"}function isMultiOperator(op){return op==="in"||op==="notIn"}const FIELD_TYPES=new Set(["string","number","boolean","date","enum"]),OPERATORS=new Set(["eq","neq","gt","gte","lt","lte","contains","startsWith","endsWith","in","notIn","isEmpty","isNotEmpty"]);function ownValue(record,key){try{const descriptor=Object.getOwnPropertyDescriptor(record,key);return descriptor&&"value"in descriptor?descriptor.value:void 0}catch{return}}function boundedString(value){return typeof value=="string"?value.slice(0,MAX_TEXT):""}function normalizeOptions(value){if(!Array.isArray(value))return EMPTY_OPTIONS;const seen=new Set,result=[];for(const candidate of value.slice(0,MAX_OPTIONS)){if(candidate===null||typeof candidate!="object"||Array.isArray(candidate))continue;const optionValue=boundedString(ownValue(candidate,"value"));if(optionValue.trim().length===0||seen.has(optionValue))continue;seen.add(optionValue);const label=boundedString(ownValue(candidate,"label"));result.push(Object.freeze({value:optionValue,...label?{label}:{}}))}return Object.freeze(result)}function normalizeOperators(value){if(!Array.isArray(value))return;const result=[...new Set(value.slice(0,MAX_OPTIONS).filter(entry=>OPERATORS.has(entry)))];return result.length>0?Object.freeze(result):void 0}function normalizeFields(value){if(!Array.isArray(value))return EMPTY_FIELDS;const names=new Set,result=[];for(const candidate of value.slice(0,MAX_FIELDS)){if(candidate===null||typeof candidate!="object"||Array.isArray(candidate))continue;const name=boundedString(ownValue(candidate,"name")),type=ownValue(candidate,"type");if(name.trim().length===0||names.has(name)||!FIELD_TYPES.has(type))continue;names.add(name);const label=boundedString(ownValue(candidate,"label")),placeholder=boundedString(ownValue(candidate,"placeholder")),options=normalizeOptions(ownValue(candidate,"options")),operators=normalizeOperators(ownValue(candidate,"operators"));result.push(Object.freeze({name,type,...label?{label}:{},...placeholder?{placeholder}:{},...options.length>0?{options}:{},...operators?{operators}:{}}))}return Object.freeze(result)}function normalizeConditionValue(value){if(typeof value=="string"||typeof value=="boolean")return value;if(typeof value=="number")return Number.isFinite(value)?value:void 0;if(Array.isArray(value))return Object.freeze(value.slice(0,MAX_OPTIONS).filter(entry=>typeof entry=="string").map(entry=>boundedString(entry)))}function normalizeConditionBuilderValue(value,fields){const record=value!==null&&typeof value=="object"&&!Array.isArray(value)?value:EMPTY_VALUE,combinator=ownValue(record,"combinator")==="or"?"or":"and",source=ownValue(record,"conditions"),conditions=[],ids=new Set;if(Array.isArray(source))for(const candidate of source.slice(0,MAX_CONDITIONS)){if(candidate===null||typeof candidate!="object"||Array.isArray(candidate))continue;const id=boundedString(ownValue(candidate,"id"));if(id.trim().length===0||ids.has(id))continue;ids.add(id);const field=boundedString(ownValue(candidate,"field")),rawOperator=ownValue(candidate,"operator"),operator=rawOperator===""||OPERATORS.has(rawOperator)?rawOperator:"";let normalizedValue=normalizeConditionValue(ownValue(candidate,"value"));fields.find(entry=>entry.name===field)?.type==="number"&&typeof normalizedValue!="number"&&(normalizedValue=void 0),conditions.push(Object.freeze({id,field,operator,...normalizedValue!==void 0?{value:normalizedValue}:{}}))}return Object.freeze({combinator,conditions:Object.freeze(conditions)})}class LyraConditionBuilder extends LyraElement{constructor(){super(...arguments),this._fields=EMPTY_FIELDS,this._value=EMPTY_VALUE,this._disabled=!1,this.pendingFocusAdd=!1}static{this.defaultStrings={...super.defaultStrings,queryBuilderAddCondition:LYRA_DEFAULT_queryBuilderAddCondition,queryBuilderBooleanFalse:LYRA_DEFAULT_queryBuilderBooleanFalse,queryBuilderBooleanTrue:LYRA_DEFAULT_queryBuilderBooleanTrue,queryBuilderCombinatorAnd:LYRA_DEFAULT_queryBuilderCombinatorAnd,queryBuilderCombinatorLabel:LYRA_DEFAULT_queryBuilderCombinatorLabel,queryBuilderCombinatorOr:LYRA_DEFAULT_queryBuilderCombinatorOr,queryBuilderEmpty:LYRA_DEFAULT_queryBuilderEmpty,queryBuilderFieldLabel:LYRA_DEFAULT_queryBuilderFieldLabel,queryBuilderFieldPlaceholder:LYRA_DEFAULT_queryBuilderFieldPlaceholder,queryBuilderLabel:LYRA_DEFAULT_queryBuilderLabel,queryBuilderNoFields:LYRA_DEFAULT_queryBuilderNoFields,queryBuilderOperatorAfter:LYRA_DEFAULT_queryBuilderOperatorAfter,queryBuilderOperatorBefore:LYRA_DEFAULT_queryBuilderOperatorBefore,queryBuilderOperatorContains:LYRA_DEFAULT_queryBuilderOperatorContains,queryBuilderOperatorEndsWith:LYRA_DEFAULT_queryBuilderOperatorEndsWith,queryBuilderOperatorEquals:LYRA_DEFAULT_queryBuilderOperatorEquals,queryBuilderOperatorGreaterThan:LYRA_DEFAULT_queryBuilderOperatorGreaterThan,queryBuilderOperatorGreaterThanOrEqual:LYRA_DEFAULT_queryBuilderOperatorGreaterThanOrEqual,queryBuilderOperatorIn:LYRA_DEFAULT_queryBuilderOperatorIn,queryBuilderOperatorIsEmpty:LYRA_DEFAULT_queryBuilderOperatorIsEmpty,queryBuilderOperatorIsNotEmpty:LYRA_DEFAULT_queryBuilderOperatorIsNotEmpty,queryBuilderOperatorLabel:LYRA_DEFAULT_queryBuilderOperatorLabel,queryBuilderOperatorLessThan:LYRA_DEFAULT_queryBuilderOperatorLessThan,queryBuilderOperatorLessThanOrEqual:LYRA_DEFAULT_queryBuilderOperatorLessThanOrEqual,queryBuilderOperatorNotEquals:LYRA_DEFAULT_queryBuilderOperatorNotEquals,queryBuilderOperatorNotIn:LYRA_DEFAULT_queryBuilderOperatorNotIn,queryBuilderOperatorOnOrAfter:LYRA_DEFAULT_queryBuilderOperatorOnOrAfter,queryBuilderOperatorOnOrBefore:LYRA_DEFAULT_queryBuilderOperatorOnOrBefore,queryBuilderOperatorPlaceholder:LYRA_DEFAULT_queryBuilderOperatorPlaceholder,queryBuilderOperatorStartsWith:LYRA_DEFAULT_queryBuilderOperatorStartsWith,queryBuilderRemoveCondition:LYRA_DEFAULT_queryBuilderRemoveCondition,queryBuilderValueLabel:LYRA_DEFAULT_queryBuilderValueLabel,queryBuilderValuePlaceholder:LYRA_DEFAULT_queryBuilderValuePlaceholder}}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-add-condition"])}static{this.properties={fields:{attribute:!1,noAccessor:!0},value:{attribute:!1,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}get fields(){return this._fields}set fields(next){const old=this._fields;this._fields=normalizeFields(next),this.requestUpdate("fields",old);const previousValue=this._value;this._value=normalizeConditionBuilderValue(this._value,this._fields),this._value!==previousValue&&this.requestUpdate("value",previousValue)}get value(){return this._value}set value(next){const old=this._value;this._value=normalizeConditionBuilderValue(next,this._fields),this.requestUpdate("value",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.requestUpdate("disabled",old)}operatorsFor(field){return field?field.operators&&field.operators.length>0?field.operators:defaultOperatorsForType(field.type):[]}operatorLabel(op,type){switch(op){case"eq":return this.localize("queryBuilderOperatorEquals");case"neq":return this.localize("queryBuilderOperatorNotEquals");case"gt":return type==="date"?this.localize("queryBuilderOperatorAfter"):this.localize("queryBuilderOperatorGreaterThan");case"gte":return type==="date"?this.localize("queryBuilderOperatorOnOrAfter"):this.localize("queryBuilderOperatorGreaterThanOrEqual");case"lt":return type==="date"?this.localize("queryBuilderOperatorBefore"):this.localize("queryBuilderOperatorLessThan");case"lte":return type==="date"?this.localize("queryBuilderOperatorOnOrBefore"):this.localize("queryBuilderOperatorLessThanOrEqual");case"contains":return this.localize("queryBuilderOperatorContains");case"startsWith":return this.localize("queryBuilderOperatorStartsWith");case"endsWith":return this.localize("queryBuilderOperatorEndsWith");case"in":return this.localize("queryBuilderOperatorIn");case"notIn":return this.localize("queryBuilderOperatorNotIn");case"isEmpty":return this.localize("queryBuilderOperatorIsEmpty");case"isNotEmpty":return this.localize("queryBuilderOperatorIsNotEmpty")}}defaultValueFor(fieldName,operator){if(operator===""||isUnaryOperator(operator))return;if(isMultiOperator(operator))return[];const field=this._fields.find(f=>f.name===fieldName);if(!(field?.type==="number"||field?.type==="boolean"))return""}commit(next){this.value=next,this.emit("lr-input",Object.freeze({value:this._value}))}addCondition(){const firstField=this._fields[0];if(this.disabled||!firstField||this._value.conditions.length>=MAX_CONDITIONS)return;const condition=Object.freeze({id:nextId("query-condition"),field:firstField.name,operator:""});this.commit({...this._value,conditions:[...this._value.conditions,condition]}),this.emit("lr-add-condition",Object.freeze({condition}))}conditionElement(id){const root=this.shadowRoot;if(!root)return null;const ownerCss=this.ownerDocument.defaultView?.CSS;if(typeof ownerCss?.escape=="function")try{const candidate=root.querySelector(`[part="condition"][data-id="${ownerCss.escape(id)}"]`);if(candidate?.getAttribute("data-id")===id)return candidate}catch{}return Array.from(root.querySelectorAll('[part="condition"][data-id]')).find(candidate=>candidate.getAttribute("data-id")===id)??null}removeCondition(id){if(this.disabled||!this._value.conditions.some(c=>c.id===id))return;const row=this.conditionElement(id),active=activeElementIn(this.shadowRoot);row&&active&&row.contains(active)&&(this.pendingFocusAdd=!0);const conditions=this._value.conditions.filter(c=>c.id!==id);this.commit({...this._value,conditions}),this.emit("lr-remove-condition",Object.freeze({conditionId:id}))}setCombinator(combinator){this.disabled||combinator===this._value.combinator||this.commit({...this._value,combinator})}setConditionField(id,field){if(this.disabled)return;const conditions=this._value.conditions.map(c=>c.id===id?{id:c.id,field,operator:"",value:void 0}:c);this.commit({...this._value,conditions})}setConditionOperator(id,operator){if(this.disabled)return;const conditions=this._value.conditions.map(c=>c.id===id?{...c,operator,value:this.defaultValueFor(c.field,operator)}:c);this.commit({...this._value,conditions})}setConditionValue(id,value){if(this.disabled)return;const conditions=this._value.conditions.map(c=>c.id===id?{...c,value}:c);this.commit({...this._value,conditions})}consumeChildEvent(event,action){event.stopPropagation(),action()}updated(changed){super.updated(changed),this.pendingFocusAdd&&(this.pendingFocusAdd=!1,this.renderRoot.querySelector('[part="add-button"]')?.focus())}renderCombinator(combinator){return html`
|
|
1
|
+
import{html,nothing}from"lit";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{styles}from"./condition-builder.styles.js";import{activeElementIn}from"../../../internal/active-element.js";import{LYRA_DEFAULT_queryBuilderAddCondition,LYRA_DEFAULT_queryBuilderBooleanFalse,LYRA_DEFAULT_queryBuilderBooleanTrue,LYRA_DEFAULT_queryBuilderCombinatorAnd,LYRA_DEFAULT_queryBuilderCombinatorLabel,LYRA_DEFAULT_queryBuilderCombinatorOr,LYRA_DEFAULT_queryBuilderEmpty,LYRA_DEFAULT_queryBuilderFieldLabel,LYRA_DEFAULT_queryBuilderFieldPlaceholder,LYRA_DEFAULT_queryBuilderLabel,LYRA_DEFAULT_queryBuilderNoFields,LYRA_DEFAULT_queryBuilderOperatorAfter,LYRA_DEFAULT_queryBuilderOperatorBefore,LYRA_DEFAULT_queryBuilderOperatorContains,LYRA_DEFAULT_queryBuilderOperatorEndsWith,LYRA_DEFAULT_queryBuilderOperatorEquals,LYRA_DEFAULT_queryBuilderOperatorGreaterThan,LYRA_DEFAULT_queryBuilderOperatorGreaterThanOrEqual,LYRA_DEFAULT_queryBuilderOperatorIn,LYRA_DEFAULT_queryBuilderOperatorIsEmpty,LYRA_DEFAULT_queryBuilderOperatorIsNotEmpty,LYRA_DEFAULT_queryBuilderOperatorLabel,LYRA_DEFAULT_queryBuilderOperatorLessThan,LYRA_DEFAULT_queryBuilderOperatorLessThanOrEqual,LYRA_DEFAULT_queryBuilderOperatorNotEquals,LYRA_DEFAULT_queryBuilderOperatorNotIn,LYRA_DEFAULT_queryBuilderOperatorOnOrAfter,LYRA_DEFAULT_queryBuilderOperatorOnOrBefore,LYRA_DEFAULT_queryBuilderOperatorPlaceholder,LYRA_DEFAULT_queryBuilderOperatorStartsWith,LYRA_DEFAULT_queryBuilderRemoveCondition,LYRA_DEFAULT_queryBuilderValueLabel,LYRA_DEFAULT_queryBuilderValuePlaceholder}from"../../../internal/default-strings.generated.js";function selectValue(el){return Array.isArray(el.value)?el.value[0]??"":el.value}const MAX_FIELDS=200,MAX_CONDITIONS=200,MAX_OPTIONS=500,MAX_TEXT=256,EMPTY_FIELDS=Object.freeze([]),EMPTY_OPTIONS=Object.freeze([]),EMPTY_VALUE=Object.freeze({combinator:"and",conditions:Object.freeze([])}),STRING_OPERATORS=["eq","neq","contains","startsWith","endsWith","isEmpty","isNotEmpty"],NUMBER_OPERATORS=["eq","neq","gt","gte","lt","lte","isEmpty","isNotEmpty"],BOOLEAN_OPERATORS=["eq","neq"],DATE_OPERATORS=["eq","neq","gt","gte","lt","lte","isEmpty","isNotEmpty"],ENUM_OPERATORS=["eq","neq","in","notIn","isEmpty","isNotEmpty"];function defaultOperatorsForType(type){switch(type){case"string":return STRING_OPERATORS;case"number":return NUMBER_OPERATORS;case"boolean":return BOOLEAN_OPERATORS;case"date":return DATE_OPERATORS;case"enum":return ENUM_OPERATORS}}function isUnaryOperator(op){return op==="isEmpty"||op==="isNotEmpty"}function isMultiOperator(op){return op==="in"||op==="notIn"}const FIELD_TYPES=new Set(["string","number","boolean","date","enum"]),OPERATORS=new Set(["eq","neq","gt","gte","lt","lte","contains","startsWith","endsWith","in","notIn","isEmpty","isNotEmpty"]);function ownValue(record,key){try{const descriptor=Object.getOwnPropertyDescriptor(record,key);return descriptor&&"value"in descriptor?descriptor.value:void 0}catch{return}}function boundedString(value){return typeof value=="string"?value.slice(0,MAX_TEXT):""}function normalizeOptions(value){if(!Array.isArray(value))return EMPTY_OPTIONS;const seen=new Set,result=[];for(const candidate of value.slice(0,MAX_OPTIONS)){if(candidate===null||typeof candidate!="object"||Array.isArray(candidate))continue;const optionValue=boundedString(ownValue(candidate,"value"));if(optionValue.trim().length===0||seen.has(optionValue))continue;seen.add(optionValue);const label=boundedString(ownValue(candidate,"label"));result.push(Object.freeze({value:optionValue,...label?{label}:{}}))}return Object.freeze(result)}function normalizeOperators(value){if(!Array.isArray(value))return;const result=[...new Set(value.slice(0,MAX_OPTIONS).filter(entry=>OPERATORS.has(entry)))];return result.length>0?Object.freeze(result):void 0}function normalizeFields(value){if(!Array.isArray(value))return EMPTY_FIELDS;const names=new Set,result=[];for(const candidate of value.slice(0,MAX_FIELDS)){if(candidate===null||typeof candidate!="object"||Array.isArray(candidate))continue;const name=boundedString(ownValue(candidate,"name")),type=ownValue(candidate,"type");if(name.trim().length===0||names.has(name)||!FIELD_TYPES.has(type))continue;names.add(name);const label=boundedString(ownValue(candidate,"label")),placeholder=boundedString(ownValue(candidate,"placeholder")),options=normalizeOptions(ownValue(candidate,"options")),operators=normalizeOperators(ownValue(candidate,"operators"));result.push(Object.freeze({name,type,...label?{label}:{},...placeholder?{placeholder}:{},...options.length>0?{options}:{},...operators?{operators}:{}}))}return Object.freeze(result)}function normalizeConditionValue(value){if(typeof value=="string"||typeof value=="boolean")return value;if(typeof value=="number")return Number.isFinite(value)?value:void 0;if(Array.isArray(value))return Object.freeze(value.slice(0,MAX_OPTIONS).filter(entry=>typeof entry=="string").map(entry=>boundedString(entry)))}function normalizeConditionBuilderValue(value,fields){const record=value!==null&&typeof value=="object"&&!Array.isArray(value)?value:EMPTY_VALUE,combinator=ownValue(record,"combinator")==="or"?"or":"and",source=ownValue(record,"conditions"),conditions=[],ids=new Set;if(Array.isArray(source))for(const candidate of source.slice(0,MAX_CONDITIONS)){if(candidate===null||typeof candidate!="object"||Array.isArray(candidate))continue;const id=boundedString(ownValue(candidate,"id"));if(id.trim().length===0||ids.has(id))continue;ids.add(id);const field=boundedString(ownValue(candidate,"field")),rawOperator=ownValue(candidate,"operator"),operator=rawOperator===""||OPERATORS.has(rawOperator)?rawOperator:"";let normalizedValue=normalizeConditionValue(ownValue(candidate,"value"));fields.find(entry=>entry.name===field)?.type==="number"&&typeof normalizedValue!="number"&&(normalizedValue=void 0),conditions.push(Object.freeze({id,field,operator,...normalizedValue!==void 0?{value:normalizedValue}:{}}))}return Object.freeze({combinator,conditions:Object.freeze(conditions)})}class LyraConditionBuilder extends LyraElement{constructor(){super(...arguments),this._fields=EMPTY_FIELDS,this._value=EMPTY_VALUE,this._disabled=!1,this.pendingFocusAdd=!1}static{this.defaultStrings={...super.defaultStrings,queryBuilderAddCondition:LYRA_DEFAULT_queryBuilderAddCondition,queryBuilderBooleanFalse:LYRA_DEFAULT_queryBuilderBooleanFalse,queryBuilderBooleanTrue:LYRA_DEFAULT_queryBuilderBooleanTrue,queryBuilderCombinatorAnd:LYRA_DEFAULT_queryBuilderCombinatorAnd,queryBuilderCombinatorLabel:LYRA_DEFAULT_queryBuilderCombinatorLabel,queryBuilderCombinatorOr:LYRA_DEFAULT_queryBuilderCombinatorOr,queryBuilderEmpty:LYRA_DEFAULT_queryBuilderEmpty,queryBuilderFieldLabel:LYRA_DEFAULT_queryBuilderFieldLabel,queryBuilderFieldPlaceholder:LYRA_DEFAULT_queryBuilderFieldPlaceholder,queryBuilderLabel:LYRA_DEFAULT_queryBuilderLabel,queryBuilderNoFields:LYRA_DEFAULT_queryBuilderNoFields,queryBuilderOperatorAfter:LYRA_DEFAULT_queryBuilderOperatorAfter,queryBuilderOperatorBefore:LYRA_DEFAULT_queryBuilderOperatorBefore,queryBuilderOperatorContains:LYRA_DEFAULT_queryBuilderOperatorContains,queryBuilderOperatorEndsWith:LYRA_DEFAULT_queryBuilderOperatorEndsWith,queryBuilderOperatorEquals:LYRA_DEFAULT_queryBuilderOperatorEquals,queryBuilderOperatorGreaterThan:LYRA_DEFAULT_queryBuilderOperatorGreaterThan,queryBuilderOperatorGreaterThanOrEqual:LYRA_DEFAULT_queryBuilderOperatorGreaterThanOrEqual,queryBuilderOperatorIn:LYRA_DEFAULT_queryBuilderOperatorIn,queryBuilderOperatorIsEmpty:LYRA_DEFAULT_queryBuilderOperatorIsEmpty,queryBuilderOperatorIsNotEmpty:LYRA_DEFAULT_queryBuilderOperatorIsNotEmpty,queryBuilderOperatorLabel:LYRA_DEFAULT_queryBuilderOperatorLabel,queryBuilderOperatorLessThan:LYRA_DEFAULT_queryBuilderOperatorLessThan,queryBuilderOperatorLessThanOrEqual:LYRA_DEFAULT_queryBuilderOperatorLessThanOrEqual,queryBuilderOperatorNotEquals:LYRA_DEFAULT_queryBuilderOperatorNotEquals,queryBuilderOperatorNotIn:LYRA_DEFAULT_queryBuilderOperatorNotIn,queryBuilderOperatorOnOrAfter:LYRA_DEFAULT_queryBuilderOperatorOnOrAfter,queryBuilderOperatorOnOrBefore:LYRA_DEFAULT_queryBuilderOperatorOnOrBefore,queryBuilderOperatorPlaceholder:LYRA_DEFAULT_queryBuilderOperatorPlaceholder,queryBuilderOperatorStartsWith:LYRA_DEFAULT_queryBuilderOperatorStartsWith,queryBuilderRemoveCondition:LYRA_DEFAULT_queryBuilderRemoveCondition,queryBuilderValueLabel:LYRA_DEFAULT_queryBuilderValueLabel,queryBuilderValuePlaceholder:LYRA_DEFAULT_queryBuilderValuePlaceholder}}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-add-condition"])}static{this.properties={fields:{attribute:!1,noAccessor:!0},value:{attribute:!1,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}get fields(){return this._fields}set fields(next){const old=this._fields;this._fields=normalizeFields(next),this.requestUpdate("fields",old);const previousValue=this._value;this._value=normalizeConditionBuilderValue(this._value,this._fields),this._value!==previousValue&&this.requestUpdate("value",previousValue)}get value(){return this._value}set value(next){const old=this._value;this._value=normalizeConditionBuilderValue(next,this._fields),this.requestUpdate("value",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.requestUpdate("disabled",old)}operatorsFor(field){return field?field.operators&&field.operators.length>0?field.operators:defaultOperatorsForType(field.type):[]}operatorLabel(op,type){switch(op){case"eq":return this.localize("queryBuilderOperatorEquals");case"neq":return this.localize("queryBuilderOperatorNotEquals");case"gt":return type==="date"?this.localize("queryBuilderOperatorAfter"):this.localize("queryBuilderOperatorGreaterThan");case"gte":return type==="date"?this.localize("queryBuilderOperatorOnOrAfter"):this.localize("queryBuilderOperatorGreaterThanOrEqual");case"lt":return type==="date"?this.localize("queryBuilderOperatorBefore"):this.localize("queryBuilderOperatorLessThan");case"lte":return type==="date"?this.localize("queryBuilderOperatorOnOrBefore"):this.localize("queryBuilderOperatorLessThanOrEqual");case"contains":return this.localize("queryBuilderOperatorContains");case"startsWith":return this.localize("queryBuilderOperatorStartsWith");case"endsWith":return this.localize("queryBuilderOperatorEndsWith");case"in":return this.localize("queryBuilderOperatorIn");case"notIn":return this.localize("queryBuilderOperatorNotIn");case"isEmpty":return this.localize("queryBuilderOperatorIsEmpty");case"isNotEmpty":return this.localize("queryBuilderOperatorIsNotEmpty")}}defaultValueFor(fieldName,operator){if(operator===""||isUnaryOperator(operator))return;if(isMultiOperator(operator))return[];const field=this._fields.find(f=>f.name===fieldName);if(!(field?.type==="number"||field?.type==="boolean"))return""}commit(next){this.value=next,this.emit("lr-input",Object.freeze({value:this._value}))}addCondition(){const firstField=this._fields[0];if(this.disabled||!firstField||this._value.conditions.length>=MAX_CONDITIONS)return;const condition=Object.freeze({id:nextId("query-condition"),field:firstField.name,operator:""});this.commit({...this._value,conditions:[...this._value.conditions,condition]}),this.emit("lr-add-condition",Object.freeze({condition}))}conditionElement(id){const root=this.shadowRoot;if(!root)return null;const ownerCss=this.ownerDocument.defaultView?.CSS;if(typeof ownerCss?.escape=="function")try{const candidate=root.querySelector(`[part="condition"][data-id="${ownerCss.escape(id)}"]`);if(candidate?.getAttribute("data-id")===id)return candidate}catch{}return Array.from(root.querySelectorAll('[part="condition"][data-id]')).find(candidate=>candidate.getAttribute("data-id")===id)??null}removeCondition(id){if(this.disabled||!this._value.conditions.some(c=>c.id===id))return;const row=this.conditionElement(id),active=activeElementIn(this.shadowRoot);row&&active&&row.contains(active)&&(this.pendingFocusAdd=!0);const conditions=this._value.conditions.filter(c=>c.id!==id);this.commit({...this._value,conditions}),this.emit("lr-remove-condition",Object.freeze({conditionId:id}))}setCombinator(combinator){this.disabled||combinator===this._value.combinator||this.commit({...this._value,combinator})}setConditionField(id,field){if(this.disabled)return;const conditions=this._value.conditions.map(c=>c.id===id?{id:c.id,field,operator:"",value:void 0}:c);this.commit({...this._value,conditions})}setConditionOperator(id,operator){if(this.disabled)return;const conditions=this._value.conditions.map(c=>c.id===id?{...c,operator,value:this.defaultValueFor(c.field,operator)}:c);this.commit({...this._value,conditions})}setConditionValue(id,value){if(this.disabled)return;const conditions=this._value.conditions.map(c=>c.id===id?{...c,value}:c);this.commit({...this._value,conditions})}consumeChildEvent(event,action){event.stopPropagation(),action()}updated(changed){super.updated(changed),this.pendingFocusAdd&&(this.pendingFocusAdd=!1,this.renderRoot.querySelector('[part="add-button"]')?.focus())}renderCombinator(combinator){return html`
|
|
2
2
|
<lr-select
|
|
3
3
|
part="combinator"
|
|
4
4
|
size="s"
|
|
@@ -114,7 +114,7 @@ import{html,nothing}from"lit";import{LyraElement}from"../../../internal/lyra-ele
|
|
|
114
114
|
></lr-icon-button>
|
|
115
115
|
</div>
|
|
116
116
|
`}render(){const hasFields=this._fields.length>0,value=this._value;return html`
|
|
117
|
-
<div part="base" role="group" aria-label=${this
|
|
117
|
+
<div part="base" role="group" aria-label=${hostAriaLabel(this)??this.localize("queryBuilderLabel")}>
|
|
118
118
|
${hasFields?html`
|
|
119
119
|
${value.conditions.length>1?this.renderCombinator(value.combinator):nothing}
|
|
120
120
|
${value.conditions.length===0?html`<p part="empty">${this.localize("queryBuilderEmpty")}</p>`:html`<div part="conditions" role="list">${value.conditions.map((c,i)=>this.renderCondition(c,i))}</div>`}
|
|
@@ -2,9 +2,6 @@ import{css}from"lit";const styles=css`
|
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
min-inline-size: 0;
|
|
5
|
-
/* Makes the host a query container so the narrow-allocation rule below reacts to the
|
|
6
|
-
component's own allocated width (a sidebar, a split pane, a dialog) rather than the
|
|
7
|
-
viewport. */
|
|
8
5
|
container-type: inline-size;
|
|
9
6
|
contain-intrinsic-inline-size: var(--lr-size-20rem);
|
|
10
7
|
}
|
|
@@ -61,9 +58,6 @@ import{css}from"lit";const styles=css`
|
|
|
61
58
|
color: var(--lr-color-text-quiet);
|
|
62
59
|
}
|
|
63
60
|
|
|
64
|
-
/* Container-query lengths cannot reference custom properties. This is the documented 320px
|
|
65
|
-
narrow-allocation baseline expressed in root-relative units so it still follows the page's
|
|
66
|
-
type scale. */
|
|
67
61
|
@container (max-inline-size: 20rem) {
|
|
68
62
|
[part='condition'] {
|
|
69
63
|
flex-direction: column;
|
|
@@ -28,7 +28,6 @@ import{css}from"lit";const styles=css`
|
|
|
28
28
|
font-family: var(--lr-font);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
/* --- bar variant ------------------------------------------------- */
|
|
32
31
|
[part='track'] {
|
|
33
32
|
position: relative;
|
|
34
33
|
display: flex;
|
|
@@ -36,10 +35,6 @@ import{css}from"lit";const styles=css`
|
|
|
36
35
|
overflow: hidden;
|
|
37
36
|
block-size: var(--lr-size-0-5rem);
|
|
38
37
|
border-radius: calc(var(--lr-radius) * 0.5);
|
|
39
|
-
/* Quiet neutral fill for the unfilled remainder -- deliberately lighter
|
|
40
|
-
than a 'neutral'-tone segment (var(--lr-color-border) at full
|
|
41
|
-
strength below) so "counted but uncolored" data still reads as
|
|
42
|
-
visually distinct from "not counted at all". */
|
|
43
38
|
background: color-mix(in srgb, var(--lr-color-border) 30%, transparent);
|
|
44
39
|
}
|
|
45
40
|
[part='segment'] {
|
|
@@ -49,11 +44,6 @@ import{css}from"lit";const styles=css`
|
|
|
49
44
|
background: var(--lr-color-border);
|
|
50
45
|
transition: flex-basis var(--lr-transition-base);
|
|
51
46
|
}
|
|
52
|
-
/* A hairline seam between adjacent segments -- painted in the surface
|
|
53
|
-
color rather than as real gap spacing, so two same-tone segments next
|
|
54
|
-
to each other (e.g. two 'neutral' entries) still read as separate
|
|
55
|
-
quantities instead of merging into one block. Logical property keeps it
|
|
56
|
-
RTL-correct without extra math. */
|
|
57
47
|
[part='segment']:not(:first-of-type) {
|
|
58
48
|
border-inline-start: var(--lr-border-width-thin) solid var(--lr-color-surface);
|
|
59
49
|
}
|
|
@@ -73,11 +63,6 @@ import{css}from"lit";const styles=css`
|
|
|
73
63
|
background: var(--lr-context-meter-segment-color);
|
|
74
64
|
}
|
|
75
65
|
|
|
76
|
-
/* --- legend --------------------------------------------------------- */
|
|
77
|
-
/* The key grows a row per consumer-supplied segment and each label grows with translation, so it
|
|
78
|
-
wraps rather than overflowing, and every item keeps min-inline-size: 0 so a long label shrinks
|
|
79
|
-
inside its own row instead of forcing the meter's allocation wider. Same shape and the same
|
|
80
|
-
part names as lr-sequence-strip's legend. */
|
|
81
66
|
[part='legend'] {
|
|
82
67
|
display: flex;
|
|
83
68
|
flex-wrap: wrap;
|
|
@@ -98,9 +83,6 @@ import{css}from"lit";const styles=css`
|
|
|
98
83
|
inline-size: var(--lr-context-meter-legend-swatch-size, var(--lr-size-0-625rem));
|
|
99
84
|
block-size: var(--lr-context-meter-legend-swatch-size, var(--lr-size-0-625rem));
|
|
100
85
|
border-radius: var(--lr-radius-xs);
|
|
101
|
-
/* The chip reproduces the option's data colour, exactly as [part='segment'] does -- same tone
|
|
102
|
-
ladder, same inline custom-property escape, so a swatch can never disagree with the band it
|
|
103
|
-
stands for. */
|
|
104
86
|
background: var(--lr-color-border);
|
|
105
87
|
}
|
|
106
88
|
[part='legend-swatch'][data-tone='brand'] {
|
|
@@ -122,9 +104,6 @@ import{css}from"lit";const styles=css`
|
|
|
122
104
|
min-inline-size: 0;
|
|
123
105
|
overflow-wrap: anywhere;
|
|
124
106
|
}
|
|
125
|
-
/* The ring is a fixed 8em square, so a legend under it would be clipped by the host's own block
|
|
126
|
-
size. Only under show-legend does the host stop being that square: the ring keeps its declared
|
|
127
|
-
size and the key flows beneath it. */
|
|
128
107
|
:host([shape='ring'][show-legend]) {
|
|
129
108
|
block-size: auto;
|
|
130
109
|
}
|
|
@@ -133,7 +112,6 @@ import{css}from"lit";const styles=css`
|
|
|
133
112
|
block-size: var(--lr-size-8em);
|
|
134
113
|
}
|
|
135
114
|
|
|
136
|
-
/* --- ring variant -------------------------------------------------- */
|
|
137
115
|
:host([shape='ring']) svg[part='base'] {
|
|
138
116
|
display: block;
|
|
139
117
|
overflow: visible;
|
|
@@ -145,8 +123,6 @@ import{css}from"lit";const styles=css`
|
|
|
145
123
|
:host([shape='ring']) [part='segment'] {
|
|
146
124
|
fill: none;
|
|
147
125
|
stroke: var(--lr-color-border);
|
|
148
|
-
/* Butt (not round) caps -- round caps on tightly-packed segmented arcs
|
|
149
|
-
bleed past the exact boundary and overlap the next segment's color. */
|
|
150
126
|
stroke-linecap: butt;
|
|
151
127
|
transition:
|
|
152
128
|
stroke-dasharray var(--lr-transition-base),
|