@aceshooting/lyra-ui 19.0.1 → 20.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 +159 -0
- package/custom-elements.json +1 -1
- package/dist/cli/migration-contract.json +1 -1
- package/dist/components/agent-tools/activity-feed/activity-feed.class.d.ts +14 -4
- package/dist/components/agent-tools/activity-feed/activity-feed.styles.js +1 -1
- package/dist/components/agent-tools/approval-queue/approval-queue.class.d.ts +1 -0
- package/dist/components/agent-tools/approval-queue/approval-queue.class.js +4 -3
- package/dist/components/agent-tools/approval-queue/approval-queue.styles.js +1 -1
- package/dist/components/agent-tools/artifact-panel/artifact-panel.class.d.ts +3 -1
- package/dist/components/agent-tools/context-inspector/context-inspector.class.d.ts +1 -0
- package/dist/components/agent-tools/context-inspector/context-inspector.class.js +4 -3
- package/dist/components/agent-tools/context-inspector/context-inspector.styles.js +1 -1
- package/dist/components/agent-tools/eval-dataset/eval-dataset.class.js +1 -1
- package/dist/components/agent-tools/eval-result/eval-result.class.js +1 -1
- package/dist/components/agent-tools/evaluation-run/evaluation-run.class.d.ts +1 -0
- package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +4 -3
- package/dist/components/agent-tools/evaluation-run/evaluation-run.styles.js +1 -1
- package/dist/components/agent-tools/policy-summary/policy-summary.class.d.ts +1 -0
- package/dist/components/agent-tools/policy-summary/policy-summary.class.js +4 -3
- package/dist/components/agent-tools/policy-summary/policy-summary.styles.js +1 -1
- package/dist/components/agent-tools/prompt-studio/prompt-studio.class.js +1 -1
- package/dist/components/agent-tools/schema-viewer/schema-viewer.class.d.ts +10 -1
- package/dist/components/agent-tools/schema-viewer/schema-viewer.class.js +3 -3
- package/dist/components/agent-tools/subagent-panel/subagent-panel.class.js +1 -1
- package/dist/components/agent-tools/thinking-panel/thinking-panel.class.d.ts +6 -3
- package/dist/components/agent-tools/thinking-panel/thinking-panel.styles.js +1 -1
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +14 -3
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +2 -2
- package/dist/components/agent-tools/tool-param-form/tool-param-form.class.d.ts +12 -2
- package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +3 -1
- package/dist/components/charts/chart/box-plot.class.d.ts +15 -3
- package/dist/components/charts/chart/box-plot.class.js +3 -3
- package/dist/components/charts/chart/box-plot.styles.js +1 -1
- package/dist/components/charts/chart/chart.class.d.ts +23 -5
- package/dist/components/charts/chart/chart.class.js +2 -2
- package/dist/components/charts/chart/chart.styles.js +1 -1
- package/dist/components/charts/chart/lite-chart.class.js +1 -1
- package/dist/components/charts/chart/lite-chart.styles.js +1 -1
- package/dist/components/conversation/audio-visualizer/audio-visualizer.class.d.ts +4 -2
- package/dist/components/conversation/audio-visualizer/audio-visualizer.class.js +1 -1
- package/dist/components/conversation/branch-picker/branch-picker.class.d.ts +4 -2
- package/dist/components/conversation/branch-picker/branch-picker.class.js +1 -1
- package/dist/components/conversation/chat-viewport/chat-viewport.class.d.ts +4 -3
- package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
- package/dist/components/conversation/code-block/code-block-core.class.d.ts +6 -11
- package/dist/components/conversation/code-block/code-block-core.class.js +1 -1
- package/dist/components/conversation/code-block/code-block-shared.d.ts +29 -1
- package/dist/components/conversation/code-block/code-block-shared.js +1 -1
- package/dist/components/conversation/code-block/code-block.class.d.ts +6 -11
- package/dist/components/conversation/code-block/code-block.class.js +1 -1
- package/dist/components/conversation/markdown/markdown-shared.js +2 -2
- package/dist/components/conversation/message-actions/message-actions.class.d.ts +4 -2
- package/dist/components/conversation/message-actions/message-actions.class.js +2 -2
- package/dist/components/conversation/message-parts/message-parts.class.d.ts +17 -2
- package/dist/components/conversation/model-select/model-select.class.js +1 -0
- package/dist/components/conversation/model-select/model-select.styles.js +1 -1
- package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +5 -1
- package/dist/components/conversation/prompt-input/prompt-input.class.js +2 -2
- package/dist/components/conversation/prompt-queue/prompt-queue.class.d.ts +6 -1
- package/dist/components/conversation/prompt-queue/prompt-queue.class.js +2 -2
- package/dist/components/conversation/realtime-session/realtime-session.class.d.ts +5 -1
- package/dist/components/conversation/realtime-session/realtime-session.class.js +1 -1
- package/dist/components/conversation/selection-toolbar/selection-toolbar.class.d.ts +5 -1
- package/dist/components/conversation/selection-toolbar/selection-toolbar.class.js +1 -1
- package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +13 -2
- package/dist/components/conversation/voice-picker/voice-picker.class.js +5 -3
- package/dist/components/conversation/voice-picker/voice-picker.styles.js +1 -1
- package/dist/components/data/calendar/calendar.class.d.ts +9 -0
- package/dist/components/data/calendar/calendar.class.js +2 -2
- package/dist/components/data/calendar/calendar.styles.js +1 -1
- package/dist/components/data/condition-builder/condition-builder.class.d.ts +5 -1
- package/dist/components/data/context-meter/context-meter.class.d.ts +4 -0
- package/dist/components/data/context-meter/context-meter.styles.js +1 -1
- package/dist/components/data/data-grid/data-grid.class.d.ts +8 -2
- package/dist/components/data/data-grid/data-grid.class.js +1 -2
- package/dist/components/data/flow-node/flow-node.class.d.ts +7 -4
- package/dist/components/data/flow-node/flow-node.styles.js +1 -1
- package/dist/components/data/funnel/funnel.class.d.ts +5 -0
- package/dist/components/data/funnel/funnel.class.js +4 -3
- package/dist/components/data/funnel/funnel.styles.js +1 -1
- package/dist/components/data/gauge/gauge.class.d.ts +12 -1
- package/dist/components/data/gauge/gauge.styles.js +1 -1
- package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +50 -13
- package/dist/components/data/graph-query-builder/graph-query-builder.class.js +2 -2
- package/dist/components/data/graph-query-builder/graph-query-builder.styles.js +1 -1
- package/dist/components/data/heatmap/heatmap.class.d.ts +27 -9
- package/dist/components/data/heatmap/heatmap.class.js +5 -3
- package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +2 -0
- package/dist/components/data/sequence-strip/sequence-strip.styles.js +1 -1
- package/dist/components/data/table/table.class.d.ts +8 -0
- package/dist/components/data/table/table.class.js +2 -1
- package/dist/components/data/tree/tree.class.d.ts +20 -1
- package/dist/components/data/tree/tree.class.js +1 -1
- package/dist/components/data/word-cloud/word-cloud.class.d.ts +4 -1
- package/dist/components/data/word-cloud/word-cloud.class.js +2 -2
- package/dist/components/forms/button/button.class.js +1 -1
- package/dist/components/forms/checkbox/checkbox.class.d.ts +11 -8
- package/dist/components/forms/checkbox/checkbox.class.js +1 -1
- package/dist/components/forms/checkbox/checkbox.styles.js +1 -1
- package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +2 -2
- package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
- package/dist/components/forms/code-editor/code-editor.class.d.ts +2 -0
- package/dist/components/forms/code-editor/code-editor.class.js +1 -1
- package/dist/components/forms/code-editor/code-editor.styles.js +1 -1
- package/dist/components/forms/color-picker/color-picker.class.d.ts +11 -1
- package/dist/components/forms/color-picker/color-picker.class.js +4 -3
- package/dist/components/forms/combobox/combobox.class.d.ts +67 -18
- package/dist/components/forms/combobox/combobox.class.js +7 -6
- package/dist/components/forms/combobox/combobox.styles.js +1 -1
- package/dist/components/forms/date-picker/date-input.class.d.ts +22 -2
- package/dist/components/forms/date-picker/date-input.class.js +4 -2
- package/dist/components/forms/date-picker/date-input.styles.js +1 -1
- package/dist/components/forms/emoji-picker/emoji-data-loader.d.ts +18 -4
- package/dist/components/forms/emoji-picker/emoji-data-loader.js +1 -1
- package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +18 -4
- package/dist/components/forms/emoji-picker/emoji-picker.class.js +1 -1
- package/dist/components/forms/emoji-picker/emoji-picker.styles.js +1 -1
- package/dist/components/forms/icon-button/icon-button.class.d.ts +1 -1
- package/dist/components/forms/input/time-input.class.d.ts +11 -1
- package/dist/components/forms/input/time-input.class.js +4 -3
- package/dist/components/forms/input/time-input.styles.js +1 -1
- package/dist/components/forms/locale-picker/locale-picker.class.d.ts +17 -3
- package/dist/components/forms/locale-picker/locale-picker.class.js +3 -2
- package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -1
- package/dist/components/forms/otp-input/otp-input.class.d.ts +13 -5
- package/dist/components/forms/otp-input/otp-input.class.js +2 -2
- package/dist/components/forms/otp-input/otp-input.styles.js +1 -1
- package/dist/components/forms/phone-input/phone-input.class.d.ts +10 -3
- package/dist/components/forms/phone-input/phone-input.class.js +6 -2
- package/dist/components/forms/phone-input/phone-input.styles.js +1 -1
- package/dist/components/forms/radio/radio-group.class.d.ts +1 -1
- package/dist/components/forms/radio/radio-group.class.js +2 -2
- package/dist/components/forms/rubric-form/rubric-form.class.d.ts +9 -1
- package/dist/components/forms/rubric-form/rubric-form.class.js +5 -3
- package/dist/components/forms/select/select.class.d.ts +4 -0
- package/dist/components/forms/select/select.styles.js +1 -1
- package/dist/components/forms/slider/slider.class.d.ts +5 -1
- package/dist/components/forms/slider/slider.class.js +3 -3
- package/dist/components/forms/switch/switch.class.d.ts +6 -5
- package/dist/components/forms/switch/switch.class.js +1 -1
- package/dist/components/forms/time-range/time-range.class.d.ts +2 -2
- package/dist/components/forms/token-input/token-input.class.d.ts +13 -3
- package/dist/components/forms/token-input/token-input.class.js +3 -1
- package/dist/components/layout/carousel/carousel.class.d.ts +4 -1
- package/dist/components/layout/carousel/carousel.class.js +1 -1
- package/dist/components/layout/command-palette/command-palette.class.d.ts +8 -2
- package/dist/components/layout/command-palette/command-palette.class.js +1 -1
- package/dist/components/layout/command-palette/command-palette.styles.js +1 -1
- package/dist/components/layout/details/accordion.class.js +1 -1
- package/dist/components/layout/dock-panel/dock-panel.class.d.ts +10 -7
- package/dist/components/layout/dock-panel/dock-panel.class.js +2 -2
- package/dist/components/layout/dock-panel/dock-panel.styles.js +1 -1
- package/dist/components/layout/menu/menu.class.d.ts +13 -3
- package/dist/components/layout/menu/menu.class.js +4 -3
- package/dist/components/layout/menu/menu.styles.js +1 -1
- package/dist/components/layout/page/page.class.d.ts +7 -1
- package/dist/components/layout/reorder-list/reorder-list.class.d.ts +1 -1
- package/dist/components/layout/reorder-list/reorder-list.class.js +1 -1
- package/dist/components/layout/segmented/segmented.class.d.ts +2 -0
- package/dist/components/layout/segmented/segmented.styles.js +1 -1
- package/dist/components/layout/virtual-list/virtual-list.styles.js +1 -1
- package/dist/components/layout/widget/widget.class.d.ts +15 -2
- package/dist/components/layout/widget/widget.class.js +1 -1
- package/dist/components/layout/widget/widget.styles.js +1 -1
- package/dist/components/media/avatar/avatar.class.d.ts +4 -0
- package/dist/components/media/avatar/avatar.styles.js +1 -1
- package/dist/components/media/avatar-group/avatar-group.class.d.ts +8 -1
- package/dist/components/media/avatar-group/avatar-group.styles.js +1 -1
- package/dist/components/media/drop-zone/drop-zone.class.d.ts +10 -4
- package/dist/components/media/drop-zone/drop-zone.class.js +2 -2
- package/dist/components/media/drop-zone/drop-zone.styles.js +1 -1
- package/dist/components/media/flag/flag.class.js +1 -1
- package/dist/components/media/map/map.class.d.ts +19 -5
- package/dist/components/media/map/map.class.js +3 -3
- package/dist/components/media/video-playlist/video-playlist.class.d.ts +6 -3
- package/dist/components/media/video-playlist/video-playlist.class.js +1 -1
- package/dist/components/overlays/callout/callout.class.d.ts +4 -1
- package/dist/components/overlays/dialog/dialog.class.d.ts +4 -1
- package/dist/components/overlays/overlay/overlay.styles.js +1 -1
- package/dist/components/overlays/overlay/popover.class.d.ts +9 -1
- package/dist/components/overlays/overlay/popover.class.js +3 -2
- package/dist/components/overlays/overlay/tooltip.class.d.ts +14 -4
- package/dist/components/overlays/overlay/tooltip.class.js +3 -2
- package/dist/components/overlays/popup/popup.class.d.ts +15 -1
- package/dist/components/overlays/popup/popup.class.js +3 -3
- package/dist/components/overlays/popup/popup.styles.js +1 -1
- package/dist/components/overlays/progress/progress-bar.class.d.ts +2 -0
- package/dist/components/overlays/progress/progress.styles.js +1 -1
- package/dist/components/retrieval/citation-badge/citation-badge.class.d.ts +4 -2
- package/dist/components/retrieval/citation-badge/citation-badge.class.js +1 -1
- package/dist/components/retrieval/claim-evidence/claim-evidence.class.d.ts +4 -0
- package/dist/components/retrieval/claim-evidence/claim-evidence.class.js +4 -3
- package/dist/components/retrieval/claim-evidence/claim-evidence.styles.js +1 -1
- package/dist/components/retrieval/community-card/community-card.class.d.ts +6 -1
- package/dist/components/retrieval/community-card/community-card.styles.js +1 -1
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.d.ts +9 -1
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.js +4 -3
- package/dist/components/retrieval/entity-card/entity-card.styles.js +1 -1
- package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +4 -2
- package/dist/components/retrieval/entity-chip/entity-chip.class.js +1 -1
- package/dist/components/retrieval/entity-dossier/entity-dossier.class.js +2 -2
- package/dist/components/retrieval/graph-legend/graph-legend.class.d.ts +18 -4
- package/dist/components/retrieval/graph-legend/graph-legend.class.js +2 -2
- package/dist/components/retrieval/grounding-summary/grounding-summary.class.d.ts +7 -0
- package/dist/components/retrieval/grounding-summary/grounding-summary.class.js +4 -3
- package/dist/components/retrieval/grounding-summary/grounding-summary.styles.js +1 -1
- package/dist/components/retrieval/memory-panel/memory-panel.class.d.ts +6 -0
- package/dist/components/retrieval/memory-panel/memory-panel.class.js +4 -3
- package/dist/components/retrieval/memory-panel/memory-panel.styles.js +1 -1
- package/dist/components/retrieval/mind-map/mind-map-layout.d.ts +17 -1
- package/dist/components/retrieval/mind-map/mind-map-layout.js +1 -1
- package/dist/components/retrieval/mind-map/mind-map.class.d.ts +8 -1
- package/dist/components/retrieval/mind-map/mind-map.class.js +3 -2
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.d.ts +5 -0
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +6 -5
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.styles.js +1 -1
- package/dist/components/retrieval/retrieval-compare/retrieval-compare.class.js +5 -5
- package/dist/components/retrieval/retrieval-compare/retrieval-compare.styles.js +1 -1
- package/dist/components/retrieval/source-list/source-list.class.d.ts +21 -2
- package/dist/components/retrieval/source-list/source-list.class.js +2 -2
- package/dist/components/retrieval/source-list/source-list.styles.js +1 -1
- package/dist/components/retrieval/source-picker/source-picker.class.d.ts +3 -1
- package/dist/components/retrieval/source-picker/source-picker.class.js +2 -2
- package/dist/components/utility/diff-view/diff-view.class.d.ts +105 -8
- package/dist/components/utility/diff-view/diff-view.class.js +21 -5
- package/dist/components/utility/diff-view/diff-view.styles.js +1 -1
- package/dist/components/utility/export-button/export-button.class.d.ts +26 -2
- package/dist/components/utility/export-button/export-button.class.js +4 -2
- package/dist/components/utility/export-button/export-button.styles.js +1 -1
- package/dist/components/utility/mention-popover/mention-popover.class.d.ts +19 -1
- package/dist/components/utility/mention-popover/mention-popover.class.js +3 -2
- package/dist/components/utility/mention-popover/mention-popover.styles.js +1 -1
- package/dist/components/utility/tour/tour.class.d.ts +1 -3
- package/dist/components/utility/tour/tour.class.js +1 -1
- package/dist/components/viewers/archive-viewer/archive-viewer.class.d.ts +20 -3
- package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
- package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +1 -1
- package/dist/components/viewers/geojson-view/geojson-view.styles.js +1 -1
- package/dist/components/viewers/geojson-view/geojson-viewer.class.d.ts +5 -0
- package/dist/components/viewers/geojson-view/geojson-viewer.class.js +6 -3
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +7 -1
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +1 -1
- package/dist/components/viewers/pptx-viewer/pptx-viewer.class.d.ts +7 -1
- package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +1 -1
- package/dist/components/viewers/xml-viewer/xml-viewer.class.d.ts +5 -0
- package/dist/components/viewers/xml-viewer/xml-viewer.class.js +1 -1
- package/dist/custom-elements-jsx.d.ts +1 -1
- package/dist/events.d.ts +79 -30
- package/dist/internal/accessibility-visibility.js +1 -1
- package/dist/internal/aria-reflection.js +1 -1
- package/dist/internal/catalog-picker.d.ts +14 -3
- package/dist/internal/catalog-picker.js +1 -1
- package/dist/internal/default-strings.generated.d.ts +1 -1
- package/dist/internal/default-strings.generated.js +2 -2
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +2 -2
- package/dist/internal/lyra-element.d.ts +17 -0
- package/dist/internal/lyra-element.js +2 -2
- package/dist/internal/package-metadata.d.ts +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/testing/lyra-tag-event-map.js +1 -1
- package/dist/translations/ar/agent-tools.js +1 -1
- package/dist/translations/ar/data.js +1 -1
- package/dist/translations/ar/retrieval.js +1 -1
- package/dist/translations/ar/shared.js +1 -1
- package/dist/translations/ar/viewers.js +1 -1
- package/dist/translations/de/agent-tools.js +1 -1
- package/dist/translations/de/data.js +1 -1
- package/dist/translations/de/retrieval.js +1 -1
- package/dist/translations/de/shared.js +1 -1
- package/dist/translations/de/viewers.js +1 -1
- package/dist/translations/es/agent-tools.js +1 -1
- package/dist/translations/es/data.js +1 -1
- package/dist/translations/es/retrieval.js +1 -1
- package/dist/translations/es/shared.js +1 -1
- package/dist/translations/es/viewers.js +1 -1
- package/dist/translations/fa/agent-tools.js +1 -1
- package/dist/translations/fa/data.js +1 -1
- package/dist/translations/fa/retrieval.js +1 -1
- package/dist/translations/fa/shared.js +1 -1
- package/dist/translations/fa/viewers.js +1 -1
- package/dist/translations/fr/agent-tools.js +1 -1
- package/dist/translations/fr/data.js +1 -1
- package/dist/translations/fr/retrieval.js +1 -1
- package/dist/translations/fr/shared.js +1 -1
- package/dist/translations/fr/viewers.js +1 -1
- package/dist/translations/he/agent-tools.js +1 -1
- package/dist/translations/he/data.js +1 -1
- package/dist/translations/he/retrieval.js +1 -1
- package/dist/translations/he/shared.js +1 -1
- package/dist/translations/he/viewers.js +1 -1
- package/dist/translations/it/agent-tools.js +1 -1
- package/dist/translations/it/data.js +1 -1
- package/dist/translations/it/retrieval.js +1 -1
- package/dist/translations/it/shared.js +1 -1
- package/dist/translations/it/viewers.js +1 -1
- package/dist/translations/ja/agent-tools.js +1 -1
- package/dist/translations/ja/data.js +1 -1
- package/dist/translations/ja/retrieval.js +1 -1
- package/dist/translations/ja/shared.js +1 -1
- package/dist/translations/ja/viewers.js +1 -1
- package/dist/translations/pt-BR/agent-tools.js +1 -1
- package/dist/translations/pt-BR/data.js +1 -1
- package/dist/translations/pt-BR/retrieval.js +1 -1
- package/dist/translations/pt-BR/shared.js +1 -1
- package/dist/translations/pt-BR/viewers.js +1 -1
- package/dist/translations/ro/agent-tools.js +1 -1
- package/dist/translations/ro/data.js +1 -1
- package/dist/translations/ro/retrieval.js +1 -1
- package/dist/translations/ro/shared.js +1 -1
- package/dist/translations/ro/viewers.js +1 -1
- package/dist/translations/ru/agent-tools.js +1 -1
- package/dist/translations/ru/data.js +1 -1
- package/dist/translations/ru/retrieval.js +1 -1
- package/dist/translations/ru/shared.js +1 -1
- package/dist/translations/ru/viewers.js +1 -1
- package/dist/translations/zh-CN/agent-tools.js +1 -1
- package/dist/translations/zh-CN/data.js +1 -1
- package/dist/translations/zh-CN/retrieval.js +1 -1
- package/dist/translations/zh-CN/shared.js +1 -1
- package/dist/translations/zh-CN/viewers.js +1 -1
- package/dist/vue.d.ts +1 -1
- package/llms/components/lr-activity-feed.md +20 -9
- package/llms/components/lr-approval-queue.md +3 -2
- package/llms/components/lr-archive-viewer.md +8 -1
- package/llms/components/lr-artifact-panel.md +3 -1
- package/llms/components/lr-audio-visualizer.md +3 -1
- package/llms/components/lr-avatar-group.md +13 -6
- package/llms/components/lr-avatar.md +6 -2
- package/llms/components/lr-bar-chart.md +6 -3
- package/llms/components/lr-box-plot.md +6 -2
- package/llms/components/lr-branch-picker.md +3 -1
- package/llms/components/lr-bubble-chart.md +6 -3
- package/llms/components/lr-calendar.md +10 -3
- package/llms/components/lr-carousel.md +4 -2
- package/llms/components/lr-chart.md +12 -4
- package/llms/components/lr-chat-viewport.md +3 -2
- package/llms/components/lr-checkbox.md +8 -5
- package/llms/components/lr-citation-badge.md +2 -0
- package/llms/components/lr-claim-evidence.md +6 -2
- package/llms/components/lr-code-editor.md +3 -1
- package/llms/components/lr-color-picker.md +20 -8
- package/llms/components/lr-combobox.md +26 -3
- package/llms/components/lr-command-palette.md +6 -3
- package/llms/components/lr-community-card.md +7 -4
- package/llms/components/lr-context-inspector.md +3 -2
- package/llms/components/lr-context-meter.md +13 -5
- package/llms/components/lr-data-grid.md +2 -0
- package/llms/components/lr-date-input.md +12 -3
- package/llms/components/lr-date-picker.md +11 -2
- package/llms/components/lr-diff-view.md +46 -5
- package/llms/components/lr-doughnut-chart.md +6 -3
- package/llms/components/lr-drop-zone.md +7 -3
- package/llms/components/lr-embedding-explorer.md +8 -2
- package/llms/components/lr-emoji-picker.md +5 -1
- package/llms/components/lr-entity-chip.md +2 -0
- package/llms/components/lr-eval-run.md +3 -2
- package/llms/components/lr-export-button.md +5 -2
- package/llms/components/lr-flow-node.md +7 -4
- package/llms/components/lr-funnel.md +7 -2
- package/llms/components/lr-gauge.md +7 -2
- package/llms/components/lr-geojson-view.md +10 -2
- package/llms/components/lr-geojson-viewer.md +10 -2
- package/llms/components/lr-graph-legend.md +6 -3
- package/llms/components/lr-graph-query-builder.md +21 -11
- package/llms/components/lr-grounding-summary.md +8 -2
- package/llms/components/lr-heatmap.md +5 -2
- package/llms/components/lr-histogram.md +4 -2
- package/llms/components/lr-json-schema-viewer.md +7 -5
- package/llms/components/lr-line-chart.md +6 -3
- package/llms/components/lr-locale-picker.md +4 -1
- package/llms/components/lr-map.md +5 -3
- package/llms/components/lr-memory-panel.md +6 -2
- package/llms/components/lr-mention-popover.md +7 -4
- package/llms/components/lr-message-actions.md +3 -1
- package/llms/components/lr-message-parts.md +8 -2
- package/llms/components/lr-mind-map.md +11 -2
- package/llms/components/lr-option.md +25 -2
- package/llms/components/lr-otp-input.md +3 -1
- package/llms/components/lr-phone-input.md +9 -5
- package/llms/components/lr-pie-chart.md +6 -3
- package/llms/components/lr-polar-area-chart.md +6 -3
- package/llms/components/lr-policy-summary.md +3 -2
- package/llms/components/lr-progress-bar.md +4 -1
- package/llms/components/lr-prompt-input.md +4 -1
- package/llms/components/lr-prompt-queue.md +5 -2
- package/llms/components/lr-radar-chart.md +6 -3
- package/llms/components/lr-rag-eval-dashboard.md +7 -2
- package/llms/components/lr-realtime-session.md +3 -1
- package/llms/components/lr-rubric-form.md +6 -1
- package/llms/components/lr-scatter-chart.md +6 -3
- package/llms/components/lr-segmented.md +3 -1
- package/llms/components/lr-select.md +7 -1
- package/llms/components/lr-selection-toolbar.md +4 -1
- package/llms/components/lr-sequence-strip.md +7 -3
- package/llms/components/lr-source-card.md +16 -1
- package/llms/components/lr-source-list.md +17 -2
- package/llms/components/lr-source-picker.md +3 -1
- package/llms/components/lr-subagent-panel.md +6 -3
- package/llms/components/lr-switch.md +4 -3
- package/llms/components/lr-table.md +6 -1
- package/llms/components/lr-thinking-panel.md +8 -5
- package/llms/components/lr-token-input.md +15 -1
- package/llms/components/lr-tool-call-chip.md +2 -0
- package/llms/components/lr-tool-param-form.md +15 -4
- package/llms/components/lr-tooltip.md +8 -4
- package/llms/components/lr-trace-tree.md +7 -4
- package/llms/components/lr-video-playlist.md +7 -5
- package/llms/components/lr-voice-picker.md +7 -4
- package/llms/components/lr-widget.md +15 -2
- package/llms/migration.md +4 -4
- package/llms-full.txt +552 -159
- package/package.json +11 -9
- package/registrations.json +1 -1
- package/vscode-css-data.json +1 -1
- package/vscode-html-data.json +1 -1
- package/web-types.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
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,nothing}from"lit";import{property}from"lit/decorators.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteCount}from"../../../internal/numbers.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import"../../overlays/badge/badge.class.js";import"../../overlays/empty/empty.class.js";import{styles}from"./schema-viewer.styles.js";import{overallSemanticLabel}from"../semantic-owner.js";import{LYRA_DEFAULT_schemaViewerCircular,LYRA_DEFAULT_schemaViewerEmpty,LYRA_DEFAULT_schemaViewerIssueLimit,LYRA_DEFAULT_schemaViewerLabel,LYRA_DEFAULT_schemaViewerLimit,LYRA_DEFAULT_schemaViewerRequired,LYRA_DEFAULT_schemaViewerType}from"../../../internal/default-strings.generated.js";const MAX_RENDERED_SCHEMA_NODES=500,MAX_RENDERED_SCHEMA_ISSUES=500,MAX_SCHEMA_DEPTH=100,MAX_CONSTRAINT_VALUES=50,MAX_CONSTRAINT_VALUE_CHARACTERS=1e3,MAX_CONSTRAINT_OBJECT_NODES=50;function constraintValue(value){const seen=new Set;let remaining=MAX_CONSTRAINT_OBJECT_NODES;const visit=(candidate,depth)=>{if(remaining--<=0)return"…";if(candidate===null)return"null";if(typeof candidate=="string")return JSON.stringify(candidate.slice(0,MAX_CONSTRAINT_VALUE_CHARACTERS));if(typeof candidate=="number"||typeof candidate=="boolean")return String(candidate);if(typeof candidate=="bigint")return`${candidate.toString()}n`;if(candidate===void 0)return"undefined";if(typeof candidate!="object")return String(candidate);if(seen.has(candidate))return"[Circular]";if(depth>=3)return Array.isArray(candidate)?"[…]":"{…}";seen.add(candidate);let result;if(Array.isArray(candidate)){const values=candidate.slice(0,MAX_CONSTRAINT_VALUES).map(item=>visit(item,depth+1));result=`[${values.join(", ")}${candidate.length>values.length?", …":""}]`}else{const entries=Object.entries(candidate).slice(0,MAX_CONSTRAINT_VALUES);result=`{${entries.map(([key,item])=>`${JSON.stringify(key)}: ${visit(item,depth+1)}`).join(", ")}${Object.keys(candidate).length>entries.length?", …":""}}`}return seen.delete(candidate),result.slice(0,MAX_CONSTRAINT_VALUE_CHARACTERS)};return visit(value,0)}function isReadonlyArray(value){return Array.isArray(value)}const SCHEMA_SNAPSHOT_NODE_LIMIT=5e4,SCHEMA_SNAPSHOT_INSPECTION_LIMIT=SCHEMA_SNAPSHOT_NODE_LIMIT*4,SCHEMA_SNAPSHOT_ARRAY_LENGTH_LIMIT=SCHEMA_SNAPSHOT_NODE_LIMIT,MAX_ARRAY_LENGTH=4294967295,OMIT_SCHEMA_VALUE=Symbol("omit-schema-value"),NODE_LIMIT_SCHEMA_VALUE=Symbol("schema-node-limit"),DEPTH_LIMIT_SCHEMA_VALUE=Symbol("schema-depth-limit"),FUNCTION_TO_STRING=Function.prototype.toString,OBJECT_CONSTRUCTOR_SOURCE=FUNCTION_TO_STRING.call(Object),MISSING_SCHEMA_DESCRIPTOR=Symbol("missing-schema-descriptor"),ACCESSOR_SCHEMA_DESCRIPTOR=Symbol("accessor-schema-descriptor"),UNSAFE_SCHEMA_DESCRIPTOR=Symbol("unsafe-schema-descriptor");function isSchemaSnapshotFailure(value){return value===OMIT_SCHEMA_VALUE||value===NODE_LIMIT_SCHEMA_VALUE||value===DEPTH_LIMIT_SCHEMA_VALUE}function isPlainSchemaRecord(value){try{const prototype=Object.getPrototypeOf(value);if(prototype===null)return!0;if(Object.getPrototypeOf(prototype)!==null)return!1;const constructorDescriptor=Object.getOwnPropertyDescriptor(prototype,"constructor");if(!constructorDescriptor||!("value"in constructorDescriptor)||typeof constructorDescriptor.value!="function")return!1;const constructor=constructorDescriptor.value,constructorPrototype=Object.getOwnPropertyDescriptor(constructor,"prototype");return!!(constructorPrototype&&"value"in constructorPrototype&&constructorPrototype.value===prototype&&FUNCTION_TO_STRING.call(constructor)===OBJECT_CONSTRUCTOR_SOURCE)}catch{return!1}}function isSchemaArray(value){try{return Array.isArray(value)}catch{return!1}}function isArrayIndex(key){const index=Number(key);return Number.isInteger(index)&&index>=0&&index<MAX_ARRAY_LENGTH&&String(index)===key}function checkpointSchemaSnapshot(budget){return{remaining:budget.remaining,additions:budget.additions.length}}function restoreSchemaSnapshot(budget,checkpoint){for(budget.remaining=checkpoint.remaining;budget.additions.length>checkpoint.additions;){const source=budget.additions.pop();source&&budget.seen.delete(source)}}function rememberSchemaSnapshot(budget,source,output){budget.seen.set(source,output),budget.additions.push(source)}function ownEnumerableDataDescriptor(value,key){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,key)}catch{return UNSAFE_SCHEMA_DESCRIPTOR}return!descriptor||!descriptor.enumerable?MISSING_SCHEMA_DESCRIPTOR:"value"in descriptor?descriptor:ACCESSOR_SCHEMA_DESCRIPTOR}function safeArrayLength(value){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,"length")}catch{return UNSAFE_SCHEMA_DESCRIPTOR}return!descriptor||!("value"in descriptor)||typeof descriptor.value!="number"||!Number.isSafeInteger(descriptor.value)||descriptor.value<0||descriptor.value>MAX_ARRAY_LENGTH?UNSAFE_SCHEMA_DESCRIPTOR:descriptor.value}function consumeSchemaInspection(budget){return budget.remainingInspections<=0?!1:(budget.remainingInspections-=1,!0)}function defineSnapshotValue(output,key,value){Object.defineProperty(output,key,{configurable:!1,enumerable:!0,value,writable:!1})}function finishSchemaSnapshot(output){try{return Object.freeze(output)}catch{return OMIT_SCHEMA_VALUE}}function snapshotSchemaValue(value,budget,depth){return value===null||typeof value!="object"&&typeof value!="function"?value:typeof value=="function"?OMIT_SCHEMA_VALUE:budget.seen.has(value)?budget.seen.get(value):depth>MAX_SCHEMA_DEPTH?DEPTH_LIMIT_SCHEMA_VALUE:budget.remaining<=0?NODE_LIMIT_SCHEMA_VALUE:isSchemaArray(value)?snapshotSchemaValueArray(value,budget,depth):isPlainSchemaRecord(value)?snapshotSchemaValueRecord(value,budget,depth):OMIT_SCHEMA_VALUE}function snapshotSchemaValueRecord(value,budget,depth){const checkpoint=checkpointSchemaSnapshot(budget);if(budget.remaining<=0)return NODE_LIMIT_SCHEMA_VALUE;budget.remaining-=1;const output=Object.create(null);rememberSchemaSnapshot(budget,value,output);try{for(const key in value){if(!consumeSchemaInspection(budget))break;const descriptor=ownEnumerableDataDescriptor(value,key);if(descriptor===MISSING_SCHEMA_DESCRIPTOR||descriptor===ACCESSOR_SCHEMA_DESCRIPTOR)continue;if(descriptor===UNSAFE_SCHEMA_DESCRIPTOR)return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE;const entryCheckpoint=checkpointSchemaSnapshot(budget),entry=snapshotSchemaValue(descriptor.value,budget,depth+1);if(entry===OMIT_SCHEMA_VALUE){restoreSchemaSnapshot(budget,entryCheckpoint);continue}if(entry!==DEPTH_LIMIT_SCHEMA_VALUE){if(entry===NODE_LIMIT_SCHEMA_VALUE)break;defineSnapshotValue(output,key,entry)}}}catch{return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE}const frozen=finishSchemaSnapshot(output);return frozen===OMIT_SCHEMA_VALUE?(restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE):frozen}function snapshotSchemaValueArray(value,budget,depth){const checkpoint=checkpointSchemaSnapshot(budget);if(budget.remaining<=0)return NODE_LIMIT_SCHEMA_VALUE;budget.remaining-=1;const sourceLength=safeArrayLength(value);if(sourceLength===UNSAFE_SCHEMA_DESCRIPTOR)return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE;const output=new Array(Math.min(sourceLength,SCHEMA_SNAPSHOT_ARRAY_LENGTH_LIMIT));rememberSchemaSnapshot(budget,value,output);try{for(const key in value){if(!consumeSchemaInspection(budget))break;const index=isArrayIndex(key)?Number(key):null;if(index!==null&&index>=output.length)continue;const descriptor=ownEnumerableDataDescriptor(value,key);if(descriptor===MISSING_SCHEMA_DESCRIPTOR||descriptor===ACCESSOR_SCHEMA_DESCRIPTOR)continue;if(descriptor===UNSAFE_SCHEMA_DESCRIPTOR)return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE;const entryCheckpoint=checkpointSchemaSnapshot(budget),entry=snapshotSchemaValue(descriptor.value,budget,depth+1);if(entry===OMIT_SCHEMA_VALUE){restoreSchemaSnapshot(budget,entryCheckpoint);continue}if(entry!==DEPTH_LIMIT_SCHEMA_VALUE){if(entry===NODE_LIMIT_SCHEMA_VALUE){index!==null&&(output.length=index);break}defineSnapshotValue(output,key,entry)}}}catch{return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE}const frozen=finishSchemaSnapshot(output);return frozen===OMIT_SCHEMA_VALUE?(restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE):frozen}function snapshotSchemaNode(value,depth,budget){if(value===null||typeof value!="object"||!isPlainSchemaRecord(value))return OMIT_SCHEMA_VALUE;if(budget.seen.has(value))return budget.seen.get(value);if(depth>MAX_SCHEMA_DEPTH)return DEPTH_LIMIT_SCHEMA_VALUE;if(budget.remaining<=0)return NODE_LIMIT_SCHEMA_VALUE;const checkpoint=checkpointSchemaSnapshot(budget);budget.remaining-=1;const output=Object.create(null);rememberSchemaSnapshot(budget,value,output);try{for(const key in value){if(!consumeSchemaInspection(budget))break;const descriptor=ownEnumerableDataDescriptor(value,key);if(descriptor===MISSING_SCHEMA_DESCRIPTOR||descriptor===ACCESSOR_SCHEMA_DESCRIPTOR)continue;if(descriptor===UNSAFE_SCHEMA_DESCRIPTOR)return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE;const entryCheckpoint=checkpointSchemaSnapshot(budget),entry=snapshotSchemaNodeField(key,descriptor.value,budget,depth);if(entry===OMIT_SCHEMA_VALUE){restoreSchemaSnapshot(budget,entryCheckpoint);continue}if(entry!==DEPTH_LIMIT_SCHEMA_VALUE){if(entry===NODE_LIMIT_SCHEMA_VALUE)break;defineSnapshotValue(output,key,entry)}}}catch{return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE}const frozen=finishSchemaSnapshot(output);return frozen===OMIT_SCHEMA_VALUE?(restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE):frozen}function snapshotSchemaNodeField(key,value,budget,depth){return depth>=MAX_SCHEMA_DEPTH&&(key==="properties"||key==="items"||key==="allOf"||key==="anyOf"||key==="oneOf")?DEPTH_LIMIT_SCHEMA_VALUE:key==="properties"?snapshotSchemaNodeMap(value,depth+1,budget):key==="allOf"||key==="anyOf"||key==="oneOf"?snapshotSchemaNodeArray(value,depth+1,budget):key==="items"?value!==null&&typeof value=="object"&&isSchemaArray(value)?snapshotSchemaNodeArray(value,depth+1,budget):snapshotSchemaNode(value,depth+1,budget):snapshotSchemaValue(value,budget,depth+1)}function snapshotSchemaNodeMap(value,depth,budget){if(value===null||typeof value!="object"||!isPlainSchemaRecord(value))return OMIT_SCHEMA_VALUE;if(budget.seen.has(value))return budget.seen.get(value);const checkpoint=checkpointSchemaSnapshot(budget),output=Object.create(null);rememberSchemaSnapshot(budget,value,output);try{for(const key in value){if(!consumeSchemaInspection(budget))break;const descriptor=ownEnumerableDataDescriptor(value,key);if(descriptor===MISSING_SCHEMA_DESCRIPTOR||descriptor===ACCESSOR_SCHEMA_DESCRIPTOR)continue;if(descriptor===UNSAFE_SCHEMA_DESCRIPTOR)return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE;const entryCheckpoint=checkpointSchemaSnapshot(budget),entry=snapshotSchemaNode(descriptor.value,depth,budget);if(entry===OMIT_SCHEMA_VALUE){restoreSchemaSnapshot(budget,entryCheckpoint);continue}if(entry!==DEPTH_LIMIT_SCHEMA_VALUE){if(entry===NODE_LIMIT_SCHEMA_VALUE)break;defineSnapshotValue(output,key,entry)}}}catch{return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE}const frozen=finishSchemaSnapshot(output);return frozen===OMIT_SCHEMA_VALUE?(restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE):frozen}function snapshotSchemaNodeArray(value,depth,budget){if(value===null||typeof value!="object"||!isSchemaArray(value))return OMIT_SCHEMA_VALUE;if(budget.seen.has(value))return budget.seen.get(value);const checkpoint=checkpointSchemaSnapshot(budget),sourceLength=safeArrayLength(value);if(sourceLength===UNSAFE_SCHEMA_DESCRIPTOR)return OMIT_SCHEMA_VALUE;const output=new Array(Math.min(sourceLength,SCHEMA_SNAPSHOT_ARRAY_LENGTH_LIMIT));rememberSchemaSnapshot(budget,value,output);try{for(const key in value){if(!consumeSchemaInspection(budget))break;const index=isArrayIndex(key)?Number(key):null;if(index!==null&&index>=output.length)continue;const descriptor=ownEnumerableDataDescriptor(value,key);if(descriptor===MISSING_SCHEMA_DESCRIPTOR||descriptor===ACCESSOR_SCHEMA_DESCRIPTOR)continue;if(descriptor===UNSAFE_SCHEMA_DESCRIPTOR)return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE;const entryCheckpoint=checkpointSchemaSnapshot(budget),entry=index!==null?snapshotSchemaNode(descriptor.value,depth,budget):snapshotSchemaValue(descriptor.value,budget,depth);if(entry===OMIT_SCHEMA_VALUE){restoreSchemaSnapshot(budget,entryCheckpoint);continue}if(entry!==DEPTH_LIMIT_SCHEMA_VALUE){if(entry===NODE_LIMIT_SCHEMA_VALUE){index!==null&&(output.length=index);break}defineSnapshotValue(output,key,entry)}}}catch{return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE}const frozen=finishSchemaSnapshot(output);return frozen===OMIT_SCHEMA_VALUE?(restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE):frozen}function snapshotSchema(value){const snapshot=snapshotSchemaNode(value,0,{remaining:SCHEMA_SNAPSHOT_NODE_LIMIT,remainingInspections:SCHEMA_SNAPSHOT_INSPECTION_LIMIT,seen:new Map,additions:[]});return isSchemaSnapshotFailure(snapshot)?null:snapshot}class LyraJsonSchemaViewer extends LyraElement{constructor(){super(...arguments),this.schemaValue=null,this.issues=[],this.selectedPath=null,this.maxDepth=20,this.label="",this.previousNodeLimitText="",this.previousIssueLimitText="",this.suppressNextLimitAnnouncement=!0}static{this.defaultStrings={...super.defaultStrings,schemaViewerCircular:LYRA_DEFAULT_schemaViewerCircular,schemaViewerEmpty:LYRA_DEFAULT_schemaViewerEmpty,schemaViewerIssueLimit:LYRA_DEFAULT_schemaViewerIssueLimit,schemaViewerLabel:LYRA_DEFAULT_schemaViewerLabel,schemaViewerLimit:LYRA_DEFAULT_schemaViewerLimit,schemaViewerRequired:LYRA_DEFAULT_schemaViewerRequired,schemaViewerType:LYRA_DEFAULT_schemaViewerType}}static{this.ownedCollectionProperties=Object.freeze(["issues"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-schema-select"])}get schema(){return this.schemaValue}set schema(value){const previous=this.schemaValue;this.schemaValue=snapshotSchema(value),this.requestUpdate("schema",previous)}syncAnnouncementSink(){this.isConnected&&this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.announcementSink?.release(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink(),this.hasUpdated&&(this.suppressNextLimitAnnouncement=!0,this.requestUpdate())}disconnectedCallback(){super.disconnectedCallback(),this.announcementSink?.release(),this.announcementSink=void 0,this.suppressNextLimitAnnouncement=!0}updated(_changed){super.updated(_changed);const nodeText=this.renderRoot.querySelector('[part="limit"]')?.textContent?.trim()??"",issueText=this.renderRoot.querySelector('[part="issue-limit"]')?.textContent?.trim()??"";this.suppressNextLimitAnnouncement||(nodeText&&nodeText!==this.previousNodeLimitText&&this.announcementSink?.announce(nodeText),issueText&&issueText!==this.previousIssueLimitText&&this.announcementSink?.announce(issueText)),this.previousNodeLimitText=nodeText,this.previousIssueLimitText=issueText,this.suppressNextLimitAnnouncement=!1}pointerSegment(value){return value.replace(/~/g,"~0").replace(/\//g,"~1")}constraints(schema){const rows=["format","pattern","minimum","maximum","minLength","maxLength","minItems","maxItems","minProperties","maxProperties"].flatMap(key=>schema[key]==null?[]:[`${key}: ${constraintValue(schema[key])}`]);if(schema.enum){const values=schema.enum.slice(0,MAX_CONSTRAINT_VALUES).map(constraintValue);rows.push(`enum: [${values.join(", ")}${schema.enum.length>values.length?", …":""}]`)}if(Object.prototype.hasOwnProperty.call(schema,"const")&&rows.push(`const: ${constraintValue(schema.const)}`),Object.prototype.hasOwnProperty.call(schema,"default")&&rows.push(`default: ${constraintValue(schema.default)}`),schema.examples){const examples=schema.examples.slice(0,MAX_CONSTRAINT_VALUES).map(constraintValue);rows.push(`examples: [${examples.join(", ")}${schema.examples.length>examples.length?", …":""}]`)}return schema.$ref&&rows.push(`$ref: ${schema.$ref.slice(0,MAX_CONSTRAINT_VALUE_CHARACTERS)}`),rows}renderNode(name,schema,path,required,depth,ancestors,budget,issuesByPath){if(budget.remaining<=0)return budget.truncated=!0,nothing;budget.remaining--;const selected=path===this.selectedPath;if(ancestors.has(schema))return html`<li part="node">
|
|
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,nothing}from"lit";import{property}from"lit/decorators.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteCount}from"../../../internal/numbers.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import"../../overlays/badge/badge.class.js";import"../../overlays/empty/empty.class.js";import{styles}from"./schema-viewer.styles.js";import{overallSemanticLabel}from"../semantic-owner.js";import{LYRA_DEFAULT_schemaViewerCircular,LYRA_DEFAULT_schemaViewerEmpty,LYRA_DEFAULT_schemaViewerIssueLimit,LYRA_DEFAULT_schemaViewerLabel,LYRA_DEFAULT_schemaViewerLimit,LYRA_DEFAULT_schemaViewerRequired,LYRA_DEFAULT_schemaViewerType}from"../../../internal/default-strings.generated.js";const MAX_RENDERED_SCHEMA_NODES=500,MAX_RENDERED_SCHEMA_ISSUES=500,MAX_SCHEMA_DEPTH=100,MAX_CONSTRAINT_VALUES=50,MAX_CONSTRAINT_VALUE_CHARACTERS=1e3,MAX_CONSTRAINT_OBJECT_NODES=50;function constraintValue(value){const seen=new Set;let remaining=MAX_CONSTRAINT_OBJECT_NODES;const visit=(candidate,depth)=>{if(remaining--<=0)return"…";if(candidate===null)return"null";if(typeof candidate=="string")return JSON.stringify(candidate.slice(0,MAX_CONSTRAINT_VALUE_CHARACTERS));if(typeof candidate=="number"||typeof candidate=="boolean")return String(candidate);if(typeof candidate=="bigint")return`${candidate.toString()}n`;if(candidate===void 0)return"undefined";if(typeof candidate!="object")return String(candidate);if(seen.has(candidate))return"[Circular]";if(depth>=3)return Array.isArray(candidate)?"[…]":"{…}";seen.add(candidate);let result;if(Array.isArray(candidate)){const values=candidate.slice(0,MAX_CONSTRAINT_VALUES).map(item=>visit(item,depth+1));result=`[${values.join(", ")}${candidate.length>values.length?", …":""}]`}else{const entries=Object.entries(candidate).slice(0,MAX_CONSTRAINT_VALUES);result=`{${entries.map(([key,item])=>`${JSON.stringify(key)}: ${visit(item,depth+1)}`).join(", ")}${Object.keys(candidate).length>entries.length?", …":""}}`}return seen.delete(candidate),result.slice(0,MAX_CONSTRAINT_VALUE_CHARACTERS)};return visit(value,0)}function isReadonlyArray(value){return Array.isArray(value)}const SCHEMA_SNAPSHOT_NODE_LIMIT=5e4,SCHEMA_SNAPSHOT_INSPECTION_LIMIT=SCHEMA_SNAPSHOT_NODE_LIMIT*4,SCHEMA_SNAPSHOT_ARRAY_LENGTH_LIMIT=SCHEMA_SNAPSHOT_NODE_LIMIT,MAX_ARRAY_LENGTH=4294967295,OMIT_SCHEMA_VALUE=Symbol("omit-schema-value"),NODE_LIMIT_SCHEMA_VALUE=Symbol("schema-node-limit"),DEPTH_LIMIT_SCHEMA_VALUE=Symbol("schema-depth-limit"),FUNCTION_TO_STRING=Function.prototype.toString,OBJECT_CONSTRUCTOR_SOURCE=FUNCTION_TO_STRING.call(Object),MISSING_SCHEMA_DESCRIPTOR=Symbol("missing-schema-descriptor"),ACCESSOR_SCHEMA_DESCRIPTOR=Symbol("accessor-schema-descriptor"),UNSAFE_SCHEMA_DESCRIPTOR=Symbol("unsafe-schema-descriptor");function isSchemaSnapshotFailure(value){return value===OMIT_SCHEMA_VALUE||value===NODE_LIMIT_SCHEMA_VALUE||value===DEPTH_LIMIT_SCHEMA_VALUE}function isPlainSchemaRecord(value){try{const prototype=Object.getPrototypeOf(value);if(prototype===null)return!0;if(Object.getPrototypeOf(prototype)!==null)return!1;const constructorDescriptor=Object.getOwnPropertyDescriptor(prototype,"constructor");if(!constructorDescriptor||!("value"in constructorDescriptor)||typeof constructorDescriptor.value!="function")return!1;const constructor=constructorDescriptor.value,constructorPrototype=Object.getOwnPropertyDescriptor(constructor,"prototype");return!!(constructorPrototype&&"value"in constructorPrototype&&constructorPrototype.value===prototype&&FUNCTION_TO_STRING.call(constructor)===OBJECT_CONSTRUCTOR_SOURCE)}catch{return!1}}function isSchemaArray(value){try{return Array.isArray(value)}catch{return!1}}function isArrayIndex(key){const index=Number(key);return Number.isInteger(index)&&index>=0&&index<MAX_ARRAY_LENGTH&&String(index)===key}function checkpointSchemaSnapshot(budget){return{remaining:budget.remaining,additions:budget.additions.length}}function restoreSchemaSnapshot(budget,checkpoint){for(budget.remaining=checkpoint.remaining;budget.additions.length>checkpoint.additions;){const source=budget.additions.pop();source&&budget.seen.delete(source)}}function rememberSchemaSnapshot(budget,source,output){budget.seen.set(source,output),budget.additions.push(source)}function ownEnumerableDataDescriptor(value,key){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,key)}catch{return UNSAFE_SCHEMA_DESCRIPTOR}return!descriptor||!descriptor.enumerable?MISSING_SCHEMA_DESCRIPTOR:"value"in descriptor?descriptor:ACCESSOR_SCHEMA_DESCRIPTOR}function safeArrayLength(value){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,"length")}catch{return UNSAFE_SCHEMA_DESCRIPTOR}return!descriptor||!("value"in descriptor)||typeof descriptor.value!="number"||!Number.isSafeInteger(descriptor.value)||descriptor.value<0||descriptor.value>MAX_ARRAY_LENGTH?UNSAFE_SCHEMA_DESCRIPTOR:descriptor.value}function consumeSchemaInspection(budget){return budget.remainingInspections<=0?!1:(budget.remainingInspections-=1,!0)}function defineSnapshotValue(output,key,value){Object.defineProperty(output,key,{configurable:!1,enumerable:!0,value,writable:!1})}function finishSchemaSnapshot(output){try{return Object.freeze(output)}catch{return OMIT_SCHEMA_VALUE}}function snapshotSchemaValue(value,budget,depth){return value===null||typeof value!="object"&&typeof value!="function"?value:typeof value=="function"?OMIT_SCHEMA_VALUE:budget.seen.has(value)?budget.seen.get(value):depth>MAX_SCHEMA_DEPTH?DEPTH_LIMIT_SCHEMA_VALUE:budget.remaining<=0?NODE_LIMIT_SCHEMA_VALUE:isSchemaArray(value)?snapshotSchemaValueArray(value,budget,depth):isPlainSchemaRecord(value)?snapshotSchemaValueRecord(value,budget,depth):OMIT_SCHEMA_VALUE}function snapshotSchemaValueRecord(value,budget,depth){const checkpoint=checkpointSchemaSnapshot(budget);if(budget.remaining<=0)return NODE_LIMIT_SCHEMA_VALUE;budget.remaining-=1;const output=Object.create(null);rememberSchemaSnapshot(budget,value,output);try{for(const key in value){if(!consumeSchemaInspection(budget))break;const descriptor=ownEnumerableDataDescriptor(value,key);if(descriptor===MISSING_SCHEMA_DESCRIPTOR||descriptor===ACCESSOR_SCHEMA_DESCRIPTOR)continue;if(descriptor===UNSAFE_SCHEMA_DESCRIPTOR)return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE;const entryCheckpoint=checkpointSchemaSnapshot(budget),entry=snapshotSchemaValue(descriptor.value,budget,depth+1);if(entry===OMIT_SCHEMA_VALUE){restoreSchemaSnapshot(budget,entryCheckpoint);continue}if(entry!==DEPTH_LIMIT_SCHEMA_VALUE){if(entry===NODE_LIMIT_SCHEMA_VALUE)break;defineSnapshotValue(output,key,entry)}}}catch{return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE}const frozen=finishSchemaSnapshot(output);return frozen===OMIT_SCHEMA_VALUE?(restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE):frozen}function snapshotSchemaValueArray(value,budget,depth){const checkpoint=checkpointSchemaSnapshot(budget);if(budget.remaining<=0)return NODE_LIMIT_SCHEMA_VALUE;budget.remaining-=1;const sourceLength=safeArrayLength(value);if(sourceLength===UNSAFE_SCHEMA_DESCRIPTOR)return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE;const output=new Array(Math.min(sourceLength,SCHEMA_SNAPSHOT_ARRAY_LENGTH_LIMIT));rememberSchemaSnapshot(budget,value,output);try{for(const key in value){if(!consumeSchemaInspection(budget))break;const index=isArrayIndex(key)?Number(key):null;if(index!==null&&index>=output.length)continue;const descriptor=ownEnumerableDataDescriptor(value,key);if(descriptor===MISSING_SCHEMA_DESCRIPTOR||descriptor===ACCESSOR_SCHEMA_DESCRIPTOR)continue;if(descriptor===UNSAFE_SCHEMA_DESCRIPTOR)return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE;const entryCheckpoint=checkpointSchemaSnapshot(budget),entry=snapshotSchemaValue(descriptor.value,budget,depth+1);if(entry===OMIT_SCHEMA_VALUE){restoreSchemaSnapshot(budget,entryCheckpoint);continue}if(entry!==DEPTH_LIMIT_SCHEMA_VALUE){if(entry===NODE_LIMIT_SCHEMA_VALUE){index!==null&&(output.length=index);break}defineSnapshotValue(output,key,entry)}}}catch{return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE}const frozen=finishSchemaSnapshot(output);return frozen===OMIT_SCHEMA_VALUE?(restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE):frozen}function snapshotSchemaNode(value,depth,budget){if(value===null||typeof value!="object"||!isPlainSchemaRecord(value))return OMIT_SCHEMA_VALUE;if(budget.seen.has(value))return budget.seen.get(value);if(depth>MAX_SCHEMA_DEPTH)return DEPTH_LIMIT_SCHEMA_VALUE;if(budget.remaining<=0)return NODE_LIMIT_SCHEMA_VALUE;const checkpoint=checkpointSchemaSnapshot(budget);budget.remaining-=1;const output=Object.create(null);rememberSchemaSnapshot(budget,value,output);try{for(const key in value){if(!consumeSchemaInspection(budget))break;const descriptor=ownEnumerableDataDescriptor(value,key);if(descriptor===MISSING_SCHEMA_DESCRIPTOR||descriptor===ACCESSOR_SCHEMA_DESCRIPTOR)continue;if(descriptor===UNSAFE_SCHEMA_DESCRIPTOR)return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE;const entryCheckpoint=checkpointSchemaSnapshot(budget),entry=snapshotSchemaNodeField(key,descriptor.value,budget,depth);if(entry===OMIT_SCHEMA_VALUE){restoreSchemaSnapshot(budget,entryCheckpoint);continue}if(entry!==DEPTH_LIMIT_SCHEMA_VALUE){if(entry===NODE_LIMIT_SCHEMA_VALUE)break;defineSnapshotValue(output,key,entry)}}}catch{return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE}const frozen=finishSchemaSnapshot(output);return frozen===OMIT_SCHEMA_VALUE?(restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE):frozen}function snapshotSchemaNodeField(key,value,budget,depth){return depth>=MAX_SCHEMA_DEPTH&&(key==="properties"||key==="items"||key==="allOf"||key==="anyOf"||key==="oneOf")?DEPTH_LIMIT_SCHEMA_VALUE:key==="properties"?snapshotSchemaNodeMap(value,depth+1,budget):key==="allOf"||key==="anyOf"||key==="oneOf"?snapshotSchemaNodeArray(value,depth+1,budget):key==="items"?value!==null&&typeof value=="object"&&isSchemaArray(value)?snapshotSchemaNodeArray(value,depth+1,budget):snapshotSchemaNode(value,depth+1,budget):snapshotSchemaValue(value,budget,depth+1)}function snapshotSchemaNodeMap(value,depth,budget){if(value===null||typeof value!="object"||!isPlainSchemaRecord(value))return OMIT_SCHEMA_VALUE;if(budget.seen.has(value))return budget.seen.get(value);const checkpoint=checkpointSchemaSnapshot(budget),output=Object.create(null);rememberSchemaSnapshot(budget,value,output);try{for(const key in value){if(!consumeSchemaInspection(budget))break;const descriptor=ownEnumerableDataDescriptor(value,key);if(descriptor===MISSING_SCHEMA_DESCRIPTOR||descriptor===ACCESSOR_SCHEMA_DESCRIPTOR)continue;if(descriptor===UNSAFE_SCHEMA_DESCRIPTOR)return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE;const entryCheckpoint=checkpointSchemaSnapshot(budget),entry=snapshotSchemaNode(descriptor.value,depth,budget);if(entry===OMIT_SCHEMA_VALUE){restoreSchemaSnapshot(budget,entryCheckpoint);continue}if(entry!==DEPTH_LIMIT_SCHEMA_VALUE){if(entry===NODE_LIMIT_SCHEMA_VALUE)break;defineSnapshotValue(output,key,entry)}}}catch{return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE}const frozen=finishSchemaSnapshot(output);return frozen===OMIT_SCHEMA_VALUE?(restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE):frozen}function snapshotSchemaNodeArray(value,depth,budget){if(value===null||typeof value!="object"||!isSchemaArray(value))return OMIT_SCHEMA_VALUE;if(budget.seen.has(value))return budget.seen.get(value);const checkpoint=checkpointSchemaSnapshot(budget),sourceLength=safeArrayLength(value);if(sourceLength===UNSAFE_SCHEMA_DESCRIPTOR)return OMIT_SCHEMA_VALUE;const output=new Array(Math.min(sourceLength,SCHEMA_SNAPSHOT_ARRAY_LENGTH_LIMIT));rememberSchemaSnapshot(budget,value,output);try{for(const key in value){if(!consumeSchemaInspection(budget))break;const index=isArrayIndex(key)?Number(key):null;if(index!==null&&index>=output.length)continue;const descriptor=ownEnumerableDataDescriptor(value,key);if(descriptor===MISSING_SCHEMA_DESCRIPTOR||descriptor===ACCESSOR_SCHEMA_DESCRIPTOR)continue;if(descriptor===UNSAFE_SCHEMA_DESCRIPTOR)return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE;const entryCheckpoint=checkpointSchemaSnapshot(budget),entry=index!==null?snapshotSchemaNode(descriptor.value,depth,budget):snapshotSchemaValue(descriptor.value,budget,depth);if(entry===OMIT_SCHEMA_VALUE){restoreSchemaSnapshot(budget,entryCheckpoint);continue}if(entry!==DEPTH_LIMIT_SCHEMA_VALUE){if(entry===NODE_LIMIT_SCHEMA_VALUE){index!==null&&(output.length=index);break}defineSnapshotValue(output,key,entry)}}}catch{return restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE}const frozen=finishSchemaSnapshot(output);return frozen===OMIT_SCHEMA_VALUE?(restoreSchemaSnapshot(budget,checkpoint),OMIT_SCHEMA_VALUE):frozen}function snapshotSchema(value){const snapshot=snapshotSchemaNode(value,0,{remaining:SCHEMA_SNAPSHOT_NODE_LIMIT,remainingInspections:SCHEMA_SNAPSHOT_INSPECTION_LIMIT,seen:new Map,additions:[]});return isSchemaSnapshotFailure(snapshot)?null:snapshot}class LyraJsonSchemaViewer extends LyraElement{constructor(){super(...arguments),this.schemaValue=null,this.issues=[],this.selectedPath=null,this.maxDepth=20,this.label="",this.previousNodeLimitText="",this.previousIssueLimitText="",this.suppressNextLimitAnnouncement=!0}static{this.defaultStrings={...super.defaultStrings,schemaViewerCircular:LYRA_DEFAULT_schemaViewerCircular,schemaViewerEmpty:LYRA_DEFAULT_schemaViewerEmpty,schemaViewerIssueLimit:LYRA_DEFAULT_schemaViewerIssueLimit,schemaViewerLabel:LYRA_DEFAULT_schemaViewerLabel,schemaViewerLimit:LYRA_DEFAULT_schemaViewerLimit,schemaViewerRequired:LYRA_DEFAULT_schemaViewerRequired,schemaViewerType:LYRA_DEFAULT_schemaViewerType}}static{this.ownedCollectionProperties=Object.freeze(["issues"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-schema-select"])}get schema(){return this.schemaValue}set schema(value){const previous=this.schemaValue;this.schemaValue=snapshotSchema(value),this.requestUpdate("schema",previous)}syncAnnouncementSink(){this.isConnected&&this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.announcementSink?.release(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink(),this.hasUpdated&&(this.suppressNextLimitAnnouncement=!0,this.requestUpdate())}disconnectedCallback(){super.disconnectedCallback(),this.announcementSink?.release(),this.announcementSink=void 0,this.suppressNextLimitAnnouncement=!0}updated(_changed){super.updated(_changed);const nodeText=this.renderRoot.querySelector('[part="limit"]')?.textContent?.trim()??"",issueText=this.renderRoot.querySelector('[part="issue-limit"]')?.textContent?.trim()??"";this.suppressNextLimitAnnouncement||(nodeText&&nodeText!==this.previousNodeLimitText&&this.announcementSink?.announce(nodeText),issueText&&issueText!==this.previousIssueLimitText&&this.announcementSink?.announce(issueText)),this.previousNodeLimitText=nodeText,this.previousIssueLimitText=issueText,this.suppressNextLimitAnnouncement=!1}pointerSegment(value){return value.replace(/~/g,"~0").replace(/\//g,"~1")}decodePointerSegment(segment){return segment.replace(/~1/g,"/").replace(/~0/g,"~")}resolvedSelectionPathChain(){const selectedPath=this.selectedPath,root=this.schema;if(selectedPath==null||!root||typeof root!="object")return new Set;if(selectedPath==="")return new Set([""]);if(!selectedPath.startsWith("/"))return new Set;const segments=selectedPath.split("/").slice(1),maxDepth=finiteCount(this.maxDepth,20,MAX_SCHEMA_DEPTH),chain=new Set([""]),visited=new Set([root]);let node=root,path="",depth=0,index=0;for(;index<segments.length;){if(depth>=maxDepth)return new Set;const kind=segments[index];let next,nextPath,consumed=0;if(kind==="properties"){const keySegment=segments[index+1];if(keySegment!==void 0){const candidate=node.properties?.[this.decodePointerSegment(keySegment)];candidate&&(next=candidate,nextPath=`${path}/properties/${keySegment}`,consumed=2)}}else if(kind==="allOf"||kind==="anyOf"||kind==="oneOf"){const idxSegment=segments[index+1];if(idxSegment!==void 0&&isArrayIndex(idxSegment)){const list=node[kind],candidate=Array.isArray(list)?list[Number(idxSegment)]:void 0;candidate&&(next=candidate,nextPath=`${path}/${kind}/${idxSegment}`,consumed=2)}}else if(kind==="items")if(isReadonlyArray(node.items)){const idxSegment=segments[index+1];if(idxSegment!==void 0&&isArrayIndex(idxSegment)){const candidate=node.items[Number(idxSegment)];candidate&&(next=candidate,nextPath=`${path}/items/${idxSegment}`,consumed=2)}}else node.items&&(next=node.items,nextPath=`${path}/items`,consumed=1);if(!next||nextPath===void 0||visited.has(next))return new Set;visited.add(next),node=next,path=nextPath,chain.add(path),depth+=1,index+=consumed}return path===selectedPath?chain:new Set}constraints(schema){const rows=["format","pattern","minimum","maximum","minLength","maxLength","minItems","maxItems","minProperties","maxProperties"].flatMap(key=>schema[key]==null?[]:[`${key}: ${constraintValue(schema[key])}`]);if(schema.enum){const values=schema.enum.slice(0,MAX_CONSTRAINT_VALUES).map(constraintValue);rows.push(`enum: [${values.join(", ")}${schema.enum.length>values.length?", …":""}]`)}if(Object.prototype.hasOwnProperty.call(schema,"const")&&rows.push(`const: ${constraintValue(schema.const)}`),Object.prototype.hasOwnProperty.call(schema,"default")&&rows.push(`default: ${constraintValue(schema.default)}`),schema.examples){const examples=schema.examples.slice(0,MAX_CONSTRAINT_VALUES).map(constraintValue);rows.push(`examples: [${examples.join(", ")}${schema.examples.length>examples.length?", …":""}]`)}return schema.$ref&&rows.push(`$ref: ${schema.$ref.slice(0,MAX_CONSTRAINT_VALUE_CHARACTERS)}`),rows}renderNode(name,schema,path,required,depth,ancestors,budget,issuesByPath){if(!budget.reservedPaths.has(path)){if(budget.remaining<=0)return budget.truncated=!0,nothing;budget.remaining--}const selected=path===this.selectedPath;if(ancestors.has(schema))return html`<li part="node">
|
|
2
2
|
<span part="description">${this.localize("schemaViewerCircular")}</span>
|
|
3
|
-
</li>`;const nextAncestors=new Set(ancestors).add(schema),type=isReadonlyArray(schema.type)?schema.type.join(" | "):schema.type??(schema.properties?"object":""),constraints=this.constraints(schema),issues=issuesByPath.get(path)??[],children=[]
|
|
3
|
+
</li>`;const nextAncestors=new Set(ancestors).add(schema),type=isReadonlyArray(schema.type)?schema.type.join(" | "):schema.type??(schema.properties?"object":""),constraints=this.constraints(schema),issues=issuesByPath.get(path)??[],children=[];let pendingReservedChild=budget.reservedPaths.has(path)&&path!==this.selectedPath;const addChild=child=>pendingReservedChild&&budget.reservedPaths.has(child.path)?(pendingReservedChild=!1,children.push(child),!0):children.length>=budget.remaining?(budget.truncated=!0,pendingReservedChild):(children.push(child),!0);if(depth<finiteCount(this.maxDepth,20,MAX_SCHEMA_DEPTH)){const properties=schema.properties??{};for(const key in properties){if(!Object.prototype.hasOwnProperty.call(properties,key))continue;const node=properties[key];if(node&&!addChild({name:key,node,path:`${path}/properties/${this.pointerSegment(key)}`,required:Array.isArray(schema.required)&&schema.required.includes(key)}))break}for(const keyword of["allOf","anyOf","oneOf"]){const nodes=schema[keyword]??[];for(const key of Object.keys(nodes)){if(!isArrayIndex(key))continue;const index=Number(key),node=nodes[index];if(node&&!addChild({name:`${keyword}[${index}]`,node,path:`${path}/${keyword}/${index}`,required:!1}))break}}if(isReadonlyArray(schema.items))for(const key of Object.keys(schema.items)){if(!isArrayIndex(key))continue;const index=Number(key),node=schema.items[index];if(node&&!addChild({name:`items[${index}]`,node,path:`${path}/items/${index}`,required:!1}))break}else schema.items&&addChild({name:"items",node:schema.items,path:`${path}/items`,required:!1})}return html`
|
|
4
4
|
<li part=${selected?"node node-selected":"node"} style=${`--_lr-schema-depth:${depth}`}>
|
|
5
5
|
<button
|
|
6
6
|
part="node-trigger"
|
|
@@ -33,7 +33,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
33
33
|
part="empty"
|
|
34
34
|
heading=${this.localize("schemaViewerEmpty")}
|
|
35
35
|
></lr-empty>
|
|
36
|
-
</section>`;const budget={remaining:MAX_RENDERED_SCHEMA_NODES,truncated:!1},issuesByPath=new Map,visibleIssueCount=Math.min(this.issues.length,MAX_RENDERED_SCHEMA_ISSUES);for(let index=0;index<visibleIssueCount;index++){const issue=this.issues[index];if(!issue)continue;const pathIssues=issuesByPath.get(issue.path)??[];pathIssues.push(issue),issuesByPath.set(issue.path,pathIssues)}const tree=this.renderNode(this.schema.title||"$",this.schema,"",!1,0,new Set,budget,issuesByPath);return html`
|
|
36
|
+
</section>`;const reservedPaths=this.resolvedSelectionPathChain(),budget={remaining:Math.max(0,MAX_RENDERED_SCHEMA_NODES-reservedPaths.size),truncated:!1,reservedPaths},issuesByPath=new Map,visibleIssueCount=Math.min(this.issues.length,MAX_RENDERED_SCHEMA_ISSUES);for(let index=0;index<visibleIssueCount;index++){const issue=this.issues[index];if(!issue)continue;const pathIssues=issuesByPath.get(issue.path)??[];pathIssues.push(issue),issuesByPath.set(issue.path,pathIssues)}const tree=this.renderNode(this.schema.title||"$",this.schema,"",!1,0,new Set,budget,issuesByPath);return html`
|
|
37
37
|
<section part="base" aria-label=${label??nothing}>
|
|
38
38
|
<ul part="tree">${tree}</ul>
|
|
39
39
|
${budget.truncated?html`<p part="limit">${this.localize("schemaViewerLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(MAX_RENDERED_SCHEMA_NODES)})}</p>`:nothing}
|
|
@@ -46,7 +46,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
46
46
|
</span>
|
|
47
47
|
</div>
|
|
48
48
|
</li>
|
|
49
|
-
`}}static{this.defaultStrings={...super.defaultStrings,agentRunStatusCancelled:LYRA_DEFAULT_agentRunStatusCancelled,agentRunStatusCollecting:LYRA_DEFAULT_agentRunStatusCollecting,agentRunStatusDone:LYRA_DEFAULT_agentRunStatusDone,agentRunStatusIdle:LYRA_DEFAULT_agentRunStatusIdle,agentRunStatusQueued:LYRA_DEFAULT_agentRunStatusQueued,agentRunStatusWaitingApproval:LYRA_DEFAULT_agentRunStatusWaitingApproval,agentRunStatusWaitingInput:LYRA_DEFAULT_agentRunStatusWaitingInput,progress:LYRA_DEFAULT_progress,statusError:LYRA_DEFAULT_statusError,statusRunning:LYRA_DEFAULT_statusRunning,subagentPanelCancelRun:LYRA_DEFAULT_subagentPanelCancelRun,subagentPanelEmpty:LYRA_DEFAULT_subagentPanelEmpty,subagentPanelLabel:LYRA_DEFAULT_subagentPanelLabel,subagentPanelLimit:LYRA_DEFAULT_subagentPanelLimit,subagentPanelRetry:LYRA_DEFAULT_subagentPanelRetry,subagentPanelRetryRun:LYRA_DEFAULT_subagentPanelRetryRun}}static{this.ownedCollectionProperties=Object.freeze(["runs"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-run-activate","lr-cancel","lr-run-retry"])}syncAnnouncementSink(){this.isConnected&&this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.announcementSink?.release(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink(),this.hasUpdated&&(this.suppressNextLimitAnnouncement=!0,this.requestUpdate())}disconnectedCallback(){super.disconnectedCallback(),this.announcementSink?.release(),this.announcementSink=void 0,this.suppressNextLimitAnnouncement=!0}statusLabel(status){switch(status){case"idle":return this.localize("agentRunStatusIdle");case"queued":return this.localize("agentRunStatusQueued");case"running":return this.localize("statusRunning");case"collecting":return this.localize("agentRunStatusCollecting");case"waiting-input":return this.localize("agentRunStatusWaitingInput");case"waiting-approval":return this.localize("agentRunStatusWaitingApproval");case"done":return this.localize("agentRunStatusDone");case"error":return this.localize("statusError");case"cancelled":return this.localize("agentRunStatusCancelled");default:return status}}ordered(){const
|
|
49
|
+
`}}static{this.defaultStrings={...super.defaultStrings,agentRunStatusCancelled:LYRA_DEFAULT_agentRunStatusCancelled,agentRunStatusCollecting:LYRA_DEFAULT_agentRunStatusCollecting,agentRunStatusDone:LYRA_DEFAULT_agentRunStatusDone,agentRunStatusIdle:LYRA_DEFAULT_agentRunStatusIdle,agentRunStatusQueued:LYRA_DEFAULT_agentRunStatusQueued,agentRunStatusWaitingApproval:LYRA_DEFAULT_agentRunStatusWaitingApproval,agentRunStatusWaitingInput:LYRA_DEFAULT_agentRunStatusWaitingInput,progress:LYRA_DEFAULT_progress,statusError:LYRA_DEFAULT_statusError,statusRunning:LYRA_DEFAULT_statusRunning,subagentPanelCancelRun:LYRA_DEFAULT_subagentPanelCancelRun,subagentPanelEmpty:LYRA_DEFAULT_subagentPanelEmpty,subagentPanelLabel:LYRA_DEFAULT_subagentPanelLabel,subagentPanelLimit:LYRA_DEFAULT_subagentPanelLimit,subagentPanelRetry:LYRA_DEFAULT_subagentPanelRetry,subagentPanelRetryRun:LYRA_DEFAULT_subagentPanelRetryRun}}static{this.ownedCollectionProperties=Object.freeze(["runs"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-run-activate","lr-cancel","lr-run-retry"])}syncAnnouncementSink(){this.isConnected&&this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.announcementSink?.release(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink(),this.hasUpdated&&(this.suppressNextLimitAnnouncement=!0,this.requestUpdate())}disconnectedCallback(){super.disconnectedCallback(),this.announcementSink?.release(),this.announcementSink=void 0,this.suppressNextLimitAnnouncement=!0}statusLabel(status){switch(status){case"idle":return this.localize("agentRunStatusIdle");case"queued":return this.localize("agentRunStatusQueued");case"running":return this.localize("statusRunning");case"collecting":return this.localize("agentRunStatusCollecting");case"waiting-input":return this.localize("agentRunStatusWaitingInput");case"waiting-approval":return this.localize("agentRunStatusWaitingApproval");case"done":return this.localize("agentRunStatusDone");case"error":return this.localize("statusError");case"cancelled":return this.localize("agentRunStatusCancelled");default:return status}}ordered(){const runs=firstByIdentity(Array.isArray(this.runs)?this.runs:[],run=>run.id),truncated=runs.length>MAX_RENDERED_RUNS,allById=new Map;for(const run of runs)allById.set(run.id,run);const chosenIds=new Set,visitedPath=new Set;let current=this.selectedRunId?allById.get(this.selectedRunId):void 0;for(;current&&chosenIds.size<MAX_RENDERED_RUNS&&!visitedPath.has(current.id);)chosenIds.add(current.id),visitedPath.add(current.id),current=current.parentId?allById.get(current.parentId):void 0;for(const run of runs){if(chosenIds.size>=MAX_RENDERED_RUNS)break;chosenIds.add(run.id)}const normalized=[],byId=new Map;for(const run of runs)chosenIds.has(run.id)&&(normalized.push(run),byId.set(run.id,run));const byParent=new Map,roots=[],hasCyclicParentChain=run=>{const visited2=new Set([run.id]);let parentId=run.parentId;for(;parentId;){if(visited2.has(parentId))return!0;visited2.add(parentId),parentId=byId.get(parentId)?.parentId}return!1};for(const run of normalized){const parent=run.parentId&&byId.has(run.parentId)&&!hasCyclicParentChain(run)?run.parentId:"";byParent.set(parent,[...byParent.get(parent)??[],run]),parent||roots.push(run)}const rows=[],stack=[...roots].reverse().map((run,reverseIndex)=>({run,depth:0,posInSet:roots.length-reverseIndex,setSize:roots.length})),visited=new Set;for(;stack.length>0&&rows.length<MAX_RENDERED_RUNS;){const row=stack.pop();if(!row||visited.has(row.run.id))continue;visited.add(row.run.id),rows.push(row);const children=byParent.get(row.run.id)??[];for(let index=children.length-1;index>=0;index--){const child=children[index];child&&stack.push({run:child,depth:row.depth+1,posInSet:index+1,setSize:children.length})}}return{rows,truncated}}willUpdate(changed){if(super.willUpdate(changed),changed.has("runs")){this.orderedRunsCache=this.ordered();const rows=this.orderedRunsCache.rows,ids=new Set(rows.map(row=>row.run.id));(this.focusedId==null||!ids.has(this.focusedId))&&(this.focusedId=rows[0]?.run.id??null)}}updated(_changed){super.updated(_changed);const limitText=this.renderRoot.querySelector('[part="limit"]')?.textContent?.trim()??"";!this.suppressNextLimitAnnouncement&&limitText&&limitText!==this.previousLimitText&&this.announcementSink?.announce(limitText),this.previousLimitText=limitText,this.suppressNextLimitAnnouncement=!1}runElement(runId){const ownerCss=this.ownerDocument.defaultView?.CSS;if(typeof ownerCss?.escape=="function")try{const candidate=this.renderRoot.querySelector(`[data-run-id="${ownerCss.escape(runId)}"]`);if(candidate?.getAttribute("data-run-id")===runId)return candidate}catch{}return Array.from(this.renderRoot.querySelectorAll("[data-run-id]")).find(candidate=>candidate.getAttribute("data-run-id")===runId)??null}focusRow(row){row&&(this.focusedId=row.run.id,this.updateComplete.then(()=>{this.runElement(row.run.id)?.focus()}))}render(){const label=hostAriaLabel(this)??(this.label==null?this.localize("subagentPanelLabel"):this.label),ordered=this.orderedRunsCache,firstId=ordered.rows[0]?.run.id;return html`
|
|
50
50
|
<div part="base">
|
|
51
51
|
${ordered.rows.length?html`<ul
|
|
52
52
|
part="list"
|
|
@@ -104,6 +104,8 @@ export type ThinkingPanelAppearance=LyraFrame;export interface ThinkingPanelTogg
|
|
|
104
104
|
* `[part="header"]` while `compact`.
|
|
105
105
|
* @cssprop [--lr-thinking-panel-compact-body-padding=var(--lr-space-s)] - `[part="body"]` padding
|
|
106
106
|
* while `compact`.
|
|
107
|
+
* @cssprop [--lr-thinking-panel-compact-body-font-size=var(--lr-font-size-sm)] - Font size of
|
|
108
|
+
* `[part="body"]` while `compact`.
|
|
107
109
|
* @cssprop [--lr-thinking-panel-background=var(--lr-color-surface)] - Fill of the outer card
|
|
108
110
|
* (`[part="base"]`) while `frame="card"`. `frame="plain"` still removes the fill entirely.
|
|
109
111
|
* @cssprop [--lr-thinking-panel-border-color=var(--lr-color-border)] - Colour of the outer card's
|
|
@@ -127,9 +129,10 @@ export declare class LyraThinkingPanel extends LyraElement<LyraThinkingPanelEven
|
|
|
127
129
|
/** Optional header-text override. Omission localizes `thinkingPanelLabel`; any supplied string,
|
|
128
130
|
* including `'Thinking'` or `''`, is rendered verbatim. */
|
|
129
131
|
label?:string;
|
|
130
|
-
/** Tighter header/body padding and header
|
|
131
|
-
* `false`, preserving the regular-density treatment. This changes
|
|
132
|
-
* border and surface remain, so use `frame="plain"` to remove card
|
|
132
|
+
/** Tighter header/body padding, header gap, and header/body font size for dense transcript
|
|
133
|
+
* contexts. Defaults to `false`, preserving the regular-density treatment. This changes
|
|
134
|
+
* density only; the outer border and surface remain, so use `frame="plain"` to remove card
|
|
135
|
+
* chrome. */
|
|
133
136
|
compact:boolean;
|
|
134
137
|
/** Visual chrome, in the library's shared container-frame vocabulary. `'card'` (the default)
|
|
135
138
|
* keeps the bordered, filled outer container. `'plain'` removes that outer border, background,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from"lit";const styles=css`:host{--_lr-thinking-panel-max-block-size:var(--lr-size-16rem);display:block}[part=base]{border:var(--lr-border-width-thin) solid var(--lr-thinking-panel-border-color,var(--lr-color-border));border-radius:var(--lr-thinking-panel-radius,var(--lr-radius));background:var(--lr-thinking-panel-background,var(--lr-color-surface));overflow:hidden}:host([compact]) [part=header]{padding:var(--lr-thinking-panel-compact-header-padding,var(--lr-space-2xs) var(--lr-space-s));gap:var(--lr-thinking-panel-compact-header-gap,var(--lr-space-2xs));font-size:var(--lr-thinking-panel-compact-header-font-size,var(--lr-font-size-sm))}:host([compact]) [part=body]{padding:var(--lr-thinking-panel-compact-body-padding,var(--lr-space-s))}:host([frame=plain]) [part=base]{background:0 0;border:0;border-radius:0}[part=header]{align-items:center;gap:var(--lr-space-xs);inline-size:100%;padding:var(--lr-space-s) var(--lr-space-m);color:var(--lr-color-text);font:inherit;font-weight:var(--lr-font-weight-semibold);font-size:var(--lr-font-size-md-sm);text-align:start;cursor:pointer;background:0 0;border:none;flex-wrap:wrap;display:flex}[part=header]:hover{background:var(--lr-color-brand-quiet);color:var(--lr-color-brand)}[part=header]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=header]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-offset))}[part=toggle]{transition:transform var(--lr-transition-fast);flex:none;display:inline-flex}:host([expanded]) [part=toggle]{transform:rotate(90deg)}:host(:not([expanded]):dir(rtl)) [part=toggle]{transform:scaleX(-1)}[part=label]{min-inline-size:var(--lr-size-6ch);text-overflow:ellipsis;white-space:nowrap;flex:auto;overflow:hidden}[part=duration]{align-items:center;gap:var(--lr-size-0-35em);overflow-wrap:anywhere;text-align:end;min-inline-size:0;font-weight:var(--lr-font-weight-normal);font-size:var(--lr-font-size-sm);color:var(--lr-color-text-quiet);flex:0 auto;display:inline-flex}[part=duration][data-pending]{color:var(--lr-thinking-panel-pending-color,var(--lr-color-brand))}.pending-dot{inline-size:var(--lr-size-0-375rem);block-size:var(--lr-size-0-375rem);animation:lr-thinking-panel-pulse var(--lr-transition-ambient) infinite;background:currentColor;border-radius:50%}@keyframes lr-thinking-panel-pulse{0%,to{opacity:.4;transform:scale(.85)}50%{opacity:1;transform:scale(1)}}[part=body]{min-inline-size:0;max-inline-size:100%;max-block-size:var(--lr-thinking-panel-max-block-size,var(--_lr-thinking-panel-max-block-size));overflow-inline:hidden;overflow-block:auto;overflow-wrap:anywhere;overscroll-behavior:contain;padding:var(--lr-space-m);border-block-start:var(--lr-border-width-thin) solid var(--lr-thinking-panel-border-color,var(--lr-color-border));color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-md-sm);line-height:var(--lr-line-height-normal)}[part=body]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-offset))}[part=body]:hover:not(:focus-visible){outline-width:var(--lr-thinking-panel-body-hover-outline-width,var(--lr-focus-ring-width));outline-style:var(--lr-thinking-panel-body-hover-outline-style,solid);outline-color:var(--lr-thinking-panel-body-hover-outline-color,var(--lr-color-border));outline-offset:var(--lr-thinking-panel-body-hover-outline-offset,calc(-1 * var(--lr-focus-ring-offset)))}[part=body][hidden]{display:none}@media (prefers-reduced-motion:reduce){[part=toggle]{transition:none!important}.pending-dot{opacity:1;transform:none;animation:none!important}}`;export{styles};
|
|
1
|
+
import{css}from"lit";const styles=css`:host{--_lr-thinking-panel-max-block-size:var(--lr-size-16rem);display:block}[part=base]{border:var(--lr-border-width-thin) solid var(--lr-thinking-panel-border-color,var(--lr-color-border));border-radius:var(--lr-thinking-panel-radius,var(--lr-radius));background:var(--lr-thinking-panel-background,var(--lr-color-surface));overflow:hidden}:host([compact]) [part=header]{padding:var(--lr-thinking-panel-compact-header-padding,var(--lr-space-2xs) var(--lr-space-s));gap:var(--lr-thinking-panel-compact-header-gap,var(--lr-space-2xs));font-size:var(--lr-thinking-panel-compact-header-font-size,var(--lr-font-size-sm))}:host([compact]) [part=body]{padding:var(--lr-thinking-panel-compact-body-padding,var(--lr-space-s));font-size:var(--lr-thinking-panel-compact-body-font-size,var(--lr-font-size-sm))}:host([frame=plain]) [part=base]{background:0 0;border:0;border-radius:0}[part=header]{align-items:center;gap:var(--lr-space-xs);inline-size:100%;padding:var(--lr-space-s) var(--lr-space-m);color:var(--lr-color-text);font:inherit;font-weight:var(--lr-font-weight-semibold);font-size:var(--lr-font-size-md-sm);text-align:start;cursor:pointer;background:0 0;border:none;flex-wrap:wrap;display:flex}[part=header]:hover{background:var(--lr-color-brand-quiet);color:var(--lr-color-brand)}[part=header]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=header]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-offset))}[part=toggle]{transition:transform var(--lr-transition-fast);flex:none;display:inline-flex}:host([expanded]) [part=toggle]{transform:rotate(90deg)}:host(:not([expanded]):dir(rtl)) [part=toggle]{transform:scaleX(-1)}[part=label]{min-inline-size:var(--lr-size-6ch);text-overflow:ellipsis;white-space:nowrap;flex:auto;overflow:hidden}[part=duration]{align-items:center;gap:var(--lr-size-0-35em);overflow-wrap:anywhere;text-align:end;min-inline-size:0;font-weight:var(--lr-font-weight-normal);font-size:var(--lr-font-size-sm);color:var(--lr-color-text-quiet);flex:0 auto;display:inline-flex}[part=duration][data-pending]{color:var(--lr-thinking-panel-pending-color,var(--lr-color-brand))}.pending-dot{inline-size:var(--lr-size-0-375rem);block-size:var(--lr-size-0-375rem);animation:lr-thinking-panel-pulse var(--lr-transition-ambient) infinite;background:currentColor;border-radius:50%}@keyframes lr-thinking-panel-pulse{0%,to{opacity:.4;transform:scale(.85)}50%{opacity:1;transform:scale(1)}}[part=body]{min-inline-size:0;max-inline-size:100%;max-block-size:var(--lr-thinking-panel-max-block-size,var(--_lr-thinking-panel-max-block-size));overflow-inline:hidden;overflow-block:auto;overflow-wrap:anywhere;overscroll-behavior:contain;padding:var(--lr-space-m);border-block-start:var(--lr-border-width-thin) solid var(--lr-thinking-panel-border-color,var(--lr-color-border));color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-md-sm);line-height:var(--lr-line-height-normal)}[part=body]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-offset))}[part=body]:hover:not(:focus-visible){outline-width:var(--lr-thinking-panel-body-hover-outline-width,var(--lr-focus-ring-width));outline-style:var(--lr-thinking-panel-body-hover-outline-style,solid);outline-color:var(--lr-thinking-panel-body-hover-outline-color,var(--lr-color-border));outline-offset:var(--lr-thinking-panel-body-hover-outline-offset,calc(-1 * var(--lr-focus-ring-offset)))}[part=body][hidden]{display:none}@media (prefers-reduced-motion:reduce){[part=toggle]{transition:none!important}.pending-dot{opacity:1;transform:none;animation:none!important}}`;export{styles};
|
|
@@ -23,7 +23,9 @@ export type ToolCallStatus=LyraToolStatus;export interface ToolChipSelectDetail{
|
|
|
23
23
|
* `<lr-citation-badge>`'s popover), so releasing one modality while the
|
|
24
24
|
* other is still active doesn't close it, and the trigger button's
|
|
25
25
|
* `aria-describedby` points at the tooltip's id whenever it's open and has
|
|
26
|
-
* content, so the association reaches assistive tech too
|
|
26
|
+
* content, so the association reaches assistive tech too; a host-authored `aria-describedby` is
|
|
27
|
+
* projected onto the same button and merged with that id, since idrefs never cross the shadow
|
|
28
|
+
* boundary on their own. The tooltip is an
|
|
27
29
|
* explicitly noninteractive preview: its flattened subtree is inert, so a
|
|
28
30
|
* consumer must put actions in the detail surface opened from
|
|
29
31
|
* `lr-tool-call-chip-select`, not links or controls in this description slot.
|
|
@@ -39,7 +41,9 @@ export type ToolCallStatus=LyraToolStatus;export interface ToolChipSelectDetail{
|
|
|
39
41
|
* @customElement lr-tool-call-chip
|
|
40
42
|
* @slot - Noninteractive tooltip preview text or formatting, shown on hover/focus. Interactive
|
|
41
43
|
* descendants are inert; put actions in the detail surface opened from
|
|
42
|
-
* `lr-tool-call-chip-select`. Nothing renders when this slot is empty.
|
|
44
|
+
* `lr-tool-call-chip-select`. Nothing renders when this slot is empty. An open tooltip
|
|
45
|
+
* participates in shared Escape ordering even while only hovered, deferring to a genuinely
|
|
46
|
+
* topmost overlay opened on top of it.
|
|
43
47
|
* @slot icon - Overrides the built-in status glyph entirely.
|
|
44
48
|
* @event lr-tool-call-chip-select - The chip was activated (click or
|
|
45
49
|
* Enter/Space while focused). `detail: { name, callId }`. The `lr-tool-chip-select`
|
|
@@ -97,7 +101,14 @@ durationMs?:number;
|
|
|
97
101
|
icon:string;
|
|
98
102
|
/** Unique identifier for this specific invocation — echoed back in `lr-tool-call-chip-select`'s
|
|
99
103
|
* detail so a listener can correlate the click with the call it fired for. */
|
|
100
|
-
callId:string;private hasDetailSlot;private tooltipOpen;private readonly tooltipId;
|
|
104
|
+
callId:string;private hasDetailSlot;private tooltipOpen;private readonly tooltipId;
|
|
105
|
+
/** Projects a host `aria-describedby` onto the internal `[part="base"]` role owner, merged with
|
|
106
|
+
* whatever that element's own `aria-describedby` (the open tooltip's id, or nothing) currently
|
|
107
|
+
* is -- IDREFs are scoped per shadow root, so the host's own attribute cannot reach across the
|
|
108
|
+
* boundary on its own, and re-deriving the baseline on every update (rather than a one-shot
|
|
109
|
+
* merge) keeps the tooltip id included as `tooltipOpen` toggles. Mirrors
|
|
110
|
+
* `graph-query-builder.class.ts`'s identically-shaped `externalDescriptionLease`. */
|
|
111
|
+
private externalDescriptionLease?;private cleanupPositioner?;private tooltipOverlay?;private hovering;private focused;private hasPreviewNodes;protected willUpdate(changed:PropertyValues):void;connectedCallback():void;private syncExternalDescription;private releaseExternalDescription;protected updated(changed:PropertyValues):void;disconnectedCallback():void;private onDetailSlotChange;private showTooltip;private hideTooltip;private onMouseEnter;private onMouseLeave;private onFocus;private onBlur;private onKeyDown;private onClick;private baseEl?;
|
|
101
112
|
/** Moves focus to the currently rendered chip button. */
|
|
102
113
|
focus(options?:FocusOptions):void;
|
|
103
114
|
/** Removes focus from the currently rendered chip button. */
|
|
@@ -1,4 +1,4 @@
|
|
|
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,svg,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{nextId}from"../../../internal/a11y.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{durationMessageValue}from"../../../internal/duration.js";import{styles}from"./tool-call-chip.styles.js";import{LYRA_DEFAULT_accessibleLabelSeparator,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_durationSeconds,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusDenied,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusPending,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusSuccess,LYRA_DEFAULT_toolCall}from"../../../internal/default-strings.generated.js";const ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function icon(paths){return svg`
|
|
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,svg,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{activateNonmodalOverlay}from"../../../internal/nonmodal-overlay-manager.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{nextId}from"../../../internal/a11y.js";import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{durationMessageValue}from"../../../internal/duration.js";import{styles}from"./tool-call-chip.styles.js";import{LYRA_DEFAULT_accessibleLabelSeparator,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_durationSeconds,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusDenied,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusPending,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusSuccess,LYRA_DEFAULT_toolCall}from"../../../internal/default-strings.generated.js";const ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function icon(paths){return svg`
|
|
2
2
|
<svg
|
|
3
3
|
width="1em"
|
|
4
4
|
height="1em"
|
|
@@ -15,7 +15,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
15
15
|
<circle cx="12" cy="12" r="9"></circle>
|
|
16
16
|
<line x1="9" y1="9" x2="15" y2="15"></line>
|
|
17
17
|
<line x1="15" y1="9" x2="9" y2="15"></line>
|
|
18
|
-
`)}function deniedIcon(){return icon(svg`<circle cx="12" cy="12" r="9"></circle><line x1="6" y1="18" x2="18" y2="6"></line>`)}const STATUS_ICON={pending:pendingIcon,running:runningIcon,success:successIcon,error:errorIcon,denied:deniedIcon},STATUS_LABEL={pending:"Pending",running:"Running",success:"Success",error:"Error",denied:"Denied"},STATUS_LABEL_KEY={pending:"statusPending",running:"statusRunning",success:"statusSuccess",error:"statusError",denied:"statusDenied"},STATUS_VALUES=new Set(Object.keys(STATUS_LABEL)),statusConverter={fromAttribute(value){return value!==null&&STATUS_VALUES.has(value)?value:"pending"},toAttribute(value){return value}};class LyraToolCallChip extends LyraElement{constructor(){super(...arguments),this.name="",this.category="",this.status="pending",this.summary="",this.icon="",this.callId="",this.hasDetailSlot=!1,this.tooltipOpen=!1,this.tooltipId=nextId("tool-call-chip-tooltip"),this.hovering=!1,this.focused=!1,this.onDetailSlotChange=e=>{this.hasDetailSlot=this.hasPreviewNodes(e.target.assignedNodes({flatten:!0})),this.hasDetailSlot||this.hideTooltip()},this.onMouseEnter=()=>{this.hovering=!0,this.showTooltip()},this.onMouseLeave=()=>{this.hovering=!1,!this.focused&&this.hideTooltip()},this.onFocus=()=>{this.focused=!0,this.showTooltip()},this.onBlur=()=>{this.focused=!1,!this.hovering&&this.hideTooltip()},this.onKeyDown=e=>{e.key==="Escape"&&this.tooltipOpen&&(e.stopPropagation(),this.hideTooltip())},this.onClick=()=>{this.emit("lr-tool-call-chip-select",{name:this.name,callId:this.callId})}}static{this.defaultStrings={...super.defaultStrings,accessibleLabelSeparator:LYRA_DEFAULT_accessibleLabelSeparator,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,durationMilliseconds:LYRA_DEFAULT_durationMilliseconds,durationSeconds:LYRA_DEFAULT_durationSeconds,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusDenied:LYRA_DEFAULT_statusDenied,statusError:LYRA_DEFAULT_statusError,statusPending:LYRA_DEFAULT_statusPending,statusRunning:LYRA_DEFAULT_statusRunning,statusSuccess:LYRA_DEFAULT_statusSuccess,toolCall:LYRA_DEFAULT_toolCall}}static{this.styles=[LyraElement.styles,styles]}hasPreviewNodes(nodes){return nodes.some(node=>{if(node.nodeType===3)return!!node.textContent?.trim();if(node.nodeType!==1)return!1;const slotName=node.getAttribute("slot");return slotName===null||slotName===""})}willUpdate(changed){super.willUpdate(changed),this.hasUpdated||(this.hasDetailSlot=this.hasPreviewNodes(Array.from(this.childNodes)))}updated(changed){if(super.updated(changed),changed.has("tooltipOpen")&&(this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.tooltipOpen)){const anchor=this.renderRoot.querySelector('[part="base"]'),tooltip=this.renderRoot.querySelector('[part="tooltip"]');anchor&&tooltip&&(this.cleanupPositioner=place(anchor,tooltip,{placement:"top-start",strategy:resolveEffectivePositioningStrategy(this,void 0,"fixed")}))}}disconnectedCallback(){super.disconnectedCallback(),this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.tooltipOpen=!1,this.hovering=!1,this.focused=!1}showTooltip(){!this.hasDetailSlot||this.tooltipOpen||(this.tooltipOpen=!0)}hideTooltip(){this.tooltipOpen&&(this.tooltipOpen=!1)}focus(options){this.baseEl?.focus(options)}blur(){this.baseEl?.blur()}click(){this.baseEl?.click()}get effectiveStatus(){return STATUS_VALUES.has(this.status)?this.status:"pending"}get safeDurationMs(){return this.durationMs!=null&&Number.isFinite(this.durationMs)?finiteRange(this.durationMs,0,0):null}get accessibleLabel(){const parts=[this.name||this.localize("toolCall")];this.summary&&parts.push(this.summary),parts.push(this.localize(STATUS_LABEL_KEY[this.effectiveStatus]));const durationMs=this.safeDurationMs;return durationMs!=null&&parts.push(this.localizedDuration(durationMs)),parts.join(this.localize("accessibleLabelSeparator"))}localizedDuration(ms){const duration=durationMessageValue(ms);return this.localize(duration.key,void 0,{value:getNumberFormat(this.effectiveLocale,{maximumFractionDigits:duration.key==="durationSeconds"?1:0}).format(duration.value)})}render(){const hasCategory=(this.category??"").length>0,hasSummary=(this.summary??"").length>0,durationMs=this.safeDurationMs,hasDuration=durationMs!=null,status=this.effectiveStatus;return html`
|
|
18
|
+
`)}function deniedIcon(){return icon(svg`<circle cx="12" cy="12" r="9"></circle><line x1="6" y1="18" x2="18" y2="6"></line>`)}const STATUS_ICON={pending:pendingIcon,running:runningIcon,success:successIcon,error:errorIcon,denied:deniedIcon},STATUS_LABEL={pending:"Pending",running:"Running",success:"Success",error:"Error",denied:"Denied"},STATUS_LABEL_KEY={pending:"statusPending",running:"statusRunning",success:"statusSuccess",error:"statusError",denied:"statusDenied"},STATUS_VALUES=new Set(Object.keys(STATUS_LABEL)),statusConverter={fromAttribute(value){return value!==null&&STATUS_VALUES.has(value)?value:"pending"},toAttribute(value){return value}};class LyraToolCallChip extends LyraElement{constructor(){super(...arguments),this.name="",this.category="",this.status="pending",this.summary="",this.icon="",this.callId="",this.hasDetailSlot=!1,this.tooltipOpen=!1,this.tooltipId=nextId("tool-call-chip-tooltip"),this.hovering=!1,this.focused=!1,this.onDetailSlotChange=e=>{this.hasDetailSlot=this.hasPreviewNodes(e.target.assignedNodes({flatten:!0})),this.hasDetailSlot||this.hideTooltip()},this.onMouseEnter=()=>{this.hovering=!0,this.showTooltip()},this.onMouseLeave=()=>{this.hovering=!1,!this.focused&&this.hideTooltip()},this.onFocus=()=>{this.focused=!0,this.showTooltip()},this.onBlur=()=>{this.focused=!1,!this.hovering&&this.hideTooltip()},this.onKeyDown=e=>{e.key==="Escape"&&this.tooltipOpen&&this.tooltipOverlay?.isTopmost()&&(e.stopPropagation(),this.hideTooltip())},this.onClick=()=>{this.emit("lr-tool-call-chip-select",{name:this.name,callId:this.callId})}}static{this.defaultStrings={...super.defaultStrings,accessibleLabelSeparator:LYRA_DEFAULT_accessibleLabelSeparator,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,durationMilliseconds:LYRA_DEFAULT_durationMilliseconds,durationSeconds:LYRA_DEFAULT_durationSeconds,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusDenied:LYRA_DEFAULT_statusDenied,statusError:LYRA_DEFAULT_statusError,statusPending:LYRA_DEFAULT_statusPending,statusRunning:LYRA_DEFAULT_statusRunning,statusSuccess:LYRA_DEFAULT_statusSuccess,toolCall:LYRA_DEFAULT_toolCall}}static{this.styles=[LyraElement.styles,styles]}hasPreviewNodes(nodes){return nodes.some(node=>{if(node.nodeType===3)return!!node.textContent?.trim();if(node.nodeType!==1)return!1;const slotName=node.getAttribute("slot");return slotName===null||slotName===""})}willUpdate(changed){super.willUpdate(changed),this.hasUpdated||(this.hasDetailSlot=this.hasPreviewNodes(Array.from(this.childNodes)))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription()}syncExternalDescription(){const target=this.isConnected?this.baseEl??null:null;if(!target){this.releaseExternalDescription();return}this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireResolvedAriaRelationship(this,target,"aria-describedby")}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}updated(changed){if(super.updated(changed),this.syncExternalDescription(),changed.has("tooltipOpen")&&(this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.tooltipOverlay?.deactivate({restoreFocus:!1}),this.tooltipOverlay=void 0,this.tooltipOpen)){const anchor=this.renderRoot.querySelector('[part="base"]'),tooltip=this.renderRoot.querySelector('[part="tooltip"]');anchor&&tooltip&&(this.cleanupPositioner=place(anchor,tooltip,{placement:"top-start",strategy:resolveEffectivePositioningStrategy(this,void 0,"fixed")}),this.tooltipOverlay=activateNonmodalOverlay({host:this,panel:()=>tooltip,onEscape:()=>this.hideTooltip(),restoreFocusTo:null}))}}disconnectedCallback(){super.disconnectedCallback(),this.releaseExternalDescription(),this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.tooltipOverlay?.deactivate({restoreFocus:!1}),this.tooltipOverlay=void 0,this.tooltipOpen=!1,this.hovering=!1,this.focused=!1}showTooltip(){!this.hasDetailSlot||this.tooltipOpen||(this.tooltipOpen=!0)}hideTooltip(){this.tooltipOpen&&(this.tooltipOpen=!1)}focus(options){this.baseEl?.focus(options)}blur(){this.baseEl?.blur()}click(){this.baseEl?.click()}get effectiveStatus(){return STATUS_VALUES.has(this.status)?this.status:"pending"}get safeDurationMs(){return this.durationMs!=null&&Number.isFinite(this.durationMs)?finiteRange(this.durationMs,0,0):null}get accessibleLabel(){const parts=[this.name||this.localize("toolCall")];this.summary&&parts.push(this.summary),parts.push(this.localize(STATUS_LABEL_KEY[this.effectiveStatus]));const durationMs=this.safeDurationMs;return durationMs!=null&&parts.push(this.localizedDuration(durationMs)),parts.join(this.localize("accessibleLabelSeparator"))}localizedDuration(ms){const duration=durationMessageValue(ms);return this.localize(duration.key,void 0,{value:getNumberFormat(this.effectiveLocale,{maximumFractionDigits:duration.key==="durationSeconds"?1:0}).format(duration.value)})}render(){const hasCategory=(this.category??"").length>0,hasSummary=(this.summary??"").length>0,durationMs=this.safeDurationMs,hasDuration=durationMs!=null,status=this.effectiveStatus;return html`
|
|
19
19
|
<button
|
|
20
20
|
part="base"
|
|
21
21
|
type="button"
|
|
@@ -14,7 +14,11 @@ readonly description?:string;
|
|
|
14
14
|
readonly title?:string;
|
|
15
15
|
/** Pre-filled value used whenever `value` doesn't already have this key. */
|
|
16
16
|
readonly default?:unknown;
|
|
17
|
-
/** Exact primitive value required when the property is present.
|
|
17
|
+
/** Exact primitive value required when the property is present. For a `'string'` (non-enum) or
|
|
18
|
+
* `'number'`/`'integer'` property, `const` also pre-fills the field (taking priority over
|
|
19
|
+
* `default` when both are present) and renders its control `readonly` — visible, focusable and
|
|
20
|
+
* still submitted, but not editable. The `'boolean'`/enum `<lr-select>` fields are unaffected:
|
|
21
|
+
* `const` there remains pure post-touch validation. */
|
|
18
22
|
readonly const?:ToolParamFormPrimitive;
|
|
19
23
|
/** Native editing-assistance hints forwarded when this property renders a text input. */
|
|
20
24
|
readonly autocomplete?:string;readonly spellcheck?:boolean;readonly autocapitalize?:string;readonly autoCorrect?:string;readonly inputMode?:string;readonly enterKeyHint?:string;}
|
|
@@ -157,7 +161,13 @@ getForm():HTMLFormElement|null;get labels():NodeList;get validity():ValidityStat
|
|
|
157
161
|
/** Forwards host clicks to the first rendered form field so the component behaves like a regular
|
|
158
162
|
* control from caller code and event re-dispatch paths.
|
|
159
163
|
*/
|
|
160
|
-
click():void;
|
|
164
|
+
click():void;
|
|
165
|
+
/** Moves focus to the first enabled rendered field, mirroring {@link click}, so the host behaves
|
|
166
|
+
* like a regular focusable control -- see the class doc's "behaves like a regular control" note.
|
|
167
|
+
*/
|
|
168
|
+
focus(options?:FocusOptions):void;
|
|
169
|
+
/** Blurs whichever nested field currently holds focus. */
|
|
170
|
+
blur():void;connectedCallback():void;disconnectedCallback():void;
|
|
161
171
|
/** `value`, with any property missing from it filled in from `schema`'s own `default` — see the class doc. */
|
|
162
172
|
get effectiveValue():ToolParamFormValue;private get schemaProperties();private get requiredKeys();private resolveEffectiveValue;
|
|
163
173
|
/** Detached, deeply frozen schema snapshot. At most 100 fields, 100 required keys, and 500 enum
|
|
@@ -1,4 +1,4 @@
|
|
|
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,nothing}from"lit";import{state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{nextId}from"../../../internal/a11y.js";import{AnchoredValidityController,resolveValidityAnchor,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{styles}from"./tool-param-form.styles.js";import"../../forms/select/select.class.js";import"../../forms/combobox/option.class.js";import"../../forms/input/number-input.class.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInteractionOnInvalid,installInvalidEventAlias,withStaticValidityCheck}from"../../../internal/invalid-event-alias.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{LYRA_DEFAULT_fieldMustBeBoolean,LYRA_DEFAULT_fieldMustBeInteger,LYRA_DEFAULT_fieldMustBeNumber,LYRA_DEFAULT_fieldMustBeOneOf,LYRA_DEFAULT_fieldMustBeString,LYRA_DEFAULT_fieldMustEqual,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_noData,LYRA_DEFAULT_schemaMustBeObject,LYRA_DEFAULT_schemaPropertiesMustBeFlat,LYRA_DEFAULT_toolParamBooleanFalse,LYRA_DEFAULT_toolParamBooleanTrue,LYRA_DEFAULT_toolParamBooleanUnset,LYRA_DEFAULT_toolParamMissingProperty,LYRA_DEFAULT_toolParamSchemaLimit,LYRA_DEFAULT_unsupportedFieldType,LYRA_DEFAULT_valueMustBeSerializable}from"../../../internal/default-strings.generated.js";const MAX_SCHEMA_FIELDS=100,MAX_ENUM_OPTIONS=500,MAX_VALUE_ENTRIES=1e4,MAX_VALUE_NODES=5e4,MAX_VALUE_INSPECTIONS=MAX_VALUE_NODES*2,MAX_VALUE_DEPTH=16,OMIT_VALUE=Symbol("omit-tool-param-value"),LIMIT_VALUE=Symbol("limit-tool-param-value"),FUNCTION_TO_STRING=Function.prototype.toString,OBJECT_CONSTRUCTOR_SOURCE=FUNCTION_TO_STRING.call(Object);function isPlainRecord(value){try{const prototype=Object.getPrototypeOf(value);if(prototype===null)return!0;if(Object.getPrototypeOf(prototype)!==null)return!1;const constructorDescriptor=Object.getOwnPropertyDescriptor(prototype,"constructor");if(!constructorDescriptor||!("value"in constructorDescriptor)||typeof constructorDescriptor.value!="function")return!1;const constructor=constructorDescriptor.value,constructorPrototype=Object.getOwnPropertyDescriptor(constructor,"prototype");return!!(constructorPrototype&&"value"in constructorPrototype&&constructorPrototype.value===prototype&&FUNCTION_TO_STRING.call(constructor)===OBJECT_CONSTRUCTOR_SOURCE)}catch{return!1}}function checkpointSnapshot(budget){return{remaining:budget.remaining,seenEntries:budget.seenEntries.length,truncated:budget.truncated}}function restoreSnapshotCheckpoint(budget,checkpoint){for(budget.remaining=checkpoint.remaining,budget.truncated=checkpoint.truncated;budget.seenEntries.length>checkpoint.seenEntries;){const source=budget.seenEntries.pop();source&&budget.seen.delete(source)}}function rememberSnapshot(budget,source,output){budget.seen.set(source,output),budget.seenEntries.push(source)}function omitInvalidValue(budget,checkpoint){return restoreSnapshotCheckpoint(budget,checkpoint),budget.invalid=!0,OMIT_VALUE}function snapshotValueEntry(value,budget,depth){if(value===null||typeof value!="object"&&typeof value!="function")return value;const checkpoint=checkpointSnapshot(budget);if(typeof value=="function")return omitInvalidValue(budget,checkpoint);if(depth>MAX_VALUE_DEPTH||budget.remaining<=0)return budget.truncated=!0,LIMIT_VALUE;const existing=budget.seen.get(value);if(existing!==void 0)return existing;let isArray=!1;try{isArray=Array.isArray(value)}catch{return omitInvalidValue(budget,checkpoint)}if(isArray){if(budget.remainingInspections<=0)return budget.truncated=!0,LIMIT_VALUE;budget.remainingInspections-=1;const output2=[];rememberSnapshot(budget,value,output2);let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");if(descriptor&&"value"in descriptor&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=0)sourceLength=descriptor.value;else return omitInvalidValue(budget,checkpoint)}catch{return omitInvalidValue(budget,checkpoint)}sourceLength>MAX_VALUE_ENTRIES&&(budget.truncated=!0);const length=Math.min(sourceLength,MAX_VALUE_ENTRIES);let outputLength=length;for(let index=0;index<length;index+=1){if(budget.remaining<=0||budget.remainingInspections<=0){budget.truncated=!0,outputLength=index;break}budget.remainingInspections-=1;let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{budget.invalid=!0;continue}if(!descriptor)continue;if(!("value"in descriptor)){budget.invalid=!0;continue}const entryCheckpoint=checkpointSnapshot(budget);budget.remaining-=1;const entry=snapshotValueEntry(descriptor.value,budget,depth+1);if(entry===OMIT_VALUE){restoreSnapshotCheckpoint(budget,entryCheckpoint);continue}if(entry===LIMIT_VALUE){outputLength=index;break}Object.defineProperty(output2,String(index),{value:entry,enumerable:!0,configurable:!1,writable:!1})}return output2.length=outputLength,Object.freeze(output2)}if(!isPlainRecord(value))return omitInvalidValue(budget,checkpoint);const output={};rememberSnapshot(budget,value,output);let retained=0;try{for(const key in value){if(retained>=MAX_VALUE_ENTRIES||budget.remaining<=0||budget.remainingInspections<=0){budget.truncated=!0;break}budget.remainingInspections-=1;const descriptor=Object.getOwnPropertyDescriptor(value,key);if(!descriptor||!descriptor.enumerable)continue;if(!("value"in descriptor)){budget.invalid=!0;continue}const entryCheckpoint=checkpointSnapshot(budget);budget.remaining-=1;const entry=snapshotValueEntry(descriptor.value,budget,depth+1);if(entry===OMIT_VALUE){restoreSnapshotCheckpoint(budget,entryCheckpoint);continue}if(entry===LIMIT_VALUE)break;retained+=1,Object.defineProperty(output,key,{value:entry,enumerable:!0,configurable:!1,writable:!1})}}catch{return omitInvalidValue(budget,checkpoint)}return Object.freeze(output)}function snapshotFormValue(value){if(value==null)return{value:Object.freeze({}),invalid:!1,truncated:!1};let isArray=!1;try{isArray=Array.isArray(value)}catch{return{value:Object.freeze({}),invalid:!0,truncated:!1}}if(typeof value!="object"||isArray||!isPlainRecord(value))return{value:Object.freeze({}),invalid:!0,truncated:!1};const budget={remaining:MAX_VALUE_NODES,remainingInspections:MAX_VALUE_INSPECTIONS,seen:new WeakMap,seenEntries:[],invalid:!1,truncated:!1},snapshot=snapshotValueEntry(value,budget,0);return{value:snapshot===OMIT_VALUE||snapshot===LIMIT_VALUE?Object.freeze({}):snapshot,invalid:budget.invalid||snapshot===OMIT_VALUE,truncated:budget.truncated||snapshot===LIMIT_VALUE}}const EMPTY_SCHEMA=Object.freeze({type:"object",properties:Object.freeze({})});function snapshotSchemaStringArray(value){let isArray=!1;try{isArray=Array.isArray(value)}catch{return{isArray:!1,exceededLimit:!1}}if(!isArray)return{isArray:!1,exceededLimit:!1};let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");descriptor&&"value"in descriptor&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=0&&(sourceLength=descriptor.value)}catch{return{isArray:!0,value:Object.freeze([]),exceededLimit:!1}}const output=[];for(let index=0;index<Math.min(sourceLength,MAX_SCHEMA_FIELDS);index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}descriptor&&"value"in descriptor&&typeof descriptor.value=="string"&&output.push(descriptor.value)}return{isArray:!0,value:Object.freeze(output),exceededLimit:sourceLength>MAX_SCHEMA_FIELDS}}function snapshotSchemaEnum(value){let isArray=!1;try{isArray=Array.isArray(value)}catch{return{malformed:!0,exceededLimit:!1}}if(!isArray)return{malformed:!0,exceededLimit:!1};let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");if(!descriptor||!("value"in descriptor)||typeof descriptor.value!="number"||!Number.isSafeInteger(descriptor.value)||descriptor.value<0)return{malformed:!0,exceededLimit:!1};sourceLength=descriptor.value}catch{return{malformed:!0,exceededLimit:!1}}const output=[];for(let index=0;index<Math.min(sourceLength,MAX_ENUM_OPTIONS);index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{return{malformed:!0,exceededLimit:sourceLength>MAX_ENUM_OPTIONS}}if(descriptor){if(!("value"in descriptor)||typeof descriptor.value!="string")return{malformed:!0,exceededLimit:sourceLength>MAX_ENUM_OPTIONS};output.push(descriptor.value)}}return{value:Object.freeze(output),malformed:!1,exceededLimit:sourceLength>MAX_ENUM_OPTIONS}}function snapshotSchemaProperty(value){let descriptors;try{descriptors=Object.getOwnPropertyDescriptors(value)}catch{return{malformed:!0,exceededLimit:!1}}const withoutEnum={};let enumDescriptor;for(const key of Reflect.ownKeys(descriptors)){const descriptor=descriptors[key];if(descriptor?.enumerable){if(key==="enum"){enumDescriptor=descriptor;continue}if(!("value"in descriptor))return{malformed:!0,exceededLimit:!1};Object.defineProperty(withoutEnum,key,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1})}}const propertySnapshot=snapshotFormValue(withoutEnum);if(propertySnapshot.invalid||propertySnapshot.truncated)return{malformed:!0,exceededLimit:!1};let choices,exceededLimit=!1,hasEnum=!1;if(enumDescriptor){if(!("value"in enumDescriptor))return{malformed:!0,exceededLimit:!1};if(hasEnum=!0,enumDescriptor.value!==void 0){const enumSnapshot=snapshotSchemaEnum(enumDescriptor.value);if(enumSnapshot.malformed)return{malformed:!0,exceededLimit:enumSnapshot.exceededLimit};choices=enumSnapshot.value,exceededLimit=enumSnapshot.exceededLimit}}const output={};for(const key of Reflect.ownKeys(propertySnapshot.value)){const descriptor=Object.getOwnPropertyDescriptor(propertySnapshot.value,key);!descriptor?.enumerable||!("value"in descriptor)||Object.defineProperty(output,key,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1})}return hasEnum&&Object.defineProperty(output,"enum",{value:choices,enumerable:!0,configurable:!1,writable:!1}),{value:Object.freeze(output),malformed:!1,exceededLimit}}function snapshotSchema(value){if(value==null)return{schema:EMPTY_SCHEMA,shapeError:"",exceededLimits:!1};let isArray=!1;try{isArray=Array.isArray(value)}catch{return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1}}if(typeof value!="object"||isArray)return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1};let rootDescriptors;try{rootDescriptors=Object.getOwnPropertyDescriptors(value)}catch{return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1}}const typeDescriptor=rootDescriptors.type;if(!typeDescriptor||!("value"in typeDescriptor)||typeDescriptor.value!=="object")return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1};const propertiesDescriptor=rootDescriptors.properties,propertiesValue=propertiesDescriptor&&"value"in propertiesDescriptor?propertiesDescriptor.value:void 0;if(propertiesValue===null||typeof propertiesValue!="object"||!isPlainRecord(propertiesValue))return{schema:EMPTY_SCHEMA,shapeError:"properties",exceededLimits:!1};const properties=Object.create(null);let shapeError="",exceededLimits=!1,seenFields=0,propertyDescriptors;try{propertyDescriptors=Object.getOwnPropertyDescriptors(propertiesValue)}catch{return{schema:EMPTY_SCHEMA,shapeError:"properties",exceededLimits:!1}}for(const key of Reflect.ownKeys(propertyDescriptors)){const descriptor=propertyDescriptors[key];if(typeof key!="string"||!descriptor?.enumerable)continue;if(seenFields+=1,seenFields>MAX_SCHEMA_FIELDS){exceededLimits=!0;break}if(!("value"in descriptor)||descriptor.value===null||typeof descriptor.value!="object"||!isPlainRecord(descriptor.value)){shapeError="properties";continue}const propertySnapshot=snapshotSchemaProperty(descriptor.value);if(propertySnapshot.malformed||!propertySnapshot.value){shapeError="properties",propertySnapshot.exceededLimit&&(exceededLimits=!0);continue}propertySnapshot.exceededLimit&&(exceededLimits=!0),properties[key]=propertySnapshot.value}const requiredDescriptor=rootDescriptors.required;let required;if(requiredDescriptor&&"value"in requiredDescriptor){const requiredSnapshot=snapshotSchemaStringArray(requiredDescriptor.value);requiredSnapshot.isArray?(required=requiredSnapshot.value,requiredSnapshot.exceededLimit&&(exceededLimits=!0)):requiredDescriptor.enumerable&&(shapeError="properties")}else requiredDescriptor?.enumerable&&(shapeError="properties");return{schema:Object.freeze({type:"object",properties:Object.freeze(properties),...required===void 0?{}:{required}}),shapeError,exceededLimits}}function cloneFormValue(value,_ownerWindow){return snapshotFormValue(value).value}class LyraToolParamForm extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldMustBeBoolean:LYRA_DEFAULT_fieldMustBeBoolean,fieldMustBeInteger:LYRA_DEFAULT_fieldMustBeInteger,fieldMustBeNumber:LYRA_DEFAULT_fieldMustBeNumber,fieldMustBeOneOf:LYRA_DEFAULT_fieldMustBeOneOf,fieldMustBeString:LYRA_DEFAULT_fieldMustBeString,fieldMustEqual:LYRA_DEFAULT_fieldMustEqual,fieldRequired:LYRA_DEFAULT_fieldRequired,noData:LYRA_DEFAULT_noData,schemaMustBeObject:LYRA_DEFAULT_schemaMustBeObject,schemaPropertiesMustBeFlat:LYRA_DEFAULT_schemaPropertiesMustBeFlat,toolParamBooleanFalse:LYRA_DEFAULT_toolParamBooleanFalse,toolParamBooleanTrue:LYRA_DEFAULT_toolParamBooleanTrue,toolParamBooleanUnset:LYRA_DEFAULT_toolParamBooleanUnset,toolParamMissingProperty:LYRA_DEFAULT_toolParamMissingProperty,toolParamSchemaLimit:LYRA_DEFAULT_toolParamSchemaLimit,unsupportedFieldType:LYRA_DEFAULT_unsupportedFieldType,valueMustBeSerializable:LYRA_DEFAULT_valueMustBeSerializable}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-validity-change","lr-input"])}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0},schema:{attribute:!1,noAccessor:!0},value:{attribute:!1,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}constructor(){super(),this._errors={},this._formError="",this.showFormError=!1,this.touchedFields=new Set,this.baseId=nextId("tool-param-form"),this._fieldsetDisabled=!1,this._name="",this._schema=EMPTY_SCHEMA,this.schemaInputShapeError="",this.schemaInputExceededLimits=!1,this._value=Object.freeze({}),this.valueInputInvalid=!1,this.valueInputTruncated=!1,this.defaultValueSnapshot=Object.freeze({}),this.defaultValueCaptured=!1,this._effectiveValue=Object.freeze({}),this._validityFlags={},this._disabled=!1,this.hasInteracted=!1,this.visibleErrorSnapshot=new Map,this.suppressNextErrorAnnouncement=!0,this.markInteracted=()=>{this.hasInteracted||(this.hasInteracted=!0,this.syncValidityCustomStates())},this.stopNestedControlEvent=e=>{e.stopPropagation()},this.onFieldFocus=()=>{this.emit("focus")},this.onFieldBlur=()=>{this.emit("blur")},this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),installInteractionOnInvalid(this,this.markInteracted),this.syncFormState()}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}[VALIDITY_ANCHOR](){const field=this.firstInvalidField();if(field){const input=field.querySelector("input.control");if(input)return input;for(const child of field.children){const anchor=resolveValidityAnchor(child);if(anchor)return anchor}}return this.firstMissingPropertyError()}firstInvalidField(){if(!this.renderRoot)return;const fields=Array.from(this.renderRoot.querySelectorAll('[part="field"]'));for(const key of Object.keys(this._errors)){const field=fields.find(candidate=>candidate.dataset.key===key);if(field)return field}}get missingRequiredKeys(){const properties=this.schemaProperties;return this.requiredKeys.filter(key=>!Object.prototype.hasOwnProperty.call(properties,key)&&!!this._errors[key])}firstMissingPropertyError(){if(!this.renderRoot)return;const errors=Array.from(this.renderRoot.querySelectorAll('[part="error"][data-missing-property]'));for(const key of Object.keys(this._errors)){const error=errors.find(candidate=>candidate.dataset.key===key);if(error)return error}}focusFirstControl(){if(!this.renderRoot)return;const controls=this.renderRoot.querySelectorAll("input.control, lr-select");for(const control of controls)if(!(control.disabled||control.getAttribute("aria-disabled")==="true")){control.focus();return}}click(){this.effectiveDisabled||this.focusFirstControl()}connectedCallback(){this.defaultValueCaptured||(this.defaultValueSnapshot=cloneFormValue(this._value,this.ownerDocument.defaultView),this.defaultValueCaptured=!0),super.connectedCallback(),this.errorAnnouncementSink?.element.ownerDocument!==this.ownerDocument&&(this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this})),this.hasUpdated&&(this.suppressNextErrorAnnouncement=!0,this.requestUpdate()),this.syncFormState()}disconnectedCallback(){super.disconnectedCallback(),this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=void 0,this.suppressNextErrorAnnouncement=!0}get effectiveValue(){return snapshotFormValue(this._effectiveValue).value}get schemaProperties(){return this._schema.properties}get requiredKeys(){return this._schema.required??Object.freeze([])}resolveEffectiveValue(){const props=this.schemaProperties,out={...this.value};for(const[key,prop]of Object.entries(props))!Object.prototype.hasOwnProperty.call(this.value,key)&&prop.default!==void 0&&Object.defineProperty(out,key,{configurable:!0,enumerable:!0,writable:!0,value:prop.default});return snapshotFormValue(out).value}get schema(){return this._schema}set schema(next){const old=this._schema,snapshot=snapshotSchema(next);this._schema=snapshot.schema,this.schemaInputShapeError=snapshot.shapeError,this.schemaInputExceededLimits=snapshot.exceededLimits,this.syncFormState(),this.requestUpdate("schema",old)}get value(){return this._value}set value(next){const old=this._value,snapshot=snapshotFormValue(next);this._value=snapshot.value,this.valueInputInvalid=snapshot.invalid,this.valueInputTruncated=snapshot.truncated,this.syncFormState(),this.requestUpdate("value",old)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.requestUpdate("name",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.applyValidity(),this.requestUpdate("disabled",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}get errors(){return this.publicValidityErrors()}publicValidityErrors(){const errors={...this._errors};return this.willValidate&&(this.validityController.customValidityMessage||this._formError)&&(errors.base=this.validationMessage),Object.freeze(errors)}publishValiditySnapshot(){if(!this.isConnected)return;const valid=!this.willValidate||this.validity.valid,errors=valid?Object.freeze({}):this.publicValidityErrors(),key=JSON.stringify({valid,errors});key!==this.lastValidityKey&&(this.lastValidityKey=key,this.emit("lr-validity-change",Object.freeze({valid,errors})))}get formError(){return this._formError}computeValidation(effective){const props=this.schemaProperties,required=new Set(this.requiredKeys),out={},flags={},addError=(key,message)=>{Object.defineProperty(out,key,{configurable:!0,enumerable:!0,writable:!0,value:message})};for(const[key,prop]of Object.entries(props)){const type=prop?.type;if(type!=="string"&&type!=="number"&&type!=="integer"&&type!=="boolean"){addError(key,this.localize("unsupportedFieldType",void 0,{type:String(type)})),flags.customError=!0;continue}if(!(Object.prototype.hasOwnProperty.call(effective,key)&&effective[key]!==void 0)){required.has(key)&&(addError(key,this.localize("fieldRequired")),flags.valueMissing=!0);continue}const v=effective[key];if(type==="string"&&typeof v!="string"){addError(key,this.localize("fieldMustBeString")),flags.typeMismatch=!0;continue}if(type==="number"&&(typeof v!="number"||!Number.isFinite(v))){addError(key,this.localize("fieldMustBeNumber")),flags.typeMismatch=!0;continue}if(type==="integer"&&(typeof v!="number"||!Number.isFinite(v))){addError(key,this.localize("fieldMustBeInteger")),flags.typeMismatch=!0;continue}if(type==="integer"&&!Number.isInteger(v)){addError(key,this.localize("fieldMustBeInteger")),flags.stepMismatch=!0;continue}if(type==="boolean"&&typeof v!="boolean"){addError(key,this.localize("fieldMustBeBoolean")),flags.typeMismatch=!0;continue}if(type==="string"&&Array.isArray(prop.enum)&&!prop.enum.includes(v)){addError(key,this.localize("fieldMustBeOneOf",void 0,{values:getListFormat(this.effectiveLocale,{style:"long",type:"disjunction"}).format(prop.enum)})),flags.customError=!0;continue}prop.const!==void 0&&v!==prop.const&&(addError(key,this.localize("fieldMustEqual",void 0,{value:JSON.stringify(prop.const)})),flags.customError=!0)}for(const key of required)Object.prototype.hasOwnProperty.call(props,key)||(!Object.prototype.hasOwnProperty.call(effective,key)||effective[key]===void 0)&&(addError(key,this.localize("fieldRequired")),flags.valueMissing=!0);return{errors:out,flags}}checkValidity(){return this.syncFormState(),withStaticValidityCheck(this,()=>this.internals.checkValidity())}reportValidity(){this.hasInteracted=!0,this.syncFormState(),Object.keys(this._errors).length>0&&(this.touchedFields=new Set([...this.touchedFields,...Object.keys(this._errors)])),this._formError&&(this.showFormError=!0),this.requestUpdate();const valid=this.internals.reportValidity();return!valid&&!this.firstInvalidField()&&this.missingRequiredKeys.length>0&&this.updateComplete.then(()=>{const error=this.firstMissingPropertyError();this.validityController.refreshAnchor(),error?.focus()}),valid}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncValidityCustomStates(),this.publishValiditySnapshot(),this.requestUpdate()}formResetCallback(){this.hasInteracted=!1,this.value=cloneFormValue(this.defaultValueSnapshot,this.ownerDocument.defaultView),this.touchedFields=new Set,this.showFormError=!1}formStateRestoreCallback(state2,_mode){let restored={};if(typeof state2=="string")try{const parsed=JSON.parse(state2);parsed!==null&&typeof parsed=="object"&&!Array.isArray(parsed)&&(restored=parsed)}catch{}this.value=restored}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,this.applyValidity(),this.requestUpdate()}schemaShapeError(){return this.schemaInputShapeError==="object"?this.localize("schemaMustBeObject"):this.schemaInputShapeError==="properties"?this.localize("schemaPropertiesMustBeFlat"):this.schemaInputExceededLimits?this.localize("toolParamSchemaLimit",void 0,{fields:getNumberFormat(this.effectiveLocale).format(MAX_SCHEMA_FIELDS),options:getNumberFormat(this.effectiveLocale).format(MAX_ENUM_OPTIONS)}):""}serializeEffectiveValue(effective){const serialized=JSON.stringify(effective,(_key,value)=>{if(typeof value=="number"&&!Number.isFinite(value))throw new TypeError("Non-finite numbers are not JSON values.");return value});if(typeof serialized!="string")throw new TypeError("Value did not serialize to JSON.");return serialized}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}syncInternals(formValue){this.internals.setFormValue(formValue,formValue),this.applyValidity()}applyValidity(){if(this.validityController){if(this.barredFromValidation||Object.keys(this._validityFlags).length===0)this.validityController.setValidity({});else{const firstMessage=Object.values(this._errors)[0]??this._formError;this.validityController.setValidity(this._validityFlags,firstMessage)}this.syncValidityCustomStates(),this.publishValiditySnapshot()}}syncValidityCustomStates(){syncValidityStates(this.internals,{required:this.requiredKeys.length>0,hasInteracted:this.hasInteracted,barred:this.barredFromValidation})}syncFormState(){let effective=Object.freeze({}),errors={},flags={},formError="",formValue=null;try{if(formError=this.schemaShapeError(),this.valueInputInvalid||this.valueInputTruncated)throw new TypeError("The value could not be retained within the public snapshot boundary.");effective=this.resolveEffectiveValue();const validation=this.computeValidation(effective);errors=validation.errors,flags=validation.flags,formValue=this.serializeEffectiveValue(effective)}catch{formError=this.localize("valueMustBeSerializable"),formValue=null}formError&&(flags.customError=!0,formValue=null),this._effectiveValue=effective,JSON.stringify(this._errors)!==JSON.stringify(errors)&&(this._errors=errors),this._formError=formError,this._validityFlags=flags,this.syncInternals(formValue)}updated(changed){if(super.updated(changed),this.publishValiditySnapshot(),changed.has("value")||changed.has("schema")||changed.has("_errors")||changed.has("_formError")){const nestedUpdates=Array.from(this.firstInvalidField()?.children??[]).filter(element=>typeof element[VALIDITY_ANCHOR]=="function").map(element=>element.updateComplete).filter(update=>update!==void 0);nestedUpdates.length>0&&Promise.all(nestedUpdates).then(()=>this.validityController.refreshAnchor())}const currentErrors=new Map;for(const node of this.renderRoot.querySelectorAll('[part="error"]')){const fieldKey=node.closest('[part~="field"]')?.dataset.key,key=node.dataset.key??fieldKey??"form",text=node.textContent?.trim()??"";text&¤tErrors.set(key,text)}if(!this.suppressNextErrorAnnouncement){const freshMessages=[];for(const[key,text]of currentErrors)this.visibleErrorSnapshot.get(key)!==text&&!freshMessages.includes(text)&&freshMessages.push(text);freshMessages.length>0&&this.errorAnnouncementSink?.announce(freshMessages.join(" "))}this.visibleErrorSnapshot=currentErrors,this.suppressNextErrorAnnouncement=!1}setFieldValue(key,val){this.effectiveDisabled||(this.hasInteracted=!0,this.value={...this.value,[key]:val},this.emit("lr-input",{value:this.effectiveValue}))}markTouched(key){this.hasInteracted=!0,this.syncValidityCustomStates(),!this.touchedFields.has(key)&&(this.touchedFields=new Set(this.touchedFields).add(key))}onTextInput(key,e){this.setFieldValue(key,e.target.value)}onNumberInput(key,e){e.stopPropagation();const n=e.target.valueAsNumber;this.setFieldValue(key,Number.isNaN(n)?void 0:n)}onSelectChange(key,e){e.stopPropagation(),this.setFieldValue(key,e.target.value)}onBooleanSelectChange(key,e){e.stopPropagation();const value=e.target.value;if(value===""){if(this.effectiveDisabled)return;if(this.hasInteracted=!0,this.schemaProperties[key]?.default!==void 0)this.value={...this.value,[key]:void 0};else{const next={...this.value};Reflect.deleteProperty(next,key),this.value=next}this.emit("lr-input",{value:this.effectiveValue});return}this.setFieldValue(key,value==="true")}renderControl(key,prop,fieldId,label,required,describedBy,errorMessage,effective){if(prop.type==="string"&&prop.enum&&prop.enum.length>0)return html`<lr-select
|
|
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,nothing}from"lit";import{state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{nextId}from"../../../internal/a11y.js";import{AnchoredValidityController,resolveValidityAnchor,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{styles}from"./tool-param-form.styles.js";import"../../forms/select/select.class.js";import"../../forms/combobox/option.class.js";import"../../forms/input/number-input.class.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInteractionOnInvalid,installInvalidEventAlias,withStaticValidityCheck}from"../../../internal/invalid-event-alias.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{LYRA_DEFAULT_fieldMustBeBoolean,LYRA_DEFAULT_fieldMustBeInteger,LYRA_DEFAULT_fieldMustBeNumber,LYRA_DEFAULT_fieldMustBeOneOf,LYRA_DEFAULT_fieldMustBeString,LYRA_DEFAULT_fieldMustEqual,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_noData,LYRA_DEFAULT_schemaMustBeObject,LYRA_DEFAULT_schemaPropertiesMustBeFlat,LYRA_DEFAULT_toolParamBooleanFalse,LYRA_DEFAULT_toolParamBooleanTrue,LYRA_DEFAULT_toolParamBooleanUnset,LYRA_DEFAULT_toolParamMissingProperty,LYRA_DEFAULT_toolParamSchemaLimit,LYRA_DEFAULT_unsupportedFieldType,LYRA_DEFAULT_valueMustBeSerializable}from"../../../internal/default-strings.generated.js";const MAX_SCHEMA_FIELDS=100,MAX_ENUM_OPTIONS=500,MAX_VALUE_ENTRIES=1e4,MAX_VALUE_NODES=5e4,MAX_VALUE_INSPECTIONS=MAX_VALUE_NODES*2,MAX_VALUE_DEPTH=16,OMIT_VALUE=Symbol("omit-tool-param-value"),LIMIT_VALUE=Symbol("limit-tool-param-value"),FUNCTION_TO_STRING=Function.prototype.toString,OBJECT_CONSTRUCTOR_SOURCE=FUNCTION_TO_STRING.call(Object);function isPlainRecord(value){try{const prototype=Object.getPrototypeOf(value);if(prototype===null)return!0;if(Object.getPrototypeOf(prototype)!==null)return!1;const constructorDescriptor=Object.getOwnPropertyDescriptor(prototype,"constructor");if(!constructorDescriptor||!("value"in constructorDescriptor)||typeof constructorDescriptor.value!="function")return!1;const constructor=constructorDescriptor.value,constructorPrototype=Object.getOwnPropertyDescriptor(constructor,"prototype");return!!(constructorPrototype&&"value"in constructorPrototype&&constructorPrototype.value===prototype&&FUNCTION_TO_STRING.call(constructor)===OBJECT_CONSTRUCTOR_SOURCE)}catch{return!1}}function checkpointSnapshot(budget){return{remaining:budget.remaining,seenEntries:budget.seenEntries.length,truncated:budget.truncated}}function restoreSnapshotCheckpoint(budget,checkpoint){for(budget.remaining=checkpoint.remaining,budget.truncated=checkpoint.truncated;budget.seenEntries.length>checkpoint.seenEntries;){const source=budget.seenEntries.pop();source&&budget.seen.delete(source)}}function rememberSnapshot(budget,source,output){budget.seen.set(source,output),budget.seenEntries.push(source)}function omitInvalidValue(budget,checkpoint){return restoreSnapshotCheckpoint(budget,checkpoint),budget.invalid=!0,OMIT_VALUE}function snapshotValueEntry(value,budget,depth){if(value===null||typeof value!="object"&&typeof value!="function")return value;const checkpoint=checkpointSnapshot(budget);if(typeof value=="function")return omitInvalidValue(budget,checkpoint);if(depth>MAX_VALUE_DEPTH||budget.remaining<=0)return budget.truncated=!0,LIMIT_VALUE;const existing=budget.seen.get(value);if(existing!==void 0)return existing;let isArray=!1;try{isArray=Array.isArray(value)}catch{return omitInvalidValue(budget,checkpoint)}if(isArray){if(budget.remainingInspections<=0)return budget.truncated=!0,LIMIT_VALUE;budget.remainingInspections-=1;const output2=[];rememberSnapshot(budget,value,output2);let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");if(descriptor&&"value"in descriptor&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=0)sourceLength=descriptor.value;else return omitInvalidValue(budget,checkpoint)}catch{return omitInvalidValue(budget,checkpoint)}sourceLength>MAX_VALUE_ENTRIES&&(budget.truncated=!0);const length=Math.min(sourceLength,MAX_VALUE_ENTRIES);let outputLength=length;for(let index=0;index<length;index+=1){if(budget.remaining<=0||budget.remainingInspections<=0){budget.truncated=!0,outputLength=index;break}budget.remainingInspections-=1;let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{budget.invalid=!0;continue}if(!descriptor)continue;if(!("value"in descriptor)){budget.invalid=!0;continue}const entryCheckpoint=checkpointSnapshot(budget);budget.remaining-=1;const entry=snapshotValueEntry(descriptor.value,budget,depth+1);if(entry===OMIT_VALUE){restoreSnapshotCheckpoint(budget,entryCheckpoint);continue}if(entry===LIMIT_VALUE){outputLength=index;break}Object.defineProperty(output2,String(index),{value:entry,enumerable:!0,configurable:!1,writable:!1})}return output2.length=outputLength,Object.freeze(output2)}if(!isPlainRecord(value))return omitInvalidValue(budget,checkpoint);const output={};rememberSnapshot(budget,value,output);let retained=0;try{for(const key in value){if(retained>=MAX_VALUE_ENTRIES||budget.remaining<=0||budget.remainingInspections<=0){budget.truncated=!0;break}budget.remainingInspections-=1;const descriptor=Object.getOwnPropertyDescriptor(value,key);if(!descriptor||!descriptor.enumerable)continue;if(!("value"in descriptor)){budget.invalid=!0;continue}const entryCheckpoint=checkpointSnapshot(budget);budget.remaining-=1;const entry=snapshotValueEntry(descriptor.value,budget,depth+1);if(entry===OMIT_VALUE){restoreSnapshotCheckpoint(budget,entryCheckpoint);continue}if(entry===LIMIT_VALUE)break;retained+=1,Object.defineProperty(output,key,{value:entry,enumerable:!0,configurable:!1,writable:!1})}}catch{return omitInvalidValue(budget,checkpoint)}return Object.freeze(output)}function snapshotFormValue(value){if(value==null)return{value:Object.freeze({}),invalid:!1,truncated:!1};let isArray=!1;try{isArray=Array.isArray(value)}catch{return{value:Object.freeze({}),invalid:!0,truncated:!1}}if(typeof value!="object"||isArray||!isPlainRecord(value))return{value:Object.freeze({}),invalid:!0,truncated:!1};const budget={remaining:MAX_VALUE_NODES,remainingInspections:MAX_VALUE_INSPECTIONS,seen:new WeakMap,seenEntries:[],invalid:!1,truncated:!1},snapshot=snapshotValueEntry(value,budget,0);return{value:snapshot===OMIT_VALUE||snapshot===LIMIT_VALUE?Object.freeze({}):snapshot,invalid:budget.invalid||snapshot===OMIT_VALUE,truncated:budget.truncated||snapshot===LIMIT_VALUE}}const EMPTY_SCHEMA=Object.freeze({type:"object",properties:Object.freeze({})});function snapshotSchemaStringArray(value){let isArray=!1;try{isArray=Array.isArray(value)}catch{return{isArray:!1,exceededLimit:!1}}if(!isArray)return{isArray:!1,exceededLimit:!1};let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");descriptor&&"value"in descriptor&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=0&&(sourceLength=descriptor.value)}catch{return{isArray:!0,value:Object.freeze([]),exceededLimit:!1}}const output=[];for(let index=0;index<Math.min(sourceLength,MAX_SCHEMA_FIELDS);index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}descriptor&&"value"in descriptor&&typeof descriptor.value=="string"&&output.push(descriptor.value)}return{isArray:!0,value:Object.freeze(output),exceededLimit:sourceLength>MAX_SCHEMA_FIELDS}}function snapshotSchemaEnum(value){let isArray=!1;try{isArray=Array.isArray(value)}catch{return{malformed:!0,exceededLimit:!1}}if(!isArray)return{malformed:!0,exceededLimit:!1};let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");if(!descriptor||!("value"in descriptor)||typeof descriptor.value!="number"||!Number.isSafeInteger(descriptor.value)||descriptor.value<0)return{malformed:!0,exceededLimit:!1};sourceLength=descriptor.value}catch{return{malformed:!0,exceededLimit:!1}}const output=[];for(let index=0;index<Math.min(sourceLength,MAX_ENUM_OPTIONS);index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{return{malformed:!0,exceededLimit:sourceLength>MAX_ENUM_OPTIONS}}if(descriptor){if(!("value"in descriptor)||typeof descriptor.value!="string")return{malformed:!0,exceededLimit:sourceLength>MAX_ENUM_OPTIONS};output.push(descriptor.value)}}return{value:Object.freeze(output),malformed:!1,exceededLimit:sourceLength>MAX_ENUM_OPTIONS}}function snapshotSchemaProperty(value){let descriptors;try{descriptors=Object.getOwnPropertyDescriptors(value)}catch{return{malformed:!0,exceededLimit:!1}}const withoutEnum={};let enumDescriptor;for(const key of Reflect.ownKeys(descriptors)){const descriptor=descriptors[key];if(descriptor?.enumerable){if(key==="enum"){enumDescriptor=descriptor;continue}if(!("value"in descriptor))return{malformed:!0,exceededLimit:!1};Object.defineProperty(withoutEnum,key,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1})}}const propertySnapshot=snapshotFormValue(withoutEnum);if(propertySnapshot.invalid||propertySnapshot.truncated)return{malformed:!0,exceededLimit:!1};let choices,exceededLimit=!1,hasEnum=!1;if(enumDescriptor){if(!("value"in enumDescriptor))return{malformed:!0,exceededLimit:!1};if(hasEnum=!0,enumDescriptor.value!==void 0){const enumSnapshot=snapshotSchemaEnum(enumDescriptor.value);if(enumSnapshot.malformed)return{malformed:!0,exceededLimit:enumSnapshot.exceededLimit};choices=enumSnapshot.value,exceededLimit=enumSnapshot.exceededLimit}}const output={};for(const key of Reflect.ownKeys(propertySnapshot.value)){const descriptor=Object.getOwnPropertyDescriptor(propertySnapshot.value,key);!descriptor?.enumerable||!("value"in descriptor)||Object.defineProperty(output,key,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1})}return hasEnum&&Object.defineProperty(output,"enum",{value:choices,enumerable:!0,configurable:!1,writable:!1}),{value:Object.freeze(output),malformed:!1,exceededLimit}}function snapshotSchema(value){if(value==null)return{schema:EMPTY_SCHEMA,shapeError:"",exceededLimits:!1};let isArray=!1;try{isArray=Array.isArray(value)}catch{return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1}}if(typeof value!="object"||isArray)return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1};let rootDescriptors;try{rootDescriptors=Object.getOwnPropertyDescriptors(value)}catch{return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1}}const typeDescriptor=rootDescriptors.type;if(!typeDescriptor||!("value"in typeDescriptor)||typeDescriptor.value!=="object")return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1};const propertiesDescriptor=rootDescriptors.properties,propertiesValue=propertiesDescriptor&&"value"in propertiesDescriptor?propertiesDescriptor.value:void 0;if(propertiesValue===null||typeof propertiesValue!="object"||!isPlainRecord(propertiesValue))return{schema:EMPTY_SCHEMA,shapeError:"properties",exceededLimits:!1};const properties=Object.create(null);let shapeError="",exceededLimits=!1,seenFields=0,propertyDescriptors;try{propertyDescriptors=Object.getOwnPropertyDescriptors(propertiesValue)}catch{return{schema:EMPTY_SCHEMA,shapeError:"properties",exceededLimits:!1}}for(const key of Reflect.ownKeys(propertyDescriptors)){const descriptor=propertyDescriptors[key];if(typeof key!="string"||!descriptor?.enumerable)continue;if(seenFields+=1,seenFields>MAX_SCHEMA_FIELDS){exceededLimits=!0;break}if(!("value"in descriptor)||descriptor.value===null||typeof descriptor.value!="object"||!isPlainRecord(descriptor.value)){shapeError="properties";continue}const propertySnapshot=snapshotSchemaProperty(descriptor.value);if(propertySnapshot.malformed||!propertySnapshot.value){shapeError="properties",propertySnapshot.exceededLimit&&(exceededLimits=!0);continue}propertySnapshot.exceededLimit&&(exceededLimits=!0),properties[key]=propertySnapshot.value}const requiredDescriptor=rootDescriptors.required;let required;if(requiredDescriptor&&"value"in requiredDescriptor){const requiredSnapshot=snapshotSchemaStringArray(requiredDescriptor.value);requiredSnapshot.isArray?(required=requiredSnapshot.value,requiredSnapshot.exceededLimit&&(exceededLimits=!0)):requiredDescriptor.enumerable&&(shapeError="properties")}else requiredDescriptor?.enumerable&&(shapeError="properties");return{schema:Object.freeze({type:"object",properties:Object.freeze(properties),...required===void 0?{}:{required}}),shapeError,exceededLimits}}function cloneFormValue(value,_ownerWindow){return snapshotFormValue(value).value}class LyraToolParamForm extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldMustBeBoolean:LYRA_DEFAULT_fieldMustBeBoolean,fieldMustBeInteger:LYRA_DEFAULT_fieldMustBeInteger,fieldMustBeNumber:LYRA_DEFAULT_fieldMustBeNumber,fieldMustBeOneOf:LYRA_DEFAULT_fieldMustBeOneOf,fieldMustBeString:LYRA_DEFAULT_fieldMustBeString,fieldMustEqual:LYRA_DEFAULT_fieldMustEqual,fieldRequired:LYRA_DEFAULT_fieldRequired,noData:LYRA_DEFAULT_noData,schemaMustBeObject:LYRA_DEFAULT_schemaMustBeObject,schemaPropertiesMustBeFlat:LYRA_DEFAULT_schemaPropertiesMustBeFlat,toolParamBooleanFalse:LYRA_DEFAULT_toolParamBooleanFalse,toolParamBooleanTrue:LYRA_DEFAULT_toolParamBooleanTrue,toolParamBooleanUnset:LYRA_DEFAULT_toolParamBooleanUnset,toolParamMissingProperty:LYRA_DEFAULT_toolParamMissingProperty,toolParamSchemaLimit:LYRA_DEFAULT_toolParamSchemaLimit,unsupportedFieldType:LYRA_DEFAULT_unsupportedFieldType,valueMustBeSerializable:LYRA_DEFAULT_valueMustBeSerializable}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-validity-change","lr-input"])}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0},schema:{attribute:!1,noAccessor:!0},value:{attribute:!1,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}constructor(){super(),this._errors={},this._formError="",this.showFormError=!1,this.touchedFields=new Set,this.baseId=nextId("tool-param-form"),this._fieldsetDisabled=!1,this._name="",this._schema=EMPTY_SCHEMA,this.schemaInputShapeError="",this.schemaInputExceededLimits=!1,this._value=Object.freeze({}),this.valueInputInvalid=!1,this.valueInputTruncated=!1,this.defaultValueSnapshot=Object.freeze({}),this.defaultValueCaptured=!1,this._effectiveValue=Object.freeze({}),this._validityFlags={},this._disabled=!1,this.hasInteracted=!1,this.visibleErrorSnapshot=new Map,this.suppressNextErrorAnnouncement=!0,this.markInteracted=()=>{this.hasInteracted||(this.hasInteracted=!0,this.syncValidityCustomStates())},this.stopNestedControlEvent=e=>{e.stopPropagation()},this.onFieldFocus=()=>{this.emit("focus")},this.onFieldBlur=()=>{this.emit("blur")},this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),installInteractionOnInvalid(this,this.markInteracted),this.syncFormState()}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}[VALIDITY_ANCHOR](){const field=this.firstInvalidField();if(field){const input=field.querySelector("input.control");if(input)return input;for(const child of field.children){const anchor=resolveValidityAnchor(child);if(anchor)return anchor}}return this.firstMissingPropertyError()}firstInvalidField(){if(!this.renderRoot)return;const fields=Array.from(this.renderRoot.querySelectorAll('[part="field"]'));for(const key of Object.keys(this._errors)){const field=fields.find(candidate=>candidate.dataset.key===key);if(field)return field}}get missingRequiredKeys(){const properties=this.schemaProperties;return this.requiredKeys.filter(key=>!Object.prototype.hasOwnProperty.call(properties,key)&&!!this._errors[key])}firstMissingPropertyError(){if(!this.renderRoot)return;const errors=Array.from(this.renderRoot.querySelectorAll('[part="error"][data-missing-property]'));for(const key of Object.keys(this._errors)){const error=errors.find(candidate=>candidate.dataset.key===key);if(error)return error}}focusFirstControl(options){if(!this.renderRoot)return;const controls=this.renderRoot.querySelectorAll("input.control, lr-select");for(const control of controls)if(!(control.disabled||control.getAttribute("aria-disabled")==="true")){control.focus(options);return}}click(){this.effectiveDisabled||this.focusFirstControl()}focus(options){this.effectiveDisabled||this.focusFirstControl(options)}blur(){const active=deepActiveElementIn(this.shadowRoot);active&&typeof active.blur=="function"&&active.blur()}connectedCallback(){this.defaultValueCaptured||(this.defaultValueSnapshot=cloneFormValue(this._value,this.ownerDocument.defaultView),this.defaultValueCaptured=!0),super.connectedCallback(),this.errorAnnouncementSink?.element.ownerDocument!==this.ownerDocument&&(this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this})),this.hasUpdated&&(this.suppressNextErrorAnnouncement=!0,this.requestUpdate()),this.syncFormState()}disconnectedCallback(){super.disconnectedCallback(),this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=void 0,this.suppressNextErrorAnnouncement=!0}get effectiveValue(){return snapshotFormValue(this._effectiveValue).value}get schemaProperties(){return this._schema.properties}get requiredKeys(){return this._schema.required??Object.freeze([])}resolveEffectiveValue(){const props=this.schemaProperties,out={...this.value};for(const[key,prop]of Object.entries(props)){const fallback=prop.const!==void 0?prop.const:prop.default;!Object.prototype.hasOwnProperty.call(this.value,key)&&fallback!==void 0&&Object.defineProperty(out,key,{configurable:!0,enumerable:!0,writable:!0,value:fallback})}return snapshotFormValue(out).value}get schema(){return this._schema}set schema(next){const old=this._schema,snapshot=snapshotSchema(next);this._schema=snapshot.schema,this.schemaInputShapeError=snapshot.shapeError,this.schemaInputExceededLimits=snapshot.exceededLimits,this.syncFormState(),this.requestUpdate("schema",old)}get value(){return this._value}set value(next){const old=this._value,snapshot=snapshotFormValue(next);this._value=snapshot.value,this.valueInputInvalid=snapshot.invalid,this.valueInputTruncated=snapshot.truncated,this.syncFormState(),this.requestUpdate("value",old)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.requestUpdate("name",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.applyValidity(),this.requestUpdate("disabled",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}get errors(){return this.publicValidityErrors()}publicValidityErrors(){const errors={...this._errors};return this.willValidate&&(this.validityController.customValidityMessage||this._formError)&&(errors.base=this.validationMessage),Object.freeze(errors)}publishValiditySnapshot(){if(!this.isConnected)return;const valid=!this.willValidate||this.validity.valid,errors=valid?Object.freeze({}):this.publicValidityErrors(),key=JSON.stringify({valid,errors});key!==this.lastValidityKey&&(this.lastValidityKey=key,this.emit("lr-validity-change",Object.freeze({valid,errors})))}get formError(){return this._formError}computeValidation(effective){const props=this.schemaProperties,required=new Set(this.requiredKeys),out={},flags={},addError=(key,message)=>{Object.defineProperty(out,key,{configurable:!0,enumerable:!0,writable:!0,value:message})};for(const[key,prop]of Object.entries(props)){const type=prop?.type;if(type!=="string"&&type!=="number"&&type!=="integer"&&type!=="boolean"){addError(key,this.localize("unsupportedFieldType",void 0,{type:String(type)})),flags.customError=!0;continue}if(!(Object.prototype.hasOwnProperty.call(effective,key)&&effective[key]!==void 0)){required.has(key)&&(addError(key,this.localize("fieldRequired")),flags.valueMissing=!0);continue}const v=effective[key];if(type==="string"&&typeof v!="string"){addError(key,this.localize("fieldMustBeString")),flags.typeMismatch=!0;continue}if(type==="number"&&(typeof v!="number"||!Number.isFinite(v))){addError(key,this.localize("fieldMustBeNumber")),flags.typeMismatch=!0;continue}if(type==="integer"&&(typeof v!="number"||!Number.isFinite(v))){addError(key,this.localize("fieldMustBeInteger")),flags.typeMismatch=!0;continue}if(type==="integer"&&!Number.isInteger(v)){addError(key,this.localize("fieldMustBeInteger")),flags.stepMismatch=!0;continue}if(type==="boolean"&&typeof v!="boolean"){addError(key,this.localize("fieldMustBeBoolean")),flags.typeMismatch=!0;continue}if(type==="string"&&Array.isArray(prop.enum)&&!prop.enum.includes(v)){addError(key,this.localize("fieldMustBeOneOf",void 0,{values:getListFormat(this.effectiveLocale,{style:"long",type:"disjunction"}).format(prop.enum)})),flags.customError=!0;continue}prop.const!==void 0&&v!==prop.const&&(addError(key,this.localize("fieldMustEqual",void 0,{value:JSON.stringify(prop.const)})),flags.customError=!0)}for(const key of required)Object.prototype.hasOwnProperty.call(props,key)||(!Object.prototype.hasOwnProperty.call(effective,key)||effective[key]===void 0)&&(addError(key,this.localize("fieldRequired")),flags.valueMissing=!0);return{errors:out,flags}}checkValidity(){return this.syncFormState(),withStaticValidityCheck(this,()=>this.internals.checkValidity())}reportValidity(){this.hasInteracted=!0,this.syncFormState(),Object.keys(this._errors).length>0&&(this.touchedFields=new Set([...this.touchedFields,...Object.keys(this._errors)])),this._formError&&(this.showFormError=!0),this.requestUpdate();const valid=this.internals.reportValidity();return!valid&&!this.firstInvalidField()&&this.missingRequiredKeys.length>0&&this.updateComplete.then(()=>{const error=this.firstMissingPropertyError();this.validityController.refreshAnchor(),error?.focus()}),valid}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncValidityCustomStates(),this.publishValiditySnapshot(),this.requestUpdate()}formResetCallback(){this.hasInteracted=!1,this.value=cloneFormValue(this.defaultValueSnapshot,this.ownerDocument.defaultView),this.touchedFields=new Set,this.showFormError=!1}formStateRestoreCallback(state2,_mode){let restored={};if(typeof state2=="string")try{const parsed=JSON.parse(state2);parsed!==null&&typeof parsed=="object"&&!Array.isArray(parsed)&&(restored=parsed)}catch{}this.value=restored}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,this.applyValidity(),this.requestUpdate()}schemaShapeError(){return this.schemaInputShapeError==="object"?this.localize("schemaMustBeObject"):this.schemaInputShapeError==="properties"?this.localize("schemaPropertiesMustBeFlat"):this.schemaInputExceededLimits?this.localize("toolParamSchemaLimit",void 0,{fields:getNumberFormat(this.effectiveLocale).format(MAX_SCHEMA_FIELDS),options:getNumberFormat(this.effectiveLocale).format(MAX_ENUM_OPTIONS)}):""}serializeEffectiveValue(effective){const serialized=JSON.stringify(effective,(_key,value)=>{if(typeof value=="number"&&!Number.isFinite(value))throw new TypeError("Non-finite numbers are not JSON values.");return value});if(typeof serialized!="string")throw new TypeError("Value did not serialize to JSON.");return serialized}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}syncInternals(formValue){this.internals.setFormValue(formValue,formValue),this.applyValidity()}applyValidity(){if(this.validityController){if(this.barredFromValidation||Object.keys(this._validityFlags).length===0)this.validityController.setValidity({});else{const firstMessage=Object.values(this._errors)[0]??this._formError;this.validityController.setValidity(this._validityFlags,firstMessage)}this.syncValidityCustomStates(),this.publishValiditySnapshot()}}syncValidityCustomStates(){syncValidityStates(this.internals,{required:this.requiredKeys.length>0,hasInteracted:this.hasInteracted,barred:this.barredFromValidation})}syncFormState(){let effective=Object.freeze({}),errors={},flags={},formError="",formValue=null;try{if(formError=this.schemaShapeError(),this.valueInputInvalid||this.valueInputTruncated)throw new TypeError("The value could not be retained within the public snapshot boundary.");effective=this.resolveEffectiveValue();const validation=this.computeValidation(effective);errors=validation.errors,flags=validation.flags,formValue=this.serializeEffectiveValue(effective)}catch{formError=this.localize("valueMustBeSerializable"),formValue=null}formError&&(flags.customError=!0,formValue=null),this._effectiveValue=effective,JSON.stringify(this._errors)!==JSON.stringify(errors)&&(this._errors=errors),this._formError=formError,this._validityFlags=flags,this.syncInternals(formValue)}updated(changed){if(super.updated(changed),this.publishValiditySnapshot(),changed.has("value")||changed.has("schema")||changed.has("_errors")||changed.has("_formError")){const nestedUpdates=Array.from(this.firstInvalidField()?.children??[]).filter(element=>typeof element[VALIDITY_ANCHOR]=="function").map(element=>element.updateComplete).filter(update=>update!==void 0);nestedUpdates.length>0&&Promise.all(nestedUpdates).then(()=>this.validityController.refreshAnchor())}const currentErrors=new Map;for(const node of this.renderRoot.querySelectorAll('[part="error"]')){const fieldKey=node.closest('[part~="field"]')?.dataset.key,key=node.dataset.key??fieldKey??"form",text=node.textContent?.trim()??"";text&¤tErrors.set(key,text)}if(!this.suppressNextErrorAnnouncement){const freshMessages=[];for(const[key,text]of currentErrors)this.visibleErrorSnapshot.get(key)!==text&&!freshMessages.includes(text)&&freshMessages.push(text);freshMessages.length>0&&this.errorAnnouncementSink?.announce(freshMessages.join(" "))}this.visibleErrorSnapshot=currentErrors,this.suppressNextErrorAnnouncement=!1}setFieldValue(key,val){this.effectiveDisabled||(this.hasInteracted=!0,this.value={...this.value,[key]:val},this.emit("lr-input",{value:this.effectiveValue}))}markTouched(key){this.hasInteracted=!0,this.syncValidityCustomStates(),!this.touchedFields.has(key)&&(this.touchedFields=new Set(this.touchedFields).add(key))}onTextInput(key,e){this.setFieldValue(key,e.target.value)}onNumberInput(key,e){e.stopPropagation();const n=e.target.valueAsNumber;this.setFieldValue(key,Number.isNaN(n)?void 0:n)}onSelectChange(key,e){e.stopPropagation(),this.setFieldValue(key,e.target.value)}onBooleanSelectChange(key,e){e.stopPropagation();const value=e.target.value;if(value===""){if(this.effectiveDisabled)return;if(this.hasInteracted=!0,this.schemaProperties[key]?.default!==void 0)this.value={...this.value,[key]:void 0};else{const next={...this.value};Reflect.deleteProperty(next,key),this.value=next}this.emit("lr-input",{value:this.effectiveValue});return}this.setFieldValue(key,value==="true")}renderControl(key,prop,fieldId,label,required,describedBy,errorMessage,effective){if(prop.type==="string"&&prop.enum&&prop.enum.length>0)return html`<lr-select
|
|
2
2
|
id=${fieldId}
|
|
3
3
|
.label=${label}
|
|
4
4
|
.hint=${prop.description??""}
|
|
@@ -33,6 +33,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
33
33
|
enterkeyhint=${prop.enterKeyHint||nothing}
|
|
34
34
|
.value=${typeof effective=="string"?effective:""}
|
|
35
35
|
?disabled=${this.effectiveDisabled}
|
|
36
|
+
?readonly=${prop.const!==void 0}
|
|
36
37
|
@input=${e=>this.onTextInput(key,e)}
|
|
37
38
|
@focus=${this.onFieldFocus}
|
|
38
39
|
@blur=${this.onFieldBlur}
|
|
@@ -47,6 +48,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
47
48
|
.step=${prop.type==="integer"?1:"any"}
|
|
48
49
|
.value=${numValue}
|
|
49
50
|
?disabled=${this.effectiveDisabled}
|
|
51
|
+
.readonly=${prop.const!==void 0}
|
|
50
52
|
@input=${e=>this.onNumberInput(key,e)}
|
|
51
53
|
@lr-input=${this.stopNestedControlEvent}
|
|
52
54
|
@change=${this.stopNestedControlEvent}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import'../../overlays/skeleton/skeleton.class.js';import{type LyraChartLegendVisibilityChangeDetail}from'./chart-legend-visibility.js';import type{LyraChartValueFormatter,LyraChartDatumActivateDetail,LyraChartFormatter}from'./chart.class.js';import{type LyraChartChromeLegendPosition}from'./chart-chrome.js';export interface LyraBoxPlotSummary{readonly min:number;readonly q1:number;readonly median:number;readonly q3:number;readonly max:number;}export interface LyraBoxPlotSeries{readonly label:string;readonly data:readonly LyraBoxPlotSummary[];readonly color?:string;}
|
|
2
2
|
/** One addressable box: a series/category pair plus the five-number summary it renders. */
|
|
3
|
-
export interface LyraBoxPlotPointDetail{datasetIndex:number;index:number;label:string|undefined;value:LyraBoxPlotSummary|null;}export interface LyraBoxPlotEventMap{'lr-point-click':CustomEvent<LyraBoxPlotPointDetail>;
|
|
3
|
+
export interface LyraBoxPlotPointDetail{datasetIndex:number;index:number;label:string|undefined;value:LyraBoxPlotSummary|null;}export interface LyraBoxPlotEventMap{'lr-point-click':CustomEvent<LyraBoxPlotPointDetail>;
|
|
4
|
+
/** Canonical name for the legend-visibility veto point. */
|
|
5
|
+
'lr-legend-visibility-change-request':CustomEvent<LyraEventDetailSnapshot<LyraChartLegendVisibilityChangeDetail>>;
|
|
6
|
+
/** Deprecated alias of `lr-legend-visibility-change-request`, kept firing unchanged for
|
|
7
|
+
* back-compat; slated for removal in 21.0.0. */
|
|
8
|
+
'lr-before-legend-visibility-change':CustomEvent<LyraEventDetailSnapshot<LyraChartLegendVisibilityChangeDetail>>;'lr-legend-visibility-change':CustomEvent<LyraEventDetailSnapshot<LyraChartLegendVisibilityChangeDetail>>;'lr-datum-activate':CustomEvent<LyraChartDatumActivateDetail<'box',LyraBoxPlotSummary|null>>;}
|
|
4
9
|
/**
|
|
5
10
|
* `<lr-box-plot>` — a box-and-whisker chart from precomputed five-number
|
|
6
11
|
* summaries (no raw sample data is shipped to the browser). Beyond Web
|
|
@@ -60,7 +65,12 @@ export interface LyraBoxPlotPointDetail{datasetIndex:number;index:number;label:s
|
|
|
60
65
|
* peer fails to load; its transition is announced through a shared light-DOM alert.
|
|
61
66
|
* @csspart data-truncation - Explanation shown when the generated accessible alternative samples
|
|
62
67
|
* more than 1,000 records.
|
|
63
|
-
* @event lr-
|
|
68
|
+
* @event lr-legend-visibility-change-request - Cancelable proposed DOM legend visibility change.
|
|
69
|
+
* Fires before `lr-before-legend-visibility-change`, from the same gesture; either event may
|
|
70
|
+
* veto.
|
|
71
|
+
* @event lr-before-legend-visibility-change - Deprecated cancelable alias of
|
|
72
|
+
* `lr-legend-visibility-change-request`, kept firing unchanged for back-compat; slated for
|
|
73
|
+
* removal in 21.0.0. Same detail.
|
|
64
74
|
* @event lr-legend-visibility-change - Committed DOM legend visibility change.
|
|
65
75
|
* @event lr-point-click - Fired when pointer input lands on a box, or when Enter/Space activates
|
|
66
76
|
* the keyboard-current box. `detail: { datasetIndex: number, index: number, label: string |
|
|
@@ -110,7 +120,9 @@ legend:boolean;
|
|
|
110
120
|
/** Logical placement for the optional DOM legend. Deliberately `'bottom'`, unlike `lr-chart`'s
|
|
111
121
|
* `'top'` default -- shared with `lr-lite-chart` via `chart-chrome.ts`'s
|
|
112
122
|
* `normalizeChartChromeLegendPosition()` default. */
|
|
113
|
-
legendPosition:LyraChartChromeLegendPosition;height:string;
|
|
123
|
+
legendPosition:LyraChartChromeLegendPosition;height:string;
|
|
124
|
+
/** Category (x) axis title, mirroring `yLabel`. Unset (the default) renders no title. */
|
|
125
|
+
xLabel:string;yLabel:string;beginAtZero:boolean;
|
|
114
126
|
/** Accessible chart name. A host `aria-label` wins. */
|
|
115
127
|
label:string|null;
|
|
116
128
|
/** Accessible chart description. A generated five-number summary is used when unset. */
|