@spatial-elements/core 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/README.md +17 -0
- package/dist/catalog/CarouselGlassCompositor.d.ts +24 -0
- package/dist/catalog/CarouselGlassCompositor.d.ts.map +1 -0
- package/dist/catalog/CarouselGlassCompositor.js +132 -0
- package/dist/catalog/CarouselGlassCompositor.js.map +1 -0
- package/dist/catalog/CatalogEndpointRegistry.d.ts +59 -0
- package/dist/catalog/CatalogEndpointRegistry.d.ts.map +1 -0
- package/dist/catalog/CatalogEndpointRegistry.js +187 -0
- package/dist/catalog/CatalogEndpointRegistry.js.map +1 -0
- package/dist/catalog/CatalogGeometryFade.d.ts +12 -0
- package/dist/catalog/CatalogGeometryFade.d.ts.map +1 -0
- package/dist/catalog/CatalogGeometryFade.js +67 -0
- package/dist/catalog/CatalogGeometryFade.js.map +1 -0
- package/dist/catalog/CatalogPreparation.d.ts +40 -0
- package/dist/catalog/CatalogPreparation.d.ts.map +1 -0
- package/dist/catalog/CatalogPreparation.js +141 -0
- package/dist/catalog/CatalogPreparation.js.map +1 -0
- package/dist/catalog/CatalogSections.d.ts +36 -0
- package/dist/catalog/CatalogSections.d.ts.map +1 -0
- package/dist/catalog/CatalogSections.js +51 -0
- package/dist/catalog/CatalogSections.js.map +1 -0
- package/dist/catalog/CatalogSpatialElementLayer.d.ts +149 -0
- package/dist/catalog/CatalogSpatialElementLayer.d.ts.map +1 -0
- package/dist/catalog/CatalogSpatialElementLayer.js +920 -0
- package/dist/catalog/CatalogSpatialElementLayer.js.map +1 -0
- package/dist/catalog/CatalogTransition.d.ts +93 -0
- package/dist/catalog/CatalogTransition.d.ts.map +1 -0
- package/dist/catalog/CatalogTransition.js +1299 -0
- package/dist/catalog/CatalogTransition.js.map +1 -0
- package/dist/catalog/EnvironmentCache.d.ts +30 -0
- package/dist/catalog/EnvironmentCache.d.ts.map +1 -0
- package/dist/catalog/EnvironmentCache.js +128 -0
- package/dist/catalog/EnvironmentCache.js.map +1 -0
- package/dist/catalog/PreparationGate.d.ts +10 -0
- package/dist/catalog/PreparationGate.d.ts.map +1 -0
- package/dist/catalog/PreparationGate.js +66 -0
- package/dist/catalog/PreparationGate.js.map +1 -0
- package/dist/catalog/PresentationLease.d.ts +16 -0
- package/dist/catalog/PresentationLease.d.ts.map +1 -0
- package/dist/catalog/PresentationLease.js +33 -0
- package/dist/catalog/PresentationLease.js.map +1 -0
- package/dist/catalog/SpatialGeometryCapture.d.ts +63 -0
- package/dist/catalog/SpatialGeometryCapture.d.ts.map +1 -0
- package/dist/catalog/SpatialGeometryCapture.js +158 -0
- package/dist/catalog/SpatialGeometryCapture.js.map +1 -0
- package/dist/catalog/assets/SpatialElementAssetManager.d.ts +92 -0
- package/dist/catalog/assets/SpatialElementAssetManager.d.ts.map +1 -0
- package/dist/catalog/assets/SpatialElementAssetManager.js +305 -0
- package/dist/catalog/assets/SpatialElementAssetManager.js.map +1 -0
- package/dist/catalog/assets/assetCosts.d.ts +4 -0
- package/dist/catalog/assets/assetCosts.d.ts.map +1 -0
- package/dist/catalog/assets/assetCosts.js +33 -0
- package/dist/catalog/assets/assetCosts.js.map +1 -0
- package/dist/catalog/assets/spatialElementAssetResources.d.ts +25 -0
- package/dist/catalog/assets/spatialElementAssetResources.d.ts.map +1 -0
- package/dist/catalog/assets/spatialElementAssetResources.js +100 -0
- package/dist/catalog/assets/spatialElementAssetResources.js.map +1 -0
- package/dist/catalog/carouselPanelProjection.d.ts +9 -0
- package/dist/catalog/carouselPanelProjection.d.ts.map +1 -0
- package/dist/catalog/carouselPanelProjection.js +33 -0
- package/dist/catalog/carouselPanelProjection.js.map +1 -0
- package/dist/catalog/carouselSelection.d.ts +7 -0
- package/dist/catalog/carouselSelection.d.ts.map +1 -0
- package/dist/catalog/carouselSelection.js +15 -0
- package/dist/catalog/carouselSelection.js.map +1 -0
- package/dist/catalog/catalogAction.d.ts +4 -0
- package/dist/catalog/catalogAction.d.ts.map +1 -0
- package/dist/catalog/catalogAction.js +9 -0
- package/dist/catalog/catalogAction.js.map +1 -0
- package/dist/catalog/catalogGeometryRequest.d.ts +13 -0
- package/dist/catalog/catalogGeometryRequest.d.ts.map +1 -0
- package/dist/catalog/catalogGeometryRequest.js +8 -0
- package/dist/catalog/catalogGeometryRequest.js.map +1 -0
- package/dist/catalog/catalogItems.d.ts +10 -0
- package/dist/catalog/catalogItems.d.ts.map +1 -0
- package/dist/catalog/catalogItems.js +23 -0
- package/dist/catalog/catalogItems.js.map +1 -0
- package/dist/catalog/catalogJourney.d.ts +38 -0
- package/dist/catalog/catalogJourney.d.ts.map +1 -0
- package/dist/catalog/catalogJourney.js +64 -0
- package/dist/catalog/catalogJourney.js.map +1 -0
- package/dist/catalog/catalogPage.d.ts +11 -0
- package/dist/catalog/catalogPage.d.ts.map +1 -0
- package/dist/catalog/catalogPage.js +2 -0
- package/dist/catalog/catalogPage.js.map +1 -0
- package/dist/catalog/catalogPose.d.ts +30 -0
- package/dist/catalog/catalogPose.d.ts.map +1 -0
- package/dist/catalog/catalogPose.js +35 -0
- package/dist/catalog/catalogPose.js.map +1 -0
- package/dist/catalog/catalogPresentation.d.ts +24 -0
- package/dist/catalog/catalogPresentation.d.ts.map +1 -0
- package/dist/catalog/catalogPresentation.js +56 -0
- package/dist/catalog/catalogPresentation.js.map +1 -0
- package/dist/catalog/catalogRecipes.d.ts +21 -0
- package/dist/catalog/catalogRecipes.d.ts.map +1 -0
- package/dist/catalog/catalogRecipes.js +84 -0
- package/dist/catalog/catalogRecipes.js.map +1 -0
- package/dist/catalog/catalogSurfaceCapture.d.ts +11 -0
- package/dist/catalog/catalogSurfaceCapture.d.ts.map +1 -0
- package/dist/catalog/catalogSurfaceCapture.js +11 -0
- package/dist/catalog/catalogSurfaceCapture.js.map +1 -0
- package/dist/catalog/catalogViewLink.d.ts +8 -0
- package/dist/catalog/catalogViewLink.d.ts.map +1 -0
- package/dist/catalog/catalogViewLink.js +37 -0
- package/dist/catalog/catalogViewLink.js.map +1 -0
- package/dist/catalog/rebasePresentation.d.ts +3 -0
- package/dist/catalog/rebasePresentation.d.ts.map +1 -0
- package/dist/catalog/rebasePresentation.js +26 -0
- package/dist/catalog/rebasePresentation.js.map +1 -0
- package/dist/catalog/spatialElementAssets.d.ts +158 -0
- package/dist/catalog/spatialElementAssets.d.ts.map +1 -0
- package/dist/catalog/spatialElementAssets.js +92 -0
- package/dist/catalog/spatialElementAssets.js.map +1 -0
- package/dist/catalog/spatialElementLodPair.d.ts +17 -0
- package/dist/catalog/spatialElementLodPair.d.ts.map +1 -0
- package/dist/catalog/spatialElementLodPair.js +5 -0
- package/dist/catalog/spatialElementLodPair.js.map +1 -0
- package/dist/catalog/transitionTiming.d.ts +15 -0
- package/dist/catalog/transitionTiming.d.ts.map +1 -0
- package/dist/catalog/transitionTiming.js +22 -0
- package/dist/catalog/transitionTiming.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/spatial-element/SpatialElementDockController.d.ts +101 -0
- package/dist/spatial-element/SpatialElementDockController.d.ts.map +1 -0
- package/dist/spatial-element/SpatialElementDockController.js +627 -0
- package/dist/spatial-element/SpatialElementDockController.js.map +1 -0
- package/dist/spatial-element/spatialElement.d.ts +28 -0
- package/dist/spatial-element/spatialElement.d.ts.map +1 -0
- package/dist/spatial-element/spatialElement.js +45 -0
- package/dist/spatial-element/spatialElement.js.map +1 -0
- package/dist/spatial-element/spatialElementDock.d.ts +43 -0
- package/dist/spatial-element/spatialElementDock.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementDock.js +126 -0
- package/dist/spatial-element/spatialElementDock.js.map +1 -0
- package/dist/spatial-element/spatialElementSectionRegistry.d.ts +29 -0
- package/dist/spatial-element/spatialElementSectionRegistry.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementSectionRegistry.js +67 -0
- package/dist/spatial-element/spatialElementSectionRegistry.js.map +1 -0
- package/dist/spatial-element/types.d.ts +165 -0
- package/dist/spatial-element/types.d.ts.map +1 -0
- package/dist/spatial-element/types.js +2 -0
- package/dist/spatial-element/types.js.map +1 -0
- package/dist/stage/LiquidGlassPanel.d.ts +55 -0
- package/dist/stage/LiquidGlassPanel.d.ts.map +1 -0
- package/dist/stage/LiquidGlassPanel.js +447 -0
- package/dist/stage/LiquidGlassPanel.js.map +1 -0
- package/dist/stage/MinimapBlurPipeline.d.ts +34 -0
- package/dist/stage/MinimapBlurPipeline.d.ts.map +1 -0
- package/dist/stage/MinimapBlurPipeline.js +147 -0
- package/dist/stage/MinimapBlurPipeline.js.map +1 -0
- package/dist/stage/MinimapController.d.ts +113 -0
- package/dist/stage/MinimapController.d.ts.map +1 -0
- package/dist/stage/MinimapController.js +803 -0
- package/dist/stage/MinimapController.js.map +1 -0
- package/dist/stage/OrbitControlsInterop.d.ts +8 -0
- package/dist/stage/OrbitControlsInterop.d.ts.map +1 -0
- package/dist/stage/OrbitControlsInterop.js +19 -0
- package/dist/stage/OrbitControlsInterop.js.map +1 -0
- package/dist/stage/PageBindingController.d.ts +41 -0
- package/dist/stage/PageBindingController.d.ts.map +1 -0
- package/dist/stage/PageBindingController.js +92 -0
- package/dist/stage/PageBindingController.js.map +1 -0
- package/dist/stage/PanelPresentationController.d.ts +92 -0
- package/dist/stage/PanelPresentationController.d.ts.map +1 -0
- package/dist/stage/PanelPresentationController.js +569 -0
- package/dist/stage/PanelPresentationController.js.map +1 -0
- package/dist/stage/PresentationReadiness.d.ts +30 -0
- package/dist/stage/PresentationReadiness.d.ts.map +1 -0
- package/dist/stage/PresentationReadiness.js +94 -0
- package/dist/stage/PresentationReadiness.js.map +1 -0
- package/dist/stage/SpaceMouseAdapter.d.ts +76 -0
- package/dist/stage/SpaceMouseAdapter.d.ts.map +1 -0
- package/dist/stage/SpaceMouseAdapter.js +197 -0
- package/dist/stage/SpaceMouseAdapter.js.map +1 -0
- package/dist/stage/SpatialElementInteractionController.d.ts +126 -0
- package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -0
- package/dist/stage/SpatialElementInteractionController.js +581 -0
- package/dist/stage/SpatialElementInteractionController.js.map +1 -0
- package/dist/stage/SpatialElementPresentationController.d.ts +82 -0
- package/dist/stage/SpatialElementPresentationController.d.ts.map +1 -0
- package/dist/stage/SpatialElementPresentationController.js +372 -0
- package/dist/stage/SpatialElementPresentationController.js.map +1 -0
- package/dist/stage/SpatialElementRefinement.d.ts +26 -0
- package/dist/stage/SpatialElementRefinement.d.ts.map +1 -0
- package/dist/stage/SpatialElementRefinement.js +105 -0
- package/dist/stage/SpatialElementRefinement.js.map +1 -0
- package/dist/stage/StageExperience.d.ts +536 -0
- package/dist/stage/StageExperience.d.ts.map +1 -0
- package/dist/stage/StageExperience.js +2399 -0
- package/dist/stage/StageExperience.js.map +1 -0
- package/dist/stage/StagePanelLayout.d.ts +15 -0
- package/dist/stage/StagePanelLayout.d.ts.map +1 -0
- package/dist/stage/StagePanelLayout.js +20 -0
- package/dist/stage/StagePanelLayout.js.map +1 -0
- package/dist/stage/StagePanelRuntime.d.ts +20 -0
- package/dist/stage/StagePanelRuntime.d.ts.map +1 -0
- package/dist/stage/StagePanelRuntime.js +2 -0
- package/dist/stage/StagePanelRuntime.js.map +1 -0
- package/dist/stage/StageRenderPipeline.d.ts +179 -0
- package/dist/stage/StageRenderPipeline.d.ts.map +1 -0
- package/dist/stage/StageRenderPipeline.js +901 -0
- package/dist/stage/StageRenderPipeline.js.map +1 -0
- package/dist/stage/VirtualScrollController.d.ts +64 -0
- package/dist/stage/VirtualScrollController.d.ts.map +1 -0
- package/dist/stage/VirtualScrollController.js +329 -0
- package/dist/stage/VirtualScrollController.js.map +1 -0
- package/dist/stage/cssProjection.d.ts +18 -0
- package/dist/stage/cssProjection.d.ts.map +1 -0
- package/dist/stage/cssProjection.js +52 -0
- package/dist/stage/cssProjection.js.map +1 -0
- package/dist/stage/damping.d.ts +3 -0
- package/dist/stage/damping.d.ts.map +1 -0
- package/dist/stage/damping.js +8 -0
- package/dist/stage/damping.js.map +1 -0
- package/dist/stage/minimap/MinimapGeometry.d.ts +31 -0
- package/dist/stage/minimap/MinimapGeometry.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapGeometry.js +163 -0
- package/dist/stage/minimap/MinimapGeometry.js.map +1 -0
- package/dist/stage/minimap/MinimapModel.d.ts +16 -0
- package/dist/stage/minimap/MinimapModel.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapModel.js +51 -0
- package/dist/stage/minimap/MinimapModel.js.map +1 -0
- package/dist/stage/minimap/MinimapProjection.d.ts +41 -0
- package/dist/stage/minimap/MinimapProjection.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapProjection.js +113 -0
- package/dist/stage/minimap/MinimapProjection.js.map +1 -0
- package/dist/stage/minimap/MinimapState.d.ts +102 -0
- package/dist/stage/minimap/MinimapState.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapState.js +2 -0
- package/dist/stage/minimap/MinimapState.js.map +1 -0
- package/dist/stage/minimapMeasurement.d.ts +5 -0
- package/dist/stage/minimapMeasurement.d.ts.map +1 -0
- package/dist/stage/minimapMeasurement.js +11 -0
- package/dist/stage/minimapMeasurement.js.map +1 -0
- package/dist/stage/panelContext.d.ts +71 -0
- package/dist/stage/panelContext.d.ts.map +1 -0
- package/dist/stage/panelContext.js +6 -0
- package/dist/stage/panelContext.js.map +1 -0
- package/dist/stage/panelShadow.d.ts +20 -0
- package/dist/stage/panelShadow.d.ts.map +1 -0
- package/dist/stage/panelShadow.js +22 -0
- package/dist/stage/panelShadow.js.map +1 -0
- package/dist/stage/renderMeasurement.d.ts +3 -0
- package/dist/stage/renderMeasurement.d.ts.map +1 -0
- package/dist/stage/renderMeasurement.js +19 -0
- package/dist/stage/renderMeasurement.js.map +1 -0
- package/dist/stage/renderTargetInventory.d.ts +17 -0
- package/dist/stage/renderTargetInventory.d.ts.map +1 -0
- package/dist/stage/renderTargetInventory.js +27 -0
- package/dist/stage/renderTargetInventory.js.map +1 -0
- package/dist/stage/rendererState.d.ts +14 -0
- package/dist/stage/rendererState.d.ts.map +1 -0
- package/dist/stage/rendererState.js +35 -0
- package/dist/stage/rendererState.js.map +1 -0
- package/dist/stage/resolveStageProfile.d.ts +44 -0
- package/dist/stage/resolveStageProfile.d.ts.map +1 -0
- package/dist/stage/resolveStageProfile.js +30 -0
- package/dist/stage/resolveStageProfile.js.map +1 -0
- package/dist/stage/scrollAnimation.d.ts +10 -0
- package/dist/stage/scrollAnimation.d.ts.map +1 -0
- package/dist/stage/scrollAnimation.js +11 -0
- package/dist/stage/scrollAnimation.js.map +1 -0
- package/dist/stage/scrollFrame.d.ts +43 -0
- package/dist/stage/scrollFrame.d.ts.map +1 -0
- package/dist/stage/scrollFrame.js +232 -0
- package/dist/stage/scrollFrame.js.map +1 -0
- package/dist/stage/spatialElementFrame.d.ts +6 -0
- package/dist/stage/spatialElementFrame.d.ts.map +1 -0
- package/dist/stage/spatialElementFrame.js +22 -0
- package/dist/stage/spatialElementFrame.js.map +1 -0
- package/dist/stage/stageConstants.d.ts +85 -0
- package/dist/stage/stageConstants.d.ts.map +1 -0
- package/dist/stage/stageConstants.js +85 -0
- package/dist/stage/stageConstants.js.map +1 -0
- package/dist/stage/stageDom.d.ts +10 -0
- package/dist/stage/stageDom.d.ts.map +1 -0
- package/dist/stage/stageDom.js +22 -0
- package/dist/stage/stageDom.js.map +1 -0
- package/dist/stage/stageMath.d.ts +187 -0
- package/dist/stage/stageMath.d.ts.map +1 -0
- package/dist/stage/stageMath.js +344 -0
- package/dist/stage/stageMath.js.map +1 -0
- package/dist/stage/stageSceneUtils.d.ts +42 -0
- package/dist/stage/stageSceneUtils.d.ts.map +1 -0
- package/dist/stage/stageSceneUtils.js +154 -0
- package/dist/stage/stageSceneUtils.js.map +1 -0
- package/dist/stage/stageTypes.d.ts +189 -0
- package/dist/stage/stageTypes.d.ts.map +1 -0
- package/dist/stage/stageTypes.js +2 -0
- package/dist/stage/stageTypes.js.map +1 -0
- package/dist/stage/stageVisualTest.d.ts +92 -0
- package/dist/stage/stageVisualTest.d.ts.map +1 -0
- package/dist/stage/stageVisualTest.js +5 -0
- package/dist/stage/stageVisualTest.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpatialElementAssetManager.js","sourceRoot":"","sources":["../../../src/catalog/assets/SpatialElementAssetManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EACN,iCAAiC,EACjC,gCAAgC,EAGhC,MAAM,mCAAmC,CAAC;AAoC3C,MAAM,UAAU,iCAAiC,CAAC,QAAqC;IACtF,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC;QACrB,QAAQ,CAAC,MAAM;QACf,QAAQ,CAAC,GAAG;QACZ,QAAQ,CAAC,QAAQ;QACjB,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;QAC1D,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,YAAY,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;KAC5D,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,OAAO,GAAG,8CAA8C;IAC3E,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAChD,CAAC;AAED,yFAAyF;AACzF,MAAM,OAAO,0BAA0B;IACrB,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;IACtC,OAAO,GAAG,IAAI,GAAG,EAAc,CAAC;IAChC,MAAM,C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AE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAC9B,GAAG,EAAE,GAAE,CAAC,CACR,CAAC;IACH,CAAC;CACD","sourcesContent":["import type { SpatialElementAssetResource } from '../spatialElementAssets.js';\nimport type { PreparationGate } from '../PreparationGate.js';\nimport { estimateAssetBytes } from './assetCosts.js';\nimport {\n\tcreateSpatialElementAssetInstance,\n\tdisposeLoadedSpatialElementAsset,\n\ttype LoadedSpatialElementAsset,\n\ttype SpatialElementAssetInstance\n} from './spatialElementAssetResources.js';\n\nexport type { LoadedSpatialElementAsset, SpatialElementAssetInstance } from './spatialElementAssetResources.js';\n\nexport interface SpatialElementAssetLoader {\n\tload(\n\t\tresource: SpatialElementAssetResource,\n\t\toptions: { signal: AbortSignal }\n\t): Promise<LoadedSpatialElementAsset>;\n\tdispose?(): void;\n}\n\nexport interface SpatialElementAssetLease {\n\treadonly key: string;\n\t/** Decoded CPU readiness only; the renderer separately establishes GPU readiness. */\n\treadonly ready: Promise<LoadedSpatialElementAsset>;\n\t/** A live instance pins shared resources independently of this lease. */\n\tcreateInstance(): Promise<SpatialElementAssetInstance>;\n\trelease(): void;\n}\n\ninterface AssetEntry {\n\tkey: string;\n\tcontroller: AbortController;\n\tpromise: Promise<LoadedSpatialElementAsset>;\n\tresolve: (asset: LoadedSpatialElementAsset) => void;\n\treject: (error: unknown) => void;\n\tstatus: 'loading' | 'ready' | 'failed';\n\tasset?: LoadedSpatialElementAsset;\n\tleases: number;\n\tinstances: number;\n\tlastUsed: number;\n\tretired: boolean;\n\testimatedBytes: number;\n}\n\nexport function getSpatialElementAssetResourceKey(resource: SpatialElementAssetResource) {\n\tif (!resource.url || !resource.revision) {\n\t\tthrow new Error('SpatialElement asset requests require a URL and revision');\n\t}\n\treturn JSON.stringify([\n\t\tresource.format,\n\t\tresource.url,\n\t\tresource.revision,\n\t\t[...new Set(resource.requirements?.decoders ?? [])].sort(),\n\t\t[...new Set(resource.requirements?.extensions ?? [])].sort()\n\t]);\n}\n\nfunction abortError(message = 'SpatialElement asset operation was cancelled') {\n\treturn new DOMException(message, 'AbortError');\n}\n\n/** Runtime-owned cache with separate lease, instance, and decoded-resource lifetimes. */\nexport class SpatialElementAssetManager {\n\tprivate readonly cache = new Map<string, AssetEntry>();\n\tprivate readonly entries = new Set<AssetEntry>();\n\tprivate readonly loader: SpatialElementAssetLoader;\n\tprivate readonly maxIdleEntries: number;\n\tprivate readonly maxIdleBytes: number;\n\tprivate clock = 0;\n\tprivate loadingCount = 0;\n\tprivate disposed = false;\n\tprivate loaderDisposed = false;\n\tprivate readonly loads: { url: string; fetchMs: number; decodeMs: number; gateWaitMs: number }[] =\n\t\t[];\n\n\tconstructor(\n\t\toptions: {\n\t\t\tloader?: SpatialElementAssetLoader;\n\t\t\tdracoDecoderPath?: string;\n\t\t\tmaxIdleEntries?: number;\n\t\t\tmaxIdleBytes?: number;\n\t\t\tpreparationGate?: PreparationGate;\n\t\t} = {}\n\t) {\n\t\tthis.loader = options.loader ?? new GltfSpatialElementAssetLoader(options.preparationGate, options.dracoDecoderPath);\n\t\tthis.preparationGate = options.preparationGate;\n\t\tthis.maxIdleEntries = Math.max(0, Math.floor(options.maxIdleEntries ?? 6));\n\t\tthis.maxIdleBytes = Math.max(0, options.maxIdleBytes ?? 96 * 1024 * 1024);\n\t}\n\tprivate readonly preparationGate?: PreparationGate;\n\n\tsetDracoDecoderPath(path: string) {\n\t\tif (this.loader instanceof GltfSpatialElementAssetLoader) this.loader.setDracoDecoderPath(path);\n\t}\n\n\tacquire(\n\t\tresource: SpatialElementAssetResource,\n\t\toptions: { signal?: AbortSignal } = {}\n\t): SpatialElementAssetLease {\n\t\tif (this.disposed) throw new Error('SpatialElementAssetManager has been disposed');\n\t\tif (options.signal?.aborted) throw abortError();\n\t\tconst key = getSpatialElementAssetResourceKey(resource);\n\t\tconst entry = this.cache.get(key) ?? this.startLoad(key, resource);\n\t\tentry.leases += 1;\n\t\tentry.lastUsed = ++this.clock;\n\t\tlet released = false;\n\t\tlet rejectReady: (error: unknown) => void = () => {};\n\t\tconst release = () => {\n\t\t\tif (released) return;\n\t\t\treleased = true;\n\t\t\toptions.signal?.removeEventListener('abort', release);\n\t\t\trejectReady(abortError());\n\t\t\tentry.leases -= 1;\n\t\t\tentry.lastUsed = ++this.clock;\n\t\t\tthis.releaseUnused(entry);\n\t\t};\n\t\tconst ready = new Promise<LoadedSpatialElementAsset>((resolve, reject) => {\n\t\t\trejectReady = reject;\n\t\t\tentry.promise.then(\n\t\t\t\t(asset) => {\n\t\t\t\t\tif (released || entry.retired) {\n\t\t\t\t\t\treject(abortError());\n\t\t\t\t\t\trelease();\n\t\t\t\t\t} else resolve(asset);\n\t\t\t\t},\n\t\t\t\t(error: unknown) => {\n\t\t\t\t\treject(error);\n\t\t\t\t\trelease();\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\t\t// A caller may release speculative work without ever awaiting it.\n\t\tvoid ready.catch(() => {});\n\t\toptions.signal?.addEventListener('abort', release, { once: true });\n\t\treturn {\n\t\t\tkey,\n\t\t\tready,\n\t\t\tcreateInstance: async () => {\n\t\t\t\tconst asset = await ready;\n\t\t\t\tif (released || entry.retired) throw abortError();\n\t\t\t\tconst create = () => {\n\t\t\t\t\tif (released || entry.retired) throw abortError();\n\t\t\t\t\tconst instance = createSpatialElementAssetInstance(asset, () => {\n\t\t\t\t\t\tentry.instances -= 1;\n\t\t\t\t\t\tentry.lastUsed = ++this.clock;\n\t\t\t\t\t\tthis.releaseUnused(entry);\n\t\t\t\t\t});\n\t\t\t\t\tentry.instances += 1;\n\t\t\t\t\treturn instance;\n\t\t\t\t};\n\t\t\t\treturn this.preparationGate ? this.preparationGate.run(create, options.signal) : create();\n\t\t\t},\n\t\t\trelease\n\t\t};\n\t}\n\n\t/** Replaces one resource generation; existing instances retain their owned resources. */\n\tinvalidate(resource: SpatialElementAssetResource) {\n\t\tconst entry = this.cache.get(getSpatialElementAssetResourceKey(resource));\n\t\tif (entry) this.retire(entry);\n\t}\n\n\t/** Evicts least-recently-used idle assets without touching active leases or instances. */\n\ttrim(maxIdleEntries = this.maxIdleEntries) {\n\t\tconst idle = [...this.cache.values()]\n\t\t\t.filter((entry) => entry.status === 'ready' && entry.leases === 0 && entry.instances === 0)\n\t\t\t.sort((a, b) => a.lastUsed - b.lastUsed);\n\t\tlet bytes = idle.reduce((sum, entry) => sum + entry.estimatedBytes, 0);\n\t\tlet count = idle.length;\n\t\tfor (const entry of idle) {\n\t\t\tif (count <= Math.max(0, Math.floor(maxIdleEntries)) && bytes <= this.maxIdleBytes) break;\n\t\t\tbytes -= entry.estimatedBytes;\n\t\t\tcount--;\n\t\t\tthis.retire(entry);\n\t\t}\n\t}\n\n\tgetStats() {\n\t\tlet activeLeases = 0;\n\t\tlet activeInstances = 0;\n\t\tfor (const entry of this.entries) {\n\t\t\tactiveLeases += entry.leases;\n\t\t\tactiveInstances += entry.instances;\n\t\t}\n\t\treturn {\n\t\t\testimatedResidentBytes: [...this.entries].reduce(\n\t\t\t\t(sum, entry) => sum + entry.estimatedBytes,\n\t\t\t\t0\n\t\t\t),\n\t\t\tloadTimings: [...this.loads],\n\t\t\testimatedIdleBytes: [...this.cache.values()]\n\t\t\t\t.filter((entry) => entry.status === 'ready' && !entry.leases && !entry.instances)\n\t\t\t\t.reduce((sum, entry) => sum + entry.estimatedBytes, 0),\n\t\t\tcachedResources: this.cache.size,\n\t\t\tpendingLoads: this.loadingCount,\n\t\t\tactiveLeases,\n\t\t\tactiveInstances,\n\t\t\tidleResources: [...this.cache.values()].filter(\n\t\t\t\t(entry) => entry.status === 'ready' && entry.leases === 0 && entry.instances === 0\n\t\t\t).length\n\t\t};\n\t}\n\n\t/** Closes the cache; live instances remain valid until their owners release them. */\n\tdispose() {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\tfor (const entry of [...this.entries]) this.retire(entry);\n\t\tthis.disposeLoaderWhenIdle();\n\t}\n\n\tprivate startLoad(key: string, resource: SpatialElementAssetResource) {\n\t\tlet resolve!: AssetEntry['resolve'];\n\t\tlet reject!: AssetEntry['reject'];\n\t\tconst promise = new Promise<LoadedSpatialElementAsset>((accept, fail) => {\n\t\t\tresolve = accept;\n\t\t\treject = fail;\n\t\t});\n\t\tconst entry: AssetEntry = {\n\t\t\tkey,\n\t\t\tcontroller: new AbortController(),\n\t\t\tpromise,\n\t\t\tresolve,\n\t\t\treject,\n\t\t\tstatus: 'loading',\n\t\t\tleases: 0,\n\t\t\tinstances: 0,\n\t\t\tlastUsed: ++this.clock,\n\t\t\tretired: false,\n\t\t\testimatedBytes: 0\n\t\t};\n\t\tthis.cache.set(key, entry);\n\t\tthis.entries.add(entry);\n\t\tthis.loadingCount += 1;\n\t\t// Defer invocation so synchronous loader failures use the same cleanup path.\n\t\tvoid Promise.resolve()\n\t\t\t.then(() => {\n\t\t\t\tif (entry.controller.signal.aborted) throw abortError();\n\t\t\t\treturn this.loader.load(resource, { signal: entry.controller.signal });\n\t\t\t})\n\t\t\t.then((asset) => {\n\t\t\t\tif (entry.retired || this.cache.get(key) !== entry) {\n\t\t\t\t\tdisposeLoadedSpatialElementAsset(asset);\n\t\t\t\t\tentry.status = 'failed';\n\t\t\t\t\tentry.reject(abortError('A newer spatialElement asset generation replaced this load'));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tentry.asset = asset;\n\t\t\t\tentry.estimatedBytes = estimateAssetBytes(asset.scene, ...(asset.scenes ?? []));\n\t\t\t\tif (asset.timings) {\n\t\t\t\t\tthis.loads.push({ url: resource.url, ...asset.timings });\n\t\t\t\t\tif (this.loads.length > 20) this.loads.shift();\n\t\t\t\t}\n\t\t\t\tentry.status = 'ready';\n\t\t\t\tentry.resolve(asset);\n\t\t\t})\n\t\t\t.catch((error: unknown) => {\n\t\t\t\tentry.status = 'failed';\n\t\t\t\tentry.reject(error);\n\t\t\t\tthis.retire(entry);\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tthis.loadingCount -= 1;\n\t\t\t\tthis.releaseUnused(entry);\n\t\t\t\tthis.disposeLoaderWhenIdle();\n\t\t\t});\n\t\treturn entry;\n\t}\n\n\tprivate retire(entry: AssetEntry) {\n\t\tentry.retired = true;\n\t\tif (this.cache.get(entry.key) === entry) this.cache.delete(entry.key);\n\t\tif (entry.status === 'loading') {\n\t\t\tentry.reject(abortError());\n\t\t\tentry.controller.abort();\n\t\t}\n\t\tthis.disposeEntryWhenUnused(entry);\n\t}\n\n\tprivate releaseUnused(entry: AssetEntry) {\n\t\tif (entry.leases || entry.instances) return;\n\t\tif (entry.status === 'loading' || this.disposed || entry.retired) this.retire(entry);\n\t\telse this.trim();\n\t}\n\n\tprivate disposeEntryWhenUnused(entry: AssetEntry) {\n\t\tif (entry.leases || entry.instances || entry.status === 'loading') return;\n\t\tif (entry.asset) {\n\t\t\tconst asset = entry.asset;\n\t\t\tentry.asset = undefined;\n\t\t\tdisposeLoadedSpatialElementAsset(asset);\n\t\t}\n\t\tthis.entries.delete(entry);\n\t}\n\n\tprivate disposeLoaderWhenIdle() {\n\t\tif (!this.disposed || this.loadingCount || this.loaderDisposed) return;\n\t\tthis.loaderDisposed = true;\n\t\tthis.loader.dispose?.();\n\t}\n}\n\n/** Lazy shared decoder setup; network cancellation does not pretend to cancel GLTF decoding. */\nexport class GltfSpatialElementAssetLoader implements SpatialElementAssetLoader {\n\tconstructor(private readonly gate?: PreparationGate, private decoderPath = '/assets/draco/gltf/') {}\n setDracoDecoderPath(path: string) {\n if (this.setup) throw new Error('Configure the Draco decoder path before loading assets');\n this.decoderPath = path;\n }\n\tprivate setup?: Promise<{\n\t\tgltf: import('three/addons/loaders/GLTFLoader.js').GLTFLoader;\n\t\tdraco: import('three/addons/loaders/DRACOLoader.js').DRACOLoader;\n\t}>;\n\n\tasync load(resource: SpatialElementAssetResource, { signal }: { signal: AbortSignal }) {\n\t\tif (resource.requirements?.decoders.includes('ktx2')) {\n\t\t\tthrow new Error('KTX2 assets require renderer capability configuration');\n\t\t}\n\t\tthis.setup ??= Promise.all([\n\t\t\timport('three/addons/loaders/GLTFLoader.js'),\n\t\t\timport('three/addons/loaders/DRACOLoader.js'),\n\t\t\timport('three/addons/libs/meshopt_decoder.module.js')\n\t\t]).then(([{ GLTFLoader }, { DRACOLoader }, { MeshoptDecoder }]) => {\n\t\t\tconst draco = new DRACOLoader().setDecoderPath(this.decoderPath);\n\t\t\tconst gltf = new GLTFLoader().setDRACOLoader(draco).setMeshoptDecoder(MeshoptDecoder);\n\t\t\treturn { gltf, draco };\n\t\t});\n\t\tconst { gltf } = await this.setup;\n\t\tsignal.throwIfAborted();\n\t\tconst fetchStarted = performance.now();\n\t\tconst response = await fetch(resource.url, { signal });\n\t\tif (!response.ok) throw new Error(`Unable to load spatialElement asset (${response.status})`);\n\t\tconst data = resource.format === 'gltf' ? await response.text() : await response.arrayBuffer();\n\t\tconst fetched = performance.now();\n\t\tsignal.throwIfAborted();\n\t\tconst base = new URL('.', new URL(resource.url, location.href)).href;\n\t\tlet parseStarted = fetched;\n\t\tconst parse = () => {\n\t\t\tparseStarted = performance.now();\n\t\t\treturn gltf.parseAsync(data, base);\n\t\t};\n\t\tconst loaded = this.gate ? await this.gate.run(parse, signal) : await parse();\n\t\t// The manager disposes the decoded result if the request became stale during parse.\n\t\treturn {\n\t\t\tscene: loaded.scene,\n\t\t\tscenes: loaded.scenes,\n\t\t\tanimations: loaded.animations,\n\t\t\ttimings: {\n\t\t\t\tfetchMs: fetched - fetchStarted,\n\t\t\t\tdecodeMs: performance.now() - parseStarted,\n\t\t\t\tgateWaitMs: parseStarted - fetched\n\t\t\t}\n\t\t};\n\t}\n\n\tdispose() {\n\t\tvoid this.setup?.then(\n\t\t\t({ draco }) => draco.dispose(),\n\t\t\t() => {}\n\t\t);\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetCosts.d.ts","sourceRoot":"","sources":["../../../src/catalog/assets/assetCosts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4B,QAAQ,EAAW,MAAM,OAAO,CAAC;AAEzE,iGAAiG;AACjG,wBAAgB,kBAAkB,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,UAiCvD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Conservative accounting model, not a GPU memory query. Shared buffers/textures count once. */
|
|
2
|
+
export function estimateAssetBytes(...scenes) {
|
|
3
|
+
const buffers = new Set();
|
|
4
|
+
const textures = new Set();
|
|
5
|
+
for (const scene of new Set(scenes))
|
|
6
|
+
scene.traverse((object) => {
|
|
7
|
+
const mesh = object;
|
|
8
|
+
if (mesh.geometry) {
|
|
9
|
+
for (const attribute of [...Object.values(mesh.geometry.attributes), mesh.geometry.index]) {
|
|
10
|
+
if (!attribute)
|
|
11
|
+
continue;
|
|
12
|
+
const array = 'isInterleavedBufferAttribute' in attribute ? attribute.data.array : attribute.array;
|
|
13
|
+
buffers.add(array.buffer);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
for (const material of !mesh.material
|
|
17
|
+
? []
|
|
18
|
+
: Array.isArray(mesh.material)
|
|
19
|
+
? mesh.material
|
|
20
|
+
: [mesh.material]) {
|
|
21
|
+
for (const value of Object.values(material))
|
|
22
|
+
if (value?.isTexture)
|
|
23
|
+
textures.add(value);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
let bytes = [...buffers].reduce((sum, buffer) => sum + buffer.byteLength, 0);
|
|
27
|
+
for (const texture of textures) {
|
|
28
|
+
const image = texture.source?.data;
|
|
29
|
+
bytes += Math.ceil((image?.width ?? 0) * (image?.height ?? 0) * 4 * (texture.generateMipmaps ? 4 / 3 : 1));
|
|
30
|
+
}
|
|
31
|
+
return bytes;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=assetCosts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetCosts.js","sourceRoot":"","sources":["../../../src/catalog/assets/assetCosts.ts"],"names":[],"mappings":"AAEA,iGAAiG;AACjG,MAA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AC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAC7E,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,IAAuD,CAAC;QACtF,KAAK,IAAI,IAAI,CAAC,IAAI,CACjB,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACtF,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import type { BufferGeometry, Material, Object3D, Texture } from 'three';\n\n/** Conservative accounting model, not a GPU memory query. Shared buffers/textures count once. */\nexport function estimateAssetBytes(...scenes: Object3D[]) {\n\tconst buffers = new Set<ArrayBufferLike>();\n\tconst textures = new Set<Texture>();\n\tfor (const scene of new Set(scenes))\n\t\tscene.traverse((object) => {\n\t\t\tconst mesh = object as Object3D & {\n\t\t\t\tgeometry?: BufferGeometry;\n\t\t\t\tmaterial?: Material | Material[];\n\t\t\t};\n\t\t\tif (mesh.geometry) {\n\t\t\t\tfor (const attribute of [...Object.values(mesh.geometry.attributes), mesh.geometry.index]) {\n\t\t\t\t\tif (!attribute) continue;\n\t\t\t\t\tconst array =\n\t\t\t\t\t\t'isInterleavedBufferAttribute' in attribute ? attribute.data.array : attribute.array;\n\t\t\t\t\tbuffers.add(array.buffer);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const material of !mesh.material\n\t\t\t\t? []\n\t\t\t\t: Array.isArray(mesh.material)\n\t\t\t\t\t? mesh.material\n\t\t\t\t\t: [mesh.material]) {\n\t\t\t\tfor (const value of Object.values(material)) if (value?.isTexture) textures.add(value);\n\t\t\t}\n\t\t});\n\tlet bytes = [...buffers].reduce((sum, buffer) => sum + buffer.byteLength, 0);\n\tfor (const texture of textures) {\n\t\tconst image = texture.source?.data as { width?: number; height?: number } | undefined;\n\t\tbytes += Math.ceil(\n\t\t\t(image?.width ?? 0) * (image?.height ?? 0) * 4 * (texture.generateMipmaps ? 4 / 3 : 1)\n\t\t);\n\t}\n\treturn bytes;\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AnimationClip, Object3D } from 'three';
|
|
2
|
+
export interface LoadedSpatialElementAsset {
|
|
3
|
+
/** Cache-owned source scene. Consumers must create an instance before mutation. */
|
|
4
|
+
scene: Object3D;
|
|
5
|
+
scenes?: readonly Object3D[];
|
|
6
|
+
animations?: readonly AnimationClip[];
|
|
7
|
+
/** Optional custom ownership boundary supplied by an injected loader. */
|
|
8
|
+
dispose?: () => void;
|
|
9
|
+
timings?: {
|
|
10
|
+
fetchMs: number;
|
|
11
|
+
decodeMs: number;
|
|
12
|
+
gateWaitMs: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface SpatialElementAssetInstance {
|
|
16
|
+
scene: Object3D;
|
|
17
|
+
/** Immutable clips may be shared; mixers and animation state belong to the presentation. */
|
|
18
|
+
animations: readonly AnimationClip[];
|
|
19
|
+
dispose(): void;
|
|
20
|
+
}
|
|
21
|
+
/** Releases cache-owned resources once, including resources shared between GLTF scenes. */
|
|
22
|
+
export declare function disposeLoadedSpatialElementAsset(asset: LoadedSpatialElementAsset): void;
|
|
23
|
+
/** Clones mutable instance state while retaining cache-owned geometries and textures. */
|
|
24
|
+
export declare function createSpatialElementAssetInstance(asset: LoadedSpatialElementAsset, onDispose: () => void): SpatialElementAssetInstance;
|
|
25
|
+
//# sourceMappingURL=spatialElementAssetResources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatialElementAssetResources.d.ts","sourceRoot":"","sources":["../../../src/catalog/assets/spatialElementAssetResources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAA4B,QAAQ,EAAqB,MAAM,OAAO,CAAC;AAGlG,MAAM,WAAW,yBAAyB;IACzC,mFAAmF;IACnF,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IACtC,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CACpE;AAED,MAAM,WAAW,2BAA2B;IAC3C,KAAK,EAAE,QAAQ,CAAC;IAChB,4FAA4F;IAC5F,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;IACrC,OAAO,IAAI,IAAI,CAAC;CAChB;AAED,2FAA2F;AAC3F,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,yBAAyB,QA2ChF;AAED,yFAAyF;AACzF,wBAAgB,iCAAiC,CAChD,KAAK,EAAE,yBAAyB,EAChC,SAAS,EAAE,MAAM,IAAI,GACnB,2BAA2B,CA2C7B"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { clone } from 'three/addons/utils/SkeletonUtils.js';
|
|
2
|
+
/** Releases cache-owned resources once, including resources shared between GLTF scenes. */
|
|
3
|
+
export function disposeLoadedSpatialElementAsset(asset) {
|
|
4
|
+
if (asset.dispose) {
|
|
5
|
+
asset.dispose();
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const geometries = new Set();
|
|
9
|
+
const materials = new Set();
|
|
10
|
+
const textures = new Set();
|
|
11
|
+
const skeletons = new Set();
|
|
12
|
+
for (const scene of new Set([asset.scene, ...(asset.scenes ?? [])])) {
|
|
13
|
+
scene.traverse((object) => {
|
|
14
|
+
const renderable = object;
|
|
15
|
+
if (renderable.geometry)
|
|
16
|
+
geometries.add(renderable.geometry);
|
|
17
|
+
if (renderable.skeleton)
|
|
18
|
+
skeletons.add(renderable.skeleton);
|
|
19
|
+
if (renderable.material) {
|
|
20
|
+
for (const material of Array.isArray(renderable.material)
|
|
21
|
+
? renderable.material
|
|
22
|
+
: [renderable.material])
|
|
23
|
+
materials.add(material);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
for (const material of materials) {
|
|
28
|
+
for (const value of Object.values(material)) {
|
|
29
|
+
if (value && typeof value === 'object' && 'isTexture' in value && value.isTexture) {
|
|
30
|
+
textures.add(value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const bitmaps = new Set();
|
|
35
|
+
for (const texture of textures) {
|
|
36
|
+
const data = texture.source?.data;
|
|
37
|
+
if (typeof ImageBitmap !== 'undefined' && data instanceof ImageBitmap)
|
|
38
|
+
bitmaps.add(data);
|
|
39
|
+
texture.dispose();
|
|
40
|
+
}
|
|
41
|
+
for (const bitmap of bitmaps)
|
|
42
|
+
bitmap.close();
|
|
43
|
+
for (const skeleton of skeletons)
|
|
44
|
+
skeleton.dispose();
|
|
45
|
+
for (const material of materials)
|
|
46
|
+
material.dispose();
|
|
47
|
+
for (const geometry of geometries)
|
|
48
|
+
geometry.dispose();
|
|
49
|
+
}
|
|
50
|
+
/** Clones mutable instance state while retaining cache-owned geometries and textures. */
|
|
51
|
+
export function createSpatialElementAssetInstance(asset, onDispose) {
|
|
52
|
+
const scene = clone(asset.scene);
|
|
53
|
+
const materials = new Map();
|
|
54
|
+
const skeletons = new Set();
|
|
55
|
+
try {
|
|
56
|
+
scene.traverse((object) => {
|
|
57
|
+
const renderable = object;
|
|
58
|
+
if (renderable.skeleton)
|
|
59
|
+
skeletons.add(renderable.skeleton);
|
|
60
|
+
if (!renderable.material)
|
|
61
|
+
return;
|
|
62
|
+
const cloneMaterial = (source) => {
|
|
63
|
+
let instance = materials.get(source);
|
|
64
|
+
if (!instance) {
|
|
65
|
+
instance = source.clone();
|
|
66
|
+
materials.set(source, instance);
|
|
67
|
+
}
|
|
68
|
+
return instance;
|
|
69
|
+
};
|
|
70
|
+
renderable.material = Array.isArray(renderable.material)
|
|
71
|
+
? renderable.material.map(cloneMaterial)
|
|
72
|
+
: cloneMaterial(renderable.material);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
for (const material of materials.values())
|
|
77
|
+
material.dispose();
|
|
78
|
+
for (const skeleton of skeletons)
|
|
79
|
+
skeleton.dispose();
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
let disposed = false;
|
|
83
|
+
return {
|
|
84
|
+
scene,
|
|
85
|
+
animations: asset.animations ?? [],
|
|
86
|
+
dispose() {
|
|
87
|
+
if (disposed)
|
|
88
|
+
return;
|
|
89
|
+
disposed = true;
|
|
90
|
+
scene.removeFromParent();
|
|
91
|
+
// Overrides added later remain the presentation's responsibility.
|
|
92
|
+
for (const material of materials.values())
|
|
93
|
+
material.dispose();
|
|
94
|
+
for (const skeleton of skeletons)
|
|
95
|
+
skeleton.dispose();
|
|
96
|
+
onDispose();
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=spatialElementAssetResources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatialElementAssetResources.js","sourceRoot":"","sources":["../../../src/catalog/assets/spatialElementAssetResources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAmB5D,2FAA2F;AAC3F,MAAM,UAAU,gCAAgC,CAAC,KAAgC;IAChF,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,OAAO;IACR,CAAC;IACD,MAAM,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC7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AE,CAAC;oBACf,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;oBAC1B,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;gBACjC,CAAC;gBACD,OAAO,QAAQ,CAAC;YACjB,CAAC,CAAC;YACF,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;gBACvD,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC;gBACxC,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,KAAK,MAAM,QAAQ,IAAI,SAAS,CAAC,MAAM,EAAE;YAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;QAC9D,KAAK,MAAM,QAAQ,IAAI,SAAS;YAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;QACrD,MAAM,KAAK,CAAC;IACb,CAAC;IACD,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,OAAO;QACN,KAAK;QACL,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,EAAE;QAClC,OAAO;YACN,IAAI,QAAQ;gBAAE,OAAO;YACrB,QAAQ,GAAG,IAAI,CAAC;YAChB,KAAK,CAAC,gBAAgB,EAAE,CAAC;YACzB,kEAAkE;YAClE,KAAK,MAAM,QAAQ,IAAI,SAAS,CAAC,MAAM,EAAE;gBAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;YAC9D,KAAK,MAAM,QAAQ,IAAI,SAAS;gBAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;YACrD,SAAS,EAAE,CAAC;QACb,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import type { AnimationClip, BufferGeometry, Material, Object3D, Skeleton, Texture } from 'three';\nimport { clone } from 'three/addons/utils/SkeletonUtils.js';\n\nexport interface LoadedSpatialElementAsset {\n\t/** Cache-owned source scene. Consumers must create an instance before mutation. */\n\tscene: Object3D;\n\tscenes?: readonly Object3D[];\n\tanimations?: readonly AnimationClip[];\n\t/** Optional custom ownership boundary supplied by an injected loader. */\n\tdispose?: () => void;\n\ttimings?: { fetchMs: number; decodeMs: number; gateWaitMs: number };\n}\n\nexport interface SpatialElementAssetInstance {\n\tscene: Object3D;\n\t/** Immutable clips may be shared; mixers and animation state belong to the presentation. */\n\tanimations: readonly AnimationClip[];\n\tdispose(): void;\n}\n\n/** Releases cache-owned resources once, including resources shared between GLTF scenes. */\nexport function disposeLoadedSpatialElementAsset(asset: LoadedSpatialElementAsset) {\n\tif (asset.dispose) {\n\t\tasset.dispose();\n\t\treturn;\n\t}\n\tconst geometries = new Set<BufferGeometry>();\n\tconst materials = new Set<Material>();\n\tconst textures = new Set<Texture>();\n\tconst skeletons = new Set<Skeleton>();\n\tfor (const scene of new Set([asset.scene, ...(asset.scenes ?? [])])) {\n\t\tscene.traverse((object) => {\n\t\t\tconst renderable = object as Object3D & {\n\t\t\t\tgeometry?: BufferGeometry;\n\t\t\t\tmaterial?: Material | Material[];\n\t\t\t\tskeleton?: Skeleton;\n\t\t\t};\n\t\t\tif (renderable.geometry) geometries.add(renderable.geometry);\n\t\t\tif (renderable.skeleton) skeletons.add(renderable.skeleton);\n\t\t\tif (renderable.material) {\n\t\t\t\tfor (const material of Array.isArray(renderable.material)\n\t\t\t\t\t? renderable.material\n\t\t\t\t\t: [renderable.material])\n\t\t\t\t\tmaterials.add(material);\n\t\t\t}\n\t\t});\n\t}\n\tfor (const material of materials) {\n\t\tfor (const value of Object.values(material)) {\n\t\t\tif (value && typeof value === 'object' && 'isTexture' in value && value.isTexture) {\n\t\t\t\ttextures.add(value as Texture);\n\t\t\t}\n\t\t}\n\t}\n\tconst bitmaps = new Set<ImageBitmap>();\n\tfor (const texture of textures) {\n\t\tconst data = texture.source?.data;\n\t\tif (typeof ImageBitmap !== 'undefined' && data instanceof ImageBitmap) bitmaps.add(data);\n\t\ttexture.dispose();\n\t}\n\tfor (const bitmap of bitmaps) bitmap.close();\n\tfor (const skeleton of skeletons) skeleton.dispose();\n\tfor (const material of materials) material.dispose();\n\tfor (const geometry of geometries) geometry.dispose();\n}\n\n/** Clones mutable instance state while retaining cache-owned geometries and textures. */\nexport function createSpatialElementAssetInstance(\n\tasset: LoadedSpatialElementAsset,\n\tonDispose: () => void\n): SpatialElementAssetInstance {\n\tconst scene = clone(asset.scene);\n\tconst materials = new Map<Material, Material>();\n\tconst skeletons = new Set<Skeleton>();\n\ttry {\n\t\tscene.traverse((object) => {\n\t\t\tconst renderable = object as Object3D & {\n\t\t\t\tmaterial?: Material | Material[];\n\t\t\t\tskeleton?: Skeleton;\n\t\t\t};\n\t\t\tif (renderable.skeleton) skeletons.add(renderable.skeleton);\n\t\t\tif (!renderable.material) return;\n\t\t\tconst cloneMaterial = (source: Material) => {\n\t\t\t\tlet instance = materials.get(source);\n\t\t\t\tif (!instance) {\n\t\t\t\t\tinstance = source.clone();\n\t\t\t\t\tmaterials.set(source, instance);\n\t\t\t\t}\n\t\t\t\treturn instance;\n\t\t\t};\n\t\t\trenderable.material = Array.isArray(renderable.material)\n\t\t\t\t? renderable.material.map(cloneMaterial)\n\t\t\t\t: cloneMaterial(renderable.material);\n\t\t});\n\t} catch (error) {\n\t\tfor (const material of materials.values()) material.dispose();\n\t\tfor (const skeleton of skeletons) skeleton.dispose();\n\t\tthrow error;\n\t}\n\tlet disposed = false;\n\treturn {\n\t\tscene,\n\t\tanimations: asset.animations ?? [],\n\t\tdispose() {\n\t\t\tif (disposed) return;\n\t\t\tdisposed = true;\n\t\t\tscene.removeFromParent();\n\t\t\t// Overrides added later remain the presentation's responsibility.\n\t\t\tfor (const material of materials.values()) material.dispose();\n\t\t\tfor (const skeleton of skeletons) skeleton.dispose();\n\t\t\tonDispose();\n\t\t}\n\t};\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CssProjectionQuad } from '../stage/cssProjection.js';
|
|
2
|
+
/** The last submitted frame survives page teardown without retaining the page. */
|
|
3
|
+
export declare function recordCarouselPanel(panel: HTMLElement, corners: CssProjectionQuad, width: number, height: number): void;
|
|
4
|
+
export declare function captureCarouselElement(element: HTMLElement): {
|
|
5
|
+
corners: CssProjectionQuad;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
} | undefined;
|
|
9
|
+
//# sourceMappingURL=carouselPanelProjection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carouselPanelProjection.d.ts","sourceRoot":"","sources":["../../src/catalog/carouselPanelProjection.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAO7F,kFAAkF;AAClF,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,iBAAiB,EAC1B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,QAGd;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW;aAb/C,iBAAiB;WAAS,MAAM;YAAU,MAAM;cAkC3D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getProjectiveCssMatrix3d } from '../stage/cssProjection.js';
|
|
2
|
+
const frames = new WeakMap();
|
|
3
|
+
/** The last submitted frame survives page teardown without retaining the page. */
|
|
4
|
+
export function recordCarouselPanel(panel, corners, width, height) {
|
|
5
|
+
frames.set(panel, { corners, width, height });
|
|
6
|
+
}
|
|
7
|
+
export function captureCarouselElement(element) {
|
|
8
|
+
const panel = element.closest('[data-carousel-spatial-element] .summary');
|
|
9
|
+
const frame = panel && frames.get(panel);
|
|
10
|
+
if (!panel || !frame)
|
|
11
|
+
return undefined;
|
|
12
|
+
if (element === panel)
|
|
13
|
+
return frame;
|
|
14
|
+
// Shared summary roles are direct children. Never guess a nested content transform.
|
|
15
|
+
if (element.offsetParent !== panel)
|
|
16
|
+
return undefined;
|
|
17
|
+
const projection = getProjectiveCssMatrix3d(frame.corners, frame.width, frame.height);
|
|
18
|
+
if (!projection)
|
|
19
|
+
return undefined;
|
|
20
|
+
const matrix = new DOMMatrix(projection);
|
|
21
|
+
const { offsetLeft: x, offsetTop: y, offsetWidth: width, offsetHeight: height } = element;
|
|
22
|
+
const corners = [
|
|
23
|
+
[x, y],
|
|
24
|
+
[x + width, y],
|
|
25
|
+
[x + width, y + height],
|
|
26
|
+
[x, y + height]
|
|
27
|
+
].map(([x, y]) => {
|
|
28
|
+
const point = matrix.transformPoint(new DOMPoint(x, y));
|
|
29
|
+
return { x: point.x / point.w, y: point.y / point.w };
|
|
30
|
+
});
|
|
31
|
+
return { corners, width, height };
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=carouselPanelProjection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carouselPanelProjection.js","sourceRoot":"","sources":["../../src/catalog/carouselPanelProjection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAA0B,MAAM,2BAA2B,CAAC;AAE7F,MAAM,MAAM,GAAG,IAAI,OAAO,EAGvB,CAAC;AAEJ,kFAAkF;AAClF,MAAM,UAAU,mBAAmB,CAClC,KAAkB,EAClB,OAA0B,EAC1B,KAAa,EACb,MAAc;IAEd,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAAoB;IAC1D,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAc,0CAA0C,CAAC,CAAC;IACvF,MAAM,KAAK,GAAG,KAAK,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IACvC,IAAI,OAAO,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IACpC,oFAAoF;IACpF,IAAI,OAAO,CAAC,YAAY,KAAK,KAAK;QAAE,OAAO,SAAS,CAAC;IACrD,MAAM,UAAU,GAAG,wBAAwB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtF,IAAI,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC1F,MAAM,OAAO,GAAG;QACf,CAAC,CAAC,EAAE,CAAC,CAAC;QACN,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;QACd,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC;QACvB,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;KACf,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;QAChB,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACxD,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;IACvD,CAAC,CAAiC,CAAC;IACnC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import { getProjectiveCssMatrix3d, type CssProjectionQuad } from '../stage/cssProjection.js';\n\nconst frames = new WeakMap<\n\tHTMLElement,\n\t{ corners: CssProjectionQuad; width: number; height: number }\n>();\n\n/** The last submitted frame survives page teardown without retaining the page. */\nexport function recordCarouselPanel(\n\tpanel: HTMLElement,\n\tcorners: CssProjectionQuad,\n\twidth: number,\n\theight: number\n) {\n\tframes.set(panel, { corners, width, height });\n}\n\nexport function captureCarouselElement(element: HTMLElement) {\n\tconst panel = element.closest<HTMLElement>('[data-carousel-spatial-element] .summary');\n\tconst frame = panel && frames.get(panel);\n\tif (!panel || !frame) return undefined;\n\tif (element === panel) return frame;\n\t// Shared summary roles are direct children. Never guess a nested content transform.\n\tif (element.offsetParent !== panel) return undefined;\n\tconst projection = getProjectiveCssMatrix3d(frame.corners, frame.width, frame.height);\n\tif (!projection) return undefined;\n\tconst matrix = new DOMMatrix(projection);\n\tconst { offsetLeft: x, offsetTop: y, offsetWidth: width, offsetHeight: height } = element;\n\tconst corners = [\n\t\t[x, y],\n\t\t[x + width, y],\n\t\t[x + width, y + height],\n\t\t[x, y + height]\n\t].map(([x, y]) => {\n\t\tconst point = matrix.transformPoint(new DOMPoint(x, y));\n\t\treturn { x: point.x / point.w, y: point.y / point.w };\n\t}) as unknown as CssProjectionQuad;\n\treturn { corners, width, height };\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function carouselKey(item: {
|
|
2
|
+
id: string;
|
|
3
|
+
itemKey?: string;
|
|
4
|
+
}): string;
|
|
5
|
+
export declare function resolveCarouselSelection(keys: readonly string[], requested?: string): string;
|
|
6
|
+
export declare function stepCarouselSelection(keys: readonly string[], current: string | undefined, step: number): string | undefined;
|
|
7
|
+
//# sourceMappingURL=carouselSelection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carouselSelection.d.ts","sourceRoot":"","sources":["../../src/catalog/carouselSelection.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,UAEjE;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,UAGnF;AAED,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,IAAI,EAAE,MAAM,sBAKZ"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function carouselKey(item) {
|
|
2
|
+
return item.itemKey ?? item.id;
|
|
3
|
+
}
|
|
4
|
+
export function resolveCarouselSelection(keys, requested) {
|
|
5
|
+
if (new Set(keys).size !== keys.length)
|
|
6
|
+
throw new Error('Carousel item keys must be unique');
|
|
7
|
+
return requested !== undefined && keys.includes(requested) ? requested : keys[0];
|
|
8
|
+
}
|
|
9
|
+
export function stepCarouselSelection(keys, current, step) {
|
|
10
|
+
if (!keys.length)
|
|
11
|
+
return undefined;
|
|
12
|
+
const index = Math.max(0, keys.indexOf(current ?? ''));
|
|
13
|
+
return keys[Math.max(0, Math.min(keys.length - 1, index + step))];
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=carouselSelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carouselSelection.js","sourceRoot":"","sources":["../../src/catalog/carouselSelection.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,IAAsC;IACjE,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,IAAuB,EAAE,SAAkB;IACnF,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IAC7F,OAAO,SAAS,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,qBAAqB,CACpC,IAAuB,EACvB,OAA2B,EAC3B,IAAY;IAEZ,IAAI,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;IACvD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC","sourcesContent":["export function carouselKey(item: { id: string; itemKey?: string }) {\n\treturn item.itemKey ?? item.id;\n}\n\nexport function resolveCarouselSelection(keys: readonly string[], requested?: string) {\n\tif (new Set(keys).size !== keys.length) throw new Error('Carousel item keys must be unique');\n\treturn requested !== undefined && keys.includes(requested) ? requested : keys[0];\n}\n\nexport function stepCarouselSelection(\n\tkeys: readonly string[],\n\tcurrent: string | undefined,\n\tstep: number\n) {\n\tif (!keys.length) return undefined;\n\tconst index = Math.max(0, keys.indexOf(current ?? ''));\n\treturn keys[Math.max(0, Math.min(keys.length - 1, index + step))];\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SpatialElementAction } from '../spatial-element/types.js';
|
|
2
|
+
/** Unspecified buttons are not the same behavior merely because both lack an href. */
|
|
3
|
+
export declare function catalogActionSemantic(action: SpatialElementAction): string | undefined;
|
|
4
|
+
//# sourceMappingURL=catalogAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogAction.d.ts","sourceRoot":"","sources":["../../src/catalog/catalogAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,sFAAsF;AACtF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,GAAG,SAAS,CAMtF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Unspecified buttons are not the same behavior merely because both lack an href. */
|
|
2
|
+
export function catalogActionSemantic(action) {
|
|
3
|
+
return action.href
|
|
4
|
+
? `link:${action.href}`
|
|
5
|
+
: action.semanticId
|
|
6
|
+
? `action:${action.semanticId}`
|
|
7
|
+
: undefined;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=catalogAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogAction.js","sourceRoot":"","sources":["../../src/catalog/catalogAction.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,MAAM,UAAU,qBAAqB,CAAC,MAA4B;IACjE,OAAO,MAAM,CAAC,IAAI;QACjB,CAAC,CAAC,QAAQ,MAAM,CAAC,IAAI,EAAE;QACvB,CAAC,CAAC,MAAM,CAAC,UAAU;YAClB,CAAC,CAAC,UAAU,MAAM,CAAC,UAAU,EAAE;YAC/B,CAAC,CAAC,SAAS,CAAC;AACf,CAAC","sourcesContent":["import type { SpatialElementAction } from '../spatial-element/types.js';\n\n/** Unspecified buttons are not the same behavior merely because both lack an href. */\nexport function catalogActionSemantic(action: SpatialElementAction): string | undefined {\n\treturn action.href\n\t\t? `link:${action.href}`\n\t\t: action.semanticId\n\t\t\t? `action:${action.semanticId}`\n\t\t\t: undefined;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CatalogEndpointAddress } from './CatalogEndpointRegistry.js';
|
|
2
|
+
/** Concrete source, resolved by the existing recipe/registry before capture. */
|
|
3
|
+
export type CatalogGeometryEndpoint = Omit<CatalogEndpointAddress, 'slot' | 'role'> & {
|
|
4
|
+
slot: Exclude<CatalogEndpointAddress['slot'], 'detail.summary'>;
|
|
5
|
+
role: 'geometry';
|
|
6
|
+
};
|
|
7
|
+
/** A retained capture can be retargeted before a concrete destination occurrence binds. */
|
|
8
|
+
export interface CatalogGeometryDestination {
|
|
9
|
+
spatialElementId: string;
|
|
10
|
+
kind: 'content' | 'hero' | 'dock';
|
|
11
|
+
}
|
|
12
|
+
export declare function geometryEndpoint(endpoint: Omit<CatalogEndpointAddress, 'role'>): CatalogGeometryEndpoint;
|
|
13
|
+
//# sourceMappingURL=catalogGeometryRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogGeometryRequest.d.ts","sourceRoot":"","sources":["../../src/catalog/catalogGeometryRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAE3E,gFAAgF;AAChF,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,sBAAsB,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG;IACrF,IAAI,EAAE,OAAO,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAChE,IAAI,EAAE,UAAU,CAAC;CACjB,CAAC;AAEF,2FAA2F;AAC3F,MAAM,WAAW,0BAA0B;IAC1C,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;CAClC;AAED,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,GAC5C,uBAAuB,CAMzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogGeometryRequest.js","sourceRoot":"","sources":["../../src/catalog/catalogGeometryRequest.ts"],"names":[],"mappings":"AAcA,MAAM,UAAU,gBAAgB,CAC/B,QAA8C;IAE9C,OAAO;QACN,GAAG,QAAQ;QACX,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,gBAAgB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI;KACxE,CAAC;AACH,CAAC","sourcesContent":["import type { CatalogEndpointAddress } from './CatalogEndpointRegistry.js';\n\n/** Concrete source, resolved by the existing recipe/registry before capture. */\nexport type CatalogGeometryEndpoint = Omit<CatalogEndpointAddress, 'slot' | 'role'> & {\n\tslot: Exclude<CatalogEndpointAddress['slot'], 'detail.summary'>;\n\trole: 'geometry';\n};\n\n/** A retained capture can be retargeted before a concrete destination occurrence binds. */\nexport interface CatalogGeometryDestination {\n\tspatialElementId: string;\n\tkind: 'content' | 'hero' | 'dock';\n}\n\nexport function geometryEndpoint(\n\tendpoint: Omit<CatalogEndpointAddress, 'role'>\n): CatalogGeometryEndpoint {\n\treturn {\n\t\t...endpoint,\n\t\trole: 'geometry',\n\t\tslot: endpoint.slot === 'detail.summary' ? 'detail.hero' : endpoint.slot\n\t};\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SpatialListItem } from '../spatial-element/types.js';
|
|
2
|
+
export declare const CATALOG_ITEMS: unique symbol;
|
|
3
|
+
export declare class CatalogItems {
|
|
4
|
+
private changed;
|
|
5
|
+
private entries;
|
|
6
|
+
constructor(changed: (items: SpatialListItem[]) => void);
|
|
7
|
+
register(item: SpatialListItem): () => void;
|
|
8
|
+
private publish;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=catalogItems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogItems.d.ts","sourceRoot":"","sources":["../../src/catalog/catalogItems.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,eAAO,MAAM,aAAa,eAA0B,CAAC;AACrD,qBAAa,YAAY;IAEZ,OAAO,CAAC,OAAO;IAD3B,OAAO,CAAC,OAAO,CAAsC;gBACjC,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,IAAI;IAC/D,QAAQ,CAAC,IAAI,EAAE,eAAe;IAW9B,OAAO,CAAC,OAAO;CAGf"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const CATALOG_ITEMS = Symbol('catalog-items');
|
|
2
|
+
export class CatalogItems {
|
|
3
|
+
changed;
|
|
4
|
+
entries = new Map();
|
|
5
|
+
constructor(changed) {
|
|
6
|
+
this.changed = changed;
|
|
7
|
+
}
|
|
8
|
+
register(item) {
|
|
9
|
+
if ([...this.entries.values()].some((entry) => entry.occurrence === item.occurrence))
|
|
10
|
+
throw new Error('Duplicate catalog occurrence: ' + item.occurrence);
|
|
11
|
+
const token = Symbol();
|
|
12
|
+
this.entries.set(token, item);
|
|
13
|
+
this.publish();
|
|
14
|
+
return () => {
|
|
15
|
+
this.entries.delete(token);
|
|
16
|
+
this.publish();
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
publish() {
|
|
20
|
+
this.changed([...this.entries.values()]);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=catalogItems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogItems.js","sourceRoot":"","sources":["../../src/catalog/catalogItems.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AACrD,MAAM,OAAO,YAAY;IAEJ;IADZ,OAAO,GAAG,IAAI,GAAG,EAA2B,CAAC;IACrD,YAAoB,OAA2C;QAA3C,YAAO,GAAP,OAAO,CAAoC;IAAG,CAAC;IACnE,QAAQ,CAAC,IAAqB;QAC7B,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU,CAAC;YACnF,MAAM,IAAI,KAAK,CAAC,gCAAgC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QACrE,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,OAAO,GAAG,EAAE;YACX,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;QAChB,CAAC,CAAC;IACH,CAAC;IACO,OAAO;QACd,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1C,CAAC;CACD","sourcesContent":["import type { SpatialListItem } from '../spatial-element/types.js';\nexport const CATALOG_ITEMS = Symbol('catalog-items');\nexport class CatalogItems {\n\tprivate entries = new Map<symbol, SpatialListItem>();\n\tconstructor(private changed: (items: SpatialListItem[]) => void) {}\n\tregister(item: SpatialListItem) {\n\t\tif ([...this.entries.values()].some((entry) => entry.occurrence === item.occurrence))\n\t\t\tthrow new Error('Duplicate catalog occurrence: ' + item.occurrence);\n\t\tconst token = Symbol();\n\t\tthis.entries.set(token, item);\n\t\tthis.publish();\n\t\treturn () => {\n\t\t\tthis.entries.delete(token);\n\t\t\tthis.publish();\n\t\t};\n\t}\n\tprivate publish() {\n\t\tthis.changed([...this.entries.values()]);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CatalogEndpointAddress, CatalogIdentity } from './CatalogEndpointRegistry.js';
|
|
2
|
+
import { type CatalogNavigationIntent } from './catalogRecipes.js';
|
|
3
|
+
/** Optional enhancement on an ordinary anchor; URLs remain authoritative. */
|
|
4
|
+
export interface CatalogViewContext {
|
|
5
|
+
spatialElementId?: string;
|
|
6
|
+
sourceSection?: string;
|
|
7
|
+
targetSection?: string;
|
|
8
|
+
sourceOccurrence?: string;
|
|
9
|
+
targetOccurrence?: string;
|
|
10
|
+
}
|
|
11
|
+
export type CatalogJourney = {
|
|
12
|
+
kind: 'spatialElement';
|
|
13
|
+
intent: CatalogNavigationIntent;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'content-view';
|
|
16
|
+
brandId: string;
|
|
17
|
+
history: boolean;
|
|
18
|
+
section?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function resolveCatalogJourney(from: URL, to: URL, type: string): CatalogJourney | undefined;
|
|
21
|
+
export interface CatalogParticipantEndpoint extends CatalogEndpointAddress {
|
|
22
|
+
role: 'geometry';
|
|
23
|
+
sectionId?: string;
|
|
24
|
+
/** Explicit authored order, never DOM registration order. */
|
|
25
|
+
order: number;
|
|
26
|
+
eligible: boolean;
|
|
27
|
+
prepared: boolean;
|
|
28
|
+
selected?: boolean;
|
|
29
|
+
focused?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface CatalogParticipantPair {
|
|
32
|
+
identity: CatalogIdentity;
|
|
33
|
+
source: CatalogParticipantEndpoint;
|
|
34
|
+
target: CatalogParticipantEndpoint;
|
|
35
|
+
}
|
|
36
|
+
/** Pure, frozen pairing. Ambiguous occurrences never borrow another element's panel. */
|
|
37
|
+
export declare function planCatalogParticipants(sources: readonly CatalogParticipantEndpoint[], targets: readonly CatalogParticipantEndpoint[], context?: CatalogViewContext, limit?: number): CatalogParticipantPair[];
|
|
38
|
+
//# sourceMappingURL=catalogJourney.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogJourney.d.ts","sourceRoot":"","sources":["../../src/catalog/catalogJourney.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EAAwB,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEzF,6EAA6E;AAC7E,MAAM,WAAW,kBAAkB;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,cAAc,GACvB;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,uBAAuB,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjF,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,GAAG,EACT,EAAE,EAAE,GAAG,EACP,IAAI,EAAE,MAAM,GACV,cAAc,GAAG,SAAS,CAqB5B;AAED,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;IACzE,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACtC,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,0BAA0B,CAAC;IACnC,MAAM,EAAE,0BAA0B,CAAC;CACnC;AAED,wFAAwF;AACxF,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,SAAS,0BAA0B,EAAE,EAC9C,OAAO,EAAE,SAAS,0BAA0B,EAAE,EAC9C,OAAO,GAAE,kBAAuB,EAChC,KAAK,SAAI,GACP,sBAAsB,EAAE,CAsC1B"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { resolveCatalogIntent } from './catalogRecipes.js';
|
|
2
|
+
export function resolveCatalogJourney(from, to, type) {
|
|
3
|
+
const intent = resolveCatalogIntent(from, to, type);
|
|
4
|
+
if (intent)
|
|
5
|
+
return { kind: 'spatialElement', intent };
|
|
6
|
+
if (from.origin !== to.origin || (from.pathname === to.pathname && from.search === to.search))
|
|
7
|
+
return;
|
|
8
|
+
const pattern = /^\/([^/]+)\/categories\/(?:list|carousel|mixed)\/?$/;
|
|
9
|
+
const source = pattern.exec(from.pathname), target = pattern.exec(to.pathname);
|
|
10
|
+
if (!source || !target)
|
|
11
|
+
return;
|
|
12
|
+
try {
|
|
13
|
+
const brandId = decodeURIComponent(source[1]);
|
|
14
|
+
if (brandId !== decodeURIComponent(target[1]))
|
|
15
|
+
return;
|
|
16
|
+
return {
|
|
17
|
+
kind: 'content-view',
|
|
18
|
+
brandId,
|
|
19
|
+
history: type === 'popstate',
|
|
20
|
+
section: to.hash ? decodeURIComponent(to.hash.slice(1)) : undefined
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Pure, frozen pairing. Ambiguous occurrences never borrow another element's panel. */
|
|
28
|
+
export function planCatalogParticipants(sources, targets, context = {}, limit = 5) {
|
|
29
|
+
const source = sources.filter((p) => p.eligible &&
|
|
30
|
+
p.prepared &&
|
|
31
|
+
(!context.sourceSection || p.sectionId === context.sourceSection) &&
|
|
32
|
+
(!context.sourceOccurrence || p.occurrence === context.sourceOccurrence));
|
|
33
|
+
const target = targets.filter((p) => p.eligible &&
|
|
34
|
+
p.prepared &&
|
|
35
|
+
(!context.targetSection || p.sectionId === context.targetSection) &&
|
|
36
|
+
(!context.targetOccurrence || p.occurrence === context.targetOccurrence));
|
|
37
|
+
const key = (p) => JSON.stringify([p.brandId, p.spatialElementId]);
|
|
38
|
+
const pairs = [];
|
|
39
|
+
for (const p of source) {
|
|
40
|
+
if (source.filter((other) => key(other) === key(p)).length !== 1)
|
|
41
|
+
continue;
|
|
42
|
+
const matches = target.filter((other) => key(other) === key(p));
|
|
43
|
+
if (matches.length !== 1)
|
|
44
|
+
continue;
|
|
45
|
+
pairs.push({
|
|
46
|
+
identity: { brandId: p.brandId, spatialElementId: p.spatialElementId },
|
|
47
|
+
source: { ...p },
|
|
48
|
+
target: { ...matches[0] }
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const activated = pairs.filter((p) => p.source.selected || p.source.focused);
|
|
52
|
+
const primary = context.spatialElementId
|
|
53
|
+
? pairs.find((p) => p.identity.spatialElementId === context.spatialElementId)
|
|
54
|
+
: activated.length === 1
|
|
55
|
+
? activated[0]
|
|
56
|
+
: [...pairs].sort((a, b) => a.source.order - b.source.order)[0];
|
|
57
|
+
if (!primary || !Number.isFinite(limit) || limit < 1)
|
|
58
|
+
return [];
|
|
59
|
+
return [
|
|
60
|
+
primary,
|
|
61
|
+
...pairs.filter((p) => p !== primary).sort((a, b) => a.source.order - b.source.order)
|
|
62
|
+
].slice(0, Math.min(5, Math.floor(limit)));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=catalogJourney.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogJourney.js","sourceRoot":"","sources":["../../src/catalog/catalogJourney.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAgC,MAAM,qBAAqB,CAAC;AAezF,MAAM,UAAU,qBAAqB,CACpC,IAAS,EACT,EAAO,EACP,IAAY;IAEZ,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IACpD,IAAI,MAAM;QAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC;IACtD,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,EAAE,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM,CAAC;QAC5F,OAAO;IACR,MAAM,OAAO,GAAG,qDAAqD,CAAC;IACtE,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,E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AC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,gBAAgB,KAAK,OAAO,CAAC,gBAAgB,CAAC;QAC7E,CAAC,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;YACvB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YACd,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAChE,OAAO;QACN,OAAO;QACP,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;KACrF,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import type { CatalogEndpointAddress, CatalogIdentity } from './CatalogEndpointRegistry.js';\nimport { resolveCatalogIntent, type CatalogNavigationIntent } from './catalogRecipes.js';\n\n/** Optional enhancement on an ordinary anchor; URLs remain authoritative. */\nexport interface CatalogViewContext {\n\tspatialElementId?: string;\n\tsourceSection?: string;\n\ttargetSection?: string;\n\tsourceOccurrence?: string;\n\ttargetOccurrence?: string;\n}\n\nexport type CatalogJourney =\n\t| { kind: 'spatialElement'; intent: CatalogNavigationIntent }\n\t| { kind: 'content-view'; brandId: string; history: boolean; section?: string };\n\nexport function resolveCatalogJourney(\n\tfrom: URL,\n\tto: URL,\n\ttype: string\n): CatalogJourney | undefined {\n\tconst intent = resolveCatalogIntent(from, to, type);\n\tif (intent) return { kind: 'spatialElement', intent };\n\tif (from.origin !== to.origin || (from.pathname === to.pathname && from.search === to.search))\n\t\treturn;\n\tconst pattern = /^\\/([^/]+)\\/categories\\/(?:list|carousel|mixed)\\/?$/;\n\tconst source = pattern.exec(from.pathname),\n\t\ttarget = pattern.exec(to.pathname);\n\tif (!source || !target) return;\n\ttry {\n\t\tconst brandId = decodeURIComponent(source[1]);\n\t\tif (brandId !== decodeURIComponent(target[1])) return;\n\t\treturn {\n\t\t\tkind: 'content-view',\n\t\t\tbrandId,\n\t\t\thistory: type === 'popstate',\n\t\t\tsection: to.hash ? decodeURIComponent(to.hash.slice(1)) : undefined\n\t\t};\n\t} catch {\n\t\treturn;\n\t}\n}\n\nexport interface CatalogParticipantEndpoint extends CatalogEndpointAddress {\n\trole: 'geometry';\n\tsectionId?: string;\n\t/** Explicit authored order, never DOM registration order. */\n\torder: number;\n\teligible: boolean;\n\tprepared: boolean;\n\tselected?: boolean;\n\tfocused?: boolean;\n}\n\nexport interface CatalogParticipantPair {\n\tidentity: CatalogIdentity;\n\tsource: CatalogParticipantEndpoint;\n\ttarget: CatalogParticipantEndpoint;\n}\n\n/** Pure, frozen pairing. Ambiguous occurrences never borrow another element's panel. */\nexport function planCatalogParticipants(\n\tsources: readonly CatalogParticipantEndpoint[],\n\ttargets: readonly CatalogParticipantEndpoint[],\n\tcontext: CatalogViewContext = {},\n\tlimit = 5\n): CatalogParticipantPair[] {\n\tconst source = sources.filter(\n\t\t(p) =>\n\t\t\tp.eligible &&\n\t\t\tp.prepared &&\n\t\t\t(!context.sourceSection || p.sectionId === context.sourceSection) &&\n\t\t\t(!context.sourceOccurrence || p.occurrence === context.sourceOccurrence)\n\t);\n\tconst target = targets.filter(\n\t\t(p) =>\n\t\t\tp.eligible &&\n\t\t\tp.prepared &&\n\t\t\t(!context.targetSection || p.sectionId === context.targetSection) &&\n\t\t\t(!context.targetOccurrence || p.occurrence === context.targetOccurrence)\n\t);\n\tconst key = (p: CatalogIdentity) => JSON.stringify([p.brandId, p.spatialElementId]);\n\tconst pairs: CatalogParticipantPair[] = [];\n\tfor (const p of source) {\n\t\tif (source.filter((other) => key(other) === key(p)).length !== 1) continue;\n\t\tconst matches = target.filter((other) => key(other) === key(p));\n\t\tif (matches.length !== 1) continue;\n\t\tpairs.push({\n\t\t\tidentity: { brandId: p.brandId, spatialElementId: p.spatialElementId },\n\t\t\tsource: { ...p },\n\t\t\ttarget: { ...matches[0] }\n\t\t});\n\t}\n\tconst activated = pairs.filter((p) => p.source.selected || p.source.focused);\n\tconst primary = context.spatialElementId\n\t\t? pairs.find((p) => p.identity.spatialElementId === context.spatialElementId)\n\t\t: activated.length === 1\n\t\t\t? activated[0]\n\t\t\t: [...pairs].sort((a, b) => a.source.order - b.source.order)[0];\n\tif (!primary || !Number.isFinite(limit) || limit < 1) return [];\n\treturn [\n\t\tprimary,\n\t\t...pairs.filter((p) => p !== primary).sort((a, b) => a.source.order - b.source.order)\n\t].slice(0, Math.min(5, Math.floor(limit)));\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SpatialListItem, SpatialStageConfig } from '../spatial-element/types.js';
|
|
2
|
+
/** URL-derived view selection; scroll and transition progress live in separate controllers. */
|
|
3
|
+
export interface CatalogPage {
|
|
4
|
+
brandId: string;
|
|
5
|
+
/** `list` is retained as a legacy alias; content routes can contain several spatial sections. */
|
|
6
|
+
view: 'content' | 'list' | 'detail';
|
|
7
|
+
spatialElementId?: string;
|
|
8
|
+
spatialElementStage?: SpatialStageConfig;
|
|
9
|
+
spatialElements: SpatialListItem[];
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=catalogPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogPage.d.ts","sourceRoot":"","sources":["../../src/catalog/catalogPage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEvF,+FAA+F;AAC/F,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,iGAAiG;IACjG,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,kBAAkB,CAAC;IACzC,eAAe,EAAE,eAAe,EAAE,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogPage.js","sourceRoot":"","sources":["../../src/catalog/catalogPage.ts"],"names":[],"mappings":"","sourcesContent":["import type { SpatialListItem, SpatialStageConfig } from '../spatial-element/types.js';\n\n/** URL-derived view selection; scroll and transition progress live in separate controllers. */\nexport interface CatalogPage {\n\tbrandId: string;\n\t/** `list` is retained as a legacy alias; content routes can contain several spatial sections. */\n\tview: 'content' | 'list' | 'detail';\n\tspatialElementId?: string;\n\tspatialElementStage?: SpatialStageConfig;\n\tspatialElements: SpatialListItem[];\n}\n"]}
|