@spatial-elements/core 0.1.0-beta.2 → 1.0.0-beta.11

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.
Files changed (391) hide show
  1. package/README.md +16 -13
  2. package/dist/catalog/CarouselDeviceCamera.d.ts +20 -0
  3. package/dist/catalog/CarouselDeviceCamera.d.ts.map +1 -0
  4. package/dist/catalog/CarouselDeviceCamera.js +58 -0
  5. package/dist/catalog/CarouselDeviceCamera.js.map +1 -0
  6. package/dist/catalog/CarouselGlassCompositor.d.ts +14 -3
  7. package/dist/catalog/CarouselGlassCompositor.d.ts.map +1 -1
  8. package/dist/catalog/CarouselGlassCompositor.js +164 -28
  9. package/dist/catalog/CarouselGlassCompositor.js.map +1 -1
  10. package/dist/catalog/CarouselGround.d.ts +43 -0
  11. package/dist/catalog/CarouselGround.d.ts.map +1 -0
  12. package/dist/catalog/CarouselGround.js +270 -0
  13. package/dist/catalog/CarouselGround.js.map +1 -0
  14. package/dist/catalog/CarouselSectionSurfaces.d.ts +10 -0
  15. package/dist/catalog/CarouselSectionSurfaces.d.ts.map +1 -0
  16. package/dist/catalog/CarouselSectionSurfaces.js +55 -0
  17. package/dist/catalog/CarouselSectionSurfaces.js.map +1 -0
  18. package/dist/catalog/CatalogDepthBlur.d.ts +45 -0
  19. package/dist/catalog/CatalogDepthBlur.d.ts.map +1 -0
  20. package/dist/catalog/CatalogDepthBlur.js +190 -0
  21. package/dist/catalog/CatalogDepthBlur.js.map +1 -0
  22. package/dist/catalog/CatalogEndpointRegistry.d.ts +4 -2
  23. package/dist/catalog/CatalogEndpointRegistry.d.ts.map +1 -1
  24. package/dist/catalog/CatalogEndpointRegistry.js +2 -0
  25. package/dist/catalog/CatalogEndpointRegistry.js.map +1 -1
  26. package/dist/catalog/CatalogGeometryFade.d.ts +5 -1
  27. package/dist/catalog/CatalogGeometryFade.d.ts.map +1 -1
  28. package/dist/catalog/CatalogGeometryFade.js +45 -9
  29. package/dist/catalog/CatalogGeometryFade.js.map +1 -1
  30. package/dist/catalog/CatalogModelOutline.d.ts +33 -0
  31. package/dist/catalog/CatalogModelOutline.d.ts.map +1 -0
  32. package/dist/catalog/CatalogModelOutline.js +144 -0
  33. package/dist/catalog/CatalogModelOutline.js.map +1 -0
  34. package/dist/catalog/CatalogNavigationRegistry.d.ts +44 -0
  35. package/dist/catalog/CatalogNavigationRegistry.d.ts.map +1 -0
  36. package/dist/catalog/CatalogNavigationRegistry.js +66 -0
  37. package/dist/catalog/CatalogNavigationRegistry.js.map +1 -0
  38. package/dist/catalog/CatalogPreparation.d.ts +3 -3
  39. package/dist/catalog/CatalogPreparation.d.ts.map +1 -1
  40. package/dist/catalog/CatalogPreparation.js +10 -7
  41. package/dist/catalog/CatalogPreparation.js.map +1 -1
  42. package/dist/catalog/CatalogSpatialElementLayer.d.ts +175 -5
  43. package/dist/catalog/CatalogSpatialElementLayer.d.ts.map +1 -1
  44. package/dist/catalog/CatalogSpatialElementLayer.js +739 -121
  45. package/dist/catalog/CatalogSpatialElementLayer.js.map +1 -1
  46. package/dist/catalog/CatalogTransition.d.ts +5 -3
  47. package/dist/catalog/CatalogTransition.d.ts.map +1 -1
  48. package/dist/catalog/CatalogTransition.js +207 -91
  49. package/dist/catalog/CatalogTransition.js.map +1 -1
  50. package/dist/catalog/CatalogWarmOutputContext.d.ts +39 -0
  51. package/dist/catalog/CatalogWarmOutputContext.d.ts.map +1 -0
  52. package/dist/catalog/CatalogWarmOutputContext.js +159 -0
  53. package/dist/catalog/CatalogWarmOutputContext.js.map +1 -0
  54. package/dist/catalog/EarlyNavigationCoordinator.d.ts +35 -0
  55. package/dist/catalog/EarlyNavigationCoordinator.d.ts.map +1 -0
  56. package/dist/catalog/EarlyNavigationCoordinator.js +103 -0
  57. package/dist/catalog/EarlyNavigationCoordinator.js.map +1 -0
  58. package/dist/catalog/NavigationFeedback.d.ts +12 -0
  59. package/dist/catalog/NavigationFeedback.d.ts.map +1 -0
  60. package/dist/catalog/NavigationFeedback.js +40 -0
  61. package/dist/catalog/NavigationFeedback.js.map +1 -0
  62. package/dist/catalog/PreparationGate.d.ts +4 -0
  63. package/dist/catalog/PreparationGate.d.ts.map +1 -1
  64. package/dist/catalog/PreparationGate.js +1 -0
  65. package/dist/catalog/PreparationGate.js.map +1 -1
  66. package/dist/catalog/SourceDomClipping.d.ts +8 -0
  67. package/dist/catalog/SourceDomClipping.d.ts.map +1 -0
  68. package/dist/catalog/SourceDomClipping.js +74 -0
  69. package/dist/catalog/SourceDomClipping.js.map +1 -0
  70. package/dist/catalog/SourceDomMotion.d.ts +28 -0
  71. package/dist/catalog/SourceDomMotion.d.ts.map +1 -0
  72. package/dist/catalog/SourceDomMotion.js +111 -0
  73. package/dist/catalog/SourceDomMotion.js.map +1 -0
  74. package/dist/catalog/SpatialGeometryCapture.d.ts +9 -0
  75. package/dist/catalog/SpatialGeometryCapture.d.ts.map +1 -1
  76. package/dist/catalog/SpatialGeometryCapture.js +11 -1
  77. package/dist/catalog/SpatialGeometryCapture.js.map +1 -1
  78. package/dist/catalog/SpatialPageRegistry.d.ts +18 -0
  79. package/dist/catalog/SpatialPageRegistry.d.ts.map +1 -0
  80. package/dist/catalog/SpatialPageRegistry.js +21 -0
  81. package/dist/catalog/SpatialPageRegistry.js.map +1 -0
  82. package/dist/catalog/StagedCatalogTransition.d.ts +74 -0
  83. package/dist/catalog/StagedCatalogTransition.d.ts.map +1 -0
  84. package/dist/catalog/StagedCatalogTransition.js +270 -0
  85. package/dist/catalog/StagedCatalogTransition.js.map +1 -0
  86. package/dist/catalog/cardModelFit.d.ts +7 -0
  87. package/dist/catalog/cardModelFit.d.ts.map +1 -0
  88. package/dist/catalog/cardModelFit.js +16 -0
  89. package/dist/catalog/cardModelFit.js.map +1 -0
  90. package/dist/catalog/cardProjection.d.ts +39 -0
  91. package/dist/catalog/cardProjection.d.ts.map +1 -0
  92. package/dist/catalog/cardProjection.js +110 -0
  93. package/dist/catalog/cardProjection.js.map +1 -0
  94. package/dist/catalog/carouselMotion.d.ts +74 -0
  95. package/dist/catalog/carouselMotion.d.ts.map +1 -0
  96. package/dist/catalog/carouselMotion.js +185 -0
  97. package/dist/catalog/carouselMotion.js.map +1 -0
  98. package/dist/catalog/carouselPanelProjection.d.ts.map +1 -1
  99. package/dist/catalog/carouselPanelProjection.js +48 -11
  100. package/dist/catalog/carouselPanelProjection.js.map +1 -1
  101. package/dist/catalog/carouselProximity.d.ts +11 -0
  102. package/dist/catalog/carouselProximity.d.ts.map +1 -0
  103. package/dist/catalog/carouselProximity.js +13 -0
  104. package/dist/catalog/carouselProximity.js.map +1 -0
  105. package/dist/catalog/carouselSupport.d.ts +4 -0
  106. package/dist/catalog/carouselSupport.d.ts.map +1 -0
  107. package/dist/catalog/carouselSupport.js +30 -0
  108. package/dist/catalog/carouselSupport.js.map +1 -0
  109. package/dist/catalog/catalogActivationFocus.d.ts +5 -0
  110. package/dist/catalog/catalogActivationFocus.d.ts.map +1 -0
  111. package/dist/catalog/catalogActivationFocus.js +39 -0
  112. package/dist/catalog/catalogActivationFocus.js.map +1 -0
  113. package/dist/catalog/catalogDomSnapshot.d.ts +18 -0
  114. package/dist/catalog/catalogDomSnapshot.d.ts.map +1 -0
  115. package/dist/catalog/catalogDomSnapshot.js +51 -0
  116. package/dist/catalog/catalogDomSnapshot.js.map +1 -0
  117. package/dist/catalog/catalogJourney.d.ts +4 -1
  118. package/dist/catalog/catalogJourney.d.ts.map +1 -1
  119. package/dist/catalog/catalogJourney.js +7 -15
  120. package/dist/catalog/catalogJourney.js.map +1 -1
  121. package/dist/catalog/catalogPage.d.ts +7 -3
  122. package/dist/catalog/catalogPage.d.ts.map +1 -1
  123. package/dist/catalog/catalogPage.js.map +1 -1
  124. package/dist/catalog/catalogPose.d.ts +54 -6
  125. package/dist/catalog/catalogPose.d.ts.map +1 -1
  126. package/dist/catalog/catalogPose.js +100 -23
  127. package/dist/catalog/catalogPose.js.map +1 -1
  128. package/dist/catalog/catalogRecipes.d.ts +3 -2
  129. package/dist/catalog/catalogRecipes.d.ts.map +1 -1
  130. package/dist/catalog/catalogRecipes.js +12 -27
  131. package/dist/catalog/catalogRecipes.js.map +1 -1
  132. package/dist/catalog/catalogTransitionViewport.d.ts +9 -0
  133. package/dist/catalog/catalogTransitionViewport.d.ts.map +1 -0
  134. package/dist/catalog/catalogTransitionViewport.js +13 -0
  135. package/dist/catalog/catalogTransitionViewport.js.map +1 -0
  136. package/dist/catalog/catalogViewLink.d.ts +2 -0
  137. package/dist/catalog/catalogViewLink.d.ts.map +1 -1
  138. package/dist/catalog/catalogViewLink.js +10 -2
  139. package/dist/catalog/catalogViewLink.js.map +1 -1
  140. package/dist/catalog/deviceYaw.d.ts +21 -0
  141. package/dist/catalog/deviceYaw.d.ts.map +1 -0
  142. package/dist/catalog/deviceYaw.js +87 -0
  143. package/dist/catalog/deviceYaw.js.map +1 -0
  144. package/dist/catalog/listDeviceOrientation.d.ts +20 -0
  145. package/dist/catalog/listDeviceOrientation.d.ts.map +1 -0
  146. package/dist/catalog/listDeviceOrientation.js +273 -0
  147. package/dist/catalog/listDeviceOrientation.js.map +1 -0
  148. package/dist/catalog/spatialElementAssets.d.ts +5 -5
  149. package/dist/catalog/spatialElementAssets.d.ts.map +1 -1
  150. package/dist/catalog/spatialElementAssets.js.map +1 -1
  151. package/dist/catalog/spatialElementLodPair.d.ts +2 -1
  152. package/dist/catalog/spatialElementLodPair.d.ts.map +1 -1
  153. package/dist/catalog/spatialElementLodPair.js.map +1 -1
  154. package/dist/catalog/stagedDetailGeometry.d.ts +37 -0
  155. package/dist/catalog/stagedDetailGeometry.d.ts.map +1 -0
  156. package/dist/catalog/stagedDetailGeometry.js +55 -0
  157. package/dist/catalog/stagedDetailGeometry.js.map +1 -0
  158. package/dist/catalog/stagedDockGeometry.d.ts +66 -0
  159. package/dist/catalog/stagedDockGeometry.d.ts.map +1 -0
  160. package/dist/catalog/stagedDockGeometry.js +66 -0
  161. package/dist/catalog/stagedDockGeometry.js.map +1 -0
  162. package/dist/index.d.ts +6 -2
  163. package/dist/index.d.ts.map +1 -1
  164. package/dist/index.js +5 -1
  165. package/dist/index.js.map +1 -1
  166. package/dist/spatial-element/ResponsiveViewportMetrics.d.ts +18 -0
  167. package/dist/spatial-element/ResponsiveViewportMetrics.d.ts.map +1 -0
  168. package/dist/spatial-element/ResponsiveViewportMetrics.js +68 -0
  169. package/dist/spatial-element/ResponsiveViewportMetrics.js.map +1 -0
  170. package/dist/spatial-element/SectionSurfaceRegistry.d.ts +2 -0
  171. package/dist/spatial-element/SectionSurfaceRegistry.d.ts.map +1 -0
  172. package/dist/spatial-element/SectionSurfaceRegistry.js +2 -0
  173. package/dist/spatial-element/SectionSurfaceRegistry.js.map +1 -0
  174. package/dist/spatial-element/SpatialElementDockController.d.ts +23 -11
  175. package/dist/spatial-element/SpatialElementDockController.d.ts.map +1 -1
  176. package/dist/spatial-element/SpatialElementDockController.js +228 -96
  177. package/dist/spatial-element/SpatialElementDockController.js.map +1 -1
  178. package/dist/spatial-element/SpatialElementPaneController.d.ts +67 -0
  179. package/dist/spatial-element/SpatialElementPaneController.d.ts.map +1 -0
  180. package/dist/spatial-element/SpatialElementPaneController.js +246 -0
  181. package/dist/spatial-element/SpatialElementPaneController.js.map +1 -0
  182. package/dist/spatial-element/activeDetailSection.d.ts +8 -0
  183. package/dist/spatial-element/activeDetailSection.d.ts.map +1 -0
  184. package/dist/spatial-element/activeDetailSection.js +19 -0
  185. package/dist/spatial-element/activeDetailSection.js.map +1 -0
  186. package/dist/spatial-element/layoutTokens.json +228 -0
  187. package/dist/spatial-element/messages.d.ts +46 -0
  188. package/dist/spatial-element/messages.d.ts.map +1 -0
  189. package/dist/spatial-element/messages.js +46 -0
  190. package/dist/spatial-element/messages.js.map +1 -0
  191. package/dist/spatial-element/responsiveLayout.d.ts +1353 -0
  192. package/dist/spatial-element/responsiveLayout.d.ts.map +1 -0
  193. package/dist/spatial-element/responsiveLayout.js +210 -0
  194. package/dist/spatial-element/responsiveLayout.js.map +1 -0
  195. package/dist/spatial-element/sectionBackground.d.ts +3 -0
  196. package/dist/spatial-element/sectionBackground.d.ts.map +1 -0
  197. package/dist/spatial-element/sectionBackground.js +2 -0
  198. package/dist/spatial-element/sectionBackground.js.map +1 -0
  199. package/dist/spatial-element/spatialElement.d.ts +17 -12
  200. package/dist/spatial-element/spatialElement.d.ts.map +1 -1
  201. package/dist/spatial-element/spatialElement.js +33 -6
  202. package/dist/spatial-element/spatialElement.js.map +1 -1
  203. package/dist/spatial-element/spatialElementDock.d.ts +15 -0
  204. package/dist/spatial-element/spatialElementDock.d.ts.map +1 -1
  205. package/dist/spatial-element/spatialElementDock.js +22 -0
  206. package/dist/spatial-element/spatialElementDock.js.map +1 -1
  207. package/dist/spatial-element/spatialElementGeometry.d.ts +22 -0
  208. package/dist/spatial-element/spatialElementGeometry.d.ts.map +1 -0
  209. package/dist/spatial-element/spatialElementGeometry.js +40 -0
  210. package/dist/spatial-element/spatialElementGeometry.js.map +1 -0
  211. package/dist/spatial-element/spatialElementMedia.d.ts +16 -0
  212. package/dist/spatial-element/spatialElementMedia.d.ts.map +1 -0
  213. package/dist/spatial-element/spatialElementMedia.js +29 -0
  214. package/dist/spatial-element/spatialElementMedia.js.map +1 -0
  215. package/dist/spatial-element/spatialElementScene.d.ts +16 -0
  216. package/dist/spatial-element/spatialElementScene.d.ts.map +1 -0
  217. package/dist/spatial-element/spatialElementScene.js +22 -0
  218. package/dist/spatial-element/spatialElementScene.js.map +1 -0
  219. package/dist/spatial-element/spatialElementSectionRegistry.d.ts +6 -25
  220. package/dist/spatial-element/spatialElementSectionRegistry.d.ts.map +1 -1
  221. package/dist/spatial-element/spatialElementSectionRegistry.js +6 -63
  222. package/dist/spatial-element/spatialElementSectionRegistry.js.map +1 -1
  223. package/dist/spatial-element/spatialTheme.d.ts +27 -0
  224. package/dist/spatial-element/spatialTheme.d.ts.map +1 -0
  225. package/dist/spatial-element/spatialTheme.js +83 -0
  226. package/dist/spatial-element/spatialTheme.js.map +1 -0
  227. package/dist/spatial-element/types.d.ts +117 -36
  228. package/dist/spatial-element/types.d.ts.map +1 -1
  229. package/dist/spatial-element/types.js.map +1 -1
  230. package/dist/stage/BackgroundLayerOutput.d.ts +76 -0
  231. package/dist/stage/BackgroundLayerOutput.d.ts.map +1 -0
  232. package/dist/stage/BackgroundLayerOutput.js +333 -0
  233. package/dist/stage/BackgroundLayerOutput.js.map +1 -0
  234. package/dist/stage/DeviceGeometryMotion.d.ts +13 -0
  235. package/dist/stage/DeviceGeometryMotion.d.ts.map +1 -0
  236. package/dist/stage/DeviceGeometryMotion.js +37 -0
  237. package/dist/stage/DeviceGeometryMotion.js.map +1 -0
  238. package/dist/stage/LiquidGlassPanel.d.ts +7 -0
  239. package/dist/stage/LiquidGlassPanel.d.ts.map +1 -1
  240. package/dist/stage/LiquidGlassPanel.js +51 -7
  241. package/dist/stage/LiquidGlassPanel.js.map +1 -1
  242. package/dist/stage/MinimapController.d.ts +4 -1
  243. package/dist/stage/MinimapController.d.ts.map +1 -1
  244. package/dist/stage/MinimapController.js +62 -71
  245. package/dist/stage/MinimapController.js.map +1 -1
  246. package/dist/stage/ModelPointerPreview.d.ts +22 -0
  247. package/dist/stage/ModelPointerPreview.d.ts.map +1 -0
  248. package/dist/stage/ModelPointerPreview.js +71 -0
  249. package/dist/stage/ModelPointerPreview.js.map +1 -0
  250. package/dist/stage/PageBindingController.d.ts +10 -0
  251. package/dist/stage/PageBindingController.d.ts.map +1 -1
  252. package/dist/stage/PageBindingController.js +45 -5
  253. package/dist/stage/PageBindingController.js.map +1 -1
  254. package/dist/stage/PanelPresentationController.d.ts +21 -1
  255. package/dist/stage/PanelPresentationController.d.ts.map +1 -1
  256. package/dist/stage/PanelPresentationController.js +190 -31
  257. package/dist/stage/PanelPresentationController.js.map +1 -1
  258. package/dist/stage/SpaceMouseAdapter.d.ts +10 -2
  259. package/dist/stage/SpaceMouseAdapter.d.ts.map +1 -1
  260. package/dist/stage/SpaceMouseAdapter.js +50 -8
  261. package/dist/stage/SpaceMouseAdapter.js.map +1 -1
  262. package/dist/stage/SpatialElementInteractionController.d.ts +24 -2
  263. package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -1
  264. package/dist/stage/SpatialElementInteractionController.js +198 -45
  265. package/dist/stage/SpatialElementInteractionController.js.map +1 -1
  266. package/dist/stage/SpatialElementPresentationController.d.ts +14 -2
  267. package/dist/stage/SpatialElementPresentationController.d.ts.map +1 -1
  268. package/dist/stage/SpatialElementPresentationController.js +47 -2
  269. package/dist/stage/SpatialElementPresentationController.js.map +1 -1
  270. package/dist/stage/SpatialElementRefinement.d.ts +34 -1
  271. package/dist/stage/SpatialElementRefinement.d.ts.map +1 -1
  272. package/dist/stage/SpatialElementRefinement.js +175 -37
  273. package/dist/stage/SpatialElementRefinement.js.map +1 -1
  274. package/dist/stage/StageExperience.d.ts +266 -11
  275. package/dist/stage/StageExperience.d.ts.map +1 -1
  276. package/dist/stage/StageExperience.js +673 -126
  277. package/dist/stage/StageExperience.js.map +1 -1
  278. package/dist/stage/StageFullscreenController.d.ts +17 -0
  279. package/dist/stage/StageFullscreenController.d.ts.map +1 -0
  280. package/dist/stage/StageFullscreenController.js +90 -0
  281. package/dist/stage/StageFullscreenController.js.map +1 -0
  282. package/dist/stage/StagePanelRuntime.d.ts +2 -1
  283. package/dist/stage/StagePanelRuntime.d.ts.map +1 -1
  284. package/dist/stage/StagePanelRuntime.js.map +1 -1
  285. package/dist/stage/StageRenderPipeline.d.ts +90 -2
  286. package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
  287. package/dist/stage/StageRenderPipeline.js +494 -120
  288. package/dist/stage/StageRenderPipeline.js.map +1 -1
  289. package/dist/stage/VirtualScrollController.d.ts +7 -0
  290. package/dist/stage/VirtualScrollController.d.ts.map +1 -1
  291. package/dist/stage/VirtualScrollController.js +63 -6
  292. package/dist/stage/VirtualScrollController.js.map +1 -1
  293. package/dist/stage/inertLease.d.ts +2 -0
  294. package/dist/stage/inertLease.d.ts.map +1 -0
  295. package/dist/stage/inertLease.js +18 -0
  296. package/dist/stage/inertLease.js.map +1 -0
  297. package/dist/stage/interactionGuidance.d.ts +22 -0
  298. package/dist/stage/interactionGuidance.d.ts.map +1 -0
  299. package/dist/stage/interactionGuidance.js +53 -0
  300. package/dist/stage/interactionGuidance.js.map +1 -0
  301. package/dist/stage/interactionOutline.d.ts +14 -0
  302. package/dist/stage/interactionOutline.d.ts.map +1 -0
  303. package/dist/stage/interactionOutline.js +59 -0
  304. package/dist/stage/interactionOutline.js.map +1 -0
  305. package/dist/stage/minimap/MinimapGeometry.d.ts.map +1 -1
  306. package/dist/stage/minimap/MinimapGeometry.js +29 -0
  307. package/dist/stage/minimap/MinimapGeometry.js.map +1 -1
  308. package/dist/stage/minimap/MinimapModel.d.ts +2 -1
  309. package/dist/stage/minimap/MinimapModel.d.ts.map +1 -1
  310. package/dist/stage/minimap/MinimapModel.js +34 -4
  311. package/dist/stage/minimap/MinimapModel.js.map +1 -1
  312. package/dist/stage/minimap/MinimapModelGeometry.d.ts +21 -0
  313. package/dist/stage/minimap/MinimapModelGeometry.d.ts.map +1 -0
  314. package/dist/stage/minimap/MinimapModelGeometry.js +68 -0
  315. package/dist/stage/minimap/MinimapModelGeometry.js.map +1 -0
  316. package/dist/stage/minimap/MinimapProjection.d.ts +7 -0
  317. package/dist/stage/minimap/MinimapProjection.d.ts.map +1 -1
  318. package/dist/stage/minimap/MinimapProjection.js +14 -13
  319. package/dist/stage/minimap/MinimapProjection.js.map +1 -1
  320. package/dist/stage/minimap/MinimapState.d.ts +6 -11
  321. package/dist/stage/minimap/MinimapState.d.ts.map +1 -1
  322. package/dist/stage/minimap/MinimapState.js.map +1 -1
  323. package/dist/stage/mouseHover.d.ts +9 -0
  324. package/dist/stage/mouseHover.d.ts.map +1 -0
  325. package/dist/stage/mouseHover.js +55 -0
  326. package/dist/stage/mouseHover.js.map +1 -0
  327. package/dist/stage/panelContext.d.ts +33 -2
  328. package/dist/stage/panelContext.d.ts.map +1 -1
  329. package/dist/stage/panelContext.js.map +1 -1
  330. package/dist/stage/panelFocusMath.d.ts +34 -0
  331. package/dist/stage/panelFocusMath.d.ts.map +1 -0
  332. package/dist/stage/panelFocusMath.js +79 -0
  333. package/dist/stage/panelFocusMath.js.map +1 -0
  334. package/dist/stage/renderSettings.d.ts +10 -0
  335. package/dist/stage/renderSettings.d.ts.map +1 -0
  336. package/dist/stage/renderSettings.js +27 -0
  337. package/dist/stage/renderSettings.js.map +1 -0
  338. package/dist/stage/renderTargetInventory.d.ts +1 -1
  339. package/dist/stage/renderTargetInventory.js +1 -1
  340. package/dist/stage/renderTargetInventory.js.map +1 -1
  341. package/dist/stage/rendererState.d.ts +2 -0
  342. package/dist/stage/rendererState.d.ts.map +1 -1
  343. package/dist/stage/rendererState.js +13 -0
  344. package/dist/stage/rendererState.js.map +1 -1
  345. package/dist/stage/scalarMath.d.ts +6 -0
  346. package/dist/stage/scalarMath.d.ts.map +1 -0
  347. package/dist/stage/scalarMath.js +6 -0
  348. package/dist/stage/scalarMath.js.map +1 -0
  349. package/dist/stage/sceneEndpointEligibility.d.ts +20 -0
  350. package/dist/stage/sceneEndpointEligibility.d.ts.map +1 -0
  351. package/dist/stage/sceneEndpointEligibility.js +363 -0
  352. package/dist/stage/sceneEndpointEligibility.js.map +1 -0
  353. package/dist/stage/scrollFrame.d.ts +2 -0
  354. package/dist/stage/scrollFrame.d.ts.map +1 -1
  355. package/dist/stage/scrollFrame.js +18 -5
  356. package/dist/stage/scrollFrame.js.map +1 -1
  357. package/dist/stage/spaceMousePermission.d.ts +11 -0
  358. package/dist/stage/spaceMousePermission.d.ts.map +1 -0
  359. package/dist/stage/spaceMousePermission.js +63 -0
  360. package/dist/stage/spaceMousePermission.js.map +1 -0
  361. package/dist/stage/spaceMousePlatform.d.ts +12 -0
  362. package/dist/stage/spaceMousePlatform.d.ts.map +1 -0
  363. package/dist/stage/spaceMousePlatform.js +13 -0
  364. package/dist/stage/spaceMousePlatform.js.map +1 -0
  365. package/dist/stage/spatialElementFrame.d.ts.map +1 -1
  366. package/dist/stage/spatialElementFrame.js +5 -1
  367. package/dist/stage/spatialElementFrame.js.map +1 -1
  368. package/dist/stage/stageConstants.d.ts +3 -3
  369. package/dist/stage/stageConstants.d.ts.map +1 -1
  370. package/dist/stage/stageConstants.js +10 -10
  371. package/dist/stage/stageConstants.js.map +1 -1
  372. package/dist/stage/stageDom.d.ts +2 -0
  373. package/dist/stage/stageDom.d.ts.map +1 -1
  374. package/dist/stage/stageDom.js +10 -1
  375. package/dist/stage/stageDom.js.map +1 -1
  376. package/dist/stage/stageMath.d.ts +4 -33
  377. package/dist/stage/stageMath.d.ts.map +1 -1
  378. package/dist/stage/stageMath.js +39 -110
  379. package/dist/stage/stageMath.js.map +1 -1
  380. package/dist/stage/stageTypes.d.ts +32 -4
  381. package/dist/stage/stageTypes.d.ts.map +1 -1
  382. package/dist/stage/stageTypes.js.map +1 -1
  383. package/dist/stage/stageVisualTest.d.ts +24 -1
  384. package/dist/stage/stageVisualTest.d.ts.map +1 -1
  385. package/dist/stage/stageVisualTest.js.map +1 -1
  386. package/dist/stage/webgpuSupport.d.ts +3 -0
  387. package/dist/stage/webgpuSupport.d.ts.map +1 -0
  388. package/dist/stage/webgpuSupport.js +14 -0
  389. package/dist/stage/webgpuSupport.js.map +1 -0
  390. package/logo.svg +225 -0
  391. package/package.json +7 -5
@@ -1,4 +1,8 @@
1
+ import { initializeDeviceOrientationMath } from '../catalog/listDeviceOrientation.js';
2
+ import { DeviceYawFilter, screenOrientation } from '../catalog/deviceYaw.js';
1
3
  import { describeRenderTargets } from './renderTargetInventory.js';
4
+ import { DeviceGeometryMotion } from './DeviceGeometryMotion.js';
5
+ import { isDeviceOrientationPaused, getListDeviceYaw, getListDevicePitch, getListDeviceRoll, retainListDeviceOrientation, subscribeListDeviceYaw, pauseDeviceOrientationForScroll, holdDeviceOrientationForTransition } from '../catalog/listDeviceOrientation.js';
2
6
  import { StageRenderPipeline } from './StageRenderPipeline.js';
3
7
  import { PanelPresentationController } from './PanelPresentationController.js';
4
8
  import { MinimapController } from './MinimapController.js';
@@ -21,14 +25,16 @@ import { CSS3DRenderer } from 'three/addons/renderers/CSS3DRenderer.js';
21
25
  import { uniform } from 'three/tsl';
22
26
  import { LiquidGlassPanel, resolveLiquidGlassPanelOptions } from './LiquidGlassPanel.js';
23
27
  import { STAGE_PANEL_LAYOUT_EVENT, STAGE_PANEL_VISUAL_EVENT } from './panelContext.js';
24
- import { DEFAULT_INTERACTION_THEME, DEFAULT_PANELS, PANEL_CAMERA_FOV, PANEL_CONTENT_Z, SPATIAL_ELEMENT_CAMERA_FIT_MARGIN, ZOOM_FOCUS_NOTIFY_EPSILON } from './stageConstants.js';
28
+ import { DEFAULT_BACKGROUND, DEFAULT_INTERACTION_THEME, DEFAULT_PANELS, PANEL_CAMERA_FOV, PANEL_CONTENT_Z, ZOOM_FOCUS_NOTIFY_EPSILON } from './stageConstants.js';
25
29
  import { getStagePositionFromRect, isViewportRectVisible } from './stageDom.js';
26
- import { STAGE_SCROLL_PRIORITY, getStageVisualScrollPosition, subscribeStageScrollFrame } from './scrollFrame.js';
27
- import { getCameraFitDistance, getCameraOrbitDirection, getBoxCorners, getPanelFocusOpacity, getPerspectiveDistance, getSequencedMinimapFocus, getStageUiFocus, getZoomFocusDistanceRange, hasPanelGeometryChanged } from './stageMath.js';
28
- import {} from './SpaceMouseAdapter.js';
30
+ import { STAGE_SCROLL_PRIORITY, getStageVisualScrollPosition, hasPendingStageScrollFrame, subscribeStageScrollFrame } from './scrollFrame.js';
31
+ import { getCameraOrbitDirection, getBoxCorners, getPanelFocusOpacity, getPerspectiveDistance, getSequencedMinimapFocus, getStageUiFocus, getZoomFocusDistanceRange, hasPanelGeometryChanged } from './stageMath.js';
29
32
  import { disposeMinimapModelMaterials } from './minimap/MinimapModel.js';
30
33
  import {} from './minimap/MinimapProjection.js';
31
34
  import { disposeMaterialOnly, getMeshBounds, getMeshMaterials, isMesh } from './stageSceneUtils.js';
35
+ import { isOutlineMesh } from './interactionOutline.js';
36
+ import { resolveDetailLayout, resolveZoomLayout } from '../spatial-element/responsiveLayout.js';
37
+ import { detailCameraFit, detailCameraFitDistance } from '../catalog/stagedDetailGeometry.js';
32
38
  const SCROLL_SETTLE_DELAY = 120;
33
39
  const VIEWPORT_CULL_MARGIN = 96;
34
40
  /** Shared spatial state for both WebGPU glass and DOM-backed panel surfaces. */
@@ -58,6 +64,7 @@ export class StageExperience {
58
64
  }
59
65
  pipeline;
60
66
  backgroundSettings;
67
+ appliedEnvironment;
61
68
  pageBackground = '#ffffff';
62
69
  hdr;
63
70
  glb;
@@ -103,7 +110,64 @@ export class StageExperience {
103
110
  catalogLayer;
104
111
  catalogHandoff = false;
105
112
  catalogMotionComplete = false;
113
+ stagedDetailTarget;
114
+ stagedAwaitingFirstFrame = false;
115
+ stagedSceneCacheOwner;
116
+ stagedRevealPreparing;
117
+ releaseStagedSensorHold;
118
+ /** Use only already submitted source resources during the pre-route movement. */
119
+ beginStagedDetailMotion(source, fit, targetOptions) {
120
+ if (!this.catalogLayer || this.spatialCapture || this.catalogHandoff)
121
+ return false;
122
+ if (this.pipeline.backgroundOutputHeld || !this.catalogLayer.isStagedDetailReady(source.spatialElementId, source.occurrence, this.renderer, this.pipeline.ensureCatalogWarmOutputContext()))
123
+ return false;
124
+ const target = this.catalogLayer.getStagedDetailTarget(source.spatialElementId, source.occurrence, fit, { width: window.innerWidth, height: window.innerHeight }, targetOptions, this.renderer.coordinateSystem);
125
+ if (!target || !this.catalogLayer.capture(source.spatialElementId, source.occurrence))
126
+ return false;
127
+ this.stagedDetailTarget = target;
128
+ // Progress zero preserves the currently displayed source. The transition's
129
+ // clock submits the first changed pose; an intervening Stage RAF would draw
130
+ // that same source again and delay the first visible acknowledgement.
131
+ this.stagedAwaitingFirstFrame = true;
132
+ cancelAnimationFrame(this.renderRequestId);
133
+ this.renderRequestId = 0;
134
+ this.catalogLayer.freezeStagedSource();
135
+ this.releaseStagedSensorHold = holdDeviceOrientationForTransition();
136
+ this.deviceMotion.update(0, 0, 0, 1);
137
+ this.catalogHandoff = true;
138
+ this.catalogMotionComplete = false;
139
+ this.preparationGate.setPaused(true);
140
+ this.detailPreparationGate.setPaused(true);
141
+ this.setStagedDetailProgress(0);
142
+ return true;
143
+ }
144
+ setStagedDetailProgress(progress) {
145
+ if (!this.stagedDetailTarget)
146
+ return;
147
+ this.catalogLayer?.setHandoffTarget({ ...this.stagedDetailTarget, progress, environmentIntensity: 0.5 });
148
+ this.requestRender();
149
+ }
150
+ setStagedDetailPanel(card, corners, width, height) {
151
+ return this.catalogLayer?.setStagedPanel(card, corners, width, height) ?? false;
152
+ }
153
+ setStagedPanelOpacity(opacity) { this.catalogLayer?.setStagedPanelOpacity(opacity); }
154
+ /** Called only after the final moving frame: route teardown may now replace its source. */
155
+ holdStagedDetail(spatialElementId, kind = 'hero') {
156
+ if (!this.stagedDetailTarget)
157
+ return false;
158
+ this.setStagedDetailProgress(1);
159
+ this.flushCatalogFrame();
160
+ const held = this.adoptCatalogPresentation({ spatialElementId, kind }, true);
161
+ this.stagedDetailTarget = undefined;
162
+ return held;
163
+ }
164
+ deferredZoomPreparation = false;
165
+ deferredScrollWarmup;
166
+ zoomPreparationFrame = 0;
106
167
  catalogLayerAnimating = false;
168
+ stagedPreparationIdle = 0;
169
+ stagedPreparationFallback = false;
170
+ stagedPreparationAbort = new AbortController();
107
171
  catalogPresentation = { ...RESTING_CATALOG_PRESENTATION };
108
172
  pageModelReady = false;
109
173
  preparationGate = new PreparationGate();
@@ -177,9 +241,18 @@ export class StageExperience {
177
241
  get minimaps() {
178
242
  return this.minimapController.views;
179
243
  }
180
- resize = () => this.resizeRenderer();
244
+ resize = () => this.requestRender();
245
+ rendererSize = new THREE.Vector2();
246
+ deviceMotion = new DeviceGeometryMotion();
247
+ deviceOrientationEnabled;
248
+ releaseDeviceOrientation;
249
+ unsubscribeDeviceOrientation;
181
250
  render = () => {
182
251
  this.renderRequestId = 0;
252
+ // The shared callback will draw after updating DOM/dock positions. Avoid
253
+ // submitting an older camera/scroll frame immediately before that draw.
254
+ if (this.stopScrollFrames && hasPendingStageScrollFrame())
255
+ return;
183
256
  this.renderFrame();
184
257
  };
185
258
  visibilityChange = () => {
@@ -187,9 +260,15 @@ export class StageExperience {
187
260
  this.requestRender();
188
261
  };
189
262
  pointerMove = (event) => this.handlePointerMove(event);
190
- pointerLeave = () => this.handlePointerLeave();
263
+ pointerLeave = (event) => {
264
+ if (event.type === 'blur' || event.pointerType === 'mouse') {
265
+ this.handlePointerLeave();
266
+ }
267
+ };
268
+ pointerContact = (event) => this.interaction.handlePointerContact(event);
191
269
  pointerDown = (event) => this.handlePointerDown(event);
192
270
  pointerUp = (event) => this.handlePointerUp(event);
271
+ touchStart = (event) => this.interaction.handleTouchStart(event);
193
272
  wheel = (event) => this.handleWheel(event);
194
273
  scroll = (frame) => this.handleScrollFrame(frame);
195
274
  finishScroll = () => {
@@ -244,11 +323,46 @@ export class StageExperience {
244
323
  animationActive = false;
245
324
  scrollActive = false;
246
325
  scrollEndTimer = 0;
247
- lastInteractionTime = performance.now();
326
+ // Input events must not reset the frame clock: high-rate wheel/SpaceMouse
327
+ // events can arrive just before RAF and otherwise starve the damping delta.
328
+ lastFrameTime = performance.now();
248
329
  layoutDirty = true;
249
330
  panelMeasurementsDirty = true;
250
331
  viewportMeasurementDirty = true;
251
332
  stageViewportVisible = true;
333
+ readLayoutMetrics;
334
+ detailMedia = 'minimap';
335
+ get detailMediaActive() { return this.detailMedia === 'minimap'; }
336
+ /** Changing media keeps the model/cache/camera but stops its interaction and sensor clock. */
337
+ setDetailMedia(media) {
338
+ if (this.detailMedia === media)
339
+ return;
340
+ this.detailMedia = media;
341
+ this.interaction.releasePage();
342
+ if (!this.detailMediaActive) {
343
+ this.releaseDeviceOrientation?.();
344
+ this.releaseDeviceOrientation = undefined;
345
+ }
346
+ this.requestRender();
347
+ }
348
+ readDetailInteractionLayout() {
349
+ const input = this.catalog ? this.readLayoutMetrics?.('stable') : undefined;
350
+ if (!input)
351
+ return;
352
+ const layout = resolveDetailLayout(input);
353
+ const split = layout.composition === 'split';
354
+ return { media: this.detailMedia, split,
355
+ paneHidden: split && (this.fullscreen || this.panelUiFocus >= 0.99),
356
+ paneLeft: layout.base.pane.x };
357
+ }
358
+ fullscreen = false;
359
+ setFullscreen(fullscreen) {
360
+ if (this.fullscreen === fullscreen)
361
+ return;
362
+ this.fullscreen = fullscreen;
363
+ this.interaction.setFullscreen(fullscreen);
364
+ this.resizeRenderer();
365
+ }
252
366
  get visiblePanelCount() {
253
367
  return this.panels.visiblePanels;
254
368
  }
@@ -302,30 +416,38 @@ export class StageExperience {
302
416
  */
303
417
  constructor(container, options = {}) {
304
418
  this.container = container;
419
+ this.readLayoutMetrics = options.readLayoutMetrics;
420
+ this.detailMedia = options.detailMedia ?? 'minimap';
305
421
  if (options.dracoDecoderPath)
306
422
  this.assets.setDracoDecoderPath(options.dracoDecoderPath);
423
+ this.deviceOrientationEnabled = options.deviceOrientation ?? false;
424
+ if (this.deviceOrientationEnabled)
425
+ this.unsubscribeDeviceOrientation = subscribeListDeviceYaw(() => {
426
+ if (this.releaseDeviceOrientation && !this.scrollActive)
427
+ this.requestRender();
428
+ });
307
429
  this.interaction = new SpatialElementInteractionController({
430
+ onSpaceMouseStateChange: options.onSpaceMouseStateChange,
308
431
  camera: this.camera,
309
432
  canvas: this.backgroundCanvas,
310
433
  container,
311
434
  cssRoot: this.cssRenderer.domElement,
312
435
  requestRender: () => this.requestRender(),
313
- markActivity: () => {
314
- this.lastInteractionTime = performance.now();
315
- },
316
436
  updateProjection: () => this.updateStageCameraProjection(),
317
437
  readGeometry: () => ({
318
438
  poseOwner: this.catalogHandoff || this.spatialCapture
319
439
  ? 'transition'
320
- : this.catalog && !this.viewportTarget
440
+ : !this.detailMediaActive || (this.catalog && !this.viewportTarget)
321
441
  ? 'none'
322
442
  : 'page',
323
- visible: this.stageViewportVisible,
443
+ visible: this.stageViewportVisible && this.detailMediaActive,
444
+ detail: this.readDetailInteractionLayout(),
324
445
  viewport: this.viewportFrame,
325
446
  bounds: this.modelBounds
326
447
  })
327
448
  });
328
449
  this.minimapController = new MinimapController({
450
+ sensorRotation: () => this.deviceMotion.rotation,
329
451
  renderer: this.renderer,
330
452
  camera: this.camera,
331
453
  panelCamera: this.panelCamera,
@@ -339,12 +461,13 @@ export class StageExperience {
339
461
  restCamera: this.initialCameraWorldQuaternion,
340
462
  restModel: this.initialModelWorldQuaternion,
341
463
  hasControls: Boolean(this.controls),
342
- referenceTarget: this.getZoomReferenceTarget()
464
+ center: this.initialControlsTarget
343
465
  }),
344
466
  frame: () => ({
345
467
  hovering: this.modelHover,
346
468
  interacting: this.modelInteractionActive,
347
- scrolling: this.scrollActive
469
+ scrolling: this.scrollActive,
470
+ fullscreen: this.fullscreen
348
471
  }),
349
472
  environment: () => this.environmentTarget,
350
473
  capture: () => this.pipeline.activeRenderTargets,
@@ -354,6 +477,10 @@ export class StageExperience {
354
477
  includeMesh: (mesh) => this.isSpatialElementMesh(mesh)
355
478
  });
356
479
  this.panels = new PanelPresentationController({
480
+ zoomLayout: () => {
481
+ const input = this.catalog ? this.readLayoutMetrics?.('visible') : undefined;
482
+ return input ? resolveZoomLayout(input) : undefined;
483
+ },
357
484
  camera: this.panelCamera,
358
485
  contentScene: this.panelContentScene,
359
486
  flatLayer: this.flatPanelLayer,
@@ -365,6 +492,7 @@ export class StageExperience {
365
492
  presentation: this.catalogPresentation,
366
493
  minimapFocus: this.minimapFocus,
367
494
  uiFocus: this.panelUiFocus,
495
+ fullscreen: this.fullscreen,
368
496
  pointer: this.pointer
369
497
  }),
370
498
  visible: (index) => this.isPanelTargetVisible(index),
@@ -391,7 +519,7 @@ export class StageExperience {
391
519
  this.excludedMeshNames = new Set(this.modelSettings.excludeMeshes ?? []);
392
520
  this.interactionTheme = { ...DEFAULT_INTERACTION_THEME, ...options.interactionTheme };
393
521
  this.pageBinding.attach(options.panels, options.viewport);
394
- this.spaceMouseEnabled = options.enableSpaceMouse ?? true;
522
+ this.spaceMouseEnabled = options.enableSpaceMouse ?? false;
395
523
  this.fallbackPanelOptions = this.panelTargets.length
396
524
  ? this.panelTargets
397
525
  .filter((panel) => panel.surface === 'glass' || (panel.surface === 'frosted' && Boolean(panel.minimap)))
@@ -401,6 +529,7 @@ export class StageExperience {
401
529
  : DEFAULT_PANELS;
402
530
  this.pipeline = new StageRenderPipeline({
403
531
  pageBackground: (this.pageBackground = options.pageBackground ?? '#ffffff'),
532
+ renderSettings: options.renderSettings,
404
533
  renderer: this.renderer,
405
534
  container: this.container,
406
535
  backgroundCanvas: this.backgroundCanvas,
@@ -427,6 +556,7 @@ export class StageExperience {
427
556
  catalogHandoff: this.catalogHandoff,
428
557
  catalogMotionComplete: this.catalogMotionComplete,
429
558
  stageViewportVisible: this.stageViewportVisible,
559
+ detailMediaActive: this.detailMediaActive,
430
560
  modelHover: this.modelHover,
431
561
  modelInteractionActive: this.modelInteractionActive,
432
562
  catalog: this.catalog,
@@ -446,6 +576,7 @@ export class StageExperience {
446
576
  if (!navigator.gpu) {
447
577
  throw new Error('WebGPU is not available in this browser');
448
578
  }
579
+ initializeDeviceOrientationMath(new DeviceYawFilter(), screenOrientation);
449
580
  this.pipeline.configureRenderer();
450
581
  await this.renderer.init();
451
582
  this.environments = new EnvironmentCache(this.renderer, this.preparationGate);
@@ -467,6 +598,7 @@ export class StageExperience {
467
598
  this.renderer.dispose();
468
599
  return;
469
600
  }
601
+ this.pipeline.initializeBackgroundOutput();
470
602
  this.backgroundCanvas.className = 'stage-webgpu-background';
471
603
  this.container.appendChild(this.backgroundCanvas);
472
604
  this.configureCssRenderer();
@@ -491,6 +623,9 @@ export class StageExperience {
491
623
  this.pipeline.createSceneCapture();
492
624
  this.createPanels();
493
625
  this.resizeRenderer();
626
+ // Reparenting must preserve the already visible HTML in the same task;
627
+ // shader compilation below can yield for more than one browser frame.
628
+ this.renderPanelContents();
494
629
  this.pipeline.warmRenderTargetSets();
495
630
  await this.pipeline.prepareZoomEffects();
496
631
  if (this.disposed)
@@ -501,16 +636,19 @@ export class StageExperience {
501
636
  this.currentScrollY = scrollPosition.scrollY;
502
637
  this.lastScrollY = this.currentScrollY;
503
638
  window.addEventListener('resize', this.resize);
639
+ window.visualViewport?.addEventListener('resize', this.resize);
504
640
  this.stopScrollFrames = subscribeStageScrollFrame(this.scroll, STAGE_SCROLL_PRIORITY.stage);
505
641
  window.addEventListener(STAGE_PANEL_LAYOUT_EVENT, this.requestPanelSync);
506
642
  window.addEventListener(STAGE_PANEL_VISUAL_EVENT, this.requestPanelVisualSync);
507
643
  window.addEventListener('pointermove', this.pointerMove);
644
+ window.addEventListener('pointerdown', this.pointerContact, { capture: true, passive: true });
508
645
  window.addEventListener('pointerup', this.pointerUp);
509
646
  window.addEventListener('pointercancel', this.pointerUp);
510
647
  window.addEventListener('pointerleave', this.pointerLeave);
511
648
  window.addEventListener('blur', this.pointerLeave);
512
649
  document.addEventListener('visibilitychange', this.visibilityChange);
513
650
  this.backgroundCanvas.addEventListener('pointerdown', this.pointerDown, { capture: true });
651
+ this.backgroundCanvas.addEventListener('touchstart', this.touchStart, { passive: false });
514
652
  this.backgroundCanvas.addEventListener('wheel', this.wheel, {
515
653
  capture: true,
516
654
  passive: false
@@ -524,14 +662,27 @@ export class StageExperience {
524
662
  if (this.disposed)
525
663
  return;
526
664
  this.disposed = true;
665
+ this.stagedPreparationAbort.abort();
666
+ if (this.stagedPreparationIdle) {
667
+ if (this.stagedPreparationFallback)
668
+ clearTimeout(this.stagedPreparationIdle);
669
+ else
670
+ window.cancelIdleCallback(this.stagedPreparationIdle);
671
+ }
672
+ this.releaseDeviceOrientation?.();
673
+ this.unsubscribeDeviceOrientation?.();
674
+ this.releaseStagedSensorHold?.();
675
+ this.releaseStagedSensorHold = undefined;
527
676
  this.releaseSpatialCapture();
528
677
  this.container.removeAttribute('data-stage-scroll-rendering');
529
678
  window.removeEventListener('resize', this.resize);
679
+ window.visualViewport?.removeEventListener('resize', this.resize);
530
680
  this.stopScrollFrames?.();
531
681
  this.stopScrollFrames = undefined;
532
682
  window.removeEventListener(STAGE_PANEL_LAYOUT_EVENT, this.requestPanelSync);
533
683
  window.removeEventListener(STAGE_PANEL_VISUAL_EVENT, this.requestPanelVisualSync);
534
684
  window.removeEventListener('pointermove', this.pointerMove);
685
+ window.removeEventListener('pointerdown', this.pointerContact, { capture: true });
535
686
  window.removeEventListener('pointerup', this.pointerUp);
536
687
  window.removeEventListener('pointercancel', this.pointerUp);
537
688
  window.removeEventListener('pointerleave', this.pointerLeave);
@@ -541,6 +692,7 @@ export class StageExperience {
541
692
  capture: true
542
693
  });
543
694
  this.backgroundCanvas.removeEventListener('wheel', this.wheel, { capture: true });
695
+ this.backgroundCanvas.removeEventListener('touchstart', this.touchStart);
544
696
  if (this.renderRequestId)
545
697
  cancelAnimationFrame(this.renderRequestId);
546
698
  this.renderRequestId = 0;
@@ -572,6 +724,12 @@ export class StageExperience {
572
724
  }
573
725
  /** Page DOM is a replaceable binding, not the owner of the device or element cache. */
574
726
  releasePage() {
727
+ // Window-level driver focus belongs only to the mounted detail viewer.
728
+ this.interaction.disconnectSpaceMouse();
729
+ cancelAnimationFrame(this.zoomPreparationFrame);
730
+ this.zoomPreparationFrame = 0;
731
+ this.deferredZoomPreparation = false;
732
+ this.deferredScrollWarmup = undefined;
575
733
  this.pageBinding.invalidate();
576
734
  this.pageModelReady = false;
577
735
  this.presentation.cancelRequests();
@@ -601,6 +759,12 @@ export class StageExperience {
601
759
  element);
602
760
  }
603
761
  capturePanelSurface(element) {
762
+ if (element.closest('[data-carousel-spatial-element]')) {
763
+ const bounds = element.matches('.summary') ? element :
764
+ (element.closest('[data-spatial-presentation-root]') ?? element);
765
+ const surface = bounds.querySelector('.spatial-summary-surface');
766
+ return captureCssSurface(bounds, surface ?? bounds, surface ? undefined : '::before');
767
+ }
604
768
  if (element.hasAttribute('data-catalog-dock-surface')) {
605
769
  const header = element.closest('[data-spatial-element-sticky-header]');
606
770
  if (header)
@@ -674,9 +838,82 @@ export class StageExperience {
674
838
  return;
675
839
  return { width, height, corners: corners };
676
840
  }
841
+ /** Updates appearance in place. Model leases, camera, interaction and page navigation stay intact. */
842
+ updateAppearance(options) {
843
+ if (this.disposed)
844
+ return;
845
+ this.pageBackground = options.pageBackground ?? '#ffffff';
846
+ this.pipeline.setPageBackground(this.pageBackground);
847
+ this.catalogLayer?.setPageBackground(this.pageBackground);
848
+ this.backgroundSettings = { ...DEFAULT_BACKGROUND, ...options.background };
849
+ if (this.appliedEnvironment) {
850
+ this.backgroundScene.background = this.backgroundSettings.blurriness <= 0
851
+ ? this.appliedEnvironment.source : this.appliedEnvironment.target.texture;
852
+ }
853
+ this.backgroundScene.backgroundBlurriness = this.backgroundSettings.blurriness;
854
+ if (this.tintMaterial) {
855
+ this.tintMaterial.color.set(this.backgroundSettings.tint);
856
+ this.tintMaterial.opacity = this.backgroundSettings.tintIntensity;
857
+ }
858
+ const previousExcludeMesh = this.interactionTheme.excludeMesh;
859
+ Object.assign(this.interactionTheme, DEFAULT_INTERACTION_THEME, { excludeMesh: undefined }, options.interactionTheme);
860
+ this.pipeline.updateInteractionTheme();
861
+ if (previousExcludeMesh !== this.interactionTheme.excludeMesh && this.model) {
862
+ const pickModel = this.refinementState === 'high' && this.highPose ? this.highPose : this.model;
863
+ this.collectModelPickTargets(pickModel);
864
+ if (pickModel === this.model)
865
+ this.pipeline.createModelOutline(this.model);
866
+ else {
867
+ const outline = this.model.clone(false);
868
+ outline.add(pickModel.clone(true));
869
+ this.pipeline.createModelOutline(outline);
870
+ }
871
+ }
872
+ const changed = [];
873
+ let surfaceChanged = false;
874
+ for (const next of options.panels ?? []) {
875
+ const index = this.panelTargets.findIndex((target) => target.frame === next.frame);
876
+ const target = this.panelTargets[index];
877
+ if (!target)
878
+ continue; // Navigation owns newly registered panels.
879
+ const appearance = (panel) => JSON.stringify([
880
+ panel.options, panel.minimap, panel.surface, panel.contentInset, panel.nativeContent
881
+ ]);
882
+ if (appearance(target) === appearance(next))
883
+ continue;
884
+ surfaceChanged ||= target.surface !== next.surface || target.nativeContent !== next.nativeContent;
885
+ Object.assign(target, next);
886
+ changed.push(index);
887
+ }
888
+ if (changed.length) {
889
+ this.fallbackPanelOptions = this.panelTargets
890
+ .filter((target) => target.surface === 'glass' || target.minimap).map((target) => target.options);
891
+ this.pipeline.syncPanelBlurCaptures();
892
+ if (surfaceChanged) {
893
+ // Surface/DOM ownership changes move the entire live root, never its children or scene.
894
+ this.minimapController.dispose();
895
+ this.panels.release();
896
+ this.createPanels();
897
+ }
898
+ else
899
+ for (const index of changed) {
900
+ const target = this.panelTargets[index];
901
+ const measured = this.getMeasuredPanelOptions(target, true);
902
+ if (this.panelRuntimes[index]?.glass)
903
+ this.replacePanel(index, measured);
904
+ else if (this.panelRuntimes[index])
905
+ this.panelRuntimes[index].options = resolveLiquidGlassPanelOptions(measured);
906
+ this.createMinimap(index, target.minimap);
907
+ }
908
+ this.panelMeasurementsDirty = this.layoutDirty = true;
909
+ }
910
+ this.requestRender();
911
+ }
677
912
  async updatePage(options) {
678
913
  if (this.disposed)
679
914
  return;
915
+ if ('renderSettings' in options)
916
+ this.pipeline.setRenderSettings(options.renderSettings);
680
917
  this.pageBackground = options.pageBackground ?? '#ffffff';
681
918
  this.pipeline.setPageBackground(this.pageBackground);
682
919
  this.catalogLayer?.setPageBackground(this.pageBackground);
@@ -733,8 +970,14 @@ export class StageExperience {
733
970
  this.createPanels();
734
971
  this.observePanelTargets();
735
972
  this.resizeRenderer();
973
+ // Navigation needs the visible full-quality frame, not future scroll/zoom variants.
974
+ // Direct/zoomed entries keep eager warming; ordinary handoffs warm after their final paint.
975
+ this.deferredZoomPreparation = this.catalogPresentation.active && this.panelUiFocus === 0;
976
+ if (!this.deferredZoomPreparation)
977
+ this.pipeline.warmRenderTargetSets();
736
978
  this.renderFrame(true);
737
- await this.pipeline.prepareZoomEffects();
979
+ if (!this.deferredZoomPreparation)
980
+ await this.pipeline.prepareZoomEffects();
738
981
  if (this.disposed || !this.pageBinding.isCurrent(generation))
739
982
  return;
740
983
  // A submitted Low/panel frame is not yet GPU-ready. Drain the required binding work
@@ -747,14 +990,118 @@ export class StageExperience {
747
990
  void this.initializeSpaceMouse();
748
991
  }
749
992
  setCatalogSpatialElements(brandId, items) {
750
- this.catalogLayer ??= new CatalogSpatialElementLayer(this.assets, () => this.requestRender());
993
+ this.catalogLayer ??= new CatalogSpatialElementLayer(this.assets, () => this.requestRender(), () => this.interactionTheme);
751
994
  this.catalogLayer.setPageBackground(this.pageBackground);
752
995
  this.catalogLayer.setExitOpacity(this.returnSpatialElement
753
996
  ? this.catalogPresentation.enterOpacity
754
997
  : this.catalogPresentation.exitOpacity, this.catalogPresentation.active);
755
998
  return this.catalogLayer.setSpatialElements(brandId, items);
756
999
  }
1000
+ /** Finish required DETAIL GPU preparation before its first visible reveal frame.
1001
+ * Binding happens with enterOpacity=0, which intentionally skips minimaps and
1002
+ * panel blur passes. Borrow fractional/end-point alpha to prepare both real
1003
+ * material owners, restore all presentation state synchronously, then fence.
1004
+ */
1005
+ async prepareStagedReveal(signal) {
1006
+ if (this.disposed || signal?.aborted || !this.catalogPresentation.active)
1007
+ return false;
1008
+ const generation = this.pageBinding.token;
1009
+ const owner = {};
1010
+ const pageBackground = this.pageBackground;
1011
+ this.presentation.invalidateSceneEndpoints();
1012
+ this.stagedSceneCacheOwner = this.stagedRevealPreparing = owner;
1013
+ const presentation = this.catalogPresentation;
1014
+ const backgroundReveal = this.catalogBackgroundReveal.value;
1015
+ let prepared = true;
1016
+ let succeeded = false;
1017
+ let ticket;
1018
+ let scrollWarmup;
1019
+ this.deferredScrollWarmup = undefined;
1020
+ try {
1021
+ try {
1022
+ // List/Card does not necessarily flush after binding. Adopt only already-ready
1023
+ // asynchronous High; this starts no loading and advances neither p nor q.
1024
+ if (this.pageModelReady && this.catalogHandoff && this.catalogMotionComplete && !this.catalogDockTarget &&
1025
+ this.catalogMode !== 'synchronous' && this.pagePreparation?.highState === 'ready')
1026
+ this.adoptPreparedHigh();
1027
+ // Programmatic dock restoration may still own the temporary scroll targets.
1028
+ // The reveal uses full quality; do not let its settle timer select cold targets.
1029
+ this.pipeline.setScrollRenderQuality(false);
1030
+ this.syncPanelLayouts();
1031
+ for (const opacity of [0.5, 1]) {
1032
+ this.catalogPresentation = {
1033
+ ...presentation, enterOpacity: opacity, sharedOpacity: opacity
1034
+ };
1035
+ this.catalogBackgroundReveal.value = opacity;
1036
+ this.updatePanelPointerInteraction(0);
1037
+ if (!this.pipeline.warmRevealFrame()) {
1038
+ prepared = false;
1039
+ break;
1040
+ }
1041
+ }
1042
+ if (prepared && this.deferredZoomPreparation && !this.catalogDockTarget && !this.refinement) {
1043
+ const model = this.model, low = this.presentation.assetInstance, high = this.highInstance, environment = this.scene.environment, background = this.backgroundScene.background;
1044
+ scrollWarmup = this.pipeline.captureDeferredScrollWarmup(() => !this.disposed && !signal?.aborted && this.pageBinding.isCurrent(generation) && this.pageModelReady && this.detailMediaActive &&
1045
+ this.model === model && this.presentation.assetInstance === low && this.highInstance === high && !this.refinement &&
1046
+ this.scene.environment === environment && this.backgroundScene.background === background && this.pageBackground === pageBackground);
1047
+ }
1048
+ // Shader/target warm-up is finished. Only now capture final endpoint pixels.
1049
+ if (prepared && this.catalogHandoff && this.catalogMotionComplete && !this.catalogDockTarget &&
1050
+ this.renderer.backend.isWebGPUBackend) {
1051
+ try {
1052
+ ticket = this.pipeline.withSceneCapture(() => {
1053
+ const target = this.renderer.getRenderTarget();
1054
+ const width = target.width, height = target.height;
1055
+ return this.presentation.prepareSceneEndpoints(this.renderer, this.scene, this.camera, this.pagePreparation?.environment.value?.target.texture, (p) => {
1056
+ const previous = this.catalogBackgroundReveal.value;
1057
+ this.catalogBackgroundReveal.value = p;
1058
+ try {
1059
+ this.pipeline.renderStageContents();
1060
+ }
1061
+ finally {
1062
+ this.catalogBackgroundReveal.value = previous;
1063
+ }
1064
+ }, () => !this.disposed && !signal?.aborted && this.stagedSceneCacheOwner === owner && this.pageBinding.isCurrent(generation) &&
1065
+ this.catalogPresentation.active && !this.catalogDockTarget && this.detailMediaActive &&
1066
+ this.pageBackground === pageBackground && this.pipeline.isSceneCaptureCurrent(target, width, height), [this.backgroundScene, this.tintScene], [this.tintCamera]);
1067
+ });
1068
+ }
1069
+ catch (error) {
1070
+ console.warn('Optional staged scene endpoint preparation failed; retaining live rendering', error);
1071
+ }
1072
+ }
1073
+ }
1074
+ finally {
1075
+ this.catalogPresentation = presentation;
1076
+ this.catalogBackgroundReveal.value = backgroundReveal;
1077
+ this.updatePanelPointerInteraction(0);
1078
+ }
1079
+ if (!prepared)
1080
+ return false;
1081
+ const device = this.renderer.backend.device;
1082
+ await device?.queue.onSubmittedWorkDone();
1083
+ if (this.disposed || signal?.aborted || !this.pageBinding.isCurrent(generation) || this.stagedSceneCacheOwner !== owner)
1084
+ return false;
1085
+ // A live Low/High write during the fence invalidates its ticket even with the same page generation.
1086
+ ticket?.commit();
1087
+ this.deferredScrollWarmup = scrollWarmup;
1088
+ succeeded = true;
1089
+ return true;
1090
+ }
1091
+ finally {
1092
+ if (this.stagedRevealPreparing === owner)
1093
+ this.stagedRevealPreparing = undefined;
1094
+ if (!succeeded)
1095
+ ticket?.cancel();
1096
+ }
1097
+ }
757
1098
  setCatalogTransitionPresentation(state) {
1099
+ if (!state.active) {
1100
+ this.stagedSceneCacheOwner = undefined;
1101
+ this.presentation.invalidateSceneEndpoints();
1102
+ }
1103
+ if (!state.active)
1104
+ this.scheduleZoomPreparation();
758
1105
  this.catalogPresentation = normalizeCatalogPresentation(state);
759
1106
  for (const entry of this.exitingMinimaps) {
760
1107
  this.setMinimapDisplayModelOpacity(entry.minimap, entry.opacity * state.exitOpacity);
@@ -779,6 +1126,58 @@ export class StageExperience {
779
1126
  this.backgroundCanvas.style.opacity = String(state.active ? state.exitOpacity : 0);
780
1127
  this.requestRender();
781
1128
  }
1129
+ scheduleZoomPreparation() {
1130
+ if (!this.deferredZoomPreparation || this.zoomPreparationFrame || this.disposed)
1131
+ return;
1132
+ const generation = this.pageBinding.token;
1133
+ // A nested RAF lets the final transition frame paint before optional work starts.
1134
+ this.zoomPreparationFrame = requestAnimationFrame(() => {
1135
+ this.zoomPreparationFrame = requestAnimationFrame(() => {
1136
+ this.zoomPreparationFrame = 0;
1137
+ if (this.disposed || !this.pageBinding.isCurrent(generation) || this.catalogPresentation.active)
1138
+ return;
1139
+ this.deferredZoomPreparation = false;
1140
+ const scrollWarmup = this.deferredScrollWarmup;
1141
+ this.deferredScrollWarmup = undefined;
1142
+ void (async () => {
1143
+ if (!scrollWarmup || !this.pipeline.warmInactiveScrollTargetSet(scrollWarmup))
1144
+ this.pipeline.warmRenderTargetSets();
1145
+ await this.pipeline.prepareZoomEffects();
1146
+ if (!this.disposed && this.pageBinding.isCurrent(generation))
1147
+ this.requestRender();
1148
+ })().catch(error => {
1149
+ // Rendering still prepares effects on demand if optional warming fails.
1150
+ if (!this.disposed && this.pageBinding.isCurrent(generation))
1151
+ console.warn('Optional zoom preparation failed', error);
1152
+ });
1153
+ });
1154
+ });
1155
+ }
1156
+ scheduleStagedPreparation() {
1157
+ if (this.disposed || this.stagedPreparationIdle || this.catalogHandoff || this.scrollActive ||
1158
+ this.catalogPresentation.active || this.pipeline.backgroundOutputHeld ||
1159
+ !this.catalogLayer?.needsStagedPreparation(this.renderer, this.pipeline.ensureCatalogWarmOutputContext()))
1160
+ return;
1161
+ const prepare = () => {
1162
+ this.stagedPreparationIdle = 0;
1163
+ if (this.disposed || this.catalogHandoff || this.scrollActive || this.catalogPresentation.active || this.pipeline.backgroundOutputHeld)
1164
+ return;
1165
+ void this.preparationGate.run(() => {
1166
+ if (this.disposed || this.catalogHandoff || this.scrollActive || this.catalogPresentation.active || this.pipeline.backgroundOutputHeld)
1167
+ return;
1168
+ return this.catalogLayer?.prepareStagedNavigation(this.renderer, this.pipeline.ensureCatalogWarmOutputContext());
1169
+ }, this.stagedPreparationAbort.signal).catch(() => {
1170
+ // Early navigation remains unavailable; ordinary routing still works.
1171
+ }).finally(() => {
1172
+ // Models can finish their first render while another actor's GPU work
1173
+ // is pending. Recheck once idle instead of waiting for a new input frame.
1174
+ this.scheduleStagedPreparation();
1175
+ });
1176
+ };
1177
+ this.stagedPreparationFallback = !window.requestIdleCallback;
1178
+ this.stagedPreparationIdle = window.requestIdleCallback
1179
+ ? window.requestIdleCallback(prepare, { timeout: 1000 }) : window.setTimeout(prepare, 50);
1180
+ }
782
1181
  /** Reports actual applied GPU alpha for browser verification without layout or style reads. */
783
1182
  getCatalogPresentation() {
784
1183
  const triangles = (root) => {
@@ -810,6 +1209,7 @@ export class StageExperience {
810
1209
  backgroundPrepared: this.catalogBackgroundPrepared,
811
1210
  handoffPoint: this.getCatalogGeometryPoint(),
812
1211
  representations: {
1212
+ sceneEndpointCache: this.presentation.getSceneEndpointStats(),
813
1213
  retainedBlendTargets: this.returnBlend?.targetCount ?? 0,
814
1214
  state: this.refinementState,
815
1215
  hero: this.model ? (this.refinementState === 'high' ? 'high' : 'low') : null,
@@ -855,6 +1255,8 @@ export class StageExperience {
855
1255
  device.destroy();
856
1256
  }
857
1257
  getPanelTransitionOpacity(panel) {
1258
+ if (panel?.content?.element.closest('[data-catalog-shell-continuous]'))
1259
+ return 1;
858
1260
  return getCatalogTransitionOpacity(this.catalogPresentation, panel?.transitionGroup);
859
1261
  }
860
1262
  captureCatalogGeometry(spatialElementId) {
@@ -948,7 +1350,7 @@ export class StageExperience {
948
1350
  return this.spatialCapture?.getPoint() ?? this.catalogLayer?.getHandoffPoint() ?? null;
949
1351
  }
950
1352
  /** Lease the last submitted element frame before another page binding can release it. */
951
- adoptCatalogPresentation(destination) {
1353
+ adoptCatalogPresentation(destination, restoreSourceOnCancel = false) {
952
1354
  const { spatialElementId } = destination;
953
1355
  const reverse = destination.kind === 'content';
954
1356
  if (!this.spatialCapture) {
@@ -988,7 +1390,10 @@ export class StageExperience {
988
1390
  highPose?.removeFromParent();
989
1391
  transferredHigh?.overrides.forEach(disposeMaterialOnly);
990
1392
  high?.dispose();
991
- moving.release();
1393
+ if (restoreSourceOnCancel && !this.disposed && this.pageBinding.token === generation)
1394
+ moving.restore();
1395
+ else
1396
+ moving.release();
992
1397
  }
993
1398
  });
994
1399
  }
@@ -1033,6 +1438,7 @@ export class StageExperience {
1033
1438
  this.pageModelReady = false;
1034
1439
  this.spatialCapture = new SpatialGeometryCapture(model, projection, {
1035
1440
  environment: this.scene.environment,
1441
+ outlineTheme: this.modelHover ? this.interactionTheme : undefined,
1036
1442
  environmentIntensity: this.scene.environmentIntensity,
1037
1443
  lights: this.scene.children.filter((child) => child instanceof THREE.Light),
1038
1444
  high: highPose,
@@ -1080,17 +1486,21 @@ export class StageExperience {
1080
1486
  this.outgoingBackground = true;
1081
1487
  return true;
1082
1488
  }
1083
- getDockProjection() {
1489
+ getDockProjection(allowViewportClipping = false) {
1084
1490
  const candidates = [...this.minimaps.values()].filter((minimap) => minimap.viewportVisible);
1085
1491
  if (candidates.length !== 1)
1086
1492
  return;
1087
1493
  const minimap = candidates[0];
1088
1494
  const rect = this.getProjectedMinimapModelRect(minimap);
1089
- if (!rect ||
1090
- rect.x < 0 ||
1091
- rect.y < 0 ||
1092
- rect.x + rect.width > innerWidth ||
1093
- rect.y + rect.height > innerHeight)
1495
+ if (!rect)
1496
+ return;
1497
+ // Canonical dock fits can extend above the viewport (XS/S centers an 80px
1498
+ // fit in a 76px header). A known destination may be partially clipped;
1499
+ // reverse capture retains its stricter, wholly visible source requirement.
1500
+ if (allowViewportClipping
1501
+ ? rect.width <= 0 || rect.height <= 0 || rect.x >= innerWidth || rect.y >= innerHeight ||
1502
+ rect.x + rect.width <= 0 || rect.y + rect.height <= 0
1503
+ : rect.x < 0 || rect.y < 0 || rect.x + rect.width > innerWidth || rect.y + rect.height > innerHeight)
1094
1504
  return;
1095
1505
  return {
1096
1506
  ...captureSpatialElementProjection(minimap.spatialElementRoot, minimap.screenCamera),
@@ -1139,9 +1549,18 @@ export class StageExperience {
1139
1549
  }
1140
1550
  prepareCatalogDestination(dock) {
1141
1551
  this.catalogDockTarget = dock;
1552
+ if (dock) {
1553
+ // Scroll restoration can dock the DOM after updatePage's submitted frame.
1554
+ // Its layout event invalidates the cache, but the next Stage RAF need not
1555
+ // have run before this binding handshake. Resolve the live destination
1556
+ // and its visibility/projection together, without drawing a GPU frame or
1557
+ // advancing hover animation while the retained source is held onscreen.
1558
+ this.syncPanelLayouts(true);
1559
+ this.updatePanelPointerInteraction(0);
1560
+ }
1142
1561
  if (this.adoptedForward) {
1143
1562
  this.returnProjection = dock
1144
- ? this.getDockProjection()
1563
+ ? this.getDockProjection(true)
1145
1564
  : this.model
1146
1565
  ? {
1147
1566
  ...captureSpatialElementProjection(this.model, this.camera),
@@ -1150,7 +1569,7 @@ export class StageExperience {
1150
1569
  : undefined;
1151
1570
  return Boolean(this.returnProjection);
1152
1571
  }
1153
- return !dock || Boolean(this.getDockProjection());
1572
+ return !dock || Boolean(this.getDockProjection(true));
1154
1573
  }
1155
1574
  prepareReturnDestination() {
1156
1575
  if (!this.returnSpatialElement || !this.spatialCapture)
@@ -1284,14 +1703,31 @@ export class StageExperience {
1284
1703
  }
1285
1704
  /** Commit GPU and DOM motion in the same browser frame, not on consecutive RAFs. */
1286
1705
  flushCatalogFrame() {
1706
+ this.stagedAwaitingFirstFrame = false;
1287
1707
  cancelAnimationFrame(this.renderRequestId);
1288
1708
  this.renderRequestId = 0;
1289
1709
  this.renderFrame(true);
1710
+ // A synchronous render callback (for example adopting newly prepared High)
1711
+ // can invalidate while this forced frame is running. Its own RAF would run
1712
+ // before the next external-clock pose and draw this pose again. Keep the
1713
+ // dirty flag, but let that next external flush consume it. Invalidations
1714
+ // outside this flush remain schedulable, including during held page binding.
1715
+ if (this.catalogPresentation.active) {
1716
+ cancelAnimationFrame(this.renderRequestId);
1717
+ this.renderRequestId = 0;
1718
+ }
1290
1719
  // After the transition's external clock stops, optional refinement resumes its own RAF.
1291
- if (!this.catalogPresentation.active && (this.animationActive || this.renderInvalidated))
1720
+ else if (this.animationActive || this.renderInvalidated)
1292
1721
  this.scheduleRender();
1293
1722
  }
1294
1723
  finishCatalogGeometry() {
1724
+ this.stagedSceneCacheOwner = undefined;
1725
+ this.presentation.invalidateSceneEndpoints();
1726
+ this.stagedAwaitingFirstFrame = false;
1727
+ this.stagedDetailTarget = undefined;
1728
+ this.releaseStagedSensorHold?.();
1729
+ this.releaseStagedSensorHold = undefined;
1730
+ this.catalogLayer?.finishStagedPanel();
1295
1731
  this.releaseSpatialCapture();
1296
1732
  this.adoptedForward = false;
1297
1733
  this.returnSpatialElement = undefined;
@@ -1368,7 +1804,7 @@ export class StageExperience {
1368
1804
  this.panelUiFocus = getStageUiFocus(this.panelFocus);
1369
1805
  this.minimapFocus = getSequencedMinimapFocus(this.panelFocus, this.panelUiFocus);
1370
1806
  this.layoutDirty = true;
1371
- this.lastInteractionTime = performance.now();
1807
+ this.lastFrameTime = performance.now();
1372
1808
  this.requestRender();
1373
1809
  }
1374
1810
  /** Applies the camera/target dolly produced by a real SpaceMouse zoom transaction. */
@@ -1406,6 +1842,26 @@ export class StageExperience {
1406
1842
  stopVisualTestSpaceMouseMotion() {
1407
1843
  this.setSpaceMouseMoving(false);
1408
1844
  }
1845
+ /** Projects a registered panel surface for frame-by-frame DOM/GPU alignment checks. */
1846
+ getVisualTestPanelRect(frame) {
1847
+ const index = this.panelTargets.findIndex((target) => target.frame === frame);
1848
+ const panel = this.panelRuntimes[index];
1849
+ if (!panel || !panel.group.visible)
1850
+ return null;
1851
+ panel.group.updateWorldMatrix(true, false);
1852
+ this.panelCamera.updateMatrixWorld(true);
1853
+ const { width, height } = panel.options;
1854
+ const points = [
1855
+ new THREE.Vector3(-width / 2, height / 2, 0),
1856
+ new THREE.Vector3(width / 2, height / 2, 0),
1857
+ new THREE.Vector3(width / 2, -height / 2, 0),
1858
+ new THREE.Vector3(-width / 2, -height / 2, 0)
1859
+ ].map((corner) => panel.group.localToWorld(corner).project(this.panelCamera));
1860
+ const xs = points.map((point) => (point.x + 1) * window.innerWidth / 2);
1861
+ const ys = points.map((point) => (1 - point.y) * window.innerHeight / 2);
1862
+ const x = Math.min(...xs), y = Math.min(...ys);
1863
+ return { x, y, width: Math.max(...xs) - x, height: Math.max(...ys) - y };
1864
+ }
1409
1865
  /** Returns the live rendered minimap bounds rather than its hidden DOM fallback bounds. */
1410
1866
  getVisualTestMinimapRect() {
1411
1867
  const minimap = this.minimaps.values().next().value;
@@ -1434,6 +1890,14 @@ export class StageExperience {
1434
1890
  height: Math.max(...yCoordinates) - top
1435
1891
  };
1436
1892
  }
1893
+ /** Returns the bound renderer's projection for query-gated handoff regressions. */
1894
+ getVisualTestDetailProjection(kind) {
1895
+ // Forward ownership releases SpatialGeometryCapture at progress one. Read
1896
+ // its actual successor instead of expecting a final retained-capture frame.
1897
+ if (kind === 'dock')
1898
+ return this.getDockProjection(true)?.clip.toArray() ?? null;
1899
+ return this.model ? captureSpatialElementProjection(this.model, this.camera).clip.toArray() : null;
1900
+ }
1437
1901
  /** Returns the main element's projected bounds for query-gated layout regressions. */
1438
1902
  getVisualTestModelRect() {
1439
1903
  if (!this.model || this.modelBounds.isEmpty())
@@ -1456,6 +1920,15 @@ export class StageExperience {
1456
1920
  const minimap = this.minimaps.values().next().value;
1457
1921
  return minimap ? this.getProjectedMinimapModelRect(minimap) : null;
1458
1922
  }
1923
+ /** Returns the visible viewport mask in minimap-local pixels. */
1924
+ getVisualTestMinimapViewportRect() {
1925
+ const minimap = this.minimaps.values().next().value;
1926
+ if (!minimap)
1927
+ return null;
1928
+ const center = minimap.overlayViewportCenter.value;
1929
+ const halfSize = minimap.overlayViewportHalfSize.value;
1930
+ return { x: center.x - halfSize.x, y: center.y - halfSize.y, width: halfSize.x * 2, height: halfSize.y * 2 };
1931
+ }
1459
1932
  /** Returns minimap orientation endpoints for query-gated browser regressions. */
1460
1933
  getVisualTestMinimapOrientation() {
1461
1934
  const minimap = this.minimaps.values().next().value;
@@ -1490,7 +1963,25 @@ export class StageExperience {
1490
1963
  }
1491
1964
  /** Returns Low-band and glass-compositor counters without scheduling rendering. */
1492
1965
  getCarouselStats() {
1493
- return this.catalogLayer?.getStats() ?? null;
1966
+ return this.catalogLayer?.getStats(this.renderer, this.pipeline.peekCatalogWarmOutputContext()) ?? null;
1967
+ }
1968
+ /** Query-gated snapshot: no new frame state, DOM measurements, scheduling or settling. */
1969
+ getVisualTestRenderActivity() {
1970
+ const preparation = this.preparation?.current;
1971
+ const assets = this.assets.getStats();
1972
+ return { at: performance.now(), lastFrameAt: this.lastFrameTime,
1973
+ animationActive: this.animationActive, catalogAnimating: this.catalogLayerAnimating,
1974
+ renderInvalidated: this.renderInvalidated, pendingRenderFrame: this.renderRequestId !== 0,
1975
+ pendingScrollFrame: hasPendingStageScrollFrame(), scrollActive: this.scrollActive,
1976
+ stagedAwaitingFirstFrame: this.stagedAwaitingFirstFrame,
1977
+ transitionActive: this.catalogPresentation.active,
1978
+ preparation: { stagedIdlePending: this.stagedPreparationIdle !== 0,
1979
+ zoomFramePending: this.zoomPreparationFrame !== 0, zoomDeferred: this.deferredZoomPreparation,
1980
+ gate: this.preparationGate.getActivity(), detailGate: this.detailPreparationGate.getActivity(),
1981
+ background: preparation?.backgroundState ?? null, high: preparation?.highState ?? null,
1982
+ assetLoads: assets.pendingLoads, activeInstances: assets.activeInstances },
1983
+ catalog: this.catalogLayer?.getRenderActivity() ?? null,
1984
+ panels: this.panels.getRenderActivity() };
1494
1985
  }
1495
1986
  /** Returns render-target lifecycle counters for query-gated performance tests. */
1496
1987
  getVisualTestRenderTargetStats() {
@@ -1516,10 +2007,14 @@ export class StageExperience {
1516
2007
  });
1517
2008
  return {
1518
2009
  ...inventory,
2010
+ pixelRatio: this.pipeline.getFullPixelRatio(),
2011
+ renderSettings: this.pipeline.getRenderSettings(),
1519
2012
  canvases: this.pipeline.getCanvasOutputs(),
1520
2013
  creations: this.pipeline.renderTargetSetCreations,
1521
2014
  resizes: this.pipeline.renderTargetSetResizes,
1522
2015
  warmups: this.pipeline.renderTargetSetWarmups,
2016
+ inactiveScrollWarmups: this.pipeline.deferredScrollWarmups,
2017
+ backgroundOutput: this.pipeline.getBackgroundOutputStats(),
1523
2018
  activeScale: this.pipeline.activeRenderTargets?.scale ?? 0
1524
2019
  };
1525
2020
  }
@@ -1549,7 +2044,7 @@ export class StageExperience {
1549
2044
  advanceVisualTestFrames(frames = 12) {
1550
2045
  const frameCount = THREE.MathUtils.clamp(Math.floor(frames), 1, 120);
1551
2046
  for (let index = 0; index < frameCount; index += 1) {
1552
- this.lastInteractionTime = performance.now() - 1000 / 60;
2047
+ this.lastFrameTime = performance.now() - 1000 / 60;
1553
2048
  this.renderFrame(true);
1554
2049
  }
1555
2050
  }
@@ -1582,7 +2077,7 @@ export class StageExperience {
1582
2077
  this.scheduleRender();
1583
2078
  }
1584
2079
  scheduleRender() {
1585
- if (this.disposed || document.hidden || this.renderRequestId)
2080
+ if (this.disposed || document.hidden || this.renderRequestId || this.stagedAwaitingFirstFrame)
1586
2081
  return;
1587
2082
  this.renderRequestId = requestAnimationFrame(this.render);
1588
2083
  }
@@ -1619,6 +2114,9 @@ export class StageExperience {
1619
2114
  element.style.pointerEvents = 'none';
1620
2115
  }
1621
2116
  async loadEnvironment() {
2117
+ // A content page without any spatial elements has no environment to load.
2118
+ if (!this.hdr)
2119
+ return;
1622
2120
  const token = this.pageBinding.token;
1623
2121
  const lease = this.environments.acquire(this.hdr);
1624
2122
  try {
@@ -1632,6 +2130,7 @@ export class StageExperience {
1632
2130
  }
1633
2131
  }
1634
2132
  applyEnvironment(environment) {
2133
+ this.appliedEnvironment = environment;
1635
2134
  this.presentation.retainEnvironment(this.environments, environment);
1636
2135
  this.environmentTarget = environment.target;
1637
2136
  const texture = environment.target.texture;
@@ -1806,23 +2305,20 @@ export class StageExperience {
1806
2305
  if (this.referenceBounds)
1807
2306
  bounds.copy(this.referenceBounds);
1808
2307
  this.modelBounds.copy(bounds);
1809
- const sphere = bounds.getBoundingSphere(new THREE.Sphere());
1810
- const radius = Math.max(sphere.radius, 1);
1811
- this.modelRadius = radius;
1812
- const orbitDirection = getCameraOrbitDirection(this.cameraSettings.azimuth, this.cameraSettings.elevation);
1813
2308
  this.updateViewportFrame();
1814
2309
  this.camera.aspect = window.innerWidth / window.innerHeight;
1815
2310
  this.camera.updateProjectionMatrix();
1816
- const fitDistance = this.getSpatialElementCameraFitDistance(bounds, orbitDirection);
1817
- const maxDistance = Math.max(fitDistance, radius * 0.6);
2311
+ const fit = detailCameraFit(bounds, this.camera, this.cameraSettings, { width: window.innerWidth, height: window.innerHeight }, { width: this.viewportLayoutSize.x, height: this.viewportLayoutSize.y });
2312
+ const { radius, center, distance: maxDistance } = fit;
2313
+ this.modelRadius = radius;
1818
2314
  this.rememberFittedViewportMetrics();
1819
- this.camera.position.copy(sphere.center).addScaledVector(orbitDirection, maxDistance);
1820
- this.camera.near = Math.max(maxDistance / 100, 0.01);
1821
- this.camera.far = Math.max(maxDistance * 100, radius * 20);
2315
+ this.camera.position.copy(center).addScaledVector(fit.direction, maxDistance);
2316
+ this.camera.near = fit.near;
2317
+ this.camera.far = fit.far;
1822
2318
  this.camera.updateProjectionMatrix();
1823
2319
  const focusRange = getZoomFocusDistanceRange(maxDistance, radius);
1824
2320
  this.interaction.setFocusRange(focusRange.restDistance, focusRange.closeDistance);
1825
- this.controls?.target.copy(sphere.center);
2321
+ this.controls?.target.copy(center);
1826
2322
  if (this.controls) {
1827
2323
  this.controls.minDistance = this.focusCloseDistance * 0.64;
1828
2324
  this.controls.maxDistance = maxDistance;
@@ -1834,6 +2330,16 @@ export class StageExperience {
1834
2330
  this.model.getWorldQuaternion(this.initialModelWorldQuaternion);
1835
2331
  }
1836
2332
  }
2333
+ /** Connect only after the host or visitor explicitly enables the local driver. */
2334
+ setSpaceMouseEnabled(enabled) {
2335
+ if (this.disposed || this.spaceMouseEnabled === enabled)
2336
+ return;
2337
+ this.spaceMouseEnabled = enabled;
2338
+ if (enabled)
2339
+ void this.initializeSpaceMouse();
2340
+ else
2341
+ this.interaction.disconnectSpaceMouse();
2342
+ }
1837
2343
  initializeSpaceMouse() {
1838
2344
  return this.interaction.initializeSpaceMouse();
1839
2345
  }
@@ -1856,18 +2362,7 @@ export class StageExperience {
1856
2362
  this.interaction.setPickTargets(model, (mesh) => this.isInteractionMesh(mesh));
1857
2363
  }
1858
2364
  isInteractionMesh(mesh) {
1859
- if (!this.isSpatialElementMesh(mesh))
1860
- return false;
1861
- if (this.interactionTheme.excludeMesh?.(mesh))
1862
- return false;
1863
- if (mesh.userData.stagePick === false || mesh.userData.stageOutline === false)
1864
- return false;
1865
- const materialNames = getMeshMaterials(mesh)
1866
- .map((material) => material.name)
1867
- .filter(Boolean)
1868
- .join(' ');
1869
- const label = `${mesh.name} ${materialNames}`.toLowerCase();
1870
- return !/(shadow|ground|floor|plane|helper|collision|collider|reflection)/i.test(label);
2365
+ return this.isSpatialElementMesh(mesh) && isOutlineMesh(mesh, this.interactionTheme);
1871
2366
  }
1872
2367
  createPanels() {
1873
2368
  if (!this.pipeline.activeRenderTargets &&
@@ -1911,11 +2406,17 @@ export class StageExperience {
1911
2406
  options: panel.options,
1912
2407
  pointerLift: 0,
1913
2408
  pointerReactive: target.pointerReactive ?? true,
2409
+ focusReactive: target.focusReactive ?? true,
1914
2410
  projectionRoot,
1915
2411
  surface: target.surface
1916
2412
  });
1917
2413
  this.panelScene.add(projectionRoot ?? panel.group);
1918
- this.attachPanelContent(target.content, index, target.contentInset);
2414
+ if (target.nativeContent) {
2415
+ // Draw floating glass above regular panels; its content stays in the top layer.
2416
+ panel.group.renderOrder = 100;
2417
+ }
2418
+ else
2419
+ this.attachPanelContent(target.content, index, target.contentInset);
1919
2420
  }
1920
2421
  else {
1921
2422
  const options = resolveLiquidGlassPanelOptions(measuredOptions);
@@ -1930,18 +2431,21 @@ export class StageExperience {
1930
2431
  options,
1931
2432
  pointerLift: 0,
1932
2433
  pointerReactive: target.pointerReactive ?? true,
2434
+ focusReactive: target.focusReactive ?? true,
1933
2435
  projectionRoot,
1934
2436
  surface: target.surface
1935
2437
  });
1936
2438
  if (projectionRoot)
1937
2439
  this.panelScene.add(projectionRoot);
1938
- this.attachPanelSurface(target.surfaceElement, index, Boolean(target.minimap));
2440
+ if (!target.nativeContent)
2441
+ this.attachPanelSurface(target.surfaceElement, index, Boolean(target.minimap));
1939
2442
  }
1940
2443
  this.createMinimap(index, target.minimap);
1941
2444
  const panel = this.panelRuntimes[index];
1942
2445
  const group = target.frame.dataset.catalogTransitionGroup;
1943
2446
  panel.transitionGroup = group === 'enter' || group === 'shared' ? group : undefined;
1944
- panel.glass?.setVisibilityAlpha(this.getPanelTransitionOpacity(panel) * (target.getSurfaceOpacity?.() ?? 1));
2447
+ panel.glass?.setVisibilityAlpha(this.getPanelTransitionOpacity(panel) * (target.getSurfaceOpacity?.() ?? 1) *
2448
+ (target.getVisible?.() === false ? 0 : 1));
1945
2449
  const minimap = this.minimaps.get(index);
1946
2450
  if (minimap) {
1947
2451
  this.updateMinimapOverlayVisibility(minimap);
@@ -1967,55 +2471,79 @@ export class StageExperience {
1967
2471
  return;
1968
2472
  this.layoutDirty = false;
1969
2473
  const measurePanels = force || this.panelMeasurementsDirty;
1970
- this.panelTargets.forEach((target, index) => {
1971
- const runtime = this.panelRuntimes[index];
1972
- if (!runtime)
1973
- return;
1974
- const options = this.getMeasuredPanelOptions(target, measurePanels);
1975
- const geometryChanged = hasPanelGeometryChanged(runtime.options, options);
1976
- if (geometryChanged && runtime.glass && target.minimap) {
1977
- this.replacePanel(index, options);
1978
- }
1979
- else {
1980
- if (geometryChanged) {
1981
- const radius = options.radius ?? runtime.options.radius;
1982
- runtime.glass?.setVisualSize(options.width, options.height, radius);
1983
- runtime.options.width = options.width;
1984
- runtime.options.height = options.height;
1985
- runtime.options.radius = radius;
1986
- }
1987
- }
1988
- const currentRuntime = this.panelRuntimes[index];
1989
- if (!currentRuntime)
1990
- return;
1991
- currentRuntime.options.position.x = options.position.x;
1992
- currentRuntime.options.position.y = options.position.y;
1993
- if (currentRuntime.projectionRoot) {
1994
- currentRuntime.group.position.set(0, 0, 0);
1995
- this.setPanelProjectionTransform(currentRuntime.projectionRoot, options.position.x, options.position.y, 0);
1996
- }
1997
- else {
1998
- currentRuntime.group.position.set(options.position.x, options.position.y, 0);
2474
+ this.panelTargets.forEach((target, index) => this.syncPanelLayout(target, index, measurePanels));
2475
+ this.panelMeasurementsDirty = false;
2476
+ }
2477
+ syncPanelLayout(target, index, measurePanels) {
2478
+ const runtime = this.panelRuntimes[index];
2479
+ if (!runtime)
2480
+ return;
2481
+ // Preserve the last popup mesh while closed instead of resizing it to a 1px box.
2482
+ if (target.nativeContent && target.getVisible?.() === false)
2483
+ return;
2484
+ const options = this.getMeasuredPanelOptions(target, measurePanels);
2485
+ const geometryChanged = hasPanelGeometryChanged(runtime.options, options);
2486
+ if (geometryChanged && runtime.glass && target.minimap) {
2487
+ this.replacePanel(index, options);
2488
+ }
2489
+ else {
2490
+ if (geometryChanged) {
2491
+ const radius = options.radius ?? runtime.options.radius;
2492
+ runtime.glass?.setVisualSize(options.width, options.height, radius);
2493
+ runtime.options.width = options.width;
2494
+ runtime.options.height = options.height;
2495
+ runtime.options.radius = radius;
1999
2496
  }
2497
+ }
2498
+ const currentRuntime = this.panelRuntimes[index];
2499
+ if (!currentRuntime)
2500
+ return;
2501
+ currentRuntime.options.position.x = options.position.x;
2502
+ currentRuntime.options.position.y = options.position.y;
2503
+ if (currentRuntime.projectionRoot) {
2504
+ currentRuntime.group.position.set(0, 0, 0);
2505
+ this.setPanelProjectionTransform(currentRuntime.projectionRoot, options.position.x, options.position.y, 0);
2506
+ }
2507
+ else {
2508
+ currentRuntime.group.position.set(options.position.x, options.position.y, 0);
2509
+ }
2510
+ // Intrinsic DOM sizing and native popover layout remain owned by the adapter.
2511
+ if (!target.nativeContent) {
2000
2512
  if (currentRuntime.surface === 'glass') {
2001
2513
  this.updateContentElement(target.content, currentRuntime, target.contentInset);
2002
2514
  }
2003
2515
  else {
2004
2516
  this.updateSurfaceElement(target.surfaceElement, currentRuntime, currentRuntime.options.width, currentRuntime.options.height, Boolean(target.minimap));
2005
2517
  }
2006
- if (currentRuntime.content) {
2007
- if (currentRuntime.contentProjectionRoot) {
2008
- currentRuntime.content.position.set(0, 0, 0);
2009
- this.setPanelProjectionTransform(currentRuntime.contentProjectionRoot, currentRuntime.options.position.x, currentRuntime.options.position.y, PANEL_CONTENT_Z);
2010
- }
2011
- else {
2012
- currentRuntime.content.position.set(currentRuntime.options.position.x, currentRuntime.options.position.y, PANEL_CONTENT_Z);
2013
- }
2518
+ }
2519
+ if (currentRuntime.content) {
2520
+ if (currentRuntime.contentProjectionRoot) {
2521
+ currentRuntime.content.position.set(0, 0, 0);
2522
+ this.setPanelProjectionTransform(currentRuntime.contentProjectionRoot, currentRuntime.options.position.x, currentRuntime.options.position.y, PANEL_CONTENT_Z);
2523
+ }
2524
+ else {
2525
+ currentRuntime.content.position.set(currentRuntime.options.position.x, currentRuntime.options.position.y, PANEL_CONTENT_Z);
2014
2526
  }
2015
- if (geometryChanged && target.minimap)
2016
- this.createMinimap(index, target.minimap);
2527
+ }
2528
+ if (geometryChanged && target.minimap)
2529
+ this.createMinimap(index, target.minimap);
2530
+ }
2531
+ /** Commit anchor DOM positions and dependent native surfaces in one render transaction. */
2532
+ renderPanelContents() {
2533
+ this.cssRenderer.render(this.panelContentScene, this.panelCamera);
2534
+ this.renderFlatPanelSurfaces();
2535
+ this.panelTargets.forEach((target, index) => {
2536
+ if (!target.nativeContent || !target.updateNativeLayout || target.getVisible?.() === false)
2537
+ return;
2538
+ target.updateNativeLayout();
2539
+ // Only positioned popovers need a second layout pass after their anchor's
2540
+ // DOM projection. Static shell panels already received their focus pose;
2541
+ // resetting their projection here detached glass from the moving content.
2542
+ this.syncPanelLayout(target, index, true);
2543
+ const runtime = this.panelRuntimes[index];
2544
+ if (runtime)
2545
+ runtime.group.visible = this.isPanelTargetVisible(index);
2017
2546
  });
2018
- this.panelMeasurementsDirty = false;
2019
2547
  }
2020
2548
  replacePanel(index, options) {
2021
2549
  if (!this.pipeline.activeRenderTargets)
@@ -2043,7 +2571,7 @@ export class StageExperience {
2043
2571
  getMeasuredPanelOptions(target, forceMeasurement = false) {
2044
2572
  let cachedRect = this.pageBinding.getPanelRect(target.frame);
2045
2573
  if (!cachedRect || forceMeasurement) {
2046
- cachedRect = this.measureStageRect(target.frame);
2574
+ cachedRect = this.pageBinding.measurePanel(target, this.currentScrollX, this.currentScrollY);
2047
2575
  this.pageBinding.setPanelRect(target.frame, cachedRect);
2048
2576
  }
2049
2577
  const rect = this.resolveStageRect(cachedRect);
@@ -2066,14 +2594,22 @@ export class StageExperience {
2066
2594
  const target = this.panelTargets[index];
2067
2595
  if (!target)
2068
2596
  return true;
2597
+ if (!this.detailMediaActive && target.frame.closest('[data-spatial-model-controls]'))
2598
+ return false;
2599
+ if (target.getVisible?.() === false)
2600
+ return false;
2601
+ if (this.fullscreen)
2602
+ return Boolean(target.minimap || target.focusReactive === 'top-right' ||
2603
+ target.content.hasAttribute('data-stage-fullscreen-visible'));
2069
2604
  const cachedRect = this.pageBinding.getPanelRect(target.frame);
2070
2605
  if (!cachedRect)
2071
2606
  return true;
2072
2607
  return isViewportRectVisible(this.resolveStageRect(cachedRect), window.innerWidth, window.innerHeight, VIEWPORT_CULL_MARGIN);
2073
2608
  }
2074
- resizeRenderer() {
2609
+ resizeRenderer(invalidate = true) {
2075
2610
  const width = window.innerWidth;
2076
2611
  const height = window.innerHeight;
2612
+ this.rendererSize.set(width, height);
2077
2613
  this.panelMeasurementsDirty = true;
2078
2614
  this.viewportMeasurementDirty = true;
2079
2615
  this.pipeline.resizeRenderTargets();
@@ -2094,7 +2630,8 @@ export class StageExperience {
2094
2630
  this.nativePanelLayer.style.height = `${height}px`;
2095
2631
  this.layoutDirty = true;
2096
2632
  this.syncPanelLayouts(true);
2097
- this.requestRender();
2633
+ if (invalidate)
2634
+ this.requestRender();
2098
2635
  }
2099
2636
  /**
2100
2637
  * Forces WebGPU to allocate and bind both quality levels before input starts.
@@ -2106,7 +2643,7 @@ export class StageExperience {
2106
2643
  const width = window.innerWidth;
2107
2644
  const height = window.innerHeight;
2108
2645
  const element = this.viewportTarget?.element;
2109
- if (!element) {
2646
+ if (!element || this.fullscreen) {
2110
2647
  this.stageViewportVisible = true;
2111
2648
  this.viewportFrame.set(0, 0, width, height);
2112
2649
  this.viewportLayoutSize.set(width, height);
@@ -2133,19 +2670,8 @@ export class StageExperience {
2133
2670
  const frameHeight = Math.max(bottom - top, 1);
2134
2671
  this.viewportFrame.set(left, top, frameWidth, frameHeight);
2135
2672
  }
2136
- getViewportScale() {
2137
- const width = Math.max(window.innerWidth, 1);
2138
- const height = Math.max(window.innerHeight, 1);
2139
- const maximumPadding = Math.max(Math.min(this.viewportLayoutSize.x, this.viewportLayoutSize.y) * 0.5 - 1, 0);
2140
- const padding = THREE.MathUtils.clamp(this.cameraSettings.fitPadding ?? 0, 0, maximumPadding);
2141
- return {
2142
- x: THREE.MathUtils.clamp((this.viewportLayoutSize.x - padding * 2) / width, 0.08, 1),
2143
- y: THREE.MathUtils.clamp((this.viewportLayoutSize.y - padding * 2) / height, 0.08, 1)
2144
- };
2145
- }
2146
2673
  getSpatialElementCameraFitDistance(bounds, viewDirection) {
2147
- const fitScale = THREE.MathUtils.clamp(this.cameraSettings.fitScale ?? 1, 0.2, 4);
2148
- return (getCameraFitDistance(bounds, viewDirection, this.camera, SPATIAL_ELEMENT_CAMERA_FIT_MARGIN, this.getViewportScale()) / fitScale);
2674
+ return detailCameraFitDistance(bounds, viewDirection, this.camera, this.cameraSettings, { width: window.innerWidth, height: window.innerHeight }, { width: this.viewportLayoutSize.x, height: this.viewportLayoutSize.y });
2149
2675
  }
2150
2676
  rememberFittedViewportMetrics() {
2151
2677
  this.fittedViewportMetrics.set(window.innerWidth, window.innerHeight, this.viewportLayoutSize.x, this.viewportLayoutSize.y);
@@ -2226,6 +2752,7 @@ export class StageExperience {
2226
2752
  handleScrollFrame(frame) {
2227
2753
  if (this.disposed)
2228
2754
  return;
2755
+ pauseDeviceOrientationForScroll();
2229
2756
  this.currentScrollX = frame.scrollX;
2230
2757
  this.currentScrollY = frame.scrollY;
2231
2758
  if (this.renderRequestId)
@@ -2308,8 +2835,20 @@ export class StageExperience {
2308
2835
  return this.panels.renderFlatPanelSurfaces();
2309
2836
  }
2310
2837
  renderFrame(force = false) {
2838
+ if (this.disposed)
2839
+ return;
2840
+ if (!force && this.stagedAwaitingFirstFrame)
2841
+ return;
2842
+ if (!this.disposed && (this.rendererSize.x !== window.innerWidth || this.rendererSize.y !== window.innerHeight))
2843
+ this.resizeRenderer(false);
2311
2844
  const renderTargets = this.pipeline.activeRenderTargets;
2312
2845
  const listOnly = this.catalog && !this.viewportTarget;
2846
+ if (this.deviceOrientationEnabled && this.detailMediaActive && !listOnly && this.model && !this.releaseDeviceOrientation)
2847
+ this.releaseDeviceOrientation = retainListDeviceOrientation(this.container, () => { });
2848
+ else if ((listOnly || !this.detailMediaActive) && this.releaseDeviceOrientation) {
2849
+ this.releaseDeviceOrientation();
2850
+ this.releaseDeviceOrientation = undefined;
2851
+ }
2313
2852
  if (this.disposed || (!listOnly && (!renderTargets || !this.pipeline.stageDisplayQuad)))
2314
2853
  return;
2315
2854
  if (!force && document.hidden)
@@ -2320,9 +2859,9 @@ export class StageExperience {
2320
2859
  this.renderer.setCanvasTarget(this.backgroundCanvasTarget);
2321
2860
  this.renderer.setClearColor(0xffffff, 1);
2322
2861
  const now = performance.now();
2323
- const delta = Math.min((now - this.lastInteractionTime) / 1000, 0.05);
2862
+ const delta = Math.min((now - this.lastFrameTime) / 1000, 0.05);
2324
2863
  this.advancePreparedPage(now);
2325
- this.lastInteractionTime = now;
2864
+ this.lastFrameTime = now;
2326
2865
  this.backgroundCanvas.style.visibility = '';
2327
2866
  this.catalogLayerAnimating =
2328
2867
  this.catalogLayer?.update(this.renderer, this.scene.environment, now) ?? false;
@@ -2336,9 +2875,9 @@ export class StageExperience {
2336
2875
  this.syncPanelLayouts();
2337
2876
  const panelsAnimating = this.updatePanelPointerInteraction(delta);
2338
2877
  const domAnimating = this.updatePanelDomRenderModes();
2878
+ this.renderPanelContents();
2339
2879
  this.pipeline.renderFrame(true, false);
2340
- this.cssRenderer.render(this.panelContentScene, this.panelCamera);
2341
- this.renderFlatPanelSurfaces();
2880
+ this.scheduleStagedPreparation();
2342
2881
  this.animationActive = this.catalogLayerAnimating || panelsAnimating || domAnimating;
2343
2882
  if (!force && (this.animationActive || this.renderInvalidated))
2344
2883
  this.scheduleRender();
@@ -2347,11 +2886,17 @@ export class StageExperience {
2347
2886
  if (!renderTargets)
2348
2887
  return;
2349
2888
  const { controls: controlsAnimating, wheel: wheelZoomAnimating } = this.interaction.advance(now, delta);
2889
+ let deviceAnimating = false;
2890
+ if (this.deviceOrientationEnabled && this.detailMediaActive && this.model?.parent === this.scene && !this.catalogHandoff && !this.spatialCapture) {
2891
+ if (!isDeviceOrientationPaused())
2892
+ deviceAnimating = this.deviceMotion.update(getListDeviceYaw(), getListDevicePitch(), getListDeviceRoll(), delta);
2893
+ this.deviceMotion.apply(this.model, this.camera, this.initialControlsTarget);
2894
+ }
2350
2895
  // The damped camera distance is the single animation clock for geometry and
2351
2896
  // every close-up UI phase. Phase remapping remains, temporal lag does not.
2352
- this.panelFocus = this.getZoomFocusFactor();
2353
- this.panelUiFocus = getStageUiFocus(this.panelFocus);
2354
- this.minimapFocus = getSequencedMinimapFocus(this.panelFocus, this.panelUiFocus);
2897
+ this.panelFocus = this.detailMediaActive ? this.getZoomFocusFactor() : 0;
2898
+ this.panelUiFocus = this.fullscreen ? 1 : getStageUiFocus(this.panelFocus);
2899
+ this.minimapFocus = this.fullscreen ? 1 : getSequencedMinimapFocus(this.panelFocus, this.panelUiFocus);
2355
2900
  this.updateStageCameraProjection();
2356
2901
  this.reportZoomFocus({
2357
2902
  focus: this.panelFocus,
@@ -2362,13 +2907,14 @@ export class StageExperience {
2362
2907
  this.syncPanelLayouts();
2363
2908
  const panelsAnimating = this.updatePanelPointerInteraction(delta);
2364
2909
  const panelDomModeAnimating = this.updatePanelDomRenderModes();
2910
+ this.renderPanelContents();
2365
2911
  this.pipeline.renderFrame(false, !this.scrollActive && !this.catalogHandoff);
2366
- this.cssRenderer.render(this.panelContentScene, this.panelCamera);
2367
- this.renderFlatPanelSurfaces();
2912
+ this.scheduleStagedPreparation();
2368
2913
  this.animationActive =
2369
- this.presentation.readiness.animating ||
2914
+ deviceAnimating ||
2915
+ (this.detailMediaActive && this.presentation.readiness.animating) ||
2370
2916
  this.catalogLayerAnimating ||
2371
- (this.stageViewportVisible &&
2917
+ (this.detailMediaActive && this.stageViewportVisible &&
2372
2918
  (!this.catalogHandoff || this.catalogMotionComplete) &&
2373
2919
  Boolean(this.refinement)) ||
2374
2920
  this.spaceMouseMoving ||
@@ -2385,13 +2931,14 @@ export class StageExperience {
2385
2931
  /** Draws only spatial UI into the transparent canvas above the page DOM. */
2386
2932
  /** Renders every glass surface below the DOM while preserving minimap screen projection. */
2387
2933
  renderStage() {
2388
- if (this.stageViewportVisible &&
2934
+ if (this.detailMediaActive && this.stageViewportVisible &&
2389
2935
  (!this.catalogHandoff || this.catalogMotionComplete) &&
2390
2936
  this.pageModelReady &&
2391
2937
  this.presentation.renderRefinement(this.renderer, this.scene, this.pagePreparation?.environment.value?.target.texture, () => this.pipeline.renderStageContents(), (model, outline) => {
2392
2938
  this.collectModelPickTargets(model);
2393
2939
  this.pipeline.createModelOutline(outline);
2394
- }, window.matchMedia('(prefers-reduced-motion: reduce)').matches))
2940
+ }, window.matchMedia('(prefers-reduced-motion: reduce)').matches, { backgroundReveal: this.catalogBackgroundReveal.value,
2941
+ advanceClock: !(this.stagedRevealPreparing && this.stagedRevealPreparing === this.stagedSceneCacheOwner) }))
2395
2942
  return;
2396
2943
  this.pipeline.renderStageContents();
2397
2944
  }