@aceshooting/lyra-ui 30.1.0 → 30.3.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 +92 -0
- package/dist/ai/adapters/a2ui.d.ts +10 -4
- package/dist/ai/adapters/a2ui.js +1 -1
- package/dist/ai/adapters/ag-ui.d.ts +17 -4
- package/dist/ai/adapters/ag-ui.js +1 -1
- package/dist/ai/adapters/ai-sdk.js +1 -1
- package/dist/ai/runtime.js +1 -1
- package/dist/components/agent-tools/mcp-app/mcp-app-protocol.d.ts +15 -0
- package/dist/components/agent-tools/mcp-app/mcp-app-protocol.js +36 -0
- package/dist/components/agent-tools/mcp-app/mcp-app.class.d.ts +31 -4
- package/dist/components/agent-tools/mcp-app/mcp-app.class.js +4 -4
- package/dist/components/agent-tools/span-waterfall/span-waterfall.class.js +1 -1
- package/dist/components/agent-tools/task-list/task-list.class.js +2 -2
- package/dist/components/agent-tools/trace-tree/trace-tree.class.js +2 -2
- package/dist/components/charts/chart/chart-prepared-data.d.ts +3 -1
- package/dist/components/charts/chart/chart-prepared-data.js +1 -1
- package/dist/components/charts/chart/chart.class.js +2 -2
- package/dist/components/charts/chart/lite-chart.class.js +1 -1
- package/dist/components/conversation/chat-viewport/chat-viewport.class.d.ts +2 -2
- package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
- package/dist/components/conversation/message-parts/message-parts.class.d.ts +13 -4
- package/dist/components/conversation/message-parts/message-parts.class.js +12 -10
- package/dist/components/conversation/message-parts/message-parts.d.ts +1 -1
- package/dist/components/conversation/message-parts/message-parts.js +1 -1
- package/dist/components/forms/checkbox/checkbox.class.d.ts +1 -1
- package/dist/components/forms/checkbox/checkbox.class.js +2 -2
- package/dist/components/forms/combobox/option.class.d.ts +1 -1
- package/dist/components/forms/combobox/option.class.js +2 -2
- package/dist/components/forms/radio/radio.class.d.ts +1 -1
- package/dist/components/forms/radio/radio.class.js +1 -1
- package/dist/components/forms/select/select.class.js +1 -1
- package/dist/components/forms/switch/switch.class.d.ts +1 -1
- package/dist/components/forms/switch/switch.class.js +1 -1
- package/dist/components/media/file-input/file-input.styles.js +1 -1
- package/dist/components/media/map/map-anchor-controller.js +1 -1
- package/dist/components/media/map/map-control-chrome.js +1 -0
- package/dist/components/media/map/map-control-options.d.ts +6 -2
- package/dist/components/media/map/map-control-options.js +1 -1
- package/dist/components/media/map/map-controls-lifecycle.js +1 -1
- package/dist/components/media/map/map-controls-readiness.js +1 -0
- package/dist/components/media/map/map.class.d.ts +39 -2
- package/dist/components/media/map/map.class.js +13 -7
- package/dist/components/media/map/map.styles.js +1 -1
- package/dist/components/viewers/model-viewer/model-viewer-loader.js +1 -1
- package/dist/components/viewers/model-viewer/model-viewer.class.js +1 -1
- package/dist/components/viewers/pptx-viewer/pptx-viewer.class.d.ts +11 -11
- package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +1 -1
- package/dist/events.d.ts +10 -1
- package/dist/framework-types.d.ts +1 -1
- package/dist/internal/accessible-text-controller.js +1 -1
- package/dist/internal/anchored-overlay-runtime.js +1 -1
- package/dist/internal/default-label-forwarding.js +1 -0
- package/dist/internal/hierarchy-summary-source.js +1 -0
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/positioner.d.ts +8 -0
- package/dist/internal/positioner.js +1 -1
- package/dist/internal/scoped-definitions.generated.js +1 -1
- package/dist/lyra.d.ts +1 -1
- package/llms/components/lr-file-input.md +5 -0
- package/llms/components/lr-map.md +87 -14
- package/llms/components/lr-mcp-app.md +94 -4
- package/llms/components/lr-message-parts.md +18 -0
- package/llms/components/lr-pptx-viewer.md +9 -5
- package/llms/components/lr-select.md +3 -2
- package/llms/index.md +1 -1
- package/llms/peers.md +1 -1
- package/llms/shared/ai-and-peers.md +77 -3
- package/llms/shared/events-and-types.md +25 -1
- package/llms/shared/localization-and-rtl.md +29 -0
- package/llms/shared.md +131 -4
- package/locales.json +1 -1
- package/package.json +12 -8
- package/registrations.json +1 -1
- package/skills/compose-lyra-interfaces/SKILL.md +5 -3
- package/skills/compose-lyra-interfaces/references/composition-patterns.md +8 -1
- package/skills/lyra-ui/SKILL.md +16 -8
- package/skills/lyra-ui/lyra-gen.md +86 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{glassSurface}from"../../../internal/glass-surface.styles.js";import{glassScrollLayerStyles}from"../../../internal/glass-scroll-layer.styles.js";const styles=css` :host { display: block; position: relative; inline-size: 100%; block-size: var(--lr-map-height, var(--lr-size-24rem)); } [part='initialization-placeholder'] { position: absolute; inset: 0; pointer-events: none; } .initialization-skeleton { inline-size: 100%; block-size: 100%; } .initialization-controls { position: absolute; inset-block-start: var(--lr-space-s); inset-inline-end: var(--lr-space-s); display: flex; flex-direction: column; gap: var(--lr-space-xs); } [part='initialization-activate'] { ${iconHitTarget} position: absolute; inset: 0; z-index: 1; pointer-events: auto; display: grid; place-items: center; padding: var(--lr-space-m); border: 0; background: transparent; color: var(--lr-color-text); font: inherit; cursor: pointer; overflow-wrap: anywhere; } [part='initialization-activate']::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-hover)); opacity: 0; } [part='initialization-activate']:where(:hover)::after { opacity: 1; } [part='initialization-activate']:where(:active)::after { opacity: 1; background: color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='initialization-activate']:focus-visible { ${focusRing} outline-offset: calc(-1 * var(--lr-focus-ring-width)); } .activate-label { position: relative; padding: var(--lr-space-xs) var(--lr-space-s); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius-button); background: var(--lr-color-surface); } [part='initialization-control'] { inline-size: var(--lr-icon-button-size); block-size: var(--lr-icon-button-size); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius-button); background: var(--lr-color-surface); } [part='pick-controls'], [part='drawing-controls'] { position: absolute; inset-inline: var(--lr-space-s); inset-block-end: var(--lr-space-s); display: flex; flex-wrap: wrap; gap: var(--lr-space-xs); pointer-events: none; } [part='pick-center'], [part='pick-cancel'], [part='drawing-add'], [part='drawing-undo'], [part='drawing-complete'], [part='drawing-cancel'], [part='anchor-close'] { ${iconHitTarget} pointer-events: auto; max-inline-size: 100%; white-space: normal; overflow-wrap: anywhere; padding: var(--lr-space-xs) var(--lr-space-s); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius-button); background: var(--lr-color-surface); color: var(--lr-color-text); font: inherit; cursor: pointer; } [part='pick-center']:where(:hover), [part='pick-cancel']:where(:hover), [part='drawing-add']:where(:hover), [part='drawing-undo']:where(:hover), [part='drawing-complete']:where(:hover), [part='drawing-cancel']:where(:hover), [part='anchor-close']:where(:hover) { background: var(--lr-color-surface-raised); } [part='pick-center']:where(:active), [part='pick-cancel']:where(:active), [part='drawing-add']:where(:active), [part='drawing-undo']:where(:active), [part='drawing-complete']:where(:active), [part='drawing-cancel']:where(:active), [part='anchor-close']:where(:active) { background: color-mix(in oklab, var(--lr-color-surface-raised), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='pick-center']:focus-visible, [part='pick-cancel']:focus-visible, [part='drawing-add']:focus-visible, [part='drawing-undo']:focus-visible, [part='drawing-complete']:focus-visible, [part='drawing-cancel']:focus-visible, [part='anchor-close']:focus-visible { ${focusRing} } [part='pick-center']:where(:disabled), [part='pick-cancel']:where(:disabled), [part='drawing-add']:where(:disabled), [part='drawing-undo']:where(:disabled), [part='drawing-complete']:where(:disabled), [part='drawing-cancel']:where(:disabled), [part='anchor-close']:where(:disabled) { cursor: default; } [part='drawing-controls'] { z-index: 2; } [part='drawing-handles'] { position: absolute; inset: 0; pointer-events: none; overflow: hidden; } [part='drawing-vertex'] { ${iconHitTarget} position: absolute; transform: translate(-50%, -50%); pointer-events: auto; display: grid; place-items: center; touch-action: none; padding: 0; border: 0; background: transparent; color: var(--lr-color-text); cursor: grab; } [part='drawing-vertex'] > span { inline-size: var(--lr-space-s); block-size: var(--lr-space-s); border-radius: var(--lr-radius-pill); background: var(--lr-map-drawing-color, var(--lr-color-brand)); border: var(--lr-border-width-thin) solid var(--lr-color-surface); } [part='drawing-vertex']:where(:hover) > span { background: color-mix(in srgb, var(--lr-map-drawing-color, var(--lr-color-brand)), var(--lr-color-surface) 20%); } [part='drawing-vertex']:where(:active) { cursor: grabbing; } [part='drawing-vertex']:where(:active) > span { background: color-mix(in oklab, var(--lr-map-drawing-color, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='drawing-measurements'] { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; } [part='drawing-measurement'] { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; padding: 0 var(--lr-space-2xs); border-radius: var(--lr-radius-xs); background: var(--lr-color-surface); color: var(--lr-color-text); font-size: var(--lr-font-size-sm); box-shadow: var(--lr-shadow-s); } [part='drawing-measurement'][data-kind='length'] { transform: translate(-50%, calc(var(--lr-space-s) + 50%)); } [part='drawing-measurement'][data-kind='area'] { font-weight: var(--lr-font-weight-semibold); } [part='drawing-summary'] { align-self: center; padding: var(--lr-space-xs) var(--lr-space-s); border-radius: var(--lr-radius-button); background: var(--lr-color-surface); color: var(--lr-color-text); } [part='drawing-vertex']:focus-visible { ${focusRing} } [part='drawing-vertex']:where(:disabled) { cursor: default; } [part='drawing-status'] { color: var(--lr-color-text); background: var(--lr-color-surface); padding: var(--lr-space-xs); overflow-wrap: anywhere; } [part='base'] { position: relative; inline-size: 100%; block-size: 100%; } lr-skeleton { --lr-skeleton-w: 100%; --lr-skeleton-h: 100%; } [part='container'] { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; overflow: hidden; } .maplibregl-canvas-container { inline-size: 100%; block-size: 100%; } .maplibregl-canvas { position: absolute; inset-block-start: 0; inset-inline-start: 0; } .maplibregl-canvas-container.maplibregl-interactive { cursor: grab; user-select: none; } .maplibregl-canvas-container.maplibregl-interactive:active { cursor: grabbing; } .maplibregl-canvas-container.maplibregl-touch-zoom-rotate, .maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas { touch-action: pan-x pan-y; } .maplibregl-canvas-container.maplibregl-touch-drag-pan, .maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas { touch-action: pinch-zoom; } .maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan, .maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas { touch-action: none; } .maplibregl-marker { color: var(--lr-color-brand); position: absolute; top: 0; left: 0; inline-size: max-content; min-inline-size: var(--lr-size-1-5rem); min-block-size: var(--lr-size-1-5rem); box-sizing: border-box; will-change: transform; } .maplibregl-marker[role='button'] { cursor: pointer; } .maplibregl-marker[role='button']:hover { filter: brightness(0.9); } .maplibregl-marker[role='button']:focus-visible { outline: var(--lr-focus-ring); outline-offset: calc(-1 * var(--lr-focus-ring-offset)); } .maplibregl-popup { position: absolute; top: 0; left: 0; z-index: var(--lr-layer-content); display: flex; will-change: transform; pointer-events: none; color: var(--lr-color-text); font-family: var(--lr-font); font-size: var(--lr-font-size-sm); line-height: var(--lr-line-height-normal); } .maplibregl-popup-anchor-top, .maplibregl-popup-anchor-top-left, .maplibregl-popup-anchor-top-right { flex-direction: column; } .maplibregl-popup-anchor-bottom, .maplibregl-popup-anchor-bottom-left, .maplibregl-popup-anchor-bottom-right { flex-direction: column-reverse; } .maplibregl-popup-anchor-left { flex-direction: row; } .maplibregl-popup-anchor-right { flex-direction: row-reverse; } .maplibregl-popup-tip { inline-size: 0; block-size: 0; border: var(--lr-size-0-625rem) solid transparent; z-index: var(--lr-layer-content); } .maplibregl-popup-anchor-top .maplibregl-popup-tip { align-self: center; border-block-start: none; border-block-end-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-top-left .maplibregl-popup-tip { align-self: flex-start; border-block-start: none; border-inline-start: none; border-block-end-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-top-right .maplibregl-popup-tip { align-self: flex-end; border-block-start: none; border-inline-end: none; border-block-end-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-bottom .maplibregl-popup-tip { align-self: center; border-block-end: none; border-block-start-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip { align-self: flex-start; border-block-end: none; border-inline-start: none; border-block-start-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { align-self: flex-end; border-block-end: none; border-inline-end: none; border-block-start-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-left .maplibregl-popup-tip { align-self: center; border-inline-start: none; border-inline-end-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-right .maplibregl-popup-tip { align-self: center; border-inline-end: none; border-inline-start-color: var(--lr-color-surface-overlay); } .maplibregl-popup-content { position: relative; min-inline-size: var(--lr-icon-button-size); padding: var(--lr-space-m); padding-inline-end: calc(var(--lr-icon-button-size) + var(--lr-space-xs)); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); border-radius: var(--lr-radius); background: var(--lr-color-surface-overlay); box-shadow: var(--lr-shadow-m); pointer-events: auto; overflow-wrap: anywhere; } .maplibregl-popup-close-button { position: absolute; inset-block-start: 0; inset-inline-end: 0; display: inline-flex; align-items: center; justify-content: center; ${iconHitTarget} padding: 0; border: 0; border-radius: var(--lr-radius); background: transparent; color: var(--lr-color-text-quiet); font: inherit; cursor: pointer; transition: background-color var(--lr-transition-fast), color var(--lr-transition-fast); } .maplibregl-popup-close-button:where(:hover) { background: var(--lr-map-popup-close-button-hover-bg, var(--lr-color-brand-quiet)); color: var(--lr-map-popup-close-button-hover-color, var(--lr-color-brand)); } .maplibregl-popup-close-button:where(:active) { background: var(--lr-map-popup-close-button-active-bg, color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))); color: var(--lr-map-popup-close-button-active-color, var(--lr-color-brand)); } .maplibregl-popup-close-button:where(:focus-visible) { outline: var(--lr-focus-ring); outline-offset: calc(-1 * var(--lr-focus-ring-offset)); } [part='error'], [part='configuration-error'] { margin: 0; padding: var(--lr-space-l); color: var(--lr-color-danger); font-size: var(--lr-font-size-md-sm); text-align: center; } .anchor-boundary { position: absolute; inset: 0; pointer-events: none; } [part='anchor-close'] { display: block; margin-inline-start: auto; margin-block-start: var(--lr-space-xs); } [part='anchor'] { position: absolute; z-index: calc(var(--lr-layer-content) + 1 + var(--_lr-map-anchor-rank, 0)); box-sizing: border-box; inline-size: max-content; max-inline-size: var(--lr-positioner-available-inline-size, calc(100% - var(--lr-space-s) - var(--lr-space-s))); max-block-size: var(--lr-positioner-available-block-size, calc(100% - var(--lr-space-s) - var(--lr-space-s))); overflow: auto; padding: var(--lr-space-m); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); border-radius: var(--lr-radius); background: var(--lr-color-surface-overlay); color: var(--lr-color-text); box-shadow: var(--lr-shadow-m); overflow-wrap: anywhere; } [part='anchor']:where([hidden]) { display: none !important; } [part='legend'] { position: absolute; inset-block-end: calc(var(--lr-space-s) + var(--_lr-map-controls-bottom, calc(var(--lr-space-xs) * 0))); inset-inline-start: var(--lr-space-s); z-index: var(--lr-layer-content); display: flex; flex-direction: column; min-inline-size: 0; max-inline-size: calc(100% - var(--lr-space-s) - var(--lr-space-s)); max-block-size: calc(100% - var(--lr-space-s) - var(--lr-space-s) - var(--_lr-map-controls-bottom, calc(var(--lr-space-xs) * 0)) - var(--_lr-map-controls-top, calc(var(--lr-space-xs) * 0))); overflow: auto; scrollbar-gutter: stable; box-sizing: border-box; gap: var(--lr-space-xs); padding: var(--lr-space-xs) var(--lr-space-s); background: var(--lr-color-surface); color: var(--lr-color-text); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); border-radius: var(--lr-radius); box-shadow: var(--lr-shadow-m); font-size: var(--lr-font-size-xs); } .legend-list { display: flex; flex-direction: column; gap: var(--lr-space-xs); min-inline-size: 0; } [part='legend'] [hidden] { display: none; } button[part='legend-disclosure'] { display: flex; align-items: center; align-self: flex-start; gap: var(--lr-space-xs); box-sizing: border-box; ${iconHitTarget} min-width: 0; max-inline-size: 100%; border: none; border-radius: var(--lr-radius-xs); padding: var(--lr-size-2px) var(--lr-space-xs); background: transparent; color: inherit; font: inherit; font-weight: var(--lr-font-weight-semibold); text-align: start; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: var(--lr-transition-interactive); } button[part='legend-disclosure'] > span:last-child { min-inline-size: 0; overflow-wrap: anywhere; } button[part='legend-disclosure']:where(:hover) { background: color-mix(in srgb, var(--lr-color-text) 8%, transparent); } button[part='legend-disclosure']:where(:active) { background: color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-active)); } button[part='legend-disclosure']:where(:focus-visible) { ${focusRing} } [part='legend-disclosure-icon'] { display: inline-flex; flex: 0 0 auto; transition: transform var(--lr-transition-fast); } :host(:dir(rtl)) [part='legend-disclosure-icon'] { transform: rotate(180deg); } button[part='legend-disclosure'][aria-expanded='true'] [part='legend-disclosure-icon'], :host(:dir(rtl)) button[part='legend-disclosure'][aria-expanded='true'] [part='legend-disclosure-icon'] { transform: rotate(90deg); } .legend-gradient { display: flex; align-items: center; gap: var(--lr-space-xs); min-inline-size: 0; } .legend-gradient .gradient-bar { flex: 1 1 var(--lr-size-6rem); inline-size: var(--lr-size-6rem); min-inline-size: 0; block-size: var(--lr-size-0-5rem); border-radius: var(--lr-size-2px); } [part='legend-lo'], [part='legend-hi'] { flex: 0 0 auto; white-space: nowrap; } .legend-gradient .gradient-track { display: flex; flex: 1 1 var(--lr-size-6rem); inline-size: var(--lr-size-6rem); flex-direction: column; gap: var(--lr-size-2px); min-inline-size: 0; } .gradient-track .gradient-bar { flex: none; inline-size: 100%; } .gradient-ticks { position: relative; block-size: calc(var(--lr-space-m) + var(--lr-space-xs)); min-inline-size: 0; } [part='legend-tick'] { position: absolute; inset-block-start: 0; inset-inline-start: var(--_lr-map-tick-position, 0%); display: flex; flex-direction: column; align-items: center; translate: -50% 0; color: var(--lr-color-text-quiet); white-space: nowrap; } :host(:dir(rtl)) [part='legend-tick'] { translate: 50% 0; } [part='legend-tick']::before { content: ''; inline-size: var(--lr-size-1px); block-size: calc(var(--lr-size-2px) * 2); background: currentColor; } :host(:dir(rtl)) .legend-gradient .gradient-bar { transform: scaleX(-1); } .legend-group, .legend-section-list { display: flex; flex-direction: column; gap: var(--lr-space-xs); min-inline-size: 0; } [part='legend-group-heading'] { min-inline-size: 0; color: var(--lr-color-text-quiet); font-weight: var(--lr-font-weight-semibold); overflow-wrap: anywhere; } .legend-row { display: flex; align-items: center; gap: var(--lr-space-xs); min-inline-size: 0; } .legend-row > span:last-child { min-inline-size: 0; overflow-wrap: anywhere; } button[part~='legend-toggle'] { display: flex; align-items: center; gap: var(--lr-space-xs); box-sizing: border-box; ${iconHitTarget} min-width: 0; max-inline-size: 100%; border: none; border-radius: var(--lr-radius-xs); padding: var(--lr-size-2px) var(--lr-space-xs); background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: var(--lr-transition-interactive); } button[part~='legend-toggle'] > span:last-child { min-inline-size: 0; overflow-wrap: anywhere; } button[part~='legend-toggle']:where(:hover) { background: color-mix(in srgb, var(--lr-color-text) 8%, transparent); } button[part~='legend-toggle']:where(:active) { background: color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-active)); } button[part~='legend-toggle']:where(:focus-visible) { ${focusRing} } button[part~='legend-toggle-hidden'] [part='legend-swatch'] { opacity: var(--lr-map-legend-hidden-swatch-opacity, 0.5); } button[part~='legend-toggle-hidden'] > span:last-child { color: var(--lr-color-text-quiet); } [part='legend-swatch'] { position: relative; overflow: hidden; inline-size: var(--lr-size-0-75rem); block-size: var(--lr-size-0-75rem); box-sizing: border-box; border: var(--lr-border-width-thin) solid currentColor; border-radius: var(--lr-size-2px); flex: 0 0 auto; } [part='legend-swatch'][data-pattern='diagonal'] { border-style: dashed; } [part='legend-swatch'][data-pattern='dots'] { border-style: dotted; border-radius: 50%; } [part='legend-swatch'][data-pattern='crosshatch'] { border-style: double; border-radius: 0; } [part='legend-swatch'][data-pattern='diagonal']::before, [part='legend-swatch'][data-pattern='crosshatch']::before, [part='legend-swatch'][data-pattern='crosshatch']::after, [part='legend-swatch'][data-pattern='dots']::before { content: ''; position: absolute; inset-block-start: 50%; inset-inline-start: 50%; inline-size: 150%; block-size: var(--lr-border-width-thin); background: currentColor; transform: translate(-50%, -50%) rotate(-45deg); } [part='legend-swatch'][data-pattern='crosshatch']::after { transform: translate(-50%, -50%) rotate(45deg); } [part='legend-swatch'][data-pattern='dots']::before { inline-size: var(--lr-size-2px); block-size: var(--lr-size-2px); border-radius: 50%; transform: translate(-50%, -50%); } [part='legend-swatch'][data-pattern][data-icon='true'] { inline-size: var(--lr-size-1rem); block-size: var(--lr-size-1rem); border: none; border-radius: 0; background: none; } [part='legend-swatch'][data-icon='true']::before, [part='legend-swatch'][data-icon='true']::after { content: none; } .legend-icon { display: block; inline-size: 100%; block-size: 100%; } [part='legend-limit'] { min-inline-size: 0; padding-block-start: var(--lr-space-xs); border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); color: var(--lr-color-text-quiet); overflow-wrap: anywhere; } .maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right, .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { position: absolute; display: flex; flex-direction: column; align-items: flex-start; max-inline-size: 100%; z-index: var(--lr-layer-content); pointer-events: none; } .maplibregl-ctrl-top-right, .maplibregl-ctrl-bottom-right { align-items: flex-end; } .maplibregl-control-container:where(:has(.maplibregl-ctrl-top-left:not(:empty))):where(:has(.maplibregl-ctrl-top-right:not(:empty))) :where(.maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right), .maplibregl-control-container:where(:has(.maplibregl-ctrl-bottom-left:not(:empty))):where(:has(.maplibregl-ctrl-bottom-right:not(:empty))) :where(.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right) { max-inline-size: 50%; } .maplibregl-ctrl-top-left { inset-block-start: 0; inset-inline-start: 0; } .maplibregl-ctrl-top-right { inset-block-start: 0; inset-inline-end: 0; } .maplibregl-ctrl-bottom-left { inset-block-end: 0; inset-inline-start: 0; } .maplibregl-ctrl-bottom-right { inset-block-end: 0; inset-inline-end: 0; } .maplibregl-ctrl { box-sizing: border-box; max-inline-size: calc(100% - 2 * var(--lr-space-xs)); flex-shrink: 0; margin: var(--lr-space-xs); pointer-events: auto; transform: translate(0); } .maplibregl-ctrl-attrib { position: relative; padding: 0 var(--lr-space-xs); border-radius: var(--lr-radius); background: var(--lr-color-surface); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); } .maplibregl-ctrl-group { position: relative; display: flex; flex-direction: column; inline-size: fit-content; border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: var(--lr-color-surface); box-shadow: var(--lr-shadow); color: var(--lr-color-text); } .maplibregl-ctrl-group button { display: grid; place-items: center; ${iconHitTarget} padding: var(--lr-space-xs); border: 0; border-radius: inherit; background: transparent; color: inherit; font: inherit; cursor: pointer; transition: background-color var(--lr-transition-fast), color var(--lr-transition-fast); } .maplibregl-ctrl-group button:where(:not(:first-child)) { border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border); } .maplibregl-ctrl-group button:hover:where(:not(:disabled)) { background: var(--lr-color-brand-quiet); color: var(--lr-color-brand); } .maplibregl-ctrl-group button:active:where(:not(:disabled)) { background: color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } .maplibregl-ctrl-group button:focus-visible { outline: var(--lr-focus-ring); outline-offset: calc(-1 * var(--lr-focus-ring-offset)); } .maplibregl-ctrl-group button:disabled { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } .maplibregl-ctrl-icon { display: grid; place-items: center; inline-size: var(--lr-size-1em); block-size: var(--lr-size-1em); font-size: var(--lr-font-size-lg); line-height: var(--lr-line-height-none); } .maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon::before { content: '+'; } .maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon::before { content: '−'; } .maplibregl-ctrl-compass .maplibregl-ctrl-icon::before { content: '▲'; } .maplibregl-ctrl-geolocate .maplibregl-ctrl-icon::before { content: '◎'; } .maplibregl-ctrl-scale { position: relative; box-sizing: border-box; min-inline-size: max-content; padding: var(--lr-space-2xs) var(--lr-space-xs); padding-block-end: calc(var(--lr-space-2xs) + var(--lr-space-xs)); background: var(--lr-color-surface); color: var(--lr-color-text); font-family: var(--lr-font); font-size: var(--lr-font-size-xs); text-align: center; white-space: nowrap; } .maplibregl-ctrl-scale::after { content: ''; position: absolute; inset-inline-start: 0; inset-block-end: 0; box-sizing: border-box; inline-size: var(--_lr-map-scale-width, 100%); block-size: var(--lr-space-xs); border: var(--lr-border-width-medium) solid currentColor; border-block-start: 0; pointer-events: none; } .maplibregl-ctrl-attrib a { color: var(--lr-color-text-quiet); text-decoration: none; } .maplibregl-ctrl-attrib a:hover { text-decoration: underline; } .maplibregl-ctrl-attrib-inner { overflow-wrap: anywhere; } .maplibregl-ctrl-attrib-button { display: none; position: absolute; inset-block-start: 0; inset-inline-end: 0; inline-size: var(--lr-icon-button-size); block-size: var(--lr-icon-button-size); padding: 0; border: 0; border-radius: var(--lr-radius-pill); background: transparent; color: var(--lr-color-text); cursor: pointer; place-items: center; transition: background-color var(--lr-transition-fast); } .maplibregl-ctrl-attrib-button::before { content: ''; display: block; inline-size: var(--lr-size-1rem); block-size: var(--lr-size-1rem); background: currentColor; mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Ccircle cx="12" cy="12" r="9" fill="none" stroke="currentColor" stroke-width="2"/%3E%3Cpath d="M12 10v7m0-10v.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/%3E%3C/svg%3E') center / contain no-repeat; } .maplibregl-ctrl-attrib.maplibregl-compact { position: relative; min-block-size: var(--lr-icon-button-size); padding-inline-end: var(--lr-icon-button-size); } .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner { display: none; } .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button { display: grid; } .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner { display: block; } .maplibregl-ctrl-attrib-button:hover, .maplibregl-ctrl-attrib-button:active, .maplibregl-ctrl-attrib:where([open]) .maplibregl-ctrl-attrib-button { background: var(--lr-color-brand-quiet); } .maplibregl-ctrl-attrib-button:focus-visible { outline: var(--lr-focus-ring); outline-offset: calc(-1 * var(--lr-focus-ring-offset)); } .maplibregl-ctrl-attrib summary { list-style: none; appearance: none; -webkit-appearance: none; } .maplibregl-ctrl-attrib summary::-webkit-details-marker { display: none; } .maplibregl-ctrl-attrib summary::marker { content: ''; } ${glassSurface(".maplibregl-ctrl-group, .maplibregl-ctrl-scale, .maplibregl-ctrl-attrib",css`var(--lr-color-surface)`)} ${glassScrollLayerStyles} [part='legend'] > .glass-scroll-layer { margin-block-end: calc(-1 * var(--lr-space-xs)); } ${glassSurface('[part="legend"]',css`var(--lr-color-surface)`,css`var(--lr-color-surface)`,!0)} @media (forced-colors: active) { .maplibregl-ctrl-attrib-button { color: ButtonText; } .maplibregl-ctrl-attrib-button::before { forced-color-adjust: none; } [part='legend-swatch'] { background: Canvas !important; border-color: CanvasText; color: CanvasText; } [part='legend-swatch'][data-pattern='solid'] { background: CanvasText !important; } [part='legend-swatch'][data-pattern][data-icon='true'] { background: Canvas !important; } button[part~='legend-toggle-hidden'] { text-decoration-line: line-through; text-decoration-thickness: var(--lr-border-width-medium); } } `;export{styles};
|
|
1
|
+
import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{glassSurface}from"../../../internal/glass-surface.styles.js";import{glassScrollLayerStyles}from"../../../internal/glass-scroll-layer.styles.js";const styles=css` :host { display: block; position: relative; inline-size: 100%; block-size: var(--lr-map-height, var(--lr-size-24rem)); } [part='initialization-placeholder'] { position: absolute; inset: 0; pointer-events: none; } .initialization-skeleton { inline-size: 100%; block-size: 100%; } .initialization-controls { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; pointer-events: none; } .initialization-row { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, max-content); justify-content: space-between; min-inline-size: 0; } .initialization-row-top { grid-row: 1; } .initialization-row-bottom { grid-row: 3; } .initialization-corner { display: flex; flex-direction: column; min-inline-size: 0; gap: 0; } .initialization-row-bottom .initialization-corner { justify-content: flex-end; } .initialization-corner-left { grid-column: 1; align-items: flex-start; } .initialization-corner-right { grid-column: 2; align-items: flex-end; } [part='initialization-activate'] { ${iconHitTarget} position: absolute; inset: 0; z-index: 1; pointer-events: auto; display: grid; place-items: center; padding: var(--lr-space-m); border: 0; background: transparent; color: var(--lr-color-text); font: inherit; cursor: pointer; overflow-wrap: anywhere; } [part='initialization-activate']::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-hover)); opacity: 0; } [part='initialization-activate']:where(:hover)::after { opacity: 1; } [part='initialization-activate']:where(:active)::after { opacity: 1; background: color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='initialization-activate']:focus-visible { ${focusRing} outline-offset: calc(-1 * var(--lr-focus-ring-width)); } .activate-label { position: relative; padding: var(--lr-space-xs) var(--lr-space-s); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius-button); background: var(--lr-color-surface); } [part~='initialization-control'] { flex-shrink: 0; margin: var(--lr-space-xs); inline-size: var(--lr-icon-button-size); block-size: var(--lr-icon-button-size); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius-button); background: var(--lr-color-surface); } [part='pick-controls'], [part='drawing-controls'] { position: absolute; inset-inline: var(--lr-space-s); inset-block-end: var(--lr-space-s); display: flex; flex-wrap: wrap; gap: var(--lr-space-xs); pointer-events: none; } [part='pick-center'], [part='pick-cancel'], [part='drawing-add'], [part='drawing-undo'], [part='drawing-complete'], [part='drawing-cancel'], [part='anchor-close'] { ${iconHitTarget} pointer-events: auto; max-inline-size: 100%; white-space: normal; overflow-wrap: anywhere; padding: var(--lr-space-xs) var(--lr-space-s); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius-button); background: var(--lr-color-surface); color: var(--lr-color-text); font: inherit; cursor: pointer; } [part='pick-center']:where(:hover), [part='pick-cancel']:where(:hover), [part='drawing-add']:where(:hover), [part='drawing-undo']:where(:hover), [part='drawing-complete']:where(:hover), [part='drawing-cancel']:where(:hover), [part='anchor-close']:where(:hover) { background: var(--lr-color-surface-raised); } [part='pick-center']:where(:active), [part='pick-cancel']:where(:active), [part='drawing-add']:where(:active), [part='drawing-undo']:where(:active), [part='drawing-complete']:where(:active), [part='drawing-cancel']:where(:active), [part='anchor-close']:where(:active) { background: color-mix(in oklab, var(--lr-color-surface-raised), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='pick-center']:focus-visible, [part='pick-cancel']:focus-visible, [part='drawing-add']:focus-visible, [part='drawing-undo']:focus-visible, [part='drawing-complete']:focus-visible, [part='drawing-cancel']:focus-visible, [part='anchor-close']:focus-visible { ${focusRing} } [part='pick-center']:where(:disabled), [part='pick-cancel']:where(:disabled), [part='drawing-add']:where(:disabled), [part='drawing-undo']:where(:disabled), [part='drawing-complete']:where(:disabled), [part='drawing-cancel']:where(:disabled), [part='anchor-close']:where(:disabled) { cursor: default; } [part='drawing-controls'] { z-index: 2; } [part='drawing-handles'] { position: absolute; inset: 0; pointer-events: none; overflow: hidden; } [part='drawing-vertex'] { ${iconHitTarget} position: absolute; transform: translate(-50%, -50%); pointer-events: auto; display: grid; place-items: center; touch-action: none; padding: 0; border: 0; background: transparent; color: var(--lr-color-text); cursor: grab; } [part='drawing-vertex'] > span { inline-size: var(--lr-space-s); block-size: var(--lr-space-s); border-radius: var(--lr-radius-pill); background: var(--lr-map-drawing-color, var(--lr-color-brand)); border: var(--lr-border-width-thin) solid var(--lr-color-surface); } [part='drawing-vertex']:where(:hover) > span { background: color-mix(in srgb, var(--lr-map-drawing-color, var(--lr-color-brand)), var(--lr-color-surface) 20%); } [part='drawing-vertex']:where(:active) { cursor: grabbing; } [part='drawing-vertex']:where(:active) > span { background: color-mix(in oklab, var(--lr-map-drawing-color, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='drawing-measurements'] { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; } [part='drawing-measurement'] { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; padding: 0 var(--lr-space-2xs); border-radius: var(--lr-radius-xs); background: var(--lr-color-surface); color: var(--lr-color-text); font-size: var(--lr-font-size-sm); box-shadow: var(--lr-shadow-s); } [part='drawing-measurement'][data-kind='length'] { transform: translate(-50%, calc(var(--lr-space-s) + 50%)); } [part='drawing-measurement'][data-kind='area'] { font-weight: var(--lr-font-weight-semibold); } [part='drawing-summary'] { align-self: center; padding: var(--lr-space-xs) var(--lr-space-s); border-radius: var(--lr-radius-button); background: var(--lr-color-surface); color: var(--lr-color-text); } [part='drawing-vertex']:focus-visible { ${focusRing} } [part='drawing-vertex']:where(:disabled) { cursor: default; } [part='drawing-status'] { color: var(--lr-color-text); background: var(--lr-color-surface); padding: var(--lr-space-xs); overflow-wrap: anywhere; } [part='base'] { position: relative; inline-size: 100%; block-size: 100%; } lr-skeleton { --lr-skeleton-w: 100%; --lr-skeleton-h: 100%; } [part='container'] { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; overflow: hidden; } .maplibregl-canvas-container { inline-size: 100%; block-size: 100%; } .maplibregl-canvas { position: absolute; inset-block-start: 0; inset-inline-start: 0; } .maplibregl-canvas-container.maplibregl-interactive { cursor: grab; user-select: none; } .maplibregl-canvas-container.maplibregl-interactive:active { cursor: grabbing; } .maplibregl-canvas-container.maplibregl-touch-zoom-rotate, .maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas { touch-action: pan-x pan-y; } .maplibregl-canvas-container.maplibregl-touch-drag-pan, .maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas { touch-action: pinch-zoom; } .maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan, .maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas { touch-action: none; } .maplibregl-marker { color: var(--lr-color-brand); position: absolute; top: 0; left: 0; inline-size: max-content; min-inline-size: var(--lr-size-1-5rem); min-block-size: var(--lr-size-1-5rem); box-sizing: border-box; will-change: transform; } .maplibregl-marker[role='button'] { cursor: pointer; } .maplibregl-marker[role='button']:hover { filter: brightness(0.9); } .maplibregl-marker[role='button']:focus-visible { outline: var(--lr-focus-ring); outline-offset: calc(-1 * var(--lr-focus-ring-offset)); } .maplibregl-popup { position: absolute; top: 0; left: 0; z-index: var(--lr-layer-content); display: flex; will-change: transform; pointer-events: none; color: var(--lr-color-text); font-family: var(--lr-font); font-size: var(--lr-font-size-sm); line-height: var(--lr-line-height-normal); } .maplibregl-popup-anchor-top, .maplibregl-popup-anchor-top-left, .maplibregl-popup-anchor-top-right { flex-direction: column; } .maplibregl-popup-anchor-bottom, .maplibregl-popup-anchor-bottom-left, .maplibregl-popup-anchor-bottom-right { flex-direction: column-reverse; } .maplibregl-popup-anchor-left { flex-direction: row; } .maplibregl-popup-anchor-right { flex-direction: row-reverse; } .maplibregl-popup-tip { inline-size: 0; block-size: 0; border: var(--lr-size-0-625rem) solid transparent; z-index: var(--lr-layer-content); } .maplibregl-popup-anchor-top .maplibregl-popup-tip { align-self: center; border-block-start: none; border-block-end-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-top-left .maplibregl-popup-tip { align-self: flex-start; border-block-start: none; border-inline-start: none; border-block-end-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-top-right .maplibregl-popup-tip { align-self: flex-end; border-block-start: none; border-inline-end: none; border-block-end-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-bottom .maplibregl-popup-tip { align-self: center; border-block-end: none; border-block-start-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip { align-self: flex-start; border-block-end: none; border-inline-start: none; border-block-start-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { align-self: flex-end; border-block-end: none; border-inline-end: none; border-block-start-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-left .maplibregl-popup-tip { align-self: center; border-inline-start: none; border-inline-end-color: var(--lr-color-surface-overlay); } .maplibregl-popup-anchor-right .maplibregl-popup-tip { align-self: center; border-inline-end: none; border-inline-start-color: var(--lr-color-surface-overlay); } .maplibregl-popup-content { position: relative; min-inline-size: var(--lr-icon-button-size); padding: var(--lr-space-m); padding-inline-end: calc(var(--lr-icon-button-size) + var(--lr-space-xs)); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); border-radius: var(--lr-radius); background: var(--lr-color-surface-overlay); box-shadow: var(--lr-shadow-m); pointer-events: auto; overflow-wrap: anywhere; } .maplibregl-popup-close-button { position: absolute; inset-block-start: 0; inset-inline-end: 0; display: inline-flex; align-items: center; justify-content: center; ${iconHitTarget} padding: 0; border: 0; border-radius: var(--lr-radius); background: transparent; color: var(--lr-color-text-quiet); font: inherit; cursor: pointer; transition: background-color var(--lr-transition-fast), color var(--lr-transition-fast); } .maplibregl-popup-close-button:where(:hover) { background: var(--lr-map-popup-close-button-hover-bg, var(--lr-color-brand-quiet)); color: var(--lr-map-popup-close-button-hover-color, var(--lr-color-brand)); } .maplibregl-popup-close-button:where(:active) { background: var(--lr-map-popup-close-button-active-bg, color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))); color: var(--lr-map-popup-close-button-active-color, var(--lr-color-brand)); } .maplibregl-popup-close-button:where(:focus-visible) { outline: var(--lr-focus-ring); outline-offset: calc(-1 * var(--lr-focus-ring-offset)); } [part='error'], [part='configuration-error'] { margin: 0; padding: var(--lr-space-l); color: var(--lr-color-danger); font-size: var(--lr-font-size-md-sm); text-align: center; } .anchor-boundary { position: absolute; inset: 0; pointer-events: none; } [part='anchor-close'] { display: block; margin-inline-start: auto; margin-block-start: var(--lr-space-xs); } [part='anchor'] { position: absolute; z-index: calc(var(--lr-layer-content) + 1 + var(--_lr-map-anchor-rank, 0)); box-sizing: border-box; inline-size: max-content; max-inline-size: var(--lr-positioner-available-inline-size, calc(100% - var(--lr-space-s) - var(--lr-space-s))); max-block-size: var(--lr-positioner-available-block-size, calc(100% - var(--lr-space-s) - var(--lr-space-s))); overflow: auto; padding: var(--lr-space-m); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); border-radius: var(--lr-radius); background: var(--lr-color-surface-overlay); color: var(--lr-color-text); box-shadow: var(--lr-shadow-m); overflow-wrap: anywhere; } [part='anchor']:where([hidden]) { display: none !important; } [part='legend'] { position: absolute; inset-block-end: calc(var(--lr-space-s) + var(--_lr-map-controls-bottom, calc(var(--lr-space-xs) * 0))); inset-inline-start: var(--lr-space-s); z-index: var(--lr-layer-content); display: flex; flex-direction: column; min-inline-size: 0; max-inline-size: calc(100% - var(--lr-space-s) - var(--lr-space-s)); max-block-size: calc(100% - var(--lr-space-s) - var(--lr-space-s) - var(--_lr-map-controls-bottom, calc(var(--lr-space-xs) * 0)) - var(--_lr-map-controls-top, calc(var(--lr-space-xs) * 0))); overflow: auto; scrollbar-gutter: stable; box-sizing: border-box; gap: var(--lr-space-xs); padding: var(--lr-space-xs) var(--lr-space-s); background: var(--lr-color-surface); color: var(--lr-color-text); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); border-radius: var(--lr-radius); box-shadow: var(--lr-shadow-m); font-size: var(--lr-font-size-xs); } .legend-list { display: flex; flex-direction: column; gap: var(--lr-space-xs); min-inline-size: 0; } [part='legend'] [hidden] { display: none; } button[part='legend-disclosure'] { display: flex; align-items: center; align-self: flex-start; gap: var(--lr-space-xs); box-sizing: border-box; ${iconHitTarget} min-width: 0; max-inline-size: 100%; border: none; border-radius: var(--lr-radius-xs); padding: var(--lr-size-2px) var(--lr-space-xs); background: transparent; color: inherit; font: inherit; font-weight: var(--lr-font-weight-semibold); text-align: start; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: var(--lr-transition-interactive); } button[part='legend-disclosure'] > span:last-child { min-inline-size: 0; overflow-wrap: anywhere; } button[part='legend-disclosure']:where(:hover) { background: color-mix(in srgb, var(--lr-color-text) 8%, transparent); } button[part='legend-disclosure']:where(:active) { background: color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-active)); } button[part='legend-disclosure']:where(:focus-visible) { ${focusRing} } [part='legend-disclosure-icon'] { display: inline-flex; flex: 0 0 auto; transition: transform var(--lr-transition-fast); } :host(:dir(rtl)) [part='legend-disclosure-icon'] { transform: rotate(180deg); } button[part='legend-disclosure'][aria-expanded='true'] [part='legend-disclosure-icon'], :host(:dir(rtl)) button[part='legend-disclosure'][aria-expanded='true'] [part='legend-disclosure-icon'] { transform: rotate(90deg); } .legend-gradient { display: flex; align-items: center; gap: var(--lr-space-xs); min-inline-size: 0; } .legend-gradient .gradient-bar { flex: 1 1 var(--lr-size-6rem); inline-size: var(--lr-size-6rem); min-inline-size: 0; block-size: var(--lr-size-0-5rem); border-radius: var(--lr-size-2px); } [part='legend-lo'], [part='legend-hi'] { flex: 0 0 auto; white-space: nowrap; } .legend-gradient .gradient-track { display: flex; flex: 1 1 var(--lr-size-6rem); inline-size: var(--lr-size-6rem); flex-direction: column; gap: var(--lr-size-2px); min-inline-size: 0; } .gradient-track .gradient-bar { flex: none; inline-size: 100%; } .gradient-ticks { position: relative; block-size: calc(var(--lr-space-m) + var(--lr-space-xs)); min-inline-size: 0; } [part='legend-tick'] { position: absolute; inset-block-start: 0; inset-inline-start: var(--_lr-map-tick-position, 0%); display: flex; flex-direction: column; align-items: center; translate: -50% 0; color: var(--lr-color-text-quiet); white-space: nowrap; } :host(:dir(rtl)) [part='legend-tick'] { translate: 50% 0; } [part='legend-tick']::before { content: ''; inline-size: var(--lr-size-1px); block-size: calc(var(--lr-size-2px) * 2); background: currentColor; } :host(:dir(rtl)) .legend-gradient .gradient-bar { transform: scaleX(-1); } .legend-group, .legend-section-list { display: flex; flex-direction: column; gap: var(--lr-space-xs); min-inline-size: 0; } [part='legend-group-heading'] { min-inline-size: 0; color: var(--lr-color-text-quiet); font-weight: var(--lr-font-weight-semibold); overflow-wrap: anywhere; } .legend-row { display: flex; align-items: center; gap: var(--lr-space-xs); min-inline-size: 0; } .legend-row > span:last-child { min-inline-size: 0; overflow-wrap: anywhere; } button[part~='legend-toggle'] { display: flex; align-items: center; gap: var(--lr-space-xs); box-sizing: border-box; ${iconHitTarget} min-width: 0; max-inline-size: 100%; border: none; border-radius: var(--lr-radius-xs); padding: var(--lr-size-2px) var(--lr-space-xs); background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: var(--lr-transition-interactive); } button[part~='legend-toggle'] > span:last-child { min-inline-size: 0; overflow-wrap: anywhere; } button[part~='legend-toggle']:where(:hover) { background: color-mix(in srgb, var(--lr-color-text) 8%, transparent); } button[part~='legend-toggle']:where(:active) { background: color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-active)); } button[part~='legend-toggle']:where(:focus-visible) { ${focusRing} } button[part~='legend-toggle-hidden'] [part='legend-swatch'] { opacity: var(--lr-map-legend-hidden-swatch-opacity, 0.5); } button[part~='legend-toggle-hidden'] > span:last-child { color: var(--lr-color-text-quiet); } [part='legend-swatch'] { position: relative; overflow: hidden; inline-size: var(--lr-size-0-75rem); block-size: var(--lr-size-0-75rem); box-sizing: border-box; border: var(--lr-border-width-thin) solid currentColor; border-radius: var(--lr-size-2px); flex: 0 0 auto; } [part='legend-swatch'][data-pattern='diagonal'] { border-style: dashed; } [part='legend-swatch'][data-pattern='dots'] { border-style: dotted; border-radius: 50%; } [part='legend-swatch'][data-pattern='crosshatch'] { border-style: double; border-radius: 0; } [part='legend-swatch'][data-pattern='diagonal']::before, [part='legend-swatch'][data-pattern='crosshatch']::before, [part='legend-swatch'][data-pattern='crosshatch']::after, [part='legend-swatch'][data-pattern='dots']::before { content: ''; position: absolute; inset-block-start: 50%; inset-inline-start: 50%; inline-size: 150%; block-size: var(--lr-border-width-thin); background: currentColor; transform: translate(-50%, -50%) rotate(-45deg); } [part='legend-swatch'][data-pattern='crosshatch']::after { transform: translate(-50%, -50%) rotate(45deg); } [part='legend-swatch'][data-pattern='dots']::before { inline-size: var(--lr-size-2px); block-size: var(--lr-size-2px); border-radius: 50%; transform: translate(-50%, -50%); } [part='legend-swatch'][data-pattern][data-icon='true'] { inline-size: var(--lr-size-1rem); block-size: var(--lr-size-1rem); border: none; border-radius: 0; background: none; } [part='legend-swatch'][data-icon='true']::before, [part='legend-swatch'][data-icon='true']::after { content: none; } .legend-icon { display: block; inline-size: 100%; block-size: 100%; } [part='legend-limit'] { min-inline-size: 0; padding-block-start: var(--lr-space-xs); border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); color: var(--lr-color-text-quiet); overflow-wrap: anywhere; } .maplibregl-control-container { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; pointer-events: none; } .map-control-row { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, max-content); justify-content: space-between; min-inline-size: 0; pointer-events: none; } .map-control-row-top { grid-row: 1; } .map-control-row-bottom { grid-row: 3; } .maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right, .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { position: relative; min-inline-size: 0; display: flex; flex-direction: column; align-items: flex-start; max-inline-size: 100%; z-index: var(--lr-layer-content); pointer-events: none; } .maplibregl-ctrl-top-right, .maplibregl-ctrl-bottom-right { align-items: flex-end; } .maplibregl-ctrl-top-left { grid-column: 1; } .maplibregl-ctrl-top-right { grid-column: 2; } .maplibregl-ctrl-bottom-left { grid-column: 1; justify-content: flex-end; } .maplibregl-ctrl-bottom-right { grid-column: 2; justify-content: flex-end; } .maplibregl-ctrl { box-sizing: border-box; max-inline-size: calc(100% - 2 * var(--lr-space-xs)); flex-shrink: 0; margin: var(--lr-space-xs); pointer-events: auto; transform: translate(0); } .maplibregl-ctrl-attrib { position: relative; padding: 0 var(--lr-space-xs); border-radius: var(--lr-radius); background: var(--lr-color-surface); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); } .maplibregl-ctrl-group { position: relative; display: flex; flex-direction: column; inline-size: fit-content; border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: var(--lr-color-surface); box-shadow: var(--lr-shadow); color: var(--lr-color-text); } .maplibregl-ctrl-group button { display: grid; place-items: center; ${iconHitTarget} padding: var(--lr-space-xs); border: 0; border-radius: inherit; background: transparent; color: inherit; font: inherit; cursor: pointer; transition: background-color var(--lr-transition-fast), color var(--lr-transition-fast); } .maplibregl-ctrl-group button:where(:not(:first-child)) { border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border); } .maplibregl-ctrl-group button:hover:where(:not(:disabled)) { background: var(--lr-color-brand-quiet); color: var(--lr-color-brand); } .maplibregl-ctrl-group button:active:where(:not(:disabled)) { background: color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } .maplibregl-ctrl-group button:focus-visible { outline: var(--lr-focus-ring); outline-offset: calc(-1 * var(--lr-focus-ring-offset)); } .maplibregl-ctrl-group button:disabled { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } .maplibregl-ctrl-icon { position: relative; display: block; inline-size: var(--lr-size-1em); block-size: var(--lr-size-1em); font-size: var(--lr-font-size-lg); } .maplibregl-ctrl-icon::before, .maplibregl-ctrl-compass .maplibregl-ctrl-icon::after { content: ''; position: absolute; inset: 0; background: currentColor; mask-position: center; mask-size: contain; mask-repeat: no-repeat; } .maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon::before { mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M12 5v14M5 12h14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/%3E%3C/svg%3E'); } .maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon::before { mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M5 12h14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/%3E%3C/svg%3E'); } .maplibregl-ctrl-compass .maplibregl-ctrl-icon::before { mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M12 2 18 12H6Z"/%3E%3C/svg%3E'); } .maplibregl-ctrl-compass .maplibregl-ctrl-icon::after { mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="m12 22 6-10H6Z"/%3E%3C/svg%3E'); opacity: var(--lr-opacity-disabled); } .maplibregl-ctrl-geolocate .maplibregl-ctrl-icon::before { mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Ccircle cx="12" cy="12" r="6" fill="none" stroke="currentColor" stroke-width="2"/%3E%3Ccircle cx="12" cy="12" r="2"/%3E%3Cpath d="M12 2v4m0 12v4M2 12h4m12 0h4" stroke="currentColor" stroke-width="2" stroke-linecap="round"/%3E%3C/svg%3E'); } .maplibregl-ctrl-scale { position: relative; box-sizing: border-box; min-inline-size: max-content; padding: var(--lr-space-2xs) var(--lr-space-xs); padding-block-end: calc(var(--lr-space-2xs) + var(--lr-space-xs)); background: var(--lr-color-surface); color: var(--lr-color-text); font-family: var(--lr-font); font-size: var(--lr-font-size-xs); text-align: center; white-space: nowrap; } .maplibregl-ctrl-scale::after { content: ''; display: var(--lr-map-scale-bar-display, block); position: absolute; inset-inline-start: 0; inset-block-end: 0; box-sizing: border-box; inline-size: var(--_lr-map-scale-width, 100%); block-size: var(--lr-space-xs); border: var(--lr-border-width-medium) solid currentColor; border-block-start: 0; pointer-events: none; } .maplibregl-ctrl-attrib a { display: inline-flex; align-items: center; min-inline-size: var(--lr-size-24px); min-block-size: var(--lr-size-24px); color: var(--lr-color-text-quiet); text-decoration: none; } .maplibregl-ctrl-attrib a:hover { text-decoration: underline; } .maplibregl-ctrl-attrib a:focus-visible { ${focusRing} } .maplibregl-ctrl-attrib-inner { overflow-wrap: anywhere; } .maplibregl-ctrl-attrib-button { display: none; position: absolute; inset-block-start: 0; inset-inline-end: 0; inline-size: var(--lr-icon-button-size); block-size: var(--lr-icon-button-size); padding: 0; border: 0; border-radius: var(--lr-radius-pill); background: transparent; color: var(--lr-color-text); cursor: pointer; place-items: center; transition: background-color var(--lr-transition-fast); } .maplibregl-ctrl-attrib-button::before { content: ''; display: block; inline-size: var(--lr-size-1rem); block-size: var(--lr-size-1rem); background: currentColor; mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Ccircle cx="12" cy="12" r="9" fill="none" stroke="currentColor" stroke-width="2"/%3E%3Cpath d="M12 10v7m0-10v.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/%3E%3C/svg%3E') center / contain no-repeat; } .maplibregl-ctrl-attrib.maplibregl-compact { position: relative; min-block-size: var(--lr-icon-button-size); padding-inline-end: var(--lr-icon-button-size); } .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner { display: none; } .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button { display: grid; } .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner { display: block; } .maplibregl-ctrl-attrib-button:hover, .maplibregl-ctrl-attrib-button:active, .maplibregl-ctrl-attrib:where([open]) .maplibregl-ctrl-attrib-button { background: var(--lr-color-brand-quiet); } .maplibregl-ctrl-attrib-button:focus-visible { outline: var(--lr-focus-ring); outline-offset: calc(-1 * var(--lr-focus-ring-offset)); } .maplibregl-ctrl-attrib summary { list-style: none; appearance: none; -webkit-appearance: none; } .maplibregl-ctrl-attrib summary::-webkit-details-marker { display: none; } .maplibregl-ctrl-attrib summary::marker { content: ''; } ${glassSurface(".maplibregl-ctrl-group, .maplibregl-ctrl-scale, .maplibregl-ctrl-attrib",css`var(--lr-color-surface)`)} ${glassScrollLayerStyles} [part='legend'] > .glass-scroll-layer { margin-block-end: calc(-1 * var(--lr-space-xs)); } ${glassSurface('[part="legend"]',css`var(--lr-color-surface)`,css`var(--lr-color-surface)`,!0)} @media (forced-colors: active) { .maplibregl-ctrl-attrib-button { color: ButtonText; } .maplibregl-ctrl-attrib-button::before { forced-color-adjust: none; } [part='legend-swatch'] { background: Canvas !important; border-color: CanvasText; color: CanvasText; } [part='legend-swatch'][data-pattern='solid'] { background: CanvasText !important; } [part='legend-swatch'][data-pattern][data-icon='true'] { background: Canvas !important; } button[part~='legend-toggle-hidden'] { text-decoration-line: line-through; text-decoration-thickness: var(--lr-border-width-medium); } } `;export{styles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createEngine3dLoader}from"../../../internal/engine-3d-loader.js";import{webgl2Available}from"../../../internal/engine-3d.js";import{tag}from"../../../internal/prefix.js";const modelEngineLoader=createEngine3dLoader({entry:"model",tag:tag("model-viewer"),load:()=>import("@aceshooting/lyra-3d/model")}),modelEngineEnvironment={available:document=>webgl2Available(()=>document.createElement("canvas"))};export{modelEngineEnvironment,modelEngineLoader};
|
|
1
|
+
import{createEngine3dLoader}from"../../../internal/engine-3d-loader.js";import{webgl2Available}from"../../../internal/engine-3d.js";import{tag}from"../../../internal/prefix.js";const modelEngineLoader=createEngine3dLoader({entry:"model",tag:tag("model-viewer"),load:()=>import("@aceshooting/lyra-3d/model")}),modelEngineEnvironment={available:document=>webgl2Available(()=>document.createElement("canvas"))};function supportsAsyncModelData(engine){return"setDataAsync"in engine&&typeof engine.setDataAsync=="function"}export{modelEngineEnvironment,modelEngineLoader,supportsAsyncModelData};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{HostDescriptionController}from"../../../internal/aria-controls.js";import{resolveCanvasColor}from"../../../internal/canvas-color.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{resolveGuardedRel}from"../../../internal/link-rel.js";import{safeDownloadHref}from"../../../internal/safe-url.js";import{isAbortError,isResourceLimitError,resolveOwnerFetchTarget}from"../../../internal/resource-loader.js";import{engine3dFailureReason}from"../../../internal/engine-3d.js";import{ViewerAnnouncementController}from"../viewer-announcements.js";import{modelEngineEnvironment,modelEngineLoader}from"./model-viewer-loader.js";import{MODEL_SOURCE_MAX_BYTES,DEFAULT_MODEL_CAMERA,readModelSource,resolveModelFormat,snapshotModelCamera}from"./model-viewer-source.js";import{styles}from"./model-viewer.styles.js";import{LYRA_DEFAULT_documentPreviewEmpty,LYRA_DEFAULT_download,LYRA_DEFAULT_engine3dContextLost,LYRA_DEFAULT_engine3dSoftwareRendering,LYRA_DEFAULT_engine3dUnavailable,LYRA_DEFAULT_engine3dUnsupported,LYRA_DEFAULT_retry,LYRA_DEFAULT_zoomIn,LYRA_DEFAULT_zoomOut}from"../../../internal/default-strings/shared.generated.js";import{LYRA_DEFAULT_documentPreviewResourceTooLarge,LYRA_DEFAULT_documentPreviewUrlNotAllowed,LYRA_DEFAULT_loadingDocument,LYRA_DEFAULT_modelViewerAlternative,LYRA_DEFAULT_modelViewerEmpty,LYRA_DEFAULT_modelViewerFit,LYRA_DEFAULT_modelViewerInstructions,LYRA_DEFAULT_modelViewerInvalid,LYRA_DEFAULT_modelViewerLabel,LYRA_DEFAULT_modelViewerProgress,LYRA_DEFAULT_modelViewerReady,LYRA_DEFAULT_modelViewerRotateDown,LYRA_DEFAULT_modelViewerRotateLeft,LYRA_DEFAULT_modelViewerRotateRight,LYRA_DEFAULT_modelViewerRotateUp,LYRA_DEFAULT_modelViewerUnsupportedFormat}from"../../../internal/default-strings/viewers.generated.js";const KEY_ACTIONS=Object.freeze({ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down","+":"in","=":"in","-":"out",Home:"fit"});class LyraModelViewer extends LyraElement{constructor(){super(...arguments),this._src="",this._name="",this._mimeType="",this._format="auto",this.authoredCamera=!1,this.alt="",this.target="_blank",this.rel="",this.status="idle",this.message="",this.software=!1,this.loaded=0,this.total=null,this.generation=0,this.observers=[],this.mediaCleanup=[],this.announcements=new ViewerAnnouncementController(this),this.descriptions=new HostDescriptionController(this,()=>this.viewport,()=>{const instructions=this.renderRoot.querySelector('[part="instructions"]');return instructions?[instructions]:[]})}static{this.defaultStrings={...super.defaultStrings,documentPreviewEmpty:LYRA_DEFAULT_documentPreviewEmpty,documentPreviewResourceTooLarge:LYRA_DEFAULT_documentPreviewResourceTooLarge,documentPreviewUrlNotAllowed:LYRA_DEFAULT_documentPreviewUrlNotAllowed,download:LYRA_DEFAULT_download,engine3dContextLost:LYRA_DEFAULT_engine3dContextLost,engine3dSoftwareRendering:LYRA_DEFAULT_engine3dSoftwareRendering,engine3dUnavailable:LYRA_DEFAULT_engine3dUnavailable,engine3dUnsupported:LYRA_DEFAULT_engine3dUnsupported,loadingDocument:LYRA_DEFAULT_loadingDocument,modelViewerAlternative:LYRA_DEFAULT_modelViewerAlternative,modelViewerEmpty:LYRA_DEFAULT_modelViewerEmpty,modelViewerFit:LYRA_DEFAULT_modelViewerFit,modelViewerInstructions:LYRA_DEFAULT_modelViewerInstructions,modelViewerInvalid:LYRA_DEFAULT_modelViewerInvalid,modelViewerLabel:LYRA_DEFAULT_modelViewerLabel,modelViewerProgress:LYRA_DEFAULT_modelViewerProgress,modelViewerReady:LYRA_DEFAULT_modelViewerReady,modelViewerRotateDown:LYRA_DEFAULT_modelViewerRotateDown,modelViewerRotateLeft:LYRA_DEFAULT_modelViewerRotateLeft,modelViewerRotateRight:LYRA_DEFAULT_modelViewerRotateRight,modelViewerRotateUp:LYRA_DEFAULT_modelViewerRotateUp,modelViewerUnsupportedFormat:LYRA_DEFAULT_modelViewerUnsupportedFormat,retry:LYRA_DEFAULT_retry,zoomIn:LYRA_DEFAULT_zoomIn,zoomOut:LYRA_DEFAULT_zoomOut}}static{this.styles=[LyraElement.styles,styles]}get src(){return this._src}set src(value){const next=typeof value=="string"?value:"",old=this._src;next!==old&&(this.retire(),this._src=next,this.requestUpdate("src",old))}get name(){return this._name}set name(value){const next=typeof value=="string"?value:"",old=this._name;next!==old&&(this.retire(),this._name=next,this.requestUpdate("name",old))}get mimeType(){return this._mimeType}set mimeType(value){const next=typeof value=="string"?value:"",old=this._mimeType;next!==old&&(this.retire(),this._mimeType=next,this.requestUpdate("mimeType",old))}get format(){return this._format}set format(value){const next=value??"auto",old=this._format;next!==old&&(this.retire(),this._format=next,this.requestUpdate("format",old))}get camera(){return this._camera}set camera(value){const next=value==null?void 0:snapshotModelCamera(value),old=this._camera;this._camera=next,this.authoredCamera=next!==void 0;try{next?this.engine?.setCamera(next):this.status==="ready"&&this.fit()}catch(error){this.fail("invalid","error",error)}this.requestUpdate("camera",old)}get viewport(){return this.renderRoot?.querySelector('[part="viewport"]')??null}connectedCallback(){super.connectedCallback(),this.announcements.connect(),this.hasUpdated&&this.scheduleAfterUpdate(()=>{this.load()})}disconnectedCallback(){this.retire(),this.announcements.disconnect(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.retire(),this.announcements.adopted(),this.descriptions.adopted(),this.isConnected&&this.scheduleAfterUpdate(()=>{this.load()})}updated(changed){super.updated(changed),this.announcements.transition("model",this.status,this.statusText(),this.status==="error"?"assertive":this.status==="ready"||this.status==="empty"||this.status==="loading"||this.status==="context-lost"?"polite":void 0),["src","name","mimeType","format"].some(key=>changed.has(key))&&this.scheduleAfterUpdate(()=>{this.load()})}retire(){this.generation++,this.controller?.abort(),this.controller=void 0;for(const observer of this.observers)observer.disconnect();this.observers=[];for(const cleanup of this.mediaCleanup)cleanup();this.mediaCleanup=[];const engine=this.engine;this.engine=void 0;try{engine?.dispose()}catch{}this.viewport?.replaceChildren(),this.status="idle",this.message="",this.software=!1,this.loaded=0,this.total=null}fail(message,reason,error){this.retire(),this.status="error",this.message=message,this.emit("lr-engine-fallback",{from:"webgl",to:"list",reason}),this.emit("lr-render-error",{error:error??new Error("Model engine unavailable")})}async load(){if(this.retire(),!this.src||!this.isConnected)return;const owner=this.ownerDocument,view=owner.defaultView,container=this.viewport;if(!view||!container)return;const generation=this.generation,controller=new view.AbortController;this.controller=controller;const current=()=>generation===this.generation&&!controller.signal.aborted&&this.isConnected&&this.ownerDocument===owner;if(this.src.length>MODEL_SOURCE_MAX_BYTES){this.fail("tooLarge","error");return}const format=resolveModelFormat(this.format,this.name,this.mimeType,this.src);if(!format){this.fail("unsupportedFormat","unsupported");return}if(!resolveOwnerFetchTarget(this,this.src)){this.fail("urlNotAllowed","error");return}if(!modelEngineEnvironment.available(owner)){this.fail("engineUnsupported","unsupported");return}this.status="loading";let candidate=null;try{const bytes=await readModelSource(this,this.src,controller.signal,current,(loaded,total)=>{current()&&(total!==this.total||loaded===total||loaded-this.loaded>=1048576)&&(this.loaded=loaded,this.total=total)});if(!current())return;if(candidate=await modelEngineLoader.create(),!current()){candidate?.dispose();return}if(!candidate){this.fail("engineUnavailable","unavailable");return}const engine=candidate;if(this.engine=engine,typeof engine.fit!="function"){this.fail("engineUnavailable","unavailable");return}engine.setStyle(this.engineStyle());let parsed=!1,contextLost=!1;const publishParsedView=()=>{!current()||contextLost||!parsed||(this.status=engine.positionOf?.(0)===null?"empty":"ready",this.message="",this.status==="ready"&&!this.authoredCamera&&this.fit())};if(await engine.mount(container,{hover:()=>{},pick:()=>{},camera:value=>{current()&&this.status==="ready"&&this.acceptCamera(value,!0)},progress:(loaded,total)=>{if(!(!current()||parsed||!Number.isFinite(loaded)||!Number.isFinite(total)||total<0||loaded<total))try{parsed=!0,publishParsedView(),current()&&this.emit("lr-load",{format})}catch(error){current()&&this.fail("invalid","error",error)}},lost:reason=>{if(current())if(reason==="context-lost"){if(contextLost)return;contextLost=!0,this.status="context-lost",this.message="contextLost",this.emit("lr-engine-fallback",{from:"webgl",to:"list",reason})}else this.fail("invalid","error")},rendering:info=>{current()&&(this.software=info.software)},restored:()=>{if(!(!current()||!contextLost))try{contextLost=!1,this.message="",parsed?publishParsedView():this.status="loading",current()&&this.refreshEngine()}catch(error){current()&&this.fail("invalid","error",error)}}}),!current()){this.engine===engine&&(this.engine=void 0,engine.dispose());return}if(container.querySelectorAll("canvas").forEach(canvas=>{canvas.setAttribute("aria-hidden","true"),canvas.removeAttribute("tabindex")}),this.authoredCamera&&this.camera&&engine.setCamera(this.camera),this.watchEnvironment(current),this.refreshEngine(),!current())return;engine.setData({bytes,format},generation)}catch(error){if(!current()||isAbortError(error))return;const reason=engine3dFailureReason(error);this.fail(isResourceLimitError(error)?"tooLarge":reason==="unsupported"?"engineUnsupported":"invalid",reason,error)}}engineStyle(){const view=this.ownerDocument.defaultView,computed=view.getComputedStyle(this),canvas=this.ownerDocument.createElement("canvas");canvas.width=canvas.height=1;const context=canvas.getContext("2d",{willReadFrequently:!0}),color=token=>{const resolved=resolveCanvasColor(this,`var(${token})`,computed.color);if(!context)return resolved;context.clearRect(0,0,1,1),context.fillStyle=resolved,context.fillRect(0,0,1,1);const rgba=context.getImageData(0,0,1,1).data;return`rgba(${rgba[0]}, ${rgba[1]}, ${rgba[2]}, ${rgba[3]/255})`};return{background:color("--lr-color-surface"),foreground:color("--lr-color-text"),muted:color("--lr-color-text-quiet"),accent:color("--lr-color-brand"),focus:color("--lr-focus-ring-color"),palette:[color("--lr-color-brand")],fontFamily:computed.fontFamily,fontSize:finiteRange(Number.parseFloat(computed.fontSize),14,1,128),pointSize:8,lineWidth:1,devicePixelRatio:finiteRange(view.devicePixelRatio,1,.25,4),reducedMotion:view.matchMedia("(prefers-reduced-motion: reduce)").matches,forcedColors:view.matchMedia("(forced-colors: active)").matches}}refreshEngine(){if(!(!this.engine||!this.isConnected))try{this.engine.setStyle(this.engineStyle());const box=this.viewport?.getBoundingClientRect();box&&this.engine.resize(Math.max(1,box.width),Math.max(1,box.height))}catch(error){this.fail("invalid","error",error)}}watchEnvironment(current){const view=this.ownerDocument.defaultView,refresh=()=>{current()&&this.refreshEngine()},resize=new view.ResizeObserver(refresh);resize.observe(this.viewport),this.observers.push(resize);const mutation=new view.MutationObserver(refresh);let ancestor=this;for(;ancestor;){mutation.observe(ancestor,{attributes:!0});const root=ancestor.getRootNode();ancestor=ancestor.parentElement??(root instanceof view.ShadowRoot?root.host:null)}this.observers.push(mutation);for(const query of["(prefers-reduced-motion: reduce)","(forced-colors: active)","(prefers-color-scheme: dark)"]){const media=view.matchMedia(query);media.addEventListener("change",refresh),this.mediaCleanup.push(()=>media.removeEventListener("change",refresh))}}acceptCamera(value,emit){let next;try{next=snapshotModelCamera(value)}catch{return}const old=this._camera;this._camera=next,this.requestUpdate("camera",old),emit&&(this.authoredCamera=!0,this.emit("lr-camera-change",{camera:next}))}fit(){if(this.engine&&this.status==="ready")try{this.acceptCamera(this.engine.fit?.(),!1)}catch(error){this.fail("invalid","error",error)}}retry(){this.retire(),this.scheduleAfterUpdate(()=>{this.load()})}move(action){if(!this.engine||this.status!=="ready")return;if(action==="fit"){const generation=this.generation;this.fit(),generation===this.generation&&this.status==="ready"&&this.camera&&this.emit("lr-camera-change",{camera:this.camera});return}const current=this.camera??DEFAULT_MODEL_CAMERA,horizontal=this.effectiveDirection==="rtl"?-1:1,next=snapshotModelCamera({...current,yaw:current.yaw+(action==="left"?-.1*horizontal:action==="right"?.1*horizontal:0),pitch:current.pitch+(action==="up"?.1:action==="down"?-.1:0),distance:current.distance*(action==="in"?.8:action==="out"?1.25:1)});try{this.engine.setCamera(next),this.acceptCamera(next,!0)}catch(error){this.fail("invalid","error",error)}}keydown(event){if(event.altKey||event.ctrlKey||event.metaKey||event.isComposing||event.currentTarget!==event.target||this.closest("[inert]"))return;const action=Object.hasOwn(KEY_ACTIONS,event.key)?KEY_ACTIONS[event.key]:void 0;!action||this.status!=="ready"||(event.preventDefault(),this.move(action))}statusText(){switch(this.message){case"tooLarge":return this.localize("documentPreviewResourceTooLarge");case"urlNotAllowed":return this.localize("documentPreviewUrlNotAllowed");case"unsupportedFormat":return this.localize("modelViewerUnsupportedFormat");case"invalid":return this.localize("modelViewerInvalid");case"engineUnsupported":return this.localize("engine3dUnsupported");case"engineUnavailable":return this.localize("engine3dUnavailable");case"contextLost":return this.localize("engine3dContextLost");default:break}if(this.status==="ready")return this.localize("modelViewerReady");if(this.status==="empty")return this.localize("modelViewerEmpty");if(this.status==="loading"){if(this.total===null)return this.localize("loadingDocument");const number=getNumberFormat(this.effectiveLocale);return this.localize("modelViewerProgress",void 0,{loaded:number.format(this.loaded),total:number.format(this.total)})}return this.localize("documentPreviewEmpty",void 0,{type:this.localize("modelViewerLabel")})}render(){const label=hostAriaLabel(this)??(this.name||this.localize("modelViewerLabel")),ready=this.status==="ready",href=this.src.length<=MODEL_SOURCE_MAX_BYTES?safeDownloadHref(this.src,this.ownerDocument?.defaultView?.URL??URL):null,controls=[["left",this.localize("modelViewerRotateLeft")],["right",this.localize("modelViewerRotateRight")],["up",this.localize("modelViewerRotateUp")],["down",this.localize("modelViewerRotateDown")],["in",this.localize("zoomIn")],["out",this.localize("zoomOut")],["fit",this.localize("modelViewerFit")]];return html`<section part="base" role="region" aria-label=${label}>
|
|
1
|
+
import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{HostDescriptionController}from"../../../internal/aria-controls.js";import{resolveCanvasColor}from"../../../internal/canvas-color.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{resolveGuardedRel}from"../../../internal/link-rel.js";import{safeDownloadHref}from"../../../internal/safe-url.js";import{isAbortError,isResourceLimitError,resolveOwnerFetchTarget}from"../../../internal/resource-loader.js";import{engine3dFailureReason}from"../../../internal/engine-3d.js";import{ViewerAnnouncementController}from"../viewer-announcements.js";import{modelEngineEnvironment,modelEngineLoader,supportsAsyncModelData}from"./model-viewer-loader.js";import{MODEL_SOURCE_MAX_BYTES,DEFAULT_MODEL_CAMERA,readModelSource,resolveModelFormat,snapshotModelCamera}from"./model-viewer-source.js";import{styles}from"./model-viewer.styles.js";import{LYRA_DEFAULT_documentPreviewEmpty,LYRA_DEFAULT_download,LYRA_DEFAULT_engine3dContextLost,LYRA_DEFAULT_engine3dSoftwareRendering,LYRA_DEFAULT_engine3dUnavailable,LYRA_DEFAULT_engine3dUnsupported,LYRA_DEFAULT_retry,LYRA_DEFAULT_zoomIn,LYRA_DEFAULT_zoomOut}from"../../../internal/default-strings/shared.generated.js";import{LYRA_DEFAULT_documentPreviewResourceTooLarge,LYRA_DEFAULT_documentPreviewUrlNotAllowed,LYRA_DEFAULT_loadingDocument,LYRA_DEFAULT_modelViewerAlternative,LYRA_DEFAULT_modelViewerEmpty,LYRA_DEFAULT_modelViewerFit,LYRA_DEFAULT_modelViewerInstructions,LYRA_DEFAULT_modelViewerInvalid,LYRA_DEFAULT_modelViewerLabel,LYRA_DEFAULT_modelViewerProgress,LYRA_DEFAULT_modelViewerReady,LYRA_DEFAULT_modelViewerRotateDown,LYRA_DEFAULT_modelViewerRotateLeft,LYRA_DEFAULT_modelViewerRotateRight,LYRA_DEFAULT_modelViewerRotateUp,LYRA_DEFAULT_modelViewerUnsupportedFormat}from"../../../internal/default-strings/viewers.generated.js";const KEY_ACTIONS=Object.freeze({ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down","+":"in","=":"in","-":"out",Home:"fit"});class LyraModelViewer extends LyraElement{constructor(){super(...arguments),this._src="",this._name="",this._mimeType="",this._format="auto",this.authoredCamera=!1,this.alt="",this.target="_blank",this.rel="",this.status="idle",this.message="",this.software=!1,this.loaded=0,this.total=null,this.generation=0,this.observers=[],this.mediaCleanup=[],this.announcements=new ViewerAnnouncementController(this),this.descriptions=new HostDescriptionController(this,()=>this.viewport,()=>{const instructions=this.renderRoot.querySelector('[part="instructions"]');return instructions?[instructions]:[]})}static{this.defaultStrings={...super.defaultStrings,documentPreviewEmpty:LYRA_DEFAULT_documentPreviewEmpty,documentPreviewResourceTooLarge:LYRA_DEFAULT_documentPreviewResourceTooLarge,documentPreviewUrlNotAllowed:LYRA_DEFAULT_documentPreviewUrlNotAllowed,download:LYRA_DEFAULT_download,engine3dContextLost:LYRA_DEFAULT_engine3dContextLost,engine3dSoftwareRendering:LYRA_DEFAULT_engine3dSoftwareRendering,engine3dUnavailable:LYRA_DEFAULT_engine3dUnavailable,engine3dUnsupported:LYRA_DEFAULT_engine3dUnsupported,loadingDocument:LYRA_DEFAULT_loadingDocument,modelViewerAlternative:LYRA_DEFAULT_modelViewerAlternative,modelViewerEmpty:LYRA_DEFAULT_modelViewerEmpty,modelViewerFit:LYRA_DEFAULT_modelViewerFit,modelViewerInstructions:LYRA_DEFAULT_modelViewerInstructions,modelViewerInvalid:LYRA_DEFAULT_modelViewerInvalid,modelViewerLabel:LYRA_DEFAULT_modelViewerLabel,modelViewerProgress:LYRA_DEFAULT_modelViewerProgress,modelViewerReady:LYRA_DEFAULT_modelViewerReady,modelViewerRotateDown:LYRA_DEFAULT_modelViewerRotateDown,modelViewerRotateLeft:LYRA_DEFAULT_modelViewerRotateLeft,modelViewerRotateRight:LYRA_DEFAULT_modelViewerRotateRight,modelViewerRotateUp:LYRA_DEFAULT_modelViewerRotateUp,modelViewerUnsupportedFormat:LYRA_DEFAULT_modelViewerUnsupportedFormat,retry:LYRA_DEFAULT_retry,zoomIn:LYRA_DEFAULT_zoomIn,zoomOut:LYRA_DEFAULT_zoomOut}}static{this.styles=[LyraElement.styles,styles]}get src(){return this._src}set src(value){const next=typeof value=="string"?value:"",old=this._src;next!==old&&(this.retire(),this._src=next,this.requestUpdate("src",old))}get name(){return this._name}set name(value){const next=typeof value=="string"?value:"",old=this._name;next!==old&&(this.retire(),this._name=next,this.requestUpdate("name",old))}get mimeType(){return this._mimeType}set mimeType(value){const next=typeof value=="string"?value:"",old=this._mimeType;next!==old&&(this.retire(),this._mimeType=next,this.requestUpdate("mimeType",old))}get format(){return this._format}set format(value){const next=value??"auto",old=this._format;next!==old&&(this.retire(),this._format=next,this.requestUpdate("format",old))}get camera(){return this._camera}set camera(value){const next=value==null?void 0:snapshotModelCamera(value),old=this._camera;this._camera=next,this.authoredCamera=next!==void 0;try{next?this.engine?.setCamera(next):this.status==="ready"&&this.fit()}catch(error){this.fail("invalid","error",error)}this.requestUpdate("camera",old)}get viewport(){return this.renderRoot?.querySelector('[part="viewport"]')??null}connectedCallback(){super.connectedCallback(),this.announcements.connect(),this.hasUpdated&&this.scheduleAfterUpdate(()=>{this.load()})}disconnectedCallback(){this.retire(),this.announcements.disconnect(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.retire(),this.announcements.adopted(),this.descriptions.adopted(),this.isConnected&&this.scheduleAfterUpdate(()=>{this.load()})}updated(changed){super.updated(changed),this.announcements.transition("model",this.status,this.statusText(),this.status==="error"?"assertive":this.status==="ready"||this.status==="empty"||this.status==="loading"||this.status==="context-lost"?"polite":void 0),["src","name","mimeType","format"].some(key=>changed.has(key))&&this.scheduleAfterUpdate(()=>{this.load()})}retire(){this.generation++,this.controller?.abort(),this.controller=void 0;for(const observer of this.observers)observer.disconnect();this.observers=[];for(const cleanup of this.mediaCleanup)cleanup();this.mediaCleanup=[];const engine=this.engine;this.engine=void 0;try{engine?.dispose()}catch{}this.viewport?.replaceChildren(),this.status="idle",this.message="",this.software=!1,this.loaded=0,this.total=null}fail(message,reason,error){this.retire(),this.status="error",this.message=message,this.emit("lr-engine-fallback",{from:"webgl",to:"list",reason}),this.emit("lr-render-error",{error:error??new Error("Model engine unavailable")})}async load(){if(this.retire(),!this.src||!this.isConnected)return;const owner=this.ownerDocument,view=owner.defaultView,container=this.viewport;if(!view||!container)return;const generation=this.generation,controller=new view.AbortController;this.controller=controller;const current=()=>generation===this.generation&&!controller.signal.aborted&&this.isConnected&&this.ownerDocument===owner;if(this.src.length>MODEL_SOURCE_MAX_BYTES){this.fail("tooLarge","error");return}const format=resolveModelFormat(this.format,this.name,this.mimeType,this.src);if(!format){this.fail("unsupportedFormat","unsupported");return}if(!resolveOwnerFetchTarget(this,this.src)){this.fail("urlNotAllowed","error");return}if(!modelEngineEnvironment.available(owner)){this.fail("engineUnsupported","unsupported");return}this.status="loading";let candidate=null;try{const bytes=await readModelSource(this,this.src,controller.signal,current,(loaded,total)=>{current()&&(total!==this.total||loaded===total||loaded-this.loaded>=1048576)&&(this.loaded=loaded,this.total=total)});if(!current())return;if(candidate=await modelEngineLoader.create(),!current()){candidate?.dispose();return}if(!candidate){this.fail("engineUnavailable","unavailable");return}const engine=candidate;if(this.engine=engine,typeof engine.fit!="function"){this.fail("engineUnavailable","unavailable");return}engine.setStyle(this.engineStyle());let parsed=!1,contextLost=!1;const publishParsedView=()=>{!current()||contextLost||!parsed||(this.status=engine.positionOf?.(0)===null?"empty":"ready",this.message="",this.status==="ready"&&!this.authoredCamera&&this.fit())};if(await engine.mount(container,{hover:()=>{},pick:()=>{},camera:value=>{current()&&this.status==="ready"&&this.acceptCamera(value,!0)},progress:(loaded,total)=>{if(!(!current()||parsed||!Number.isFinite(loaded)||!Number.isFinite(total)||total<0||loaded<total))try{parsed=!0,publishParsedView(),current()&&this.emit("lr-load",{format})}catch(error){current()&&this.fail("invalid","error",error)}},lost:reason=>{if(current())if(reason==="context-lost"){if(contextLost)return;contextLost=!0,this.status="context-lost",this.message="contextLost",this.emit("lr-engine-fallback",{from:"webgl",to:"list",reason})}else this.fail("invalid","error")},rendering:info=>{current()&&(this.software=info.software)},restored:()=>{if(!(!current()||!contextLost))try{contextLost=!1,this.message="",parsed?publishParsedView():this.status="loading",current()&&this.refreshEngine()}catch(error){current()&&this.fail("invalid","error",error)}}}),!current()){this.engine===engine&&(this.engine=void 0,engine.dispose());return}if(container.querySelectorAll("canvas").forEach(canvas=>{canvas.setAttribute("aria-hidden","true"),canvas.removeAttribute("tabindex")}),this.authoredCamera&&this.camera&&engine.setCamera(this.camera),this.watchEnvironment(current),this.refreshEngine(),!current())return;if(supportsAsyncModelData(engine)){if(await engine.setDataAsync({bytes,format},generation,{signal:controller.signal}),!current())return}else engine.setData({bytes,format},generation)}catch(error){if(!current()||isAbortError(error))return;const reason=engine3dFailureReason(error);this.fail(isResourceLimitError(error)?"tooLarge":reason==="unsupported"?"engineUnsupported":"invalid",reason,error)}}engineStyle(){const view=this.ownerDocument.defaultView,computed=view.getComputedStyle(this),canvas=this.ownerDocument.createElement("canvas");canvas.width=canvas.height=1;const context=canvas.getContext("2d",{willReadFrequently:!0}),color=token=>{const resolved=resolveCanvasColor(this,`var(${token})`,computed.color);if(!context)return resolved;context.clearRect(0,0,1,1),context.fillStyle=resolved,context.fillRect(0,0,1,1);const rgba=context.getImageData(0,0,1,1).data;return`rgba(${rgba[0]}, ${rgba[1]}, ${rgba[2]}, ${rgba[3]/255})`};return{background:color("--lr-color-surface"),foreground:color("--lr-color-text"),muted:color("--lr-color-text-quiet"),accent:color("--lr-color-brand"),focus:color("--lr-focus-ring-color"),palette:[color("--lr-color-brand")],fontFamily:computed.fontFamily,fontSize:finiteRange(Number.parseFloat(computed.fontSize),14,1,128),pointSize:8,lineWidth:1,devicePixelRatio:finiteRange(view.devicePixelRatio,1,.25,4),reducedMotion:view.matchMedia("(prefers-reduced-motion: reduce)").matches,forcedColors:view.matchMedia("(forced-colors: active)").matches}}refreshEngine(){if(!(!this.engine||!this.isConnected))try{this.engine.setStyle(this.engineStyle());const box=this.viewport?.getBoundingClientRect();box&&this.engine.resize(Math.max(1,box.width),Math.max(1,box.height))}catch(error){this.fail("invalid","error",error)}}watchEnvironment(current){const view=this.ownerDocument.defaultView,refresh=()=>{current()&&this.refreshEngine()},resize=new view.ResizeObserver(refresh);resize.observe(this.viewport),this.observers.push(resize);const mutation=new view.MutationObserver(refresh);let ancestor=this;for(;ancestor;){mutation.observe(ancestor,{attributes:!0});const root=ancestor.getRootNode();ancestor=ancestor.parentElement??(root instanceof view.ShadowRoot?root.host:null)}this.observers.push(mutation);for(const query of["(prefers-reduced-motion: reduce)","(forced-colors: active)","(prefers-color-scheme: dark)"]){const media=view.matchMedia(query);media.addEventListener("change",refresh),this.mediaCleanup.push(()=>media.removeEventListener("change",refresh))}}acceptCamera(value,emit){let next;try{next=snapshotModelCamera(value)}catch{return}const old=this._camera;this._camera=next,this.requestUpdate("camera",old),emit&&(this.authoredCamera=!0,this.emit("lr-camera-change",{camera:next}))}fit(){if(this.engine&&this.status==="ready")try{this.acceptCamera(this.engine.fit?.(),!1)}catch(error){this.fail("invalid","error",error)}}retry(){this.retire(),this.scheduleAfterUpdate(()=>{this.load()})}move(action){if(!this.engine||this.status!=="ready")return;if(action==="fit"){const generation=this.generation;this.fit(),generation===this.generation&&this.status==="ready"&&this.camera&&this.emit("lr-camera-change",{camera:this.camera});return}const current=this.camera??DEFAULT_MODEL_CAMERA,horizontal=this.effectiveDirection==="rtl"?-1:1,next=snapshotModelCamera({...current,yaw:current.yaw+(action==="left"?-.1*horizontal:action==="right"?.1*horizontal:0),pitch:current.pitch+(action==="up"?.1:action==="down"?-.1:0),distance:current.distance*(action==="in"?.8:action==="out"?1.25:1)});try{this.engine.setCamera(next),this.acceptCamera(next,!0)}catch(error){this.fail("invalid","error",error)}}keydown(event){if(event.altKey||event.ctrlKey||event.metaKey||event.isComposing||event.currentTarget!==event.target||this.closest("[inert]"))return;const action=Object.hasOwn(KEY_ACTIONS,event.key)?KEY_ACTIONS[event.key]:void 0;!action||this.status!=="ready"||(event.preventDefault(),this.move(action))}statusText(){switch(this.message){case"tooLarge":return this.localize("documentPreviewResourceTooLarge");case"urlNotAllowed":return this.localize("documentPreviewUrlNotAllowed");case"unsupportedFormat":return this.localize("modelViewerUnsupportedFormat");case"invalid":return this.localize("modelViewerInvalid");case"engineUnsupported":return this.localize("engine3dUnsupported");case"engineUnavailable":return this.localize("engine3dUnavailable");case"contextLost":return this.localize("engine3dContextLost");default:break}if(this.status==="ready")return this.localize("modelViewerReady");if(this.status==="empty")return this.localize("modelViewerEmpty");if(this.status==="loading"){if(this.total===null)return this.localize("loadingDocument");const number=getNumberFormat(this.effectiveLocale);return this.localize("modelViewerProgress",void 0,{loaded:number.format(this.loaded),total:number.format(this.total)})}return this.localize("documentPreviewEmpty",void 0,{type:this.localize("modelViewerLabel")})}render(){const label=hostAriaLabel(this)??(this.name||this.localize("modelViewerLabel")),ready=this.status==="ready",href=this.src.length<=MODEL_SOURCE_MAX_BYTES?safeDownloadHref(this.src,this.ownerDocument?.defaultView?.URL??URL):null,controls=[["left",this.localize("modelViewerRotateLeft")],["right",this.localize("modelViewerRotateRight")],["up",this.localize("modelViewerRotateUp")],["down",this.localize("modelViewerRotateDown")],["in",this.localize("zoomIn")],["out",this.localize("zoomOut")],["fit",this.localize("modelViewerFit")]];return html`<section part="base" role="region" aria-label=${label}>
|
|
2
2
|
<div part="viewport" role="group" aria-label=${label} aria-busy=${String(this.status==="loading")} tabindex=${ready?"0":"-1"} ?data-ready=${ready} ?hidden=${this.status==="idle"||this.status==="empty"||this.status==="error"} @keydown=${this.keydown}></div>
|
|
3
3
|
<div part="toolbar">${controls.map(([action,label2])=>html`<button part="control" type="button" ?disabled=${!ready} @click=${()=>this.move(action)}>${label2}</button>`)}</div>
|
|
4
4
|
<p part="instructions">${this.localize("modelViewerInstructions")}</p>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraSearchChangeDetail,type LyraTextViewerTargetEventMap}from'../../../internal/text-viewer-target.js';import type{AnchorResultDetail,LyraAnchor,LyraAnchorKind,TextSelectDetail}from'../document-viewer/anchors.js';import type{LyraViewerDiagnosticEventDetail}from'../viewer-diagnostics.js';import type{LyraPageViewerSnapshot,LyraPageViewerStateChangeDetail,PageThumbnailRenderHandle}from'../page-rail/page-rail.class.js';export type{LyraViewerDiagnostic,LyraViewerDiagnosticCode,LyraViewerDiagnosticEventDetail,LyraViewerDiagnosticSeverity,}from'../viewer-diagnostics.js';export interface LyraPptxViewerEventMap extends LyraTextViewerTargetEventMap{'lr-load':CustomEvent<{slideCount:number;}>;'lr-slide-change':CustomEvent<{index:number;count:number;}>;'lr-render-error':CustomEvent<{error:unknown;}>;'lr-search-change':CustomEvent<LyraSearchChangeDetail>;'lr-anchor-result':CustomEvent<AnchorResultDetail>;'lr-text-select':CustomEvent<TextSelectDetail>;'lr-viewer-diagnostic':CustomEvent<LyraViewerDiagnosticEventDetail>;'lr-page-viewer-state-change':CustomEvent<LyraPageViewerStateChangeDetail>;}declare class LyraPptxViewerBase extends LyraElement<LyraPptxViewerEventMap>{}declare const LyraPptxViewer_base:Omit<typeof LyraPptxViewerBase,'prototype'> &(new(...args:ConstructorParameters<typeof LyraPptxViewerBase>)=>InstanceType<typeof LyraPptxViewerBase> &import("../../../lyra.js").LyraTextViewerTarget&import("../../../internal/text-viewer-target.js").TextViewerTargetHooks&{renderAnchorLiveRegion():unknown;});
|
|
2
2
|
/**
|
|
3
|
-
* Best-effort client-side PPTX viewer
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
3
|
+
* Best-effort client-side PPTX viewer with optional `@aiden0z/pptx-renderer`.
|
|
4
|
+
* An always-visible fidelity notice covers unrendered animations, equations, embedded OLE
|
|
5
|
+
* objects, notes, and several advanced effects.
|
|
6
|
+
* Remote bytes and measured ZIP expansion are bounded before renderer parsing. Peers lacking
|
|
7
|
+
* complete, safely bounded ZIP limits fail closed.
|
|
8
|
+
* Slides and thumbnails block external images, picture fills, audio, video, and posters linked
|
|
9
|
+
* by the presentation. Embedded package media remains; linked media is omitted or gets a placeholder.
|
|
10
|
+
* Click-driven hyperlinks are unchanged.
|
|
11
|
+
* `text-quote` searches all slides, preferring `prefix`/`suffix` matches; `page` navigates one-based slides.
|
|
12
|
+
* Lyra assigns no slide fragment IDs. Fragments require exact DOM IDs in mounted renderer output;
|
|
13
|
+
* these IDs are unstable. Use `page`/`goToSlide()` or `text-quote`.
|
|
14
14
|
*
|
|
15
15
|
* @customElement lr-pptx-viewer
|
|
16
16
|
* @event lr-load - Fired after a presentation opens. `detail: { slideCount }`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{srOnly}from"../../../internal/a11y.js";import{finiteInteger}from"../../../internal/numbers.js";import{TextViewerTarget}from"../../../internal/text-viewer-target.js";import{isAbortError,isResourceLimitError,LyraUserFacingError,readResponseArrayBuffer,resolveOwnerFetchTarget}from"../../../internal/resource-loader.js";import{sanitizeCssLength}from"../../../internal/safe-css.js";import{adaptPptxViewer,getPptxRenderer}from"./pptx-loader.js";import{assertPptxArchiveWithinLimits}from"./pptx-resource-guard.js";import{styles}from"./pptx-viewer.styles.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{ViewerAnnouncementController}from"../viewer-announcements.js";import{DeferredTeardown}from"../../../internal/deferred-teardown.js";import{textQuoteContextScore}from"../document-viewer/anchors.js";import{PageViewerSnapshotController}from"../page-rail/page-viewer-snapshot.js";import{viewerSemanticLabel,viewerSemanticRole}from"../viewer-semantic-owner.js";import{renderViewerLoading,viewerLoadingStyles}from"../viewer-loading.js";import{renderViewerPagerButton,viewerPagerStyles}from"../viewer-pager.js";import{boundedViewerSearchQuery,ViewerSearchWorkBudget}from"../viewer-search-limits.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{LYRA_DEFAULT_anchorJumped,LYRA_DEFAULT_anchorJumpedToPage,LYRA_DEFAULT_anchorNotFound,LYRA_DEFAULT_loading}from"../../../internal/default-strings/shared.generated.js";import{LYRA_DEFAULT_documentPreviewFailedToLoad,LYRA_DEFAULT_documentPreviewResourceTooLarge,LYRA_DEFAULT_documentPreviewUrlNotAllowed,LYRA_DEFAULT_pptxViewerFidelityNotice,LYRA_DEFAULT_pptxViewerLabel,LYRA_DEFAULT_pptxViewerMissingLibrary,LYRA_DEFAULT_pptxViewerNextSlide,LYRA_DEFAULT_pptxViewerPreviousSlide,LYRA_DEFAULT_pptxViewerRenderError,LYRA_DEFAULT_pptxViewerSlideOf}from"../../../internal/default-strings/viewers.generated.js";const MAX_PPTX_SEARCH_MATCHES=1e4,MAX_PPTX_THUMBNAIL_WIDTH=2048;class LyraPptxViewerBase extends LyraElement{}class LyraPptxViewer extends TextViewerTarget(LyraPptxViewerBase){constructor(){super(...arguments),this.src="",this.name="",this.page=1,this.maxHeight="",this.phase="idle",this.errorMessage="",this.slideCount=0,this.currentSlideIndex=0,this.loadRenderer=getPptxRenderer,this.generation=0,this.announcements=new ViewerAnnouncementController(this),this.pptxSearchQuery="",this.lastSearchLocale="",this.pptxSearchMatches=[],this.pendingSearchResetEvent=!1,this.pptxSearchMatchCountExact=!0,this.pptxSearchActiveIndex=-1,this.pptxSearchGeneration=0,this.pageViewerState=new PageViewerSnapshotController,this.anchorKinds=["text-quote","fragment","page"],this.onViewerEvent=event=>{if(event.kind==="slide-change"){this.commitSlide(event.index);return}this.reportPeerDiagnostic(event.code,event.cause,{page:event.page,nodeId:event.nodeId},event.fatal)},this.focusedPagerPart=null,this.detached=new DeferredTeardown(()=>this.releaseDetachedPresentation())}static{this.defaultStrings={...super.defaultStrings,anchorJumped:LYRA_DEFAULT_anchorJumped,anchorJumpedToPage:LYRA_DEFAULT_anchorJumpedToPage,anchorNotFound:LYRA_DEFAULT_anchorNotFound,documentPreviewFailedToLoad:LYRA_DEFAULT_documentPreviewFailedToLoad,documentPreviewResourceTooLarge:LYRA_DEFAULT_documentPreviewResourceTooLarge,documentPreviewUrlNotAllowed:LYRA_DEFAULT_documentPreviewUrlNotAllowed,loading:LYRA_DEFAULT_loading,pptxViewerFidelityNotice:LYRA_DEFAULT_pptxViewerFidelityNotice,pptxViewerLabel:LYRA_DEFAULT_pptxViewerLabel,pptxViewerMissingLibrary:LYRA_DEFAULT_pptxViewerMissingLibrary,pptxViewerNextSlide:LYRA_DEFAULT_pptxViewerNextSlide,pptxViewerPreviousSlide:LYRA_DEFAULT_pptxViewerPreviousSlide,pptxViewerRenderError:LYRA_DEFAULT_pptxViewerRenderError,pptxViewerSlideOf:LYRA_DEFAULT_pptxViewerSlideOf}}static{this.styles=[LyraElement.styles,styles,viewerPagerStyles,srOnly,viewerLoadingStyles]}async search(query2){const generation=++this.pptxSearchGeneration,viewer=this.viewer,boundedQuery=boundedViewerSearchQuery(query2,this.effectiveLocale);if(this.pptxSearchQuery=query2,this.lastSearchLocale=this.effectiveLocale,this.disposeSearchHighlight(),viewer?.clearSearchHighlights(),!boundedQuery.accepted)return this.pptxSearchMatches=[],this.pptxSearchMatchCountExact=!1,this.pptxSearchActiveIndex=-1,this.emitPptxSearchChange(),0;if(!viewer||!boundedQuery.needle)return this.pptxSearchMatches=[],this.pptxSearchMatchCountExact=!0,this.pptxSearchActiveIndex=-1,this.emitPptxSearchChange(),0;try{const raw=viewer.searchText(query2.trim(),{matchCase:!1});if(generation!==this.pptxSearchGeneration||viewer!==this.viewer)return this.pptxSearchMatches.length;const normalized=this.normalizeSearchResults(raw,viewer.slideCount);return this.pptxSearchMatches=normalized.matches,this.pptxSearchMatchCountExact=normalized.matchCountExact,this.pptxSearchActiveIndex=this.pptxSearchMatches.length>0?0:-1,this.emitPptxSearchChange(),this.pptxSearchActiveIndex>=0&&await this.focusPptxSearchMatch(this.pptxSearchActiveIndex,generation,viewer),this.pptxSearchMatches.length}catch(cause){return generation!==this.pptxSearchGeneration||viewer!==this.viewer||(this.pptxSearchMatches=[],this.pptxSearchMatchCountExact=!1,this.pptxSearchActiveIndex=-1,this.reportPeerDiagnostic("pptx-search-error",cause),this.emitPptxSearchChange()),0}}async searchNext(){const viewer=this.viewer;if(!viewer||this.pptxSearchMatches.length===0)return!1;const generation=++this.pptxSearchGeneration;return this.pptxSearchActiveIndex=(this.pptxSearchActiveIndex+1)%this.pptxSearchMatches.length,this.emitPptxSearchChange(),await this.focusPptxSearchMatch(this.pptxSearchActiveIndex,generation,viewer),generation===this.pptxSearchGeneration}async searchPrevious(){const viewer=this.viewer;if(!viewer||this.pptxSearchMatches.length===0)return!1;const generation=++this.pptxSearchGeneration;return this.pptxSearchActiveIndex=(this.pptxSearchActiveIndex-1+this.pptxSearchMatches.length)%this.pptxSearchMatches.length,this.emitPptxSearchChange(),await this.focusPptxSearchMatch(this.pptxSearchActiveIndex,generation,viewer),generation===this.pptxSearchGeneration}clearSearch(){this.pptxSearchGeneration++,this.pptxSearchQuery="",this.pptxSearchMatches=[],this.pptxSearchMatchCountExact=!0,this.pptxSearchActiveIndex=-1,this.disposeSearchHighlight(),this.viewer?.clearSearchHighlights(),this.emitPptxSearchChange()}get pageViewerSnapshot(){return this.pageViewerState.value}set pageViewerSnapshot(_value){}textContentRoot(){return this.renderRoot.querySelector('[part="container"]')??this.renderRoot.querySelector('[part="base"]')}async applyAnchor(anchor){const viewer=this.viewer;if(anchor.kind==="page"){const index=anchor.page-1;return!viewer||!Number.isInteger(anchor.page)||index<0||index>=this.slideCount?!1:(await this.goToSlide(index),viewer===this.viewer&&this.currentSlideIndex===index)}if(anchor.kind==="text-quote"&&viewer){const slideIndex=this.slideForTextQuote(viewer,anchor);if(slideIndex>=0&&slideIndex!==this.currentSlideIndex){if(await this.goToSlide(slideIndex),viewer!==this.viewer||this.currentSlideIndex!==slideIndex)return!1;await this.updateComplete}}return this.applyMountedAnchor(anchor)}applyMountedAnchor(anchor){return Object.getPrototypeOf(LyraPptxViewer.prototype).applyAnchor.call(this,anchor)}slideForTextQuote(viewer,anchor){const quote=anchor.quote.trim(),bounded=boundedViewerSearchQuery(quote,this.effectiveLocale);if(!bounded.accepted||!bounded.needle)return-1;let matches;try{matches=this.normalizeSearchResults(viewer.searchText(quote,{matchCase:!1}),viewer.slideCount).matches}catch(cause){return this.reportPeerDiagnostic("pptx-search-error",cause),-1}let best,bestScore=-1;for(const match of matches){const score=textQuoteContextScore(match.text,match.matchStart,match.matchEnd,anchor.prefix,anchor.suffix);score>bestScore&&(best=match,bestScore=score)}return best?.slideIndex??-1}keepPagerFocus(){const part=this.focusedPagerPart;this.focusedPagerPart=null;const twin=part==="previous-button"?"next-button":part==="next-button"?"previous-button":void 0,root=this.shadowRoot;!twin||!root||root.querySelector(`[part="${part}"]`)?.disabled&&root.querySelector(`[part="${twin}"]:not(:disabled)`)?.focus()}updated(changed){if(super.updated(changed),this.keepPagerFocus(),this.announcements.transition("load",this.phase,this.phase==="error"?this.errorMessage:this.localize("loading")),changed.has("src")&&this.scheduleAfterUpdate(()=>{this.mount()}),changed.has("src")&&this.pendingSearchResetEvent&&(this.pendingSearchResetEvent=!1,this.emitPptxSearchChange()),changed.has("page")&&this.viewer&&this.page-1!==this.currentSlideIndex){const page=this.page;this.scheduleAfterUpdate(()=>{this.page===page&&this.goToSlide(page-1)},"page-navigation")}const locale=this.effectiveLocale;if(locale!==this.lastSearchLocale){const shouldRecompute=this.pptxSearchQuery!=="";this.lastSearchLocale=locale,shouldRecompute&&this.scheduleAfterUpdate(()=>{this.search(this.pptxSearchQuery)},"search")}}willUpdate(changed){super.willUpdate(changed);const active=shadowFocusTarget(this);this.focusedPagerPart=active?.localName==="button"&&!active.disabled?active.getAttribute("part"):null,changed.has("src")&&(this.pendingSearchResetEvent||=this.hasPptxSearchState(),this.resetPptxSearchState()),(changed.has("page")||changed.has("slideCount"))&&(this.page=finiteInteger(this.page,1,1,Math.max(1,this.slideCount)))}connectedCallback(){super.connectedCallback(),this.announcements.connect();const moved=this.detached.cancel();this.hasUpdated&&this.src&&!moved&&this.scheduleAfterUpdate(()=>{this.mount()})}disconnectedCallback(){this.announcements.disconnect(),super.disconnectedCallback(),this.detached.schedule()}releaseDetachedPresentation(){this.teardown(),this.phase="idle",this.slideCount=0,this.currentSlideIndex=0,this.page=1,this.pageViewerState.reset()}adoptedCallback(){super.adoptedCallback(),this.detached.flush(),this.announcements.adopted()}async goToSlide(index){const viewer=this.viewer;if(!viewer||!Number.isSafeInteger(index)||index<0||index>=viewer.slideCount)return;const generation=this.generation;try{await viewer.goToSlide(index)}catch(error){if(isAbortError(error)||!this.isConnected||generation!==this.generation||viewer!==this.viewer)return;this.teardown(),this.phase="error",this.slideCount=0,this.currentSlideIndex=0,this.page=1,this.errorMessage=this.localize("pptxViewerRenderError"),this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error});return}viewer===this.viewer&&viewer.currentSlideIndex!==this.currentSlideIndex&&this.commitSlide(viewer.currentSlideIndex)}async renderPageThumbnailToContainer(page,container,options){const viewer=this.viewer,generation=this.generation,width=options?.width??96;if(!viewer||!Number.isSafeInteger(page)||page<1||page>viewer.slideCount||!Number.isFinite(width)||width<=0||width>MAX_PPTX_THUMBNAIL_WIDTH)return!1;const previousChildren=[...container.childNodes],restorePreviousChildren=()=>{container.replaceChildren(...previousChildren)};let handle;try{handle=viewer.renderThumbnailToContainer(page-1,container,{width})}catch{return restorePreviousChildren(),!1}if(!handle)return restorePreviousChildren(),!1;try{await handle.ready}catch{return handle.dispose(),restorePreviousChildren(),!1}if(generation!==this.generation||viewer!==this.viewer||!container.isConnected)return handle.dispose(),restorePreviousChildren(),!1;for(const child of previousChildren)child.parentNode===container&&child.remove();return handle}isValidSlideIndex(index){return Number.isSafeInteger(index)&&index>=0&&index<this.slideCount}commitSlide(index){if(!this.isValidSlideIndex(index))return;const changed=index!==this.currentSlideIndex;this.currentSlideIndex=index,this.page=index+1,this.publishPageViewerSnapshot("ready",this.slideCount),changed&&this.emit("lr-slide-change",{index,count:this.slideCount})}publishPageViewerSnapshot(status,pageCount){const snapshot=this.pageViewerState.publish(status,finiteInteger(this.page,1,1,Math.max(1,pageCount)),finiteInteger(pageCount,0,0,Number.MAX_SAFE_INTEGER));snapshot&&this.isConnected&&this.emit("lr-page-viewer-state-change",{snapshot})}teardown(){const shouldEmitSearchReset=this.hasPptxSearchState();this.generation++,this.viewerUnsubscribe?.(),this.viewerUnsubscribe=void 0,this.viewer?.destroy(),this.viewer=void 0,this.resetPptxSearchState(),shouldEmitSearchReset&&this.emitPptxSearchChange()}hasPptxSearchState(){return this.pptxSearchQuery!==""||this.pptxSearchMatches.length>0||!this.pptxSearchMatchCountExact||this.pptxSearchActiveIndex!==-1}resetPptxSearchState(){this.pptxSearchGeneration++,this.disposeSearchHighlight(),this.viewer?.clearSearchHighlights(),this.pptxSearchQuery="",this.pptxSearchMatches=[],this.pptxSearchMatchCountExact=!0,this.pptxSearchActiveIndex=-1}normalizeSearchResults(value,slideCount){if(!Array.isArray(value))throw new TypeError("PPTX search returned a non-array result.");const matches=[],work=new ViewerSearchWorkBudget;let matchCountExact=!0;for(const candidate of value){if(!work.consume("")){matchCountExact=!1;break}if(!candidate||typeof candidate!="object")continue;const result=candidate;if(!(!Number.isSafeInteger(result.slideIndex)||result.slideIndex<0||result.slideIndex>=slideCount||typeof result.nodeId!="string"||typeof result.text!="string"||!Number.isSafeInteger(result.matchStart)||!Number.isSafeInteger(result.matchEnd)||result.matchStart<0||result.matchEnd<result.matchStart||result.matchEnd>result.text.length)){if(!work.consume(result.nodeId)||!work.consume(result.text)){matchCountExact=!1;break}if(matches.length===MAX_PPTX_SEARCH_MATCHES){matchCountExact=!1;break}matches.push(candidate)}}return{matches,matchCountExact:matchCountExact&&work.complete}}async focusPptxSearchMatch(index,generation,viewer){const match=this.pptxSearchMatches[index];if(match){this.disposeSearchHighlight(),viewer.clearSearchHighlights();try{if(await viewer.goToSlide(match.slideIndex),generation!==this.pptxSearchGeneration||viewer!==this.viewer)return;const highlight=await viewer.highlightSearchResult(match,{scrollIntoView:!1});if(generation!==this.pptxSearchGeneration||viewer!==this.viewer){highlight?.dispose();return}this.searchHighlight=highlight??void 0}catch(cause){generation===this.pptxSearchGeneration&&viewer===this.viewer&&this.reportPeerDiagnostic("pptx-search-error",cause,{page:match.slideIndex+1})}}}disposeSearchHighlight(){this.searchHighlight?.dispose(),this.searchHighlight=void 0}emitPptxSearchChange(){this.emit("lr-search-change",{query:this.pptxSearchQuery,matchCount:this.pptxSearchMatches.length,matchCountExact:this.pptxSearchMatchCountExact,activeIndex:this.pptxSearchActiveIndex})}reportPeerDiagnostic(code,cause,location={},fatal=!1){this.emit("lr-viewer-diagnostic",{diagnostic:Object.freeze({code,severity:"error",fatal,source:"pptx-renderer",cause,...location})}),fatal&&(this.teardown(),this.phase="error",this.slideCount=0,this.currentSlideIndex=0,this.page=1,this.errorMessage=this.localize("pptxViewerRenderError"),this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error:cause}))}async mount(){this.teardown(),this.pageViewerState.advance();const signal=this.beginAbortableLoad(),generation=this.generation;if(this.slideCount=0,this.currentSlideIndex=0,this.page=1,!this.src){this.phase="idle",this.publishPageViewerSnapshot("idle",0);return}const fetchTarget=resolveOwnerFetchTarget(this,this.src);if(!fetchTarget){const error=new LyraUserFacingError(this.localize("documentPreviewUrlNotAllowed"));this.phase="error",this.errorMessage=error.message,this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error});return}this.phase="loading",this.publishPageViewerSnapshot("loading",0);let module,response;try{[module,response]=await Promise.all([this.loadRenderer(),fetchTarget.view.fetch(fetchTarget.url,signal?{signal}:void 0)])}catch(error){if(isAbortError(error)||!this.isConnected||generation!==this.generation)return;this.phase="error",this.errorMessage=this.localize(isResourceLimitError(error)?"documentPreviewResourceTooLarge":"documentPreviewFailedToLoad"),this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error});return}if(!this.isConnected||generation!==this.generation)return;if(!module||!response.ok){response.body?.cancel().catch(()=>{});const error=new LyraUserFacingError(this.localize(module?"documentPreviewFailedToLoad":"pptxViewerMissingLibrary"));this.phase="error",this.errorMessage=error.message,this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error});return}let buffer;try{if(buffer=await readResponseArrayBuffer(response),!this.isConnected||generation!==this.generation)return;await assertPptxArchiveWithinLimits(buffer,{signal})}catch(error){if(isAbortError(error)||!this.isConnected||generation!==this.generation)return;this.phase="error",this.errorMessage=this.localize(isResourceLimitError(error)?"documentPreviewResourceTooLarge":"documentPreviewFailedToLoad"),this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error});return}if(!(!this.isConnected||generation!==this.generation)&&(this.phase="mounted",await this.updateComplete,!(!this.isConnected||generation!==this.generation||!this.containerEl)))try{const openedViewer=await module.PptxViewer.open(buffer,this.containerEl,{zipLimits:module.RECOMMENDED_ZIP_LIMITS,listOptions:{windowed:!0}});if(!this.isConnected||generation!==this.generation){openedViewer.destroy();return}const viewer=adaptPptxViewer(openedViewer);if(!viewer)throw openedViewer.destroy(),new TypeError("The PPTX renderer did not expose the required viewer capabilities.");this.viewer=viewer,this.viewerUnsubscribe=viewer.subscribe(this.onViewerEvent),this.slideCount=viewer.slideCount,this.isValidSlideIndex(viewer.currentSlideIndex)&&(this.currentSlideIndex=viewer.currentSlideIndex,this.page=viewer.currentSlideIndex+1),this.publishPageViewerSnapshot("ready",viewer.slideCount),this.emit("lr-load",{slideCount:viewer.slideCount})}catch(error){if(isAbortError(error)||!this.isConnected||generation!==this.generation)return;this.phase="error",this.errorMessage=this.localize("pptxViewerRenderError"),this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error})}}renderBody(){return this.phase==="loading"?renderViewerLoading(this.localize("loading")):this.phase==="error"?html`<div part="error">${this.errorMessage}</div>`:this.phase!=="mounted"?nothing:html`
|
|
1
|
+
import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{srOnly}from"../../../internal/a11y.js";import{finiteInteger}from"../../../internal/numbers.js";import{TextViewerTarget}from"../../../internal/text-viewer-target.js";import{isAbortError,isResourceLimitError,LyraUserFacingError,readResponseArrayBuffer,resolveOwnerFetchTarget}from"../../../internal/resource-loader.js";import{sanitizeCssLength}from"../../../internal/safe-css.js";import{adaptPptxViewer,getPptxRenderer}from"./pptx-loader.js";import{assertPptxArchiveWithinLimits}from"./pptx-resource-guard.js";import{styles}from"./pptx-viewer.styles.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{ViewerAnnouncementController}from"../viewer-announcements.js";import{DeferredTeardown}from"../../../internal/deferred-teardown.js";import{textQuoteContextScore}from"../document-viewer/anchors.js";import{PageViewerSnapshotController}from"../page-rail/page-viewer-snapshot.js";import{viewerSemanticLabel,viewerSemanticRole}from"../viewer-semantic-owner.js";import{renderViewerLoading,viewerLoadingStyles}from"../viewer-loading.js";import{renderViewerPagerButton,viewerPagerStyles}from"../viewer-pager.js";import{boundedViewerSearchQuery,ViewerSearchWorkBudget}from"../viewer-search-limits.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{LYRA_DEFAULT_anchorJumped,LYRA_DEFAULT_anchorJumpedToPage,LYRA_DEFAULT_anchorNotFound,LYRA_DEFAULT_loading}from"../../../internal/default-strings/shared.generated.js";import{LYRA_DEFAULT_documentPreviewFailedToLoad,LYRA_DEFAULT_documentPreviewResourceTooLarge,LYRA_DEFAULT_documentPreviewUrlNotAllowed,LYRA_DEFAULT_pptxViewerFidelityNotice,LYRA_DEFAULT_pptxViewerLabel,LYRA_DEFAULT_pptxViewerMissingLibrary,LYRA_DEFAULT_pptxViewerNextSlide,LYRA_DEFAULT_pptxViewerPreviousSlide,LYRA_DEFAULT_pptxViewerRenderError,LYRA_DEFAULT_pptxViewerSlideOf}from"../../../internal/default-strings/viewers.generated.js";const MAX_PPTX_SEARCH_MATCHES=1e4,MAX_PPTX_THUMBNAIL_WIDTH=2048;class LyraPptxViewerBase extends LyraElement{}class LyraPptxViewer extends TextViewerTarget(LyraPptxViewerBase){constructor(){super(...arguments),this.src="",this.name="",this.page=1,this.maxHeight="",this.phase="idle",this.errorMessage="",this.slideCount=0,this.currentSlideIndex=0,this.loadRenderer=getPptxRenderer,this.generation=0,this.announcements=new ViewerAnnouncementController(this),this.pptxSearchQuery="",this.lastSearchLocale="",this.pptxSearchMatches=[],this.pendingSearchResetEvent=!1,this.pptxSearchMatchCountExact=!0,this.pptxSearchActiveIndex=-1,this.pptxSearchGeneration=0,this.pageViewerState=new PageViewerSnapshotController,this.anchorKinds=["text-quote","fragment","page"],this.onViewerEvent=event=>{if(event.kind==="slide-change"){this.commitSlide(event.index);return}this.reportPeerDiagnostic(event.code,event.cause,{page:event.page,nodeId:event.nodeId},event.fatal)},this.focusedPagerPart=null,this.detached=new DeferredTeardown(()=>this.releaseDetachedPresentation())}static{this.defaultStrings={...super.defaultStrings,anchorJumped:LYRA_DEFAULT_anchorJumped,anchorJumpedToPage:LYRA_DEFAULT_anchorJumpedToPage,anchorNotFound:LYRA_DEFAULT_anchorNotFound,documentPreviewFailedToLoad:LYRA_DEFAULT_documentPreviewFailedToLoad,documentPreviewResourceTooLarge:LYRA_DEFAULT_documentPreviewResourceTooLarge,documentPreviewUrlNotAllowed:LYRA_DEFAULT_documentPreviewUrlNotAllowed,loading:LYRA_DEFAULT_loading,pptxViewerFidelityNotice:LYRA_DEFAULT_pptxViewerFidelityNotice,pptxViewerLabel:LYRA_DEFAULT_pptxViewerLabel,pptxViewerMissingLibrary:LYRA_DEFAULT_pptxViewerMissingLibrary,pptxViewerNextSlide:LYRA_DEFAULT_pptxViewerNextSlide,pptxViewerPreviousSlide:LYRA_DEFAULT_pptxViewerPreviousSlide,pptxViewerRenderError:LYRA_DEFAULT_pptxViewerRenderError,pptxViewerSlideOf:LYRA_DEFAULT_pptxViewerSlideOf}}static{this.styles=[LyraElement.styles,styles,viewerPagerStyles,srOnly,viewerLoadingStyles]}async search(query2){const generation=++this.pptxSearchGeneration,viewer=this.viewer,boundedQuery=boundedViewerSearchQuery(query2,this.effectiveLocale);if(this.pptxSearchQuery=query2,this.lastSearchLocale=this.effectiveLocale,this.disposeSearchHighlight(),viewer?.clearSearchHighlights(),!boundedQuery.accepted)return this.pptxSearchMatches=[],this.pptxSearchMatchCountExact=!1,this.pptxSearchActiveIndex=-1,this.emitPptxSearchChange(),0;if(!viewer||!boundedQuery.needle)return this.pptxSearchMatches=[],this.pptxSearchMatchCountExact=!0,this.pptxSearchActiveIndex=-1,this.emitPptxSearchChange(),0;try{const raw=viewer.searchText(query2.trim(),{matchCase:!1});if(generation!==this.pptxSearchGeneration||viewer!==this.viewer)return this.pptxSearchMatches.length;const normalized=this.normalizeSearchResults(raw,viewer.slideCount);return this.pptxSearchMatches=normalized.matches,this.pptxSearchMatchCountExact=normalized.matchCountExact,this.pptxSearchActiveIndex=this.pptxSearchMatches.length>0?0:-1,this.emitPptxSearchChange(),this.pptxSearchActiveIndex>=0&&await this.focusPptxSearchMatch(this.pptxSearchActiveIndex,generation,viewer),this.pptxSearchMatches.length}catch(cause){return generation!==this.pptxSearchGeneration||viewer!==this.viewer||(this.pptxSearchMatches=[],this.pptxSearchMatchCountExact=!1,this.pptxSearchActiveIndex=-1,this.reportPeerDiagnostic("pptx-search-error",cause),this.emitPptxSearchChange()),0}}async searchNext(){const viewer=this.viewer;if(!viewer||this.pptxSearchMatches.length===0)return!1;const generation=++this.pptxSearchGeneration;return this.pptxSearchActiveIndex=(this.pptxSearchActiveIndex+1)%this.pptxSearchMatches.length,this.emitPptxSearchChange(),await this.focusPptxSearchMatch(this.pptxSearchActiveIndex,generation,viewer),generation===this.pptxSearchGeneration}async searchPrevious(){const viewer=this.viewer;if(!viewer||this.pptxSearchMatches.length===0)return!1;const generation=++this.pptxSearchGeneration;return this.pptxSearchActiveIndex=(this.pptxSearchActiveIndex-1+this.pptxSearchMatches.length)%this.pptxSearchMatches.length,this.emitPptxSearchChange(),await this.focusPptxSearchMatch(this.pptxSearchActiveIndex,generation,viewer),generation===this.pptxSearchGeneration}clearSearch(){this.pptxSearchGeneration++,this.pptxSearchQuery="",this.pptxSearchMatches=[],this.pptxSearchMatchCountExact=!0,this.pptxSearchActiveIndex=-1,this.disposeSearchHighlight(),this.viewer?.clearSearchHighlights(),this.emitPptxSearchChange()}get pageViewerSnapshot(){return this.pageViewerState.value}set pageViewerSnapshot(_value){}textContentRoot(){return this.renderRoot.querySelector('[part="container"]')??this.renderRoot.querySelector('[part="base"]')}async applyAnchor(anchor){const viewer=this.viewer;if(anchor.kind==="page"){const index=anchor.page-1;return!viewer||!Number.isInteger(anchor.page)||index<0||index>=this.slideCount?!1:(await this.goToSlide(index),viewer===this.viewer&&this.currentSlideIndex===index)}if(anchor.kind==="text-quote"&&viewer){const slideIndex=this.slideForTextQuote(viewer,anchor);if(slideIndex>=0&&slideIndex!==this.currentSlideIndex){if(await this.goToSlide(slideIndex),viewer!==this.viewer||this.currentSlideIndex!==slideIndex)return!1;await this.updateComplete}}return this.applyMountedAnchor(anchor)}applyMountedAnchor(anchor){return Object.getPrototypeOf(LyraPptxViewer.prototype).applyAnchor.call(this,anchor)}slideForTextQuote(viewer,anchor){const quote=anchor.quote.trim(),bounded=boundedViewerSearchQuery(quote,this.effectiveLocale);if(!bounded.accepted||!bounded.needle)return-1;let matches;try{matches=this.normalizeSearchResults(viewer.searchText(quote,{matchCase:!1}),viewer.slideCount).matches}catch(cause){return this.reportPeerDiagnostic("pptx-search-error",cause),-1}let best,bestScore=-1;for(const match of matches){const score=textQuoteContextScore(match.text,match.matchStart,match.matchEnd,anchor.prefix,anchor.suffix);score>bestScore&&(best=match,bestScore=score)}return best?.slideIndex??-1}keepPagerFocus(){const part=this.focusedPagerPart;this.focusedPagerPart=null;const twin=part==="previous-button"?"next-button":part==="next-button"?"previous-button":void 0,root=this.shadowRoot;!twin||!root||root.querySelector(`[part="${part}"]`)?.disabled&&root.querySelector(`[part="${twin}"]:not(:disabled)`)?.focus()}updated(changed){if(super.updated(changed),this.keepPagerFocus(),this.announcements.transition("load",this.phase,this.phase==="error"?this.errorMessage:this.localize("loading")),changed.has("src")&&this.scheduleAfterUpdate(()=>{this.mount()}),changed.has("src")&&this.pendingSearchResetEvent&&(this.pendingSearchResetEvent=!1,this.emitPptxSearchChange()),changed.has("page")&&this.viewer&&this.page-1!==this.currentSlideIndex){const page=this.page;this.scheduleAfterUpdate(()=>{this.page===page&&this.goToSlide(page-1)},"page-navigation")}const locale=this.effectiveLocale;if(locale!==this.lastSearchLocale){const shouldRecompute=this.pptxSearchQuery!=="";this.lastSearchLocale=locale,shouldRecompute&&this.scheduleAfterUpdate(()=>{this.search(this.pptxSearchQuery)},"search")}}willUpdate(changed){super.willUpdate(changed);const active=shadowFocusTarget(this);this.focusedPagerPart=active?.localName==="button"&&!active.disabled?active.getAttribute("part"):null,changed.has("src")&&(this.pendingSearchResetEvent||=this.hasPptxSearchState(),this.resetPptxSearchState()),(changed.has("page")||changed.has("slideCount"))&&(this.page=finiteInteger(this.page,1,1,Math.max(1,this.slideCount)))}connectedCallback(){super.connectedCallback(),this.announcements.connect();const moved=this.detached.cancel();this.hasUpdated&&this.src&&!moved&&this.scheduleAfterUpdate(()=>{this.mount()})}disconnectedCallback(){this.announcements.disconnect(),super.disconnectedCallback(),this.detached.schedule()}releaseDetachedPresentation(){this.teardown(),this.phase="idle",this.slideCount=0,this.currentSlideIndex=0,this.page=1,this.pageViewerState.reset()}adoptedCallback(){super.adoptedCallback(),this.detached.flush(),this.announcements.adopted()}async goToSlide(index){const viewer=this.viewer;if(!viewer||!Number.isSafeInteger(index)||index<0||index>=viewer.slideCount)return;const generation=this.generation;try{await viewer.goToSlide(index)}catch(error){if(isAbortError(error)||!this.isConnected||generation!==this.generation||viewer!==this.viewer)return;this.teardown(),this.phase="error",this.slideCount=0,this.currentSlideIndex=0,this.page=1,this.errorMessage=this.localize("pptxViewerRenderError"),this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error});return}viewer===this.viewer&&viewer.currentSlideIndex!==this.currentSlideIndex&&this.commitSlide(viewer.currentSlideIndex)}async renderPageThumbnailToContainer(page,container,options){const viewer=this.viewer,generation=this.generation,width=options?.width??96;if(!viewer||!Number.isSafeInteger(page)||page<1||page>viewer.slideCount||!Number.isFinite(width)||width<=0||width>MAX_PPTX_THUMBNAIL_WIDTH)return!1;const previousChildren=[...container.childNodes],restorePreviousChildren=()=>{container.replaceChildren(...previousChildren)};let handle;try{handle=viewer.renderThumbnailToContainer(page-1,container,{width})}catch{return restorePreviousChildren(),!1}if(!handle)return restorePreviousChildren(),!1;try{await handle.ready}catch{return handle.dispose(),restorePreviousChildren(),!1}if(generation!==this.generation||viewer!==this.viewer||!container.isConnected)return handle.dispose(),restorePreviousChildren(),!1;for(const child of previousChildren)child.parentNode===container&&child.remove();return handle}isValidSlideIndex(index){return Number.isSafeInteger(index)&&index>=0&&index<this.slideCount}commitSlide(index){if(!this.isValidSlideIndex(index))return;const changed=index!==this.currentSlideIndex;this.currentSlideIndex=index,this.page=index+1,this.publishPageViewerSnapshot("ready",this.slideCount),changed&&this.emit("lr-slide-change",{index,count:this.slideCount})}publishPageViewerSnapshot(status,pageCount){const snapshot=this.pageViewerState.publish(status,finiteInteger(this.page,1,1,Math.max(1,pageCount)),finiteInteger(pageCount,0,0,Number.MAX_SAFE_INTEGER));snapshot&&this.isConnected&&this.emit("lr-page-viewer-state-change",{snapshot})}teardown(){const shouldEmitSearchReset=this.hasPptxSearchState();this.generation++,this.viewerUnsubscribe?.(),this.viewerUnsubscribe=void 0,this.viewer?.destroy(),this.viewer=void 0,this.resetPptxSearchState(),shouldEmitSearchReset&&this.emitPptxSearchChange()}hasPptxSearchState(){return this.pptxSearchQuery!==""||this.pptxSearchMatches.length>0||!this.pptxSearchMatchCountExact||this.pptxSearchActiveIndex!==-1}resetPptxSearchState(){this.pptxSearchGeneration++,this.disposeSearchHighlight(),this.viewer?.clearSearchHighlights(),this.pptxSearchQuery="",this.pptxSearchMatches=[],this.pptxSearchMatchCountExact=!0,this.pptxSearchActiveIndex=-1}normalizeSearchResults(value,slideCount){if(!Array.isArray(value))throw new TypeError("PPTX search returned a non-array result.");const matches=[],work=new ViewerSearchWorkBudget;let matchCountExact=!0;for(const candidate of value){if(!work.consume("")){matchCountExact=!1;break}if(!candidate||typeof candidate!="object")continue;const result=candidate;if(!(!Number.isSafeInteger(result.slideIndex)||result.slideIndex<0||result.slideIndex>=slideCount||typeof result.nodeId!="string"||typeof result.text!="string"||!Number.isSafeInteger(result.matchStart)||!Number.isSafeInteger(result.matchEnd)||result.matchStart<0||result.matchEnd<result.matchStart||result.matchEnd>result.text.length)){if(!work.consume(result.nodeId)||!work.consume(result.text)){matchCountExact=!1;break}if(matches.length===MAX_PPTX_SEARCH_MATCHES){matchCountExact=!1;break}matches.push(candidate)}}return{matches,matchCountExact:matchCountExact&&work.complete}}async focusPptxSearchMatch(index,generation,viewer){const match=this.pptxSearchMatches[index];if(match){this.disposeSearchHighlight(),viewer.clearSearchHighlights();try{if(await viewer.goToSlide(match.slideIndex),generation!==this.pptxSearchGeneration||viewer!==this.viewer)return;const highlight=await viewer.highlightSearchResult(match,{scrollIntoView:!1});if(generation!==this.pptxSearchGeneration||viewer!==this.viewer){highlight?.dispose();return}this.searchHighlight=highlight??void 0}catch(cause){generation===this.pptxSearchGeneration&&viewer===this.viewer&&this.reportPeerDiagnostic("pptx-search-error",cause,{page:match.slideIndex+1})}}}disposeSearchHighlight(){this.searchHighlight?.dispose(),this.searchHighlight=void 0}emitPptxSearchChange(){this.emit("lr-search-change",{query:this.pptxSearchQuery,matchCount:this.pptxSearchMatches.length,matchCountExact:this.pptxSearchMatchCountExact,activeIndex:this.pptxSearchActiveIndex})}reportPeerDiagnostic(code,cause,location={},fatal=!1){this.emit("lr-viewer-diagnostic",{diagnostic:Object.freeze({code,severity:"error",fatal,source:"pptx-renderer",cause,...location})}),fatal&&(this.teardown(),this.phase="error",this.slideCount=0,this.currentSlideIndex=0,this.page=1,this.errorMessage=this.localize("pptxViewerRenderError"),this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error:cause}))}async mount(){this.teardown(),this.pageViewerState.advance();const signal=this.beginAbortableLoad(),generation=this.generation;if(this.slideCount=0,this.currentSlideIndex=0,this.page=1,!this.src){this.phase="idle",this.publishPageViewerSnapshot("idle",0);return}const fetchTarget=resolveOwnerFetchTarget(this,this.src);if(!fetchTarget){const error=new LyraUserFacingError(this.localize("documentPreviewUrlNotAllowed"));this.phase="error",this.errorMessage=error.message,this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error});return}this.phase="loading",this.publishPageViewerSnapshot("loading",0);let module,response;try{[module,response]=await Promise.all([this.loadRenderer(),fetchTarget.view.fetch(fetchTarget.url,signal?{signal}:void 0)])}catch(error){if(isAbortError(error)||!this.isConnected||generation!==this.generation)return;this.phase="error",this.errorMessage=this.localize(isResourceLimitError(error)?"documentPreviewResourceTooLarge":"documentPreviewFailedToLoad"),this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error});return}if(!this.isConnected||generation!==this.generation)return;if(!module||!response.ok){response.body?.cancel().catch(()=>{});const error=new LyraUserFacingError(this.localize(module?"documentPreviewFailedToLoad":"pptxViewerMissingLibrary"));this.phase="error",this.errorMessage=error.message,this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error});return}let buffer;try{if(buffer=await readResponseArrayBuffer(response),!this.isConnected||generation!==this.generation)return;await assertPptxArchiveWithinLimits(buffer,{signal})}catch(error){if(isAbortError(error)||!this.isConnected||generation!==this.generation)return;this.phase="error",this.errorMessage=this.localize(isResourceLimitError(error)?"documentPreviewResourceTooLarge":"documentPreviewFailedToLoad"),this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error});return}if(!(!this.isConnected||generation!==this.generation)&&(this.phase="mounted",await this.updateComplete,!(!this.isConnected||generation!==this.generation||!this.containerEl)))try{const openedViewer=await module.PptxViewer.open(buffer,this.containerEl,{externalMedia:"block",zipLimits:module.RECOMMENDED_ZIP_LIMITS,listOptions:{windowed:!0}});if(!this.isConnected||generation!==this.generation){openedViewer.destroy();return}const viewer=adaptPptxViewer(openedViewer);if(!viewer)throw openedViewer.destroy(),new TypeError("The PPTX renderer did not expose the required viewer capabilities.");this.viewer=viewer,this.viewerUnsubscribe=viewer.subscribe(this.onViewerEvent),this.slideCount=viewer.slideCount,this.isValidSlideIndex(viewer.currentSlideIndex)&&(this.currentSlideIndex=viewer.currentSlideIndex,this.page=viewer.currentSlideIndex+1),this.publishPageViewerSnapshot("ready",viewer.slideCount),this.emit("lr-load",{slideCount:viewer.slideCount})}catch(error){if(isAbortError(error)||!this.isConnected||generation!==this.generation)return;this.phase="error",this.errorMessage=this.localize("pptxViewerRenderError"),this.publishPageViewerSnapshot("error",0),this.emit("lr-render-error",{error})}}renderBody(){return this.phase==="loading"?renderViewerLoading(this.localize("loading")):this.phase==="error"?html`<div part="error">${this.errorMessage}</div>`:this.phase!=="mounted"?nothing:html`
|
|
2
2
|
<div part="nav" ?hidden=${this.slideCount<=1}>
|
|
3
3
|
${renderViewerPagerButton("previous",this.localize("pptxViewerPreviousSlide"),this.currentSlideIndex<=0,()=>{this.goToSlide(this.currentSlideIndex-1)})}
|
|
4
4
|
<span part="slide-count">${this.localize("pptxViewerSlideOf",void 0,{current:getNumberFormat(this.effectiveLocale).format(this.currentSlideIndex+1),total:getNumberFormat(this.effectiveLocale).format(this.slideCount)})}</span>
|
package/dist/events.d.ts
CHANGED
|
@@ -1039,6 +1039,11 @@ export type LyraMatrixRangeSelectEvent=LyraHeatmapEventMap['lr-matrix-range-sele
|
|
|
1039
1039
|
*/
|
|
1040
1040
|
export type LyraMaximizeChangeRequestEvent=LyraToolResultDialogEventMap['lr-maximize-change-request'];
|
|
1041
1041
|
/**
|
|
1042
|
+
* `lr-mcp-initialized` — dispatched by `<lr-mcp-app>`; detail
|
|
1043
|
+
* `LyraMcpAppEventMap['lr-mcp-initialized']`.
|
|
1044
|
+
*/
|
|
1045
|
+
export type LyraMcpInitializedEvent=LyraMcpAppEventMap['lr-mcp-initialized'];
|
|
1046
|
+
/**
|
|
1042
1047
|
* `lr-mcp-log` — dispatched by `<lr-mcp-app>`; detail `LyraMcpAppEventMap['lr-mcp-log']`.
|
|
1043
1048
|
*/
|
|
1044
1049
|
export type LyraMcpLogEvent=LyraMcpAppEventMap['lr-mcp-log'];
|
|
@@ -1052,6 +1057,10 @@ export type LyraMcpOpenLinkEvent=LyraMcpAppEventMap['lr-mcp-open-link'];
|
|
|
1052
1057
|
*/
|
|
1053
1058
|
export type LyraMcpReadyEvent=LyraMcpAppEventMap['lr-mcp-ready'];
|
|
1054
1059
|
/**
|
|
1060
|
+
* `lr-mcp-request` — dispatched by `<lr-mcp-app>`; detail `LyraMcpAppEventMap['lr-mcp-request']`.
|
|
1061
|
+
*/
|
|
1062
|
+
export type LyraMcpRequestEvent=LyraMcpAppEventMap['lr-mcp-request'];
|
|
1063
|
+
/**
|
|
1055
1064
|
* `lr-mcp-resize` — dispatched by `<lr-mcp-app>`; detail `LyraMcpAppEventMap['lr-mcp-resize']`.
|
|
1056
1065
|
*/
|
|
1057
1066
|
export type LyraMcpResizeEvent=LyraMcpAppEventMap['lr-mcp-resize'];
|
|
@@ -2186,7 +2195,7 @@ export type LyraZoomChangeEvent=LyraDocumentViewerEventMap['lr-zoom-change']|Lyr
|
|
|
2186
2195
|
* their standard types, and redeclaring them globally would either conflict or widen a built-in.
|
|
2187
2196
|
* Those stay typed per component through the component's own event map.
|
|
2188
2197
|
*/
|
|
2189
|
-
export interface LyraGlobalEventMap{'lr-activate':LyraActivateEvent;'lr-add':LyraAddEvent;'lr-add-condition':LyraAddConditionEvent;'lr-after-collapse':LyraAfterCollapseEvent;'lr-after-expand':LyraAfterExpandEvent;'lr-after-hide':LyraAfterHideEvent;'lr-after-show':LyraAfterShowEvent;'lr-anchor-result':LyraAnchorResultEvent;'lr-annotatable-change':LyraAnnotatableChangeEvent;'lr-annotation-create':LyraAnnotationCreateEvent;'lr-approval-close':LyraApprovalCloseEvent;'lr-approval-decision-request':LyraApprovalDecisionRequestEvent;'lr-approval-select':LyraApprovalSelectEvent;'lr-approve-request':LyraApproveRequestEvent;'lr-attachment-open':LyraAttachmentOpenEvent;'lr-attachment-preview-request':LyraAttachmentPreviewRequestEvent;'lr-attachment-remove':LyraAttachmentRemoveEvent;'lr-attachment-retry':LyraAttachmentRetryEvent;'lr-attachments-add':LyraAttachmentsAddEvent;'lr-audio-request':LyraAudioRequestEvent;'lr-autoload-error':LyraAutoloadErrorEvent;'lr-autoload-loaded':LyraAutoloadLoadedEvent;'lr-autoload-preload':LyraAutoloadPreloadEvent;'lr-autoload-traversal-error':LyraAutoloadTraversalErrorEvent;'lr-before-page-change':LyraBeforePageChangeEvent;'lr-branch-change':LyraBranchChangeEvent;'lr-calendar-geometry-change':LyraCalendarGeometryChangeEvent;'lr-camera-change':LyraCameraChangeEvent;'lr-camera-request':LyraCameraRequestEvent;'lr-cancel':LyraCancelEvent;'lr-card-activate':LyraCardActivateEvent;'lr-cell-activate':LyraCellActivateEvent;'lr-cell-click':LyraCellClickEvent;'lr-cell-contextmenu':LyraCellContextmenuEvent;'lr-cell-edit':LyraCellEditEvent;'lr-cell-move':LyraCellMoveEvent;'lr-cell-resize':LyraCellResizeEvent;'lr-change':LyraChangeEvent;'lr-change-decision-request':LyraChangeDecisionRequestEvent;'lr-change-request':LyraChangeRequestEvent;'lr-chart-row-select':LyraChartRowSelectEvent;'lr-checkbox-group-toggle-request':LyraCheckboxGroupToggleRequestEvent;'lr-checkbox-toggle-request':LyraCheckboxToggleRequestEvent;'lr-chip-change':LyraChipChangeEvent;'lr-chip-toggle-request':LyraChipToggleRequestEvent;'lr-chunk-open':LyraChunkOpenEvent;'lr-chunk-select':LyraChunkSelectEvent;'lr-citation-activate':LyraCitationActivateEvent;'lr-citation-open':LyraCitationOpenEvent;'lr-citation-select':LyraCitationSelectEvent;'lr-claim-select':LyraClaimSelectEvent;'lr-clear':LyraClearEvent;'lr-close':LyraCloseEvent;'lr-close-request':LyraCloseRequestEvent;'lr-cluster-activate':LyraClusterActivateEvent;'lr-collapse':LyraCollapseEvent;'lr-collision':LyraCollisionEvent;'lr-column-move':LyraColumnMoveEvent;'lr-column-pin':LyraColumnPinEvent;'lr-column-resize':LyraColumnResizeEvent;'lr-column-resize-request':LyraColumnResizeRequestEvent;'lr-column-visibility-change':LyraColumnVisibilityChangeEvent;'lr-community-activate':LyraCommunityActivateEvent;'lr-complete':LyraCompleteEvent;'lr-connect':LyraConnectEvent;'lr-connector-action':LyraConnectorActionEvent;'lr-content-change':LyraContentChangeEvent;'lr-content-settled':LyraContentSettledEvent;'lr-copy':LyraCopyEvent;'lr-copy-error':LyraCopyErrorEvent;'lr-create':LyraCreateEvent;'lr-cue-change':LyraCueChangeEvent;'lr-data-error':LyraDataErrorEvent;'lr-date-select':LyraDateSelectEvent;'lr-datum-activate':LyraDatumActivateEvent;'lr-datum-visibility-change':LyraDatumVisibilityChangeEvent;'lr-datum-visibility-change-request':LyraDatumVisibilityChangeRequestEvent;'lr-decision-settled':LyraDecisionSettledEvent;'lr-deny-request':LyraDenyRequestEvent;'lr-disconnect':LyraDisconnectEvent;'lr-dismiss':LyraDismissEvent;'lr-download':LyraDownloadEvent;'lr-download-request':LyraDownloadRequestEvent;'lr-drill':LyraDrillEvent;'lr-drilldown-category-change':LyraDrilldownCategoryChangeEvent;'lr-drilldown-document-download':LyraDrilldownDocumentDownloadEvent;'lr-drilldown-document-highlight-activate':LyraDrilldownDocumentHighlightActivateEvent;'lr-drilldown-document-render-error':LyraDrilldownDocumentRenderErrorEvent;'lr-drilldown-entity-activate':LyraDrilldownEntityActivateEvent;'lr-drilldown-evidence-expand':LyraDrilldownEvidenceExpandEvent;'lr-drilldown-evidence-open':LyraDrilldownEvidenceOpenEvent;'lr-drilldown-navigate':LyraDrilldownNavigateEvent;'lr-edge-activate':LyraEdgeActivateEvent;'lr-edge-enter':LyraEdgeEnterEvent;'lr-edge-leave':LyraEdgeLeaveEvent;'lr-edit':LyraEditEvent;'lr-engine-fallback':LyraEngineFallbackEvent;'lr-entity-open':LyraEntityOpenEvent;'lr-entity-select':LyraEntitySelectEvent;'lr-error':LyraErrorEvent;'lr-event-select':LyraEventSelectEvent;'lr-example-add-request':LyraExampleAddRequestEvent;'lr-example-citation-select':LyraExampleCitationSelectEvent;'lr-example-claim-select':LyraExampleClaimSelectEvent;'lr-example-remove-request':LyraExampleRemoveRequestEvent;'lr-example-select':LyraExampleSelectEvent;'lr-example-toggle':LyraExampleToggleEvent;'lr-example-tool-activate':LyraExampleToolActivateEvent;'lr-example-tool-approval-decide-request':LyraExampleToolApprovalDecideRequestEvent;'lr-example-tool-render-error':LyraExampleToolRenderErrorEvent;'lr-expand':LyraExpandEvent;'lr-export-complete':LyraExportCompleteEvent;'lr-export-error':LyraExportErrorEvent;'lr-export-request':LyraExportRequestEvent;'lr-feedback-change':LyraFeedbackChangeEvent;'lr-feedback-submit-request':LyraFeedbackSubmitRequestEvent;'lr-file-open':LyraFileOpenEvent;'lr-file-select':LyraFileSelectEvent;'lr-files':LyraFilesEvent;'lr-filter':LyraFilterEvent;'lr-filter-change':LyraFilterChangeEvent;'lr-filters-change':LyraFiltersChangeEvent;'lr-finish':LyraFinishEvent;'lr-fit-change':LyraFitChangeEvent;'lr-focus-day':LyraFocusDayEvent;'lr-follow-change':LyraFollowChangeEvent;'lr-forget':LyraForgetEvent;'lr-frame-select':LyraFrameSelectEvent;'lr-fullscreen-change':LyraFullscreenChangeEvent;'lr-fullscreen-request':LyraFullscreenRequestEvent;'lr-group-collapse':LyraGroupCollapseEvent;'lr-group-expand':LyraGroupExpandEvent;'lr-group-toggle':LyraGroupToggleEvent;'lr-group-toggle-request':LyraGroupToggleRequestEvent;'lr-hidden-types-change':LyraHiddenTypesChangeEvent;'lr-hide':LyraHideEvent;'lr-highlight-activate':LyraHighlightActivateEvent;'lr-hover':LyraHoverEvent;'lr-import-request':LyraImportRequestEvent;'lr-include-error':LyraIncludeErrorEvent;'lr-index-change':LyraIndexChangeEvent;'lr-ingestion-cancel':LyraIngestionCancelEvent;'lr-ingestion-retry':LyraIngestionRetryEvent;'lr-initial-focus':LyraInitialFocusEvent;'lr-input':LyraInputEvent;'lr-input-settled':LyraInputSettledEvent;'lr-interrupt':LyraInterruptEvent;'lr-intersect':LyraIntersectEvent;'lr-intersection':LyraIntersectionEvent;'lr-invalid':LyraInvalidEvent;'lr-item-activate':LyraItemActivateEvent;'lr-layout-change':LyraLayoutChangeEvent;'lr-lazy-change':LyraLazyChangeEvent;'lr-lazy-load':LyraLazyLoadEvent;'lr-legend-visibility-change':LyraLegendVisibilityChangeEvent;'lr-legend-visibility-change-request':LyraLegendVisibilityChangeRequestEvent;'lr-level':LyraLevelEvent;'lr-line-activate':LyraLineActivateEvent;'lr-link-activate':LyraLinkActivateEvent;'lr-load':LyraLoadEvent;'lr-load-children':LyraLoadChildrenEvent;'lr-load-error':LyraLoadErrorEvent;'lr-load-more':LyraLoadMoreEvent;'lr-location-change':LyraLocationChangeEvent;'lr-map-anchor-close':LyraMapAnchorCloseEvent;'lr-map-click':LyraMapClickEvent;'lr-map-contextmenu':LyraMapContextmenuEvent;'lr-map-draw-cancel':LyraMapDrawCancelEvent;'lr-map-draw-change':LyraMapDrawChangeEvent;'lr-map-draw-complete':LyraMapDrawCompleteEvent;'lr-map-draw-start':LyraMapDrawStartEvent;'lr-map-draw-vertex-end':LyraMapDrawVertexEndEvent;'lr-map-export-error':LyraMapExportErrorEvent;'lr-map-feature-enter':LyraMapFeatureEnterEvent;'lr-map-feature-leave':LyraMapFeatureLeaveEvent;'lr-map-geolocate':LyraMapGeolocateEvent;'lr-map-geolocate-error':LyraMapGeolocateErrorEvent;'lr-map-geolocate-out-of-bounds':LyraMapGeolocateOutOfBoundsEvent;'lr-map-idle':LyraMapIdleEvent;'lr-map-legend-panel-toggle-request':LyraMapLegendPanelToggleRequestEvent;'lr-map-legend-toggle-request':LyraMapLegendToggleRequestEvent;'lr-map-load':LyraMapLoadEvent;'lr-map-marker-activate':LyraMapMarkerActivateEvent;'lr-map-move':LyraMapMoveEvent;'lr-map-pick':LyraMapPickEvent;'lr-map-pointer-leave':LyraMapPointerLeaveEvent;'lr-map-pointer-move':LyraMapPointerMoveEvent;'lr-map-style-load':LyraMapStyleLoadEvent;'lr-map-view-change':LyraMapViewChangeEvent;'lr-matrix-geometry-change':LyraMatrixGeometryChangeEvent;'lr-matrix-range-select':LyraMatrixRangeSelectEvent;'lr-maximize-change-request':LyraMaximizeChangeRequestEvent;'lr-mcp-log':LyraMcpLogEvent;'lr-mcp-open-link':LyraMcpOpenLinkEvent;'lr-mcp-ready':LyraMcpReadyEvent;'lr-mcp-resize':LyraMcpResizeEvent;'lr-mcp-send-message':LyraMcpSendMessageEvent;'lr-mcp-tool-call':LyraMcpToolCallEvent;'lr-media-download-request':LyraMediaDownloadRequestEvent;'lr-media-open':LyraMediaOpenEvent;'lr-mention-close':LyraMentionCloseEvent;'lr-mention-select':LyraMentionSelectEvent;'lr-menu-item-change-request':LyraMenuItemChangeRequestEvent;'lr-menu-item-state-change':LyraMenuItemStateChangeEvent;'lr-message-reorder-request':LyraMessageReorderRequestEvent;'lr-message-retry':LyraMessageRetryEvent;'lr-metric-change-request':LyraMetricChangeRequestEvent;'lr-mode-change':LyraModeChangeEvent;'lr-model-change':LyraModelChangeEvent;'lr-move-request':LyraMoveRequestEvent;'lr-multi-split-collapse-change':LyraMultiSplitCollapseChangeEvent;'lr-multi-split-constraints-invalid':LyraMultiSplitConstraintsInvalidEvent;'lr-multi-split-orientation-change':LyraMultiSplitOrientationChangeEvent;'lr-mutation':LyraMutationEvent;'lr-mute-change':LyraMuteChangeEvent;'lr-nav-open-change':LyraNavOpenChangeEvent;'lr-nav-toggle-request':LyraNavToggleRequestEvent;'lr-node-activate':LyraNodeActivateEvent;'lr-node-add':LyraNodeAddEvent;'lr-node-enter':LyraNodeEnterEvent;'lr-node-expand':LyraNodeExpandEvent;'lr-node-leave':LyraNodeLeaveEvent;'lr-node-move':LyraNodeMoveEvent;'lr-node-select':LyraNodeSelectEvent;'lr-node-toggle':LyraNodeToggleEvent;'lr-open':LyraOpenEvent;'lr-option-change':LyraOptionChangeEvent;'lr-overflow':LyraOverflowEvent;'lr-overflow-activate':LyraOverflowActivateEvent;'lr-overflow-toggle':LyraOverflowToggleEvent;'lr-page-change':LyraPageChangeEvent;'lr-page-select':LyraPageSelectEvent;'lr-page-viewer-state-change':LyraPageViewerStateChangeEvent;'lr-palette-place':LyraPalettePlaceEvent;'lr-panorama-camera-change':LyraPanoramaCameraChangeEvent;'lr-panorama-hotspot-select':LyraPanoramaHotspotSelectEvent;'lr-part-resume':LyraPartResumeEvent;'lr-part-retry':LyraPartRetryEvent;'lr-path-request':LyraPathRequestEvent;'lr-pause':LyraPauseEvent;'lr-pause-change':LyraPauseChangeEvent;'lr-peek-change':LyraPeekChangeEvent;'lr-permission-decision':LyraPermissionDecisionEvent;'lr-permission-rule-change':LyraPermissionRuleChangeEvent;'lr-pin-change':LyraPinChangeEvent;'lr-play':LyraPlayEvent;'lr-point-activate':LyraPointActivateEvent;'lr-point-select':LyraPointSelectEvent;'lr-poll-due':LyraPollDueEvent;'lr-preview-change':LyraPreviewChangeEvent;'lr-preview-request':LyraPreviewRequestEvent;'lr-priority-columns-visibility-change':LyraPriorityColumnsVisibilityChangeEvent;'lr-query-change':LyraQueryChangeEvent;'lr-query-delete':LyraQueryDeleteEvent;'lr-query-delete-request':LyraQueryDeleteRequestEvent;'lr-query-load':LyraQueryLoadEvent;'lr-query-load-request':LyraQueryLoadRequestEvent;'lr-query-run':LyraQueryRunEvent;'lr-query-run-request':LyraQueryRunRequestEvent;'lr-query-save':LyraQuerySaveEvent;'lr-query-save-request':LyraQuerySaveRequestEvent;'lr-question-input':LyraQuestionInputEvent;'lr-question-response':LyraQuestionResponseEvent;'lr-queue-change':LyraQueueChangeEvent;'lr-rail-resize':LyraRailResizeEvent;'lr-rail-resize-request':LyraRailResizeRequestEvent;'lr-rate-change':LyraRateChangeEvent;'lr-readonly-change':LyraReadonlyChangeEvent;'lr-record-cancel':LyraRecordCancelEvent;'lr-record-chunk':LyraRecordChunkEvent;'lr-record-error':LyraRecordErrorEvent;'lr-record-start':LyraRecordStartEvent;'lr-record-state-change':LyraRecordStateChangeEvent;'lr-record-stop':LyraRecordStopEvent;'lr-recover':LyraRecoverEvent;'lr-regenerate':LyraRegenerateEvent;'lr-relation-activate':LyraRelationActivateEvent;'lr-remove':LyraRemoveEvent;'lr-remove-condition':LyraRemoveConditionEvent;'lr-rename':LyraRenameEvent;'lr-render-error':LyraRenderErrorEvent;'lr-reorder':LyraReorderEvent;'lr-reorder-request':LyraReorderRequestEvent;'lr-reposition':LyraRepositionEvent;'lr-reposition-request':LyraRepositionRequestEvent;'lr-request':LyraRequestEvent;'lr-request-close':LyraRequestCloseEvent;'lr-reset':LyraResetEvent;'lr-resize':LyraResizeEvent;'lr-resize-change':LyraResizeChangeEvent;'lr-resize-input':LyraResizeInputEvent;'lr-resize-request':LyraResizeRequestEvent;'lr-restore':LyraRestoreEvent;'lr-resume':LyraResumeEvent;'lr-retrieval-select':LyraRetrievalSelectEvent;'lr-retry':LyraRetryEvent;'lr-retry-request':LyraRetryRequestEvent;'lr-reveal-change':LyraRevealChangeEvent;'lr-review-input':LyraReviewInputEvent;'lr-review-skip':LyraReviewSkipEvent;'lr-review-submit':LyraReviewSubmitEvent;'lr-review-validity-change':LyraReviewValidityChangeEvent;'lr-rotation-change':LyraRotationChangeEvent;'lr-row-activate':LyraRowActivateEvent;'lr-row-collapse':LyraRowCollapseEvent;'lr-row-expand':LyraRowExpandEvent;'lr-row-expand-request':LyraRowExpandRequestEvent;'lr-row-expand-toggle':LyraRowExpandToggleEvent;'lr-row-select':LyraRowSelectEvent;'lr-run':LyraRunEvent;'lr-run-activate':LyraRunActivateEvent;'lr-run-cancel':LyraRunCancelEvent;'lr-run-retry':LyraRunRetryEvent;'lr-save':LyraSaveEvent;'lr-schema-select':LyraSchemaSelectEvent;'lr-scroll':LyraScrollEvent;'lr-search':LyraSearchEvent;'lr-search-change':LyraSearchChangeEvent;'lr-segment-activate-request':LyraSegmentActivateRequestEvent;'lr-select':LyraSelectEvent;'lr-selection-action':LyraSelectionActionEvent;'lr-selection-change':LyraSelectionChangeEvent;'lr-selection-delete':LyraSelectionDeleteEvent;'lr-send-now':LyraSendNowEvent;'lr-sequence-step':LyraSequenceStepEvent;'lr-show':LyraShowEvent;'lr-skip':LyraSkipEvent;'lr-slice-change-request':LyraSliceChangeRequestEvent;'lr-slide-change':LyraSlideChangeEvent;'lr-sort':LyraSortEvent;'lr-sort-change':LyraSortChangeEvent;'lr-sort-request':LyraSortRequestEvent;'lr-source-category-select':LyraSourceCategorySelectEvent;'lr-source-create':LyraSourceCreateEvent;'lr-source-delete':LyraSourceDeleteEvent;'lr-source-error':LyraSourceErrorEvent;'lr-source-pause':LyraSourcePauseEvent;'lr-source-point-select':LyraSourcePointSelectEvent;'lr-source-selection-change':LyraSourceSelectionChangeEvent;'lr-source-sync':LyraSourceSyncEvent;'lr-sources-change':LyraSourcesChangeEvent;'lr-span-select':LyraSpanSelectEvent;'lr-span-toggle':LyraSpanToggleEvent;'lr-span-visibility-change':LyraSpanVisibilityChangeEvent;'lr-spatial-bin-select':LyraSpatialBinSelectEvent;'lr-spatial-point-select':LyraSpatialPointSelectEvent;'lr-stage-chunk-action':LyraStageChunkActionEvent;'lr-stage-select':LyraStageSelectEvent;'lr-stall':LyraStallEvent;'lr-start':LyraStartEvent;'lr-step-select':LyraStepSelectEvent;'lr-stepper-orientation-change':LyraStepperOrientationChangeEvent;'lr-stop':LyraStopEvent;'lr-submit':LyraSubmitEvent;'lr-suggestion-select':LyraSuggestionSelectEvent;'lr-switch-toggle-request':LyraSwitchToggleRequestEvent;'lr-tab-change':LyraTabChangeEvent;'lr-tab-hide':LyraTabHideEvent;'lr-tab-show':LyraTabShowEvent;'lr-take-over':LyraTakeOverEvent;'lr-test-select':LyraTestSelectEvent;'lr-text-select':LyraTextSelectEvent;'lr-thread-archive':LyraThreadArchiveEvent;'lr-thread-delete':LyraThreadDeleteEvent;'lr-thread-pin':LyraThreadPinEvent;'lr-thread-rename':LyraThreadRenameEvent;'lr-time-change':LyraTimeChangeEvent;'lr-toast-overflow':LyraToastOverflowEvent;'lr-toggle':LyraToggleEvent;'lr-toggle-group-toggle-request':LyraToggleGroupToggleRequestEvent;'lr-toggle-request':LyraToggleRequestEvent;'lr-toggle-toggle-request':LyraToggleToggleRequestEvent;'lr-token-add-request':LyraTokenAddRequestEvent;'lr-token-edit-request':LyraTokenEditRequestEvent;'lr-token-remove-request':LyraTokenRemoveRequestEvent;'lr-tool-activate':LyraToolActivateEvent;'lr-tool-approval-decide-request':LyraToolApprovalDecideRequestEvent;'lr-tool-call-chip-select':LyraToolCallChipSelectEvent;'lr-tool-render-error':LyraToolRenderErrorEvent;'lr-toolbar-actions-change':LyraToolbarActionsChangeEvent;'lr-topic-select':LyraTopicSelectEvent;'lr-topic-toggle':LyraTopicToggleEvent;'lr-tour-end':LyraTourEndEvent;'lr-tour-end-request':LyraTourEndRequestEvent;'lr-tour-start':LyraTourStartEvent;'lr-tour-step-change-request':LyraTourStepChangeRequestEvent;'lr-tour-target-missing':LyraTourTargetMissingEvent;'lr-validity-change':LyraValidityChangeEvent;'lr-version-change':LyraVersionChangeEvent;'lr-version-select':LyraVersionSelectEvent;'lr-video-change':LyraVideoChangeEvent;'lr-view-change':LyraViewChangeEvent;'lr-view-request':LyraViewRequestEvent;'lr-viewer-diagnostic':LyraViewerDiagnosticEvent;'lr-viewport-change':LyraViewportChangeEvent;'lr-virtual-scroll':LyraVirtualScrollEvent;'lr-visibility-change':LyraVisibilityChangeEvent;'lr-visibility-change-request':LyraVisibilityChangeRequestEvent;'lr-visible-range-change':LyraVisibleRangeChangeEvent;'lr-voice-change':LyraVoiceChangeEvent;'lr-vote-request':LyraVoteRequestEvent;'lr-widget-action':LyraWidgetActionEvent;'lr-widget-state-change':LyraWidgetStateChangeEvent;'lr-word-activate':LyraWordActivateEvent;'lr-zoom':LyraZoomEvent;'lr-zoom-change':LyraZoomChangeEvent;}declare global{
|
|
2198
|
+
export interface LyraGlobalEventMap{'lr-activate':LyraActivateEvent;'lr-add':LyraAddEvent;'lr-add-condition':LyraAddConditionEvent;'lr-after-collapse':LyraAfterCollapseEvent;'lr-after-expand':LyraAfterExpandEvent;'lr-after-hide':LyraAfterHideEvent;'lr-after-show':LyraAfterShowEvent;'lr-anchor-result':LyraAnchorResultEvent;'lr-annotatable-change':LyraAnnotatableChangeEvent;'lr-annotation-create':LyraAnnotationCreateEvent;'lr-approval-close':LyraApprovalCloseEvent;'lr-approval-decision-request':LyraApprovalDecisionRequestEvent;'lr-approval-select':LyraApprovalSelectEvent;'lr-approve-request':LyraApproveRequestEvent;'lr-attachment-open':LyraAttachmentOpenEvent;'lr-attachment-preview-request':LyraAttachmentPreviewRequestEvent;'lr-attachment-remove':LyraAttachmentRemoveEvent;'lr-attachment-retry':LyraAttachmentRetryEvent;'lr-attachments-add':LyraAttachmentsAddEvent;'lr-audio-request':LyraAudioRequestEvent;'lr-autoload-error':LyraAutoloadErrorEvent;'lr-autoload-loaded':LyraAutoloadLoadedEvent;'lr-autoload-preload':LyraAutoloadPreloadEvent;'lr-autoload-traversal-error':LyraAutoloadTraversalErrorEvent;'lr-before-page-change':LyraBeforePageChangeEvent;'lr-branch-change':LyraBranchChangeEvent;'lr-calendar-geometry-change':LyraCalendarGeometryChangeEvent;'lr-camera-change':LyraCameraChangeEvent;'lr-camera-request':LyraCameraRequestEvent;'lr-cancel':LyraCancelEvent;'lr-card-activate':LyraCardActivateEvent;'lr-cell-activate':LyraCellActivateEvent;'lr-cell-click':LyraCellClickEvent;'lr-cell-contextmenu':LyraCellContextmenuEvent;'lr-cell-edit':LyraCellEditEvent;'lr-cell-move':LyraCellMoveEvent;'lr-cell-resize':LyraCellResizeEvent;'lr-change':LyraChangeEvent;'lr-change-decision-request':LyraChangeDecisionRequestEvent;'lr-change-request':LyraChangeRequestEvent;'lr-chart-row-select':LyraChartRowSelectEvent;'lr-checkbox-group-toggle-request':LyraCheckboxGroupToggleRequestEvent;'lr-checkbox-toggle-request':LyraCheckboxToggleRequestEvent;'lr-chip-change':LyraChipChangeEvent;'lr-chip-toggle-request':LyraChipToggleRequestEvent;'lr-chunk-open':LyraChunkOpenEvent;'lr-chunk-select':LyraChunkSelectEvent;'lr-citation-activate':LyraCitationActivateEvent;'lr-citation-open':LyraCitationOpenEvent;'lr-citation-select':LyraCitationSelectEvent;'lr-claim-select':LyraClaimSelectEvent;'lr-clear':LyraClearEvent;'lr-close':LyraCloseEvent;'lr-close-request':LyraCloseRequestEvent;'lr-cluster-activate':LyraClusterActivateEvent;'lr-collapse':LyraCollapseEvent;'lr-collision':LyraCollisionEvent;'lr-column-move':LyraColumnMoveEvent;'lr-column-pin':LyraColumnPinEvent;'lr-column-resize':LyraColumnResizeEvent;'lr-column-resize-request':LyraColumnResizeRequestEvent;'lr-column-visibility-change':LyraColumnVisibilityChangeEvent;'lr-community-activate':LyraCommunityActivateEvent;'lr-complete':LyraCompleteEvent;'lr-connect':LyraConnectEvent;'lr-connector-action':LyraConnectorActionEvent;'lr-content-change':LyraContentChangeEvent;'lr-content-settled':LyraContentSettledEvent;'lr-copy':LyraCopyEvent;'lr-copy-error':LyraCopyErrorEvent;'lr-create':LyraCreateEvent;'lr-cue-change':LyraCueChangeEvent;'lr-data-error':LyraDataErrorEvent;'lr-date-select':LyraDateSelectEvent;'lr-datum-activate':LyraDatumActivateEvent;'lr-datum-visibility-change':LyraDatumVisibilityChangeEvent;'lr-datum-visibility-change-request':LyraDatumVisibilityChangeRequestEvent;'lr-decision-settled':LyraDecisionSettledEvent;'lr-deny-request':LyraDenyRequestEvent;'lr-disconnect':LyraDisconnectEvent;'lr-dismiss':LyraDismissEvent;'lr-download':LyraDownloadEvent;'lr-download-request':LyraDownloadRequestEvent;'lr-drill':LyraDrillEvent;'lr-drilldown-category-change':LyraDrilldownCategoryChangeEvent;'lr-drilldown-document-download':LyraDrilldownDocumentDownloadEvent;'lr-drilldown-document-highlight-activate':LyraDrilldownDocumentHighlightActivateEvent;'lr-drilldown-document-render-error':LyraDrilldownDocumentRenderErrorEvent;'lr-drilldown-entity-activate':LyraDrilldownEntityActivateEvent;'lr-drilldown-evidence-expand':LyraDrilldownEvidenceExpandEvent;'lr-drilldown-evidence-open':LyraDrilldownEvidenceOpenEvent;'lr-drilldown-navigate':LyraDrilldownNavigateEvent;'lr-edge-activate':LyraEdgeActivateEvent;'lr-edge-enter':LyraEdgeEnterEvent;'lr-edge-leave':LyraEdgeLeaveEvent;'lr-edit':LyraEditEvent;'lr-engine-fallback':LyraEngineFallbackEvent;'lr-entity-open':LyraEntityOpenEvent;'lr-entity-select':LyraEntitySelectEvent;'lr-error':LyraErrorEvent;'lr-event-select':LyraEventSelectEvent;'lr-example-add-request':LyraExampleAddRequestEvent;'lr-example-citation-select':LyraExampleCitationSelectEvent;'lr-example-claim-select':LyraExampleClaimSelectEvent;'lr-example-remove-request':LyraExampleRemoveRequestEvent;'lr-example-select':LyraExampleSelectEvent;'lr-example-toggle':LyraExampleToggleEvent;'lr-example-tool-activate':LyraExampleToolActivateEvent;'lr-example-tool-approval-decide-request':LyraExampleToolApprovalDecideRequestEvent;'lr-example-tool-render-error':LyraExampleToolRenderErrorEvent;'lr-expand':LyraExpandEvent;'lr-export-complete':LyraExportCompleteEvent;'lr-export-error':LyraExportErrorEvent;'lr-export-request':LyraExportRequestEvent;'lr-feedback-change':LyraFeedbackChangeEvent;'lr-feedback-submit-request':LyraFeedbackSubmitRequestEvent;'lr-file-open':LyraFileOpenEvent;'lr-file-select':LyraFileSelectEvent;'lr-files':LyraFilesEvent;'lr-filter':LyraFilterEvent;'lr-filter-change':LyraFilterChangeEvent;'lr-filters-change':LyraFiltersChangeEvent;'lr-finish':LyraFinishEvent;'lr-fit-change':LyraFitChangeEvent;'lr-focus-day':LyraFocusDayEvent;'lr-follow-change':LyraFollowChangeEvent;'lr-forget':LyraForgetEvent;'lr-frame-select':LyraFrameSelectEvent;'lr-fullscreen-change':LyraFullscreenChangeEvent;'lr-fullscreen-request':LyraFullscreenRequestEvent;'lr-group-collapse':LyraGroupCollapseEvent;'lr-group-expand':LyraGroupExpandEvent;'lr-group-toggle':LyraGroupToggleEvent;'lr-group-toggle-request':LyraGroupToggleRequestEvent;'lr-hidden-types-change':LyraHiddenTypesChangeEvent;'lr-hide':LyraHideEvent;'lr-highlight-activate':LyraHighlightActivateEvent;'lr-hover':LyraHoverEvent;'lr-import-request':LyraImportRequestEvent;'lr-include-error':LyraIncludeErrorEvent;'lr-index-change':LyraIndexChangeEvent;'lr-ingestion-cancel':LyraIngestionCancelEvent;'lr-ingestion-retry':LyraIngestionRetryEvent;'lr-initial-focus':LyraInitialFocusEvent;'lr-input':LyraInputEvent;'lr-input-settled':LyraInputSettledEvent;'lr-interrupt':LyraInterruptEvent;'lr-intersect':LyraIntersectEvent;'lr-intersection':LyraIntersectionEvent;'lr-invalid':LyraInvalidEvent;'lr-item-activate':LyraItemActivateEvent;'lr-layout-change':LyraLayoutChangeEvent;'lr-lazy-change':LyraLazyChangeEvent;'lr-lazy-load':LyraLazyLoadEvent;'lr-legend-visibility-change':LyraLegendVisibilityChangeEvent;'lr-legend-visibility-change-request':LyraLegendVisibilityChangeRequestEvent;'lr-level':LyraLevelEvent;'lr-line-activate':LyraLineActivateEvent;'lr-link-activate':LyraLinkActivateEvent;'lr-load':LyraLoadEvent;'lr-load-children':LyraLoadChildrenEvent;'lr-load-error':LyraLoadErrorEvent;'lr-load-more':LyraLoadMoreEvent;'lr-location-change':LyraLocationChangeEvent;'lr-map-anchor-close':LyraMapAnchorCloseEvent;'lr-map-click':LyraMapClickEvent;'lr-map-contextmenu':LyraMapContextmenuEvent;'lr-map-draw-cancel':LyraMapDrawCancelEvent;'lr-map-draw-change':LyraMapDrawChangeEvent;'lr-map-draw-complete':LyraMapDrawCompleteEvent;'lr-map-draw-start':LyraMapDrawStartEvent;'lr-map-draw-vertex-end':LyraMapDrawVertexEndEvent;'lr-map-export-error':LyraMapExportErrorEvent;'lr-map-feature-enter':LyraMapFeatureEnterEvent;'lr-map-feature-leave':LyraMapFeatureLeaveEvent;'lr-map-geolocate':LyraMapGeolocateEvent;'lr-map-geolocate-error':LyraMapGeolocateErrorEvent;'lr-map-geolocate-out-of-bounds':LyraMapGeolocateOutOfBoundsEvent;'lr-map-idle':LyraMapIdleEvent;'lr-map-legend-panel-toggle-request':LyraMapLegendPanelToggleRequestEvent;'lr-map-legend-toggle-request':LyraMapLegendToggleRequestEvent;'lr-map-load':LyraMapLoadEvent;'lr-map-marker-activate':LyraMapMarkerActivateEvent;'lr-map-move':LyraMapMoveEvent;'lr-map-pick':LyraMapPickEvent;'lr-map-pointer-leave':LyraMapPointerLeaveEvent;'lr-map-pointer-move':LyraMapPointerMoveEvent;'lr-map-style-load':LyraMapStyleLoadEvent;'lr-map-view-change':LyraMapViewChangeEvent;'lr-matrix-geometry-change':LyraMatrixGeometryChangeEvent;'lr-matrix-range-select':LyraMatrixRangeSelectEvent;'lr-maximize-change-request':LyraMaximizeChangeRequestEvent;'lr-mcp-initialized':LyraMcpInitializedEvent;'lr-mcp-log':LyraMcpLogEvent;'lr-mcp-open-link':LyraMcpOpenLinkEvent;'lr-mcp-ready':LyraMcpReadyEvent;'lr-mcp-request':LyraMcpRequestEvent;'lr-mcp-resize':LyraMcpResizeEvent;'lr-mcp-send-message':LyraMcpSendMessageEvent;'lr-mcp-tool-call':LyraMcpToolCallEvent;'lr-media-download-request':LyraMediaDownloadRequestEvent;'lr-media-open':LyraMediaOpenEvent;'lr-mention-close':LyraMentionCloseEvent;'lr-mention-select':LyraMentionSelectEvent;'lr-menu-item-change-request':LyraMenuItemChangeRequestEvent;'lr-menu-item-state-change':LyraMenuItemStateChangeEvent;'lr-message-reorder-request':LyraMessageReorderRequestEvent;'lr-message-retry':LyraMessageRetryEvent;'lr-metric-change-request':LyraMetricChangeRequestEvent;'lr-mode-change':LyraModeChangeEvent;'lr-model-change':LyraModelChangeEvent;'lr-move-request':LyraMoveRequestEvent;'lr-multi-split-collapse-change':LyraMultiSplitCollapseChangeEvent;'lr-multi-split-constraints-invalid':LyraMultiSplitConstraintsInvalidEvent;'lr-multi-split-orientation-change':LyraMultiSplitOrientationChangeEvent;'lr-mutation':LyraMutationEvent;'lr-mute-change':LyraMuteChangeEvent;'lr-nav-open-change':LyraNavOpenChangeEvent;'lr-nav-toggle-request':LyraNavToggleRequestEvent;'lr-node-activate':LyraNodeActivateEvent;'lr-node-add':LyraNodeAddEvent;'lr-node-enter':LyraNodeEnterEvent;'lr-node-expand':LyraNodeExpandEvent;'lr-node-leave':LyraNodeLeaveEvent;'lr-node-move':LyraNodeMoveEvent;'lr-node-select':LyraNodeSelectEvent;'lr-node-toggle':LyraNodeToggleEvent;'lr-open':LyraOpenEvent;'lr-option-change':LyraOptionChangeEvent;'lr-overflow':LyraOverflowEvent;'lr-overflow-activate':LyraOverflowActivateEvent;'lr-overflow-toggle':LyraOverflowToggleEvent;'lr-page-change':LyraPageChangeEvent;'lr-page-select':LyraPageSelectEvent;'lr-page-viewer-state-change':LyraPageViewerStateChangeEvent;'lr-palette-place':LyraPalettePlaceEvent;'lr-panorama-camera-change':LyraPanoramaCameraChangeEvent;'lr-panorama-hotspot-select':LyraPanoramaHotspotSelectEvent;'lr-part-resume':LyraPartResumeEvent;'lr-part-retry':LyraPartRetryEvent;'lr-path-request':LyraPathRequestEvent;'lr-pause':LyraPauseEvent;'lr-pause-change':LyraPauseChangeEvent;'lr-peek-change':LyraPeekChangeEvent;'lr-permission-decision':LyraPermissionDecisionEvent;'lr-permission-rule-change':LyraPermissionRuleChangeEvent;'lr-pin-change':LyraPinChangeEvent;'lr-play':LyraPlayEvent;'lr-point-activate':LyraPointActivateEvent;'lr-point-select':LyraPointSelectEvent;'lr-poll-due':LyraPollDueEvent;'lr-preview-change':LyraPreviewChangeEvent;'lr-preview-request':LyraPreviewRequestEvent;'lr-priority-columns-visibility-change':LyraPriorityColumnsVisibilityChangeEvent;'lr-query-change':LyraQueryChangeEvent;'lr-query-delete':LyraQueryDeleteEvent;'lr-query-delete-request':LyraQueryDeleteRequestEvent;'lr-query-load':LyraQueryLoadEvent;'lr-query-load-request':LyraQueryLoadRequestEvent;'lr-query-run':LyraQueryRunEvent;'lr-query-run-request':LyraQueryRunRequestEvent;'lr-query-save':LyraQuerySaveEvent;'lr-query-save-request':LyraQuerySaveRequestEvent;'lr-question-input':LyraQuestionInputEvent;'lr-question-response':LyraQuestionResponseEvent;'lr-queue-change':LyraQueueChangeEvent;'lr-rail-resize':LyraRailResizeEvent;'lr-rail-resize-request':LyraRailResizeRequestEvent;'lr-rate-change':LyraRateChangeEvent;'lr-readonly-change':LyraReadonlyChangeEvent;'lr-record-cancel':LyraRecordCancelEvent;'lr-record-chunk':LyraRecordChunkEvent;'lr-record-error':LyraRecordErrorEvent;'lr-record-start':LyraRecordStartEvent;'lr-record-state-change':LyraRecordStateChangeEvent;'lr-record-stop':LyraRecordStopEvent;'lr-recover':LyraRecoverEvent;'lr-regenerate':LyraRegenerateEvent;'lr-relation-activate':LyraRelationActivateEvent;'lr-remove':LyraRemoveEvent;'lr-remove-condition':LyraRemoveConditionEvent;'lr-rename':LyraRenameEvent;'lr-render-error':LyraRenderErrorEvent;'lr-reorder':LyraReorderEvent;'lr-reorder-request':LyraReorderRequestEvent;'lr-reposition':LyraRepositionEvent;'lr-reposition-request':LyraRepositionRequestEvent;'lr-request':LyraRequestEvent;'lr-request-close':LyraRequestCloseEvent;'lr-reset':LyraResetEvent;'lr-resize':LyraResizeEvent;'lr-resize-change':LyraResizeChangeEvent;'lr-resize-input':LyraResizeInputEvent;'lr-resize-request':LyraResizeRequestEvent;'lr-restore':LyraRestoreEvent;'lr-resume':LyraResumeEvent;'lr-retrieval-select':LyraRetrievalSelectEvent;'lr-retry':LyraRetryEvent;'lr-retry-request':LyraRetryRequestEvent;'lr-reveal-change':LyraRevealChangeEvent;'lr-review-input':LyraReviewInputEvent;'lr-review-skip':LyraReviewSkipEvent;'lr-review-submit':LyraReviewSubmitEvent;'lr-review-validity-change':LyraReviewValidityChangeEvent;'lr-rotation-change':LyraRotationChangeEvent;'lr-row-activate':LyraRowActivateEvent;'lr-row-collapse':LyraRowCollapseEvent;'lr-row-expand':LyraRowExpandEvent;'lr-row-expand-request':LyraRowExpandRequestEvent;'lr-row-expand-toggle':LyraRowExpandToggleEvent;'lr-row-select':LyraRowSelectEvent;'lr-run':LyraRunEvent;'lr-run-activate':LyraRunActivateEvent;'lr-run-cancel':LyraRunCancelEvent;'lr-run-retry':LyraRunRetryEvent;'lr-save':LyraSaveEvent;'lr-schema-select':LyraSchemaSelectEvent;'lr-scroll':LyraScrollEvent;'lr-search':LyraSearchEvent;'lr-search-change':LyraSearchChangeEvent;'lr-segment-activate-request':LyraSegmentActivateRequestEvent;'lr-select':LyraSelectEvent;'lr-selection-action':LyraSelectionActionEvent;'lr-selection-change':LyraSelectionChangeEvent;'lr-selection-delete':LyraSelectionDeleteEvent;'lr-send-now':LyraSendNowEvent;'lr-sequence-step':LyraSequenceStepEvent;'lr-show':LyraShowEvent;'lr-skip':LyraSkipEvent;'lr-slice-change-request':LyraSliceChangeRequestEvent;'lr-slide-change':LyraSlideChangeEvent;'lr-sort':LyraSortEvent;'lr-sort-change':LyraSortChangeEvent;'lr-sort-request':LyraSortRequestEvent;'lr-source-category-select':LyraSourceCategorySelectEvent;'lr-source-create':LyraSourceCreateEvent;'lr-source-delete':LyraSourceDeleteEvent;'lr-source-error':LyraSourceErrorEvent;'lr-source-pause':LyraSourcePauseEvent;'lr-source-point-select':LyraSourcePointSelectEvent;'lr-source-selection-change':LyraSourceSelectionChangeEvent;'lr-source-sync':LyraSourceSyncEvent;'lr-sources-change':LyraSourcesChangeEvent;'lr-span-select':LyraSpanSelectEvent;'lr-span-toggle':LyraSpanToggleEvent;'lr-span-visibility-change':LyraSpanVisibilityChangeEvent;'lr-spatial-bin-select':LyraSpatialBinSelectEvent;'lr-spatial-point-select':LyraSpatialPointSelectEvent;'lr-stage-chunk-action':LyraStageChunkActionEvent;'lr-stage-select':LyraStageSelectEvent;'lr-stall':LyraStallEvent;'lr-start':LyraStartEvent;'lr-step-select':LyraStepSelectEvent;'lr-stepper-orientation-change':LyraStepperOrientationChangeEvent;'lr-stop':LyraStopEvent;'lr-submit':LyraSubmitEvent;'lr-suggestion-select':LyraSuggestionSelectEvent;'lr-switch-toggle-request':LyraSwitchToggleRequestEvent;'lr-tab-change':LyraTabChangeEvent;'lr-tab-hide':LyraTabHideEvent;'lr-tab-show':LyraTabShowEvent;'lr-take-over':LyraTakeOverEvent;'lr-test-select':LyraTestSelectEvent;'lr-text-select':LyraTextSelectEvent;'lr-thread-archive':LyraThreadArchiveEvent;'lr-thread-delete':LyraThreadDeleteEvent;'lr-thread-pin':LyraThreadPinEvent;'lr-thread-rename':LyraThreadRenameEvent;'lr-time-change':LyraTimeChangeEvent;'lr-toast-overflow':LyraToastOverflowEvent;'lr-toggle':LyraToggleEvent;'lr-toggle-group-toggle-request':LyraToggleGroupToggleRequestEvent;'lr-toggle-request':LyraToggleRequestEvent;'lr-toggle-toggle-request':LyraToggleToggleRequestEvent;'lr-token-add-request':LyraTokenAddRequestEvent;'lr-token-edit-request':LyraTokenEditRequestEvent;'lr-token-remove-request':LyraTokenRemoveRequestEvent;'lr-tool-activate':LyraToolActivateEvent;'lr-tool-approval-decide-request':LyraToolApprovalDecideRequestEvent;'lr-tool-call-chip-select':LyraToolCallChipSelectEvent;'lr-tool-render-error':LyraToolRenderErrorEvent;'lr-toolbar-actions-change':LyraToolbarActionsChangeEvent;'lr-topic-select':LyraTopicSelectEvent;'lr-topic-toggle':LyraTopicToggleEvent;'lr-tour-end':LyraTourEndEvent;'lr-tour-end-request':LyraTourEndRequestEvent;'lr-tour-start':LyraTourStartEvent;'lr-tour-step-change-request':LyraTourStepChangeRequestEvent;'lr-tour-target-missing':LyraTourTargetMissingEvent;'lr-validity-change':LyraValidityChangeEvent;'lr-version-change':LyraVersionChangeEvent;'lr-version-select':LyraVersionSelectEvent;'lr-video-change':LyraVideoChangeEvent;'lr-view-change':LyraViewChangeEvent;'lr-view-request':LyraViewRequestEvent;'lr-viewer-diagnostic':LyraViewerDiagnosticEvent;'lr-viewport-change':LyraViewportChangeEvent;'lr-virtual-scroll':LyraVirtualScrollEvent;'lr-visibility-change':LyraVisibilityChangeEvent;'lr-visibility-change-request':LyraVisibilityChangeRequestEvent;'lr-visible-range-change':LyraVisibleRangeChangeEvent;'lr-voice-change':LyraVoiceChangeEvent;'lr-vote-request':LyraVoteRequestEvent;'lr-widget-action':LyraWidgetActionEvent;'lr-widget-state-change':LyraWidgetStateChangeEvent;'lr-word-activate':LyraWordActivateEvent;'lr-zoom':LyraZoomEvent;'lr-zoom-change':LyraZoomChangeEvent;}declare global{
|
|
2190
2199
|
/**
|
|
2191
2200
|
* Extended rather than re-declared member by member so `LyraGlobalEventMap` remains the one
|
|
2192
2201
|
* definition. `HTMLElementEventMap`, `DocumentEventMap`, `WindowEventMap`, and
|