@aceshooting/lyra-ui 29.2.2 → 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 -106
- 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 +3 -3
- 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 +41 -13
- 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
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
- **Status** `stable` since `4.0.0` — see the maturity and deprecation policy in `llms/shared.md`
|
|
9
9
|
- **Release history** [CHANGELOG.md](../../CHANGELOG.md); family-wide breaking-change summaries: [media](https://github.com/aceshooting/lyra-ui/blob/main/packages/lyra-ui/llms/media.md)
|
|
10
10
|
- **Deprecations** none
|
|
11
|
-
- **Optional peers** `@aceshooting/lyra-map`, `maplibre-gl` — see `llms/peers.md`
|
|
12
|
-
- **Themeable via**
|
|
11
|
+
- **Optional peers** `@aceshooting/lyra-map`, `dompurify`, `maplibre-gl` — see `llms/peers.md`
|
|
12
|
+
- **Themeable via** 50 parts, 9 custom properties — see this component's own `@csspart`/`@cssprop` list below
|
|
13
13
|
- **Library-wide behavior** (events, form association, `locale`/`strings`, tokens, TS types): `llms/shared.md`
|
|
14
14
|
|
|
15
15
|
---
|
|
@@ -56,6 +56,448 @@ step base color again, as well as its opacity. These are paint-only updates on t
|
|
|
56
56
|
layer: the map instance, source, layer and viewport are preserved. Linear, logarithmic and step
|
|
57
57
|
modes use the same expression semantics at initial render and after a theme change.
|
|
58
58
|
|
|
59
|
+
**Readiness and declarative resources:** `whenStyleReady()` waits for the current style and
|
|
60
|
+
wrapper-owned resources for that style generation. After changing layer or source data on the same
|
|
61
|
+
style, await `whenIdle()` for the current resource and rendering work. Observe
|
|
62
|
+
`lr-map-style-load` and `lr-map-idle` for lifecycle notifications. Await these promises and handle
|
|
63
|
+
rejection when replacing styles or disconnecting; a returned `true` from a synchronous command
|
|
64
|
+
means admission, not asynchronous completion.
|
|
65
|
+
|
|
66
|
+
**On-demand runtimes:** optional `lr-map` features load their code on first use, so a bundler that
|
|
67
|
+
splits chunks keeps them out of the initial bundle. Drawing and vertex editing load when `drawMode`
|
|
68
|
+
becomes `line` or `polygon` or `editDrawing()` is first called; `exportImage()` loads export
|
|
69
|
+
capture; `hash` loads URL ownership when it is anything but `false`, `null` or `undefined`;
|
|
70
|
+
`overlays`, `images`, `styleOverrides`, external data layers and `interactiveBasemapLayers` load
|
|
71
|
+
resource ownership when they are not the empty defaults; an `imageProvider` function loads
|
|
72
|
+
resource ownership too. Image preparation and basemap override ownership load only for
|
|
73
|
+
non-empty `images` and `styleOverrides`; `anchorLngLat` loads
|
|
74
|
+
anchor placement; the first native control (default attribution included) loads control
|
|
75
|
+
ownership; and the first `setFeatureState()`/`removeFeatureState()` loads feature state. Each
|
|
76
|
+
runtime is imported once per page and every element shares it. `whenStyleReady()` and
|
|
77
|
+
`whenIdle()` wait for a resource-ownership load and for any drawing, URL or feature-state load in
|
|
78
|
+
progress, so awaiting them is the deterministic way to wait; anchor placement, export and controls
|
|
79
|
+
stay asynchronous as before. Once a runtime has loaded, its APIs are synchronous again.
|
|
80
|
+
While one is loading, `editDrawing()`, `setFeatureState()` and `removeFeatureState()` return
|
|
81
|
+
`false` without retaining anything: await `whenIdle()` and call again. `undoDrawing()`,
|
|
82
|
+
`completeDrawing()`, `closeAnchor()` and `focusAnchor()` return `false` because no session or
|
|
83
|
+
placed anchor exists yet; `cancelDrawing()` still cancels an armed mode synchronously with the
|
|
84
|
+
usual `lr-map-draw-cancel` detail. A runtime that cannot load fails closed with the feature's
|
|
85
|
+
existing localized feedback: drawing shows its unavailable message, export rejects with
|
|
86
|
+
`capture-failed`, resources show the initialization fallback, URL ownership and requested controls
|
|
87
|
+
show the control-unavailable message (default attribution alone stays silent, as when its own code
|
|
88
|
+
cannot load), feature state shows its unavailable message, and an anchor stays hidden. Drawing
|
|
89
|
+
retries when drawing is requested again, feature state after a new style or connection, URL
|
|
90
|
+
ownership after reconnection, controls when they next change, export on its next call, and an
|
|
91
|
+
anchor for a new coordinate.
|
|
92
|
+
|
|
93
|
+
`overlays: LyraMapOverlays = {}` owns native `sources` (`{ id, source }`) and `layers`
|
|
94
|
+
(`{ layer, before?, interactive?, priority? }`). Descriptors are snapshotted as bounded plain data:
|
|
95
|
+
at most 128 sources and 128 layers, 50,000 values, 10,000 entries per array or record and 1 MiB of
|
|
96
|
+
text; a rejected assignment shows the localized initialization failure. A `geojson` source whose
|
|
97
|
+
`data` is a `Feature` or `FeatureCollection` object is the exception: that object is kept by
|
|
98
|
+
identity (its envelope is checked, its contents are left to the engine, as for `dataLayers`), so
|
|
99
|
+
large data stays outside that budget. That is the supported way to draw large styled GeoJSON with
|
|
100
|
+
native paint and layout expressions (`match`, `interpolate` on `["zoom"]`,
|
|
101
|
+
`["coalesce", ["feature-state", "x"], ["get", "x"]]`), `filter`, `minzoom`/`maxzoom`, symbol layers,
|
|
102
|
+
`before` ordering, interaction and feature state, all replayed after a `mapStyle` swap. Assign a new
|
|
103
|
+
`data` object (in a new `overlays` value) to update the native source in place with `setData`: its
|
|
104
|
+
layers stay, and its feature state is retired as for any data change. Mutating the retained object is
|
|
105
|
+
not observed; `updateSourceData(sourceId, diff)` also accepts an overlay GeoJSON source ID for
|
|
106
|
+
incremental diffs (re-applied from `data` after the next style swap). Hits skip an interactive layer
|
|
107
|
+
outside its `minzoom`/`maxzoom` at the fractional camera zoom, with `visibility: 'none'`, or whose
|
|
108
|
+
every opacity (a constant or a `["zoom"]`-driven `interpolate`/`step`) is `0`, so a hidden tier never
|
|
109
|
+
shadows a visible one.
|
|
110
|
+
|
|
111
|
+
Reassign a fresh `overlays` snapshot to change an owned layer's `paint`, `layout`, `filter`,
|
|
112
|
+
`minzoom` or `maxzoom`. When its `id`, `type`, source/source-layer binding and other structural
|
|
113
|
+
fields stay the same and its source does not need replacement, the wrapper applies those mutable
|
|
114
|
+
fields in place. Removed paint and layout
|
|
115
|
+
keys are unset; removing `filter` clears it, and omitted zoom bounds return to `0`/`24`. The native
|
|
116
|
+
source and layer stay installed, so feature state, image references and interaction attribution
|
|
117
|
+
survive the change. The `before` order planner also runs when a snapshot changes. Changing a
|
|
118
|
+
structural field, or using a peer without the needed mutation methods, takes the existing
|
|
119
|
+
remove/add path instead. A failed native mutation is rolled back while the current peer can still
|
|
120
|
+
be used; if restoration fails, ownership stays uncertain until a fresh style or peer can rebuild
|
|
121
|
+
the resources. Failures
|
|
122
|
+
produce the localized resource error, without exposing the native exception or claiming readiness
|
|
123
|
+
for a partial update. Keep the application snapshot authoritative and await `whenIdle()` after a
|
|
124
|
+
successful assignment before relying on the new rendering.
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
mapEl.overlays = {
|
|
128
|
+
sources: [{ id: 'communes', source: { type: 'geojson', data: communes /* 600k values */, promoteId: 'code' } }],
|
|
129
|
+
layers: [{ interactive: true, before: 'place-labels', layer: {
|
|
130
|
+
id: 'communes-fill', type: 'fill', source: 'communes', minzoom: 9, maxzoom: 14,
|
|
131
|
+
filter: ['==', ['get', 'level'], 'commune'],
|
|
132
|
+
paint: {
|
|
133
|
+
'fill-color': ['coalesce', ['feature-state', 'color'], ['get', 'color']],
|
|
134
|
+
'fill-opacity': ['interpolate', ['linear'], ['zoom'], 9, 0, 10, 0.6],
|
|
135
|
+
},
|
|
136
|
+
} }],
|
|
137
|
+
};
|
|
138
|
+
mapEl.setFeatureState({ origin: 'overlay', source: 'communes', id: 'LU0101' }, { color: '#0d6efd' });
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Composing independent map modules
|
|
142
|
+
|
|
143
|
+
Keep one application owner of `overlays`. For example, publish eight module snapshots in this
|
|
144
|
+
explicit bottom-to-top order: districts, parcels, roads, transit, water, sensors, alerts, selection.
|
|
145
|
+
Each controller returns immutable `sources` and `layers` arrays with globally unique stable IDs
|
|
146
|
+
such as `city:roads:data` and `city:roads:fill`. These are application IDs; the aggregator never
|
|
147
|
+
prefixes or rewrites them. Freeze nested descriptor values too and treat retained GeoJSON as
|
|
148
|
+
immutable; create fresh descriptors when a controller changes. Keep large `data` objects by
|
|
149
|
+
reference instead of cloning or serializing them.
|
|
150
|
+
|
|
151
|
+
The tested **Independent Modules** story uses the following pure composition pattern (trusted
|
|
152
|
+
application snapshots, not an admission boundary for untrusted objects):
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
import type { LyraMapOverlays } from '@aceshooting/lyra-ui/components/media/map/map.class.js';
|
|
156
|
+
|
|
157
|
+
/** Application example, shared by the composition story and its tests. */
|
|
158
|
+
export const MAP_MODULE_ORDER = Object.freeze([
|
|
159
|
+
'districts', 'parcels', 'roads', 'transit', 'water', 'sensors', 'alerts', 'selection',
|
|
160
|
+
] as const);
|
|
161
|
+
export type MapModuleName = typeof MAP_MODULE_ORDER[number];
|
|
162
|
+
export type MapModuleSnapshot = Required<LyraMapOverlays>;
|
|
163
|
+
export type MapModules = Readonly<Partial<Record<MapModuleName, MapModuleSnapshot>>>;
|
|
164
|
+
|
|
165
|
+
/** Match descriptor admission limits before publication, without visiting GeoJSON contents.
|
|
166
|
+
* This example accepts plain immutable application descriptors, not canvas/other native objects. */
|
|
167
|
+
function validateDescriptors(sources: NonNullable<LyraMapOverlays['sources']>, layers: NonNullable<LyraMapOverlays['layers']>): void {
|
|
168
|
+
if (sources.length > 128 || layers.length > 128) throw new Error('limit');
|
|
169
|
+
let values = 0, text = 0;
|
|
170
|
+
const visiting = new WeakSet<object>();
|
|
171
|
+
const fail = (): never => { throw new Error('invalid-descriptor'); };
|
|
172
|
+
const plain = (value: unknown): value is Record<string, unknown> => value !== null && typeof value === 'object' &&
|
|
173
|
+
(Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);
|
|
174
|
+
const plainArray = (value: unknown): value is unknown[] => Array.isArray(value) && Object.getPrototypeOf(value) === Array.prototype;
|
|
175
|
+
const own = (value: object, key: string): unknown => {
|
|
176
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
177
|
+
if (!descriptor) return undefined;
|
|
178
|
+
if (!Object.hasOwn(descriptor, 'value')) return fail();
|
|
179
|
+
return descriptor.value;
|
|
180
|
+
};
|
|
181
|
+
const safeKey = (key: string): void => { if (['__proto__', 'prototype', 'constructor'].includes(key)) fail(); };
|
|
182
|
+
const addText = (value: string): void => { text += value.length; if (text > 1_048_576) throw new Error('limit'); };
|
|
183
|
+
const walk = (value: unknown, depth: number): void => {
|
|
184
|
+
values += 1;
|
|
185
|
+
if (values > 50_000 || depth > 24) throw new Error('limit');
|
|
186
|
+
if (value === null || typeof value === 'boolean') return;
|
|
187
|
+
if (typeof value === 'string') { addText(value); return; }
|
|
188
|
+
if (typeof value === 'number') { if (!Number.isFinite(value)) fail(); return; }
|
|
189
|
+
if (typeof value !== 'object' || visiting.has(value)) return fail();
|
|
190
|
+
visiting.add(value);
|
|
191
|
+
try {
|
|
192
|
+
if (plainArray(value)) {
|
|
193
|
+
if (value.length > 10_000) throw new Error('limit');
|
|
194
|
+
for (let i = 0; i < value.length; i++) walk(own(value, String(i)), depth + 1);
|
|
195
|
+
} else {
|
|
196
|
+
if (!plain(value)) fail();
|
|
197
|
+
const keys = Object.keys(value);
|
|
198
|
+
if (keys.length > 10_000) throw new Error('limit');
|
|
199
|
+
for (const key of keys) {
|
|
200
|
+
safeKey(key);
|
|
201
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
202
|
+
if (!descriptor || !Object.hasOwn(descriptor, 'value')) fail();
|
|
203
|
+
addText(key); walk(descriptor!.value, depth + 1);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
} finally { visiting.delete(value); }
|
|
207
|
+
};
|
|
208
|
+
for (const { source } of sources) {
|
|
209
|
+
if (!plain(source)) fail();
|
|
210
|
+
const type = own(source, 'type');
|
|
211
|
+
if (typeof type !== 'string' || !/^[a-z][a-z0-9-]{0,63}$/u.test(type)) fail();
|
|
212
|
+
const data = own(source, 'data');
|
|
213
|
+
const envelope = plain(data) && (own(data, 'type') === 'FeatureCollection' && plainArray(own(data, 'features')) ||
|
|
214
|
+
own(data, 'type') === 'Feature' && (own(data, 'geometry') === null || plain(own(data, 'geometry'))));
|
|
215
|
+
if (type === 'geojson' && envelope) {
|
|
216
|
+
const keys = Object.keys(source);
|
|
217
|
+
if (keys.length > 10_000) throw new Error('limit');
|
|
218
|
+
for (const key of keys) {
|
|
219
|
+
safeKey(key); addText(key);
|
|
220
|
+
const value = own(source, key);
|
|
221
|
+
if (key !== 'data') walk(value, 1);
|
|
222
|
+
}
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
walk(source, 0);
|
|
226
|
+
}
|
|
227
|
+
for (const { layer } of layers) {
|
|
228
|
+
if (typeof layer.type !== 'string' || !/^[a-z][a-z0-9-]{0,63}$/u.test(layer.type)) fail();
|
|
229
|
+
if (layer['source'] !== undefined && typeof layer['source'] !== 'string') fail();
|
|
230
|
+
walk(layer, 0);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function canonicalId(id: string): string {
|
|
234
|
+
if (!id || id !== id.trim() || id.length > 128 || ['__proto__', 'prototype', 'constructor'].includes(id))
|
|
235
|
+
throw new Error('noncanonical-id');
|
|
236
|
+
return id;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** Compose trusted application snapshots. IDs are never rewritten. External dependencies are
|
|
240
|
+
* declared explicitly; callers must refresh those inventories when their basemap changes. */
|
|
241
|
+
export function composeMapModules(modules: MapModules, external: {
|
|
242
|
+
readonly sources: readonly string[]; readonly layers: readonly string[];
|
|
243
|
+
} = { sources: [], layers: [] }): LyraMapOverlays {
|
|
244
|
+
const sources = MAP_MODULE_ORDER.flatMap(name => modules[name]?.sources ?? []);
|
|
245
|
+
const layers = MAP_MODULE_ORDER.flatMap(name => modules[name]?.layers ?? []);
|
|
246
|
+
validateDescriptors(sources, layers);
|
|
247
|
+
const sourceIds = new Set(external.sources.map(canonicalId)), layerIds = new Set(external.layers.map(canonicalId));
|
|
248
|
+
for (const entry of sources) {
|
|
249
|
+
canonicalId(entry.id);
|
|
250
|
+
if (sourceIds.has(entry.id)) throw new Error(`duplicate-source:${entry.id}`);
|
|
251
|
+
sourceIds.add(entry.id);
|
|
252
|
+
}
|
|
253
|
+
for (const entry of layers) {
|
|
254
|
+
canonicalId(entry.layer.id);
|
|
255
|
+
if (layerIds.has(entry.layer.id)) throw new Error(`duplicate-layer:${entry.layer.id}`);
|
|
256
|
+
layerIds.add(entry.layer.id);
|
|
257
|
+
}
|
|
258
|
+
for (const entry of layers) {
|
|
259
|
+
const source = entry.layer['source'];
|
|
260
|
+
if (typeof source === 'string') canonicalId(source);
|
|
261
|
+
if (entry.before !== undefined) canonicalId(entry.before);
|
|
262
|
+
if (typeof source === 'string' && !sourceIds.has(source)) throw new Error(`missing-source:${source}`);
|
|
263
|
+
if (entry.before !== undefined && !layerIds.has(entry.before)) throw new Error(`missing-layer:${entry.before}`);
|
|
264
|
+
}
|
|
265
|
+
const before = new Map(layers.map(entry => [entry.layer.id, entry.before]));
|
|
266
|
+
for (const { layer } of layers) {
|
|
267
|
+
const seen = new Set<string>(); let next: string | undefined = layer.id;
|
|
268
|
+
while (next !== undefined && before.has(next)) {
|
|
269
|
+
if (seen.has(next)) throw new Error(`cycle:${next}`);
|
|
270
|
+
seen.add(next); next = before.get(next);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
// The component remains responsible for native order planning and bounded descriptor admission.
|
|
274
|
+
return Object.freeze({ sources: Object.freeze(sources), layers: Object.freeze(layers) });
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/** An application controller calls this once after batching its module changes. Validation runs
|
|
278
|
+
* before the sole assignment; failures leave both the map and the last successful input intact. */
|
|
279
|
+
export function createMapModulePublisher(assign: (overlays: LyraMapOverlays) => void) {
|
|
280
|
+
let previous: MapModules | undefined;
|
|
281
|
+
return (modules: MapModules): boolean => {
|
|
282
|
+
if (previous && MAP_MODULE_ORDER.every(name => previous?.[name] === modules[name])) return false;
|
|
283
|
+
const overlays = composeMapModules(modules);
|
|
284
|
+
assign(overlays);
|
|
285
|
+
previous = Object.freeze({ ...modules });
|
|
286
|
+
return true;
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
const publish = createMapModulePublisher(value => { mapEl.overlays = value; });
|
|
292
|
+
try { publish(moduleSnapshots); }
|
|
293
|
+
catch (error) { reportCompositionDiagnostic(error); }
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Collect all IDs before checking dependencies so modules can reference another module's source or
|
|
297
|
+
`before` layer regardless of publication order. If referencing basemap IDs, explicitly supply their
|
|
298
|
+
current source/layer inventories to validation, check collisions with them, and refresh those
|
|
299
|
+
inventories when changing styles. The self-contained example needs no external inventories.
|
|
300
|
+
This application preflight rejects noncanonical IDs (including surrounding whitespace), duplicate IDs, missing dependencies, cycles and the same aggregate descriptor budgets before assignment. It accepts trusted plain immutable native descriptors; canvas/native-object sources need their own validated application adapter. GeoJSON envelopes retain opaque data by identity outside the descriptor walk. Native option semantics remain the selected engine's responsibility. The map repeats bounded admission and native order planning; splitting resources into modules does not raise its limits.
|
|
301
|
+
|
|
302
|
+
A publisher can retain the last successful module references and skip publication when all eight
|
|
303
|
+
references are unchanged. Publish a fresh module snapshot on each change, then compose and make
|
|
304
|
+
exactly one assignment for the batch. Only update that reference cache after successful composition
|
|
305
|
+
and assignment. Duplicate IDs or missing dependencies reject the whole composition with a stable
|
|
306
|
+
application diagnostic; the last assigned aggregate remains intact. Remove a module by omitting its
|
|
307
|
+
snapshot, and resolve any dependent descriptors in the same batch. Unrelated module snapshots,
|
|
308
|
+
descriptors and GeoJSON retain their identity. Composition does not replace the map's native
|
|
309
|
+
lifecycle: resources replay after style changes, clicks keep `hit.origin === 'overlay'` and their
|
|
310
|
+
`sourceId`, and `setFeatureState({ origin: 'overlay', source: sourceId, id }, patch)` keeps the normal
|
|
311
|
+
identity and retirement rules described below. The story demonstrates style replay, attributed
|
|
312
|
+
selection, a module update/removal and a rejected conflicting module.
|
|
313
|
+
|
|
314
|
+
`images: readonly LyraMapImage[] = []` registers bounded image descriptors (`id`, `source`,
|
|
315
|
+
`width`, `height`, `pixelRatio`, `sdf?`), with SVG markup or a safe URL as the source: up to 1,024
|
|
316
|
+
images within an aggregate budget of 16,777,216 backing pixels and 8 MiB of encoded input, so a
|
|
317
|
+
sprite catalog fits. `sdf: true` registers a signed-distance-field image that `icon-color` and
|
|
318
|
+
`icon-halo-color` recolor. Reassigning `images` adds, replaces and removes images in place, without
|
|
319
|
+
removing or re-adding the layers that use them. These resources are restored after style
|
|
320
|
+
replacement; keep IDs distinct from basemap and generated resources.
|
|
321
|
+
|
|
322
|
+
`imageProvider?: LyraMapImageProvider` (attribute: false) supplies images on demand:
|
|
323
|
+
`(id) => LyraMapImage | null | undefined` (or a promise of one), called through the engine's
|
|
324
|
+
missing-image hook for an image ID a layer needs that neither `images` nor the basemap sprite has.
|
|
325
|
+
Return a descriptor with the same `id`; it is sanitized and rasterized like an `images` entry and
|
|
326
|
+
shares their count and pixel budget. A declined, invalid, failing or over-budget image stays missing
|
|
327
|
+
(development-mode warning) without failing the map. Each ID is asked once per provider and its
|
|
328
|
+
pixels are re-added after a style swap; an ID later assigned through `images` is handed over to it,
|
|
329
|
+
and replacing or clearing the provider removes what it supplied. The engine waits for the provider
|
|
330
|
+
before laying out the symbols that need it, so `whenIdle()` covers it.
|
|
331
|
+
|
|
332
|
+
```js
|
|
333
|
+
mapEl.imageProvider = async (id) => id.startsWith('poi-')
|
|
334
|
+
? { id, source: { kind: 'url', url: `/sprites/${id}.svg` }, width: 32, height: 32, pixelRatio: 2 }
|
|
335
|
+
: undefined;
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
`styleOverrides: readonly LyraMapStyleOverride[] = []` applies `paint` and `layout` records by `layerId` to existing unowned style layers. Reassign fresh
|
|
339
|
+
descriptors to change desired state; unsupported or conflicting resources fail closed.
|
|
340
|
+
|
|
341
|
+
An overlay layer's `source` may name a source of the basemap style itself rather than one of
|
|
342
|
+
`overlays.sources`, for example a vector tile source plus its `source-layer`, so you can add a
|
|
343
|
+
highlight or a restyled copy of basemap features without registering the source twice; the layer is
|
|
344
|
+
restored after every style swap whose new style still defines that source. Color-valued `paint`
|
|
345
|
+
strings in overlay layers and `styleOverrides` may be theme tokens (`var(--brand)`), `currentColor`
|
|
346
|
+
or CSS color functions (`oklch()`, `color-mix()`, `light-dark()`, …), also inside expressions. They
|
|
347
|
+
resolve against the host, convert to sRGB (engines parse only sRGB notations) and re-resolve when an
|
|
348
|
+
ancestor theme, class, style or color scheme changes; an unresolvable token fails closed like any
|
|
349
|
+
other invalid resource.
|
|
350
|
+
|
|
351
|
+
```js
|
|
352
|
+
map.overlays = {
|
|
353
|
+
layers: [{ layer: { id: 'poi-highlight', type: 'circle', source: 'openmaptiles', 'source-layer': 'poi',
|
|
354
|
+
paint: { 'circle-color': 'var(--lr-color-brand)', 'circle-radius': 6 } } }],
|
|
355
|
+
};
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Basemap selectors and the style catalog:** an `interactiveBasemapLayers` or `styleOverrides`
|
|
359
|
+
entry names one layer by `layerId`, or selects every layer of the current style whose `source`,
|
|
360
|
+
`sourceLayer` and `layerType` match the fields it gives (`LyraMapStyleLayerSelector`), for example
|
|
361
|
+
`{ sourceLayer: 'poi', layerType: 'symbol', paint: { 'icon-opacity': 0.4 } }`. An explicit id wins
|
|
362
|
+
over a selector and an earlier selector over a later one; an entry with both an id and a selector,
|
|
363
|
+
or with an empty selector, fails closed. Selectors re-match after each style swap, and a selector
|
|
364
|
+
may expand to at most 1,024 overridden layers. The read-only `styleLayers`
|
|
365
|
+
(`{ id, type, source?, sourceLayer? }[]`, at most 4,096) and `styleSources` (`{ id, type }[]`, at
|
|
366
|
+
most 1,024) list what the current `mapStyle` loaded, before the element added its own resources.
|
|
367
|
+
Both are frozen, empty until the style has loaded and replaced on every style swap; read them after
|
|
368
|
+
`lr-map-style-load` or `whenStyleReady()`.
|
|
369
|
+
|
|
370
|
+
`LyraMapDataLayer` includes GeoJSON and explicitly discriminated `vector`, `raster`, `image`, and
|
|
371
|
+
`canvas` descriptors. Tile descriptors use `source`; vector descriptors also require `sourceLayer`
|
|
372
|
+
and `render`. Image descriptors use `url` and canvas descriptors retain an `HTMLCanvasElement`;
|
|
373
|
+
both require four `coordinates` ordered top-left, top-right, bottom-right, bottom-left. External
|
|
374
|
+
layers accept `before`, `minZoom`, `maxZoom`, `opacity`, and `category`. GeoJSON and vector labels
|
|
375
|
+
use `label: LyraMapLabelOptions` with exactly one `field` or `expression`; text needs a style with
|
|
376
|
+
a glyph provider. Image/canvas interaction tests the full four-corner footprint, including
|
|
377
|
+
transparent pixels, and reports `sourceId` without inventing feature identity or `sourceLayer`.
|
|
378
|
+
|
|
379
|
+
For a retained canvas, change `redrawRevision` (default `0`, a nonnegative safe integer) in a
|
|
380
|
+
fresh `dataLayers` array after drawing. With `animate: false`, this uploads the new pixels once
|
|
381
|
+
without replacing the source or its layers. Repeating a revision does not request another upload.
|
|
382
|
+
An already animated canvas keeps its animation policy. Coordinate and revision changes can be
|
|
383
|
+
assigned together. Missing native upload support fails through the map's resource-error path.
|
|
384
|
+
|
|
385
|
+
Image-layer `url` also accepts strict base64 PNG/JPEG/WebP data URLs and blob URLs from the
|
|
386
|
+
current document origin. SVG and other local formats are rejected. Local image preparation has a
|
|
387
|
+
1 MiB byte limit, a 2,048-pixel per-axis limit, a 4,194,304-pixel limit and a 15-second deadline.
|
|
388
|
+
The map owns a separately validated object URL; it never revokes the caller's blob URL. Retained
|
|
389
|
+
local URLs share an 8 MiB encoded-byte retention budget, including older URLs awaiting native retirement.
|
|
390
|
+
This local-source budget is separate from the atlas-image budget used by `images` and `imageProvider`.
|
|
391
|
+
Keep an input blob URL available until preparation finishes. The owned URL survives style replay
|
|
392
|
+
and is released after its native use retires or the map disconnects. Tile and style URLs keep
|
|
393
|
+
their HTTP(S)-only policy.
|
|
394
|
+
|
|
395
|
+
Paint-only data-layer and choropleth changes request one repaint per synchronous mutation batch.
|
|
396
|
+
Equal paint produces no repaint; camera movement is not needed to show a metric or theme change.
|
|
397
|
+
|
|
398
|
+
**Interactions:** opt in with `interactive` and optional `priority` on a data layer, choropleth or
|
|
399
|
+
owned overlay layer; `interactiveBasemapLayers = []` explicitly enrolls basemap layers.
|
|
400
|
+
`lr-map-click`, `lr-map-contextmenu`, `lr-map-feature-enter`, and `lr-map-feature-leave` report routed interaction data;
|
|
401
|
+
legacy `lr-map-click` and cluster payloads remain available. `pickMode = false` enables a temporary
|
|
402
|
+
coordinate-picking session when set to true; `lr-map-pick` also supports keyboard center selection.
|
|
403
|
+
`setFeatureState(target, patch)`, `getFeatureState(target)`, and `removeFeatureState(target, key?)`
|
|
404
|
+
use stable source/feature IDs and an optional `origin` (`choropleth`, `data-layer`, `overlay`, or
|
|
405
|
+
`basemap`). Check boolean admission and retain application state across source identity changes;
|
|
406
|
+
the first write returns `false` while the feature-state runtime loads (see **On-demand runtimes**).
|
|
407
|
+
`hash = false` opts out of URL camera synchronization; use true or a distinct string key to opt in.
|
|
408
|
+
With `hashFormat: LyraMapHashFormat = 'named'` (attribute `hash-format`) the camera is the
|
|
409
|
+
`#map=zoom/lat/lng[/bearing[/pitch]]` field (or the given key); other `&`-separated tokens are
|
|
410
|
+
preserved. `hashFormat = 'unnamed'` with `hash = true` reads and writes the raw engine's unnamed
|
|
411
|
+
form, `#zoom/lat/lng[/bearing[/pitch]]`, so existing deep links keep working: the camera is the
|
|
412
|
+
leading token without `=`, named fields after it are kept, and a fragment of named fields only gets
|
|
413
|
+
the camera prepended. A string `hash` under `'unnamed'` is invalid and shows the localized hash
|
|
414
|
+
message. An enabled `hash` delays map construction until URL ownership has loaded, so a valid
|
|
415
|
+
initial hash still sets the first camera, and it takes precedence over a queued initial
|
|
416
|
+
`fitBounds()`/`fitToData()`. Only a valid camera in the owned field or token suppresses that fit: an
|
|
417
|
+
absent, unrelated (`#section`) or malformed fragment leaves the fit to run, and a malformed owned
|
|
418
|
+
value is left untouched (no camera is written over it) until navigation replaces it.
|
|
419
|
+
`controls` also supports `geolocate` and `attribution` options; geolocation errors are sanitized in
|
|
420
|
+
`lr-map-geolocate-error`, and out-of-bounds reports use `lr-map-geolocate-out-of-bounds`. A
|
|
421
|
+
successful location, which only the user's activation of the geolocate button can start, emits
|
|
422
|
+
`lr-map-geolocate` with frozen `LyraMapGeolocateDetail { lngLat, accuracy }` (`accuracy` in metres),
|
|
423
|
+
again for each position update while the control tracks the user. Use it to store the position or
|
|
424
|
+
to compare it against your own bounds.
|
|
425
|
+
`lr-map-pointer-move` (frozen `LyraMapPointerDetail { lngLat, point }`) reports the mouse position
|
|
426
|
+
at most once per animation frame whatever lies under it, for tooltips and coordinate read-outs, and
|
|
427
|
+
`lr-map-pointer-leave` (detail `null`) follows when it leaves the map. `lr-map-feature-enter`,
|
|
428
|
+
`lr-map-feature-leave`, `lr-map-contextmenu` and `lr-map-pick` add `feature`, the hit as a detached,
|
|
429
|
+
deeply frozen GeoJSON `Feature` (`LyraMapFeature`) with its `[longitude, latitude]` geometry. That
|
|
430
|
+
geometry is the rendered one, so a large feature may be clipped to the tiles around the pointer, and
|
|
431
|
+
`geometry` is `null` above 100,000 coordinate values.
|
|
432
|
+
|
|
433
|
+
**Drawing:** `drawMode: LyraMapDrawingMode = 'none'` arms `line` or `polygon` drawing. The
|
|
434
|
+
controls render as soon as a mode is armed; the session starts once the drawing runtime has loaded
|
|
435
|
+
and the style is ready, and `whenIdle()` covers that load. Pointer
|
|
436
|
+
vertices and the keyboard center/undo/finish/cancel controls share one temporary session.
|
|
437
|
+
`undoDrawing()`, `completeDrawing()`, and `cancelDrawing()` return boolean admission.
|
|
438
|
+
`lr-map-draw-start`, `lr-map-draw-change`, `lr-map-draw-complete`, and `lr-map-draw-cancel` carry
|
|
439
|
+
immutable `LyraMapDrawingSnapshot` data (cancel adds a reason). Completion supplies geometry and
|
|
440
|
+
metrics: length in metres, area in square metres, and a geographic centroid. The 512-vertex cap
|
|
441
|
+
and simple-geometry, polar and antimeridian validation reject unsupported shapes. Persist the
|
|
442
|
+
completed snapshot in application state: temporary drawing resources are not a durable layer.
|
|
443
|
+
`editDrawing(snapshot)` explicitly starts editing a completed snapshot; completion does not
|
|
444
|
+
implicitly reopen it. Before the drawing runtime has loaded it returns `false` without reading the
|
|
445
|
+
snapshot and starts the load; await `whenIdle()` and call it again. Keyboard vertex handles and
|
|
446
|
+
pointer edits update the same session.
|
|
447
|
+
Use `whenIdle()` to await temporary rendering work.
|
|
448
|
+
|
|
449
|
+
While drawing, a dashed rubber band runs from the last vertex to the pointer (and, for a polygon,
|
|
450
|
+
on to the first vertex). A press within 12 CSS pixels of a polygon's first vertex, once it has three
|
|
451
|
+
vertices, completes it as clicking near the start does in common drawing tools. While the map
|
|
452
|
+
canvas has focus, Enter completes the drawing (or an edit) and Backspace removes the last vertex;
|
|
453
|
+
the canvas advertises them through `aria-keyshortcuts`, and the visible buttons remain the
|
|
454
|
+
discoverable path. A drawing or edit session survives a `mapStyle` swap: its temporary resources are
|
|
455
|
+
rebuilt on the new style and a captured vertex drag is released (the `style-change` cancel reason is
|
|
456
|
+
no longer reported). `lr-map-draw-change` fires for every intermediate drag position, so recompute
|
|
457
|
+
derived state on `lr-map-draw-vertex-end` (`LyraMapDrawingVertexEndDetail`, the snapshot plus the
|
|
458
|
+
moved vertex `index`), fired once when a drag that moved the vertex is released and after each
|
|
459
|
+
keyboard vertex move. Setting `drawingMeasurements` to `true` (attribute `drawing-measurements`;
|
|
460
|
+
default `false`) shows
|
|
461
|
+
localized, decorative on-map labels (`drawing-measurement`, with `data-kind` `segment`, `closing`,
|
|
462
|
+
`area` or `length`): every segment length, a polygon's closing segment and its area at the centroid,
|
|
463
|
+
and a line's total length; the same total is written beside the vertex count as `drawing-summary`
|
|
464
|
+
for assistive technology. Lengths are metres or kilometres through `Intl.NumberFormat` in the
|
|
465
|
+
component locale, areas `mapSquareMeters`/`mapSquareKilometers`. The temporary drawing, its rubber
|
|
466
|
+
band and the vertex handles use `--lr-map-drawing-color` (default: the brand accent), re-read after
|
|
467
|
+
a theme change.
|
|
468
|
+
|
|
469
|
+
**Anchored content:** `anchorLngLat` is the sole declarative open request for the `anchor` slot.
|
|
470
|
+
Its first coordinate loads anchor placement; placement, already asynchronous, follows that load.
|
|
471
|
+
`anchorBoundary?: LyraMapAnchorBoundary` accepts connected same-document elements (one element or
|
|
472
|
+
a dense array of at most 32). `anchorSafeArea?: LyraMapAnchorSafeArea` adds nonnegative finite
|
|
473
|
+
logical CSS-pixel edges (`blockStart`, `inlineEnd`, `blockEnd`, `inlineStart`); omitted edges are
|
|
474
|
+
zero, explicitly invalid edges fail closed. Placement intersects boundaries with the allocation
|
|
475
|
+
and retains its 8px padding. `anchorClosable = false` leaves content passive; enabling it adds a
|
|
476
|
+
close button and nonmodal Escape handling. `focusAnchor()` explicitly focuses eligible visible
|
|
477
|
+
content synchronously; `closeAnchor()` closes a currently visible anchor. Both return booleans.
|
|
478
|
+
`lr-map-anchor-close` reports `api`, `close-button`, or `escape`; focus return respects ownership.
|
|
479
|
+
The close button is exposed as `anchor-close`.
|
|
480
|
+
|
|
481
|
+
**Initialization and image export:** `initialization: LyraMapInitialization = 'visible'` defers
|
|
482
|
+
construction until visible; `idle` schedules idle construction and `eager` requests immediate
|
|
483
|
+
construction. `interaction` waits for the first input on the element (pointer press, touch, wheel,
|
|
484
|
+
key press or click) and shows the localized `initialization-activate` button over the placeholder,
|
|
485
|
+
so keyboard and screen-reader users can start the map; focus moves to the map canvas when the map
|
|
486
|
+
was started from that button. `initializationDelay?: number` (attribute `initialization-delay`,
|
|
487
|
+
milliseconds) also starts an `interaction` map that long after it connected; leave it unset to wait
|
|
488
|
+
for input only. Until then `map` is undefined and `whenStyleReady()`/`whenIdle()` wait; camera
|
|
489
|
+
commands and fits queue as usual. Deferred UI exposes `initialization-placeholder` and
|
|
490
|
+
`initialization-control`.
|
|
491
|
+
Static `LyraMap.preload(engine)` loads the engine without constructing a map.
|
|
492
|
+
`exportImage(options?: LyraMapImageExportOptions): Promise<Blob>` captures the current native
|
|
493
|
+
frame with `type` of `image/png` (default), `image/jpeg`, or `image/webp`. Attribution is included
|
|
494
|
+
by default, including admitted source credits and custom attribution; preserve required credits
|
|
495
|
+
when sharing an export. DOM markers, popups and slotted overlays are excluded. Export waits for
|
|
496
|
+
current-frame readiness; handle rejection as `LyraMapImageExportError` with a sanitized `code`.
|
|
497
|
+
`lr-map-export-error` carries `LyraMapImageExportErrorDetail`, never raw renderer errors. The first
|
|
498
|
+
call loads the export runtime; options are still admitted when the call is made, and a runtime that
|
|
499
|
+
cannot load rejects with `capture-failed`.
|
|
500
|
+
|
|
59
501
|
**Properties:**
|
|
60
502
|
|
|
61
503
|
- `engine: LyraMapEngine = 'modular'` — selects the optional `@aceshooting/lyra-map` companion.
|
|
@@ -65,7 +507,8 @@ modes use the same expression semantics at initial render and after a theme chan
|
|
|
65
507
|
engine payload and is a separate opt-in from the modular default.
|
|
66
508
|
- `center: [number, number] = [0, 0]`
|
|
67
509
|
- `zoom: number = 2` — `center` and `zoom` are the declarative camera. Assigning either moves the
|
|
68
|
-
map without emitting anything. When the camera settles after a user gesture
|
|
510
|
+
map without emitting anything. When the camera settles after a user gesture, `fitBounds()` or a
|
|
511
|
+
camera command (`flyTo()`/`easeTo()`/`jumpTo()`), the
|
|
69
512
|
element writes that camera into both and reports it through `lr-map-view-change`, so its next
|
|
70
513
|
update never resets it, and a later, different assignment still moves the map. Assigning a value
|
|
71
514
|
the map already shows moves nothing, so echoing a reported camera back, however late, never stops
|
|
@@ -74,8 +517,31 @@ modes use the same expression semantics at initial render and after a theme chan
|
|
|
74
517
|
did not assign is not left wherever the interrupted movement stopped; with nothing in flight,
|
|
75
518
|
only the assigned axis moves. Because both track the settled camera, a map rebuilt after a
|
|
76
519
|
disconnect/reconnect opens at the last settled camera rather than the originally declared one.
|
|
77
|
-
|
|
78
|
-
a
|
|
520
|
+
`center` is compared by value against the last value assigned: a new array holding the same two
|
|
521
|
+
numbers (a parent re-render rebuilding its arrays) is not a new request, even after a gesture,
|
|
522
|
+
fit or camera command, so it never pulls the map back over the user's pan. Assign a different
|
|
523
|
+
value to move the map, or call `jumpTo({ center })` to re-centre on the value already assigned.
|
|
524
|
+
**Behavior change:** an equal re-assignment used to re-centre the map after a pan.
|
|
525
|
+
- `minZoom?: number` (attribute `min-zoom`) and `maxZoom?: number` (attribute `max-zoom`) — camera
|
|
526
|
+
zoom limits in `[0, 24]`, forwarded to the engine at construction and whenever they change.
|
|
527
|
+
Unset keeps the engine's `[0, 22]` (`maxZoom` defaults to `minZoom` when that is above 22).
|
|
528
|
+
Gestures, `zoom`, the URL `hash`, `flyTo()`/`easeTo()`/`jumpTo()`, and the `maxZoom` of
|
|
529
|
+
`fitBounds()`/`fitToData()` are all clamped into them. Raising `minZoom` above the camera (or
|
|
530
|
+
lowering `maxZoom` below it) moves the camera inside and writes the clamped value into `zoom`,
|
|
531
|
+
without an `lr-map-view-change`. A non-finite value counts as unset; an explicit
|
|
532
|
+
`minZoom > maxZoom` pair is ignored as a whole, with a development-mode warning.
|
|
533
|
+
|
|
534
|
+
```js
|
|
535
|
+
mapEl.minZoom = 5; // country view at most
|
|
536
|
+
mapEl.maxZoom = 21; // building level at least
|
|
537
|
+
```
|
|
538
|
+
- `cameraPadding?: LyraMapPadding` (attribute: false) — screen pixels (`top`, `right`, `bottom`,
|
|
539
|
+
`left`; an omitted, negative or non-finite side is `0`) the camera is measured inside, applied to
|
|
540
|
+
the engine persistently. Every fit (`fitBounds()`, `fitToData()`) frames inside it, and the
|
|
541
|
+
`bounds` that `lr-map-view-change` and `lr-map-move` report is the visible box inside it, so a
|
|
542
|
+
panel or toolbar covering part of the map does not hide what the map frames. Changing it keeps
|
|
543
|
+
the geographic centre fixed, shifts the picture and is not reported as a camera change. Sides are
|
|
544
|
+
physical, not logical.
|
|
79
545
|
- `renderWorldCopies?: boolean` (attribute: false) — forwarded to MapLibre when its map is
|
|
80
546
|
constructed. Leave it unset to preserve MapLibre's own current default; set `false` before
|
|
81
547
|
construction to stop repeating the world horizontally. This is a construction-time option, so a
|
|
@@ -87,7 +553,10 @@ modes use the same expression semantics at initial render and after a theme chan
|
|
|
87
553
|
is selected implicitly: an unset, empty, or whitespace-only value renders the localized
|
|
88
554
|
style-required failure and makes no tile/style request. Assign a hosted vector/raster style from
|
|
89
555
|
a provider whose terms fit your application, or an explicitly network-silent style for local
|
|
90
|
-
geometry.
|
|
556
|
+
geometry. `LYRA_MAP_EMPTY_STYLE` (exported from `@aceshooting/lyra-ui` and the map module) is that
|
|
557
|
+
style for the common case: a frozen `{ version: 8, sources: {}, layers: [] }` with no basemap, so
|
|
558
|
+
a choropleth, `dataLayers` and markers draw on a blank canvas and no tile request is made. Assign
|
|
559
|
+
it as is (`map.mapStyle = LYRA_MAP_EMPTY_STYLE`); build a new style object to add to it.
|
|
91
560
|
- `legendGradient: readonly (readonly [number, string])[] = []` (attribute: false, type
|
|
92
561
|
`LyraMapLegendGradientStop[]`) — renders the legend as a **continuous** gradient bar with endpoint
|
|
93
562
|
captions instead of (or alongside) the discrete `legend` swatches, which is the standard key for a
|
|
@@ -108,6 +577,29 @@ modes use the same expression semantics at initial render and after a theme chan
|
|
|
108
577
|
`legendGradientHiLabel: string | null = null` (attribute `legend-gradient-hi-label`) — override
|
|
109
578
|
the endpoint captions, which otherwise default to the lowest/highest stop value in the component's
|
|
110
579
|
own locale-aware numeric formatting
|
|
580
|
+
- `legendGradientTicks: readonly (number | LyraMapLegendGradientTick)[]` (attribute: false; the
|
|
581
|
+
getter returns the frozen `LyraMapLegendGradientTick { value: number; label?: string }` list) —
|
|
582
|
+
labelled marks under the `legendGradient` bar, each at its value's true position on the ramp
|
|
583
|
+
(the bar and its marks share one track, so a logarithmic ramp keeps them at the data positions).
|
|
584
|
+
A bare number is a mark labelled with the locale-formatted value; a `label` is caller data and is
|
|
585
|
+
rendered verbatim. At most 16 marks are kept, sorted ascending and de-duplicated; a mark outside
|
|
586
|
+
the ramp's lowest and highest stop, or a non-finite one, is not drawn, and without a gradient
|
|
587
|
+
there is nothing to mark. Marks are positioned from the inline start, so they mirror with the
|
|
588
|
+
flipped bar under RTL. Parts `legend-ticks` and `legend-tick`.
|
|
589
|
+
- `choroplethLegend: boolean = false` (attribute `choropleth-legend`, reflected) — derives the key
|
|
590
|
+
from `choropleth` instead of a hand-built copy that can drift. A `'step'` ramp renders one swatch
|
|
591
|
+
row per band in `legend-derived`: `< 20`, `20 – 50`, `≥ 50` (numbers formatted for
|
|
592
|
+
`effectiveLocale`, each range wrapped in bidi isolates so it keeps its order in a right-to-left
|
|
593
|
+
legend); an explicit `stepBaseColor` becomes its own `< first` band, otherwise the first band
|
|
594
|
+
absorbs the values below the first threshold exactly as the fill does, and a lone stop without a
|
|
595
|
+
base colour describes nothing so it adds no band. A `'linear'` or `'logarithmic'` ramp renders the
|
|
596
|
+
gradient bar from `choropleth.stops` (a logarithmic one sampled as the fill is) with the interior
|
|
597
|
+
stop values as ticks, because a continuous ramp has no bands to list. When `choropleth.noData`
|
|
598
|
+
is set, a hatched swatch (`data-pattern="diagonal"`, the non-colour cue) captioned with its
|
|
599
|
+
`label`, or the localized "No data", ends the derived rows. Authored input wins where it overlaps:
|
|
600
|
+
a non-empty `legendGradient` replaces the derived bar, an assigned `legendGradientTicks` (even
|
|
601
|
+
`[]`) replaces the derived ticks, and `legend` rows render ahead of the derived rows. Derived rows
|
|
602
|
+
are not interactive. Default off, so an unset map renders what it rendered before.
|
|
111
603
|
- `legend: readonly LyraMapLegendEntry[] = []` (attribute: false) — immutable defensive snapshots
|
|
112
604
|
of `LyraMapLegendEntry { readonly color: string; readonly label: string; readonly pattern:
|
|
113
605
|
LyraMapLegendPattern }`, where `LyraMapLegendPattern` is `'solid' | 'diagonal' | 'dots' |
|
|
@@ -217,6 +709,18 @@ string; geojson: GeoJSON.FeatureCollection; field: string; stops: [number, strin
|
|
|
217
709
|
colour, so a legend whose first band starts at the data minimum needs no extra configuration.
|
|
218
710
|
Stop colors and `stepBaseColor` accept CSS custom-property references; Lyra resolves them from
|
|
219
711
|
the live host cascade before passing the expression to MapLibre's WebGL renderer.
|
|
712
|
+
`noData?: LyraMapChoroplethNoData { color?: string; strokeColor?: string; label?: string }`
|
|
713
|
+
says how features without a usable value look and read, instead of splitting the data into a
|
|
714
|
+
second layer. A feature has no value when its `field` property is missing, `null` or not a number;
|
|
715
|
+
without `noData` such a feature is not painted by the choropleth at all (the expression cannot
|
|
716
|
+
evaluate). With it, `fill-color` becomes `['case', <is a number>, <ramp>, <noData color>]` under
|
|
717
|
+
every interpolation, `color` defaults to the neutral data tone and takes the same CSS colours and
|
|
718
|
+
`var(--lr-…)` references as `stops`, and the colour follows live theme changes. `strokeColor`
|
|
719
|
+
adds an outline drawn on no-data features only (other features keep the default outline, their own
|
|
720
|
+
fill colour); omitted, nothing distinct is drawn. `label` is caller data, trimmed and bounded to
|
|
721
|
+
256 characters, shown verbatim as the legend caption under `choroplethLegend` (default: the
|
|
722
|
+
localized "No data"). `noData: {}` accepts every default. A click on such a feature reports
|
|
723
|
+
`noData: true` in the `lr-map-click` detail.
|
|
220
724
|
- `markers: LyraMapMarker[] = []` (attribute: false) — `LyraMapMarker { id?: string; lngLat:
|
|
221
725
|
[number, number]; color?: string; label?: string; unsafeHtml?: string }`; an explicit `id` is
|
|
222
726
|
trimmed and must be nonempty, and the first successfully admitted marker for an explicit ID wins.
|
|
@@ -245,7 +749,9 @@ string; geojson: GeoJSON.FeatureCollection; field: string; stops: [number, strin
|
|
|
245
749
|
Enter, and Space emit `lr-map-marker-activate`; Space suppresses its page-scroll default while
|
|
246
750
|
preserving MapLibre's popup toggle. A popup-bearing marker additionally exposes
|
|
247
751
|
`aria-haspopup="dialog"`, `aria-controls`, and explicit `aria-expanded`.
|
|
248
|
-
- `dataLayers:
|
|
752
|
+
- `dataLayers: readonly LyraMapDataLayer[] = []` (attribute: false) accepts GeoJSON, vector,
|
|
753
|
+
raster, image and canvas entries. The external-source forms are described under
|
|
754
|
+
**Readiness and declarative resources** above. The GeoJSON form is
|
|
249
755
|
`LyraMapGeoJsonDataLayer { sourceId: string; geojson: GeoJSON.Feature |
|
|
250
756
|
GeoJSON.FeatureCollection; tone?: 'accent' | 'success' | 'warning' |
|
|
251
757
|
'danger' | 'neutral'; color?: string; strokeColor?: string; line?: LyraMapLineOptions;
|
|
@@ -253,7 +759,7 @@ point?: LyraMapPointOptions; kind?: LyraMapDataLayerKind;
|
|
|
253
759
|
heatmap?: LyraMapHeatmapOptions; cluster?: LyraMapClusterOptions }`. `sourceId` is trimmed and must be nonempty; the first layer for a
|
|
254
760
|
`sourceId` that is successfully admitted wins. Only the first 100 entries are inspected; blank,
|
|
255
761
|
malformed, and later duplicate records are
|
|
256
|
-
ignored without reserving an identity for a valid later sibling. Each retained entry adds one
|
|
762
|
+
ignored without reserving an identity for a valid later sibling. Each retained GeoJSON entry adds one
|
|
257
763
|
GeoJSON source plus three geometry-filtered layers
|
|
258
764
|
(fill, line, and circle, so a mixed `FeatureCollection` renders correctly), colored from the
|
|
259
765
|
matching `--lr-color-*` token (`tone` defaults to `'accent'` → `--lr-color-brand`).
|
|
@@ -296,7 +802,7 @@ heatmap?: LyraMapHeatmapOptions; cluster?: LyraMapClusterOptions }`. `sourceId`
|
|
|
296
802
|
|
|
297
803
|
`cluster?: LyraMapClusterOptions { radius?: number; maxZoom?: number; radiusSteps?: [number,
|
|
298
804
|
number][]; colorSteps?: [number, string][]; strokeColor?: string; countFont?: string[]; countColor?: string;
|
|
299
|
-
countHaloColor?: string; countHaloWidth?: number }` turns the entry's source into a
|
|
805
|
+
countHaloColor?: string; countHaloWidth?: number; zoomOnClick?: boolean }` turns the entry's source into a
|
|
300
806
|
natively clustered one — `cluster`/`clusterRadius` (default 50)/`clusterMaxZoom` (default 14) on
|
|
301
807
|
the source, plus a `${sourceId}-cluster` circle filtered on `has('point_count')`, a
|
|
302
808
|
`${sourceId}-cluster-count` label, and a `${sourceId}-circle` layer for the points that stayed
|
|
@@ -323,6 +829,13 @@ countHaloColor?: string; countHaloWidth?: number }` turns the entry's source int
|
|
|
323
829
|
explicit width of 0 disables the outline. Both count colors accept CSS colors or `var(--lr-…)`
|
|
324
830
|
references resolved against the host on theme repaint. Omitting or removing these options
|
|
325
831
|
restores the previous on-tone label and halo-free default.
|
|
832
|
+
`zoomOnClick` (default `false`) eases the camera into a clicked cluster: after `lr-map-click`
|
|
833
|
+
fires with `origin: 'cluster'`, the element asks the cluster's source for the zoom at which it
|
|
834
|
+
breaks apart (promise or callback peers both work) and calls `easeTo({ center: <cluster>, zoom })`,
|
|
835
|
+
so reduced motion, the write-back into `center`/`zoom` and `lr-map-view-change` with
|
|
836
|
+
`source: 'command'` all apply, and the zoom is clamped to the camera range. A later cluster click
|
|
837
|
+
supersedes an earlier lookup still pending; a peer without the lookup, or a cluster that has
|
|
838
|
+
vanished, leaves the camera alone. It is not cancelable from the click event.
|
|
326
839
|
Cluster options are baked into the source at creation time by MapLibre and have no setter, so
|
|
327
840
|
changing them (or `kind`) rebuilds that one entry's source and layers; every other update still
|
|
328
841
|
reconciles in place.
|
|
@@ -458,12 +971,65 @@ intensity?: LyraMapHeatmapZoomValue; opacity?: number }`, where `LyraMapHeatmapZ
|
|
|
458
971
|
escape hatch: constraining the camera can wedge maplibre-gl at a sub-1 fractional zoom in a wide
|
|
459
972
|
container, leaving `getZoom()` returning `null` permanently, every frame throwing from inside the
|
|
460
973
|
peer's own matrix math, and the canvas never painting again — a blank map, with nothing thrown at
|
|
461
|
-
the call site to attribute it to. This property applies the same call, then reads the camera back
|
|
462
|
-
|
|
974
|
+
the call site to attribute it to. This property applies the same call, then reads the camera back.
|
|
975
|
+
A camera below zoom 1, fractional zoom included, is tolerated: a box the peer rejects there is
|
|
976
|
+
retried once from zoom 1 and the zoom and centre that were showing are restored, so the limit
|
|
977
|
+
applies to a map that currently shows the whole world and no warning is issued. A box that still
|
|
978
|
+
cannot be applied reverts (restoring zoom and centre), so the worst case is an
|
|
463
979
|
unconstrained map plus a dev-mode warning. The defensive camera snapshots are inside the same
|
|
464
980
|
failure boundary, so a peer whose damaged transform already throws from `getZoom()` or
|
|
465
981
|
`getCenter()` is also reduced to an unconstrained map instead of leaking through Lit's update.
|
|
466
982
|
A malformed box is rejected rather than clamped
|
|
983
|
+
- `controls?: Readonly<LyraMapControls>` (attribute: false) — `LyraMapControls { navigation?: boolean |
|
|
984
|
+
LyraMapNavigationControlOptions; scale?: boolean | LyraMapScaleControlOptions;
|
|
985
|
+
geolocate?: boolean | LyraMapGeolocateControlOptions;
|
|
986
|
+
attribution?: boolean | LyraMapAttributionControlOptions }`, with
|
|
987
|
+
`LyraMapNavigationControlOptions { position?: LyraMapControlPosition }`,
|
|
988
|
+
`LyraMapScaleControlOptions { position?: LyraMapControlPosition; unit?: LyraMapScaleUnit }`,
|
|
989
|
+
`LyraMapControlPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'` and
|
|
990
|
+
`LyraMapScaleUnit = 'metric' | 'imperial'`. The element adds the engine's standard controls once
|
|
991
|
+
the map exists, moves one whose corner changes, replaces one whose other options change and removes one that
|
|
992
|
+
is dropped, so an application no longer imports control classes and calls `map.addControl()`.
|
|
993
|
+
`true` takes the defaults (navigation `'top-right'`, scale `'bottom-left'` and `'metric'`); an
|
|
994
|
+
unknown navigation/scale position or unit falls back to its default. Malformed geolocate or
|
|
995
|
+
attribution options are rejected with localized feedback. The control code comes from the selected
|
|
996
|
+
engine (`maplibre-gl`, or the companion's granular control entries). Requested controls load
|
|
997
|
+
on demand; unavailable controls show localized feedback while the map remains usable. Geolocation
|
|
998
|
+
starts only on user activation. Attribution is enabled by default; set `attribution: false` to
|
|
999
|
+
disable it. Attribution options accept `position`, `compact`, and `customAttribution` as a string,
|
|
1000
|
+
`LyraMapAttributionLink { readonly label: string; readonly url: string }`, or a readonly array of
|
|
1001
|
+
either. Labels are escaped text; links open in a new tab with `rel="noopener noreferrer"`.
|
|
1002
|
+
Link URLs must be absolute HTTP(S), no longer than 2,048 characters, with no credentials or
|
|
1003
|
+
control characters. At most 32 credits and 16 KiB of label/URL text are accepted, with each label
|
|
1004
|
+
limited to 4,096 characters. Admission snapshots own data properties without invoking accessors.
|
|
1005
|
+
An invalid item rejects the whole custom option and shows localized feedback while retaining
|
|
1006
|
+
provider credits. Image exports include link labels as text alongside provider credits, without
|
|
1007
|
+
the link URLs or markup. For example:
|
|
1008
|
+
|
|
1009
|
+
```js
|
|
1010
|
+
mapElement.controls = {
|
|
1011
|
+
navigation: { position: 'bottom-left' },
|
|
1012
|
+
scale: { position: 'bottom-left' },
|
|
1013
|
+
geolocate: { position: 'bottom-left' },
|
|
1014
|
+
attribution: { position: 'bottom-left', customAttribution: [
|
|
1015
|
+
'Survey team', { label: 'Data contributors', url: 'https://example.com/credits' }
|
|
1016
|
+
] }
|
|
1017
|
+
};
|
|
1018
|
+
```
|
|
1019
|
+
|
|
1020
|
+
Within each corner the visual and keyboard order is navigation, scale, geolocate, attribution,
|
|
1021
|
+
including when constructors load in a different order or one fails. A subset keeps that relative
|
|
1022
|
+
order. Changing only a corner moves the existing controls and retains focused buttons. Corners
|
|
1023
|
+
continue to follow text direction under RTL. Geolocation is never activated by reconfiguration
|
|
1024
|
+
or reconnect.
|
|
1025
|
+
Button names come from `zoomIn`, `zoomOut` and `mapResetNorth`
|
|
1026
|
+
and are re-applied whenever `lang`, `locale` or `strings` change, so they follow a live language
|
|
1027
|
+
switch. Controls survive a `mapStyle` swap and are dropped with the map on disconnect, then added
|
|
1028
|
+
again to the next one. Parts `navigation`, `zoom-in`, `zoom-out`, `compass`, `scale`.
|
|
1029
|
+
- `anchorLngLat?: readonly [number, number] | null` (attribute: false) — where content in the
|
|
1030
|
+
`anchor` slot sits. Pair it with the `lngLat` of an `lr-map-click` to show a clicked feature's
|
|
1031
|
+
details, replacing a hand-positioned popup. The first coordinate loads anchor placement on
|
|
1032
|
+
demand; the anchor stays hidden until it has been placed. See **Slots**.
|
|
467
1033
|
|
|
468
1034
|
**Choropleth and `dataLayers` updates are diffed before they reach the peer.** `setData()`
|
|
469
1035
|
unconditionally re-tiles and repaints an entire source, which is invisible on a static map and
|
|
@@ -503,8 +1069,10 @@ payload beside the map.
|
|
|
503
1069
|
`LyraMapPointRadiusInterpolation`, `LyraMapPointIcon`, `LyraMapPointIconMode`,
|
|
504
1070
|
`LyraMapPointIconLineCap`, `LyraMapPointIconLineJoin`, `LyraMapMarker`, `LyraMapMarkerActivationDetail`,
|
|
505
1071
|
`LyraMapMarkerActivationSource`, `LyraMapLegendToggleDetail`, `LyraMapLegendPanelToggleDetail`,
|
|
506
|
-
`
|
|
507
|
-
|
|
1072
|
+
`LyraMapChoroplethNoData`, `LyraMapLegendGradientTick`, `LyraMapControls`,
|
|
1073
|
+
`LyraMapNavigationControlOptions`, `LyraMapScaleControlOptions`, `LyraMapControlPosition`,
|
|
1074
|
+
`LyraMapScaleUnit`, `LyraMapStyleSpecification`, `LyraMapEngine`, `LyraMapFeatureRequirements`,
|
|
1075
|
+
`LyraMapSourceDataDiff`, the `LYRA_MAP_EMPTY_STYLE` constant, and `LyraMapInstance`.
|
|
508
1076
|
|
|
509
1077
|
**Getters:** `map: LyraMapInstance | undefined` → the underlying runtime `maplibregl.Map`, exposed
|
|
510
1078
|
through the peer-neutral `getCanvas()`, `getCenter()`, `getZoom()`, `setCenter()`, `setZoom()`, and
|
|
@@ -523,11 +1091,10 @@ direct engine mutation that must be visible without further interaction (a scree
|
|
|
523
1091
|
export), call the narrowed engine's `map.triggerRepaint()` once. `lr-map` does not force a
|
|
524
1092
|
repaint after every idle, because that would re-render forever.
|
|
525
1093
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
and `dataLayers` layers described below; it does not query arbitrary layer IDs from `mapStyle`.
|
|
1094
|
+
For style-owned layers, set `interactiveBasemapLayers` to opt their IDs into the component's
|
|
1095
|
+
hit routing and `lr-map-click` events. For queries outside that routing, narrow `.map` to the
|
|
1096
|
+
selected engine's type and call `queryRenderedFeatures(point, { layers: [...] })`; `point` is a
|
|
1097
|
+
screen position available from `project([longitude, latitude])`.
|
|
531
1098
|
|
|
532
1099
|
`markersTruncated: boolean` (read-only) is true when authored marker entries exceed the 2,000-entry
|
|
533
1100
|
inspection ceiling; it does not count malformed rows skipped within that prefix.
|
|
@@ -571,7 +1138,8 @@ settles, the element writes it into `center`/`zoom` and emits `lr-map-view-chang
|
|
|
571
1138
|
both text directions, because the map's projected space is physical. A negative or non-finite
|
|
572
1139
|
side counts as `0`. Defaults to `0`.
|
|
573
1140
|
- `options.maxZoom` — the highest zoom the fit may reach, so one marker or a tight cluster does not
|
|
574
|
-
zoom to the street. Clamped into `[0, 22]
|
|
1141
|
+
zoom to the street. Clamped into the zoom limits (`minZoom`/`maxZoom`, `[0, 22]` by default) when
|
|
1142
|
+
the fit runs; a non-finite value sets no ceiling beyond `maxZoom`.
|
|
575
1143
|
- `options.animate` — defaults to `true`. The camera never animates under
|
|
576
1144
|
`prefers-reduced-motion: reduce`.
|
|
577
1145
|
- Latitudes lie in `[-90, 90]`, with `south <= north`, and longitudes in `[-180, 180]`. A box
|
|
@@ -593,6 +1161,49 @@ settles, the element writes it into `center`/`zoom` and emits `lr-map-view-chang
|
|
|
593
1161
|
map), MapLibre leaves the camera where it is and logs its own warning: the call still returns
|
|
594
1162
|
`true`, and no `lr-map-view-change` fires.
|
|
595
1163
|
|
|
1164
|
+
`fitToData(options?: LyraMapFitBoundsOptions): boolean` frames everything the map draws: `markers`,
|
|
1165
|
+
every `dataLayers` source and the `choropleth`, measured from the geometry the element has already
|
|
1166
|
+
admitted (not from your raw values), so you no longer compute a box yourself. It is `fitBounds()` of
|
|
1167
|
+
the union of their extents, with the same options, queueing, `cameraPadding`, write-back and
|
|
1168
|
+
`source: 'fit'`. `maxZoom` defaults to `16`, so one marker does not zoom to the street; pass it
|
|
1169
|
+
(a non-finite value for no ceiling) to change that. The extent is a plain west-to-east span, so data
|
|
1170
|
+
on both sides of the antimeridian frames the long way round. Returns `false`, doing nothing, when
|
|
1171
|
+
nothing with geometry is drawn. Assignments to `markers`/`dataLayers`/`choropleth` made in the same
|
|
1172
|
+
tick are already counted.
|
|
1173
|
+
|
|
1174
|
+
`fitBounds()`, `fitToData()` and the camera commands below are not interrupted by a `center` or
|
|
1175
|
+
`zoom` assignment made in the same tick: they run after the update that pushes that assignment, so
|
|
1176
|
+
the order you wrote them in is the order they take effect (`el.center = x; el.fitBounds(box)` no
|
|
1177
|
+
longer needs an `await el.updateComplete` in between). Their return value is `true` once accepted
|
|
1178
|
+
or deferred.
|
|
1179
|
+
|
|
1180
|
+
`flyTo(options)`, `easeTo(options)` and `jumpTo(options)` (`LyraMapCameraOptions { center?, zoom?,
|
|
1181
|
+
bearing?, pitch?, duration? }`; each returns `boolean`) move the camera with the engine's own
|
|
1182
|
+
commands, a curved flight, an eased animation and an immediate jump respectively. Use them instead of
|
|
1183
|
+
calling the same methods through `map`, which the element neither knows about nor reports.
|
|
1184
|
+
|
|
1185
|
+
- Reduced motion: under `prefers-reduced-motion: reduce` (or a `data-lr-motion="reduce"` scope)
|
|
1186
|
+
`flyTo()` and `easeTo()` jump.
|
|
1187
|
+
- Write-back: once the camera settles, the element writes it into `center`/`zoom` and emits
|
|
1188
|
+
`lr-map-view-change` with `source: 'command'`; it never moves the camera a second time to apply
|
|
1189
|
+
what it just wrote. `jumpTo()` is the explicit re-centre (an equal `center` re-assignment is a
|
|
1190
|
+
no-op).
|
|
1191
|
+
- Every option is optional and an unusable one is ignored: `center` must be a finite
|
|
1192
|
+
`[longitude, latitude]` (clamped into range), `zoom` is clamped into the zoom limits
|
|
1193
|
+
(`minZoom`/`maxZoom`, `[0, 22]` by default), `pitch` into
|
|
1194
|
+
`[0, 85]`, and a negative or non-finite `duration` means the engine's default. With nothing
|
|
1195
|
+
usable the call returns `false` (and warns in development) without moving anything.
|
|
1196
|
+
- Callable before the map exists: the most recent request (or `fitBounds()` call) is queued and
|
|
1197
|
+
applied without animation right after construction, unless `center` or `zoom` has been given a
|
|
1198
|
+
different value since. Returns `true` once the move is running or queued, `false` when the loaded
|
|
1199
|
+
engine has no such command.
|
|
1200
|
+
|
|
1201
|
+
`project(lngLat)` returns the `[x, y]` CSS pixel position of a `[longitude, latitude]` in the map's
|
|
1202
|
+
container, and `unproject([x, y])` the inverse, so an overlay can sit on a coordinate; both read the
|
|
1203
|
+
camera as it is now and return `undefined` before the map exists, for a non-finite input, or when
|
|
1204
|
+
the engine cannot project. Pair `project()` with `lr-map-move` to keep an overlay glued to a moving
|
|
1205
|
+
map.
|
|
1206
|
+
|
|
596
1207
|
There is deliberately no declarative `bounds` property. `center` and `zoom` already describe the
|
|
597
1208
|
camera; a third camera input would need a precedence rule against them, and a framework that
|
|
598
1209
|
rebuilds its arrays on every render would refit on every render, pulling the camera away from a user
|
|
@@ -609,7 +1220,7 @@ import type {
|
|
|
609
1220
|
let camera: LyraMapViewChangeDetail | undefined;
|
|
610
1221
|
const mapEl = document.querySelector('lr-map') as LyraMap;
|
|
611
1222
|
mapEl.addEventListener('lr-map-view-change', (event) => {
|
|
612
|
-
// Keep the host's own camera state in step: { center, zoom, source }.
|
|
1223
|
+
// Keep the host's own camera state in step: { center, zoom, source, bounds }.
|
|
613
1224
|
camera = event.detail;
|
|
614
1225
|
});
|
|
615
1226
|
|
|
@@ -624,6 +1235,19 @@ function showMarkers(markers: LyraMapMarker[]): void {
|
|
|
624
1235
|
];
|
|
625
1236
|
mapEl.fitBounds(box, { padding: 48, maxZoom: 14 });
|
|
626
1237
|
}
|
|
1238
|
+
|
|
1239
|
+
// The same, without computing the box, inside a toolbar that covers the left 320px:
|
|
1240
|
+
mapEl.cameraPadding = { left: 320 };
|
|
1241
|
+
mapEl.fitToData({ maxZoom: 14 });
|
|
1242
|
+
|
|
1243
|
+
// Camera commands report as `source: 'command'` and write back into center/zoom:
|
|
1244
|
+
mapEl.flyTo({ center: [2.35, 48.85], zoom: 11 });
|
|
1245
|
+
|
|
1246
|
+
// Keep an overlay on a coordinate while the map moves:
|
|
1247
|
+
mapEl.addEventListener('lr-map-move', () => {
|
|
1248
|
+
const point = mapEl.project([2.35, 48.85]);
|
|
1249
|
+
if (point) overlay.style.translate = `${point[0]}px ${point[1]}px`;
|
|
1250
|
+
});
|
|
627
1251
|
```
|
|
628
1252
|
|
|
629
1253
|
**Events:** `lr-map-load` (fired once, after the underlying map's own `'load'`),
|
|
@@ -649,7 +1273,9 @@ Also `lr-map-marker-activate` (non-cancelable; frozen `LyraMapMarkerActivationDe
|
|
|
649
1273
|
marker, source }`; `id` is the trimmed explicit identity or `undefined`, `marker` is the accepted
|
|
650
1274
|
declarative snapshot, and `source` is `'pointer' | 'keyboard'`), and `lr-map-click`
|
|
651
1275
|
(frozen `detail: { readonly lngLat: readonly [lng, lat], readonly feature?, readonly origin?,
|
|
652
|
-
readonly sourceId? }`; the tuple and any hit GeoJSON feature are detached and
|
|
1276
|
+
readonly sourceId?, readonly noData? }`; the tuple and any hit GeoJSON feature are detached and
|
|
1277
|
+
recursively frozen). `noData` is `true` only for a choropleth hit whose `field` value is missing,
|
|
1278
|
+
`null` or not a number while `choropleth.noData` is configured, and is absent otherwise.
|
|
653
1279
|
`feature` resolves against the choropleth fill layer **and** every applied `dataLayers`
|
|
654
1280
|
fill/line/circle/cluster layer, topmost first — so a shape painted through `dataLayers` is
|
|
655
1281
|
identifiable instead of being indistinguishable from empty space. `origin` is `'choropleth'`,
|
|
@@ -657,24 +1283,71 @@ identifiable instead of being indistinguishable from empty space. `origin` is `'
|
|
|
657
1283
|
data-layer or cluster hit; both are `undefined` whenever `feature` is. A cluster hit is reported
|
|
658
1284
|
separately because it is a synthetic aggregate rather than one of your features: its useful payload
|
|
659
1285
|
is MapLibre's `point_count`/`point_count_abbreviated`/`cluster_id` properties, which is what a
|
|
660
|
-
zoom-to-cluster handler reads
|
|
1286
|
+
zoom-to-cluster handler reads (or set `cluster.zoomOnClick` and let the element ease into it).
|
|
1287
|
+
The count label is deliberately not hit-tested (it sits exactly on
|
|
661
1288
|
the circle already queried and would only make the label the topmost hit), and a `kind: 'heatmap'`
|
|
662
1289
|
layer is never queried at all — MapLibre returns no features for a rendered density surface.
|
|
663
|
-
Also `lr-map-view-change` (non-cancelable; frozen `LyraMapViewChangeDetail { center, zoom, source
|
|
664
|
-
`source` being `LyraMapViewChangeSource = 'user' | 'fit'`), fired once each
|
|
665
|
-
after a user gesture (drag, wheel, touch, keyboard, Shift+drag box zoom, or
|
|
666
|
-
navigation button)
|
|
667
|
-
|
|
1290
|
+
Also `lr-map-view-change` (non-cancelable; frozen `LyraMapViewChangeDetail { center, zoom, source,
|
|
1291
|
+
bounds? }`, `source` being `LyraMapViewChangeSource = 'user' | 'fit' | 'command'`), fired once each
|
|
1292
|
+
time the camera settles after a user gesture (drag, wheel, touch, keyboard, Shift+drag box zoom, or
|
|
1293
|
+
a standard peer navigation button), a `fitBounds()`/`fitToData()` call (`'fit'`), or a
|
|
1294
|
+
`flyTo()`/`easeTo()`/`jumpTo()` call (`'command'`). `center` is `[longitude, latitude]` with the
|
|
1295
|
+
longitude wrapped into `[-180, 180]`. `bounds` is the visible `[[west, south], [east, north]]` box
|
|
1296
|
+
inside `cameraPadding` (`west` within `[-180, 180]`, `east` possibly past 180 across the antimeridian,
|
|
1297
|
+
so `fitBounds()` accepts it back); it is absent when the engine cannot report bounds. The element has already written the camera into `center` and `zoom`
|
|
668
1298
|
when it fires, so a host that mirrors camera state assigns the detail back, at any later time,
|
|
669
1299
|
without moving the map. Assigning `center`/`zoom` reconciles without emitting it, so a controlled
|
|
670
1300
|
host cannot loop, and camera moves made directly through `map` are not reported — which is why
|
|
671
|
-
`'user'` and `'
|
|
1301
|
+
`'user'`, `'fit'` and `'command'` are the only sources.
|
|
1302
|
+
Also `lr-map-move` (non-cancelable; frozen `LyraMapMoveDetail { center, zoom, bounds? }`), fired at
|
|
1303
|
+
most once per animation frame while the camera moves, whatever moves it (a gesture, an animation,
|
|
1304
|
+
a camera command, a fit, a `center`/`zoom` assignment or a move made directly through `map`), and
|
|
1305
|
+
once more when the move ends so the last position is never missed. It reports the camera as it is,
|
|
1306
|
+
not a settled intent: use `lr-map-view-change` for where the camera came to rest, and this event to
|
|
1307
|
+
keep an overlay in step with the map while it travels (pair it with `project()`). It stops when the
|
|
1308
|
+
element disconnects.
|
|
1309
|
+
Readiness: `lr-map-style-load` (frozen `LyraMapReadinessDetail { generation }`) fires once per
|
|
1310
|
+
connection and style after generated and registered overlays, images, style overrides and their
|
|
1311
|
+
asynchronous preparation are restored; `lr-map-idle` (same detail) fires after style readiness
|
|
1312
|
+
whenever the peer and current component work are idle, including after later camera or source
|
|
1313
|
+
updates. `generation` increases monotonically across reconnects and style replacements.
|
|
1314
|
+
Interactions: `lr-map-feature-enter` and `lr-map-feature-leave` (frozen `LyraMapInteractionDetail
|
|
1315
|
+
{ lngLat, hit?, feature? }`) report the pointer entering a different admitted feature and leaving the previous
|
|
1316
|
+
one; `lr-map-pointer-move` (frozen `LyraMapPointerDetail { lngLat, point }`, at most once per frame) and
|
|
1317
|
+
`lr-map-pointer-leave` (detail `null`) report the pointer itself; `lr-map-contextmenu` (same detail) reports a secondary click without preventing the native
|
|
1318
|
+
context menu; `lr-map-pick` (frozen `LyraMapPickDetail { lngLat, hit?, trigger }`, `trigger` being
|
|
1319
|
+
`'pointer' | 'keyboard'`) reports a pick-mode selection, a keyboard pick using the camera center.
|
|
1320
|
+
`lr-map-anchor-close` (frozen `LyraMapAnchorCloseDetail { reason }`) fires after an open anchor
|
|
1321
|
+
closes by `closeAnchor()`, its close button or Escape.
|
|
1322
|
+
Drawing: `lr-map-draw-start` (after the first accepted vertex), `lr-map-draw-change` (after an
|
|
1323
|
+
accepted vertex, undo or vertex edit) and `lr-map-draw-complete` (valid geometry with spherical
|
|
1324
|
+
metrics) carry a frozen `LyraMapDrawingSnapshot`; `lr-map-draw-cancel` carries
|
|
1325
|
+
`LyraMapDrawingCancelDetail`, the cancelled snapshot plus a stable `reason`; `lr-map-draw-vertex-end`
|
|
1326
|
+
carries `LyraMapDrawingVertexEndDetail` once a vertex drag or keyboard move ends.
|
|
1327
|
+
Location: `lr-map-geolocate` (frozen `LyraMapGeolocateDetail { lngLat, accuracy }`) after the
|
|
1328
|
+
user-activated geolocate control locates the user.
|
|
1329
|
+
Failures: `lr-map-geolocate-error` (frozen `LyraMapGeolocateErrorDetail { code }`, a
|
|
1330
|
+
`LyraMapGeolocationErrorCode`) and `lr-map-geolocate-out-of-bounds` (`{ code: 'out-of-bounds' }`)
|
|
1331
|
+
expose no coordinates or native messages; `lr-map-export-error` (frozen
|
|
1332
|
+
`LyraMapImageExportErrorDetail { code }`) reports a sanitized `exportImage()` failure. None of these
|
|
1333
|
+
events is cancelable; all bubble and are composed.
|
|
672
1334
|
|
|
673
1335
|
The outer marker-activation detail is frozen, while an opaque marker `unsafeHtml` value remains the
|
|
674
1336
|
original supplied value at the MapLibre popup and marker-activation boundary. Treat it as trusted
|
|
675
1337
|
markup as described above.
|
|
676
1338
|
|
|
677
|
-
**Slots:** `
|
|
1339
|
+
**Slots:** `anchor` — content placed at `anchorLngLat`, replacing a hand-positioned popup. It sits
|
|
1340
|
+
above the point (flipped below near the top edge, shifted to stay inside the map), follows the point
|
|
1341
|
+
through every camera move, resize and `anchorLngLat` change, and is hidden while `anchorLngLat` is
|
|
1342
|
+
unset or unusable, the point is outside the visible map, or the map does not exist (before the peer
|
|
1343
|
+
loads, after a failure or a disconnect). The element only places it: `part="anchor"` supplies a
|
|
1344
|
+
default surface (padding, border, radius, shadow, above the legend and controls) and the slotted
|
|
1345
|
+
content owns its semantics, labelling, close control and focus, so name it and manage focus as you
|
|
1346
|
+
would any dialog or popup of your own. Positioning uses the library's shared popup positioner, in
|
|
1347
|
+
the map's container, and the wrapper's size never depends on the placement, so it adds no layout
|
|
1348
|
+
loop. Typical use: `map.addEventListener('lr-map-click', (e) => { card.hidden = false;
|
|
1349
|
+
map.anchorLngLat = e.detail.lngLat; })`.
|
|
1350
|
+
`legend` — custom legend content, rendered inside the legend panel's own layout so it
|
|
678
1351
|
stays positioned with the map instead of floating beside it. Supplying it opens the panel even
|
|
679
1352
|
when `legend` and `legendGradient` are both empty. `legend-start` — the same extension point at the
|
|
680
1353
|
**top** of the panel: it renders ahead of the gradient bar and every projected row, where `legend`
|
|
@@ -685,9 +1358,18 @@ which only reaches rows projected from `legend`.
|
|
|
685
1358
|
**CSS parts:** `base`, `container`, `legend`, `legend-disclosure`, `legend-disclosure-icon`,
|
|
686
1359
|
`legend-group`, `legend-group-heading`, `legend-swatch`, `legend-toggle`,
|
|
687
1360
|
`legend-toggle-hidden`, `legend-gradient`, `legend-lo`,
|
|
688
|
-
`legend-hi`, `legend-
|
|
689
|
-
`popup-content`, `popup-close-button`, `attribution`,
|
|
690
|
-
`zoom-in`, `zoom-out`, `compass`, `scale`, `
|
|
1361
|
+
`legend-hi`, `legend-ticks`, `legend-tick`, `legend-derived`, `legend-limit`, `anchor`,
|
|
1362
|
+
`anchor-close`, `marker`, `popup`, `popup-content`, `popup-close-button`, `attribution`,
|
|
1363
|
+
`attribution-toggle`, `navigation`, `zoom-in`, `zoom-out`, `compass`, `scale`, `geolocate`,
|
|
1364
|
+
`configuration-error`, `error`.
|
|
1365
|
+
Before native construction, `initialization-placeholder` is the stable surface,
|
|
1366
|
+
`initialization-control` outlines each requested control and, for `initialization="interaction"`,
|
|
1367
|
+
`initialization-activate` is the localized button that starts the map. Pick mode renders `pick-controls` with
|
|
1368
|
+
`pick-center` and `pick-cancel`; draw mode renders `drawing-controls` with `drawing-add`,
|
|
1369
|
+
`drawing-undo`, `drawing-complete`, `drawing-cancel` and the `drawing-status` vertex count (plus
|
|
1370
|
+
`drawing-summary` with `drawingMeasurements`), vertex editing renders `drawing-handles` containing
|
|
1371
|
+
one `drawing-vertex` per editable vertex, and `drawingMeasurements` renders `drawing-measurements`
|
|
1372
|
+
holding the `drawing-measurement` labels.
|
|
691
1373
|
The compact attribution summary has a decorative, current-color information glyph and retains
|
|
692
1374
|
MapLibre's accessible name, keyboard/touch disclosure behavior and attribution links. To make
|
|
693
1375
|
only this control compact, scope the shared target-size token to its public wrapper:
|
|
@@ -762,11 +1444,13 @@ reserves vertical room for these controls and attribution, including after resiz
|
|
|
762
1444
|
Attribution also reserves legend space when it is the only control. Opposing occupied corners
|
|
763
1445
|
share the available width, so expanded attribution wraps without covering a scale or navigation
|
|
764
1446
|
control on the other side; controls stay aligned to their logical edge in both text directions.
|
|
1447
|
+
Prefer the declarative `controls` property (`controls = { navigation: true, scale: { unit: 'metric' } }`),
|
|
1448
|
+
which does the dynamic import, `addControl()` and removal for you; the imperative route below stays
|
|
1449
|
+
supported for controls it does not cover, such as fullscreen.
|
|
765
1450
|
Navigation exposes `navigation`, `zoom-in`, `zoom-out`, and `compass` parts; the scale exposes `scale`.
|
|
766
1451
|
Button names update through `zoomIn`, `zoomOut`, and `mapResetNorth` locale strings. MapLibre retains
|
|
767
1452
|
keyboard activation, compass rotation, zoom limits, scale units and viewport updates. No controls
|
|
768
|
-
are created until
|
|
769
|
-
integration; there is no declarative controls property.
|
|
1453
|
+
other than default attribution are created until declared in `controls` or added by the application.
|
|
770
1454
|
|
|
771
1455
|
Navigation, scale, attribution and the legend follow the surrounding Glass or Solid surface
|
|
772
1456
|
treatment. Their decorative filtering leaves native control behavior and map data paint intact.
|
|
@@ -791,6 +1475,8 @@ geometry and foreground overrides remain available through the existing public p
|
|
|
791
1475
|
- `--lr-map-legend-hidden-swatch-opacity` (default `0.5`) — opacity of a hidden interactive legend
|
|
792
1476
|
row's decorative swatch. Only the `aria-hidden` swatch dims; the label re-colours through
|
|
793
1477
|
`--lr-color-text-quiet` instead, so it never drops below 4.5:1.
|
|
1478
|
+
- `--lr-map-drawing-color` (default `var(--lr-color-brand)`) — color of the temporary drawing, its
|
|
1479
|
+
rubber band and the vertex handles. Read from the resolved cascade, so a theme change repaints it.
|
|
794
1480
|
- `--lr-map-popup-close-button-hover-bg` (default `var(--lr-color-brand-quiet)`) and
|
|
795
1481
|
`--lr-map-popup-close-button-hover-color` (default `var(--lr-color-brand)`) — hover background
|
|
796
1482
|
and foreground of `popup-close-button`.
|
|
@@ -802,6 +1488,85 @@ var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-acti
|
|
|
802
1488
|
control group), `--lr-color-border-subtle` (popup, legend and legend-limit rule edges),
|
|
803
1489
|
`--lr-shadow`, `--lr-radius`.
|
|
804
1490
|
|
|
1491
|
+
### Migrating a raw engine map to `lr-map`
|
|
1492
|
+
|
|
1493
|
+
Move the map's desired state into the component before connecting it. Keep `mapStyle` for the
|
|
1494
|
+
basemap and `overlays` for application-owned native sources and layers. The component prepares the
|
|
1495
|
+
modular features, installs those resources and restores them after each style replacement.
|
|
1496
|
+
|
|
1497
|
+
| Raw engine operation | Component-owned equivalent |
|
|
1498
|
+
| --- | --- |
|
|
1499
|
+
| `new Map({ style, center, zoom })` | `mapStyle`, `center`, `zoom` and the element's allocation |
|
|
1500
|
+
| `addSource()` / `addLayer()` and style-load replay | `overlays.sources` / `overlays.layers`, or `dataLayers` for the documented data-layer models |
|
|
1501
|
+
| `addImage()` / missing-image listener | `images` / `imageProvider` |
|
|
1502
|
+
| Basemap `setPaintProperty()` / `setLayoutProperty()` | `styleOverrides` with the basemap `layerId` |
|
|
1503
|
+
| Camera moves and fitting | `flyTo()`, `easeTo()`, `jumpTo()`, `fitBounds()` and `fitToData()` |
|
|
1504
|
+
| Polling `isStyleLoaded()` and installing a style-load listener | `whenStyleReady()` for style restoration; `whenIdle()` for subsequent resource/render work |
|
|
1505
|
+
|
|
1506
|
+
For example, this overlay remains owned when the basemap changes:
|
|
1507
|
+
|
|
1508
|
+
```ts
|
|
1509
|
+
import {
|
|
1510
|
+
LYRA_MAP_EMPTY_STYLE,
|
|
1511
|
+
type LyraMapStyleSpecification,
|
|
1512
|
+
} from '@aceshooting/lyra-ui/components/lr-map.js';
|
|
1513
|
+
|
|
1514
|
+
const mapEl = document.createElement('lr-map');
|
|
1515
|
+
mapEl.setAttribute('aria-label', 'Locations');
|
|
1516
|
+
mapEl.style.blockSize = '24rem';
|
|
1517
|
+
mapEl.initialization = 'eager';
|
|
1518
|
+
mapEl.mapStyle = LYRA_MAP_EMPTY_STYLE;
|
|
1519
|
+
mapEl.center = [2.35, 48.85];
|
|
1520
|
+
mapEl.zoom = 10;
|
|
1521
|
+
mapEl.overlays = {
|
|
1522
|
+
sources: [{
|
|
1523
|
+
id: 'locations-source',
|
|
1524
|
+
source: {
|
|
1525
|
+
type: 'geojson',
|
|
1526
|
+
data: {
|
|
1527
|
+
type: 'FeatureCollection',
|
|
1528
|
+
features: [{
|
|
1529
|
+
type: 'Feature', id: 'location-1', properties: {},
|
|
1530
|
+
geometry: { type: 'Point', coordinates: [2.35, 48.85] },
|
|
1531
|
+
}],
|
|
1532
|
+
},
|
|
1533
|
+
},
|
|
1534
|
+
}],
|
|
1535
|
+
layers: [{
|
|
1536
|
+
interactive: true,
|
|
1537
|
+
layer: {
|
|
1538
|
+
id: 'locations-circles', type: 'circle', source: 'locations-source',
|
|
1539
|
+
paint: { 'circle-color': 'var(--lr-color-brand)', 'circle-radius': 6 },
|
|
1540
|
+
},
|
|
1541
|
+
}],
|
|
1542
|
+
};
|
|
1543
|
+
document.body.append(mapEl);
|
|
1544
|
+
await mapEl.whenStyleReady();
|
|
1545
|
+
|
|
1546
|
+
async function replaceBasemap(style: LyraMapStyleSpecification): Promise<void> {
|
|
1547
|
+
mapEl.mapStyle = style;
|
|
1548
|
+
await mapEl.whenStyleReady();
|
|
1549
|
+
// The component has restored locations-source and locations-circles.
|
|
1550
|
+
}
|
|
1551
|
+
```
|
|
1552
|
+
|
|
1553
|
+
Configure the companion worker as shown below before running this example. Handle rejected
|
|
1554
|
+
readiness promises when navigation disconnects the element, a newer style supersedes the request,
|
|
1555
|
+
or resource preparation fails. After reassigning overlay data or mutable paint/layout on the same
|
|
1556
|
+
style, await `whenIdle()` before relying on the rendered result.
|
|
1557
|
+
|
|
1558
|
+
Keep the application snapshot authoritative and assign fresh `overlays`, `images` and
|
|
1559
|
+
`styleOverrides` values when they change. An incremental `updateSourceData()` call does not rewrite
|
|
1560
|
+
that snapshot: the next style replacement restores the controlled source data. Keep source, layer
|
|
1561
|
+
and image IDs distinct from the basemap and component-generated resources. A `before` anchor must
|
|
1562
|
+
be valid for the replacement basemap too; omit it when no shared anchor exists.
|
|
1563
|
+
|
|
1564
|
+
Remove the old callbacks that re-add these same resources on every style load. Use
|
|
1565
|
+
`lr-map-style-load` to observe completed restoration. Direct mutations through the `map` getter
|
|
1566
|
+
remain outside declarative ownership; move resources that must survive basemap changes into the
|
|
1567
|
+
properties above. Retain application selection state across source identity changes, and check
|
|
1568
|
+
boolean admission when applying it through `setFeatureState()`.
|
|
1569
|
+
|
|
805
1570
|
**Optional peer deps:** the default is `@aceshooting/lyra-map` `^1.0.0` (lazy-loaded). Install and
|
|
806
1571
|
configure the companion's Vite plugin so the engine and module worker share the same emitted
|
|
807
1572
|
feature graph:
|
|
@@ -813,6 +1578,22 @@ import { lyraMapWorkerPlugin } from '@aceshooting/lyra-map/vite';
|
|
|
813
1578
|
export default defineConfig({ plugins: [lyraMapWorkerPlugin()] });
|
|
814
1579
|
```
|
|
815
1580
|
|
|
1581
|
+
The plugin configures the worker as the selected renderer is bundled; application startup needs
|
|
1582
|
+
no companion pre-import or readiness gate. Configure one plugin instance per application build,
|
|
1583
|
+
including when a workspace re-exports it. For an optional warm-up when navigation intent is known:
|
|
1584
|
+
|
|
1585
|
+
```ts
|
|
1586
|
+
import { LyraMap } from '@aceshooting/lyra-ui/components/lr-map.js';
|
|
1587
|
+
|
|
1588
|
+
void LyraMap.preload();
|
|
1589
|
+
```
|
|
1590
|
+
|
|
1591
|
+
`preload()` starts the selected engine import without constructing a map, creating a WebGL context
|
|
1592
|
+
or waiting for a style. It is optional and does not replace worker configuration or an element's
|
|
1593
|
+
`whenStyleReady()` / `whenIdle()` promises. Await its boolean result only when the application needs
|
|
1594
|
+
to choose its own fallback; `false` means that the selected engine could not load. For an element
|
|
1595
|
+
that will use `engine="maplibre"`, warm that engine with `LyraMap.preload('maplibre')` instead.
|
|
1596
|
+
|
|
816
1597
|
The plugin disables document module-preload helpers for chunks also imported by workers. See the
|
|
817
1598
|
companion README for Rollup/Rolldown integration or the explicit `setWorkerUrl()` override. Missing
|
|
818
1599
|
worker configuration fails visibly. Importing the companion during SSR is safe; worker creation
|
|
@@ -854,10 +1635,44 @@ With the default companion configured:
|
|
|
854
1635
|
</script>
|
|
855
1636
|
```
|
|
856
1637
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
`
|
|
860
|
-
|
|
1638
|
+
### Moving from full MapLibre to the modular engine
|
|
1639
|
+
|
|
1640
|
+
For an existing `lr-map`, install the compatible `@aceshooting/lyra-map` companion, add
|
|
1641
|
+
`lyraMapWorkerPlugin()` to the Vite configuration above, and set `engine="modular"` before the
|
|
1642
|
+
element connects (or omit `engine`, whose default is `modular`). Existing style descriptors and
|
|
1643
|
+
component-owned overlays keep the same shape. Changing `engine` on a connected element takes
|
|
1644
|
+
effect only after disconnect/reconnect.
|
|
1645
|
+
|
|
1646
|
+
Register custom protocols through `@aceshooting/lyra-map` when using the modular engine; protocol
|
|
1647
|
+
registrations on `maplibre-gl` belong to that other engine. Declarative component resources prepare
|
|
1648
|
+
their required feature families automatically. Any remaining direct `map.addSource()` /
|
|
1649
|
+
`map.addLayer()` / projection / terrain mutations must await the modular map's
|
|
1650
|
+
`prepareFeatures()` with their real descriptors first, as described above.
|
|
1651
|
+
|
|
1652
|
+
The modular plugin does not configure full MapLibre's worker. If an element still explicitly uses
|
|
1653
|
+
`engine="maplibre"`, retain that engine's setup. For Vite and MapLibre v6:
|
|
1654
|
+
|
|
1655
|
+
```ts
|
|
1656
|
+
import { setWorkerUrl } from 'maplibre-gl';
|
|
1657
|
+
import workerUrl from 'maplibre-gl/dist/maplibre-gl-worker.mjs?worker&url';
|
|
1658
|
+
import {
|
|
1659
|
+
LYRA_MAP_EMPTY_STYLE,
|
|
1660
|
+
} from '@aceshooting/lyra-ui/components/lr-map.js';
|
|
1661
|
+
|
|
1662
|
+
setWorkerUrl(workerUrl);
|
|
1663
|
+
const nativeMapEl = document.createElement('lr-map');
|
|
1664
|
+
nativeMapEl.engine = 'maplibre';
|
|
1665
|
+
nativeMapEl.mapStyle = LYRA_MAP_EMPTY_STYLE;
|
|
1666
|
+
nativeMapEl.style.blockSize = '24rem';
|
|
1667
|
+
document.body.append(nativeMapEl);
|
|
1668
|
+
```
|
|
1669
|
+
|
|
1670
|
+
Run worker setup before connecting any full-engine element. MapLibre v5's standard build includes
|
|
1671
|
+
its worker; other build variants and bundlers have their own setup (see
|
|
1672
|
+
https://maplibre.org/maplibre-gl-js/docs/#esm). Remove the full-engine worker import and dependency
|
|
1673
|
+
only when no remaining consumer uses them. The component styles its own shadow DOM for either
|
|
1674
|
+
engine; keep a page-level engine stylesheet only for raw maps that still need it. Deploy the
|
|
1675
|
+
modular renderer, worker and every emitted feature chunk together.
|
|
861
1676
|
|
|
862
1677
|
**Known gotchas:**
|
|
863
1678
|
|
|
@@ -892,10 +1707,9 @@ undefined`, or changing `choropleth.sourceId` to a different value, now calls `r
|
|
|
892
1707
|
`Marker` has no `setColor()`) rather than mutated in place — this also closes any popup the user
|
|
893
1708
|
currently has open on that marker (a fresh, closed `Popup` is built for the new instance); an
|
|
894
1709
|
accepted side effect of the reconstruction fallback, not a bug.
|
|
895
|
-
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
only the raw `lr-map-click` event.
|
|
1710
|
+
- Clicking does not select or highlight a feature automatically. Use `setFeatureState()` with
|
|
1711
|
+
feature-state-aware paint for application-owned selection, or assign `anchorLngLat` and slotted
|
|
1712
|
+
anchor content to show feature details. Marker popups remain available through `unsafeHtml`/`label`.
|
|
899
1713
|
- `LyraMapLegendEntry.color` is validated against a strict CSS-color-syntax allowlist before being applied
|
|
900
1714
|
to the legend swatch's `background-color`, rejecting anything that isn't recognizable color syntax
|
|
901
1715
|
(notably `url(...)`, which `background` also accepts and would otherwise fetch as soon as the
|
|
@@ -905,13 +1719,11 @@ undefined`, or changing `choropleth.sourceId` to a different value, now calls `r
|
|
|
905
1719
|
decorative `<lr-skeleton shape="rect" announce="false">` in place of the map container.
|
|
906
1720
|
Ordinary sr-only text preserves the localized `loading` label without creating a shadow live
|
|
907
1721
|
region.
|
|
908
|
-
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
concurrent WebGL contexts when many `<lr-map>`s sit in one dashboard/grid. Skipped entirely
|
|
914
|
-
(constructs immediately once the peer loads) when `IntersectionObserver` itself is unavailable.
|
|
1722
|
+
- `initialization='visible'` (the default) waits for the element to intersect the viewport before
|
|
1723
|
+
constructing its map and WebGL context. `idle` and `eager` select the other admission modes.
|
|
1724
|
+
Deferred construction shows the localized initialization placeholder; `map` remains undefined
|
|
1725
|
+
and `lr-map-load` waits for construction. Without `IntersectionObserver`, visible admission
|
|
1726
|
+
proceeds once the peer and caller inputs are ready.
|
|
915
1727
|
- Once constructed, the owner realm's `ResizeObserver` watches the rendered map container and calls
|
|
916
1728
|
the current peer's `resize()` on allocation changes. It is replaced on reconnect/adoption and
|
|
917
1729
|
disconnected before peer teardown, so a stale delivery cannot resize a removed map. Browsers
|