@spatial-elements/core 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/README.md +17 -0
- package/dist/catalog/CarouselGlassCompositor.d.ts +24 -0
- package/dist/catalog/CarouselGlassCompositor.d.ts.map +1 -0
- package/dist/catalog/CarouselGlassCompositor.js +132 -0
- package/dist/catalog/CarouselGlassCompositor.js.map +1 -0
- package/dist/catalog/CatalogEndpointRegistry.d.ts +59 -0
- package/dist/catalog/CatalogEndpointRegistry.d.ts.map +1 -0
- package/dist/catalog/CatalogEndpointRegistry.js +187 -0
- package/dist/catalog/CatalogEndpointRegistry.js.map +1 -0
- package/dist/catalog/CatalogGeometryFade.d.ts +12 -0
- package/dist/catalog/CatalogGeometryFade.d.ts.map +1 -0
- package/dist/catalog/CatalogGeometryFade.js +67 -0
- package/dist/catalog/CatalogGeometryFade.js.map +1 -0
- package/dist/catalog/CatalogPreparation.d.ts +40 -0
- package/dist/catalog/CatalogPreparation.d.ts.map +1 -0
- package/dist/catalog/CatalogPreparation.js +141 -0
- package/dist/catalog/CatalogPreparation.js.map +1 -0
- package/dist/catalog/CatalogSections.d.ts +36 -0
- package/dist/catalog/CatalogSections.d.ts.map +1 -0
- package/dist/catalog/CatalogSections.js +51 -0
- package/dist/catalog/CatalogSections.js.map +1 -0
- package/dist/catalog/CatalogSpatialElementLayer.d.ts +149 -0
- package/dist/catalog/CatalogSpatialElementLayer.d.ts.map +1 -0
- package/dist/catalog/CatalogSpatialElementLayer.js +920 -0
- package/dist/catalog/CatalogSpatialElementLayer.js.map +1 -0
- package/dist/catalog/CatalogTransition.d.ts +93 -0
- package/dist/catalog/CatalogTransition.d.ts.map +1 -0
- package/dist/catalog/CatalogTransition.js +1299 -0
- package/dist/catalog/CatalogTransition.js.map +1 -0
- package/dist/catalog/EnvironmentCache.d.ts +30 -0
- package/dist/catalog/EnvironmentCache.d.ts.map +1 -0
- package/dist/catalog/EnvironmentCache.js +128 -0
- package/dist/catalog/EnvironmentCache.js.map +1 -0
- package/dist/catalog/PreparationGate.d.ts +10 -0
- package/dist/catalog/PreparationGate.d.ts.map +1 -0
- package/dist/catalog/PreparationGate.js +66 -0
- package/dist/catalog/PreparationGate.js.map +1 -0
- package/dist/catalog/PresentationLease.d.ts +16 -0
- package/dist/catalog/PresentationLease.d.ts.map +1 -0
- package/dist/catalog/PresentationLease.js +33 -0
- package/dist/catalog/PresentationLease.js.map +1 -0
- package/dist/catalog/SpatialGeometryCapture.d.ts +63 -0
- package/dist/catalog/SpatialGeometryCapture.d.ts.map +1 -0
- package/dist/catalog/SpatialGeometryCapture.js +158 -0
- package/dist/catalog/SpatialGeometryCapture.js.map +1 -0
- package/dist/catalog/assets/SpatialElementAssetManager.d.ts +92 -0
- package/dist/catalog/assets/SpatialElementAssetManager.d.ts.map +1 -0
- package/dist/catalog/assets/SpatialElementAssetManager.js +305 -0
- package/dist/catalog/assets/SpatialElementAssetManager.js.map +1 -0
- package/dist/catalog/assets/assetCosts.d.ts +4 -0
- package/dist/catalog/assets/assetCosts.d.ts.map +1 -0
- package/dist/catalog/assets/assetCosts.js +33 -0
- package/dist/catalog/assets/assetCosts.js.map +1 -0
- package/dist/catalog/assets/spatialElementAssetResources.d.ts +25 -0
- package/dist/catalog/assets/spatialElementAssetResources.d.ts.map +1 -0
- package/dist/catalog/assets/spatialElementAssetResources.js +100 -0
- package/dist/catalog/assets/spatialElementAssetResources.js.map +1 -0
- package/dist/catalog/carouselPanelProjection.d.ts +9 -0
- package/dist/catalog/carouselPanelProjection.d.ts.map +1 -0
- package/dist/catalog/carouselPanelProjection.js +33 -0
- package/dist/catalog/carouselPanelProjection.js.map +1 -0
- package/dist/catalog/carouselSelection.d.ts +7 -0
- package/dist/catalog/carouselSelection.d.ts.map +1 -0
- package/dist/catalog/carouselSelection.js +15 -0
- package/dist/catalog/carouselSelection.js.map +1 -0
- package/dist/catalog/catalogAction.d.ts +4 -0
- package/dist/catalog/catalogAction.d.ts.map +1 -0
- package/dist/catalog/catalogAction.js +9 -0
- package/dist/catalog/catalogAction.js.map +1 -0
- package/dist/catalog/catalogGeometryRequest.d.ts +13 -0
- package/dist/catalog/catalogGeometryRequest.d.ts.map +1 -0
- package/dist/catalog/catalogGeometryRequest.js +8 -0
- package/dist/catalog/catalogGeometryRequest.js.map +1 -0
- package/dist/catalog/catalogItems.d.ts +10 -0
- package/dist/catalog/catalogItems.d.ts.map +1 -0
- package/dist/catalog/catalogItems.js +23 -0
- package/dist/catalog/catalogItems.js.map +1 -0
- package/dist/catalog/catalogJourney.d.ts +38 -0
- package/dist/catalog/catalogJourney.d.ts.map +1 -0
- package/dist/catalog/catalogJourney.js +64 -0
- package/dist/catalog/catalogJourney.js.map +1 -0
- package/dist/catalog/catalogPage.d.ts +11 -0
- package/dist/catalog/catalogPage.d.ts.map +1 -0
- package/dist/catalog/catalogPage.js +2 -0
- package/dist/catalog/catalogPage.js.map +1 -0
- package/dist/catalog/catalogPose.d.ts +30 -0
- package/dist/catalog/catalogPose.d.ts.map +1 -0
- package/dist/catalog/catalogPose.js +35 -0
- package/dist/catalog/catalogPose.js.map +1 -0
- package/dist/catalog/catalogPresentation.d.ts +24 -0
- package/dist/catalog/catalogPresentation.d.ts.map +1 -0
- package/dist/catalog/catalogPresentation.js +56 -0
- package/dist/catalog/catalogPresentation.js.map +1 -0
- package/dist/catalog/catalogRecipes.d.ts +21 -0
- package/dist/catalog/catalogRecipes.d.ts.map +1 -0
- package/dist/catalog/catalogRecipes.js +84 -0
- package/dist/catalog/catalogRecipes.js.map +1 -0
- package/dist/catalog/catalogSurfaceCapture.d.ts +11 -0
- package/dist/catalog/catalogSurfaceCapture.d.ts.map +1 -0
- package/dist/catalog/catalogSurfaceCapture.js +11 -0
- package/dist/catalog/catalogSurfaceCapture.js.map +1 -0
- package/dist/catalog/catalogViewLink.d.ts +8 -0
- package/dist/catalog/catalogViewLink.d.ts.map +1 -0
- package/dist/catalog/catalogViewLink.js +37 -0
- package/dist/catalog/catalogViewLink.js.map +1 -0
- package/dist/catalog/rebasePresentation.d.ts +3 -0
- package/dist/catalog/rebasePresentation.d.ts.map +1 -0
- package/dist/catalog/rebasePresentation.js +26 -0
- package/dist/catalog/rebasePresentation.js.map +1 -0
- package/dist/catalog/spatialElementAssets.d.ts +158 -0
- package/dist/catalog/spatialElementAssets.d.ts.map +1 -0
- package/dist/catalog/spatialElementAssets.js +92 -0
- package/dist/catalog/spatialElementAssets.js.map +1 -0
- package/dist/catalog/spatialElementLodPair.d.ts +17 -0
- package/dist/catalog/spatialElementLodPair.d.ts.map +1 -0
- package/dist/catalog/spatialElementLodPair.js +5 -0
- package/dist/catalog/spatialElementLodPair.js.map +1 -0
- package/dist/catalog/transitionTiming.d.ts +15 -0
- package/dist/catalog/transitionTiming.d.ts.map +1 -0
- package/dist/catalog/transitionTiming.js +22 -0
- package/dist/catalog/transitionTiming.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/spatial-element/SpatialElementDockController.d.ts +101 -0
- package/dist/spatial-element/SpatialElementDockController.d.ts.map +1 -0
- package/dist/spatial-element/SpatialElementDockController.js +627 -0
- package/dist/spatial-element/SpatialElementDockController.js.map +1 -0
- package/dist/spatial-element/spatialElement.d.ts +28 -0
- package/dist/spatial-element/spatialElement.d.ts.map +1 -0
- package/dist/spatial-element/spatialElement.js +45 -0
- package/dist/spatial-element/spatialElement.js.map +1 -0
- package/dist/spatial-element/spatialElementDock.d.ts +43 -0
- package/dist/spatial-element/spatialElementDock.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementDock.js +126 -0
- package/dist/spatial-element/spatialElementDock.js.map +1 -0
- package/dist/spatial-element/spatialElementSectionRegistry.d.ts +29 -0
- package/dist/spatial-element/spatialElementSectionRegistry.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementSectionRegistry.js +67 -0
- package/dist/spatial-element/spatialElementSectionRegistry.js.map +1 -0
- package/dist/spatial-element/types.d.ts +165 -0
- package/dist/spatial-element/types.d.ts.map +1 -0
- package/dist/spatial-element/types.js +2 -0
- package/dist/spatial-element/types.js.map +1 -0
- package/dist/stage/LiquidGlassPanel.d.ts +55 -0
- package/dist/stage/LiquidGlassPanel.d.ts.map +1 -0
- package/dist/stage/LiquidGlassPanel.js +447 -0
- package/dist/stage/LiquidGlassPanel.js.map +1 -0
- package/dist/stage/MinimapBlurPipeline.d.ts +34 -0
- package/dist/stage/MinimapBlurPipeline.d.ts.map +1 -0
- package/dist/stage/MinimapBlurPipeline.js +147 -0
- package/dist/stage/MinimapBlurPipeline.js.map +1 -0
- package/dist/stage/MinimapController.d.ts +113 -0
- package/dist/stage/MinimapController.d.ts.map +1 -0
- package/dist/stage/MinimapController.js +803 -0
- package/dist/stage/MinimapController.js.map +1 -0
- package/dist/stage/OrbitControlsInterop.d.ts +8 -0
- package/dist/stage/OrbitControlsInterop.d.ts.map +1 -0
- package/dist/stage/OrbitControlsInterop.js +19 -0
- package/dist/stage/OrbitControlsInterop.js.map +1 -0
- package/dist/stage/PageBindingController.d.ts +41 -0
- package/dist/stage/PageBindingController.d.ts.map +1 -0
- package/dist/stage/PageBindingController.js +92 -0
- package/dist/stage/PageBindingController.js.map +1 -0
- package/dist/stage/PanelPresentationController.d.ts +92 -0
- package/dist/stage/PanelPresentationController.d.ts.map +1 -0
- package/dist/stage/PanelPresentationController.js +569 -0
- package/dist/stage/PanelPresentationController.js.map +1 -0
- package/dist/stage/PresentationReadiness.d.ts +30 -0
- package/dist/stage/PresentationReadiness.d.ts.map +1 -0
- package/dist/stage/PresentationReadiness.js +94 -0
- package/dist/stage/PresentationReadiness.js.map +1 -0
- package/dist/stage/SpaceMouseAdapter.d.ts +76 -0
- package/dist/stage/SpaceMouseAdapter.d.ts.map +1 -0
- package/dist/stage/SpaceMouseAdapter.js +197 -0
- package/dist/stage/SpaceMouseAdapter.js.map +1 -0
- package/dist/stage/SpatialElementInteractionController.d.ts +126 -0
- package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -0
- package/dist/stage/SpatialElementInteractionController.js +581 -0
- package/dist/stage/SpatialElementInteractionController.js.map +1 -0
- package/dist/stage/SpatialElementPresentationController.d.ts +82 -0
- package/dist/stage/SpatialElementPresentationController.d.ts.map +1 -0
- package/dist/stage/SpatialElementPresentationController.js +372 -0
- package/dist/stage/SpatialElementPresentationController.js.map +1 -0
- package/dist/stage/SpatialElementRefinement.d.ts +26 -0
- package/dist/stage/SpatialElementRefinement.d.ts.map +1 -0
- package/dist/stage/SpatialElementRefinement.js +105 -0
- package/dist/stage/SpatialElementRefinement.js.map +1 -0
- package/dist/stage/StageExperience.d.ts +536 -0
- package/dist/stage/StageExperience.d.ts.map +1 -0
- package/dist/stage/StageExperience.js +2399 -0
- package/dist/stage/StageExperience.js.map +1 -0
- package/dist/stage/StagePanelLayout.d.ts +15 -0
- package/dist/stage/StagePanelLayout.d.ts.map +1 -0
- package/dist/stage/StagePanelLayout.js +20 -0
- package/dist/stage/StagePanelLayout.js.map +1 -0
- package/dist/stage/StagePanelRuntime.d.ts +20 -0
- package/dist/stage/StagePanelRuntime.d.ts.map +1 -0
- package/dist/stage/StagePanelRuntime.js +2 -0
- package/dist/stage/StagePanelRuntime.js.map +1 -0
- package/dist/stage/StageRenderPipeline.d.ts +179 -0
- package/dist/stage/StageRenderPipeline.d.ts.map +1 -0
- package/dist/stage/StageRenderPipeline.js +901 -0
- package/dist/stage/StageRenderPipeline.js.map +1 -0
- package/dist/stage/VirtualScrollController.d.ts +64 -0
- package/dist/stage/VirtualScrollController.d.ts.map +1 -0
- package/dist/stage/VirtualScrollController.js +329 -0
- package/dist/stage/VirtualScrollController.js.map +1 -0
- package/dist/stage/cssProjection.d.ts +18 -0
- package/dist/stage/cssProjection.d.ts.map +1 -0
- package/dist/stage/cssProjection.js +52 -0
- package/dist/stage/cssProjection.js.map +1 -0
- package/dist/stage/damping.d.ts +3 -0
- package/dist/stage/damping.d.ts.map +1 -0
- package/dist/stage/damping.js +8 -0
- package/dist/stage/damping.js.map +1 -0
- package/dist/stage/minimap/MinimapGeometry.d.ts +31 -0
- package/dist/stage/minimap/MinimapGeometry.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapGeometry.js +163 -0
- package/dist/stage/minimap/MinimapGeometry.js.map +1 -0
- package/dist/stage/minimap/MinimapModel.d.ts +16 -0
- package/dist/stage/minimap/MinimapModel.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapModel.js +51 -0
- package/dist/stage/minimap/MinimapModel.js.map +1 -0
- package/dist/stage/minimap/MinimapProjection.d.ts +41 -0
- package/dist/stage/minimap/MinimapProjection.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapProjection.js +113 -0
- package/dist/stage/minimap/MinimapProjection.js.map +1 -0
- package/dist/stage/minimap/MinimapState.d.ts +102 -0
- package/dist/stage/minimap/MinimapState.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapState.js +2 -0
- package/dist/stage/minimap/MinimapState.js.map +1 -0
- package/dist/stage/minimapMeasurement.d.ts +5 -0
- package/dist/stage/minimapMeasurement.d.ts.map +1 -0
- package/dist/stage/minimapMeasurement.js +11 -0
- package/dist/stage/minimapMeasurement.js.map +1 -0
- package/dist/stage/panelContext.d.ts +71 -0
- package/dist/stage/panelContext.d.ts.map +1 -0
- package/dist/stage/panelContext.js +6 -0
- package/dist/stage/panelContext.js.map +1 -0
- package/dist/stage/panelShadow.d.ts +20 -0
- package/dist/stage/panelShadow.d.ts.map +1 -0
- package/dist/stage/panelShadow.js +22 -0
- package/dist/stage/panelShadow.js.map +1 -0
- package/dist/stage/renderMeasurement.d.ts +3 -0
- package/dist/stage/renderMeasurement.d.ts.map +1 -0
- package/dist/stage/renderMeasurement.js +19 -0
- package/dist/stage/renderMeasurement.js.map +1 -0
- package/dist/stage/renderTargetInventory.d.ts +17 -0
- package/dist/stage/renderTargetInventory.d.ts.map +1 -0
- package/dist/stage/renderTargetInventory.js +27 -0
- package/dist/stage/renderTargetInventory.js.map +1 -0
- package/dist/stage/rendererState.d.ts +14 -0
- package/dist/stage/rendererState.d.ts.map +1 -0
- package/dist/stage/rendererState.js +35 -0
- package/dist/stage/rendererState.js.map +1 -0
- package/dist/stage/resolveStageProfile.d.ts +44 -0
- package/dist/stage/resolveStageProfile.d.ts.map +1 -0
- package/dist/stage/resolveStageProfile.js +30 -0
- package/dist/stage/resolveStageProfile.js.map +1 -0
- package/dist/stage/scrollAnimation.d.ts +10 -0
- package/dist/stage/scrollAnimation.d.ts.map +1 -0
- package/dist/stage/scrollAnimation.js +11 -0
- package/dist/stage/scrollAnimation.js.map +1 -0
- package/dist/stage/scrollFrame.d.ts +43 -0
- package/dist/stage/scrollFrame.d.ts.map +1 -0
- package/dist/stage/scrollFrame.js +232 -0
- package/dist/stage/scrollFrame.js.map +1 -0
- package/dist/stage/spatialElementFrame.d.ts +6 -0
- package/dist/stage/spatialElementFrame.d.ts.map +1 -0
- package/dist/stage/spatialElementFrame.js +22 -0
- package/dist/stage/spatialElementFrame.js.map +1 -0
- package/dist/stage/stageConstants.d.ts +85 -0
- package/dist/stage/stageConstants.d.ts.map +1 -0
- package/dist/stage/stageConstants.js +85 -0
- package/dist/stage/stageConstants.js.map +1 -0
- package/dist/stage/stageDom.d.ts +10 -0
- package/dist/stage/stageDom.d.ts.map +1 -0
- package/dist/stage/stageDom.js +22 -0
- package/dist/stage/stageDom.js.map +1 -0
- package/dist/stage/stageMath.d.ts +187 -0
- package/dist/stage/stageMath.d.ts.map +1 -0
- package/dist/stage/stageMath.js +344 -0
- package/dist/stage/stageMath.js.map +1 -0
- package/dist/stage/stageSceneUtils.d.ts +42 -0
- package/dist/stage/stageSceneUtils.d.ts.map +1 -0
- package/dist/stage/stageSceneUtils.js +154 -0
- package/dist/stage/stageSceneUtils.js.map +1 -0
- package/dist/stage/stageTypes.d.ts +189 -0
- package/dist/stage/stageTypes.d.ts.map +1 -0
- package/dist/stage/stageTypes.js +2 -0
- package/dist/stage/stageTypes.js.map +1 -0
- package/dist/stage/stageVisualTest.d.ts +92 -0
- package/dist/stage/stageVisualTest.d.ts.map +1 -0
- package/dist/stage/stageVisualTest.js +5 -0
- package/dist/stage/stageVisualTest.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
import { STAGE_PANEL_LAYOUT_EVENT, STAGE_PANEL_VISUAL_EVENT } from '../stage/panelContext.js';
|
|
2
|
+
import { STAGE_SCROLL_PRIORITY, getStageVisualScrollPosition, subscribeStageScrollFrame } from '../stage/scrollFrame.js';
|
|
3
|
+
import { getCompactMinimapDockDestination, getDockedMinimapCopyReserve, getDockedMinimapInteractionRect, getDockedMinimapModelScale, getMinimapDockDestination, getSpatialElementDockBreakpoint, getSpatialElementDockPresentationProgress, getSpatialElementDockTarget, getSpatialElementSectionScrollOffset, getSpatialElementTabsDockBreakpoint, getSpatialElementTabsDockDestination, getSpatialElementTabsDockProgress, getSpatialElementTabsDockTarget } from './spatialElementDock.js';
|
|
4
|
+
const COMPACT_BREAKPOINT = 1100;
|
|
5
|
+
const TABS_DOCK_MORPH_DISTANCE = 24;
|
|
6
|
+
const MINIMAP_ANCHOR = '[data-spatial-element-dock-minimap-anchor]';
|
|
7
|
+
const PANEL_FRAME = '[data-stage-panel-fallback]';
|
|
8
|
+
const STICKY_HEADER = '[data-spatial-element-sticky-header]';
|
|
9
|
+
const STICKY_MINIMAP_ACTION = '[data-spatial-element-sticky-minimap-action]';
|
|
10
|
+
const TABS_ANCHOR = '[data-spatial-element-tabs-panel-anchor]';
|
|
11
|
+
const TABS_LIST = '[data-spatial-element-tab-list]';
|
|
12
|
+
const TABS_LINKS = '[data-spatial-element-tab-links]';
|
|
13
|
+
const STICKY_TABS = '[data-spatial-element-sticky-tabs]';
|
|
14
|
+
const SPATIAL_ELEMENT_LAYOUT_ROOT = '.stage';
|
|
15
|
+
const DEPARTING_CONTENT = '[data-spatial-element-hero-panel-content], [data-spatial-element-departing-media-content]';
|
|
16
|
+
/**
|
|
17
|
+
* Pins the existing minimap without transforming it and reveals a separate HTML header.
|
|
18
|
+
* The normal element summary remains in document flow and simply leaves with the hero.
|
|
19
|
+
*/
|
|
20
|
+
export class SpatialElementDockController {
|
|
21
|
+
root;
|
|
22
|
+
minimapAnchor;
|
|
23
|
+
minimapFrame;
|
|
24
|
+
stickyHeader;
|
|
25
|
+
stickyMinimapAction;
|
|
26
|
+
stickyHeaderOriginalParent;
|
|
27
|
+
stickyHeaderOriginalNextSibling;
|
|
28
|
+
tabsAnchor;
|
|
29
|
+
tabsFrame;
|
|
30
|
+
sourceTabsList;
|
|
31
|
+
stickyTabs;
|
|
32
|
+
dockedTabsList;
|
|
33
|
+
stickyTabsOriginalParent;
|
|
34
|
+
stickyTabsOriginalNextSibling;
|
|
35
|
+
stickyTabsOriginalStyle = null;
|
|
36
|
+
tabsOriginalSurfaceOpacity = '';
|
|
37
|
+
departingContent = [];
|
|
38
|
+
minimapOriginalStyle = null;
|
|
39
|
+
minimapOriginalDockProgress = null;
|
|
40
|
+
minimapOriginalModelScale = null;
|
|
41
|
+
minimapOriginalModelTop = null;
|
|
42
|
+
minimapDock;
|
|
43
|
+
tabsDock;
|
|
44
|
+
dockedMinimapModelScale = 1;
|
|
45
|
+
dockedMinimapModelTop = 0;
|
|
46
|
+
stickyHeaderBottom = 0;
|
|
47
|
+
breakpoint = 0;
|
|
48
|
+
presentationEndScrollY = 0;
|
|
49
|
+
tabsBreakpoint = Number.POSITIVE_INFINITY;
|
|
50
|
+
tabsPanelRadius = 12;
|
|
51
|
+
tabsDockProgress = -1;
|
|
52
|
+
resizeObserver;
|
|
53
|
+
animationFrame = 0;
|
|
54
|
+
focusTransferFrame = 0;
|
|
55
|
+
focusTransferTimer = 0;
|
|
56
|
+
stopScrollFrames;
|
|
57
|
+
decorationOpacity = 1;
|
|
58
|
+
minimapDockProgress = 0;
|
|
59
|
+
minimapModelScale = 1;
|
|
60
|
+
scrollY = 0;
|
|
61
|
+
minimapDockApplied = false;
|
|
62
|
+
started = false;
|
|
63
|
+
docked = false;
|
|
64
|
+
presentationProgress = 0;
|
|
65
|
+
presentationRevision = 0;
|
|
66
|
+
tabsDocked = false;
|
|
67
|
+
lastFocusedTabId;
|
|
68
|
+
lastTabFocusTime = 0;
|
|
69
|
+
layoutRoot;
|
|
70
|
+
constructor(root) {
|
|
71
|
+
this.root = root;
|
|
72
|
+
this.layoutRoot = root.closest(SPATIAL_ELEMENT_LAYOUT_ROOT) ?? undefined;
|
|
73
|
+
}
|
|
74
|
+
/** Production presentation state, published after this controller's ordered scroll update. */
|
|
75
|
+
getPresentation() {
|
|
76
|
+
return {
|
|
77
|
+
composition: !this.started || !this.stickyHeader?.isConnected
|
|
78
|
+
? 'unavailable'
|
|
79
|
+
: this.docked && this.presentationProgress === 1
|
|
80
|
+
? 'dock'
|
|
81
|
+
: !this.docked && this.presentationProgress === 0
|
|
82
|
+
? 'hero'
|
|
83
|
+
: 'intermediate',
|
|
84
|
+
progress: this.presentationProgress,
|
|
85
|
+
revision: this.presentationRevision
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
start() {
|
|
89
|
+
if (this.started)
|
|
90
|
+
return;
|
|
91
|
+
this.minimapAnchor = this.root.querySelector(MINIMAP_ANCHOR) ?? undefined;
|
|
92
|
+
this.minimapFrame = this.minimapAnchor?.querySelector(PANEL_FRAME) ?? undefined;
|
|
93
|
+
this.stickyHeader = this.root.querySelector(STICKY_HEADER) ?? undefined;
|
|
94
|
+
this.stickyMinimapAction =
|
|
95
|
+
this.stickyHeader?.querySelector(STICKY_MINIMAP_ACTION) ?? undefined;
|
|
96
|
+
this.tabsAnchor = this.root.querySelector(TABS_ANCHOR) ?? undefined;
|
|
97
|
+
this.tabsFrame = this.tabsAnchor?.querySelector(PANEL_FRAME) ?? undefined;
|
|
98
|
+
this.sourceTabsList = this.tabsFrame?.querySelector(TABS_LIST) ?? undefined;
|
|
99
|
+
this.stickyTabs = this.stickyHeader?.querySelector(STICKY_TABS) ?? undefined;
|
|
100
|
+
this.dockedTabsList = this.stickyTabs?.querySelector(TABS_LIST) ?? undefined;
|
|
101
|
+
this.departingContent = Array.from(this.root.querySelectorAll(DEPARTING_CONTENT)).map((element) => ({
|
|
102
|
+
element,
|
|
103
|
+
clipPath: element.style.clipPath,
|
|
104
|
+
webkitClipPath: element.style.getPropertyValue('-webkit-clip-path'),
|
|
105
|
+
documentTop: 0,
|
|
106
|
+
height: 0
|
|
107
|
+
}));
|
|
108
|
+
if (!this.minimapFrame || !this.minimapAnchor || !this.stickyHeader)
|
|
109
|
+
return;
|
|
110
|
+
this.mountStickyHeaderOverlay();
|
|
111
|
+
this.mountStickyTabsOverlay();
|
|
112
|
+
this.minimapOriginalStyle = this.minimapFrame.getAttribute('style');
|
|
113
|
+
this.minimapOriginalDockProgress = this.minimapFrame.getAttribute('data-stage-minimap-dock-progress');
|
|
114
|
+
this.minimapOriginalModelScale = this.minimapFrame.getAttribute('data-stage-minimap-model-scale');
|
|
115
|
+
this.minimapOriginalModelTop = this.minimapFrame.getAttribute('data-stage-minimap-model-top');
|
|
116
|
+
this.stickyTabsOriginalStyle = this.stickyTabs?.getAttribute('style') ?? null;
|
|
117
|
+
this.tabsOriginalSurfaceOpacity =
|
|
118
|
+
this.tabsFrame?.style.getPropertyValue('--stage-panel-surface-opacity') ?? '';
|
|
119
|
+
this.decorationOpacity = this.getMinimapSurfaceOpacity();
|
|
120
|
+
this.minimapDockProgress = this.getMinimapDockProgress();
|
|
121
|
+
this.minimapModelScale = this.getMinimapModelScale();
|
|
122
|
+
this.scrollY = getStageVisualScrollPosition().scrollY;
|
|
123
|
+
this.started = true;
|
|
124
|
+
this.sourceTabsList?.addEventListener('focusin', this.handleTabFocusIn);
|
|
125
|
+
this.dockedTabsList?.addEventListener('focusin', this.handleTabFocusIn);
|
|
126
|
+
this.measure();
|
|
127
|
+
this.stopScrollFrames = subscribeStageScrollFrame(this.scrollFrame, STAGE_SCROLL_PRIORITY.dock);
|
|
128
|
+
window.addEventListener('resize', this.handleResize, { passive: true });
|
|
129
|
+
if ('ResizeObserver' in window) {
|
|
130
|
+
this.resizeObserver = new ResizeObserver(this.handleResize);
|
|
131
|
+
this.resizeObserver.observe(this.minimapAnchor);
|
|
132
|
+
this.resizeObserver.observe(this.stickyHeader);
|
|
133
|
+
if (this.tabsAnchor)
|
|
134
|
+
this.resizeObserver.observe(this.tabsAnchor);
|
|
135
|
+
}
|
|
136
|
+
this.setTabsActive(false);
|
|
137
|
+
this.update();
|
|
138
|
+
}
|
|
139
|
+
destroy() {
|
|
140
|
+
if (!this.started)
|
|
141
|
+
return;
|
|
142
|
+
this.started = false;
|
|
143
|
+
this.stopScrollFrames?.();
|
|
144
|
+
this.stopScrollFrames = undefined;
|
|
145
|
+
window.removeEventListener('resize', this.handleResize);
|
|
146
|
+
this.resizeObserver?.disconnect();
|
|
147
|
+
if (this.animationFrame)
|
|
148
|
+
cancelAnimationFrame(this.animationFrame);
|
|
149
|
+
if (this.focusTransferFrame)
|
|
150
|
+
cancelAnimationFrame(this.focusTransferFrame);
|
|
151
|
+
if (this.focusTransferTimer)
|
|
152
|
+
clearTimeout(this.focusTransferTimer);
|
|
153
|
+
this.sourceTabsList?.removeEventListener('focusin', this.handleTabFocusIn);
|
|
154
|
+
this.dockedTabsList?.removeEventListener('focusin', this.handleTabFocusIn);
|
|
155
|
+
this.restoreMinimap();
|
|
156
|
+
this.restoreMinimapDockProgress();
|
|
157
|
+
this.restoreMinimapModelScale();
|
|
158
|
+
this.restoreMinimapModelTop();
|
|
159
|
+
this.restoreHeaderPresentation();
|
|
160
|
+
this.setHeaderActive(false);
|
|
161
|
+
this.setTabsActive(false);
|
|
162
|
+
this.restoreStickyTabs();
|
|
163
|
+
this.restoreStickyHeader();
|
|
164
|
+
this.restoreDepartingContentClipping();
|
|
165
|
+
this.root.removeAttribute('data-spatial-element-dock-active');
|
|
166
|
+
this.root.removeAttribute('data-spatial-element-tabs-dock-active');
|
|
167
|
+
this.root.style.removeProperty('--spatial-element-section-scroll-offset');
|
|
168
|
+
(this.layoutRoot ?? this.root).style.removeProperty('--spatial-element-content-inline-inset');
|
|
169
|
+
}
|
|
170
|
+
scrollFrame = (frame) => {
|
|
171
|
+
this.scrollY = frame.scrollY;
|
|
172
|
+
this.update();
|
|
173
|
+
};
|
|
174
|
+
schedule = () => {
|
|
175
|
+
if (!this.started || this.animationFrame)
|
|
176
|
+
return;
|
|
177
|
+
this.animationFrame = requestAnimationFrame(() => {
|
|
178
|
+
this.animationFrame = 0;
|
|
179
|
+
this.update();
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
handleResize = () => {
|
|
183
|
+
this.scrollY = getStageVisualScrollPosition().scrollY;
|
|
184
|
+
this.measure();
|
|
185
|
+
this.schedule();
|
|
186
|
+
};
|
|
187
|
+
handleTabFocusIn = (event) => {
|
|
188
|
+
if (!(event.target instanceof HTMLElement))
|
|
189
|
+
return;
|
|
190
|
+
const tabId = event.target.closest('[data-spatial-element-tab-id]')?.dataset.spatialElementTabId;
|
|
191
|
+
if (!tabId)
|
|
192
|
+
return;
|
|
193
|
+
this.lastFocusedTabId = tabId;
|
|
194
|
+
this.lastTabFocusTime = performance.now();
|
|
195
|
+
};
|
|
196
|
+
measure() {
|
|
197
|
+
if (!this.minimapFrame || !this.stickyHeader)
|
|
198
|
+
return;
|
|
199
|
+
const decorationOpacity = this.decorationOpacity;
|
|
200
|
+
this.restoreMinimap();
|
|
201
|
+
this.setMinimapSurfaceOpacity(decorationOpacity);
|
|
202
|
+
const minimapRect = toRect(this.minimapFrame.getBoundingClientRect());
|
|
203
|
+
const headerRect = toRect(this.stickyHeader.getBoundingClientRect());
|
|
204
|
+
this.minimapDock =
|
|
205
|
+
window.innerWidth <= COMPACT_BREAKPOINT
|
|
206
|
+
? getCompactMinimapDockDestination(minimapRect, headerRect, window.innerWidth)
|
|
207
|
+
: getMinimapDockDestination(minimapRect);
|
|
208
|
+
this.dockedMinimapModelScale = getDockedMinimapModelScale(this.minimapDock, headerRect, this.getConfiguredDockedModelScale());
|
|
209
|
+
this.dockedMinimapModelTop = headerRect.top;
|
|
210
|
+
if (this.stickyMinimapAction) {
|
|
211
|
+
applyViewportFixedRect(this.stickyMinimapAction, getDockedMinimapInteractionRect(this.minimapDock, headerRect, this.dockedMinimapModelScale));
|
|
212
|
+
}
|
|
213
|
+
this.stickyHeaderBottom = headerRect.top + headerRect.height;
|
|
214
|
+
this.measureDepartingContent();
|
|
215
|
+
this.breakpoint = getSpatialElementDockBreakpoint(minimapRect.top + this.scrollY, this.minimapDock.top);
|
|
216
|
+
this.presentationEndScrollY = Math.max(minimapRect.top + this.scrollY + minimapRect.height, 0);
|
|
217
|
+
const reserve = getDockedMinimapCopyReserve(this.minimapDock, headerRect, this.dockedMinimapModelScale, window.innerWidth <= COMPACT_BREAKPOINT ? 12 : 16);
|
|
218
|
+
this.stickyHeader.style.setProperty('--spatial-element-sticky-minimap-reserve', `${reserve}px`);
|
|
219
|
+
(this.layoutRoot ?? this.root).style.setProperty('--spatial-element-content-inline-inset', `${Math.max(headerRect.left + reserve, 0)}px`);
|
|
220
|
+
if (this.tabsFrame && this.stickyTabs) {
|
|
221
|
+
const tabsRect = toRect(this.tabsFrame.getBoundingClientRect());
|
|
222
|
+
const panelRadius = Number.parseFloat(getComputedStyle(this.tabsFrame).getPropertyValue('--stage-panel-radius'));
|
|
223
|
+
if (Number.isFinite(panelRadius))
|
|
224
|
+
this.tabsPanelRadius = Math.max(panelRadius, 0);
|
|
225
|
+
this.tabsDockProgress = -1;
|
|
226
|
+
this.tabsDock = getSpatialElementTabsDockDestination(tabsRect, headerRect, window.innerWidth);
|
|
227
|
+
this.tabsBreakpoint = getSpatialElementTabsDockBreakpoint(tabsRect.top + this.scrollY, this.tabsDock.top);
|
|
228
|
+
applyViewportFixedRect(this.stickyTabs, this.tabsDock);
|
|
229
|
+
this.stickyTabs.style.setProperty('--spatial-element-tabs-dock-bottom-radius', `${this.tabsPanelRadius}px`);
|
|
230
|
+
this.root.style.setProperty('--spatial-element-section-scroll-offset', `${getSpatialElementSectionScrollOffset(this.tabsDock)}px`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
update() {
|
|
234
|
+
if (!this.minimapFrame || !this.minimapDock)
|
|
235
|
+
return;
|
|
236
|
+
const presentationProgress = getSpatialElementDockPresentationProgress(this.scrollY, this.presentationEndScrollY);
|
|
237
|
+
const docked = getSpatialElementDockTarget(this.scrollY, this.breakpoint, this.docked);
|
|
238
|
+
const tabsDocked = getSpatialElementTabsDockTarget(this.scrollY, this.tabsBreakpoint, docked, this.tabsDocked);
|
|
239
|
+
this.applyMinimapPresentation(presentationProgress);
|
|
240
|
+
this.applyHeaderPresentation(presentationProgress);
|
|
241
|
+
this.applyState(docked);
|
|
242
|
+
this.applyTabsPresentation(tabsDocked);
|
|
243
|
+
this.applyTabsState(tabsDocked);
|
|
244
|
+
this.presentationProgress = presentationProgress;
|
|
245
|
+
this.presentationRevision++;
|
|
246
|
+
}
|
|
247
|
+
applyState(docked) {
|
|
248
|
+
if (!this.minimapFrame || !this.minimapDock)
|
|
249
|
+
return;
|
|
250
|
+
const changed = docked !== this.docked;
|
|
251
|
+
const dockLayoutChanged = docked && !this.minimapDockApplied;
|
|
252
|
+
this.docked = docked;
|
|
253
|
+
if (docked) {
|
|
254
|
+
if (!this.minimapDockApplied) {
|
|
255
|
+
applyFixedRect(this.minimapFrame, this.minimapDock);
|
|
256
|
+
this.minimapDockApplied = true;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
else if (changed || this.minimapDockApplied) {
|
|
260
|
+
const decorationOpacity = this.decorationOpacity;
|
|
261
|
+
this.restoreMinimap();
|
|
262
|
+
this.setMinimapSurfaceOpacity(decorationOpacity);
|
|
263
|
+
}
|
|
264
|
+
if (changed) {
|
|
265
|
+
this.setHeaderActive(docked);
|
|
266
|
+
this.root.toggleAttribute('data-spatial-element-dock-active', docked);
|
|
267
|
+
}
|
|
268
|
+
this.setMinimapModelTop(docked ? this.dockedMinimapModelTop : undefined);
|
|
269
|
+
if (docked)
|
|
270
|
+
this.updateDepartingContentClipping();
|
|
271
|
+
else if (changed)
|
|
272
|
+
this.restoreDepartingContentClipping();
|
|
273
|
+
if (changed || dockLayoutChanged) {
|
|
274
|
+
window.dispatchEvent(new Event(STAGE_PANEL_LAYOUT_EVENT));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
applyTabsState(docked) {
|
|
278
|
+
if (!this.stickyTabs || !this.sourceTabsList || !this.dockedTabsList)
|
|
279
|
+
return;
|
|
280
|
+
if (docked === this.tabsDocked)
|
|
281
|
+
return;
|
|
282
|
+
this.setTabsActive(docked);
|
|
283
|
+
this.root.toggleAttribute('data-spatial-element-tabs-dock-active', docked);
|
|
284
|
+
}
|
|
285
|
+
applyTabsPresentation(docked) {
|
|
286
|
+
if (!this.stickyTabs || !this.tabsDock)
|
|
287
|
+
return;
|
|
288
|
+
const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
289
|
+
const progress = docked
|
|
290
|
+
? reducedMotion
|
|
291
|
+
? 1
|
|
292
|
+
: getSpatialElementTabsDockProgress(this.scrollY, this.tabsBreakpoint, TABS_DOCK_MORPH_DISTANCE)
|
|
293
|
+
: 0;
|
|
294
|
+
const top = this.tabsDock.top + (docked ? Math.max(this.tabsBreakpoint - this.scrollY, 0) : 0);
|
|
295
|
+
this.stickyTabs.style.top = `${top}px`;
|
|
296
|
+
if (Math.abs(progress - this.tabsDockProgress) < 0.0005)
|
|
297
|
+
return;
|
|
298
|
+
this.tabsDockProgress = progress;
|
|
299
|
+
this.stickyTabs.style.setProperty('--spatial-element-tabs-dock-top-radius', `${(this.tabsPanelRadius * (1 - progress)).toFixed(3)}px`);
|
|
300
|
+
this.stickyTabs.setAttribute('data-spatial-element-tabs-dock-progress', progress.toFixed(3));
|
|
301
|
+
}
|
|
302
|
+
applyMinimapPresentation(progress) {
|
|
303
|
+
const clampedProgress = Math.min(Math.max(progress, 0), 1);
|
|
304
|
+
this.setMinimapSurfaceOpacity(1 - clampedProgress);
|
|
305
|
+
this.setMinimapModelScale(1 + (this.dockedMinimapModelScale - 1) * clampedProgress);
|
|
306
|
+
this.setMinimapDockProgress(clampedProgress);
|
|
307
|
+
}
|
|
308
|
+
applyHeaderPresentation(progress) {
|
|
309
|
+
if (!this.stickyHeader)
|
|
310
|
+
return;
|
|
311
|
+
const clampedProgress = Math.min(Math.max(progress, 0), 1);
|
|
312
|
+
const value = formatPresentationProgress(clampedProgress);
|
|
313
|
+
this.stickyHeader.style.setProperty('--spatial-element-sticky-header-progress', value);
|
|
314
|
+
this.stickyHeader.setAttribute('data-spatial-element-dock-progress', value);
|
|
315
|
+
this.stickyHeader.toggleAttribute('data-presented', clampedProgress > 0);
|
|
316
|
+
}
|
|
317
|
+
restoreHeaderPresentation() {
|
|
318
|
+
if (!this.stickyHeader)
|
|
319
|
+
return;
|
|
320
|
+
this.stickyHeader.style.removeProperty('--spatial-element-sticky-header-progress');
|
|
321
|
+
this.stickyHeader.removeAttribute('data-spatial-element-dock-progress');
|
|
322
|
+
this.stickyHeader.removeAttribute('data-presented');
|
|
323
|
+
}
|
|
324
|
+
getMinimapSurfaceOpacity() {
|
|
325
|
+
if (!this.minimapFrame)
|
|
326
|
+
return 1;
|
|
327
|
+
const value = Number.parseFloat(this.minimapFrame.style.getPropertyValue('--stage-panel-surface-opacity') || '1');
|
|
328
|
+
return Number.isFinite(value) ? Math.min(Math.max(value, 0), 1) : 1;
|
|
329
|
+
}
|
|
330
|
+
setMinimapSurfaceOpacity(opacity) {
|
|
331
|
+
if (!this.minimapFrame)
|
|
332
|
+
return;
|
|
333
|
+
const nextOpacity = Math.min(Math.max(opacity, 0), 1);
|
|
334
|
+
const changed = Math.abs(nextOpacity - this.decorationOpacity) >= 0.0005;
|
|
335
|
+
this.decorationOpacity = nextOpacity;
|
|
336
|
+
this.minimapFrame.style.setProperty('--stage-panel-surface-opacity', this.decorationOpacity.toFixed(3));
|
|
337
|
+
if (changed)
|
|
338
|
+
window.dispatchEvent(new Event(STAGE_PANEL_VISUAL_EVENT));
|
|
339
|
+
}
|
|
340
|
+
getMinimapModelScale() {
|
|
341
|
+
if (!this.minimapFrame)
|
|
342
|
+
return 1;
|
|
343
|
+
const value = Number.parseFloat(this.minimapFrame.getAttribute('data-stage-minimap-model-scale') || '1');
|
|
344
|
+
return Number.isFinite(value) ? Math.min(Math.max(value, 0.2), 2) : 1;
|
|
345
|
+
}
|
|
346
|
+
getConfiguredDockedModelScale() {
|
|
347
|
+
if (!this.minimapFrame)
|
|
348
|
+
return undefined;
|
|
349
|
+
const value = Number.parseFloat(this.minimapFrame.getAttribute('data-stage-minimap-docked-view-scale') ?? '');
|
|
350
|
+
return Number.isFinite(value) ? value : undefined;
|
|
351
|
+
}
|
|
352
|
+
getMinimapDockProgress() {
|
|
353
|
+
if (!this.minimapFrame)
|
|
354
|
+
return 0;
|
|
355
|
+
const value = Number.parseFloat(this.minimapFrame.getAttribute('data-stage-minimap-dock-progress') || '0');
|
|
356
|
+
return Number.isFinite(value) ? Math.min(Math.max(value, 0), 1) : 0;
|
|
357
|
+
}
|
|
358
|
+
setMinimapDockProgress(progress) {
|
|
359
|
+
if (!this.minimapFrame)
|
|
360
|
+
return;
|
|
361
|
+
const nextProgress = Math.min(Math.max(progress, 0), 1);
|
|
362
|
+
const changed = nextProgress !== this.minimapDockProgress;
|
|
363
|
+
this.minimapDockProgress = nextProgress;
|
|
364
|
+
this.minimapFrame.setAttribute('data-stage-minimap-dock-progress', formatPresentationProgress(this.minimapDockProgress));
|
|
365
|
+
if (changed)
|
|
366
|
+
window.dispatchEvent(new Event(STAGE_PANEL_VISUAL_EVENT));
|
|
367
|
+
}
|
|
368
|
+
restoreMinimapDockProgress() {
|
|
369
|
+
if (!this.minimapFrame)
|
|
370
|
+
return;
|
|
371
|
+
if (this.minimapOriginalDockProgress === null) {
|
|
372
|
+
this.minimapFrame.removeAttribute('data-stage-minimap-dock-progress');
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
this.minimapFrame.setAttribute('data-stage-minimap-dock-progress', this.minimapOriginalDockProgress);
|
|
376
|
+
}
|
|
377
|
+
this.minimapDockProgress = this.getMinimapDockProgress();
|
|
378
|
+
}
|
|
379
|
+
setMinimapModelScale(scale) {
|
|
380
|
+
if (!this.minimapFrame)
|
|
381
|
+
return;
|
|
382
|
+
const nextScale = Math.min(Math.max(scale, 0.2), 2);
|
|
383
|
+
const changed = Math.abs(nextScale - this.minimapModelScale) >= 0.0005;
|
|
384
|
+
this.minimapModelScale = nextScale;
|
|
385
|
+
this.minimapFrame.setAttribute('data-stage-minimap-model-scale', this.minimapModelScale.toFixed(3));
|
|
386
|
+
if (changed)
|
|
387
|
+
window.dispatchEvent(new Event(STAGE_PANEL_VISUAL_EVENT));
|
|
388
|
+
}
|
|
389
|
+
restoreMinimapModelScale() {
|
|
390
|
+
if (!this.minimapFrame)
|
|
391
|
+
return;
|
|
392
|
+
if (this.minimapOriginalModelScale === null) {
|
|
393
|
+
this.minimapFrame.removeAttribute('data-stage-minimap-model-scale');
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
this.minimapFrame.setAttribute('data-stage-minimap-model-scale', this.minimapOriginalModelScale);
|
|
397
|
+
}
|
|
398
|
+
this.minimapModelScale = this.getMinimapModelScale();
|
|
399
|
+
}
|
|
400
|
+
setMinimapModelTop(top) {
|
|
401
|
+
if (!this.minimapFrame)
|
|
402
|
+
return;
|
|
403
|
+
const nextValue = top === undefined ? null : top.toFixed(3);
|
|
404
|
+
const changed = this.minimapFrame.getAttribute('data-stage-minimap-model-top') !== nextValue;
|
|
405
|
+
if (nextValue === null)
|
|
406
|
+
this.minimapFrame.removeAttribute('data-stage-minimap-model-top');
|
|
407
|
+
else
|
|
408
|
+
this.minimapFrame.setAttribute('data-stage-minimap-model-top', nextValue);
|
|
409
|
+
if (changed)
|
|
410
|
+
window.dispatchEvent(new Event(STAGE_PANEL_VISUAL_EVENT));
|
|
411
|
+
}
|
|
412
|
+
restoreMinimapModelTop() {
|
|
413
|
+
if (!this.minimapFrame)
|
|
414
|
+
return;
|
|
415
|
+
if (this.minimapOriginalModelTop === null) {
|
|
416
|
+
this.minimapFrame.removeAttribute('data-stage-minimap-model-top');
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
this.minimapFrame.setAttribute('data-stage-minimap-model-top', this.minimapOriginalModelTop);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
setHeaderActive(active) {
|
|
423
|
+
if (!this.stickyHeader)
|
|
424
|
+
return;
|
|
425
|
+
this.stickyHeader.toggleAttribute('data-active', active);
|
|
426
|
+
this.stickyHeader.inert = !active;
|
|
427
|
+
this.stickyHeader.setAttribute('aria-hidden', String(!active));
|
|
428
|
+
}
|
|
429
|
+
setTabsActive(active) {
|
|
430
|
+
if (!this.stickyTabs || !this.sourceTabsList || !this.dockedTabsList)
|
|
431
|
+
return;
|
|
432
|
+
const outgoingList = active ? this.sourceTabsList : this.dockedTabsList;
|
|
433
|
+
const incomingList = active ? this.dockedTabsList : this.sourceTabsList;
|
|
434
|
+
this.syncTabScrollPosition(outgoingList, incomingList);
|
|
435
|
+
const focusedTabId = document.activeElement instanceof HTMLElement && outgoingList.contains(document.activeElement)
|
|
436
|
+
? document.activeElement.closest('[data-spatial-element-tab-id]')?.dataset.spatialElementTabId
|
|
437
|
+
: performance.now() - this.lastTabFocusTime <= 500
|
|
438
|
+
? this.lastFocusedTabId
|
|
439
|
+
: undefined;
|
|
440
|
+
this.tabsDocked = active;
|
|
441
|
+
this.sourceTabsList.inert = active;
|
|
442
|
+
this.sourceTabsList.setAttribute('aria-hidden', String(active));
|
|
443
|
+
this.sourceTabsList.toggleAttribute('data-spatial-element-tab-list-hidden', active);
|
|
444
|
+
this.stickyTabs.inert = !active;
|
|
445
|
+
this.stickyTabs.setAttribute('aria-hidden', String(!active));
|
|
446
|
+
this.stickyTabs.toggleAttribute('data-active', active);
|
|
447
|
+
this.setSourceTabsSurfaceVisible(!active);
|
|
448
|
+
if (!focusedTabId)
|
|
449
|
+
return;
|
|
450
|
+
if (this.focusTransferFrame)
|
|
451
|
+
cancelAnimationFrame(this.focusTransferFrame);
|
|
452
|
+
if (this.focusTransferTimer)
|
|
453
|
+
clearTimeout(this.focusTransferTimer);
|
|
454
|
+
const focusMatchingTab = (retry = true) => {
|
|
455
|
+
if (!this.started || this.tabsDocked !== active)
|
|
456
|
+
return;
|
|
457
|
+
const matchingTab = Array.from(incomingList.querySelectorAll('[data-spatial-element-tab-id]')).find((element) => element.dataset.spatialElementTabId === focusedTabId);
|
|
458
|
+
matchingTab?.focus({ preventScroll: true });
|
|
459
|
+
if (retry && matchingTab && document.activeElement !== matchingTab) {
|
|
460
|
+
this.focusTransferTimer = window.setTimeout(() => focusMatchingTab(false), 160);
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
this.focusTransferFrame = requestAnimationFrame(() => {
|
|
464
|
+
this.focusTransferFrame = 0;
|
|
465
|
+
focusMatchingTab();
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
setSourceTabsSurfaceVisible(visible) {
|
|
469
|
+
if (!this.tabsFrame)
|
|
470
|
+
return;
|
|
471
|
+
const property = '--stage-panel-surface-opacity';
|
|
472
|
+
const currentValue = this.tabsFrame.style.getPropertyValue(property);
|
|
473
|
+
const nextValue = visible ? this.tabsOriginalSurfaceOpacity : '0.000';
|
|
474
|
+
if (currentValue === nextValue)
|
|
475
|
+
return;
|
|
476
|
+
if (nextValue)
|
|
477
|
+
this.tabsFrame.style.setProperty(property, nextValue);
|
|
478
|
+
else
|
|
479
|
+
this.tabsFrame.style.removeProperty(property);
|
|
480
|
+
window.dispatchEvent(new Event(STAGE_PANEL_VISUAL_EVENT));
|
|
481
|
+
}
|
|
482
|
+
syncTabScrollPosition(outgoingList, incomingList) {
|
|
483
|
+
const outgoingLinks = outgoingList.querySelector(TABS_LINKS);
|
|
484
|
+
const incomingLinks = incomingList.querySelector(TABS_LINKS);
|
|
485
|
+
if (!outgoingLinks || !incomingLinks)
|
|
486
|
+
return;
|
|
487
|
+
const outgoingRange = Math.max(outgoingLinks.scrollWidth - outgoingLinks.clientWidth, 0);
|
|
488
|
+
const incomingRange = Math.max(incomingLinks.scrollWidth - incomingLinks.clientWidth, 0);
|
|
489
|
+
incomingLinks.scrollLeft =
|
|
490
|
+
outgoingRange > 0
|
|
491
|
+
? (outgoingLinks.scrollLeft / outgoingRange) * incomingRange
|
|
492
|
+
: outgoingLinks.scrollLeft;
|
|
493
|
+
}
|
|
494
|
+
mountStickyHeaderOverlay() {
|
|
495
|
+
if (!this.stickyHeader)
|
|
496
|
+
return;
|
|
497
|
+
const stage = this.root.closest('.stage');
|
|
498
|
+
const parent = this.stickyHeader.parentElement;
|
|
499
|
+
if (!stage || !parent || parent === stage)
|
|
500
|
+
return;
|
|
501
|
+
this.stickyHeaderOriginalParent = parent;
|
|
502
|
+
this.stickyHeaderOriginalNextSibling = this.stickyHeader.nextSibling;
|
|
503
|
+
stage.appendChild(this.stickyHeader);
|
|
504
|
+
this.stickyHeader.setAttribute('data-stage-fixed-overlay', '');
|
|
505
|
+
}
|
|
506
|
+
mountStickyTabsOverlay() {
|
|
507
|
+
if (!this.stickyTabs)
|
|
508
|
+
return;
|
|
509
|
+
const stage = this.root.closest('.stage');
|
|
510
|
+
const parent = this.stickyTabs.parentElement;
|
|
511
|
+
if (!stage || !parent || parent === stage)
|
|
512
|
+
return;
|
|
513
|
+
this.stickyTabsOriginalParent = parent;
|
|
514
|
+
this.stickyTabsOriginalNextSibling = this.stickyTabs.nextSibling;
|
|
515
|
+
stage.appendChild(this.stickyTabs);
|
|
516
|
+
this.stickyTabs.setAttribute('data-stage-fixed-overlay', '');
|
|
517
|
+
}
|
|
518
|
+
restoreStickyHeader() {
|
|
519
|
+
if (!this.stickyHeader || !this.stickyHeaderOriginalParent)
|
|
520
|
+
return;
|
|
521
|
+
const parent = this.stickyHeaderOriginalParent;
|
|
522
|
+
const sibling = this.stickyHeaderOriginalNextSibling;
|
|
523
|
+
this.stickyHeader.removeAttribute('data-stage-fixed-overlay');
|
|
524
|
+
if (sibling?.parentNode === parent)
|
|
525
|
+
parent.insertBefore(this.stickyHeader, sibling);
|
|
526
|
+
else
|
|
527
|
+
parent.appendChild(this.stickyHeader);
|
|
528
|
+
this.stickyHeaderOriginalParent = undefined;
|
|
529
|
+
this.stickyHeaderOriginalNextSibling = undefined;
|
|
530
|
+
}
|
|
531
|
+
restoreStickyTabs() {
|
|
532
|
+
if (!this.stickyTabs || !this.stickyTabsOriginalParent)
|
|
533
|
+
return;
|
|
534
|
+
const parent = this.stickyTabsOriginalParent;
|
|
535
|
+
const sibling = this.stickyTabsOriginalNextSibling;
|
|
536
|
+
this.stickyTabs.removeAttribute('data-stage-fixed-overlay');
|
|
537
|
+
this.stickyTabs.removeAttribute('data-spatial-element-tabs-dock-progress');
|
|
538
|
+
if (this.stickyTabsOriginalStyle === null)
|
|
539
|
+
this.stickyTabs.removeAttribute('style');
|
|
540
|
+
else
|
|
541
|
+
this.stickyTabs.setAttribute('style', this.stickyTabsOriginalStyle);
|
|
542
|
+
if (sibling?.parentNode === parent)
|
|
543
|
+
parent.insertBefore(this.stickyTabs, sibling);
|
|
544
|
+
else
|
|
545
|
+
parent.appendChild(this.stickyTabs);
|
|
546
|
+
this.stickyTabsOriginalParent = undefined;
|
|
547
|
+
this.stickyTabsOriginalNextSibling = undefined;
|
|
548
|
+
}
|
|
549
|
+
measureDepartingContent() {
|
|
550
|
+
for (const state of this.departingContent) {
|
|
551
|
+
const rect = state.element.getBoundingClientRect();
|
|
552
|
+
state.documentTop = rect.top + this.scrollY;
|
|
553
|
+
state.height = rect.height;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
updateDepartingContentClipping() {
|
|
557
|
+
for (const state of this.departingContent) {
|
|
558
|
+
const viewportTop = state.documentTop - this.scrollY;
|
|
559
|
+
const inset = Math.min(Math.max(this.stickyHeaderBottom - viewportTop, 0), state.height);
|
|
560
|
+
const clipPath = `inset(${inset.toFixed(2)}px 0 0 0)`;
|
|
561
|
+
if (state.appliedClipPath === clipPath)
|
|
562
|
+
continue;
|
|
563
|
+
state.appliedClipPath = clipPath;
|
|
564
|
+
state.element.style.clipPath = clipPath;
|
|
565
|
+
state.element.style.setProperty('-webkit-clip-path', clipPath);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
restoreDepartingContentClipping() {
|
|
569
|
+
for (const state of this.departingContent)
|
|
570
|
+
this.restoreContentClipping(state);
|
|
571
|
+
}
|
|
572
|
+
restoreContentClipping(state) {
|
|
573
|
+
state.appliedClipPath = undefined;
|
|
574
|
+
state.element.style.clipPath = state.clipPath;
|
|
575
|
+
if (state.webkitClipPath) {
|
|
576
|
+
state.element.style.setProperty('-webkit-clip-path', state.webkitClipPath);
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
state.element.style.removeProperty('-webkit-clip-path');
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
restoreMinimap() {
|
|
583
|
+
if (!this.minimapFrame)
|
|
584
|
+
return;
|
|
585
|
+
if (this.minimapOriginalStyle === null)
|
|
586
|
+
this.minimapFrame.removeAttribute('style');
|
|
587
|
+
else
|
|
588
|
+
this.minimapFrame.setAttribute('style', this.minimapOriginalStyle);
|
|
589
|
+
this.minimapDockApplied = false;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
function formatPresentationProgress(progress) {
|
|
593
|
+
if (progress <= 0)
|
|
594
|
+
return '0.000';
|
|
595
|
+
if (progress >= 1)
|
|
596
|
+
return '1.000';
|
|
597
|
+
return progress.toFixed(6);
|
|
598
|
+
}
|
|
599
|
+
function applyFixedRect(frame, rect) {
|
|
600
|
+
frame.style.position = 'fixed';
|
|
601
|
+
frame.style.left = `${rect.left}px`;
|
|
602
|
+
// A transformed virtual document is the containing block for fixed descendants.
|
|
603
|
+
// Counter the document transform so the dock remains viewport-aligned.
|
|
604
|
+
frame.style.top = `calc(var(--virtual-scroll-y, 0px) + ${rect.top}px)`;
|
|
605
|
+
frame.style.width = `${rect.width}px`;
|
|
606
|
+
frame.style.height = `${rect.height}px`;
|
|
607
|
+
frame.style.minHeight = `${rect.height}px`;
|
|
608
|
+
frame.style.margin = '0';
|
|
609
|
+
frame.style.zIndex = '22';
|
|
610
|
+
}
|
|
611
|
+
function applyViewportFixedRect(element, rect) {
|
|
612
|
+
element.style.position = 'fixed';
|
|
613
|
+
element.style.left = `${rect.left}px`;
|
|
614
|
+
element.style.top = `${rect.top}px`;
|
|
615
|
+
element.style.width = `${rect.width}px`;
|
|
616
|
+
element.style.height = `${rect.height}px`;
|
|
617
|
+
element.style.margin = '0';
|
|
618
|
+
}
|
|
619
|
+
function toRect(rect) {
|
|
620
|
+
return {
|
|
621
|
+
left: rect.left,
|
|
622
|
+
top: rect.top,
|
|
623
|
+
width: rect.width,
|
|
624
|
+
height: rect.height
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
//# sourceMappingURL=SpatialElementDockController.js.map
|