@aceshooting/lyra-ui 29.2.1 → 30.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +126 -95
- package/README.md +8 -7
- package/dist/ai/snapshot.js +1 -1
- package/dist/all.d.ts +1 -1
- package/dist/all.js +1 -1
- package/dist/autoloader.js +1 -1
- package/dist/cli/component-inventory.mjs +1 -1
- package/dist/cli/lyra-rename-ledger.mjs +1 -1
- package/dist/cli/migrate-wa.mjs +7 -3
- package/dist/cli/migration-analysis.mjs +1 -1
- package/dist/cli/migration-contract.json +1 -1
- package/dist/cli/migration-contract.mjs +1 -1
- package/dist/cli/migration-immutable-collections.mjs +6 -0
- package/dist/cli/migration-renames.mjs +1 -1
- package/dist/cli/migration-transforms.mjs +1 -1
- package/dist/components/agent-tools/activity-feed/activity-feed.class.d.ts +1 -1
- package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.d.ts +1 -2
- package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.js +1 -1
- package/dist/components/agent-tools/agent-run/agent-run.class.d.ts +3 -4
- package/dist/components/agent-tools/agent-run/agent-run.class.js +1 -1
- package/dist/components/agent-tools/agent-trace/agent-trace.class.d.ts +1 -1
- package/dist/components/agent-tools/agent-trace/agent-trace.class.js +2 -2
- package/dist/components/agent-tools/background-runs/background-runs.class.d.ts +1 -2
- package/dist/components/agent-tools/background-runs/background-runs.class.js +1 -1
- package/dist/components/agent-tools/change-review/change-review.class.d.ts +1 -2
- package/dist/components/agent-tools/change-review/change-review.class.js +1 -1
- package/dist/components/agent-tools/eval-dataset/eval-dataset.class.d.ts +3 -2
- package/dist/components/agent-tools/eval-dataset/eval-dataset.class.js +1 -1
- package/dist/components/agent-tools/evaluation-run/evaluation-run.class.d.ts +7 -1
- package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +1 -1
- package/dist/components/agent-tools/prompt-studio/prompt-studio.class.d.ts +2 -2
- package/dist/components/agent-tools/prompt-studio/prompt-studio.class.js +3 -3
- package/dist/components/agent-tools/span-waterfall/span-waterfall.class.d.ts +1 -1
- package/dist/components/agent-tools/subagent-panel/subagent-panel.class.d.ts +1 -2
- package/dist/components/agent-tools/subagent-panel/subagent-panel.class.js +2 -2
- package/dist/components/agent-tools/task-list/task-list.class.d.ts +1 -1
- package/dist/components/agent-tools/test-results/test-results.class.d.ts +1 -1
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +3 -4
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +1 -5
- package/dist/components/agent-tools/tool-timeline/tool-timeline.class.d.ts +3 -3
- package/dist/components/agent-tools/trace-tree/trace-tree.class.d.ts +1 -0
- package/dist/components/agent-tools/trace-tree/trace-tree.class.js +1 -1
- package/dist/components/charts/chart/chart.class.js +4 -4
- package/dist/components/charts/chart-3d/chart-3d-data.d.ts +50 -0
- package/dist/components/charts/chart-3d/chart-3d-data.js +1 -0
- package/dist/components/charts/chart-3d/chart-3d-engine.js +1 -0
- package/dist/components/charts/chart-3d/chart-3d.class.d.ts +96 -0
- package/dist/components/charts/chart-3d/chart-3d.class.js +47 -0
- package/dist/components/charts/chart-3d/chart-3d.d.ts +1 -0
- package/dist/components/charts/chart-3d/chart-3d.js +1 -0
- package/dist/components/charts/chart-3d/chart-3d.styles.js +1 -0
- package/dist/components/charts/index.d.ts +1 -1
- package/dist/components/charts/index.js +1 -1
- package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +3 -3
- package/dist/components/conversation/agent-workspace/agent-workspace.class.js +4 -5
- package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
- package/dist/components/conversation/code-block/shiki-oniguruma.d.ts +3 -0
- package/dist/components/conversation/code-block/shiki-oniguruma.js +1 -0
- package/dist/components/conversation/code-block/shiki-types.d.ts +3 -5
- package/dist/components/conversation/code-block/shiki-types.js +1 -1
- package/dist/components/conversation/generation-metrics/generation-metrics.class.js +1 -1
- package/dist/components/conversation/markdown/markdown-progressive.js +1 -1
- package/dist/components/conversation/message-actions/message-actions.class.js +1 -1
- package/dist/components/conversation/message-parts/message-parts.class.js +1 -1
- package/dist/components/conversation/model-select/model-select.class.js +1 -1
- package/dist/components/conversation/model-settings-panel/model-settings-panel.class.js +1 -1
- package/dist/components/conversation/prompt-input/prompt-input.class.js +3 -4
- package/dist/components/conversation/prompt-queue/prompt-queue.class.d.ts +1 -1
- package/dist/components/conversation/push-to-talk/push-to-talk.class.js +1 -1
- package/dist/components/conversation/selection-toolbar/selection-toolbar.class.js +1 -1
- package/dist/components/conversation/thread-list/thread-list.class.d.ts +2 -2
- package/dist/components/conversation/thread-list/thread-list.class.js +1 -1
- package/dist/components/conversation/widget-renderer/registry.js +1 -1
- package/dist/components/conversation/widget-renderer/resolve.js +1 -1
- package/dist/components/data/calendar/calendar.class.d.ts +3 -1
- package/dist/components/data/data-grid/data-grid.class.js +2 -2
- package/dist/components/data/flow-canvas/flow-canvas.class.js +2 -2
- package/dist/components/data/flow-canvas/flow-source.js +1 -1
- package/dist/components/data/flow-node/flow-node.class.d.ts +2 -3
- package/dist/components/data/flow-node/flow-node.class.js +2 -4
- package/dist/components/data/heatmap/heatmap.class.js +1 -1
- package/dist/components/data/sparkline/sparkline.class.d.ts +0 -1
- package/dist/components/data/sparkline/sparkline.class.js +1 -1
- package/dist/components/data/table/table.class.js +1 -1
- package/dist/components/forms/color-picker/color-core.js +1 -1
- package/dist/components/forms/date-picker/calendar-core.js +1 -1
- package/dist/components/forms/otp-input/otp-input.class.js +1 -1
- package/dist/components/forms/signature-pad/signature-pad.class.d.ts +4 -3
- package/dist/components/forms/signature-pad/signature-pad.class.js +1 -1
- package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +3 -2
- package/dist/components/forms/swatch-picker/swatch-picker.class.js +1 -1
- package/dist/components/layout/app-rail/app-rail-item.class.d.ts +0 -2
- package/dist/components/layout/app-rail/app-rail-item.class.js +1 -1
- package/dist/components/layout/app-rail/app-rail.class.d.ts +3 -3
- package/dist/components/layout/command-palette/command-palette.class.d.ts +1 -1
- package/dist/components/layout/details/accordion-item.class.d.ts +1 -2
- package/dist/components/layout/details/accordion-item.class.js +1 -1
- package/dist/components/layout/dock-panel/dock-panel.class.d.ts +4 -11
- package/dist/components/layout/dock-panel/dock-panel.class.js +1 -1
- package/dist/components/layout/drilldown-panel/drilldown-panel.class.js +1 -1
- package/dist/components/layout/menu/menu.class.js +1 -1
- package/dist/components/layout/menubar/menubar-item.class.d.ts +1 -1
- package/dist/components/layout/menubar/menubar.class.d.ts +1 -1
- package/dist/components/layout/multi-split/multi-split.class.d.ts +1 -1
- package/dist/components/layout/multi-split/multi-split.class.js +1 -1
- package/dist/components/layout/navigation-menu/navigation-menu.class.d.ts +2 -6
- package/dist/components/layout/navigation-menu/navigation-menu.class.js +1 -1
- package/dist/components/layout/tab-group/tab-group.class.js +1 -1
- package/dist/components/layout/virtual-list/virtual-list.class.d.ts +3 -2
- package/dist/components/layout/virtual-list/virtual-list.class.js +1 -1
- package/dist/components/layout/widget/widget.class.d.ts +5 -14
- package/dist/components/layout/widget/widget.class.js +2 -2
- package/dist/components/lr-chart-3d.js +1 -0
- package/dist/components/lr-model-viewer.js +1 -0
- package/dist/components/media/av-player/av-metadata.d.ts +1 -13
- package/dist/components/media/av-player/av-metadata.js +1 -1
- package/dist/components/media/av-player/av-player.class.js +1 -1
- package/dist/components/media/file-input/file-input.class.d.ts +10 -13
- package/dist/components/media/file-input/file-input.class.js +3 -3
- package/dist/components/media/file-input/file-input.styles.js +1 -1
- package/dist/components/media/image-viewer/image-viewer-panorama.d.ts +5 -0
- package/dist/components/media/image-viewer/image-viewer-panorama.js +8 -0
- package/dist/components/media/image-viewer/image-viewer-panorama.styles.js +1 -0
- package/dist/components/media/image-viewer/image-viewer.class.d.ts +29 -5
- package/dist/components/media/image-viewer/image-viewer.class.js +8 -5
- package/dist/components/media/image-viewer/image-viewer.styles.js +1 -1
- package/dist/components/media/map/map-anchor-controller.js +1 -0
- package/dist/components/media/map/map-anchor-options.d.ts +14 -0
- package/dist/components/media/map/map-anchor-options.js +1 -0
- package/dist/components/media/map/map-camera.d.ts +34 -0
- package/dist/components/media/map/map-camera.js +1 -0
- package/dist/components/media/map/map-construction-scheduler.d.ts +13 -0
- package/dist/components/media/map/map-construction-scheduler.js +1 -0
- package/dist/components/media/map/map-control-options.d.ts +39 -0
- package/dist/components/media/map/map-control-options.js +1 -0
- package/dist/components/media/map/map-controls-lifecycle.js +1 -0
- package/dist/components/media/map/map-cursor.js +1 -0
- package/dist/components/media/map/map-data-layer-model.d.ts +40 -0
- package/dist/components/media/map/map-data-layer-model.js +1 -0
- package/dist/components/media/map/map-drawing-controller.js +1 -0
- package/dist/components/media/map/map-drawing-gesture.js +1 -0
- package/dist/components/media/map/map-drawing-pan.js +1 -0
- package/dist/components/media/map/map-drawing-pointer.js +1 -0
- package/dist/components/media/map/map-drawing.d.ts +29 -0
- package/dist/components/media/map/map-drawing.js +1 -0
- package/dist/components/media/map/map-empty-style.d.ts +8 -0
- package/dist/components/media/map/map-empty-style.js +1 -0
- package/dist/components/media/map/map-engine-events.js +1 -0
- package/dist/components/media/map/map-export-attribution.js +1 -0
- package/dist/components/media/map/map-external-source-effects.js +1 -0
- package/dist/components/media/map/map-feature-loader-core.js +1 -0
- package/dist/components/media/map/map-feature-loader.js +1 -0
- package/dist/components/media/map/map-feature-state-router.d.ts +16 -0
- package/dist/components/media/map/map-feature-state-router.js +1 -0
- package/dist/components/media/map/map-feature-state-routes.js +1 -0
- package/dist/components/media/map/map-feature-state.d.ts +16 -0
- package/dist/components/media/map/map-feature-state.js +1 -0
- package/dist/components/media/map/map-hash-option.js +1 -0
- package/dist/components/media/map/map-hash-owner.js +1 -0
- package/dist/components/media/map/map-hash.js +1 -0
- package/dist/components/media/map/map-hit-test.d.ts +17 -0
- package/dist/components/media/map/map-hit-test.js +1 -0
- package/dist/components/media/map/map-image-admission.d.ts +7 -0
- package/dist/components/media/map/map-image-admission.js +1 -0
- package/dist/components/media/map/map-image-export-controller.js +1 -0
- package/dist/components/media/map/map-image-export-error.d.ts +3 -0
- package/dist/components/media/map/map-image-export-error.js +1 -0
- package/dist/components/media/map/map-image-export.d.ts +15 -0
- package/dist/components/media/map/map-image-export.js +5 -0
- package/dist/components/media/map/map-image-limits.d.ts +4 -0
- package/dist/components/media/map/map-image-limits.js +1 -0
- package/dist/components/media/map/map-image-metadata.js +3 -0
- package/dist/components/media/map/map-image-provider.d.ts +33 -0
- package/dist/components/media/map/map-image-provider.js +1 -0
- package/dist/components/media/map/map-images.d.ts +9 -0
- package/dist/components/media/map/map-images.js +1 -0
- package/dist/components/media/map/map-interaction-options.d.ts +26 -0
- package/dist/components/media/map/map-interaction-options.js +1 -0
- package/dist/components/media/map/map-layer-order.js +1 -0
- package/dist/components/media/map/map-loader.d.ts +35 -5
- package/dist/components/media/map/map-loader.js +1 -1
- package/dist/components/media/map/map-local-image-url.js +1 -0
- package/dist/components/media/map/map-local-image.js +1 -0
- package/dist/components/media/map/map-overlay-admission.d.ts +13 -0
- package/dist/components/media/map/map-overlay-admission.js +1 -0
- package/dist/components/media/map/map-owned-feature-input.js +1 -0
- package/dist/components/media/map/map-owned-features.js +1 -0
- package/dist/components/media/map/map-owned-resources.js +1 -0
- package/dist/components/media/map/map-paint-batch.js +1 -0
- package/dist/components/media/map/map-readers.js +1 -0
- package/dist/components/media/map/map-readiness.js +1 -0
- package/dist/components/media/map/map-resource-feature-loaders.js +1 -0
- package/dist/components/media/map/map-source-updates.js +1 -0
- package/dist/components/media/map/map-style-input.js +1 -0
- package/dist/components/media/map/map-style-lifecycle.js +1 -0
- package/dist/components/media/map/map-style-override-admission.d.ts +10 -0
- package/dist/components/media/map/map-style-override-admission.js +1 -0
- package/dist/components/media/map/map-style-overrides.js +1 -0
- package/dist/components/media/map/map-style-value.d.ts +3 -0
- package/dist/components/media/map/map-style-value.js +1 -0
- package/dist/components/media/map/map-vector-style.d.ts +10 -0
- package/dist/components/media/map/map-vector-style.js +1 -0
- package/dist/components/media/map/map.class.d.ts +558 -51
- package/dist/components/media/map/map.class.js +58 -11
- package/dist/components/media/map/map.styles.js +1 -1
- package/dist/components/media/qr-code/qr-code.class.d.ts +1 -3
- package/dist/components/media/qr-code/qr-code.class.js +1 -1
- package/dist/components/media/qr-code/qr-code.styles.js +1 -1
- package/dist/components/media/video/video.class.d.ts +25 -4
- package/dist/components/media/video/video.class.js +11 -3
- package/dist/components/media/video/video.styles.js +1 -1
- package/dist/components/media/video-playlist/video-playlist.class.d.ts +0 -1
- package/dist/components/media/video-playlist/video-playlist.class.js +1 -1
- package/dist/components/overlays/chip/chip-group.class.d.ts +1 -1
- package/dist/components/overlays/chip/chip-group.class.js +1 -1
- package/dist/components/overlays/dialog/confirm.js +1 -1
- package/dist/components/overlays/overlay/popover.class.d.ts +1 -1
- package/dist/components/overlays/overlay/popover.class.js +2 -1
- package/dist/components/overlays/overlay/tooltip.class.js +1 -1
- package/dist/components/retrieval/chunk-inspector/chunk-inspector.class.d.ts +4 -7
- package/dist/components/retrieval/chunk-inspector/chunk-inspector.class.js +2 -2
- package/dist/components/retrieval/claim-evidence/claim-evidence.class.d.ts +2 -2
- package/dist/components/retrieval/community-card/community-card.class.d.ts +1 -4
- package/dist/components/retrieval/community-card/community-card.class.js +1 -1
- package/dist/components/retrieval/embedding-explorer/embedding-explorer-data.d.ts +12 -0
- package/dist/components/retrieval/embedding-explorer/embedding-explorer-data.js +1 -0
- package/dist/components/retrieval/embedding-explorer/embedding-explorer-engine.js +1 -0
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.d.ts +26 -7
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.js +35 -4
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +1 -1
- package/dist/components/retrieval/entity-dossier/entity-dossier.class.d.ts +3 -9
- package/dist/components/retrieval/graph/graph-builtin-3d-engine.js +1 -0
- package/dist/components/retrieval/graph/graph-engine-adapter.js +1 -0
- package/dist/components/retrieval/graph/graph-engine-columns.js +1 -0
- package/dist/components/retrieval/graph/graph-model.js +1 -1
- package/dist/components/retrieval/graph/graph-spatial-controller.js +13 -8
- package/dist/components/retrieval/graph/graph-webgl-engine.js +1 -0
- package/dist/components/retrieval/graph/graph.class.d.ts +18 -5
- package/dist/components/retrieval/graph/graph.class.js +4 -4
- package/dist/components/retrieval/graph/graph.styles.js +1 -1
- package/dist/components/retrieval/grounding-summary/grounding-summary.class.d.ts +1 -1
- package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.d.ts +1 -1
- package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +2 -2
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +6 -3
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +3 -3
- package/dist/components/retrieval/memory-panel/memory-panel.class.d.ts +3 -10
- package/dist/components/retrieval/memory-panel/memory-panel.class.js +1 -1
- package/dist/components/retrieval/node-palette/node-palette.class.d.ts +1 -1
- package/dist/components/retrieval/path-strip/path-strip.class.d.ts +1 -4
- package/dist/components/retrieval/path-strip/path-strip.class.js +1 -1
- package/dist/components/retrieval/provenance-panel/provenance-panel.class.d.ts +2 -8
- package/dist/components/retrieval/rag-answer/rag-answer.class.d.ts +2 -2
- package/dist/components/retrieval/rag-answer/rag-answer.class.js +2 -3
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.d.ts +1 -11
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +1 -1
- package/dist/components/retrieval/retrieval-results/retrieval-results.class.d.ts +8 -12
- package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +5 -6
- package/dist/components/retrieval/retrieval-search/retrieval-search.class.d.ts +1 -1
- package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.d.ts +4 -7
- package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.js +2 -3
- package/dist/components/retrieval/source-card/source-card.class.d.ts +6 -9
- package/dist/components/retrieval/source-card/source-card.class.js +1 -1
- package/dist/components/retrieval/source-picker/source-picker.class.d.ts +1 -4
- package/dist/components/retrieval/source-picker/source-picker.class.js +1 -1
- package/dist/components/utility/diff-view/diff-view.class.js +1 -1
- package/dist/components/utility/format/format-options.js +1 -1
- package/dist/components/utility/icon/icon.class.d.ts +0 -5
- package/dist/components/utility/icon/icon.class.js +2 -2
- package/dist/components/utility/icon/icon.styles.js +1 -1
- package/dist/components/utility/json-viewer/json-viewer.class.js +1 -1
- package/dist/components/utility/known-date/known-date.class.d.ts +0 -3
- package/dist/components/utility/known-date/known-date.class.js +1 -1
- package/dist/components/utility/mention-popover/mention-popover.class.d.ts +3 -2
- package/dist/components/utility/mention-popover/mention-popover.class.js +1 -1
- package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
- package/dist/components/viewers/calendar-viewer/calendar-viewer.class.js +1 -1
- package/dist/components/viewers/contact-viewer/contact-viewer.class.js +1 -1
- package/dist/components/viewers/document-preview/document-preview.class.js +1 -1
- package/dist/components/viewers/document-viewer/document-viewer-kinds.d.ts +1 -1
- package/dist/components/viewers/document-viewer/document-viewer-kinds.js +1 -1
- package/dist/components/viewers/document-viewer/document-viewer.class.js +1 -1
- package/dist/components/viewers/document-viewer/registry.d.ts +1 -69
- package/dist/components/viewers/document-viewer/registry.js +1 -1
- package/dist/components/viewers/docx-viewer/docx-viewer.class.js +1 -1
- package/dist/components/viewers/email-viewer/email-viewer.class.js +1 -1
- package/dist/components/viewers/html-viewer/html-viewer.class.js +1 -1
- package/dist/components/viewers/include/include.class.js +1 -1
- package/dist/components/viewers/index.d.ts +1 -1
- package/dist/components/viewers/index.js +1 -1
- package/dist/components/viewers/model-viewer/model-viewer-document.js +1 -0
- package/dist/components/viewers/model-viewer/model-viewer-loader.js +1 -0
- package/dist/components/viewers/model-viewer/model-viewer-register.d.ts +1 -0
- package/dist/components/viewers/model-viewer/model-viewer-register.js +1 -0
- package/dist/components/viewers/model-viewer/model-viewer-source.d.ts +1 -0
- package/dist/components/viewers/model-viewer/model-viewer-source.js +1 -0
- package/dist/components/viewers/model-viewer/model-viewer.class.d.ts +61 -0
- package/dist/components/viewers/model-viewer/model-viewer.class.js +9 -0
- package/dist/components/viewers/model-viewer/model-viewer.d.ts +1 -0
- package/dist/components/viewers/model-viewer/model-viewer.js +1 -0
- package/dist/components/viewers/model-viewer/model-viewer.styles.js +1 -0
- package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +2 -2
- package/dist/components/viewers/page-rail/page-rail.class.js +1 -1
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +1 -1
- package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +3 -3
- package/dist/components/viewers/svg-viewer/svg-viewer.class.js +1 -1
- package/dist/components/viewers/table-viewer-shared.js +1 -1
- 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 +137 -92
- package/dist/framework-types.d.ts +2 -2
- package/dist/hydration.d.ts +1 -1
- package/dist/internal/ansi.d.ts +3 -1
- package/dist/internal/ansi.js +1 -1
- package/dist/internal/autoloader-manifest.js +1 -1
- package/dist/internal/autoloader-tags.d.ts +1 -1
- package/dist/internal/autoloader-tags.js +1 -1
- package/dist/internal/av-metadata.d.ts +13 -0
- package/dist/internal/av-metadata.js +1 -0
- package/dist/internal/collection-snapshot.js +1 -1
- package/dist/internal/component-loaders.generated.js +1 -1
- package/dist/internal/data-descriptors.d.ts +30 -0
- package/dist/internal/default-strings/agent-tools.generated.js +1 -1
- package/dist/internal/default-strings/charts.generated.js +1 -1
- package/dist/internal/default-strings/conversation.generated.js +1 -1
- package/dist/internal/default-strings/media.generated.js +1 -1
- package/dist/internal/default-strings/shared.generated.js +1 -1
- package/dist/internal/default-strings/viewers.generated.js +1 -1
- package/dist/internal/document-renderer-registry.d.ts +75 -0
- package/dist/internal/document-renderer-registry.js +1 -0
- package/dist/internal/drop-session-controller.js +1 -1
- package/dist/internal/engine-3d-loader.d.ts +47 -0
- package/dist/internal/engine-3d-loader.js +1 -0
- package/dist/internal/engine-3d.d.ts +57 -0
- package/dist/internal/engine-3d.js +1 -0
- package/dist/internal/hierarchy-source-controller.js +1 -1
- package/dist/internal/localization-runtime.js +1 -1
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +1 -1
- package/dist/internal/lyra-element.d.ts +2 -2
- package/dist/internal/lyra-element.js +1 -1
- package/dist/internal/model-viewer-contract.d.ts +5 -0
- package/dist/internal/model-viewer-contract.js +1 -0
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/positioner.js +1 -1
- package/dist/internal/rendered-state.js +1 -1
- package/dist/internal/root-registration-allowlist.js +1 -1
- package/dist/internal/scoped-definitions.generated.js +1 -1
- package/dist/internal/typed-columns.d.ts +39 -0
- package/dist/internal/typed-columns.js +1 -0
- package/dist/localization.js +1 -1
- package/dist/lyra.d.ts +1 -1
- package/dist/lyra.js +1 -1
- package/dist/ssr/all.d.ts +1 -1
- package/dist/ssr/all.js +1 -1
- package/dist/ssr.d.ts +4 -4
- package/dist/ssr.js +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/testing/lyra-tag-event-map.d.ts +2 -2
- package/dist/testing/lyra-tag-event-map.js +1 -1
- package/dist/theme/theme-bootstrap.js +1 -1
- package/dist/theme/theme.js +1 -1
- package/dist/vue.d.ts +1 -1
- package/llms/components/lr-accordion-item.md +2 -2
- package/llms/components/lr-agent-eval-dashboard.md +3 -3
- package/llms/components/lr-agent-run.md +3 -3
- package/llms/components/lr-agent-trace.md +1 -1
- package/llms/components/lr-agent-workspace.md +1 -1
- package/llms/components/lr-app-rail-item.md +1 -1
- package/llms/components/lr-app-rail.md +5 -6
- package/llms/components/lr-background-runs.md +4 -4
- package/llms/components/lr-calendar.md +1 -1
- package/llms/components/lr-change-review.md +5 -5
- package/llms/components/lr-chart-3d.md +164 -0
- package/llms/components/lr-chunk-inspector.md +4 -5
- package/llms/components/lr-citation-badge.md +1 -1
- package/llms/components/lr-code-block-core.md +2 -4
- package/llms/components/lr-command-palette.md +3 -3
- package/llms/components/lr-community-card.md +2 -2
- package/llms/components/lr-date-picker.md +1 -1
- package/llms/components/lr-details.md +2 -2
- package/llms/components/lr-diff-view.md +2 -2
- package/llms/components/lr-dock-panel.md +5 -10
- package/llms/components/lr-document-viewer.md +21 -14
- package/llms/components/lr-embedding-explorer.md +24 -4
- package/llms/components/lr-entity-dossier.md +3 -4
- package/llms/components/lr-eval-dataset.md +3 -3
- package/llms/components/lr-eval-run.md +7 -1
- package/llms/components/lr-file-input.md +10 -11
- package/llms/components/lr-flow-node.md +2 -3
- package/llms/components/lr-geojson-viewer.md +1 -1
- package/llms/components/lr-graph.md +21 -2
- package/llms/components/lr-grounding-summary.md +1 -1
- package/llms/components/lr-icon.md +1 -3
- package/llms/components/lr-image-viewer.md +29 -2
- package/llms/components/lr-ingestion-queue.md +1 -1
- package/llms/components/lr-knowledge-base-admin.md +2 -2
- package/llms/components/lr-knowledge-graph-explorer.md +7 -1
- package/llms/components/lr-known-date.md +3 -10
- package/llms/components/lr-lite-chart.md +1 -1
- package/llms/components/lr-map.md +861 -49
- package/llms/components/lr-markdown-core.md +1 -2
- package/llms/components/lr-memory-panel.md +4 -8
- package/llms/components/lr-model-viewer.md +170 -0
- package/llms/components/lr-navigation-menu.md +3 -4
- package/llms/components/lr-node-palette.md +1 -1
- package/llms/components/lr-path-strip.md +2 -3
- package/llms/components/lr-provenance-panel.md +3 -5
- package/llms/components/lr-qr-code.md +3 -4
- package/llms/components/lr-rag-answer.md +1 -1
- package/llms/components/lr-rag-eval-dashboard.md +2 -5
- package/llms/components/lr-retrieval-results.md +6 -7
- package/llms/components/lr-retrieval-trace.md +3 -4
- package/llms/components/lr-signature-pad.md +4 -3
- package/llms/components/lr-source-card.md +1 -1
- package/llms/components/lr-source-list.md +5 -5
- package/llms/components/lr-source-picker.md +2 -3
- package/llms/components/lr-span-waterfall.md +4 -3
- package/llms/components/lr-sparkline.md +3 -3
- package/llms/components/lr-subagent-panel.md +3 -3
- package/llms/components/lr-tool-call-chip.md +6 -6
- package/llms/components/lr-tool-timeline.md +1 -1
- package/llms/components/lr-video-playlist.md +3 -3
- package/llms/components/lr-video.md +29 -2
- package/llms/components/lr-virtual-list.md +3 -2
- package/llms/components/lr-widget.md +6 -13
- package/llms/index.md +98 -95
- package/llms/migration.md +27 -38
- package/llms/peers.md +7 -6
- package/llms/shared/ai-and-peers.md +1 -1
- package/llms/shared/events-and-types.md +8 -0
- package/llms/shared/imports-and-registration.md +2 -2
- package/llms/shared/v29-to-v30-migration.md +256 -0
- package/llms/shared.md +11 -3
- package/llms.txt +4 -4
- package/locales.json +1 -2328
- package/package.json +42 -14
- package/registrations.json +1 -1
- package/skills/lyra-ui/SKILL.md +4 -3
- /package/dist/{components/viewers/document-viewer → internal}/deferred-teardown.js +0 -0
- /package/dist/{components/viewers/document-viewer/registry-ownership.js → internal/document-renderer-registry-ownership.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{NativeModalCarrier}from"../../../internal/native-modal-carrier.js";import{nativeModalCarrierStyles}from"../../../internal/native-modal-carrier.styles.js";import{AccessibleTextController}from"../../../internal/accessible-text-controller.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{requestThenCommit}from"../../../internal/request-commit.js";import{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{renderInertPresentation}from"../../../internal/inert-presentation.js";import{cancelDeferredFocusReturn,captureFocusReturnOpener}from"../../../internal/deferred-focus-return.js";import{activateOverlay,collectFocusableElements,deepActiveElement}from"../../../internal/overlay-manager.js";import{readPersistedState,writePersistedState}from"../../../internal/persisted-state.js";import{definePersistedProperty,isPersistedPropertyExplicitlySet}from"../../../internal/persisted-restore.js";import{nextId}from"../../../internal/a11y.js";import{composedAccessibilityText}from"../../../internal/accessibility-visibility.js";import{observeScrollOverflow}from"../../../internal/scroll-overflow.js";import{scrollOverflowFadeStyles}from"../../../internal/scroll-overflow.styles.js";import{chevronIcon,closeIcon,expandIcon}from"../../../internal/icons.js";import{styles}from"./widget.styles.js";import{sanitizeCssInset}from"../../../internal/safe-css.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{LYRA_DEFAULT_widgetCollapse,LYRA_DEFAULT_widgetExitFullscreen,LYRA_DEFAULT_widgetExpand,LYRA_DEFAULT_widgetExpandToFullscreen,LYRA_DEFAULT_widgetFullscreenPanel,LYRA_DEFAULT_widgetViewGroup}from"../../../internal/default-strings/layout.generated.js";const MAX_WIDGET_VIEWS=256;function snapshotWidgetViews(value){if(!Array.isArray(value))return Object.freeze([]);const seen=new Set,normalized=[];for(const candidate of value.slice(0,MAX_WIDGET_VIEWS))try{if(!candidate||typeof candidate!="object")continue;const record=candidate,viewId=record.viewId;if(typeof viewId!="string"||viewId.length===0||viewId!==viewId.trim()||seen.has(viewId))continue;const label=record.label,ariaLabel=record.ariaLabel,icon=record.icon;if(label!==void 0&&typeof label!="string"||ariaLabel!==void 0&&typeof ariaLabel!="string")continue;seen.add(viewId),normalized.push(Object.freeze({viewId,...label!==void 0?{label}:{},...icon!==void 0?{icon}:{},...ariaLabel!==void 0?{ariaLabel}:{}}))}catch{}return Object.freeze(normalized)}const collapseWriteGuards=new WeakMap;function collapseWriteGuardFor(widget){let guard=collapseWriteGuards.get(widget);return guard||(guard=new VetoWriteGuard,collapseWriteGuards.set(widget,guard)),guard}function installSynchronousCollapsedReflection(prototype){const installed=Object.getOwnPropertyDescriptor(prototype,"collapsed"),installedSet=installed.set;Object.defineProperty(prototype,"collapsed",{...installed,set(next){installedSet.call(this,next),markVetoGuardWrite(collapseWriteGuardFor(this)),this.toggleAttribute("collapsed",this.collapsed)}})}class LyraWidget extends LyraElement{constructor(){super(...arguments),this.actionsScrollOverflow=observeScrollOverflow(this,()=>this.renderRoot.querySelector('[part="actions"]')),this.viewTogglesScrollOverflow=observeScrollOverflow(this,()=>this.renderRoot.querySelector('[part="view-toggles"]')),this.label="",this.accessibleLabel=null,this.sublabel="",this.collapsible=!1,this.expandable=!1,this.fullscreen=!1,this.fullscreenInset="",this.backdropInset="",this.size="m",this.effectiveViews=Object.freeze([]),this.activeViewId="",this.slotPresence=new SlotPresenceController(this),this.nativeModal=new NativeModalCarrier(this,{onCancel:()=>{this.overlayHandle?.isTopmost()&&this.dismissFullscreen()},onUnexpectedClose:()=>{this.overlayHandle?.isTopmost()&&this.dismissFullscreen(),this.fullscreen&&this.nativeModal.show()}}),this.labelTextObserver=new AccessibleTextController(this,[],()=>{const assigned=this.shadowRoot?.querySelector('slot[name="label"]')?.assignedElements({flatten:!0})??[];this.syncLabelSlot(assigned)},["alt","aria-labelledby","slot"],!1),this.ownerRealmGeneration=0,this.bodyId=nextId("widget-body"),this.persistReady=!1,this.onLabelSlotChange=e=>{const assigned=e.target.assignedElements({flatten:!0});this.syncLabelSlot(assigned)},this.setActiveView=viewId=>{if(viewId!==this.activeViewId){if(this.emit("lr-view-request",{viewId},{cancelable:!0}).defaultPrevented)return;this.activeViewId=viewId,this.emit("lr-view-change",{viewId})}this.emit("lr-activate",{value:viewId})},this.dispatchingCollapse=!1,this.toggleCollapsed=()=>{this.requestCollapse(!this.collapsed)},this.toggleFullscreen=e=>{const next=!this.fullscreen,trigger=e.currentTarget;this.requestFullscreenChange(next)&&next&&(this.explicitTrigger=trigger)},this.dismissFullscreen=()=>{this.fullscreen&&this.requestFullscreenChange(!1)},this.onBackdropClick=()=>{this.overlayHandle?.dismissBackdrop()}}static{this.defaultStrings={...super.defaultStrings,widgetCollapse:LYRA_DEFAULT_widgetCollapse,widgetExitFullscreen:LYRA_DEFAULT_widgetExitFullscreen,widgetExpand:LYRA_DEFAULT_widgetExpand,widgetExpandToFullscreen:LYRA_DEFAULT_widgetExpandToFullscreen,widgetFullscreenPanel:LYRA_DEFAULT_widgetFullscreenPanel,widgetViewGroup:LYRA_DEFAULT_widgetViewGroup}}static{this.styles=[LyraElement.styles,nativeModalCarrierStyles,scrollOverflowFadeStyles,styles]}static{this.properties={collapsed:{type:Boolean,reflect:!0,noAccessor:!0}}}static{definePersistedProperty(this.prototype,"collapsed",{initial:!1,attribute:!0,type:Boolean,reflect:!0,coerce:next=>!!next}),installSynchronousCollapsedReflection(this.prototype)}get views(){return this.effectiveViews}set views(value){if(value===this.viewsSource||value===this.effectiveViews)return;this.viewsSource=value;const previous=this.effectiveViews;this.effectiveViews=snapshotWidgetViews(value),this.requestUpdate("views",previous)}get storageFullKey(){return this.storageKey?`lr-widget:${this.storageKey}`:void 0}willUpdate(changed){if(super.willUpdate(changed),!this.hasUpdated){const labelChildren=Array.from(this.children).filter(el=>el.getAttribute("slot")==="label");this.labelSlotText=this.readLabelSlotText(labelChildren);const parsed=readPersistedState(this.storageFullKey,v=>typeof v=="object"&&v!==null);parsed&&typeof parsed.collapsed=="boolean"&&!isPersistedPropertyExplicitlySet(this,"collapsed")&&(this.collapsed=parsed.collapsed)}if(changed.has("fullscreen")&&(this.fullscreen?this.activateFullscreenOverlay():this.deactivateFullscreenOverlay()),changed.has("views")||changed.has("activeViewId")){const focused=this.renderRoot?.querySelector('[part="view-toggle"]:focus');this.focusedViewIdBeforeUpdate=focused?.dataset.viewId;const views=this.views;if(!views.some(view=>view.viewId===this.activeViewId)){const forcedBySibling=this.hasUpdated&&changed.has("views")&&!changed.has("activeViewId");this.activeViewId=views[0]?.viewId??"",forcedBySibling&&this.emit("lr-view-change",{viewId:this.activeViewId})}}}updated(changed){super.updated(changed),this.fullscreen&&this.nativeModal.show();const actionsSlot=this.renderRoot.querySelector('slot[name="actions"]');if(this.actionsScrollOverflow.observeExtra(actionsSlot?actionsSlot.assignedElements({flatten:!0}):[]),this.viewTogglesScrollOverflow.observeExtra(this.renderRoot.querySelectorAll('[part="view-toggle"]')),this.persistReady&&changed.has("collapsed")&&writePersistedState(this.storageFullKey,{collapsed:this.collapsed}),this.persistReady=!0,changed.has("fullscreen")&&this.fullscreen)this.overlayHandle?.focusInitial();else if(changed.has("collapsed")&&this.fullscreen){const panel=this.shadowRoot?.querySelector('[part="base"]'),active=deepActiveElement(this.ownerDocument);panel&&!collectFocusableElements(panel).includes(active)&&(active&&typeof active.blur=="function"&&active.blur(),this.overlayHandle?.focusInitial())}if(changed.has("views")||changed.has("activeViewId")){const focusedId=this.focusedViewIdBeforeUpdate;this.focusedViewIdBeforeUpdate=void 0,focusedId&&!this.views.some(view=>view.viewId===focusedId)&&Array.from(this.renderRoot.querySelectorAll('[part="view-toggle"]')).find(toggle=>toggle.dataset.viewId===this.activeViewId)?.focus()}}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.fullscreen&&(this.overlayHandle?.isActive()?this.overlayHandle.resume():this.activateFullscreenOverlay(),this.queueOwnerMicrotask(()=>{this.nativeModal.show(),this.overlayHandle?.focusInitial()})),this.hasUpdated&&this.queueOwnerMicrotask(()=>{const slot=this.shadowRoot?.querySelector('slot[name="label"]');slot&&this.syncLabelSlot(slot.assignedElements({flatten:!0}))})}disconnectedCallback(){this.resetOwnerRealmWork(),cancelDeferredFocusReturn(this),super.disconnectedCallback(),this.nativeModal.hide(),this.overlayHandle?.suspend()}adoptedCallback(){super.adoptedCallback(),this.resetOwnerRealmWork();const slot=this.shadowRoot?.querySelector('slot[name="label"]');this.isConnected&&slot&&this.syncLabelSlot(slot.assignedElements({flatten:!0})),this.labelTextObserver.adopted()}resetOwnerRealmWork(){this.ownerRealmGeneration+=1,this.labelTextObserver.setEnabled(!1)}queueOwnerMicrotask(callback){const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ownerWindow||!this.isConnected)return;const generation=this.ownerRealmGeneration;ownerWindow.queueMicrotask(()=>{this.ownerRealmGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||callback()})}activateFullscreenOverlay(){this.nativeModal.prepare(),this.fullscreenOpener=this.explicitTrigger??captureFocusReturnOpener(this),this.overlayHandle=activateOverlay({host:this,panel:()=>this.shadowRoot?.querySelector('[part="base"]')??null,onEscape:this.dismissFullscreen,onBackdrop:this.dismissFullscreen,restoreFocusTo:this.explicitTrigger,lockScroll:!0,suspendWhenUnrendered:!0,deferredReturn:()=>{const opener=this.fullscreenOpener;return opener?{candidates:()=>[opener],isCurrent:()=>!this.fullscreen}:void 0}}),this.explicitTrigger=void 0}deactivateFullscreenOverlay(){this.nativeModal.hide(),this.nativeModal.prepare(!1),this.overlayHandle?.deactivate(),this.overlayHandle=void 0,this.fullscreenOpener=void 0}syncLabelSlot(assigned){this.labelSlotText=this.readLabelSlotText(assigned),this.labelTextObserver.setEnabled(assigned.length>0),this.labelTextObserver.bind()}readLabelSlotText(assigned){return composedAccessibilityText(assigned).replace(/\s+/g," ").trim()||void 0}requestCollapse(next){if(this.dispatchingCollapse)return;const previous=this.collapsed;this.dispatchingCollapse=!0;try{requestThenCommit({requestDetail:{expanded:!next},emitRequest:(proposal,init)=>{const request=this.emit("lr-toggle-request",proposal,init);return this.emit("lr-collapse-request",{collapsed:next},init).defaultPrevented&&request.preventDefault(),request},guard:collapseWriteGuardFor(this),commit:()=>{this.collapsed===previous&&(this.collapsed=next,this.emit("lr-collapse-change",{collapsed:next}),this.emit("lr-toggle",{expanded:!next}))}})}finally{this.dispatchingCollapse=!1}}requestFullscreenChange(next){return this.emit("lr-fullscreen-request",{fullscreen:next},{cancelable:!0}).defaultPrevented?!1:(this.fullscreen=next,this.emit("lr-fullscreen-change",{fullscreen:next}),!0)}render(){const hasLabel=(this.label??"").length>0,hasSublabel=(this.sublabel??"").length>0,views=this.views,fullscreenInset=sanitizeCssInset(this.fullscreenInset),backdropInset=sanitizeCssInset(this.backdropInset);return this.nativeModal.render(html`
|
|
1
|
+
import{__decorate}from"tslib";import{NativeModalCarrier}from"../../../internal/native-modal-carrier.js";import{nativeModalCarrierStyles}from"../../../internal/native-modal-carrier.styles.js";import{AccessibleTextController}from"../../../internal/accessible-text-controller.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{requestThenCommit}from"../../../internal/request-commit.js";import{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{renderInertPresentation}from"../../../internal/inert-presentation.js";import{cancelDeferredFocusReturn,captureFocusReturnOpener}from"../../../internal/deferred-focus-return.js";import{activateOverlay,collectFocusableElements,deepActiveElement}from"../../../internal/overlay-manager.js";import{readPersistedState,writePersistedState}from"../../../internal/persisted-state.js";import{definePersistedProperty,isPersistedPropertyExplicitlySet}from"../../../internal/persisted-restore.js";import{nextId}from"../../../internal/a11y.js";import{composedAccessibilityText}from"../../../internal/accessibility-visibility.js";import{observeScrollOverflow}from"../../../internal/scroll-overflow.js";import{scrollOverflowFadeStyles}from"../../../internal/scroll-overflow.styles.js";import{chevronIcon,closeIcon,expandIcon}from"../../../internal/icons.js";import{styles}from"./widget.styles.js";import{sanitizeCssInset}from"../../../internal/safe-css.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{LYRA_DEFAULT_widgetCollapse,LYRA_DEFAULT_widgetExitFullscreen,LYRA_DEFAULT_widgetExpand,LYRA_DEFAULT_widgetExpandToFullscreen,LYRA_DEFAULT_widgetFullscreenPanel,LYRA_DEFAULT_widgetViewGroup}from"../../../internal/default-strings/layout.generated.js";const MAX_WIDGET_VIEWS=256;function snapshotWidgetViews(value){if(!Array.isArray(value))return Object.freeze([]);const seen=new Set,normalized=[];for(const candidate of value.slice(0,MAX_WIDGET_VIEWS))try{if(!candidate||typeof candidate!="object")continue;const record=candidate,viewId=record.viewId;if(typeof viewId!="string"||viewId.length===0||viewId!==viewId.trim()||seen.has(viewId))continue;const label=record.label,ariaLabel=record.ariaLabel,icon=record.icon;if(label!==void 0&&typeof label!="string"||ariaLabel!==void 0&&typeof ariaLabel!="string")continue;seen.add(viewId),normalized.push(Object.freeze({viewId,...label!==void 0?{label}:{},...icon!==void 0?{icon}:{},...ariaLabel!==void 0?{ariaLabel}:{}}))}catch{}return Object.freeze(normalized)}const collapseWriteGuards=new WeakMap;function collapseWriteGuardFor(widget){let guard=collapseWriteGuards.get(widget);return guard||(guard=new VetoWriteGuard,collapseWriteGuards.set(widget,guard)),guard}function installSynchronousCollapsedReflection(prototype){const installed=Object.getOwnPropertyDescriptor(prototype,"collapsed"),installedSet=installed.set;Object.defineProperty(prototype,"collapsed",{...installed,set(next){installedSet.call(this,next),markVetoGuardWrite(collapseWriteGuardFor(this)),this.toggleAttribute("collapsed",this.collapsed)}})}class LyraWidget extends LyraElement{constructor(){super(...arguments),this.actionsScrollOverflow=observeScrollOverflow(this,()=>this.renderRoot.querySelector('[part="actions"]')),this.viewTogglesScrollOverflow=observeScrollOverflow(this,()=>this.renderRoot.querySelector('[part="view-toggles"]')),this.label="",this.accessibleLabel=null,this.sublabel="",this.collapsible=!1,this.expandable=!1,this.fullscreen=!1,this.fullscreenInset="",this.backdropInset="",this.size="m",this.effectiveViews=Object.freeze([]),this.activeViewId="",this.slotPresence=new SlotPresenceController(this),this.nativeModal=new NativeModalCarrier(this,{onCancel:()=>{this.overlayHandle?.isTopmost()&&this.dismissFullscreen()},onUnexpectedClose:()=>{this.overlayHandle?.isTopmost()&&this.dismissFullscreen(),this.fullscreen&&this.nativeModal.show()}}),this.labelTextObserver=new AccessibleTextController(this,[],()=>{const assigned=this.shadowRoot?.querySelector('slot[name="label"]')?.assignedElements({flatten:!0})??[];this.syncLabelSlot(assigned)},["alt","aria-labelledby","slot"],!1),this.ownerRealmGeneration=0,this.bodyId=nextId("widget-body"),this.persistReady=!1,this.onLabelSlotChange=e=>{const assigned=e.target.assignedElements({flatten:!0});this.syncLabelSlot(assigned)},this.setActiveView=viewId=>{if(viewId!==this.activeViewId){if(this.emit("lr-view-request",{viewId},{cancelable:!0}).defaultPrevented)return;this.activeViewId=viewId,this.emit("lr-view-change",{viewId})}this.emit("lr-activate",{value:viewId})},this.dispatchingCollapse=!1,this.toggleCollapsed=()=>{this.requestCollapse(!this.collapsed)},this.toggleFullscreen=e=>{const next=!this.fullscreen,trigger=e.currentTarget;this.requestFullscreenChange(next)&&next&&(this.explicitTrigger=trigger)},this.dismissFullscreen=()=>{this.fullscreen&&this.requestFullscreenChange(!1)},this.onBackdropClick=()=>{this.overlayHandle?.dismissBackdrop()}}static{this.defaultStrings={...super.defaultStrings,widgetCollapse:LYRA_DEFAULT_widgetCollapse,widgetExitFullscreen:LYRA_DEFAULT_widgetExitFullscreen,widgetExpand:LYRA_DEFAULT_widgetExpand,widgetExpandToFullscreen:LYRA_DEFAULT_widgetExpandToFullscreen,widgetFullscreenPanel:LYRA_DEFAULT_widgetFullscreenPanel,widgetViewGroup:LYRA_DEFAULT_widgetViewGroup}}static{this.styles=[LyraElement.styles,nativeModalCarrierStyles,scrollOverflowFadeStyles,styles]}static{this.properties={collapsed:{type:Boolean,reflect:!0,noAccessor:!0}}}static{definePersistedProperty(this.prototype,"collapsed",{initial:!1,attribute:!0,type:Boolean,reflect:!0,coerce:next=>!!next}),installSynchronousCollapsedReflection(this.prototype)}get views(){return this.effectiveViews}set views(value){if(value===this.viewsSource||value===this.effectiveViews)return;this.viewsSource=value;const previous=this.effectiveViews;this.effectiveViews=snapshotWidgetViews(value),this.requestUpdate("views",previous)}get storageFullKey(){return this.storageKey?`lr-widget:${this.storageKey}`:void 0}willUpdate(changed){if(super.willUpdate(changed),!this.hasUpdated){const labelChildren=Array.from(this.children).filter(el=>el.getAttribute("slot")==="label");this.labelSlotText=this.readLabelSlotText(labelChildren);const parsed=readPersistedState(this.storageFullKey,v=>typeof v=="object"&&v!==null);parsed&&typeof parsed.collapsed=="boolean"&&!isPersistedPropertyExplicitlySet(this,"collapsed")&&(this.collapsed=parsed.collapsed)}if(changed.has("fullscreen")&&(this.fullscreen?this.activateFullscreenOverlay():this.deactivateFullscreenOverlay()),changed.has("views")||changed.has("activeViewId")){const focused=this.renderRoot?.querySelector('[part="view-toggle"]:focus');this.focusedViewIdBeforeUpdate=focused?.dataset.viewId;const views=this.views;if(!views.some(view=>view.viewId===this.activeViewId)){const forcedBySibling=this.hasUpdated&&changed.has("views")&&!changed.has("activeViewId");this.activeViewId=views[0]?.viewId??"",forcedBySibling&&this.emit("lr-view-change",{viewId:this.activeViewId})}}}updated(changed){super.updated(changed),this.fullscreen&&this.nativeModal.show();const actionsSlot=this.renderRoot.querySelector('slot[name="actions"]');if(this.actionsScrollOverflow.observeExtra(actionsSlot?actionsSlot.assignedElements({flatten:!0}):[]),this.viewTogglesScrollOverflow.observeExtra(this.renderRoot.querySelectorAll('[part="view-toggle"]')),this.persistReady&&changed.has("collapsed")&&writePersistedState(this.storageFullKey,{collapsed:this.collapsed}),this.persistReady=!0,changed.has("fullscreen")&&this.fullscreen)this.overlayHandle?.focusInitial();else if(changed.has("collapsed")&&this.fullscreen){const panel=this.shadowRoot?.querySelector('[part="base"]'),active=deepActiveElement(this.ownerDocument);panel&&!collectFocusableElements(panel).includes(active)&&(active&&typeof active.blur=="function"&&active.blur(),this.overlayHandle?.focusInitial())}if(changed.has("views")||changed.has("activeViewId")){const focusedId=this.focusedViewIdBeforeUpdate;this.focusedViewIdBeforeUpdate=void 0,focusedId&&!this.views.some(view=>view.viewId===focusedId)&&Array.from(this.renderRoot.querySelectorAll('[part="view-toggle"]')).find(toggle=>toggle.dataset.viewId===this.activeViewId)?.focus()}}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.fullscreen&&(this.overlayHandle?.isActive()?this.overlayHandle.resume():this.activateFullscreenOverlay(),this.queueOwnerMicrotask(()=>{this.nativeModal.show(),this.overlayHandle?.focusInitial()})),this.hasUpdated&&this.queueOwnerMicrotask(()=>{const slot=this.shadowRoot?.querySelector('slot[name="label"]');slot&&this.syncLabelSlot(slot.assignedElements({flatten:!0}))})}disconnectedCallback(){this.resetOwnerRealmWork(),cancelDeferredFocusReturn(this),super.disconnectedCallback(),this.nativeModal.hide(),this.overlayHandle?.suspend()}adoptedCallback(){super.adoptedCallback(),this.resetOwnerRealmWork();const slot=this.shadowRoot?.querySelector('slot[name="label"]');this.isConnected&&slot&&this.syncLabelSlot(slot.assignedElements({flatten:!0})),this.labelTextObserver.adopted()}resetOwnerRealmWork(){this.ownerRealmGeneration+=1,this.labelTextObserver.setEnabled(!1)}queueOwnerMicrotask(callback){const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ownerWindow||!this.isConnected)return;const generation=this.ownerRealmGeneration;ownerWindow.queueMicrotask(()=>{this.ownerRealmGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||callback()})}activateFullscreenOverlay(){this.nativeModal.prepare(),this.fullscreenOpener=this.explicitTrigger??captureFocusReturnOpener(this),this.overlayHandle=activateOverlay({host:this,panel:()=>this.shadowRoot?.querySelector('[part="base"]')??null,onEscape:this.dismissFullscreen,onBackdrop:this.dismissFullscreen,restoreFocusTo:this.explicitTrigger,lockScroll:!0,suspendWhenUnrendered:!0,deferredReturn:()=>{const opener=this.fullscreenOpener;return opener?{candidates:()=>[opener],isCurrent:()=>!this.fullscreen}:void 0}}),this.explicitTrigger=void 0}deactivateFullscreenOverlay(){this.nativeModal.hide(),this.nativeModal.prepare(!1),this.overlayHandle?.deactivate(),this.overlayHandle=void 0,this.fullscreenOpener=void 0}syncLabelSlot(assigned){this.labelSlotText=this.readLabelSlotText(assigned),this.labelTextObserver.setEnabled(assigned.length>0),this.labelTextObserver.bind()}readLabelSlotText(assigned){return composedAccessibilityText(assigned).replace(/\s+/g," ").trim()||void 0}requestCollapse(next){if(this.dispatchingCollapse)return;const previous=this.collapsed;this.dispatchingCollapse=!0;try{requestThenCommit({requestDetail:{expanded:!next},emitRequest:(proposal,init)=>this.emit("lr-toggle-request",proposal,init),guard:collapseWriteGuardFor(this),commit:()=>{this.collapsed===previous&&(this.collapsed=next,this.emit("lr-toggle",{expanded:!next}))}})}finally{this.dispatchingCollapse=!1}}requestFullscreenChange(next){return this.emit("lr-fullscreen-request",{fullscreen:next},{cancelable:!0}).defaultPrevented?!1:(this.fullscreen=next,this.emit("lr-fullscreen-change",{fullscreen:next}),!0)}render(){const hasLabel=(this.label??"").length>0,hasSublabel=(this.sublabel??"").length>0,views=this.views,fullscreenInset=sanitizeCssInset(this.fullscreenInset),backdropInset=sanitizeCssInset(this.backdropInset);return this.nativeModal.render(html`
|
|
2
2
|
${this.fullscreen?html`<div
|
|
3
3
|
part="backdrop"
|
|
4
4
|
style=${backdropInset?styleMap({"--lr-widget-backdrop-inset":backdropInset}):nothing}
|
|
@@ -14,7 +14,7 @@ import{__decorate}from"tslib";import{NativeModalCarrier}from"../../../internal/n
|
|
|
14
14
|
>
|
|
15
15
|
<div part="header">
|
|
16
16
|
<div part="title">
|
|
17
|
-
${renderInertPresentation(html`<slot name="start"
|
|
17
|
+
${renderInertPresentation(html`<slot name="start"></slot>`,{part:"icon",hidden:!this.slotPresence.has("start")})}
|
|
18
18
|
<div part="label-group">
|
|
19
19
|
<span part="label" ?hidden=${!hasLabel&&!this.slotPresence.has("label")}
|
|
20
20
|
><slot name="label" @slotchange=${this.onLabelSlotChange}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./charts/chart-3d/chart-3d.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./viewers/model-viewer/model-viewer.js";
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* start (or forever, for the last one). Equal starts do not end one another; caller order is
|
|
3
|
-
* retained. The player builds a bounded interval index so playback reconciliation uses logarithmic lookup. Cue collections require a trimmed nonempty `cueId` and retain the
|
|
4
|
-
* first occurrence when IDs repeat. */
|
|
5
|
-
export interface LyraAvCue{readonly cueId:string;readonly start:number;readonly end?:number;readonly text:string;readonly speaker?:string;}
|
|
6
|
-
/** A native `<track>` source (subtitles/captions/descriptions). */
|
|
7
|
-
export interface LyraAvTrack{readonly src:string;readonly kind:'subtitles'|'captions'|'descriptions';readonly srclang:string;readonly label:string;readonly default?:boolean;}export declare const MAX_CUE_ID_CHARS=256;export declare const MAX_CUE_TEXT_CHARS=100000;export declare const MAX_CUE_SPEAKER_CHARS=4096;export declare const EMPTY_LYRA_AV_CUES:readonly LyraAvCue[];export declare const EMPTY_LYRA_AV_TRACKS:readonly LyraAvTrack[];
|
|
8
|
-
/** Clones, validates, bounds, and freezes transcript cues. */
|
|
9
|
-
export declare function snapshotLyraAvCues(value:unknown):readonly LyraAvCue[];
|
|
10
|
-
/** Clones, validates, bounds, and freezes native text-track metadata. */
|
|
11
|
-
export declare function snapshotLyraAvTracks(value:unknown):readonly LyraAvTrack[];
|
|
12
|
-
/** Whether the retained cue snapshot contains text or speaker content that `search()` can match. */
|
|
13
|
-
export declare function hasSearchableLyraAvCues(cues:readonly LyraAvCue[]):boolean;
|
|
1
|
+
export{MAX_CUE_ID_CHARS,MAX_CUE_TEXT_CHARS,MAX_CUE_SPEAKER_CHARS,EMPTY_LYRA_AV_CUES,EMPTY_LYRA_AV_TRACKS,snapshotLyraAvCues,snapshotLyraAvTracks,hasSearchableLyraAvCues,}from'../../../internal/av-metadata.js';export type{LyraAvCue,LyraAvTrack,}from'../../../internal/av-metadata.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{MAX_CUE_ID_CHARS,MAX_CUE_TEXT_CHARS,MAX_CUE_SPEAKER_CHARS,EMPTY_LYRA_AV_CUES,EMPTY_LYRA_AV_TRACKS,snapshotLyraAvCues,snapshotLyraAvTracks,hasSearchableLyraAvCues}from"../../../internal/av-metadata.js";export{EMPTY_LYRA_AV_CUES,EMPTY_LYRA_AV_TRACKS,MAX_CUE_ID_CHARS,MAX_CUE_SPEAKER_CHARS,MAX_CUE_TEXT_CHARS,hasSearchableLyraAvCues,snapshotLyraAvCues,snapshotLyraAvTracks};
|
|
@@ -9,7 +9,7 @@ import{__decorate}from"tslib";import{AvCueSourceController}from"./av-player-cue-
|
|
|
9
9
|
<span part="cue-time">${formatMediaTime(start,this.effectiveLocale)}</span>
|
|
10
10
|
${c.speaker?html`<span part="cue-speaker">${c.speaker}</span>`:nothing}
|
|
11
11
|
<span part="cue-text">${c.text}</span>
|
|
12
|
-
</button>`},this.transcriptRenderItem=this.renderCue,new ThemeWatcher(this,()=>{this.hasWaveform&&this.drawWaveform()})}get mediaEl(){return this.mediaController.element}focus(options){this.mediaEl?.focus(options)}blur(){this.mediaEl?.blur()}click(){this.mediaEl?.click()}get currentTime(){return this.mediaController.currentTime}set currentTime(value){this.mediaController.currentTime=value,this.currentTimeState=this.mediaController.currentTime}detectedKind(){return this.kind==="audio"||this.kind==="video"?this.kind:(this.mimeType??"").startsWith("audio/")?"audio":"video"}get effectivePreload(){return this.preload==="none"||this.preload==="auto"?this.preload:"metadata"}willUpdate(changed){super.willUpdate(changed),this.captureWaveform(),this.captureCueSource(),changed.has("controlsSurface")&&(this.controlsSurface=CONTROLS_SURFACE.normalizeReflected(this,"controls-surface",this.controlsSurface)),this.semanticInternals.role=hostAriaLabel(this)!==null?"region":null;const mayEmitConnectionTransition=this.isConnected&&!this.connectionEventBaselinePending,locale=this.effectiveLocale;let refreshTranscript=!1;if(changed.has("kind")&&this.kind!==void 0&&this.kind!=="audio"&&this.kind!=="video"&&(this.kind=void 0),changed.has("preload")&&this.preload!==this.effectivePreload&&(this.preload=this.effectivePreload),this._cueSource===null&&changed.has("cues")&&(this.rebuildCueKeys(),this.metadataLoaded&&this.reconcileActiveCue()),this.transcriptLocale!==locale&&(this.transcriptLocale=locale,refreshTranscript=!0),this.hasUpdated&&(changed.has("src")||changed.has("kind")||changed.has("mimeType"))&&(this.duration=0,this.currentTimeState=0,this.activeCueId=null,this.activeCueIndex=-1,this.metadataLoaded=!1,this.sourceError=!1,this.playbackError=!1,this.lastTimeChangeAt=0,this.pendingSeekEmission=null,this.lastEmittedTime=null,this.lastReportedSourceError=NO_REPORTED_ERROR,this.mediaController.startGeneration(),changed.has("src")&&this.src&&!safeMediaSrc(this.src))){const error=new TypeError("The media source URL is not allowed.");mayEmitConnectionTransition&&(this.announceRenderError(),this.emit("lr-render-error",{error}))}this._cueSource===null&&this.searchQuery&&(changed.has("cues")||this.searchLocale!==locale)&&(this.reconcileSearchMatches(changed.get("cues")),refreshTranscript=!0),this._cueSource!==null&&this.searchQuery&&this.searchLocale!==locale&&this.search(this.searchQuery),refreshTranscript&&this.refreshTranscriptRenderItem()}updated(changed){super.updated(changed),changed.has("playbackRate")&&(this.mediaController.playbackRate=this.playbackRate,changed.get("playbackRate")!==void 0&&this.emit("lr-rate-change",{rate:this.playbackRate})),changed.has("volume")&&(this.mediaController.volume=this.volume),changed.has("muted")&&(this.mediaController.muted=this.muted),(this.waveformInputChanged||["peaks","duration","metadataLoaded","src","kind","mimeType"].some(key=>changed.has(key)))&&(this.syncWaveformVisibilityObserver(),this.syncWaveformResizeObserver(),this.drawWaveform()),this.waveformInputChanged=!1;const unavailable=this.waveformUnavailable;unavailable&&!this.waveformFailureAnnounced&&!this.connectionEventBaselinePending&&this.announcements.announceAssertive(this.localize("avPlayerWaveformUnavailable")),this.waveformFailureAnnounced=unavailable;const transcriptUnavailable=this._cueSource!==null&&this.cueSourceController.unavailable;transcriptUnavailable&&!this.transcriptFailureAnnounced&&!this.connectionEventBaselinePending&&this.announcements.announceAssertive(this.localize("avPlayerTranscriptUnavailable")),this.transcriptFailureAnnounced=transcriptUnavailable;const searchUnavailable=this._cueSource!==null&&this.cueSourceController.searchUnavailable;searchUnavailable&&!this.searchFailureAnnounced&&!this.connectionEventBaselinePending&&this.announcements.announceAssertive(this.localize("sourceSearchUnavailable")),this.searchFailureAnnounced=searchUnavailable,this.cueSourceDirty&&this.isConnected&&!this.cueSourceContinuationQueued&&(this.cueSourceContinuationQueued=!0,queueMicrotask(()=>{this.cueSourceContinuationQueued=!1,this.cueSourceDirty&&this.isConnected&&this.requestUpdate("cueSourceContinuation",null)})),this.isConnected&&(this.connectionEventBaselinePending=!1),this.waveformInputDirty&&this.isConnected&&!this.waveformContinuationQueued&&(this.waveformContinuationQueued=!0,queueMicrotask(()=>{this.waveformContinuationQueued=!1,this.waveformInputDirty&&this.isConnected&&this.requestUpdate("waveformContinuation",null)}))}connectedCallback(){super.connectedCallback(),this.connectionEventBaselinePending=!0,this.mediaController.reconnect(),this.bindResizeWindow(),this.syncWaveformVisibilityObserver(),this.syncWaveformResizeObserver(),this.waveformDirty&&this.drawWaveform(),this.requestUpdate()}firstUpdated(changed){super.firstUpdated(changed),this.drawWaveform()}disconnectedCallback(){this.cueSourceController.revoke(),this.cueSourceDirty=!0,this.activeCueId=null,this.activeCueIndex=-1,this.connectionEventBaselinePending=!0,this.mediaController.disconnect(),this.unbindResizeWindow(),this.unbindWaveformResizeObserver(),this.cancelWaveformDrawFrame(),this.waveformDetachedObserverWindow=this.waveformObserverWindow,this.unbindWaveformVisibilityObserver(),this.waveformDirty=this.hasWaveform,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.announcements.adopted(),this.cueSourceController.adopted(),this.cueSourceDirty=!0,this.requestUpdate("cueSourceAdopted",null),this.bindResizeWindow(),this.syncWaveformVisibilityObserver(),this.syncWaveformResizeObserver(),this.isConnected&&this.waveformDirty&&this.drawWaveform()}announceRenderError(){this.announcements.announceAssertive(this.localize("avPlayerFailedToLoad"))}bindResizeWindow(){const nextWindow=this.isConnected?this.ownerDocument.defaultView:null;this.resizeWindow!==nextWindow&&(this.unbindResizeWindow(),this.resizeWindow=nextWindow??void 0,this.resizeWindow?.addEventListener("resize",this.onWindowResize))}unbindResizeWindow(){this.resizeWindow?.removeEventListener("resize",this.onWindowResize),this.resizeWindow=void 0}syncWaveformVisibilityObserver(){const owner=this.isConnected&&this.hasWaveform?this.ownerDocument.defaultView:null;if(this.waveformIntersectionObserver&&this.waveformObserverWindow===owner)return;const needsFreshSameRealmVisibility=owner!==null&&this.waveformDetachedObserverWindow===owner;if(owner!==null&&(this.waveformDetachedObserverWindow=void 0),this.cancelWaveformDrawFrame(),this.unbindWaveformVisibilityObserver(),!owner)return;const IntersectionObserverCtor=owner.IntersectionObserver;if(!IntersectionObserverCtor){this.waveformVisible=!0;return}needsFreshSameRealmVisibility&&(this.waveformVisible=!1),this.waveformDirty=!0;let observer;observer=new IntersectionObserverCtor(entries=>{if(!this.isConnected||this.ownerDocument.defaultView!==owner||this.waveformIntersectionObserver!==observer)return;const entry=entries.find(candidate=>candidate.target===this);!entry||entry.isIntersecting===this.waveformVisible||(this.waveformVisible=entry.isIntersecting,this.waveformVisible?this.waveformDirty&&this.scheduleWaveformDraw():this.cancelWaveformDrawFrame())}),this.waveformObserverWindow=owner,this.waveformIntersectionObserver=observer,observer.observe(this)}unbindWaveformVisibilityObserver(){this.waveformIntersectionObserver?.disconnect(),this.waveformIntersectionObserver=void 0,this.waveformObserverWindow=void 0}syncWaveformResizeObserver(){const target=this.isConnected&&this.hasWaveform?this.canvasEl:void 0,owner=target?.ownerDocument.defaultView;if(target&&owner&&this.waveformResizeObserver&&this.waveformResizeObserverWindow===owner&&this.waveformResizeTarget===target||(this.unbindWaveformResizeObserver(),!target||!owner||typeof owner.ResizeObserver!="function"))return;let observer;observer=new owner.ResizeObserver(entries=>{if(!this.isConnected||this.ownerDocument.defaultView!==owner||this.waveformResizeObserver!==observer||this.waveformResizeTarget!==target||!entries.some(entry=>entry.target===target))return;const width=positiveFinite(target.clientWidth),height=positiveFinite(target.clientHeight),dpr=positiveFinite(owner.devicePixelRatio),previous=this.lastWaveformAllocation;previous?.target===target&&previous.width===width&&previous.height===height&&previous.dpr===dpr||this.drawWaveform()}),this.waveformResizeObserver=observer,this.waveformResizeObserverWindow=owner,this.waveformResizeTarget=target,observer.observe(target)}unbindWaveformResizeObserver(){this.waveformResizeObserver?.disconnect(),this.waveformResizeObserver=void 0,this.waveformResizeObserverWindow=void 0,this.waveformResizeTarget=void 0,this.lastWaveformAllocation=void 0}play(){return this.mediaController.play()}pause(){this.mediaController.pause()}toggle(){const media=this.mediaEl;if(media?.paused){const generation=this.mediaController.generation;this.play().catch(error=>{!this.isConnected||!this.mediaController.isCurrentGeneration(generation,media)||this.onPlaybackFailure(error)})}else this.pause()}seek(seconds){this.currentTime=seconds,this.emitTimeChange(!0,!0),this.pendingSeekEmission=this.currentTimeState,this.reconcileActiveCue(!0)}async applyAnchor(anchor){return anchor.kind!=="time-range"||!this.metadataLoaded?!1:(this.seek(anchor.start),!0)}onLoadedMetadata(){this.metadataLoaded=!0,this.duration=this.mediaController.duration,this.currentTimeState=this.mediaController.currentTime,this.sourceError=!1,this.playbackError=!1,this.lastReportedSourceError=NO_REPORTED_ERROR,this.reconcileActiveCue(),this.emit("lr-load",{duration:this.duration,kind:this.detectedKind()})}onPlay(){this.playbackError=!1,this.emit("lr-play",null)}onPause(){this.emit("lr-pause",null)}onMediaError(){const error=this.mediaEl?.error??null,identity=error??"native-media-error-without-detail";identity!==this.lastReportedSourceError&&(this.lastReportedSourceError=identity,this.sourceError=!0,this.playbackError=!1,this.announceRenderError(),this.emit("lr-render-error",{error:error??new Error("The media failed to load.")}))}onNativeMediaEvent(event){switch(event.type){case"loadedmetadata":this.onLoadedMetadata();break;case"durationchange":this.duration=this.mediaController.duration,this.reconcileActiveCue();break;case"play":this.onPlay();break;case"pause":this.onPause();break;case"error":this.onMediaError();break;case"volumechange":{const nextVolume=this.mediaController.volume,nextMuted=this.mediaController.muted;this.volume!==nextVolume&&(this.volume=nextVolume),this.muted!==nextMuted&&(this.muted=nextMuted);break}case"ratechange":{const nextRate=this.mediaController.playbackRate;this.playbackRate!==nextRate&&(this.playbackRate=nextRate);break}case"timeupdate":this.onTimeUpdate();break;case"seeked":this.onSeeked();break;default:break}}emitTimeChange(force,allowDuplicate=!1){const now=Date.now();if(!force&&now-this.lastTimeChangeAt<TIME_CHANGE_THROTTLE_MS)return;const nextTime=this.currentTime;this.currentTimeState=nextTime,!(!allowDuplicate&&nextTime===this.lastEmittedTime)&&(this.lastTimeChangeAt=now,this.lastEmittedTime=nextTime,this.emit("lr-time-change",{currentTime:this.currentTimeState}))}onTimeUpdate(){this.emitTimeChange(!1),this.reconcileActiveCue()}reconcileActiveCue(discontinuity=!1){const time=this.currentTime;if(this._cueSource!==null){this.cueSourceController.updateTime(time,discontinuity);return}const cues=this.cues,duration=this.duration>0?this.duration:0;(!this.cueIndex||this.indexedCues!==cues||this.indexedCueDuration!==duration)&&(this.cueIndex=new AvCueIndex(cues,duration),this.indexedCues=cues,this.indexedCueDuration=duration);const activeIndex=this.cueIndex.at(time),nextId=cues[activeIndex]?.cueId??null;this.setActiveCue(nextId,activeIndex)}setActiveCue(nextId,activeIndex){(nextId!==this.activeCueId||activeIndex!==this.activeCueIndex)&&(this.activeCueId=nextId,this.activeCueIndex=activeIndex,this.emit("lr-cue-change",Object.freeze({cueId:nextId,index:activeIndex})))}onSeeked(){const completedTime=this.currentTime;this.pendingSeekEmission===null||completedTime!==this.pendingSeekEmission?this.emitTimeChange(!0):this.currentTimeState=completedTime,this.pendingSeekEmission=null,this.reconcileActiveCue(!0)}async search(query2){return this._cueSource!==null?(this.captureCueSource(),this.searchQuery=query2.trim(),this.searchLocale=this.effectiveLocale,this.cueSourceController.search(this.searchQuery,this.searchLocale)):(this.searchQuery=query2,this.reconcileSearchMatches(),this.activeSearchIndex=this.searchMatches.length?0:-1,this.refreshTranscriptRenderItem(),this.emitSearchChange(),await this.revealActiveSearchMatch(),this.searchMatches.length)}reconcileSearchMatches(previousCues){const locale=this.effectiveLocale,q=this.searchQuery.trim().toLocaleLowerCase(locale),previousMatchIndex=this.searchMatches[this.activeSearchIndex],previousActiveId=previousCues&&previousMatchIndex!==void 0?previousCues[previousMatchIndex]?.cueId:void 0;if(this.searchMatches=q?this.cues.reduce((acc,cue,index)=>((cue.text.toLocaleLowerCase(locale).includes(q)||(cue.speaker??"").toLocaleLowerCase(locale).includes(q))&&acc.push(index),acc),[]):[],this.searchMatchIndices=new Set(this.searchMatches),this.searchLocale=locale,!this.searchMatches.length){this.activeSearchIndex=-1;return}const retainedPosition=previousActiveId?this.searchMatches.findIndex(index=>this.cues[index]?.cueId===previousActiveId):-1;this.activeSearchIndex=retainedPosition>=0?retainedPosition:Math.min(Math.max(0,this.activeSearchIndex),this.searchMatches.length-1)}async searchNext(){return this._cueSource!==null?this.cueSourceController.navigate(1):this.searchMatches.length?(this.activeSearchIndex=(this.activeSearchIndex+1)%this.searchMatches.length,this.refreshTranscriptRenderItem(),this.emitSearchChange(),await this.revealActiveSearchMatch(),!0):!1}async searchPrevious(){return this._cueSource!==null?this.cueSourceController.navigate(-1):this.searchMatches.length?(this.activeSearchIndex=(this.activeSearchIndex-1+this.searchMatches.length)%this.searchMatches.length,this.refreshTranscriptRenderItem(),this.emitSearchChange(),await this.revealActiveSearchMatch(),!0):!1}clearSearch(){if(this.searchQuery="",this._cueSource!==null){this.cueSourceController.clearSearch();return}this.searchMatches=[],this.searchMatchIndices=new Set,this.activeSearchIndex=-1,this.refreshTranscriptRenderItem(),this.emitSearchChange()}emitSearchChange(){this.emit("lr-search-change",{query:this.searchQuery,matchCount:this.searchMatches.length,matchCountExact:!0,activeIndex:this.activeSearchIndex})}async revealSourceCue(index,epoch,authoritative=()=>!0){const current=()=>authoritative()&&this.cueSourceController.isCurrent(epoch);if(!current()||!await this.cueSourceController.window.ensure(index)||!current()||(await this.updateComplete,!current()))return!1;const list=this.renderRoot.querySelector(tag("virtual-list"));return!list||(await list.updateComplete,!current())?!1:(list.scrollToIndex(index,{align:"auto",behavior:"auto"}),current())}async revealActiveSearchMatch(){await this.updateComplete;const list=this.renderRoot.querySelector(tag("virtual-list"));if(!list)return;await list.updateComplete;const index=this.searchMatches[this.activeSearchIndex];index!==void 0&&list.scrollToIndex(index,{align:"auto",behavior:"auto"})}drawWaveform(){const canvas=this.canvasEl,ownerWindow=this.ownerDocument.defaultView;if(!this.hasWaveform){this.waveformDirty=!1;return}if(!this.isConnected||!canvas||!ownerWindow||!this.waveformVisible){this.waveformDirty=!0;return}this.cancelWaveformDrawFrame(),this.waveformDirty=!1,this.paintWaveform()}paintWaveform(){const canvas=this.canvasEl;if(!canvas||!this.hasWaveform)return;const ownerWindow=this.ownerDocument.defaultView;if(!ownerWindow)return;const dpr=positiveFinite(ownerWindow.devicePixelRatio),width=positiveFinite(canvas.clientWidth),height=positiveFinite(canvas.clientHeight),allocation=resolveBoundedCanvasAllocation({cssWidth:width,cssHeight:height,desiredScale:dpr,maxDimension:MAX_CANVAS_DIMENSION,maxPixels:MAX_CANVAS_PIXELS});this.lastWaveformAllocation={target:canvas,width,height,dpr},canvas.width=allocation.pixelWidth,canvas.height=allocation.pixelHeight;const ctx=canvas.getContext("2d");if(!ctx)return;const scaleX=allocation.scaleX,scaleY=allocation.scaleY;ctx.setTransform(scaleX,0,0,scaleY,0,0),ctx.clearRect(0,0,width,height),ctx.fillStyle=resolveCanvasColor(this,"var(--lr-color-brand)",ownerWindow.getComputedStyle(this).color);const peaks=this._waveform!==null&&this.waveformSnapshot?preparedWaveformPeaks(this.waveformSnapshot,canvas.width):waveformPaintPeaks(this.peaks,canvas.width),barWidth=width/peaks.length,physicalPixel=Math.min(barWidth,finiteNumber(1/scaleX,barWidth)),paintedBarWidth=Math.max(physicalPixel,barWidth-physicalPixel);peaks.forEach((peak,i)=>{const barHeight=Math.max(1,finiteRange(peak,0,0,1)*height);ctx.fillRect(i*barWidth,(height-barHeight)/2,paintedBarWidth,barHeight)})}scheduleWaveformDraw(){if(this.waveformDrawFrame)return;const owner=this.ownerDocument.defaultView;if(!owner||!this.isConnected)return;const request={owner,handle:0};request.handle=owner.requestAnimationFrame(()=>{this.waveformDrawFrame===request&&(this.waveformDrawFrame=void 0,this.isConnected&&this.ownerDocument.defaultView===owner&&this.drawWaveform())}),this.waveformDrawFrame=request}cancelWaveformDrawFrame(){const request=this.waveformDrawFrame;request&&request.owner.cancelAnimationFrame(request.handle),this.waveformDrawFrame=void 0}renderMarkers(){if(!this.duration)return nothing;const ranged=this.highlights.filter(h=>h.anchor.kind==="time-range");return ranged.length?html`${ranged.map(h=>{const startSeconds=finiteRange(h.anchor.start,0,0,this.duration),endSeconds=h.anchor.end==null?startSeconds:finiteRange(h.anchor.end,startSeconds,startSeconds,this.duration),start=startSeconds/this.duration*100,end=endSeconds/this.duration*100;return html`<button
|
|
12
|
+
</button>`},this.transcriptRenderItem=this.renderCue,new ThemeWatcher(this,()=>{this.hasWaveform&&this.drawWaveform()})}get mediaEl(){return this.mediaController.element}focus(options){this.mediaEl?.focus(options)}blur(){this.mediaEl?.blur()}click(){this.mediaEl?.click()}get currentTime(){return this.mediaController.currentTime}set currentTime(value){this.mediaController.currentTime=value,this.currentTimeState=this.mediaController.currentTime}detectedKind(){return this.kind==="audio"||this.kind==="video"?this.kind:(this.mimeType??"").startsWith("audio/")?"audio":"video"}get effectivePreload(){return this.preload==="none"||this.preload==="auto"?this.preload:"metadata"}willUpdate(changed){super.willUpdate(changed),this.captureWaveform(),this.captureCueSource(),changed.has("controlsSurface")&&(this.controlsSurface=CONTROLS_SURFACE.normalizeReflected(this,"controls-surface",this.controlsSurface)),this.semanticInternals.role=hostAriaLabel(this)!==null?"region":null;const mayEmitConnectionTransition=this.isConnected&&!this.connectionEventBaselinePending,locale=this.effectiveLocale;let refreshTranscript=!1;if(changed.has("kind")&&this.kind!==void 0&&this.kind!=="audio"&&this.kind!=="video"&&(this.kind=void 0),changed.has("preload")&&this.preload!==this.effectivePreload&&(this.preload=this.effectivePreload),this._cueSource===null&&changed.has("cues")&&(this.rebuildCueKeys(),this.metadataLoaded&&this.reconcileActiveCue()),this.transcriptLocale!==locale&&(this.transcriptLocale=locale,refreshTranscript=!0),changed.has("strings")&&(refreshTranscript=!0),this.hasUpdated&&(changed.has("src")||changed.has("kind")||changed.has("mimeType"))&&(this.duration=0,this.currentTimeState=0,this.activeCueId=null,this.activeCueIndex=-1,this.metadataLoaded=!1,this.sourceError=!1,this.playbackError=!1,this.lastTimeChangeAt=0,this.pendingSeekEmission=null,this.lastEmittedTime=null,this.lastReportedSourceError=NO_REPORTED_ERROR,this.mediaController.startGeneration(),changed.has("src")&&this.src&&!safeMediaSrc(this.src))){const error=new TypeError("The media source URL is not allowed.");mayEmitConnectionTransition&&(this.announceRenderError(),this.emit("lr-render-error",{error}))}this._cueSource===null&&this.searchQuery&&(changed.has("cues")||this.searchLocale!==locale)&&(this.reconcileSearchMatches(changed.get("cues")),refreshTranscript=!0),this._cueSource!==null&&this.searchQuery&&this.searchLocale!==locale&&this.search(this.searchQuery),refreshTranscript&&this.refreshTranscriptRenderItem()}updated(changed){super.updated(changed),changed.has("playbackRate")&&(this.mediaController.playbackRate=this.playbackRate,changed.get("playbackRate")!==void 0&&this.emit("lr-rate-change",{rate:this.playbackRate})),changed.has("volume")&&(this.mediaController.volume=this.volume),changed.has("muted")&&(this.mediaController.muted=this.muted),(this.waveformInputChanged||["peaks","duration","metadataLoaded","src","kind","mimeType"].some(key=>changed.has(key)))&&(this.syncWaveformVisibilityObserver(),this.syncWaveformResizeObserver(),this.drawWaveform()),this.waveformInputChanged=!1;const unavailable=this.waveformUnavailable;unavailable&&!this.waveformFailureAnnounced&&!this.connectionEventBaselinePending&&this.announcements.announceAssertive(this.localize("avPlayerWaveformUnavailable")),this.waveformFailureAnnounced=unavailable;const transcriptUnavailable=this._cueSource!==null&&this.cueSourceController.unavailable;transcriptUnavailable&&!this.transcriptFailureAnnounced&&!this.connectionEventBaselinePending&&this.announcements.announceAssertive(this.localize("avPlayerTranscriptUnavailable")),this.transcriptFailureAnnounced=transcriptUnavailable;const searchUnavailable=this._cueSource!==null&&this.cueSourceController.searchUnavailable;searchUnavailable&&!this.searchFailureAnnounced&&!this.connectionEventBaselinePending&&this.announcements.announceAssertive(this.localize("sourceSearchUnavailable")),this.searchFailureAnnounced=searchUnavailable,this.cueSourceDirty&&this.isConnected&&!this.cueSourceContinuationQueued&&(this.cueSourceContinuationQueued=!0,queueMicrotask(()=>{this.cueSourceContinuationQueued=!1,this.cueSourceDirty&&this.isConnected&&this.requestUpdate("cueSourceContinuation",null)})),this.isConnected&&(this.connectionEventBaselinePending=!1),this.waveformInputDirty&&this.isConnected&&!this.waveformContinuationQueued&&(this.waveformContinuationQueued=!0,queueMicrotask(()=>{this.waveformContinuationQueued=!1,this.waveformInputDirty&&this.isConnected&&this.requestUpdate("waveformContinuation",null)}))}connectedCallback(){super.connectedCallback(),this.connectionEventBaselinePending=!0,this.mediaController.reconnect(),this.bindResizeWindow(),this.syncWaveformVisibilityObserver(),this.syncWaveformResizeObserver(),this.waveformDirty&&this.drawWaveform(),this.requestUpdate()}firstUpdated(changed){super.firstUpdated(changed),this.drawWaveform()}disconnectedCallback(){this.cueSourceController.revoke(),this.cueSourceDirty=!0,this.activeCueId=null,this.activeCueIndex=-1,this.connectionEventBaselinePending=!0,this.mediaController.disconnect(),this.unbindResizeWindow(),this.unbindWaveformResizeObserver(),this.cancelWaveformDrawFrame(),this.waveformDetachedObserverWindow=this.waveformObserverWindow,this.unbindWaveformVisibilityObserver(),this.waveformDirty=this.hasWaveform,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.announcements.adopted(),this.cueSourceController.adopted(),this.cueSourceDirty=!0,this.requestUpdate("cueSourceAdopted",null),this.bindResizeWindow(),this.syncWaveformVisibilityObserver(),this.syncWaveformResizeObserver(),this.isConnected&&this.waveformDirty&&this.drawWaveform()}announceRenderError(){this.announcements.announceAssertive(this.localize("avPlayerFailedToLoad"))}bindResizeWindow(){const nextWindow=this.isConnected?this.ownerDocument.defaultView:null;this.resizeWindow!==nextWindow&&(this.unbindResizeWindow(),this.resizeWindow=nextWindow??void 0,this.resizeWindow?.addEventListener("resize",this.onWindowResize))}unbindResizeWindow(){this.resizeWindow?.removeEventListener("resize",this.onWindowResize),this.resizeWindow=void 0}syncWaveformVisibilityObserver(){const owner=this.isConnected&&this.hasWaveform?this.ownerDocument.defaultView:null;if(this.waveformIntersectionObserver&&this.waveformObserverWindow===owner)return;const needsFreshSameRealmVisibility=owner!==null&&this.waveformDetachedObserverWindow===owner;if(owner!==null&&(this.waveformDetachedObserverWindow=void 0),this.cancelWaveformDrawFrame(),this.unbindWaveformVisibilityObserver(),!owner)return;const IntersectionObserverCtor=owner.IntersectionObserver;if(!IntersectionObserverCtor){this.waveformVisible=!0;return}needsFreshSameRealmVisibility&&(this.waveformVisible=!1),this.waveformDirty=!0;let observer;observer=new IntersectionObserverCtor(entries=>{if(!this.isConnected||this.ownerDocument.defaultView!==owner||this.waveformIntersectionObserver!==observer)return;const entry=entries.find(candidate=>candidate.target===this);!entry||entry.isIntersecting===this.waveformVisible||(this.waveformVisible=entry.isIntersecting,this.waveformVisible?this.waveformDirty&&this.scheduleWaveformDraw():this.cancelWaveformDrawFrame())}),this.waveformObserverWindow=owner,this.waveformIntersectionObserver=observer,observer.observe(this)}unbindWaveformVisibilityObserver(){this.waveformIntersectionObserver?.disconnect(),this.waveformIntersectionObserver=void 0,this.waveformObserverWindow=void 0}syncWaveformResizeObserver(){const target=this.isConnected&&this.hasWaveform?this.canvasEl:void 0,owner=target?.ownerDocument.defaultView;if(target&&owner&&this.waveformResizeObserver&&this.waveformResizeObserverWindow===owner&&this.waveformResizeTarget===target||(this.unbindWaveformResizeObserver(),!target||!owner||typeof owner.ResizeObserver!="function"))return;let observer;observer=new owner.ResizeObserver(entries=>{if(!this.isConnected||this.ownerDocument.defaultView!==owner||this.waveformResizeObserver!==observer||this.waveformResizeTarget!==target||!entries.some(entry=>entry.target===target))return;const width=positiveFinite(target.clientWidth),height=positiveFinite(target.clientHeight),dpr=positiveFinite(owner.devicePixelRatio),previous=this.lastWaveformAllocation;previous?.target===target&&previous.width===width&&previous.height===height&&previous.dpr===dpr||this.drawWaveform()}),this.waveformResizeObserver=observer,this.waveformResizeObserverWindow=owner,this.waveformResizeTarget=target,observer.observe(target)}unbindWaveformResizeObserver(){this.waveformResizeObserver?.disconnect(),this.waveformResizeObserver=void 0,this.waveformResizeObserverWindow=void 0,this.waveformResizeTarget=void 0,this.lastWaveformAllocation=void 0}play(){return this.mediaController.play()}pause(){this.mediaController.pause()}toggle(){const media=this.mediaEl;if(media?.paused){const generation=this.mediaController.generation;this.play().catch(error=>{!this.isConnected||!this.mediaController.isCurrentGeneration(generation,media)||this.onPlaybackFailure(error)})}else this.pause()}seek(seconds){this.currentTime=seconds,this.emitTimeChange(!0,!0),this.pendingSeekEmission=this.currentTimeState,this.reconcileActiveCue(!0)}async applyAnchor(anchor){return anchor.kind!=="time-range"||!this.metadataLoaded?!1:(this.seek(anchor.start),!0)}onLoadedMetadata(){this.metadataLoaded=!0,this.duration=this.mediaController.duration,this.currentTimeState=this.mediaController.currentTime,this.sourceError=!1,this.playbackError=!1,this.lastReportedSourceError=NO_REPORTED_ERROR,this.reconcileActiveCue(),this.emit("lr-load",{duration:this.duration,kind:this.detectedKind()})}onPlay(){this.playbackError=!1,this.emit("lr-play",null)}onPause(){this.emit("lr-pause",null)}onMediaError(){const error=this.mediaEl?.error??null,identity=error??"native-media-error-without-detail";identity!==this.lastReportedSourceError&&(this.lastReportedSourceError=identity,this.sourceError=!0,this.playbackError=!1,this.announceRenderError(),this.emit("lr-render-error",{error:error??new Error("The media failed to load.")}))}onNativeMediaEvent(event){switch(event.type){case"loadedmetadata":this.onLoadedMetadata();break;case"durationchange":this.duration=this.mediaController.duration,this.reconcileActiveCue();break;case"play":this.onPlay();break;case"pause":this.onPause();break;case"error":this.onMediaError();break;case"volumechange":{const nextVolume=this.mediaController.volume,nextMuted=this.mediaController.muted;this.volume!==nextVolume&&(this.volume=nextVolume),this.muted!==nextMuted&&(this.muted=nextMuted);break}case"ratechange":{const nextRate=this.mediaController.playbackRate;this.playbackRate!==nextRate&&(this.playbackRate=nextRate);break}case"timeupdate":this.onTimeUpdate();break;case"seeked":this.onSeeked();break;default:break}}emitTimeChange(force,allowDuplicate=!1){const now=Date.now();if(!force&&now-this.lastTimeChangeAt<TIME_CHANGE_THROTTLE_MS)return;const nextTime=this.currentTime;this.currentTimeState=nextTime,!(!allowDuplicate&&nextTime===this.lastEmittedTime)&&(this.lastTimeChangeAt=now,this.lastEmittedTime=nextTime,this.emit("lr-time-change",{currentTime:this.currentTimeState}))}onTimeUpdate(){this.emitTimeChange(!1),this.reconcileActiveCue()}reconcileActiveCue(discontinuity=!1){const time=this.currentTime;if(this._cueSource!==null){this.cueSourceController.updateTime(time,discontinuity);return}const cues=this.cues,duration=this.duration>0?this.duration:0;(!this.cueIndex||this.indexedCues!==cues||this.indexedCueDuration!==duration)&&(this.cueIndex=new AvCueIndex(cues,duration),this.indexedCues=cues,this.indexedCueDuration=duration);const activeIndex=this.cueIndex.at(time),nextId=cues[activeIndex]?.cueId??null;this.setActiveCue(nextId,activeIndex)}setActiveCue(nextId,activeIndex){(nextId!==this.activeCueId||activeIndex!==this.activeCueIndex)&&(this.activeCueId=nextId,this.activeCueIndex=activeIndex,this.emit("lr-cue-change",Object.freeze({cueId:nextId,index:activeIndex})))}onSeeked(){const completedTime=this.currentTime;this.pendingSeekEmission===null||completedTime!==this.pendingSeekEmission?this.emitTimeChange(!0):this.currentTimeState=completedTime,this.pendingSeekEmission=null,this.reconcileActiveCue(!0)}async search(query2){return this._cueSource!==null?(this.captureCueSource(),this.searchQuery=query2.trim(),this.searchLocale=this.effectiveLocale,this.cueSourceController.search(this.searchQuery,this.searchLocale)):(this.searchQuery=query2,this.reconcileSearchMatches(),this.activeSearchIndex=this.searchMatches.length?0:-1,this.refreshTranscriptRenderItem(),this.emitSearchChange(),await this.revealActiveSearchMatch(),this.searchMatches.length)}reconcileSearchMatches(previousCues){const locale=this.effectiveLocale,q=this.searchQuery.trim().toLocaleLowerCase(locale),previousMatchIndex=this.searchMatches[this.activeSearchIndex],previousActiveId=previousCues&&previousMatchIndex!==void 0?previousCues[previousMatchIndex]?.cueId:void 0;if(this.searchMatches=q?this.cues.reduce((acc,cue,index)=>((cue.text.toLocaleLowerCase(locale).includes(q)||(cue.speaker??"").toLocaleLowerCase(locale).includes(q))&&acc.push(index),acc),[]):[],this.searchMatchIndices=new Set(this.searchMatches),this.searchLocale=locale,!this.searchMatches.length){this.activeSearchIndex=-1;return}const retainedPosition=previousActiveId?this.searchMatches.findIndex(index=>this.cues[index]?.cueId===previousActiveId):-1;this.activeSearchIndex=retainedPosition>=0?retainedPosition:Math.min(Math.max(0,this.activeSearchIndex),this.searchMatches.length-1)}async searchNext(){return this._cueSource!==null?this.cueSourceController.navigate(1):this.searchMatches.length?(this.activeSearchIndex=(this.activeSearchIndex+1)%this.searchMatches.length,this.refreshTranscriptRenderItem(),this.emitSearchChange(),await this.revealActiveSearchMatch(),!0):!1}async searchPrevious(){return this._cueSource!==null?this.cueSourceController.navigate(-1):this.searchMatches.length?(this.activeSearchIndex=(this.activeSearchIndex-1+this.searchMatches.length)%this.searchMatches.length,this.refreshTranscriptRenderItem(),this.emitSearchChange(),await this.revealActiveSearchMatch(),!0):!1}clearSearch(){if(this.searchQuery="",this._cueSource!==null){this.cueSourceController.clearSearch();return}this.searchMatches=[],this.searchMatchIndices=new Set,this.activeSearchIndex=-1,this.refreshTranscriptRenderItem(),this.emitSearchChange()}emitSearchChange(){this.emit("lr-search-change",{query:this.searchQuery,matchCount:this.searchMatches.length,matchCountExact:!0,activeIndex:this.activeSearchIndex})}async revealSourceCue(index,epoch,authoritative=()=>!0){const current=()=>authoritative()&&this.cueSourceController.isCurrent(epoch);if(!current()||!await this.cueSourceController.window.ensure(index)||!current()||(await this.updateComplete,!current()))return!1;const list=this.renderRoot.querySelector(tag("virtual-list"));return!list||(await list.updateComplete,!current())?!1:(list.scrollToIndex(index,{align:"auto",behavior:"auto"}),current())}async revealActiveSearchMatch(){await this.updateComplete;const list=this.renderRoot.querySelector(tag("virtual-list"));if(!list)return;await list.updateComplete;const index=this.searchMatches[this.activeSearchIndex];index!==void 0&&list.scrollToIndex(index,{align:"auto",behavior:"auto"})}drawWaveform(){const canvas=this.canvasEl,ownerWindow=this.ownerDocument.defaultView;if(!this.hasWaveform){this.waveformDirty=!1;return}if(!this.isConnected||!canvas||!ownerWindow||!this.waveformVisible){this.waveformDirty=!0;return}this.cancelWaveformDrawFrame(),this.waveformDirty=!1,this.paintWaveform()}paintWaveform(){const canvas=this.canvasEl;if(!canvas||!this.hasWaveform)return;const ownerWindow=this.ownerDocument.defaultView;if(!ownerWindow)return;const dpr=positiveFinite(ownerWindow.devicePixelRatio),width=positiveFinite(canvas.clientWidth),height=positiveFinite(canvas.clientHeight),allocation=resolveBoundedCanvasAllocation({cssWidth:width,cssHeight:height,desiredScale:dpr,maxDimension:MAX_CANVAS_DIMENSION,maxPixels:MAX_CANVAS_PIXELS});this.lastWaveformAllocation={target:canvas,width,height,dpr},canvas.width=allocation.pixelWidth,canvas.height=allocation.pixelHeight;const ctx=canvas.getContext("2d");if(!ctx)return;const scaleX=allocation.scaleX,scaleY=allocation.scaleY;ctx.setTransform(scaleX,0,0,scaleY,0,0),ctx.clearRect(0,0,width,height),ctx.fillStyle=resolveCanvasColor(this,"var(--lr-color-brand)",ownerWindow.getComputedStyle(this).color);const peaks=this._waveform!==null&&this.waveformSnapshot?preparedWaveformPeaks(this.waveformSnapshot,canvas.width):waveformPaintPeaks(this.peaks,canvas.width),barWidth=width/peaks.length,physicalPixel=Math.min(barWidth,finiteNumber(1/scaleX,barWidth)),paintedBarWidth=Math.max(physicalPixel,barWidth-physicalPixel);peaks.forEach((peak,i)=>{const barHeight=Math.max(1,finiteRange(peak,0,0,1)*height);ctx.fillRect(i*barWidth,(height-barHeight)/2,paintedBarWidth,barHeight)})}scheduleWaveformDraw(){if(this.waveformDrawFrame)return;const owner=this.ownerDocument.defaultView;if(!owner||!this.isConnected)return;const request={owner,handle:0};request.handle=owner.requestAnimationFrame(()=>{this.waveformDrawFrame===request&&(this.waveformDrawFrame=void 0,this.isConnected&&this.ownerDocument.defaultView===owner&&this.drawWaveform())}),this.waveformDrawFrame=request}cancelWaveformDrawFrame(){const request=this.waveformDrawFrame;request&&request.owner.cancelAnimationFrame(request.handle),this.waveformDrawFrame=void 0}renderMarkers(){if(!this.duration)return nothing;const ranged=this.highlights.filter(h=>h.anchor.kind==="time-range");return ranged.length?html`${ranged.map(h=>{const startSeconds=finiteRange(h.anchor.start,0,0,this.duration),endSeconds=h.anchor.end==null?startSeconds:finiteRange(h.anchor.end,startSeconds,startSeconds,this.duration),start=startSeconds/this.duration*100,end=endSeconds/this.duration*100;return html`<button
|
|
13
13
|
part="timeline-marker"
|
|
14
14
|
type="button"
|
|
15
15
|
data-tone=${h.tone??"accent"}
|
|
@@ -58,19 +58,16 @@ export interface LyraFileInputFilesEvent extends CustomEvent<LyraFileInputFilesD
|
|
|
58
58
|
* @event lr-invalid - The file input failed a validity check. Cancelable: calling
|
|
59
59
|
* `preventDefault()` also cancels the native `invalid` event behind it, suppressing the browser's
|
|
60
60
|
* own validation bubble so an app can present the failure its own way.
|
|
61
|
-
* @csspart file-input - The interactive picker surface
|
|
61
|
+
* @csspart file-input - The interactive picker surface: the native dropzone button, visually backing
|
|
62
|
+
* the slotted content while remaining its sibling in the accessibility tree so arbitrary slotted
|
|
63
|
+
* controls are never nested in it.
|
|
62
64
|
* @csspart form-control - The complete label, dropzone, selected-file, error, and hint frame.
|
|
63
65
|
* @csspart form-control-label - The form-control label.
|
|
64
|
-
* @csspart label - Deprecated in 8.2.3; compatibility name for `form-control-label`; both names
|
|
65
|
-
* are on the same node.
|
|
66
66
|
* @csspart hint - The form-control hint.
|
|
67
67
|
* @csspart error - The visible validation message or authored error content.
|
|
68
68
|
* @csspart dropzone - The drag/drop and paste target around the semantic button.
|
|
69
69
|
* @csspart dropzone-icon - The default decorative file icon.
|
|
70
70
|
* @csspart dropzone-text - Wrapper around dropzone slot/text content.
|
|
71
|
-
* @csspart base - Deprecated in 8.2.3; compatibility name for `file-input`; both names are on the
|
|
72
|
-
* native dropzone button, visually backing the slotted content while remaining its sibling in
|
|
73
|
-
* the accessibility tree so arbitrary slotted controls are never nested in it.
|
|
74
71
|
* @csspart input - The visually-hidden native `<input type="file">`.
|
|
75
72
|
* @csspart status - The visually-hidden, `aria-hidden` mirror of the drag accept/reject state and
|
|
76
73
|
* accepted/rejected selection counts. The announcement itself lands in the shared light-DOM polite
|
|
@@ -111,28 +108,28 @@ export interface LyraFileInputFilesEvent extends CustomEvent<LyraFileInputFilesD
|
|
|
111
108
|
* inside the dropzone. Retuned per `size` tier; the documented default is the `m`/`medium` tier.
|
|
112
109
|
* @cssprop [--lr-file-input-dropzone-icon-size=var(--lr-font-size-xl)] - `[part="dropzone-icon"]`
|
|
113
110
|
* glyph size. Retuned per `size` tier.
|
|
114
|
-
* @cssprop [--lr-file-input-dropzone-padding=var(--lr-space-l)] - Padding inside `[part~="
|
|
111
|
+
* @cssprop [--lr-file-input-dropzone-padding=var(--lr-space-l)] - Padding inside `[part~="file-input"]`
|
|
115
112
|
* and the stacked dropzone content. Retuned per `size` tier.
|
|
116
113
|
* @cssprop [--lr-file-input-detail-font-size=var(--lr-font-size-sm)] - Size of the secondary text:
|
|
117
114
|
* the hint, the validation error, and each selected file's formatted size. Retuned per `size` tier.
|
|
118
115
|
* @cssprop [--lr-file-input-gap=var(--lr-space-xs)] - Gap between the dropzone's slotted
|
|
119
116
|
* children. At `size="s"` or `size="small"`, this is the fallback when
|
|
120
117
|
* `--lr-file-input-compact-gap` is unset.
|
|
121
|
-
* @cssprop [--lr-file-input-radius=var(--lr-radius)] - Corner radius of `[part~="
|
|
122
|
-
* @cssprop [--lr-file-input-compact-padding] - `[part~="
|
|
118
|
+
* @cssprop [--lr-file-input-radius=var(--lr-radius)] - Corner radius of `[part~="file-input"]`.
|
|
119
|
+
* @cssprop [--lr-file-input-compact-padding] - `[part~="file-input"]` padding while
|
|
123
120
|
* `size="s"` or `size="small"` is set.
|
|
124
121
|
* @cssprop [--lr-file-input-compact-gap] - Gap between the dropzone's slotted
|
|
125
122
|
* children while `size="s"` or `size="small"` is set.
|
|
126
123
|
* @cssprop [--lr-file-input-compact-font-size] - Dropzone instruction font
|
|
127
124
|
* size while `size="s"` or `size="small"` is set.
|
|
128
125
|
* @cssprop [--lr-file-input-accept-border-color=var(--lr-color-success)] - Border color of
|
|
129
|
-
* `[part~="
|
|
126
|
+
* `[part~="file-input"][data-drag-state="accept"]`.
|
|
130
127
|
* @cssprop [--lr-file-input-accept-bg=color-mix(in srgb, var(--lr-color-success) 8%, transparent)] -
|
|
131
|
-
* Background of `[part~="
|
|
128
|
+
* Background of `[part~="file-input"][data-drag-state="accept"]`.
|
|
132
129
|
* @cssprop [--lr-file-input-reject-border-color=var(--lr-color-danger)] - Border color of
|
|
133
|
-
* `[part~="
|
|
130
|
+
* `[part~="file-input"][data-drag-state="reject"]`.
|
|
134
131
|
* @cssprop [--lr-file-input-reject-bg=color-mix(in srgb, var(--lr-color-danger) 8%, transparent)] -
|
|
135
|
-
* Background of `[part~="
|
|
132
|
+
* Background of `[part~="file-input"][data-drag-state="reject"]`.
|
|
136
133
|
* @cssprop [--lr-file-input-dropzone-fill=var(--lr-color-surface)] - Resting dropzone background,
|
|
137
134
|
* the state it spends most of its life in. The drag accept/reject tints have had their own hooks
|
|
138
135
|
* since 12.0.0; this one completes the set.
|
|
@@ -17,7 +17,7 @@ import{__decorate}from"tslib";import{emitValueEvents}from"../../../internal/valu
|
|
|
17
17
|
<div part="form-control">
|
|
18
18
|
<label
|
|
19
19
|
id="file-input-label"
|
|
20
|
-
part="form-control-label
|
|
20
|
+
part="form-control-label"
|
|
21
21
|
?hidden=${!hasLabel}
|
|
22
22
|
@click=${this.onVisibleLabelClick}
|
|
23
23
|
>
|
|
@@ -34,7 +34,7 @@ import{__decorate}from"tslib";import{emitValueEvents}from"../../../internal/valu
|
|
|
34
34
|
@click=${this.onDropzoneClick}
|
|
35
35
|
>
|
|
36
36
|
<button
|
|
37
|
-
part="file-input
|
|
37
|
+
part="file-input"
|
|
38
38
|
type="button"
|
|
39
39
|
role="button"
|
|
40
40
|
tabindex=${this.effectiveDisabled?"-1":"0"}
|
|
@@ -87,4 +87,4 @@ import{__decorate}from"tslib";import{emitValueEvents}from"../../../internal/valu
|
|
|
87
87
|
?disabled=${this.effectiveDisabled}
|
|
88
88
|
@change=${this.onInputChange}
|
|
89
89
|
/>
|
|
90
|
-
`}}__decorate([property({type:Boolean,reflect:!0,converter:falseDefaultBooleanConverter})],LyraFileInput.prototype,"multiple",void 0),__decorate([property()],LyraFileInput.prototype,"accept",void 0),__decorate([property()],LyraFileInput.prototype,"capture",void 0),__decorate([property({attribute:!1})],LyraFileInput.prototype,"allowedMimeTypes",null),__decorate([property({attribute:!1})],LyraFileInput.prototype,"forbiddenMimeTypes",null),__decorate([property({type:Number,attribute:"max-file-size"})],LyraFileInput.prototype,"maxFileSize",void 0),__decorate([property({type:Number,attribute:"max-files"})],LyraFileInput.prototype,"maxFiles",void 0),__decorate([property({type:Number,attribute:"max-total-size"})],LyraFileInput.prototype,"maxTotalSize",void 0),__decorate([property({type:Number,attribute:"held-file-count"})],LyraFileInput.prototype,"heldFileCount",void 0),__decorate([property({type:Number,attribute:"held-total-size"})],LyraFileInput.prototype,"heldTotalSize",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"non-retaining"})],LyraFileInput.prototype,"nonRetaining",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"value-present"})],LyraFileInput.prototype,"valuePresent",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraFileInput.prototype,"directory",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"without-paste"})],LyraFileInput.prototype,"withoutPaste",void 0),__decorate([property()],LyraFileInput.prototype,"label",void 0),__decorate([property()],LyraFileInput.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraFileInput.prototype,"errorText",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraFileInput.prototype,"withLabel",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraFileInput.prototype,"withHint",void 0),__decorate([property({type:Boolean,attribute:"with-error"})],LyraFileInput.prototype,"withError",void 0),__decorate([property({reflect:!0})],LyraFileInput.prototype,"size",void 0),__decorate([property({attribute:!1})],LyraFileInput.prototype,"validators",void 0),__decorate([property({attribute:"aria-label"})],LyraFileInput.prototype,"hostAccessibleLabel",void 0),__decorate([property({attribute:"accepted-message"})],LyraFileInput.prototype,"acceptedMessage",void 0),__decorate([property({attribute:"rejected-message"})],LyraFileInput.prototype,"rejectedMessage",void 0),__decorate([state()],LyraFileInput.prototype,"dragState",void 0),__decorate([state()],LyraFileInput.prototype,"resultStatus",void 0),__decorate([state()],LyraFileInput.prototype,"rejectedFiles",void 0),__decorate([state()],LyraFileInput.prototype,"touched",void 0),__decorate([state()],LyraFileInput.prototype,"validityRevision",void 0),__decorate([query('[part~="
|
|
90
|
+
`}}__decorate([property({type:Boolean,reflect:!0,converter:falseDefaultBooleanConverter})],LyraFileInput.prototype,"multiple",void 0),__decorate([property()],LyraFileInput.prototype,"accept",void 0),__decorate([property()],LyraFileInput.prototype,"capture",void 0),__decorate([property({attribute:!1})],LyraFileInput.prototype,"allowedMimeTypes",null),__decorate([property({attribute:!1})],LyraFileInput.prototype,"forbiddenMimeTypes",null),__decorate([property({type:Number,attribute:"max-file-size"})],LyraFileInput.prototype,"maxFileSize",void 0),__decorate([property({type:Number,attribute:"max-files"})],LyraFileInput.prototype,"maxFiles",void 0),__decorate([property({type:Number,attribute:"max-total-size"})],LyraFileInput.prototype,"maxTotalSize",void 0),__decorate([property({type:Number,attribute:"held-file-count"})],LyraFileInput.prototype,"heldFileCount",void 0),__decorate([property({type:Number,attribute:"held-total-size"})],LyraFileInput.prototype,"heldTotalSize",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"non-retaining"})],LyraFileInput.prototype,"nonRetaining",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"value-present"})],LyraFileInput.prototype,"valuePresent",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraFileInput.prototype,"directory",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"without-paste"})],LyraFileInput.prototype,"withoutPaste",void 0),__decorate([property()],LyraFileInput.prototype,"label",void 0),__decorate([property()],LyraFileInput.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraFileInput.prototype,"errorText",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraFileInput.prototype,"withLabel",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraFileInput.prototype,"withHint",void 0),__decorate([property({type:Boolean,attribute:"with-error"})],LyraFileInput.prototype,"withError",void 0),__decorate([property({reflect:!0})],LyraFileInput.prototype,"size",void 0),__decorate([property({attribute:!1})],LyraFileInput.prototype,"validators",void 0),__decorate([property({attribute:"aria-label"})],LyraFileInput.prototype,"hostAccessibleLabel",void 0),__decorate([property({attribute:"accepted-message"})],LyraFileInput.prototype,"acceptedMessage",void 0),__decorate([property({attribute:"rejected-message"})],LyraFileInput.prototype,"rejectedMessage",void 0),__decorate([state()],LyraFileInput.prototype,"dragState",void 0),__decorate([state()],LyraFileInput.prototype,"resultStatus",void 0),__decorate([state()],LyraFileInput.prototype,"rejectedFiles",void 0),__decorate([state()],LyraFileInput.prototype,"touched",void 0),__decorate([state()],LyraFileInput.prototype,"validityRevision",void 0),__decorate([query('[part~="file-input"]')],LyraFileInput.prototype,"baseEl",void 0),__decorate([query('input[type="file"]')],LyraFileInput.prototype,"inputEl",void 0);export{DEFAULT_MAX_FILES,DEFAULT_MAX_FILE_SIZE_BYTES,DEFAULT_MAX_TOTAL_SIZE_BYTES,LyraFileInput};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{iconHitTarget}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{formControlFocusHalo,formControlRequiredMarker}from"../../../internal/form-control.styles.js";const styles=css` :host { display: block; min-inline-size: 0; max-inline-size: 100%; --_lr-file-input-font-size: var(--lr-form-control-font-size); --_lr-file-input-dropzone-font-size: var(--lr-font-size-md-sm); --_lr-file-input-dropzone-icon-size: var(--lr-font-size-xl); --_lr-file-input-dropzone-padding: var(--lr-space-l); --_lr-file-input-detail-font-size: var(--lr-font-size-sm); --_lr-form-control-focus-shadow: var(--lr-form-control-focus-shadow, none); } :host([size="2xs"]), :host([size="xs"]) { --_lr-file-input-dropzone-font-size: var(--lr-font-size-xs); --_lr-file-input-dropzone-icon-size: var(--lr-font-size-md-sm); --_lr-file-input-dropzone-padding: var(--lr-space-s); --_lr-file-input-detail-font-size: var(--lr-font-size-2xs); } :host([size="s"]), :host([size="small"]) { --_lr-file-input-dropzone-font-size: var(--lr-font-size-sm); --_lr-file-input-dropzone-icon-size: var(--lr-font-size-lg); --_lr-file-input-dropzone-padding: var(--lr-space-m); --_lr-file-input-detail-font-size: var(--lr-font-size-xs); } :host([size="l"]), :host([size="large"]) { --_lr-file-input-dropzone-font-size: var(--lr-font-size-lg); --_lr-file-input-dropzone-icon-size: var(--lr-font-size-2xl); --_lr-file-input-dropzone-padding: var(--lr-space-2xl); --_lr-file-input-detail-font-size: var(--lr-font-size-md-sm); } :host([size="xl"]) { --_lr-file-input-dropzone-font-size: var(--lr-font-size-xl); --_lr-file-input-dropzone-icon-size: var(--lr-font-size-3xl); --_lr-file-input-dropzone-padding: var(--lr-space-2xl); --_lr-file-input-detail-font-size: var(--lr-font-size-m); } [part="form-control"] { min-inline-size: 0; max-inline-size: 100%; block-size: 100%; } [part~="form-control-label"] { display: block; min-inline-size: 0; margin-block-end: var(--lr-space-xs); font-size: var(--lr-file-input-font-size, var(--_lr-file-input-font-size)); font-weight: var(--lr-font-weight-semibold); overflow-wrap: anywhere; } [part~="form-control-label"][hidden], [part="hint"][hidden], [part="error"][hidden] { display: none; } ${formControlRequiredMarker} .dropzone { position: relative; display: grid; min-inline-size: 0; block-size: 100%; } [part~="
|
|
1
|
+
import{iconHitTarget}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{formControlFocusHalo,formControlRequiredMarker}from"../../../internal/form-control.styles.js";const styles=css` :host { display: block; min-inline-size: 0; max-inline-size: 100%; --_lr-file-input-font-size: var(--lr-form-control-font-size); --_lr-file-input-dropzone-font-size: var(--lr-font-size-md-sm); --_lr-file-input-dropzone-icon-size: var(--lr-font-size-xl); --_lr-file-input-dropzone-padding: var(--lr-space-l); --_lr-file-input-detail-font-size: var(--lr-font-size-sm); --_lr-form-control-focus-shadow: var(--lr-form-control-focus-shadow, none); } :host([size="2xs"]), :host([size="xs"]) { --_lr-file-input-dropzone-font-size: var(--lr-font-size-xs); --_lr-file-input-dropzone-icon-size: var(--lr-font-size-md-sm); --_lr-file-input-dropzone-padding: var(--lr-space-s); --_lr-file-input-detail-font-size: var(--lr-font-size-2xs); } :host([size="s"]), :host([size="small"]) { --_lr-file-input-dropzone-font-size: var(--lr-font-size-sm); --_lr-file-input-dropzone-icon-size: var(--lr-font-size-lg); --_lr-file-input-dropzone-padding: var(--lr-space-m); --_lr-file-input-detail-font-size: var(--lr-font-size-xs); } :host([size="l"]), :host([size="large"]) { --_lr-file-input-dropzone-font-size: var(--lr-font-size-lg); --_lr-file-input-dropzone-icon-size: var(--lr-font-size-2xl); --_lr-file-input-dropzone-padding: var(--lr-space-2xl); --_lr-file-input-detail-font-size: var(--lr-font-size-md-sm); } :host([size="xl"]) { --_lr-file-input-dropzone-font-size: var(--lr-font-size-xl); --_lr-file-input-dropzone-icon-size: var(--lr-font-size-3xl); --_lr-file-input-dropzone-padding: var(--lr-space-2xl); --_lr-file-input-detail-font-size: var(--lr-font-size-m); } [part="form-control"] { min-inline-size: 0; max-inline-size: 100%; block-size: 100%; } [part~="form-control-label"] { display: block; min-inline-size: 0; margin-block-end: var(--lr-space-xs); font-size: var(--lr-file-input-font-size, var(--_lr-file-input-font-size)); font-weight: var(--lr-font-weight-semibold); overflow-wrap: anywhere; } [part~="form-control-label"][hidden], [part="hint"][hidden], [part="error"][hidden] { display: none; } ${formControlRequiredMarker} .dropzone { position: relative; display: grid; min-inline-size: 0; block-size: 100%; } [part~="file-input"] { grid-area: 1 / 1; inline-size: 100%; block-size: 100%; ${iconHitTarget} box-sizing: border-box; font: inherit; cursor: pointer; appearance: none; padding: var( --lr-file-input-dropzone-padding, var(--_lr-file-input-dropzone-padding) ); border: var(--lr-border-width-medium) dashed var(--lr-file-input-dropzone-border-color, var(--lr-color-border)); border-radius: var(--lr-file-input-radius, var(--lr-radius)); background: var(--lr-file-input-dropzone-fill, var(--lr-color-surface)); color: var(--lr-color-text-quiet); font-size: var( --lr-file-input-dropzone-font-size, var(--_lr-file-input-dropzone-font-size) ); transition: border-color var(--lr-transition-fast), background-color var(--lr-transition-fast); } .dropzone-content { grid-area: 1 / 1; z-index: var(--lr-layer-content); min-inline-size: 0; max-inline-size: 100%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--lr-file-input-gap, var(--lr-space-xs)); padding: var( --lr-file-input-dropzone-padding, var(--_lr-file-input-dropzone-padding) ); color: var(--lr-color-text-quiet); text-align: center; font-size: var( --lr-file-input-dropzone-font-size, var(--_lr-file-input-dropzone-font-size) ); overflow-wrap: anywhere; pointer-events: none; } [part="dropzone-icon"] { display: inline-flex; align-items: center; justify-content: center; font-size: var( --lr-file-input-dropzone-icon-size, var(--_lr-file-input-dropzone-icon-size) ); } [part="dropzone-text"] { min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; } ::slotted(*) { max-inline-size: 100%; min-inline-size: 0; pointer-events: auto; } :host(:is([size='s'], [size='small'])) [part~='file-input'], :host(:is([size='s'], [size='small'])) .dropzone-content { padding: var(--lr-file-input-compact-padding, var(--lr-file-input-dropzone-padding, var(--_lr-file-input-dropzone-padding))); font-size: var(--lr-file-input-compact-font-size, var(--lr-file-input-dropzone-font-size, var(--_lr-file-input-dropzone-font-size))); } :host(:is([size='s'], [size='small'])) .dropzone-content { gap: var(--lr-file-input-compact-gap, var(--lr-file-input-gap, var(--lr-space-xs))); } [part~="file-input"][data-drag-state="accept"] { border-color: var( --lr-file-input-accept-border-color, var(--lr-color-success) ); background: var( --lr-file-input-accept-bg, color-mix(in srgb, var(--lr-color-success) 8%, transparent) ); } [part~="file-input"][data-drag-state="reject"] { border-color: var( --lr-file-input-reject-border-color, var(--lr-color-danger) ); background: var( --lr-file-input-reject-bg, color-mix(in srgb, var(--lr-color-danger) 8%, transparent) ); } @media (forced-colors: active) { [part~="file-input"][data-drag-state="accept"] { border-color: Highlight; border-style: double; outline: var(--lr-border-width-thin) solid Highlight; outline-offset: calc(-1 * var(--lr-border-width-medium)); } [part~="file-input"][data-drag-state="reject"] { border-color: CanvasText; border-style: dotted; outline: var(--lr-border-width-medium) double CanvasText; outline-offset: calc(-1 * var(--lr-border-width-medium)); } } :host(:not(:disabled)) [part~="file-input"]:hover { border-color: var(--lr-file-input-dropzone-hover-border-color, var(--lr-color-brand)); } :host(:not(:disabled)) .dropzone:hover [part~="file-input"] { border-color: var(--lr-file-input-dropzone-hover-border-color, var(--lr-color-brand)); } :host(:not(:disabled)) [part~="file-input"]:active { border-color: var(--lr-color-brand); background: color-mix( in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } :host(:not(:disabled)) .dropzone:active [part~="file-input"] { border-color: var(--lr-color-brand); background: color-mix( in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part~="file-input"]:focus-visible { outline: var(--lr-focus-ring); outline-offset: var(--lr-focus-ring-offset); } [part~="file-input"]:focus { ${formControlFocusHalo} } :host(:disabled) [part~="file-input"] { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } [part="rejection"] { min-inline-size: 0; max-inline-size: 100%; margin-block: var(--lr-space-2xs) 0; color: var(--lr-color-danger); font-size: var(--lr-font-size-sm); text-align: start; overflow-wrap: anywhere; } [part="rejection"] ul { margin: 0; padding-inline-start: var(--lr-space-m); } [part="file-list"] { display: grid; gap: var(--lr-space-xs); margin-block-start: var(--lr-space-xs); } [part="file"] { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--lr-space-s); min-inline-size: 0; padding: var(--lr-space-xs) var(--lr-space-s); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); border-radius: var(--lr-radius); background: var(--lr-color-surface-raised); } [part="file-thumbnail"] { display: inline-flex; align-items: center; justify-content: center; inline-size: var(--lr-icon-button-size); block-size: var(--lr-icon-button-size); overflow: hidden; border-radius: var(--lr-radius-xs); color: var(--lr-color-text-quiet); } [part="file-image"] { inline-size: 100%; block-size: 100%; object-fit: cover; } [part="file-icon"] { display: inline-flex; font-size: var(--lr-font-size-xl); } [part="file-details"] { display: flex; flex-direction: column; min-inline-size: 0; } [part="file-name"] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--lr-color-text); font-size: var(--lr-file-input-font-size, var(--_lr-file-input-font-size)); } [part="file-size"] { color: var(--lr-color-text-quiet); font-size: var( --lr-file-input-detail-font-size, var(--_lr-file-input-detail-font-size) ); } [part="remove-button"] { display: inline-flex; align-items: center; justify-content: center; ${iconHitTarget} padding: 0; border: none; border-radius: var(--lr-radius); background: transparent; color: var(--lr-color-text-quiet); font: inherit; cursor: pointer; transition: background-color var(--lr-transition-fast), color var(--lr-transition-fast); } [part="remove-button"]:hover:where(:not(:disabled)) { background: var(--lr-color-brand-quiet); color: var(--lr-color-text); } [part="remove-button"]:active:where(:not(:disabled)) { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part="remove-button"]:focus-visible { outline: var(--lr-focus-ring); outline-offset: var(--lr-focus-ring-offset); } [part="remove-button"]:disabled { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } [part="hint"] { min-inline-size: 0; margin-block-start: var(--lr-space-xs); color: var(--lr-color-text-quiet); font-size: var( --lr-file-input-detail-font-size, var(--_lr-file-input-detail-font-size) ); overflow-wrap: anywhere; } [part="error"] { min-inline-size: 0; margin-block-start: var(--lr-space-xs); color: var(--lr-color-danger); font-size: var( --lr-file-input-detail-font-size, var(--_lr-file-input-detail-font-size) ); overflow-wrap: anywhere; } `;export{styles};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{nothing,type TemplateResult}from'lit';import{type Engine3dFallbackDetail}from'../../../internal/engine-3d.js';import type{LyraMessageKey}from'../../../internal/localization.js';export type LyraMediaProjection='flat'|'equirectangular';export interface LyraPanoramaCamera{readonly yaw:number;readonly pitch:number;readonly fieldOfView:number;}export interface LyraPanoramaHotspot{readonly id:string;readonly yaw:number;readonly pitch:number;readonly label?:string;}export interface LyraPanoramaHotspotSelectDetail{readonly hotspot:LyraPanoramaHotspot;readonly id:string;readonly index:number;}export declare const PANORAMA_PROJECTION:import("../../../internal/converters.js").LiteralSetConverter<LyraMediaProjection>;export declare const PANORAMA_DEFAULT_CAMERA:LyraPanoramaCamera;export declare const panoramaLoader:import("../../../internal/engine-3d-loader.js").Engine3dLoader;export declare const panoramaEnvironment:{available:(owner:Document)=>boolean;};export declare function normalizePanoramaCamera(value:unknown):LyraPanoramaCamera;
|
|
2
|
+
/** First valid ID wins; invalid coordinates and blank IDs are omitted from the bounded snapshot. */
|
|
3
|
+
export declare function snapshotPanoramaHotspots(value:unknown,owner:Window|null):readonly LyraPanoramaHotspot[];type Media=HTMLImageElement|HTMLVideoElement;interface PanoramaOptions{readonly changed:()=>void;readonly updated:()=>Promise<unknown>;readonly localize:(key:LyraMessageKey)=>string;readonly direction:()=>'ltr'|'rtl';readonly camera:(camera:LyraPanoramaCamera)=>void;readonly pick:(detail:LyraPanoramaHotspotSelectDetail)=>void;readonly fallback:(detail:Engine3dFallbackDetail)=>void;}
|
|
4
|
+
/** Optional spherical rendering around a caller-owned native image or video. */
|
|
5
|
+
export declare class PanoramaController{private readonly host;private readonly options;private readonly selection;private readonly announcements;ready:boolean;loading:boolean;notice:Engine3dFallbackDetail|null;private software;private enabled;private media;private mediaRevision;private hotspots;private camera;private container;private engine?;private generation;private revision;private attempted;private pending;private intersection?;private eligibility?;private intersecting;private resize?;private theme?;private cleanups;private cursor;constructor(host:HTMLElement,options:PanoramaOptions);private release;invalidate():void;disconnect():void;adopted():void;update(enabled:boolean,media:Media|null,mediaRevision:number,hotspots:readonly LyraPanoramaHotspot[],camera:LyraPanoramaCamera,container:HTMLElement|null):void;private fail;private command;private start;private style;private activate;keydown(event:KeyboardEvent,direction:'ltr'|'rtl'):void;renderViewport(label:string,enabled:boolean):TemplateResult|typeof nothing;renderNotice():TemplateResult|typeof nothing;renderHotspots(enabled:boolean):TemplateResult|typeof nothing;}export{};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{html,nothing}from"lit";import{literalSetConverter}from"../../../internal/converters.js";import{snapshotPublicCollection}from"../../../internal/collection-snapshot.js";import{isObjectValue,readOwnDataValue}from"../../../internal/data-descriptors.js";import{finiteRange}from"../../../internal/numbers.js";import{createEngine3dLoader}from"../../../internal/engine-3d-loader.js";import{Engine3dSelection,ENGINE_3D_REASON_MESSAGE,ENGINE_3D_SHOWING_MESSAGE,engine3dFailureReason,webgl2Available}from"../../../internal/engine-3d.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{isAccessibilityVisible}from"../../../internal/accessibility-visibility.js";import{resolveCanvasColor}from"../../../internal/canvas-color.js";import{tag}from"../../../internal/prefix.js";const PANORAMA_PROJECTION=literalSetConverter(["flat","equirectangular"],"flat"),PANORAMA_DEFAULT_CAMERA=Object.freeze({yaw:0,pitch:0,fieldOfView:75}),panoramaLoader=createEngine3dLoader({entry:"panorama",tag:tag("image-viewer"),load:()=>import("@aceshooting/lyra-3d/panorama")}),panoramaEnvironment={available:owner=>webgl2Available(()=>owner.createElement("canvas"))};function normalizePanoramaCamera(value){if(!isObjectValue(value))return PANORAMA_DEFAULT_CAMERA;const number=key=>{const entry=readOwnDataValue(value,key);return typeof entry=="number"?entry:NaN},yaw=finiteRange(number("yaw"),0);return Object.freeze({yaw:((yaw+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI,pitch:finiteRange(number("pitch"),0,-Math.PI/2+.01,Math.PI/2-.01),fieldOfView:finiteRange(number("fieldOfView"),75,20,100)})}function snapshotPanoramaHotspots(value,owner){const source=snapshotPublicCollection(value,owner);if(!Array.isArray(source))return Object.freeze([]);const seen=new Set,result=[];for(const item of source){const id=readOwnDataValue(item,"id"),yaw=readOwnDataValue(item,"yaw"),pitch=readOwnDataValue(item,"pitch"),label=readOwnDataValue(item,"label");typeof id!="string"||!id.trim()||seen.has(id)||typeof yaw!="number"||!Number.isFinite(yaw)||typeof pitch!="number"||!Number.isFinite(pitch)||Math.abs(pitch)>Math.PI/2||(seen.add(id),result.push(Object.freeze({id,yaw:normalizePanoramaCamera({yaw}).yaw,pitch,...typeof label=="string"?{label}:{}})))}return Object.freeze(result)}class PanoramaController{constructor(host,options){this.host=host,this.options=options,this.selection=new Engine3dSelection(!0),this.ready=!1,this.loading=!1,this.notice=null,this.software=!1,this.enabled=!1,this.media=null,this.mediaRevision=-1,this.hotspots=[],this.camera=PANORAMA_DEFAULT_CAMERA,this.container=null,this.generation=0,this.revision=0,this.attempted=!1,this.pending=!1,this.intersecting=!1,this.cleanups=[],this.cursor=0,this.announcements=new AnnouncementSinkController(host,{eager:["assertive"]})}release(){this.generation++,this.intersection?.disconnect(),this.intersection=void 0,this.eligibility?.disconnect(),this.eligibility=void 0,this.intersecting=!1,this.resize?.disconnect(),this.resize=void 0,this.theme?.disconnect(),this.theme=void 0;for(const cleanup of this.cleanups)cleanup();this.cleanups=[];const engine=this.engine;this.engine=void 0,this.ready=this.loading=this.pending=!1,engine?.dispose()}invalidate(){this.release(),this.attempted=!1,this.notice=null,this.software=!1,this.selection.prefer(this.enabled?"webgl":"builtin")}disconnect(){this.invalidate(),this.media=null,this.container=null}adopted(){this.disconnect(),this.announcements.adopted()}update(enabled,media,mediaRevision,hotspots,camera,container){(enabled!==this.enabled||media!==this.media||mediaRevision!==this.mediaRevision||hotspots!==this.hotspots||container!==this.container)&&(this.invalidate(),this.enabled=enabled,this.media=media,this.mediaRevision=mediaRevision,this.hotspots=hotspots,this.container=container,this.cursor=Math.min(this.cursor,Math.max(0,hotspots.length-1)),this.selection.prefer(enabled?"webgl":"builtin"),this.options.changed());const cameraChanged=camera!==this.camera;if(this.camera=camera,!enabled||!media||!container||!this.host.isConnected)return;if(this.ready){cameraChanged&&this.command(()=>this.engine?.setCamera(camera));return}if(this.pending||this.attempted||this.intersection||this.eligibility)return;const view=this.host.ownerDocument.defaultView,generation=this.generation;this.intersecting=view?.IntersectionObserver===void 0;const admit=()=>{generation!==this.generation||this.pending||this.attempted||!this.intersecting||!isAccessibilityVisible(this.host)||(this.intersection?.disconnect(),this.intersection=void 0,this.eligibility?.disconnect(),this.eligibility=void 0,this.start())};if(view?.IntersectionObserver&&(this.intersection=new view.IntersectionObserver(entries=>{if(generation===this.generation){for(const entry of entries)entry.target===container&&(this.intersecting=entry.isIntersecting);admit()}}),this.intersection.observe(container)),view?.MutationObserver){this.eligibility=new view.MutationObserver(admit);let ancestor=this.host,depth=0;for(;ancestor&&depth++<=256;){this.eligibility.observe(ancestor,{attributes:!0,attributeFilter:["aria-hidden","inert","hidden","style","class","open"]});const root=ancestor.getRootNode();ancestor=ancestor.assignedSlot??ancestor.parentElement??(root instanceof view.ShadowRoot?root.host:null)}}admit()}fail(reason){const detail=this.selection.renderer==="webgl"?this.selection.fail(reason):null;this.ready=this.loading=!1,reason!=="context-lost"&&(this.release(),this.attempted=!0),detail&&(this.notice=detail,this.options.changed(),this.announcements.announceAssertive(this.options.localize(ENGINE_3D_REASON_MESSAGE[detail.reason])),this.announcements.announcePolite(this.options.localize(ENGINE_3D_SHOWING_MESSAGE[detail.to])),this.options.fallback(detail))}command(run){const generation=this.generation,engine=this.engine;try{run()}catch{generation===this.generation&&engine===this.engine&&this.fail("error")}}async start(){const owner=this.host.ownerDocument,container=this.container,media=this.media,hotspots=this.hotspots;if(!this.enabled||!container||!media||!this.host.isConnected)return;const generation=this.generation,current=()=>generation===this.generation&&this.host.isConnected&&this.host.ownerDocument===owner;if(this.pending=this.attempted=!0,!panoramaEnvironment.available(owner)){this.fail("unsupported");return}this.loading=!0,this.options.changed();let engine=null,owned=!1;try{if(engine=await panoramaLoader.create(),!current()){engine?.dispose();return}if(!engine){this.fail("unavailable");return}if(this.engine=engine,owned=!0,await engine.mount(container,{hover:index=>{current()&&this.ready&&this.command(()=>engine.setState?.({selected:new Set,dimmed:new Set,hover:index??-1,focus:this.cursor}))},pick:index=>{current()&&this.ready&&index!==null&&this.activate(index)},camera:value=>{current()&&this.ready&&(this.camera=normalizePanoramaCamera(value),this.options.camera(this.camera))},lost:reason=>{current()&&this.fail(reason)},restored:()=>{!current()||!this.engine||!this.selection.restore()||this.command(()=>{engine.setStyle(this.style()),current()&&(engine.setCamera(this.camera),current()&&(engine.setState?.({selected:new Set,dimmed:new Set,hover:-1,focus:this.cursor}),current()&&(this.ready=!0,this.notice=null,this.options.changed())))})},rendering:value=>{current()&&(this.software=value.software,this.options.changed())}}),!current()||(engine.setStyle(this.style()),!current()))return;const angles=new Float32Array(hotspots.length*2);if(hotspots.forEach((hotspot,index)=>{angles[index*2]=hotspot.yaw,angles[index*2+1]=hotspot.pitch}),engine.setData({source:media.localName==="video"?{kind:"video",video:media}:{kind:"image",image:media},hotspotAngles:angles},++this.revision),!current()||(engine.setCamera(this.camera),!current()))return;const resize=()=>{if(!current())return;const box=container.getBoundingClientRect();engine.resize(Math.max(1,box.width),Math.max(1,box.height))};if(resize(),!current())return;const view=owner.defaultView;view?.ResizeObserver&&(this.resize=new view.ResizeObserver(()=>{current()&&this.ready&&this.command(resize)}),this.resize.observe(container));const restyle=()=>{current()&&this.ready&&this.command(()=>engine.setStyle(this.style()))};if(view?.MutationObserver){this.theme=new view.MutationObserver(restyle);let ancestor=this.host;for(;ancestor;){this.theme.observe(ancestor,{attributes:!0});const root=ancestor.getRootNode();ancestor=ancestor.parentElement??(root instanceof view.ShadowRoot?root.host:null)}}for(const query of["(prefers-reduced-motion: reduce)","(forced-colors: active)","(prefers-color-scheme: dark)"]){const mediaQuery=view?.matchMedia(query);mediaQuery?.addEventListener("change",restyle),mediaQuery&&this.cleanups.push(()=>mediaQuery.removeEventListener("change",restyle))}this.pending=this.loading=!1,this.ready=this.selection.renderer==="webgl",this.options.changed()}catch(error){if(!current()){owned||engine?.dispose();return}this.fail(engine3dFailureReason(error))}}style(){const view=this.host.ownerDocument.defaultView,computed=view.getComputedStyle(this.host),canvas=this.host.ownerDocument.createElement("canvas");canvas.width=canvas.height=1;const context=canvas.getContext("2d",{willReadFrequently:!0}),color=name=>{const value=resolveCanvasColor(this.host,`var(${name})`,computed.color);if(!context)return value;context.clearRect(0,0,1,1),context.fillStyle=value,context.fillRect(0,0,1,1);const rgba=context.getImageData(0,0,1,1).data;return`rgba(${rgba[0]}, ${rgba[1]}, ${rgba[2]}, ${rgba[3]/255})`};return{background:color("--lr-color-surface"),foreground:color("--lr-color-text"),muted:color("--lr-color-text-quiet"),accent:color("--lr-color-brand"),focus:color("--lr-focus-ring-color"),palette:[color("--lr-color-brand")],fontFamily:computed.fontFamily,fontSize:finiteRange(Number.parseFloat(computed.fontSize),14,1,128),pointSize:24,lineWidth:1,devicePixelRatio:finiteRange(view.devicePixelRatio,1,.25,4),reducedMotion:view.matchMedia("(prefers-reduced-motion: reduce)").matches,forcedColors:view.matchMedia("(forced-colors: active)").matches}}activate(index){const hotspot=this.hotspots[index];!hotspot||!Number.isSafeInteger(index)||(this.cursor=index,this.options.changed(),this.options.pick({hotspot,id:hotspot.id,index}))}keydown(event,direction){if(!this.ready||event.target!==event.currentTarget)return;const sign=direction==="rtl"?-1:1;let{yaw,pitch,fieldOfView}=this.camera;switch(event.key){case"ArrowLeft":yaw-=sign*Math.PI/18;break;case"ArrowRight":yaw+=sign*Math.PI/18;break;case"ArrowUp":pitch+=Math.PI/18;break;case"ArrowDown":pitch-=Math.PI/18;break;case"+":case"=":fieldOfView-=5;break;case"-":case"_":fieldOfView+=5;break;case"Home":yaw=pitch=0,fieldOfView=75;break;default:return}event.preventDefault(),event.stopPropagation(),this.camera=normalizePanoramaCamera({yaw,pitch,fieldOfView});const generation=this.generation;this.command(()=>this.engine?.setCamera(this.camera)),generation===this.generation&&this.ready&&this.options.camera(this.camera)}renderViewport(label,enabled){return enabled?html`<div part="panorama" role="group" aria-label=${label} aria-description=${this.options.localize("panoramaInstructions")}
|
|
2
|
+
tabindex=${this.ready?"0":"-1"} ?data-ready=${this.ready} ?hidden=${this.notice!==null}
|
|
3
|
+
@keydown=${event=>this.keydown(event,this.options.direction())}><div part="panorama-engine" aria-hidden="true"></div></div>`:nothing}renderNotice(){const notice=this.notice;return notice?html`<div part="panorama-notice"><p>${this.options.localize(ENGINE_3D_REASON_MESSAGE[notice.reason])}</p><p>${this.options.localize(ENGINE_3D_SHOWING_MESSAGE[notice.to])}</p></div>`:!this.loading&&!this.software?nothing:html`<p part="panorama-notice">${this.options.localize(this.loading?"engine3dLoading":"engine3dSoftwareRendering")}</p>`}renderHotspots(enabled){if(!enabled||!this.hotspots.length)return nothing;const start=Math.floor(this.cursor/200)*200,end=Math.min(this.hotspots.length,start+200),generation=this.generation,current=()=>this.host.isConnected&&generation===this.generation,move=(index,focus=!1)=>{current()&&(this.cursor=Math.max(0,Math.min(this.hotspots.length-1,index)),this.options.changed(),this.ready&&this.command(()=>this.engine?.setState?.({selected:new Set,dimmed:new Set,hover:-1,focus:this.cursor})),focus&&this.options.updated().then(()=>{current()&&this.host.shadowRoot?.querySelector(`[data-panorama-index="${this.cursor}"]`)?.focus()}))};return html`<div part="panorama-hotspots" role="group" aria-label=${this.options.localize("panoramaHotspotsLabel")}>
|
|
4
|
+
${this.hotspots.slice(start,end).map((hotspot,offset)=>{const index=start+offset;return html`<button part="panorama-hotspot" type="button" data-panorama-index=${index} tabindex=${index===this.cursor?"0":"-1"}
|
|
5
|
+
@focus=${()=>move(index)} @click=${()=>{current()&&this.activate(index)}}
|
|
6
|
+
@keydown=${event=>{const forward=this.options.direction()==="rtl"?"ArrowLeft":"ArrowRight",backward=this.options.direction()==="rtl"?"ArrowRight":"ArrowLeft";let next=index;if(event.key===forward||event.key==="ArrowDown")next++;else if(event.key===backward||event.key==="ArrowUp")next--;else if(event.key==="Home")next=0;else if(event.key==="End")next=this.hotspots.length-1;else return;event.preventDefault(),move(next,!0)}}>${hotspot.label||hotspot.id}</button>`})}
|
|
7
|
+
${this.hotspots.length>200?html`<div role="group" aria-label=${this.options.localize("paginationLabel")}><button part="panorama-page" type="button" ?disabled=${start===0} @click=${()=>move(start-200)}>${this.options.localize("previous")}</button><button part="panorama-page" type="button" ?disabled=${end===this.hotspots.length} @click=${()=>move(start+200)}>${this.options.localize("next")}</button></div>`:nothing}
|
|
8
|
+
</div>`}}export{PANORAMA_DEFAULT_CAMERA,PANORAMA_PROJECTION,PanoramaController,normalizePanoramaCamera,panoramaEnvironment,panoramaLoader,snapshotPanoramaHotspots};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{css}from"lit";const panoramaStyles=css`[part=panorama]{block-size:100%;inline-size:100%;min-block-size:var(--lr-size-12rem);min-inline-size:var(--lr-icon-button-size);border-radius:var(--lr-radius);outline-offset:calc(-1 * var(--lr-focus-ring-width));pointer-events:none;position:relative}[part=panorama]:where([data-ready]){pointer-events:auto;cursor:grab}[part=panorama]:hover{outline:var(--lr-border-width-thin) solid var(--lr-color-border)}[part=panorama]:focus-visible{outline:var(--lr-focus-ring)}[part=panorama]:active{cursor:grabbing}[part=panorama][hidden]{display:none}[part=panorama-engine]{border-radius:inherit;block-size:100%;inline-size:100%;position:absolute;inset:0;overflow:hidden}[part=panorama-engine] canvas{block-size:100%;inline-size:100%;display:block}[part=panorama-notice]{color:var(--lr-color-text-quiet);overflow-wrap:anywhere}[part=panorama-notice] p{margin:0}[part=panorama-hotspots]{gap:var(--lr-space-xs);flex-wrap:wrap;min-inline-size:0;display:flex}[part=panorama-hotspot],[part=panorama-page]{transition:var(--lr-transition-interactive);min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);max-inline-size:100%;padding:var(--lr-space-xs) var(--lr-space-s);color:var(--lr-color-text);background:var(--lr-color-surface);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);font:inherit;overflow-wrap:anywhere;cursor:pointer}[part=panorama-hotspot]:hover,[part=panorama-page]:hover{text-decoration:underline}[part=panorama-hotspot]:focus-visible,[part=panorama-page]:focus-visible{outline:var(--lr-focus-ring);outline-offset:var(--lr-focus-ring-offset)}[part=panorama-hotspot]:active,[part=panorama-page]:active{border-color:var(--lr-color-brand)}[part=panorama-page]:disabled{opacity:var(--lr-opacity-disabled);cursor:default}`;export{panoramaStyles};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraAnchor,LyraAnchorKind,HighlightActivateDetail,AnchorResultDetail}from'../../viewers/document-viewer/anchors.js';import{type LyraImageFit}from'../../../internal/image-fit.js';export type{LyraImageFit}from'../../../internal/image-fit.js';export type LyraImageRotation=0|90|180|270;
|
|
1
|
+
import{type Engine3dPreference,type Engine3dFallbackDetail}from'../../../internal/engine-3d.js';import{type LyraMediaProjection,type LyraPanoramaCamera,type LyraPanoramaHotspot,type LyraPanoramaHotspotSelectDetail}from'./image-viewer-panorama.js';export type{LyraMediaProjection,LyraPanoramaCamera,LyraPanoramaHotspot,LyraPanoramaHotspotSelectDetail}from'./image-viewer-panorama.js';import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraAnchor,LyraAnchorKind,HighlightActivateDetail,AnchorResultDetail}from'../../viewers/document-viewer/anchors.js';import{type LyraImageFit}from'../../../internal/image-fit.js';export type{LyraImageFit}from'../../../internal/image-fit.js';export type LyraImageRotation=0|90|180|270;
|
|
2
2
|
/** Finite percentage coordinates. Negative widths/heights are rejected when rendered. */
|
|
3
3
|
export interface LyraImageRegionRect{x:number;y:number;width:number;height:number;}
|
|
4
4
|
/** Maximum region buttons projected at once. An active region beyond the leading window replaces
|
|
5
5
|
* the final entry so anchor identity remains reachable without making an unbounded tab/DOM list. */
|
|
6
|
-
export{IMAGE_VIEWER_HIGHLIGHT_LIMIT}from'./image-viewer-limits.js';export interface LyraImageViewerEventMap{'lr-load':CustomEvent<{naturalWidth:number;naturalHeight:number;}>;'lr-zoom-change':CustomEvent<{zoom:number;}>;'lr-rotation-change':CustomEvent<{rotation:LyraImageRotation;}>;'lr-fit-change':CustomEvent<{fit:LyraImageFit;}>;'lr-annotatable-change':CustomEvent<{annotatable:boolean;}>;'lr-highlight-activate':CustomEvent<HighlightActivateDetail>;'lr-annotation-create':CustomEvent<LyraEventDetailSnapshot<{anchor:LyraAnchor;}>>;'lr-anchor-result':CustomEvent<AnchorResultDetail>;'lr-render-error':CustomEvent<{error:unknown;}>;}declare class LyraImageViewerBase extends LyraElement<LyraImageViewerEventMap>{}declare const LyraImageViewer_base:Omit<typeof LyraImageViewerBase,'prototype'> &(new(...args:ConstructorParameters<typeof LyraImageViewerBase>)=>InstanceType<typeof LyraImageViewerBase> &import("../../../lyra.js").LyraAnchorTarget&import("../../../internal/anchor-target.js").DocumentAnchorTargetHooks&{renderAnchorLiveRegion():unknown;});
|
|
6
|
+
export{IMAGE_VIEWER_HIGHLIGHT_LIMIT}from'./image-viewer-limits.js';export interface LyraImageViewerEventMap{'lr-engine-fallback':CustomEvent<Engine3dFallbackDetail>;'lr-panorama-camera-change':CustomEvent<{camera:LyraPanoramaCamera;}>;'lr-panorama-hotspot-select':CustomEvent<LyraPanoramaHotspotSelectDetail>;'lr-load':CustomEvent<{naturalWidth:number;naturalHeight:number;}>;'lr-zoom-change':CustomEvent<{zoom:number;}>;'lr-rotation-change':CustomEvent<{rotation:LyraImageRotation;}>;'lr-fit-change':CustomEvent<{fit:LyraImageFit;}>;'lr-annotatable-change':CustomEvent<{annotatable:boolean;}>;'lr-highlight-activate':CustomEvent<HighlightActivateDetail>;'lr-annotation-create':CustomEvent<LyraEventDetailSnapshot<{anchor:LyraAnchor;}>>;'lr-anchor-result':CustomEvent<AnchorResultDetail>;'lr-render-error':CustomEvent<{error:unknown;}>;}declare class LyraImageViewerBase extends LyraElement<LyraImageViewerEventMap>{}declare const LyraImageViewer_base:Omit<typeof LyraImageViewerBase,'prototype'> &(new(...args:ConstructorParameters<typeof LyraImageViewerBase>)=>InstanceType<typeof LyraImageViewerBase> &import("../../../lyra.js").LyraAnchorTarget&import("../../../internal/anchor-target.js").DocumentAnchorTargetHooks&{renderAnchorLiveRegion():unknown;});
|
|
7
7
|
/**
|
|
8
8
|
* `<lr-image-viewer>` — full pan/zoom raster-image viewer with labeled region highlights and
|
|
9
9
|
* opt-in region annotation, the landing surface for `region`-anchored citations. Distinct from
|
|
@@ -30,6 +30,18 @@ export{IMAGE_VIEWER_HIGHLIGHT_LIMIT}from'./image-viewer-limits.js';export interf
|
|
|
30
30
|
* variants decrease/increase its width in both text directions; the surrounding toolbar remains
|
|
31
31
|
* logical.
|
|
32
32
|
*
|
|
33
|
+
* Panorama rendering is opt-in through projection="equirectangular" and engine="webgl".
|
|
34
|
+
* The optional companion reuses the existing native media; loading or renderer failure retains
|
|
35
|
+
* the flat view. Hotspots use unique IDs and yaw/pitch radians, with 200-item text pages.
|
|
36
|
+
* @event lr-engine-fallback - Renderer fallback detail contains from, to and reason.
|
|
37
|
+
* @event lr-panorama-camera-change - A gesture or keyboard action changed the panorama camera; detail contains camera.
|
|
38
|
+
* @event lr-panorama-hotspot-select - A hotspot was activated; detail contains hotspot, id and index.
|
|
39
|
+
* @csspart panorama - Keyboard-operable spherical viewport.
|
|
40
|
+
* @csspart panorama-engine - The optional renderer container.
|
|
41
|
+
* @csspart panorama-notice - Localized renderer loading or fallback feedback.
|
|
42
|
+
* @csspart panorama-hotspots - The paginated hotspot alternative.
|
|
43
|
+
* @csspart panorama-hotspot - One hotspot activation button.
|
|
44
|
+
* @csspart panorama-page - A hotspot page action.
|
|
33
45
|
* @customElement lr-image-viewer
|
|
34
46
|
* @event lr-load - Image finished loading. `detail: { naturalWidth, naturalHeight }`.
|
|
35
47
|
* @event lr-zoom-change - `detail: { zoom }`, bubbles from the embedded pan-zoom surface.
|
|
@@ -98,7 +110,16 @@ export{IMAGE_VIEWER_HIGHLIGHT_LIMIT}from'./image-viewer-limits.js';export interf
|
|
|
98
110
|
* @status stable
|
|
99
111
|
* @since 4.0.0
|
|
100
112
|
*/
|
|
101
|
-
export declare class LyraImageViewer extends LyraImageViewer_base{static styles:import("lit").CSSResultGroup[];private readonly hostDescription;protected static collectionSupport:import("../../../internal/lyra-element.js").LyraCollectionSupport;protected static readonly immutableEventDetails:readonly string[];
|
|
113
|
+
export declare class LyraImageViewer extends LyraImageViewer_base{static styles:import("lit").CSSResultGroup[];private readonly hostDescription;protected static collectionSupport:import("../../../internal/lyra-element.js").LyraCollectionSupport;protected static readonly immutableEventDetails:readonly string[];private panoramaRevision;private readonly panorama;private _projection;
|
|
114
|
+
/** Flat media by default. Equirectangular rendering also requires engine="webgl". */
|
|
115
|
+
get projection():LyraMediaProjection;set projection(value:LyraMediaProjection);private _engine;
|
|
116
|
+
/** Preferred panorama renderer; the builtin flat view never downloads a companion. */
|
|
117
|
+
get engine():Engine3dPreference;set engine(value:Engine3dPreference);private _panoramaCamera;
|
|
118
|
+
/** Camera yaw/pitch in radians and vertical fieldOfView in degrees (20–100). Authored writes are silent. */
|
|
119
|
+
get panoramaCamera():LyraPanoramaCamera;set panoramaCamera(value:LyraPanoramaCamera);private _hotspots;private hotspotSource;
|
|
120
|
+
/** Bounded clone-owned hotspot snapshot. First valid unique ID wins; reassign after changes.
|
|
121
|
+
* Angles are radians, pitch is within ±π/2, and invalid rows are omitted. */
|
|
122
|
+
get hotspots():readonly LyraPanoramaHotspot[];set hotspots(value:readonly LyraPanoramaHotspot[]);private get panoramaEnabled();requestUpdate(name?:PropertyKey,oldValue?:unknown,options?:Parameters<LyraElement['requestUpdate']>[2]):void;
|
|
102
123
|
/** Image URL; validated with `safeMediaSrc` before it ever reaches the `<img>`. */
|
|
103
124
|
src:string;
|
|
104
125
|
/** Accessible name of `[part="base"]`; a host `aria-label` wins, then the localized
|
|
@@ -122,10 +143,13 @@ zoomStep:number;private _rotation;get rotation():LyraImageRotation;set rotation(
|
|
|
122
143
|
* commands and shows the shared focus ring inside its clipped viewport; descendant highlights retain activation. */
|
|
123
144
|
annotatable:boolean;
|
|
124
145
|
/** From `DocumentAnchorTarget` — only `region` anchors resolve here. */
|
|
125
|
-
readonly anchorKinds:readonly LyraAnchorKind[];private loadState;private draft;private revealTarget;private highlightFocusId;private mediaLayoutSize;private readonly announcements;private geometryObserver?;private observedWrapper?;private geometryFrame?;private geometryFrameOwner?;private frameEl?;private liveRegion?;private wrapperEl?;private get hasOperableContent();protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;
|
|
146
|
+
readonly anchorKinds:readonly LyraAnchorKind[];private loadState;private draft;private revealTarget;private highlightFocusId;private mediaLayoutSize;private readonly announcements;private geometryObserver?;private observedWrapper?;private geometryFrame?;private geometryFrameOwner?;private frameEl?;private liveRegion?;private wrapperEl?;private get hasOperableContent();private declarativeAnchorUpdate;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;
|
|
126
147
|
/** Increases the embedded pan/zoom scale by one configured step. */
|
|
127
148
|
zoomIn():void;
|
|
128
149
|
/** Decreases the embedded pan/zoom scale by one configured step. */
|
|
129
150
|
zoomOut():void;
|
|
130
151
|
/** Restores the embedded pan/zoom scale to `1`, keeping the pan position. */
|
|
131
|
-
resetZoom():void;rotate():void;
|
|
152
|
+
resetZoom():void;rotate():void;
|
|
153
|
+
/** Explicit region navigation reveals the flat image before resolving its rectangle.
|
|
154
|
+
* Declarative anchor assignments do not change the chosen projection. */
|
|
155
|
+
scrollToAnchor(target:LyraAnchor|string):Promise<boolean>;protected applyAnchor(anchor:LyraAnchor):Promise<boolean>;private onImgLoad;private onImgError;connectedCallback():void;adoptedCallback():void;private disconnectGeometryObserver;private updateMediaLayoutSize;private scheduleMediaLayoutSize;private syncGeometryObserver;private announceLoadError;private onFrameZoomChange;private onHighlightActivate;private toggleAnnotatable;private onFitChange;private announceDraftPosition;private onWrapperKeyDown;private commitDraft;private pointerDraftId;private pointerOrigin;private cancelPointerDraft;private onWrapperPointerDown;private onWrapperPointerMove;private onWrapperPointerUp;private regionHighlights?;private canonicalRegionHighlights;private boundedRegionHighlights;private onHighlightFocus;private onHighlightKeyDown;private renderHighlights;private renderDraft;private renderRevealTarget;private renderBody;render():TemplateResult;disconnectedCallback():void;}declare global{interface HTMLElementTagNameMap{'lr-image-viewer':LyraImageViewer;}}
|