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

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 (367) 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 +2 -0
  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 +143 -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 +4 -2
  47. package/dist/catalog/CatalogTransition.d.ts.map +1 -1
  48. package/dist/catalog/CatalogTransition.js +206 -90
  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 +10 -25
  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 +17 -0
  145. package/dist/catalog/listDeviceOrientation.d.ts.map +1 -0
  146. package/dist/catalog/listDeviceOrientation.js +262 -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 +22 -10
  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 +34 -0
  188. package/dist/spatial-element/messages.d.ts.map +1 -0
  189. package/dist/spatial-element/messages.js +34 -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 +46 -5
  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 +57 -66
  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/SpatialElementInteractionController.d.ts +19 -1
  259. package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -1
  260. package/dist/stage/SpatialElementInteractionController.js +134 -13
  261. package/dist/stage/SpatialElementInteractionController.js.map +1 -1
  262. package/dist/stage/SpatialElementPresentationController.d.ts +14 -2
  263. package/dist/stage/SpatialElementPresentationController.d.ts.map +1 -1
  264. package/dist/stage/SpatialElementPresentationController.js +47 -2
  265. package/dist/stage/SpatialElementPresentationController.js.map +1 -1
  266. package/dist/stage/SpatialElementRefinement.d.ts +34 -1
  267. package/dist/stage/SpatialElementRefinement.d.ts.map +1 -1
  268. package/dist/stage/SpatialElementRefinement.js +175 -37
  269. package/dist/stage/SpatialElementRefinement.js.map +1 -1
  270. package/dist/stage/StageExperience.d.ts +263 -10
  271. package/dist/stage/StageExperience.d.ts.map +1 -1
  272. package/dist/stage/StageExperience.js +655 -124
  273. package/dist/stage/StageExperience.js.map +1 -1
  274. package/dist/stage/StageFullscreenController.d.ts +17 -0
  275. package/dist/stage/StageFullscreenController.d.ts.map +1 -0
  276. package/dist/stage/StageFullscreenController.js +90 -0
  277. package/dist/stage/StageFullscreenController.js.map +1 -0
  278. package/dist/stage/StagePanelRuntime.d.ts +2 -1
  279. package/dist/stage/StagePanelRuntime.d.ts.map +1 -1
  280. package/dist/stage/StagePanelRuntime.js.map +1 -1
  281. package/dist/stage/StageRenderPipeline.d.ts +90 -2
  282. package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
  283. package/dist/stage/StageRenderPipeline.js +494 -119
  284. package/dist/stage/StageRenderPipeline.js.map +1 -1
  285. package/dist/stage/VirtualScrollController.d.ts +7 -0
  286. package/dist/stage/VirtualScrollController.d.ts.map +1 -1
  287. package/dist/stage/VirtualScrollController.js +63 -6
  288. package/dist/stage/VirtualScrollController.js.map +1 -1
  289. package/dist/stage/inertLease.d.ts +2 -0
  290. package/dist/stage/inertLease.d.ts.map +1 -0
  291. package/dist/stage/inertLease.js +18 -0
  292. package/dist/stage/inertLease.js.map +1 -0
  293. package/dist/stage/interactionGuidance.d.ts +22 -0
  294. package/dist/stage/interactionGuidance.d.ts.map +1 -0
  295. package/dist/stage/interactionGuidance.js +53 -0
  296. package/dist/stage/interactionGuidance.js.map +1 -0
  297. package/dist/stage/interactionOutline.d.ts +14 -0
  298. package/dist/stage/interactionOutline.d.ts.map +1 -0
  299. package/dist/stage/interactionOutline.js +59 -0
  300. package/dist/stage/interactionOutline.js.map +1 -0
  301. package/dist/stage/minimap/MinimapGeometry.d.ts.map +1 -1
  302. package/dist/stage/minimap/MinimapGeometry.js +29 -0
  303. package/dist/stage/minimap/MinimapGeometry.js.map +1 -1
  304. package/dist/stage/minimap/MinimapModel.d.ts +2 -1
  305. package/dist/stage/minimap/MinimapModel.d.ts.map +1 -1
  306. package/dist/stage/minimap/MinimapModel.js +34 -4
  307. package/dist/stage/minimap/MinimapModel.js.map +1 -1
  308. package/dist/stage/minimap/MinimapModelGeometry.d.ts +21 -0
  309. package/dist/stage/minimap/MinimapModelGeometry.d.ts.map +1 -0
  310. package/dist/stage/minimap/MinimapModelGeometry.js +68 -0
  311. package/dist/stage/minimap/MinimapModelGeometry.js.map +1 -0
  312. package/dist/stage/minimap/MinimapProjection.d.ts +7 -0
  313. package/dist/stage/minimap/MinimapProjection.d.ts.map +1 -1
  314. package/dist/stage/minimap/MinimapProjection.js +14 -13
  315. package/dist/stage/minimap/MinimapProjection.js.map +1 -1
  316. package/dist/stage/minimap/MinimapState.d.ts +3 -8
  317. package/dist/stage/minimap/MinimapState.d.ts.map +1 -1
  318. package/dist/stage/minimap/MinimapState.js.map +1 -1
  319. package/dist/stage/mouseHover.d.ts +9 -0
  320. package/dist/stage/mouseHover.d.ts.map +1 -0
  321. package/dist/stage/mouseHover.js +55 -0
  322. package/dist/stage/mouseHover.js.map +1 -0
  323. package/dist/stage/panelContext.d.ts +27 -2
  324. package/dist/stage/panelContext.d.ts.map +1 -1
  325. package/dist/stage/panelContext.js.map +1 -1
  326. package/dist/stage/renderSettings.d.ts +10 -0
  327. package/dist/stage/renderSettings.d.ts.map +1 -0
  328. package/dist/stage/renderSettings.js +27 -0
  329. package/dist/stage/renderSettings.js.map +1 -0
  330. package/dist/stage/renderTargetInventory.d.ts +1 -1
  331. package/dist/stage/renderTargetInventory.js +1 -1
  332. package/dist/stage/renderTargetInventory.js.map +1 -1
  333. package/dist/stage/rendererState.d.ts +2 -0
  334. package/dist/stage/rendererState.d.ts.map +1 -1
  335. package/dist/stage/rendererState.js +13 -0
  336. package/dist/stage/rendererState.js.map +1 -1
  337. package/dist/stage/sceneEndpointEligibility.d.ts +20 -0
  338. package/dist/stage/sceneEndpointEligibility.d.ts.map +1 -0
  339. package/dist/stage/sceneEndpointEligibility.js +363 -0
  340. package/dist/stage/sceneEndpointEligibility.js.map +1 -0
  341. package/dist/stage/scrollFrame.d.ts +2 -0
  342. package/dist/stage/scrollFrame.d.ts.map +1 -1
  343. package/dist/stage/scrollFrame.js +18 -5
  344. package/dist/stage/scrollFrame.js.map +1 -1
  345. package/dist/stage/spatialElementFrame.d.ts.map +1 -1
  346. package/dist/stage/spatialElementFrame.js +5 -1
  347. package/dist/stage/spatialElementFrame.js.map +1 -1
  348. package/dist/stage/stageConstants.d.ts +3 -3
  349. package/dist/stage/stageConstants.d.ts.map +1 -1
  350. package/dist/stage/stageConstants.js +6 -6
  351. package/dist/stage/stageConstants.js.map +1 -1
  352. package/dist/stage/stageDom.d.ts +2 -0
  353. package/dist/stage/stageDom.d.ts.map +1 -1
  354. package/dist/stage/stageDom.js +10 -1
  355. package/dist/stage/stageDom.js.map +1 -1
  356. package/dist/stage/stageMath.d.ts +9 -10
  357. package/dist/stage/stageMath.d.ts.map +1 -1
  358. package/dist/stage/stageMath.js +23 -21
  359. package/dist/stage/stageMath.js.map +1 -1
  360. package/dist/stage/stageTypes.d.ts +30 -3
  361. package/dist/stage/stageTypes.d.ts.map +1 -1
  362. package/dist/stage/stageTypes.js.map +1 -1
  363. package/dist/stage/stageVisualTest.d.ts +24 -1
  364. package/dist/stage/stageVisualTest.d.ts.map +1 -1
  365. package/dist/stage/stageVisualTest.js.map +1 -1
  366. package/logo.svg +188 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BAAkB;YAClB,eAAe;YACf,eAAe;YACf,kBAAkB;YAClB,kBAAkB;SAClB,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CACjF,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,EAAE,CAAC;IACX,CAAC;AACF,CAAC","sourcesContent":["import type { CatalogViewContext } from './catalogJourney.js';\n\n/** Native anchor enhancement. No routing interception and no GPU state in the URL. */\nexport function catalogViewLink(node: HTMLAnchorElement, context: CatalogViewContext = {}) {\n\tconst update = (value: CatalogViewContext) => {\n\t\tnode.dataset.catalogView = JSON.stringify(value);\n\t};\n\tconst activate = () => node.focus({ preventScroll: true });\n\tupdate(context);\n\tnode.addEventListener('click', activate);\n\treturn {\n\t\tupdate,\n\t\tdestroy() {\n\t\t\tnode.removeEventListener('click', activate);\n\t\t\tdelete node.dataset.catalogView;\n\t\t}\n\t};\n}\n\nexport function readCatalogViewContext(destination: URL): CatalogViewContext {\n\tconst link = document.activeElement?.closest<HTMLAnchorElement>('a[data-catalog-view]');\n\tif (!link || link.href !== destination.href) return {};\n\ttry {\n\t\tconst parsed = JSON.parse(link.dataset.catalogView ?? '{}');\n\t\tif (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return {};\n\t\treturn Object.fromEntries(\n\t\t\t[\n\t\t\t\t'spatialElementId',\n\t\t\t\t'sourceSection',\n\t\t\t\t'targetSection',\n\t\t\t\t'sourceOccurrence',\n\t\t\t\t'targetOccurrence'\n\t\t\t].flatMap((key) => (typeof parsed[key] === 'string' ? [[key, parsed[key]]] : []))\n\t\t);\n\t} catch {\n\t\treturn {};\n\t}\n}\n"]}
1
+ {"version":3,"file":"catalogViewLink.js","sourceRoot":"","sources":["../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,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,OAAO,EAAE,CAAC;QAC9E,MAAM,OAAO,GAAuB,MAAM,CAAC,WAAW,CACrD;YACC,kBAAkB;YAClB,eAAe;YACf,eAAe;YACf,kBAAkB;YAClB,kBAAkB;SAClB,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CACjF,CAAC;QACF,IAAI,MAAM,CAAC,kBAAkB,KAAK,MAAM,IAAI,MAAM,CAAC,kBAAkB,KAAK,MAAM;YAAE,OAAO,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;QACzI,OAAO,OAAO,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,EAAE,CAAC;IACX,CAAC;AACF,CAAC","sourcesContent":["import type { CatalogViewContext } from './catalogJourney.js';\nimport { focusCatalogLink } from './catalogActivationFocus.js';\n\n/** Native anchor enhancement. No routing interception and no GPU state in the URL. */\nexport function catalogViewLink(node: HTMLAnchorElement, context: CatalogViewContext = {}) {\n\tconst update = (value: CatalogViewContext) => {\n\t\tnode.dataset.catalogView = JSON.stringify(value);\n\t};\n\tconst activate = (event: MouseEvent) => focusCatalogLink(node, event);\n\tupdate(context);\n\tnode.addEventListener('click', activate);\n\treturn {\n\t\tupdate,\n\t\tdestroy() {\n\t\t\tnode.removeEventListener('click', activate);\n\t\t\tdelete node.dataset.catalogView;\n\t\t}\n\t};\n}\n\nexport function readCatalogViewContext(destination: URL): CatalogViewContext {\n\tconst link = document.activeElement?.closest<HTMLAnchorElement>('a[data-catalog-view]');\n\treturn readCatalogLinkContext(link, destination);\n}\n\n/** Read the originally activated anchor even after focus/ownership has changed. */\nexport function readCatalogLinkContext(link: HTMLAnchorElement | null | undefined, destination: URL): CatalogViewContext {\n\tif (!link || link.href !== destination.href) return {};\n\ttry {\n\t\tconst parsed = JSON.parse(link.dataset.catalogView ?? '{}');\n\t\tif (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return {};\n\t\tconst context: CatalogViewContext = Object.fromEntries(\n\t\t\t[\n\t\t\t\t'spatialElementId',\n\t\t\t\t'sourceSection',\n\t\t\t\t'targetSection',\n\t\t\t\t'sourceOccurrence',\n\t\t\t\t'targetOccurrence'\n\t\t\t].flatMap((key) => (typeof parsed[key] === 'string' ? [[key, parsed[key]]] : []))\n\t\t);\n\t\tif (parsed.targetPresentation === 'hero' || parsed.targetPresentation === 'dock') context.targetPresentation = parsed.targetPresentation;\n\t\treturn context;\n\t} catch {\n\t\treturn {};\n\t}\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { Quaternion } from 'three/webgpu';
2
+ /** W3C intrinsic Z-X-Y orientation, expressed in the current screen frame. */
3
+ export declare function screenOrientation(alpha: number, beta: number, gamma: number, angle: number): Quaternion;
4
+ /** Bounded screen-relative yaw, pitch and roll, in degrees, without a render loop. */
5
+ export declare class DeviceYawFilter {
6
+ private reference?;
7
+ private previous?;
8
+ private time;
9
+ private quietUntil;
10
+ private filtered;
11
+ private filteredPitch;
12
+ private filteredRoll;
13
+ value: number;
14
+ pitch: number;
15
+ roll: number;
16
+ reset(): void;
17
+ /** Re-anchor to the new grip, retaining output so it can ease back to neutral. */
18
+ resume(q: Quaternion, now: number): void;
19
+ update(q: Quaternion, now: number, smoothingMs?: number): number;
20
+ }
21
+ //# sourceMappingURL=deviceYaw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceYaw.d.ts","sourceRoot":"","sources":["../../src/catalog/deviceYaw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAsB,MAAM,cAAc,CAAC;AAErE,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAI1F;AAED,sFAAsF;AACtF,qBAAa,eAAe;IAC3B,OAAO,CAAC,SAAS,CAAC,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,YAAY,CAAK;IACzB,KAAK,SAAK;IACV,KAAK,SAAK;IACV,IAAI,SAAK;IACT,KAAK;IAML,kFAAkF;IAClF,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM;IAMjC,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,SAAK;CA8CnD"}
@@ -0,0 +1,87 @@
1
+ import { Euler, Quaternion, Vector3, MathUtils } from 'three/webgpu';
2
+ /** W3C intrinsic Z-X-Y orientation, expressed in the current screen frame. */
3
+ export function screenOrientation(alpha, beta, gamma, angle) {
4
+ return new Quaternion().setFromEuler(new Euler(MathUtils.degToRad(beta), MathUtils.degToRad(gamma), MathUtils.degToRad(alpha), 'ZXY')).multiply(new Quaternion().setFromAxisAngle(new Vector3(0, 0, 1), -MathUtils.degToRad(angle)));
5
+ }
6
+ /** Bounded screen-relative yaw, pitch and roll, in degrees, without a render loop. */
7
+ export class DeviceYawFilter {
8
+ reference;
9
+ previous;
10
+ time = 0;
11
+ quietUntil = 0;
12
+ filtered = 0;
13
+ filteredPitch = 0;
14
+ filteredRoll = 0;
15
+ value = 0;
16
+ pitch = 0;
17
+ roll = 0;
18
+ reset() {
19
+ this.reference = this.previous = undefined;
20
+ this.filtered = this.value = 0;
21
+ this.filteredPitch = this.pitch = 0;
22
+ this.filteredRoll = this.roll = 0;
23
+ }
24
+ /** Re-anchor to the new grip, retaining output so it can ease back to neutral. */
25
+ resume(q, now) {
26
+ this.reference = q.clone();
27
+ this.previous = q.clone();
28
+ this.time = now - 16;
29
+ this.quietUntil = 0;
30
+ }
31
+ update(q, now, smoothingMs = 60) {
32
+ const dt = now - this.time;
33
+ if (!this.reference || !this.previous || dt > 1500 || dt <= 0) {
34
+ this.reference = q.clone();
35
+ this.previous = q.clone();
36
+ this.time = now;
37
+ this.quietUntil = now;
38
+ this.filteredPitch = this.pitch = 0;
39
+ this.filteredRoll = this.roll = 0;
40
+ return this.value = this.filtered = 0;
41
+ }
42
+ const step = MathUtils.radToDeg(this.previous.angleTo(q));
43
+ const speed = step / (dt / 1000);
44
+ this.previous.copy(q);
45
+ this.time = now;
46
+ // Re-anchor after abrupt movement; wait for a quiet grip before responding again.
47
+ // Do not mistake an ordinary deliberate turn or a small noisy sample for travel.
48
+ if (speed > 240 && step > 12)
49
+ this.quietUntil = now + 400;
50
+ let target = 0;
51
+ let pitchTarget = 0;
52
+ let rollTarget = 0;
53
+ if (now < this.quietUntil)
54
+ this.reference.copy(q);
55
+ else {
56
+ const relative = this.reference.clone().invert().multiply(q);
57
+ if (relative.w < 0)
58
+ relative.set(-relative.x, -relative.y, -relative.z, -relative.w);
59
+ const yaw = MathUtils.radToDeg(2 * Math.atan2(relative.y, relative.w));
60
+ const pitch = MathUtils.radToDeg(2 * Math.atan2(relative.x, relative.w));
61
+ const roll = MathUtils.radToDeg(2 * Math.atan2(relative.z, relative.w));
62
+ // Preserve a noise floor while making small intentional turns clearly visible.
63
+ target = Math.sign(yaw) * Math.min(16, Math.max(0, Math.abs(yaw) - 1.2) * 0.55);
64
+ pitchTarget = Math.sign(pitch) * Math.min(10, Math.max(0, Math.abs(pitch) - 1.5) * 0.4);
65
+ rollTarget = Math.sign(roll) * Math.min(6, Math.max(0, Math.abs(roll) - 2) * 0.25);
66
+ }
67
+ const blend = 1 - Math.exp(-Math.min(dt, smoothingMs === 60 ? dt : 50) / smoothingMs);
68
+ this.filtered += (target - this.filtered) * blend;
69
+ this.filteredPitch += (pitchTarget - this.filteredPitch) * blend;
70
+ this.filteredRoll += (rollTarget - this.filteredRoll) * blend;
71
+ if (Math.abs(this.filtered) < 0.08 && target === 0)
72
+ this.filtered = 0;
73
+ if (Math.abs(this.filteredPitch) < 0.08 && pitchTarget === 0)
74
+ this.filteredPitch = 0;
75
+ if (Math.abs(this.filteredRoll) < 0.08 && rollTarget === 0)
76
+ this.filteredRoll = 0;
77
+ // Hysteresis, not rounding: noise at a quantization boundary must not wake rendering.
78
+ if (Math.abs(this.filtered - this.value) >= 0.12 || this.filtered === 0)
79
+ this.value = this.filtered;
80
+ if (Math.abs(this.filteredPitch - this.pitch) >= 0.12 || this.filteredPitch === 0)
81
+ this.pitch = this.filteredPitch;
82
+ if (Math.abs(this.filteredRoll - this.roll) >= 0.12 || this.filteredRoll === 0)
83
+ this.roll = this.filteredRoll;
84
+ return this.value;
85
+ }
86
+ }
87
+ //# sourceMappingURL=deviceYaw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceYaw.js","sourceRoot":"","sources":["../../src/catalog/deviceYaw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAErE,8EAA8E;AAC9E,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,IAAY,EAAE,KAAa,EAAE,KAAa;IAC1F,OAAO,IAAI,UAAU,EAAE,CAAC,YAAY,CAAC,IAAI,KAAK,CAC7C,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CACrF,CAAC,CAAC,QAAQ,CAAC,IAAI,UAAU,EAAE,CAAC,gBAAgB,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAA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CAAC,aAAa,CAAC;QACnH,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC;YAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC;QAC9G,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;CACD","sourcesContent":["import { Euler, Quaternion, Vector3, MathUtils } from 'three/webgpu';\n\n/** W3C intrinsic Z-X-Y orientation, expressed in the current screen frame. */\nexport function screenOrientation(alpha: number, beta: number, gamma: number, angle: number) {\n\treturn new Quaternion().setFromEuler(new Euler(\n\t\tMathUtils.degToRad(beta), MathUtils.degToRad(gamma), MathUtils.degToRad(alpha), 'ZXY'\n\t)).multiply(new Quaternion().setFromAxisAngle(new Vector3(0, 0, 1), -MathUtils.degToRad(angle)));\n}\n\n/** Bounded screen-relative yaw, pitch and roll, in degrees, without a render loop. */\nexport class DeviceYawFilter {\n\tprivate reference?: Quaternion;\n\tprivate previous?: Quaternion;\n\tprivate time = 0;\n\tprivate quietUntil = 0;\n\tprivate filtered = 0;\n\tprivate filteredPitch = 0;\n\tprivate filteredRoll = 0;\n\tvalue = 0;\n\tpitch = 0;\n\troll = 0;\n\treset() {\n\t\tthis.reference = this.previous = undefined;\n\t\tthis.filtered = this.value = 0;\n\t\tthis.filteredPitch = this.pitch = 0;\n\t\tthis.filteredRoll = this.roll = 0;\n\t}\n\t/** Re-anchor to the new grip, retaining output so it can ease back to neutral. */\n\tresume(q: Quaternion, now: number) {\n\t\tthis.reference = q.clone();\n\t\tthis.previous = q.clone();\n\t\tthis.time = now - 16;\n\t\tthis.quietUntil = 0;\n\t}\n\tupdate(q: Quaternion, now: number, smoothingMs = 60) {\n\t\tconst dt = now - this.time;\n\t\tif (!this.reference || !this.previous || dt > 1500 || dt <= 0) {\n\t\t\tthis.reference = q.clone();\n\t\t\tthis.previous = q.clone();\n\t\t\tthis.time = now;\n\t\t\tthis.quietUntil = now;\n\t\t\tthis.filteredPitch = this.pitch = 0;\n\t\t\tthis.filteredRoll = this.roll = 0;\n\t\t\treturn this.value = this.filtered = 0;\n\t\t}\n\t\tconst step = MathUtils.radToDeg(this.previous.angleTo(q));\n\t\tconst speed = step / (dt / 1000);\n\t\tthis.previous.copy(q);\n\t\tthis.time = now;\n\t\t// Re-anchor after abrupt movement; wait for a quiet grip before responding again.\n\t\t// Do not mistake an ordinary deliberate turn or a small noisy sample for travel.\n\t\tif (speed > 240 && step > 12) this.quietUntil = now + 400;\n\t\tlet target = 0;\n\t\tlet pitchTarget = 0;\n\t\tlet rollTarget = 0;\n\t\tif (now < this.quietUntil) this.reference.copy(q);\n\t\telse {\n\t\t\tconst relative = this.reference.clone().invert().multiply(q);\n\t\t\tif (relative.w < 0) relative.set(-relative.x, -relative.y, -relative.z, -relative.w);\n\t\t\tconst yaw = MathUtils.radToDeg(2 * Math.atan2(relative.y, relative.w));\n\t\t\tconst pitch = MathUtils.radToDeg(2 * Math.atan2(relative.x, relative.w));\n\t\t\tconst roll = MathUtils.radToDeg(2 * Math.atan2(relative.z, relative.w));\n\t\t\t// Preserve a noise floor while making small intentional turns clearly visible.\n\t\t\ttarget = Math.sign(yaw) * Math.min(16, Math.max(0, Math.abs(yaw) - 1.2) * 0.55);\n\t\t\tpitchTarget = Math.sign(pitch) * Math.min(10, Math.max(0, Math.abs(pitch) - 1.5) * 0.4);\n\t\t\trollTarget = Math.sign(roll) * Math.min(6, Math.max(0, Math.abs(roll) - 2) * 0.25);\n\t\t}\n\t\tconst blend = 1 - Math.exp(-Math.min(dt, smoothingMs === 60 ? dt : 50) / smoothingMs);\n\t\tthis.filtered += (target - this.filtered) * blend;\n\t\tthis.filteredPitch += (pitchTarget - this.filteredPitch) * blend;\n\t\tthis.filteredRoll += (rollTarget - this.filteredRoll) * blend;\n\t\tif (Math.abs(this.filtered) < 0.08 && target === 0) this.filtered = 0;\n\t\tif (Math.abs(this.filteredPitch) < 0.08 && pitchTarget === 0) this.filteredPitch = 0;\n\t\tif (Math.abs(this.filteredRoll) < 0.08 && rollTarget === 0) this.filteredRoll = 0;\n\t\t// Hysteresis, not rounding: noise at a quantization boundary must not wake rendering.\n\t\tif (Math.abs(this.filtered - this.value) >= 0.12 || this.filtered === 0) this.value = this.filtered;\n\t\tif (Math.abs(this.filteredPitch - this.pitch) >= 0.12 || this.filteredPitch === 0) this.pitch = this.filteredPitch;\n\t\tif (Math.abs(this.filteredRoll - this.roll) >= 0.12 || this.filteredRoll === 0) this.roll = this.filteredRoll;\n\t\treturn this.value;\n\t}\n}\n"]}
@@ -0,0 +1,17 @@
1
+ export type OrientationStatus = 'unavailable' | 'permission' | 'active' | 'denied';
2
+ export declare const isDeviceOrientationPaused: () => boolean;
3
+ /** A captured staged source owns its pose; its destination binds to a neutral sensor baseline. */
4
+ export declare function holdDeviceOrientationForTransition(): () => void;
5
+ /** Called by native scrolling and the stage's virtual-scroll frame stream. */
6
+ export declare function pauseDeviceOrientationForScroll(): void;
7
+ export declare const getListDeviceYaw: () => number;
8
+ export declare const getListDevicePitch: () => number;
9
+ export declare const getListDeviceRoll: () => number;
10
+ export declare function subscribeListDeviceYaw(callback: () => void): () => void;
11
+ /** A silent probe can recover existing consent; a prompt requires a navigation click. */
12
+ export declare function requestListDeviceOrientation(fromNavigation?: boolean): Promise<void>;
13
+ /** Mount in the application shell so entry via detail/carousel pages also works. */
14
+ export declare function retainDeviceOrientationPermission(): () => void;
15
+ /** One shared sensor listener for all visible opted-in sections, with complete teardown. */
16
+ export declare function retainListDeviceOrientation(node: HTMLElement, callback: (status: OrientationStatus) => void): () => void;
17
+ //# sourceMappingURL=listDeviceOrientation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listDeviceOrientation.d.ts","sourceRoot":"","sources":["../../src/catalog/listDeviceOrientation.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AA2BnF,eAAO,MAAM,yBAAyB,eAAwG,CAAC;AAE/I,kGAAkG;AAClG,wBAAgB,kCAAkC,eAajD;AAkBD,8EAA8E;AAC9E,wBAAgB,+BAA+B,SAG9C;AAED,eAAO,MAAM,gBAAgB,cAAY,CAAC;AAC1C,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAC9C,eAAO,MAAM,iBAAiB,cAAa,CAAC;AAC5C,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,IAAI,cAG1D;AA4DD,yFAAyF;AACzF,wBAAgB,4BAA4B,CAAC,cAAc,UAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBjF;AAuBD,oFAAoF;AACpF,wBAAgB,iCAAiC,eAShD;AAED,4FAA4F;AAC5F,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,cAoD3G"}
@@ -0,0 +1,262 @@
1
+ import { DeviceYawFilter, screenOrientation } from './deviceYaw.js';
2
+ const listeners = new Set();
3
+ const owners = new Map();
4
+ const visible = new Set();
5
+ const filter = new DeviceYawFilter();
6
+ let status = 'unavailable';
7
+ let yaw = 0;
8
+ let pitch = 0;
9
+ let roll = 0;
10
+ let calibratingUntil = 0;
11
+ let observer;
12
+ let motion;
13
+ let lastSample = -Infinity;
14
+ let screenAngle = 0;
15
+ let listening = false;
16
+ let granted = false;
17
+ let denied = false;
18
+ let permissionPending;
19
+ let probedPermission = false;
20
+ let permissionOwners = 0;
21
+ let hasHeading;
22
+ let scrollUntil = 0;
23
+ let scrollPaused = false;
24
+ let recoverUntil = 0;
25
+ const touchPointers = new Set();
26
+ let touches = 0;
27
+ let transitionHolds = 0;
28
+ export const isDeviceOrientationPaused = () => transitionHolds > 0 || touches > 0 || touchPointers.size > 0 || performance.now() < scrollUntil;
29
+ /** A captured staged source owns its pose; its destination binds to a neutral sensor baseline. */
30
+ export function holdDeviceOrientationForTransition() {
31
+ transitionHolds += 1;
32
+ reset();
33
+ let released = false;
34
+ return () => {
35
+ if (released)
36
+ return;
37
+ released = true;
38
+ transitionHolds = Math.max(transitionHolds - 1, 0);
39
+ if (!transitionHolds) {
40
+ reset();
41
+ pauseDeviceOrientationForScroll();
42
+ }
43
+ };
44
+ }
45
+ function pointerStart(event) {
46
+ if (event.pointerType !== 'touch')
47
+ return;
48
+ touchPointers.add(event.pointerId);
49
+ pauseDeviceOrientationForScroll();
50
+ }
51
+ function pointerEnd(event) {
52
+ if (touchPointers.delete(event.pointerId))
53
+ pauseDeviceOrientationForScroll();
54
+ }
55
+ function touchChange(event) {
56
+ touches = event.touches.length;
57
+ pauseDeviceOrientationForScroll();
58
+ }
59
+ function releaseTouches() {
60
+ touches = 0;
61
+ touchPointers.clear();
62
+ }
63
+ /** Called by native scrolling and the stage's virtual-scroll frame stream. */
64
+ export function pauseDeviceOrientationForScroll() {
65
+ scrollUntil = performance.now() + 160;
66
+ scrollPaused = true;
67
+ }
68
+ export const getListDeviceYaw = () => yaw;
69
+ export const getListDevicePitch = () => pitch;
70
+ export const getListDeviceRoll = () => roll;
71
+ export function subscribeListDeviceYaw(callback) {
72
+ listeners.add(callback);
73
+ return () => { listeners.delete(callback); };
74
+ }
75
+ function publish(value, pitchValue = 0, rollValue = 0) {
76
+ if (value === yaw && pitchValue === pitch && rollValue === roll)
77
+ return;
78
+ yaw = value;
79
+ pitch = pitchValue;
80
+ roll = rollValue;
81
+ for (const callback of listeners)
82
+ callback();
83
+ }
84
+ function reset() {
85
+ filter.reset();
86
+ lastSample = -Infinity;
87
+ publish(0);
88
+ }
89
+ function readScreenAngle() {
90
+ return window.screen.orientation?.angle ?? window.orientation ?? 0;
91
+ }
92
+ function recalibrateScreen() {
93
+ screenAngle = readScreenAngle();
94
+ calibratingUntil = performance.now() + 300;
95
+ reset();
96
+ }
97
+ function sample(event) {
98
+ const now = performance.now();
99
+ // Do not parse, filter, allocate quaternions or invalidate GPU rendering during scrolling.
100
+ if (isDeviceOrientationPaused())
101
+ return;
102
+ const { alpha, beta, gamma } = event;
103
+ if (![beta, gamma].every(value => typeof value === 'number' && Number.isFinite(value))) {
104
+ reset();
105
+ return;
106
+ }
107
+ if (readScreenAngle() !== screenAngle)
108
+ recalibrateScreen();
109
+ // Screen rotation and sensor events can arrive in either order. Let the screen settle.
110
+ if (now < calibratingUntil)
111
+ return;
112
+ if (now - lastSample < 1000 / 60 - 1)
113
+ return;
114
+ lastSample = now;
115
+ // Some sensor/browser combinations expose tilt without a heading. Keep tilt usable.
116
+ const headingAvailable = typeof alpha === 'number' && Number.isFinite(alpha);
117
+ if (hasHeading !== headingAvailable) {
118
+ hasHeading = headingAvailable;
119
+ reset();
120
+ }
121
+ const orientation = screenOrientation(headingAvailable ? alpha : 0, beta, gamma, screenAngle);
122
+ if (scrollPaused) {
123
+ scrollPaused = false;
124
+ filter.resume(orientation, now);
125
+ recoverUntil = now + 700;
126
+ }
127
+ publish(filter.update(orientation, now, now < recoverUntil ? 400 : 60), filter.pitch, filter.roll);
128
+ }
129
+ function sync() {
130
+ // Pointer media queries describe input devices, not sensor availability (e.g. Surface).
131
+ const available = window.isSecureContext && 'DeviceOrientationEvent' in window && !motion?.matches;
132
+ status = !available ? 'unavailable' : granted ? 'active'
133
+ : window.DeviceOrientationEvent.requestPermission ? (denied ? 'denied' : 'permission') : 'active';
134
+ const active = status === 'active' && visible.size > 0 && !document.hidden;
135
+ if (active !== listening) {
136
+ listening = active;
137
+ if (active)
138
+ window.addEventListener('deviceorientation', sample, { passive: true });
139
+ else
140
+ window.removeEventListener('deviceorientation', sample);
141
+ reset();
142
+ }
143
+ for (const callback of owners.values())
144
+ callback(status);
145
+ }
146
+ /** A silent probe can recover existing consent; a prompt requires a navigation click. */
147
+ export function requestListDeviceOrientation(fromNavigation = true) {
148
+ if (granted || denied)
149
+ return Promise.resolve();
150
+ if (permissionPending)
151
+ return permissionPending;
152
+ const attempt = async () => {
153
+ try {
154
+ const permission = window.DeviceOrientationEvent.requestPermission;
155
+ granted = !permission || await permission.call(window.DeviceOrientationEvent) === 'granted';
156
+ denied = !granted;
157
+ }
158
+ catch {
159
+ // NotAllowedError without user activation is not a user denial.
160
+ if (fromNavigation)
161
+ denied = true;
162
+ }
163
+ if (owners.size)
164
+ sync();
165
+ };
166
+ permissionPending = attempt().finally(() => { permissionPending = undefined; });
167
+ return permissionPending;
168
+ }
169
+ function permissionAvailable() {
170
+ return window.isSecureContext && 'DeviceOrientationEvent' in window &&
171
+ !window.matchMedia('(prefers-reduced-motion: reduce)').matches;
172
+ }
173
+ function autoPermission() {
174
+ if (!permissionAvailable() || probedPermission)
175
+ return;
176
+ probedPermission = true;
177
+ void requestListDeviceOrientation(false);
178
+ }
179
+ function navigationPermission(event) {
180
+ if (!event.isTrusted || event.defaultPrevented || event.button !== 0 || event.metaKey ||
181
+ event.ctrlKey || event.shiftKey || event.altKey || !permissionAvailable())
182
+ return;
183
+ const anchor = event.composedPath().find(node => node instanceof HTMLAnchorElement);
184
+ if (!anchor || !anchor.hasAttribute('href') || anchor.hasAttribute('download') ||
185
+ (anchor.target && anchor.target !== '_self'))
186
+ return;
187
+ const destination = new URL(anchor.href, window.location.href);
188
+ if (destination.origin !== window.location.origin || !['http:', 'https:'].includes(destination.protocol))
189
+ return;
190
+ // Invoke synchronously, before the router handles the click; never hold up navigation.
191
+ void requestListDeviceOrientation(true);
192
+ }
193
+ /** Mount in the application shell so entry via detail/carousel pages also works. */
194
+ export function retainDeviceOrientationPermission() {
195
+ const preference = window.matchMedia('(prefers-reduced-motion: reduce)');
196
+ if (permissionOwners++ === 0)
197
+ document.addEventListener('click', navigationPermission, true);
198
+ preference.addEventListener('change', autoPermission);
199
+ autoPermission();
200
+ return () => {
201
+ preference.removeEventListener('change', autoPermission);
202
+ if (--permissionOwners === 0)
203
+ document.removeEventListener('click', navigationPermission, true);
204
+ };
205
+ }
206
+ /** One shared sensor listener for all visible opted-in sections, with complete teardown. */
207
+ export function retainListDeviceOrientation(node, callback) {
208
+ const releasePermission = retainDeviceOrientationPermission();
209
+ owners.set(node, callback);
210
+ if (owners.size === 1) {
211
+ scrollUntil = recoverUntil = 0;
212
+ scrollPaused = false;
213
+ window.addEventListener('scroll', pauseDeviceOrientationForScroll, { passive: true, capture: true });
214
+ window.addEventListener('pointerdown', pointerStart, { passive: true, capture: true });
215
+ window.addEventListener('pointerup', pointerEnd, { passive: true, capture: true });
216
+ window.addEventListener('pointercancel', pointerEnd, { passive: true, capture: true });
217
+ for (const name of ['touchstart', 'touchend', 'touchcancel'])
218
+ window.addEventListener(name, touchChange, { passive: true, capture: true });
219
+ window.addEventListener('blur', releaseTouches);
220
+ screenAngle = readScreenAngle();
221
+ calibratingUntil = 0;
222
+ window.screen.orientation?.addEventListener?.('change', recalibrateScreen);
223
+ window.addEventListener('orientationchange', recalibrateScreen);
224
+ motion = window.matchMedia('(prefers-reduced-motion: reduce)');
225
+ motion.addEventListener('change', sync);
226
+ document.addEventListener('visibilitychange', sync);
227
+ observer = new IntersectionObserver(entries => {
228
+ for (const entry of entries) {
229
+ if (entry.isIntersecting)
230
+ visible.add(entry.target);
231
+ else
232
+ visible.delete(entry.target);
233
+ }
234
+ sync();
235
+ });
236
+ }
237
+ observer.observe(node);
238
+ sync();
239
+ return () => {
240
+ releasePermission();
241
+ observer?.unobserve(node);
242
+ visible.delete(node);
243
+ owners.delete(node);
244
+ if (!owners.size) {
245
+ window.removeEventListener('scroll', pauseDeviceOrientationForScroll, true);
246
+ window.removeEventListener('pointerdown', pointerStart, true);
247
+ window.removeEventListener('pointerup', pointerEnd, true);
248
+ window.removeEventListener('pointercancel', pointerEnd, true);
249
+ for (const name of ['touchstart', 'touchend', 'touchcancel'])
250
+ window.removeEventListener(name, touchChange, true);
251
+ window.removeEventListener('blur', releaseTouches);
252
+ releaseTouches();
253
+ window.screen.orientation?.removeEventListener?.('change', recalibrateScreen);
254
+ window.removeEventListener('orientationchange', recalibrateScreen);
255
+ observer?.disconnect();
256
+ motion?.removeEventListener('change', sync);
257
+ document.removeEventListener('visibilitychange', sync);
258
+ }
259
+ sync();
260
+ };
261
+ }
262
+ //# sourceMappingURL=listDeviceOrientation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listDeviceOrientation.js","sourceRoot":"","sources":["../../src/catalog/listDeviceOrientation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAMpE,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;AACxC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoD,CAAC;AAC3E,MAAM,OAAO,GAAG,IAAI,GAAG,EAAe,CAAC;AACvC,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;AACrC,IAAI,MAAM,GAAsB,aAAa,CAAC;AAC9C,IAAI,GAAG,GAAG,CAAC,CAAC;AACZ,IAAI,KAAK,GAAG,CAAC,CAAC;AACd,IAAI,IAAI,GAAG,CAAC,CAAC;AACb,IAAI,gBAAgB,GAAG,CAAC,CAAC;AACzB,IAAI,QAA0C,CAAC;AAC/C,IAAI,MAAkC,CAAC;AACvC,IAAI,UAAU,GAAG,CAAC,QAAQ,CAAC;AAC3B,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,SAAS,GAAG,KAAK,CAAC;AACtB,IAAI,OAAO,GAAG,KAAK,CAAC;AACpB,IAAI,MAAM,GAAG,KAAK,CAAC;AACnB,IAAI,iBAA4C,CAAC;AACjD,IAAI,gBAAgB,GAAG,KAAK,CAAC;AAC7B,IAAI,gBAAgB,GAAG,CAAC,CAAC;AACzB,IAAI,UAA+B,CAAC;AACpC,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,YAAY,GAAG,KAAK,CAAC;AACzB,IAAI,YAAY,GAAG,CAAC,CAAC;AACrB,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;AACxC,IAAI,OAAO,GAAG,CAAC,CAA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EAAE,IAAI,CAAC,CAAC;YAC9D,KAAK,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE,UAAU,EAAE,aAAa,CAAU;gBACpE,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;YACrD,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;YACnD,cAAc,EAAE,CAAC;YACjB,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,mBAAmB,EAAE,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;YAC9E,MAAM,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;YACnE,QAAQ,EAAE,UAAU,EAAE,CAAC;YACvB,MAAM,EAAE,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC5C,QAAQ,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { DeviceYawFilter, screenOrientation } from './deviceYaw.js';\n\ntype PermissionConstructor = typeof DeviceOrientationEvent & {\n\trequestPermission?: () => Promise<PermissionState>;\n};\nexport type OrientationStatus = 'unavailable' | 'permission' | 'active' | 'denied';\nconst listeners = new Set<() => void>();\nconst owners = new Map<HTMLElement, (status: OrientationStatus) => void>();\nconst visible = new Set<HTMLElement>();\nconst filter = new DeviceYawFilter();\nlet status: OrientationStatus = 'unavailable';\nlet yaw = 0;\nlet pitch = 0;\nlet roll = 0;\nlet calibratingUntil = 0;\nlet observer: IntersectionObserver | undefined;\nlet motion: MediaQueryList | undefined;\nlet lastSample = -Infinity;\nlet screenAngle = 0;\nlet listening = false;\nlet granted = false;\nlet denied = false;\nlet permissionPending: Promise<void> | undefined;\nlet probedPermission = false;\nlet permissionOwners = 0;\nlet hasHeading: boolean | undefined;\nlet scrollUntil = 0;\nlet scrollPaused = false;\nlet recoverUntil = 0;\nconst touchPointers = new Set<number>();\nlet touches = 0;\nlet transitionHolds = 0;\nexport const isDeviceOrientationPaused = () => transitionHolds > 0 || touches > 0 || touchPointers.size > 0 || performance.now() < scrollUntil;\n\n/** A captured staged source owns its pose; its destination binds to a neutral sensor baseline. */\nexport function holdDeviceOrientationForTransition() {\n\ttransitionHolds += 1;\n\treset();\n\tlet released = false;\n\treturn () => {\n\t\tif (released) return;\n\t\treleased = true;\n\t\ttransitionHolds = Math.max(transitionHolds - 1, 0);\n\t\tif (!transitionHolds) {\n\t\t\treset();\n\t\t\tpauseDeviceOrientationForScroll();\n\t\t}\n\t};\n}\nfunction pointerStart(event: PointerEvent) {\n\tif (event.pointerType !== 'touch') return;\n\ttouchPointers.add(event.pointerId);\n\tpauseDeviceOrientationForScroll();\n}\nfunction pointerEnd(event: PointerEvent) {\n\tif (touchPointers.delete(event.pointerId)) pauseDeviceOrientationForScroll();\n}\nfunction touchChange(event: TouchEvent) {\n\ttouches = event.touches.length;\n\tpauseDeviceOrientationForScroll();\n}\nfunction releaseTouches() {\n\ttouches = 0;\n\ttouchPointers.clear();\n}\n\n/** Called by native scrolling and the stage's virtual-scroll frame stream. */\nexport function pauseDeviceOrientationForScroll() {\n\tscrollUntil = performance.now() + 160;\n\tscrollPaused = true;\n}\n\nexport const getListDeviceYaw = () => yaw;\nexport const getListDevicePitch = () => pitch;\nexport const getListDeviceRoll = () => roll;\nexport function subscribeListDeviceYaw(callback: () => void) {\n\tlisteners.add(callback);\n\treturn () => { listeners.delete(callback); };\n}\nfunction publish(value: number, pitchValue = 0, rollValue = 0) {\n\tif (value === yaw && pitchValue === pitch && rollValue === roll) return;\n\tyaw = value;\n\tpitch = pitchValue;\n\troll = rollValue;\n\tfor (const callback of listeners) callback();\n}\nfunction reset() {\n\tfilter.reset();\n\tlastSample = -Infinity;\n\tpublish(0);\n}\nfunction readScreenAngle() {\n\treturn window.screen.orientation?.angle ?? (window as Window & { orientation?: number }).orientation ?? 0;\n}\nfunction recalibrateScreen() {\n\tscreenAngle = readScreenAngle();\n\tcalibratingUntil = performance.now() + 300;\n\treset();\n}\nfunction sample(event: DeviceOrientationEvent) {\n\tconst now = performance.now();\n\t// Do not parse, filter, allocate quaternions or invalidate GPU rendering during scrolling.\n\tif (isDeviceOrientationPaused()) return;\n\tconst { alpha, beta, gamma } = event;\n\tif (![beta, gamma].every(value => typeof value === 'number' && Number.isFinite(value))) {\n\t\treset();\n\t\treturn;\n\t}\n\tif (readScreenAngle() !== screenAngle) recalibrateScreen();\n\t// Screen rotation and sensor events can arrive in either order. Let the screen settle.\n\tif (now < calibratingUntil) return;\n\tif (now - lastSample < 1000 / 60 - 1) return;\n\tlastSample = now;\n\t// Some sensor/browser combinations expose tilt without a heading. Keep tilt usable.\n\tconst headingAvailable = typeof alpha === 'number' && Number.isFinite(alpha);\n\tif (hasHeading !== headingAvailable) { hasHeading = headingAvailable; reset(); }\n\tconst orientation = screenOrientation(headingAvailable ? alpha! : 0, beta!, gamma!, screenAngle);\n\tif (scrollPaused) {\n\t\tscrollPaused = false;\n\t\tfilter.resume(orientation, now);\n\t\trecoverUntil = now + 700;\n\t}\n\tpublish(filter.update(orientation, now, now < recoverUntil ? 400 : 60), filter.pitch, filter.roll);\n}\nfunction sync() {\n\t// Pointer media queries describe input devices, not sensor availability (e.g. Surface).\n\tconst available = window.isSecureContext && 'DeviceOrientationEvent' in window && !motion?.matches;\n\tstatus = !available ? 'unavailable' : granted ? 'active'\n\t\t: (window.DeviceOrientationEvent as PermissionConstructor).requestPermission ? (denied ? 'denied' : 'permission') : 'active';\n\tconst active = status === 'active' && visible.size > 0 && !document.hidden;\n\tif (active !== listening) {\n\t\tlistening = active;\n\t\tif (active) window.addEventListener('deviceorientation', sample, { passive: true });\n\t\telse window.removeEventListener('deviceorientation', sample);\n\t\treset();\n\t}\n\tfor (const callback of owners.values()) callback(status);\n}\n/** A silent probe can recover existing consent; a prompt requires a navigation click. */\nexport function requestListDeviceOrientation(fromNavigation = true): Promise<void> {\n\tif (granted || denied) return Promise.resolve();\n\tif (permissionPending) return permissionPending;\n\tconst attempt = async () => {\n\t\ttry {\n\t\t\tconst permission = (window.DeviceOrientationEvent as PermissionConstructor).requestPermission;\n\t\t\tgranted = !permission || await permission.call(window.DeviceOrientationEvent) === 'granted';\n\t\t\tdenied = !granted;\n\t\t} catch {\n\t\t\t// NotAllowedError without user activation is not a user denial.\n\t\t\tif (fromNavigation) denied = true;\n\t\t}\n\t\tif (owners.size) sync();\n\t};\n\tpermissionPending = attempt().finally(() => { permissionPending = undefined; });\n\treturn permissionPending;\n}\n\nfunction permissionAvailable() {\n\treturn window.isSecureContext && 'DeviceOrientationEvent' in window &&\n\t\t!window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\nfunction autoPermission() {\n\tif (!permissionAvailable() || probedPermission) return;\n\tprobedPermission = true;\n\tvoid requestListDeviceOrientation(false);\n}\nfunction navigationPermission(event: MouseEvent) {\n\tif (!event.isTrusted || event.defaultPrevented || event.button !== 0 || event.metaKey ||\n\t\tevent.ctrlKey || event.shiftKey || event.altKey || !permissionAvailable()) return;\n\tconst anchor = event.composedPath().find(node => node instanceof HTMLAnchorElement) as HTMLAnchorElement | undefined;\n\tif (!anchor || !anchor.hasAttribute('href') || anchor.hasAttribute('download') ||\n\t\t(anchor.target && anchor.target !== '_self')) return;\n\tconst destination = new URL(anchor.href, window.location.href);\n\tif (destination.origin !== window.location.origin || !['http:', 'https:'].includes(destination.protocol)) return;\n\t// Invoke synchronously, before the router handles the click; never hold up navigation.\n\tvoid requestListDeviceOrientation(true);\n}\n\n/** Mount in the application shell so entry via detail/carousel pages also works. */\nexport function retainDeviceOrientationPermission() {\n\tconst preference = window.matchMedia('(prefers-reduced-motion: reduce)');\n\tif (permissionOwners++ === 0) document.addEventListener('click', navigationPermission, true);\n\tpreference.addEventListener('change', autoPermission);\n\tautoPermission();\n\treturn () => {\n\t\tpreference.removeEventListener('change', autoPermission);\n\t\tif (--permissionOwners === 0) document.removeEventListener('click', navigationPermission, true);\n\t};\n}\n\n/** One shared sensor listener for all visible opted-in sections, with complete teardown. */\nexport function retainListDeviceOrientation(node: HTMLElement, callback: (status: OrientationStatus) => void) {\n\tconst releasePermission = retainDeviceOrientationPermission();\n\towners.set(node, callback);\n\tif (owners.size === 1) {\n\t\tscrollUntil = recoverUntil = 0;\n\t\tscrollPaused = false;\n\t\twindow.addEventListener('scroll', pauseDeviceOrientationForScroll, { passive: true, capture: true });\n\t\twindow.addEventListener('pointerdown', pointerStart, { passive: true, capture: true });\n\t\twindow.addEventListener('pointerup', pointerEnd, { passive: true, capture: true });\n\t\twindow.addEventListener('pointercancel', pointerEnd, { passive: true, capture: true });\n\t\tfor (const name of ['touchstart', 'touchend', 'touchcancel'] as const)\n\t\t\twindow.addEventListener(name, touchChange, { passive: true, capture: true });\n\t\twindow.addEventListener('blur', releaseTouches);\n\t\tscreenAngle = readScreenAngle();\n\t\tcalibratingUntil = 0;\n\t\twindow.screen.orientation?.addEventListener?.('change', recalibrateScreen);\n\t\twindow.addEventListener('orientationchange', recalibrateScreen);\n\t\tmotion = window.matchMedia('(prefers-reduced-motion: reduce)');\n\t\tmotion.addEventListener('change', sync);\n\t\tdocument.addEventListener('visibilitychange', sync);\n\t\tobserver = new IntersectionObserver(entries => {\n\t\t\tfor (const entry of entries) {\n\t\t\t\tif (entry.isIntersecting) visible.add(entry.target as HTMLElement);\n\t\t\t\telse visible.delete(entry.target as HTMLElement);\n\t\t\t}\n\t\t\tsync();\n\t\t});\n\t}\n\tobserver!.observe(node);\n\tsync();\n\treturn () => {\n\t\treleasePermission();\n\t\tobserver?.unobserve(node);\n\t\tvisible.delete(node);\n\t\towners.delete(node);\n\t\tif (!owners.size) {\n\t\t\twindow.removeEventListener('scroll', pauseDeviceOrientationForScroll, true);\n\t\t\twindow.removeEventListener('pointerdown', pointerStart, true);\n\t\t\twindow.removeEventListener('pointerup', pointerEnd, true);\n\t\t\twindow.removeEventListener('pointercancel', pointerEnd, true);\n\t\t\tfor (const name of ['touchstart', 'touchend', 'touchcancel'] as const)\n\t\t\t\twindow.removeEventListener(name, touchChange, true);\n\t\t\twindow.removeEventListener('blur', releaseTouches);\n\t\t\treleaseTouches();\n\t\t\twindow.screen.orientation?.removeEventListener?.('change', recalibrateScreen);\n\t\t\twindow.removeEventListener('orientationchange', recalibrateScreen);\n\t\t\tobserver?.disconnect();\n\t\t\tmotion?.removeEventListener('change', sync);\n\t\t\tdocument.removeEventListener('visibilitychange', sync);\n\t\t}\n\t\tsync();\n\t};\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { type SpatialElementLodPair } from './spatialElementLodPair.js';
2
- import type { SpatialStageConfig } from '../spatial-element/types.js';
2
+ import type { SpatialElementScene } from '../spatial-element/spatialElementScene.js';
3
3
  export type SpatialElementLod = 'low' | 'high';
4
4
  export type SpatialElementVector3 = readonly [number, number, number];
5
5
  /** Column-major matrix, acting on homogeneous column vectors. */
@@ -122,7 +122,7 @@ export interface LegacySpatialElementAssetManifest {
122
122
  canonicalBounds: null;
123
123
  poster: SpatialElementPoster | null;
124
124
  metadataGaps: readonly string[];
125
- stage: SpatialStageConfig;
125
+ stage: SpatialElementScene;
126
126
  representations: {
127
127
  low: LegacySpatialElementAssetRepresentation;
128
128
  high: null;
@@ -135,13 +135,13 @@ export interface ProvisionalSpatialElementAssetManifest {
135
135
  spatialElementId: string;
136
136
  canonicalRevision: null;
137
137
  pair: SpatialElementLodPair;
138
- stage: SpatialStageConfig;
138
+ stage: SpatialElementScene;
139
139
  }
140
140
  export type SpatialElementAssetManifest = VerifiedSpatialElementAssetManifest | LegacySpatialElementAssetManifest | ProvisionalSpatialElementAssetManifest;
141
- export declare function createStageSpatialElementAssetManifest(brandId: string, spatialElementId: string, stage: SpatialStageConfig): SpatialElementAssetManifest;
141
+ export declare function createStageSpatialElementAssetManifest(brandId: string, spatialElementId: string, stage: SpatialElementScene): SpatialElementAssetManifest;
142
142
  export declare function getSpatialElementEntityKey(brandId: string, spatialElementId: string): string;
143
143
  export declare function getRepresentationResource(representation: SpatialElementAssetRepresentation | LegacySpatialElementAssetRepresentation): SpatialElementAssetResource;
144
- export declare function createLegacySpatialElementAssetManifest(brandId: string, spatialElementId: string, stage: SpatialStageConfig, poster?: SpatialElementPoster | null): LegacySpatialElementAssetManifest;
144
+ export declare function createLegacySpatialElementAssetManifest(brandId: string, spatialElementId: string, stage: SpatialElementScene, poster?: SpatialElementPoster | null): LegacySpatialElementAssetManifest;
145
145
  export interface SpatialElementEntity {
146
146
  readonly key: string;
147
147
  readonly brandId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"spatialElementAssets.d.ts","sourceRoot":"","sources":["../../src/catalog/spatialElementAssets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,MAAM,CAAC;AAC/C,MAAM,MAAM,qBAAqB,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACtE,iEAAiE;AACjE,MAAM,MAAM,qBAAqB,GAAG,SAAS;IAC5C,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;CACN,CAAC;AAEF,MAAM,WAAW,+BAA+B;IAC/C,QAAQ,EAAE,SAAS,CAAC,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC;IACpD,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,2BAA2B;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;CACvB;AAED,4FAA4F;A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K,EAAE,IAAI;aACX;YACD,IAAI,EAAE,IAAI;SACV;KACD,CAAC;AACH,CAAC;AASD,oFAAoF;AACpF,MAAM,OAAO,yBAAyB;IACpB,QAAQ,GAAG,IAAI,GAAG,EAAgC,CAAC;IAEpE,GAAG,CAAC,OAAe,EAAE,gBAAwB;QAC5C,MAAM,GAAG,GAAG,0BAA0B,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAClE,IAAI,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YAC5D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAChC,CAAC;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED,WAAW,CAAC,QAAqC;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACrE,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,OAAO,MAAM,CAAC;IACf,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACD","sourcesContent":["import { resolveSpatialElementLodPair, type SpatialElementLodPair } from './spatialElementLodPair.js';\nimport type { SpatialStageConfig } from '../spatial-element/types.js';\n\nexport type SpatialElementLod = 'low' | 'high';\nexport type SpatialElementVector3 = readonly [number, number, number];\n/** Column-major matrix, acting on homogeneous column vectors. */\nexport type SpatialElementMatrix4 = readonly [\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber\n];\n\nexport interface SpatialElementAssetRequirements {\n\tdecoders: readonly ('draco' | 'meshopt' | 'ktx2')[];\n\textensions: readonly string[];\n}\n\nexport interface SpatialElementAssetLocation {\n\turl: string;\n\tformat: 'glb' | 'gltf';\n}\n\n/** Immutable resource request; identity is independent of element and presentation role. */\nexport interface SpatialElementAssetResource extends SpatialElementAssetLocation {\n\trevision: string;\n\trequirements?: SpatialElementAssetRequirements;\n}\n\nexport interface SpatialElementAssetCosts {\n\ttransferBytes: number;\n\ttriangleCount: number;\n\tprimitiveCount: number;\n\tmaterialCount: number;\n\tdecodedGeometryBytes: number;\n\testimatedTextureBytes: number;\n\t/** Documents assumptions used for decoded and estimated memory. */\n\tmethod: string;\n}\n\nexport interface SpatialElementProfileReference {\n\tid: string;\n\trevision: string;\n}\n\nexport interface SpatialElementPoster {\n\tsrc: string;\n\talt: string;\n\twidth: number;\n\theight: number;\n}\n\nexport interface SpatialElementAssetRepresentation {\n\trepresentationId: string;\n\tlod: SpatialElementLod;\n\tassetRevision: string;\n\tcanonicalRevision: string;\n\tresource: SpatialElementAssetLocation;\n\trequirements: SpatialElementAssetRequirements;\n\tassetToCanonical: SpatialElementMatrix4;\n\t/** Null selects the entire authored scene; named roots must resolve uniquely. */\n\tspatialElementRoot: string | null;\n\texcludedMeshes: readonly string[];\n\t/** Semantic material roles mapped to representation-specific material names. */\n\tmaterialBindings: Readonly<Record<string, string>>;\n\tcosts: SpatialElementAssetCosts;\n}\n\n/** Verified contract: right-handed, +Y up, +Z front, meters, shared origin/pivot. */\nexport interface VerifiedSpatialElementAssetManifest {\n\tphysicalReference?: {\n\t\tdimensionsMeters: SpatialElementVector3;\n\t\tscope: string;\n\t\tprovenance: string;\n\t\tmeasuredReferenceExtentsMeters: SpatialElementVector3;\n\t\trelativeDeviation: SpatialElementVector3;\n\t\tmaximumRelativeDeviation: number;\n\t};\n\tschemaVersion: 1;\n\tstatus: 'verified';\n\tbrandId: string;\n\tspatialElementId: string;\n\tcanonicalRevision: string;\n\tcanonicalBounds: { min: SpatialElementVector3; max: SpatialElementVector3 };\n\treferencePose: SpatialElementProfileReference;\n\treferenceTarget: SpatialElementVector3;\n\treferenceView: SpatialElementProfileReference;\n\tappearanceProfile: SpatialElementProfileReference;\n\tposter: SpatialElementPoster;\n\trepresentations: {\n\t\tlow: SpatialElementAssetRepresentation & { lod: 'low' };\n\t\thigh: (SpatialElementAssetRepresentation & { lod: 'high' }) | null;\n\t};\n}\n\nexport interface LegacySpatialElementAssetRepresentation {\n\trepresentationId: 'legacy-preview';\n\tlod: 'low';\n\tassetRevision: string;\n\tcanonicalRevision: null;\n\tresource: SpatialElementAssetLocation;\n\trequirements: SpatialElementAssetRequirements;\n\tassetToCanonical: null;\n\tcosts: null;\n}\n\n/** Temporary adapter, explicitly not a physically verified or decimated low asset. */\nexport interface LegacySpatialElementAssetManifest {\n\tschemaVersion: 1;\n\tstatus: 'legacy-unverified';\n\tbrandId: string;\n\tspatialElementId: string;\n\tcanonicalRevision: null;\n\tcanonicalBounds: null;\n\tposter: SpatialElementPoster | null;\n\tmetadataGaps: readonly string[];\n\tstage: SpatialStageConfig;\n\trepresentations: {\n\t\tlow: LegacySpatialElementAssetRepresentation;\n\t\thigh: null;\n\t};\n}\n\nexport interface ProvisionalSpatialElementAssetManifest {\n\tschemaVersion: 1;\n\tstatus: 'provisional-shared-frame';\n\tbrandId: string;\n\tspatialElementId: string;\n\tcanonicalRevision: null;\n\tpair: SpatialElementLodPair;\n\tstage: SpatialStageConfig;\n}\n\nexport type SpatialElementAssetManifest =\n\tVerifiedSpatialElementAssetManifest | LegacySpatialElementAssetManifest | ProvisionalSpatialElementAssetManifest;\n\nexport function createStageSpatialElementAssetManifest(\n\tbrandId: string,\n\tspatialElementId: string,\n\tstage: SpatialStageConfig\n): SpatialElementAssetManifest {\n\tgetSpatialElementEntityKey(brandId, spatialElementId);\n\tif (stage.assetManifest?.brandId === brandId && stage.assetManifest.spatialElementId === spatialElementId)\n\t\treturn stage.assetManifest;\n\tconst pair = resolveSpatialElementLodPair(stage.glb, stage.lodPair);\n\treturn pair\n\t\t? {\n\t\t\t\tschemaVersion: 1,\n\t\t\t\tstatus: 'provisional-shared-frame',\n\t\t\t\tbrandId,\n\t\t\t\tspatialElementId,\n\t\t\t\tcanonicalRevision: null,\n\t\t\t\tpair,\n\t\t\t\tstage\n\t\t\t}\n\t\t: createLegacySpatialElementAssetManifest(brandId, spatialElementId, stage);\n}\n\nexport function getSpatialElementEntityKey(brandId: string, spatialElementId: string) {\n\tif (!brandId || !spatialElementId) throw new Error('SpatialElement identity requires brandId and spatialElementId');\n\treturn JSON.stringify([brandId, spatialElementId]);\n}\n\nexport function getRepresentationResource(\n\trepresentation: SpatialElementAssetRepresentation | LegacySpatialElementAssetRepresentation\n): SpatialElementAssetResource {\n\treturn {\n\t\t...representation.resource,\n\t\trevision: representation.assetRevision,\n\t\trequirements: representation.requirements\n\t};\n}\n\nexport function createLegacySpatialElementAssetManifest(\n\tbrandId: string,\n\tspatialElementId: string,\n\tstage: SpatialStageConfig,\n\tposter: SpatialElementPoster | null = stage.fallbackImage && stage.fallbackImageSize\n\t\t? {\n\t\t\t\tsrc: stage.fallbackImage,\n\t\t\t\talt: `${brandId} ${spatialElementId}`,\n\t\t\t\twidth: stage.fallbackImageSize[0],\n\t\t\t\theight: stage.fallbackImageSize[1]\n\t\t\t}\n\t\t: null\n): LegacySpatialElementAssetManifest {\n\tgetSpatialElementEntityKey(brandId, spatialElementId);\n\treturn {\n\t\tschemaVersion: 1,\n\t\tstatus: 'legacy-unverified',\n\t\tbrandId,\n\t\tspatialElementId,\n\t\tcanonicalRevision: null,\n\t\tcanonicalBounds: null,\n\t\tposter,\n\t\tmetadataGaps: [\n\t\t\t'physical-dimensions',\n\t\t\t'canonical-frame',\n\t\t\t'validated-low-representation',\n\t\t\t'resource-costs',\n\t\t\t...(!poster ? ['spatial-element-poster'] : [])\n\t\t],\n\t\tstage,\n\t\trepresentations: {\n\t\t\tlow: {\n\t\t\t\trepresentationId: 'legacy-preview',\n\t\t\t\tlod: 'low',\n\t\t\t\tassetRevision: 'legacy-unversioned',\n\t\t\t\tcanonicalRevision: null,\n\t\t\t\tresource: { url: stage.glb, format: 'glb' },\n\t\t\t\trequirements: { decoders: ['draco'], extensions: [] },\n\t\t\t\tassetToCanonical: null,\n\t\t\t\tcosts: null\n\t\t\t},\n\t\t\thigh: null\n\t\t}\n\t};\n}\n\nexport interface SpatialElementEntity {\n\treadonly key: string;\n\treadonly brandId: string;\n\treadonly spatialElementId: string;\n\tmanifest: SpatialElementAssetManifest | null;\n}\n\n/** Runtime-owned logical identities survive page and asset-instance replacement. */\nexport class SpatialElementEntityStore {\n\tprivate readonly entities = new Map<string, SpatialElementEntity>();\n\n\tget(brandId: string, spatialElementId: string): SpatialElementEntity {\n\t\tconst key = getSpatialElementEntityKey(brandId, spatialElementId);\n\t\tlet entity = this.entities.get(key);\n\t\tif (!entity) {\n\t\t\tentity = { key, brandId, spatialElementId, manifest: null };\n\t\t\tthis.entities.set(key, entity);\n\t\t}\n\t\treturn entity;\n\t}\n\n\tsetManifest(manifest: SpatialElementAssetManifest) {\n\t\tconst entity = this.get(manifest.brandId, manifest.spatialElementId);\n\t\tentity.manifest = manifest;\n\t\treturn entity;\n\t}\n\n\tclear() {\n\t\tthis.entities.clear();\n\t}\n}\n"]}
1
+ {"version":3,"file":"spatialElementAssets.js","sourceRoot":"","sources":["../../src/catalog/spatialElementAssets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAA8B,MAAM,4BAA4B,CAAC;AAoJtG,MAAM,UAAU,sCAAsC,CACrD,OAAe,EACf,gBAAwB,EACxB,KAA0B;IAE1B,0BAA0B,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IACtD,IAAI,KAAK,CAAC,aAAa,EAAE,OAAO,KAAK,OAAO,IAAI,KAAK,CAAC,aAAa,CAAC,gBAAgB,KAAK,gBAAgB;QACxG,OAAO,KAAK,C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ACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED,WAAW,CAAC,QAAqC;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACrE,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,OAAO,MAAM,CAAC;IACf,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACD","sourcesContent":["import { resolveSpatialElementLodPair, type SpatialElementLodPair } from './spatialElementLodPair.js';\nimport type { SpatialElementScene } from '../spatial-element/spatialElementScene.js';\n\nexport type SpatialElementLod = 'low' | 'high';\nexport type SpatialElementVector3 = readonly [number, number, number];\n/** Column-major matrix, acting on homogeneous column vectors. */\nexport type SpatialElementMatrix4 = readonly [\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber,\n\tnumber\n];\n\nexport interface SpatialElementAssetRequirements {\n\tdecoders: readonly ('draco' | 'meshopt' | 'ktx2')[];\n\textensions: readonly string[];\n}\n\nexport interface SpatialElementAssetLocation {\n\turl: string;\n\tformat: 'glb' | 'gltf';\n}\n\n/** Immutable resource request; identity is independent of element and presentation role. */\nexport interface SpatialElementAssetResource extends SpatialElementAssetLocation {\n\trevision: string;\n\trequirements?: SpatialElementAssetRequirements;\n}\n\nexport interface SpatialElementAssetCosts {\n\ttransferBytes: number;\n\ttriangleCount: number;\n\tprimitiveCount: number;\n\tmaterialCount: number;\n\tdecodedGeometryBytes: number;\n\testimatedTextureBytes: number;\n\t/** Documents assumptions used for decoded and estimated memory. */\n\tmethod: string;\n}\n\nexport interface SpatialElementProfileReference {\n\tid: string;\n\trevision: string;\n}\n\nexport interface SpatialElementPoster {\n\tsrc: string;\n\talt: string;\n\twidth: number;\n\theight: number;\n}\n\nexport interface SpatialElementAssetRepresentation {\n\trepresentationId: string;\n\tlod: SpatialElementLod;\n\tassetRevision: string;\n\tcanonicalRevision: string;\n\tresource: SpatialElementAssetLocation;\n\trequirements: SpatialElementAssetRequirements;\n\tassetToCanonical: SpatialElementMatrix4;\n\t/** Null selects the entire authored scene; named roots must resolve uniquely. */\n\tspatialElementRoot: string | null;\n\texcludedMeshes: readonly string[];\n\t/** Semantic material roles mapped to representation-specific material names. */\n\tmaterialBindings: Readonly<Record<string, string>>;\n\tcosts: SpatialElementAssetCosts;\n}\n\n/** Verified contract: right-handed, +Y up, +Z front, meters, shared origin/pivot. */\nexport interface VerifiedSpatialElementAssetManifest {\n\tphysicalReference?: {\n\t\tdimensionsMeters: SpatialElementVector3;\n\t\tscope: string;\n\t\tprovenance: string;\n\t\tmeasuredReferenceExtentsMeters: SpatialElementVector3;\n\t\trelativeDeviation: SpatialElementVector3;\n\t\tmaximumRelativeDeviation: number;\n\t};\n\tschemaVersion: 1;\n\tstatus: 'verified';\n\tbrandId: string;\n\tspatialElementId: string;\n\tcanonicalRevision: string;\n\tcanonicalBounds: { min: SpatialElementVector3; max: SpatialElementVector3 };\n\treferencePose: SpatialElementProfileReference;\n\treferenceTarget: SpatialElementVector3;\n\treferenceView: SpatialElementProfileReference;\n\tappearanceProfile: SpatialElementProfileReference;\n\tposter: SpatialElementPoster;\n\trepresentations: {\n\t\tlow: SpatialElementAssetRepresentation & { lod: 'low' };\n\t\thigh: (SpatialElementAssetRepresentation & { lod: 'high' }) | null;\n\t};\n}\n\nexport interface LegacySpatialElementAssetRepresentation {\n\trepresentationId: 'legacy-preview';\n\tlod: 'low';\n\tassetRevision: string;\n\tcanonicalRevision: null;\n\tresource: SpatialElementAssetLocation;\n\trequirements: SpatialElementAssetRequirements;\n\tassetToCanonical: null;\n\tcosts: null;\n}\n\n/** Temporary adapter, explicitly not a physically verified or decimated low asset. */\nexport interface LegacySpatialElementAssetManifest {\n\tschemaVersion: 1;\n\tstatus: 'legacy-unverified';\n\tbrandId: string;\n\tspatialElementId: string;\n\tcanonicalRevision: null;\n\tcanonicalBounds: null;\n\tposter: SpatialElementPoster | null;\n\tmetadataGaps: readonly string[];\n\tstage: SpatialElementScene;\n\trepresentations: {\n\t\tlow: LegacySpatialElementAssetRepresentation;\n\t\thigh: null;\n\t};\n}\n\nexport interface ProvisionalSpatialElementAssetManifest {\n\tschemaVersion: 1;\n\tstatus: 'provisional-shared-frame';\n\tbrandId: string;\n\tspatialElementId: string;\n\tcanonicalRevision: null;\n\tpair: SpatialElementLodPair;\n\tstage: SpatialElementScene;\n}\n\nexport type SpatialElementAssetManifest =\n\tVerifiedSpatialElementAssetManifest | LegacySpatialElementAssetManifest | ProvisionalSpatialElementAssetManifest;\n\nexport function createStageSpatialElementAssetManifest(\n\tbrandId: string,\n\tspatialElementId: string,\n\tstage: SpatialElementScene\n): SpatialElementAssetManifest {\n\tgetSpatialElementEntityKey(brandId, spatialElementId);\n\tif (stage.assetManifest?.brandId === brandId && stage.assetManifest.spatialElementId === spatialElementId)\n\t\treturn stage.assetManifest;\n\tconst pair = resolveSpatialElementLodPair(stage.glb, stage.lodPair);\n\treturn pair\n\t\t? {\n\t\t\t\tschemaVersion: 1,\n\t\t\t\tstatus: 'provisional-shared-frame',\n\t\t\t\tbrandId,\n\t\t\t\tspatialElementId,\n\t\t\t\tcanonicalRevision: null,\n\t\t\t\tpair,\n\t\t\t\tstage\n\t\t\t}\n\t\t: createLegacySpatialElementAssetManifest(brandId, spatialElementId, stage);\n}\n\nexport function getSpatialElementEntityKey(brandId: string, spatialElementId: string) {\n\tif (!brandId || !spatialElementId) throw new Error('SpatialElement identity requires brandId and spatialElementId');\n\treturn JSON.stringify([brandId, spatialElementId]);\n}\n\nexport function getRepresentationResource(\n\trepresentation: SpatialElementAssetRepresentation | LegacySpatialElementAssetRepresentation\n): SpatialElementAssetResource {\n\treturn {\n\t\t...representation.resource,\n\t\trevision: representation.assetRevision,\n\t\trequirements: representation.requirements\n\t};\n}\n\nexport function createLegacySpatialElementAssetManifest(\n\tbrandId: string,\n\tspatialElementId: string,\n\tstage: SpatialElementScene,\n\tposter: SpatialElementPoster | null = stage.fallbackImage && stage.fallbackImageSize\n\t\t? {\n\t\t\t\tsrc: stage.fallbackImage,\n\t\t\t\talt: `${brandId} ${spatialElementId}`,\n\t\t\t\twidth: stage.fallbackImageSize[0],\n\t\t\t\theight: stage.fallbackImageSize[1]\n\t\t\t}\n\t\t: null\n): LegacySpatialElementAssetManifest {\n\tgetSpatialElementEntityKey(brandId, spatialElementId);\n\treturn {\n\t\tschemaVersion: 1,\n\t\tstatus: 'legacy-unverified',\n\t\tbrandId,\n\t\tspatialElementId,\n\t\tcanonicalRevision: null,\n\t\tcanonicalBounds: null,\n\t\tposter,\n\t\tmetadataGaps: [\n\t\t\t'physical-dimensions',\n\t\t\t'canonical-frame',\n\t\t\t'validated-low-representation',\n\t\t\t'resource-costs',\n\t\t\t...(!poster ? ['spatial-element-poster'] : [])\n\t\t],\n\t\tstage,\n\t\trepresentations: {\n\t\t\tlow: {\n\t\t\t\trepresentationId: 'legacy-preview',\n\t\t\t\tlod: 'low',\n\t\t\t\tassetRevision: 'legacy-unversioned',\n\t\t\t\tcanonicalRevision: null,\n\t\t\t\tresource: { url: stage.glb, format: 'glb' },\n\t\t\t\trequirements: { decoders: ['draco'], extensions: [] },\n\t\t\t\tassetToCanonical: null,\n\t\t\t\tcosts: null\n\t\t\t},\n\t\t\thigh: null\n\t\t}\n\t};\n}\n\nexport interface SpatialElementEntity {\n\treadonly key: string;\n\treadonly brandId: string;\n\treadonly spatialElementId: string;\n\tmanifest: SpatialElementAssetManifest | null;\n}\n\n/** Runtime-owned logical identities survive page and asset-instance replacement. */\nexport class SpatialElementEntityStore {\n\tprivate readonly entities = new Map<string, SpatialElementEntity>();\n\n\tget(brandId: string, spatialElementId: string): SpatialElementEntity {\n\t\tconst key = getSpatialElementEntityKey(brandId, spatialElementId);\n\t\tlet entity = this.entities.get(key);\n\t\tif (!entity) {\n\t\t\tentity = { key, brandId, spatialElementId, manifest: null };\n\t\t\tthis.entities.set(key, entity);\n\t\t}\n\t\treturn entity;\n\t}\n\n\tsetManifest(manifest: SpatialElementAssetManifest) {\n\t\tconst entity = this.get(manifest.brandId, manifest.spatialElementId);\n\t\tentity.manifest = manifest;\n\t\treturn entity;\n\t}\n\n\tclear() {\n\t\tthis.entities.clear();\n\t}\n}\n"]}
@@ -7,7 +7,8 @@ export interface SpatialElementLodPair {
7
7
  low: SpatialElementAssetResource;
8
8
  high: SpatialElementAssetResource;
9
9
  assetToFrame: SpatialElementMatrix4;
10
- bounds: {
10
+ /** Optional generated bounds; otherwise fit the loaded Low geometry. */
11
+ bounds?: {
11
12
  min: SpatialElementVector3;
12
13
  max: SpatialElementVector3;
13
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"spatialElementLodPair.d.ts","sourceRoot":"","sources":["../../src/catalog/spatialElementLodPair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAE3H,yEAAyE;AACzE,MAAM,WAAW,qBAAqB;IACrC,MAAM,EAAE,0BAA0B,GAAG,0BAA0B,CAAC;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,2BAA2B,CAAC;IACjC,IAAI,EAAE,2BAA2B,CAAC;IAClC,YAAY,EAAE,qBAAqB,CAAC;IACpC,MAAM,EAAE;QAAE,GAAG,EAAE,qBAAqB,CAAC;QAAC,GAAG,EAAE,qBAAqB,CAAA;KAAE,CAAC;CACnE;AAED,+EAA+E;AAC/E,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,qBAAqB,qCAErF"}
1
+ {"version":3,"file":"spatialElementLodPair.d.ts","sourceRoot":"","sources":["../../src/catalog/spatialElementLodPair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAE3H,yEAAyE;AACzE,MAAM,WAAW,qBAAqB;IACrC,MAAM,EAAE,0BAA0B,GAAG,0BAA0B,CAAC;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,2BAA2B,CAAC;IACjC,IAAI,EAAE,2BAA2B,CAAC;IAClC,YAAY,EAAE,qBAAqB,CAAC;IACpC,wEAAwE;IACxE,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,qBAAqB,CAAC;QAAC,GAAG,EAAE,qBAAqB,CAAA;KAAE,CAAC;CACpE;AAED,+EAA+E;AAC/E,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,qBAAqB,qCAErF"}
@@ -1 +1 @@
1
- {"version":3,"file":"spatialElementLodPair.js","sourceRoot":"","sources":["../../src/catalog/spatialElementLodPair.ts"],"names":[],"mappings":"AAaA,+EAA+E;AAC/E,MAAM,UAAU,4BAA4B,CAAC,GAAW,EAAE,IAA4B;IACrF,OAAO,IAAI,EAAE,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC","sourcesContent":["import type { SpatialElementAssetResource, SpatialElementMatrix4, SpatialElementVector3 } from './spatialElementAssets.js';\n\n/** A shared rendering frame does not imply a verified physical scale. */\nexport interface SpatialElementLodPair {\n\tstatus: 'provisional-shared-frame' | 'verified-canonical-frame';\n\trevision: string;\n\tsourceUrl: string;\n\tlow: SpatialElementAssetResource;\n\thigh: SpatialElementAssetResource;\n\tassetToFrame: SpatialElementMatrix4;\n\tbounds: { min: SpatialElementVector3; max: SpatialElementVector3 };\n}\n\n/** Explicit legacy source overrides invalidate the associated pair as well. */\nexport function resolveSpatialElementLodPair(glb: string, pair?: SpatialElementLodPair) {\n\treturn pair?.sourceUrl === glb ? pair : undefined;\n}\n"]}
1
+ {"version":3,"file":"spatialElementLodPair.js","sourceRoot":"","sources":["../../src/catalog/spatialElementLodPair.ts"],"names":[],"mappings":"AAcA,+EAA+E;AAC/E,MAAM,UAAU,4BAA4B,CAAC,GAAW,EAAE,IAA4B;IACrF,OAAO,IAAI,EAAE,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC","sourcesContent":["import type { SpatialElementAssetResource, SpatialElementMatrix4, SpatialElementVector3 } from './spatialElementAssets.js';\n\n/** A shared rendering frame does not imply a verified physical scale. */\nexport interface SpatialElementLodPair {\n\tstatus: 'provisional-shared-frame' | 'verified-canonical-frame';\n\trevision: string;\n\tsourceUrl: string;\n\tlow: SpatialElementAssetResource;\n\thigh: SpatialElementAssetResource;\n\tassetToFrame: SpatialElementMatrix4;\n\t/** Optional generated bounds; otherwise fit the loaded Low geometry. */\n\tbounds?: { min: SpatialElementVector3; max: SpatialElementVector3 };\n}\n\n/** Explicit legacy source overrides invalidate the associated pair as well. */\nexport function resolveSpatialElementLodPair(glb: string, pair?: SpatialElementLodPair) {\n\treturn pair?.sourceUrl === glb ? pair : undefined;\n}\n"]}