@spatial-elements/core 1.0.0-beta.4 → 1.0.0-beta.6

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 (120) hide show
  1. package/README.md +1 -1
  2. package/dist/catalog/CarouselGlassCompositor.d.ts +7 -2
  3. package/dist/catalog/CarouselGlassCompositor.d.ts.map +1 -1
  4. package/dist/catalog/CarouselGlassCompositor.js +85 -24
  5. package/dist/catalog/CarouselGlassCompositor.js.map +1 -1
  6. package/dist/catalog/CarouselGround.d.ts +21 -0
  7. package/dist/catalog/CarouselGround.d.ts.map +1 -0
  8. package/dist/catalog/CarouselGround.js +107 -0
  9. package/dist/catalog/CarouselGround.js.map +1 -0
  10. package/dist/catalog/CatalogDepthBlur.d.ts +26 -0
  11. package/dist/catalog/CatalogDepthBlur.d.ts.map +1 -0
  12. package/dist/catalog/CatalogDepthBlur.js +87 -0
  13. package/dist/catalog/CatalogDepthBlur.js.map +1 -0
  14. package/dist/catalog/CatalogModelOutline.d.ts +31 -0
  15. package/dist/catalog/CatalogModelOutline.d.ts.map +1 -0
  16. package/dist/catalog/CatalogModelOutline.js +127 -0
  17. package/dist/catalog/CatalogModelOutline.js.map +1 -0
  18. package/dist/catalog/CatalogSpatialElementLayer.d.ts +29 -2
  19. package/dist/catalog/CatalogSpatialElementLayer.d.ts.map +1 -1
  20. package/dist/catalog/CatalogSpatialElementLayer.js +170 -41
  21. package/dist/catalog/CatalogSpatialElementLayer.js.map +1 -1
  22. package/dist/catalog/CatalogTransition.d.ts.map +1 -1
  23. package/dist/catalog/CatalogTransition.js +49 -4
  24. package/dist/catalog/CatalogTransition.js.map +1 -1
  25. package/dist/catalog/SpatialGeometryCapture.d.ts +9 -0
  26. package/dist/catalog/SpatialGeometryCapture.d.ts.map +1 -1
  27. package/dist/catalog/SpatialGeometryCapture.js +11 -1
  28. package/dist/catalog/SpatialGeometryCapture.js.map +1 -1
  29. package/dist/catalog/cardModelFit.d.ts +7 -0
  30. package/dist/catalog/cardModelFit.d.ts.map +1 -0
  31. package/dist/catalog/cardModelFit.js +16 -0
  32. package/dist/catalog/cardModelFit.js.map +1 -0
  33. package/dist/catalog/cardProjection.d.ts +8 -0
  34. package/dist/catalog/cardProjection.d.ts.map +1 -0
  35. package/dist/catalog/cardProjection.js +51 -0
  36. package/dist/catalog/cardProjection.js.map +1 -0
  37. package/dist/catalog/carouselMotion.d.ts +35 -0
  38. package/dist/catalog/carouselMotion.d.ts.map +1 -1
  39. package/dist/catalog/carouselMotion.js +85 -4
  40. package/dist/catalog/carouselMotion.js.map +1 -1
  41. package/dist/catalog/carouselProximity.d.ts +11 -0
  42. package/dist/catalog/carouselProximity.d.ts.map +1 -0
  43. package/dist/catalog/carouselProximity.js +13 -0
  44. package/dist/catalog/carouselProximity.js.map +1 -0
  45. package/dist/catalog/carouselSupport.d.ts +4 -0
  46. package/dist/catalog/carouselSupport.d.ts.map +1 -0
  47. package/dist/catalog/carouselSupport.js +30 -0
  48. package/dist/catalog/carouselSupport.js.map +1 -0
  49. package/dist/catalog/catalogPose.d.ts +36 -6
  50. package/dist/catalog/catalogPose.d.ts.map +1 -1
  51. package/dist/catalog/catalogPose.js +79 -23
  52. package/dist/catalog/catalogPose.js.map +1 -1
  53. package/dist/spatial-element/SpatialElementDockController.d.ts +1 -1
  54. package/dist/spatial-element/SpatialElementDockController.d.ts.map +1 -1
  55. package/dist/spatial-element/SpatialElementDockController.js +29 -2
  56. package/dist/spatial-element/SpatialElementDockController.js.map +1 -1
  57. package/dist/spatial-element/messages.d.ts +2 -0
  58. package/dist/spatial-element/messages.d.ts.map +1 -1
  59. package/dist/spatial-element/messages.js +1 -1
  60. package/dist/spatial-element/messages.js.map +1 -1
  61. package/dist/spatial-element/spatialTheme.d.ts.map +1 -1
  62. package/dist/spatial-element/spatialTheme.js +1 -0
  63. package/dist/spatial-element/spatialTheme.js.map +1 -1
  64. package/dist/spatial-element/types.d.ts +2 -0
  65. package/dist/spatial-element/types.d.ts.map +1 -1
  66. package/dist/spatial-element/types.js.map +1 -1
  67. package/dist/stage/LiquidGlassPanel.d.ts +2 -0
  68. package/dist/stage/LiquidGlassPanel.d.ts.map +1 -1
  69. package/dist/stage/LiquidGlassPanel.js +8 -1
  70. package/dist/stage/LiquidGlassPanel.js.map +1 -1
  71. package/dist/stage/MinimapController.d.ts +3 -1
  72. package/dist/stage/MinimapController.d.ts.map +1 -1
  73. package/dist/stage/MinimapController.js +23 -20
  74. package/dist/stage/MinimapController.js.map +1 -1
  75. package/dist/stage/PageBindingController.d.ts +4 -0
  76. package/dist/stage/PageBindingController.d.ts.map +1 -1
  77. package/dist/stage/PageBindingController.js +15 -4
  78. package/dist/stage/PageBindingController.js.map +1 -1
  79. package/dist/stage/PanelPresentationController.d.ts +1 -0
  80. package/dist/stage/PanelPresentationController.d.ts.map +1 -1
  81. package/dist/stage/PanelPresentationController.js +38 -7
  82. package/dist/stage/PanelPresentationController.js.map +1 -1
  83. package/dist/stage/SpatialElementInteractionController.d.ts +2 -0
  84. package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -1
  85. package/dist/stage/SpatialElementInteractionController.js +23 -5
  86. package/dist/stage/SpatialElementInteractionController.js.map +1 -1
  87. package/dist/stage/StageExperience.d.ts +58 -1
  88. package/dist/stage/StageExperience.d.ts.map +1 -1
  89. package/dist/stage/StageExperience.js +112 -19
  90. package/dist/stage/StageExperience.js.map +1 -1
  91. package/dist/stage/StageFullscreenController.d.ts +17 -0
  92. package/dist/stage/StageFullscreenController.d.ts.map +1 -0
  93. package/dist/stage/StageFullscreenController.js +90 -0
  94. package/dist/stage/StageFullscreenController.js.map +1 -0
  95. package/dist/stage/StageRenderPipeline.d.ts +6 -0
  96. package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
  97. package/dist/stage/StageRenderPipeline.js +46 -65
  98. package/dist/stage/StageRenderPipeline.js.map +1 -1
  99. package/dist/stage/VirtualScrollController.d.ts.map +1 -1
  100. package/dist/stage/VirtualScrollController.js +6 -0
  101. package/dist/stage/VirtualScrollController.js.map +1 -1
  102. package/dist/stage/interactionOutline.d.ts +14 -0
  103. package/dist/stage/interactionOutline.d.ts.map +1 -0
  104. package/dist/stage/interactionOutline.js +81 -0
  105. package/dist/stage/interactionOutline.js.map +1 -0
  106. package/dist/stage/minimap/MinimapProjection.d.ts +7 -0
  107. package/dist/stage/minimap/MinimapProjection.d.ts.map +1 -1
  108. package/dist/stage/minimap/MinimapProjection.js +14 -13
  109. package/dist/stage/minimap/MinimapProjection.js.map +1 -1
  110. package/dist/stage/panelContext.d.ts +9 -0
  111. package/dist/stage/panelContext.d.ts.map +1 -1
  112. package/dist/stage/panelContext.js.map +1 -1
  113. package/dist/stage/stageDom.d.ts +2 -0
  114. package/dist/stage/stageDom.d.ts.map +1 -1
  115. package/dist/stage/stageDom.js +4 -0
  116. package/dist/stage/stageDom.js.map +1 -1
  117. package/dist/stage/stageVisualTest.d.ts +2 -0
  118. package/dist/stage/stageVisualTest.d.ts.map +1 -1
  119. package/dist/stage/stageVisualTest.js.map +1 -1
  120. package/package.json +1 -1
@@ -0,0 +1,81 @@
1
+ import * as THREE from 'three/webgpu';
2
+ import { Fn, float, If, max as tslMax, min as tslMin, uniform, uv, vec2 } from 'three/tsl';
3
+ import { getMeshMaterials } from './stageSceneUtils.js';
4
+ export function isOutlineMesh(mesh, theme) {
5
+ if (theme.excludeMesh?.(mesh) || mesh.userData.stagePick === false || mesh.userData.stageOutline === false)
6
+ return false;
7
+ const materials = getMeshMaterials(mesh).map(material => material.name).filter(Boolean).join(' ');
8
+ return !/(shadow|ground|floor|plane|helper|collision|collider|reflection)/i.test(`${mesh.name} ${materials}`);
9
+ }
10
+ export function createOutlineUniforms() {
11
+ return {
12
+ color: uniform(new THREE.Color()),
13
+ strength: uniform(0), glow: uniform(0), opacityScale: uniform(1),
14
+ texel: uniform(new THREE.Vector2()), glowTexel: uniform(new THREE.Vector2())
15
+ };
16
+ }
17
+ /** Shared silhouette and outer halo for detail and catalog geometry. */
18
+ export function createOutlineOpacity(mask, controls, unconditional = false) {
19
+ const calculate = () => {
20
+ const texel = controls.texel;
21
+ const glowTexel = controls.glowTexel;
22
+ const sampleMaskRing = (sampleTexel, scale = 1) => {
23
+ const centerUv = uv();
24
+ const sampleX = sampleTexel.x.mul(scale);
25
+ const sampleY = sampleTexel.y.mul(scale);
26
+ const left = mask.sample(centerUv.sub(vec2(sampleX, 0))).r;
27
+ const right = mask.sample(centerUv.add(vec2(sampleX, 0))).r;
28
+ const up = mask.sample(centerUv.add(vec2(0, sampleY))).r;
29
+ const down = mask.sample(centerUv.sub(vec2(0, sampleY))).r;
30
+ const upLeft = mask.sample(centerUv.add(vec2(0, sampleY)).sub(vec2(sampleX, 0))).r;
31
+ const upRight = mask.sample(centerUv.add(vec2(sampleX, sampleY))).r;
32
+ const downLeft = mask.sample(centerUv.sub(vec2(sampleX, sampleY))).r;
33
+ const downRight = mask.sample(centerUv.add(vec2(sampleX, 0)).sub(vec2(0, sampleY))).r;
34
+ return {
35
+ average: left
36
+ .add(right)
37
+ .add(up)
38
+ .add(down)
39
+ .add(upLeft)
40
+ .add(upRight)
41
+ .add(downLeft)
42
+ .add(downRight)
43
+ .div(8),
44
+ max: tslMax(tslMax(tslMax(left, right), tslMax(up, down)), tslMax(tslMax(upLeft, upRight), tslMax(downLeft, downRight))),
45
+ min: tslMin(tslMin(tslMin(left, right), tslMin(up, down)), tslMin(tslMin(upLeft, upRight), tslMin(downLeft, downRight)))
46
+ };
47
+ };
48
+ const edgeNeighbor = sampleMaskRing(texel);
49
+ const glowNearNeighbor = sampleMaskRing(glowTexel, 0.45);
50
+ const glowMidNeighbor = sampleMaskRing(glowTexel, 0.7);
51
+ const glowFarNeighbor = sampleMaskRing(glowTexel);
52
+ const center = mask.sample(uv()).r;
53
+ const outside = center.oneMinus();
54
+ const edgeGradient = edgeNeighbor.max.sub(center).max(0);
55
+ const core = edgeGradient.mul(controls.strength);
56
+ // Average neighbouring coverage, rather than dilating a solid band. Keep the
57
+ // halo outside the spatialElement so it cannot be mistaken for painted geometry.
58
+ const glowNear = glowNearNeighbor.average
59
+ .mul(outside)
60
+ .mul(controls.glow.mul(0.6));
61
+ const glowMid = glowMidNeighbor.average
62
+ .mul(outside)
63
+ .mul(controls.glow.mul(0.3));
64
+ const glowFar = glowFarNeighbor.average
65
+ .mul(outside)
66
+ .mul(controls.glow.mul(0.1));
67
+ const opacity = tslMin(core.add(glowNear).add(glowMid).add(glowFar), 1).mul(controls.opacityScale);
68
+ return opacity;
69
+ };
70
+ if (unconditional)
71
+ return calculate();
72
+ return Fn(() => {
73
+ const opacity = float(0).toVar();
74
+ // A fully covered pixel has zero outer halo. Skip all 32 neighbour taps there.
75
+ If(mask.sample(uv()).r.lessThan(1), () => {
76
+ opacity.assign(calculate());
77
+ });
78
+ return opacity;
79
+ })();
80
+ }
81
+ //# sourceMappingURL=interactionOutline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactionOutline.js","sourceRoot":"","sources":["../../src/stage/interactionOutline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,IAAI,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD,MAAM,UAAU,aAAa,CAAC,IAAgB,EAAE,KAA4B;IAC3E,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,KAAK,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IACzH,MAAM,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAA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from 'three/tsl';\nimport { getMeshMaterials } from './stageSceneUtils.js';\nimport type { StageInteractionTheme } from './stageTypes.js';\n\nexport function isOutlineMesh(mesh: THREE.Mesh, theme: StageInteractionTheme) {\n\tif (theme.excludeMesh?.(mesh) || mesh.userData.stagePick === false || mesh.userData.stageOutline === false) return false;\n\tconst materials = getMeshMaterials(mesh).map(material => material.name).filter(Boolean).join(' ');\n\treturn !/(shadow|ground|floor|plane|helper|collision|collider|reflection)/i.test(`${mesh.name} ${materials}`);\n}\n\nexport function createOutlineUniforms() {\n\treturn {\n\t\tcolor: uniform(new THREE.Color()),\n\t\tstrength: uniform(0), glow: uniform(0), opacityScale: uniform(1),\n\t\ttexel: uniform(new THREE.Vector2()), glowTexel: uniform(new THREE.Vector2())\n\t};\n}\n\n/** Shared silhouette and outer halo for detail and catalog geometry. */\nexport function createOutlineOpacity(mask: THREE.TextureNode, controls: ReturnType<typeof createOutlineUniforms>, unconditional = false) {\n\tconst calculate = () => {\n\t\tconst texel = controls.texel;\n\t\tconst glowTexel = controls.glowTexel;\n\t\tconst sampleMaskRing = (sampleTexel: typeof texel, scale = 1) => {\n\t\t\tconst centerUv = uv();\n\t\t\tconst sampleX = sampleTexel.x.mul(scale);\n\t\t\tconst sampleY = sampleTexel.y.mul(scale);\n\t\t\tconst left = mask.sample(centerUv.sub(vec2(sampleX, 0))).r;\n\t\t\tconst right = mask.sample(centerUv.add(vec2(sampleX, 0))).r;\n\t\t\tconst up = mask.sample(centerUv.add(vec2(0, sampleY))).r;\n\t\t\tconst down = mask.sample(centerUv.sub(vec2(0, sampleY))).r;\n\t\t\tconst upLeft = mask.sample(centerUv.add(vec2(0, sampleY)).sub(vec2(sampleX, 0))).r;\n\t\t\tconst upRight = mask.sample(centerUv.add(vec2(sampleX, sampleY))).r;\n\t\t\tconst downLeft = mask.sample(centerUv.sub(vec2(sampleX, sampleY))).r;\n\t\t\tconst downRight = mask.sample(centerUv.add(vec2(sampleX, 0)).sub(vec2(0, sampleY))).r;\n\n\t\t\treturn {\n\t\t\t\taverage: left\n\t\t\t\t\t.add(right)\n\t\t\t\t\t.add(up)\n\t\t\t\t\t.add(down)\n\t\t\t\t\t.add(upLeft)\n\t\t\t\t\t.add(upRight)\n\t\t\t\t\t.add(downLeft)\n\t\t\t\t\t.add(downRight)\n\t\t\t\t\t.div(8),\n\t\t\t\tmax: tslMax(\n\t\t\t\t\ttslMax(tslMax(left, right), tslMax(up, down)),\n\t\t\t\t\ttslMax(tslMax(upLeft, upRight), tslMax(downLeft, downRight))\n\t\t\t\t),\n\t\t\t\tmin: tslMin(\n\t\t\t\t\ttslMin(tslMin(left, right), tslMin(up, down)),\n\t\t\t\t\ttslMin(tslMin(upLeft, upRight), tslMin(downLeft, downRight))\n\t\t\t\t)\n\t\t\t};\n\t\t};\n\t\tconst edgeNeighbor = sampleMaskRing(texel);\n\t\tconst glowNearNeighbor = sampleMaskRing(glowTexel, 0.45);\n\t\tconst glowMidNeighbor = sampleMaskRing(glowTexel, 0.7);\n\t\tconst glowFarNeighbor = sampleMaskRing(glowTexel);\n\t\tconst center = mask.sample(uv()).r;\n\t\tconst outside = center.oneMinus();\n\t\tconst edgeGradient = edgeNeighbor.max.sub(center).max(0);\n\t\tconst core = edgeGradient.mul(controls.strength);\n\t\t// Average neighbouring coverage, rather than dilating a solid band. Keep the\n\t\t// halo outside the spatialElement so it cannot be mistaken for painted geometry.\n\t\tconst glowNear = glowNearNeighbor.average\n\t\t\t.mul(outside)\n\t\t\t.mul(controls.glow.mul(0.6));\n\t\tconst glowMid = glowMidNeighbor.average\n\t\t\t.mul(outside)\n\t\t\t.mul(controls.glow.mul(0.3));\n\t\tconst glowFar = glowFarNeighbor.average\n\t\t\t.mul(outside)\n\t\t\t.mul(controls.glow.mul(0.1));\n\t\tconst opacity = tslMin(core.add(glowNear).add(glowMid).add(glowFar), 1).mul(\n\t\t\tcontrols.opacityScale\n\t\t);\n\n\t\treturn opacity;\n\t};\n\tif (unconditional) return calculate();\n\treturn Fn(() => {\n\t\tconst opacity = float(0).toVar();\n\t\t// A fully covered pixel has zero outer halo. Skip all 32 neighbour taps there.\n\t\tIf(mask.sample(uv()).r.lessThan(1), () => {\n\t\t\topacity.assign(calculate());\n\t\t});\n\t\treturn opacity;\n\t})();\n}\n"]}
@@ -36,6 +36,13 @@ export interface MinimapViewportRect {
36
36
  * panel in screen space.
37
37
  */
38
38
  export declare function getMinimapViewportRect(stageCamera: THREE.PerspectiveCamera, minimapCamera: THREE.PerspectiveCamera, target: THREE.Vector3, stageModel: Object3D, minimapSourceRoot: Object3D, minimapSourceLayer: Object3D, width: number, height: number): MinimapViewportRect | null;
39
+ /** Intersects the projected view with the panel without scaling or shifting it. */
40
+ export declare function clipMinimapViewportRect(rect: MinimapViewportRect, width: number, height: number): {
41
+ left: number;
42
+ top: number;
43
+ width: number;
44
+ height: number;
45
+ };
39
46
  /** Normalizes a CSS blur radius before it is passed to the WebGPU blur pipeline. */
40
47
  export declare function getMinimapCssBlurRadius(blur: number): number;
41
48
  //# sourceMappingURL=MinimapProjection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MinimapProjection.d.ts","sourceRoot":"","sources":["../../../src/stage/minimap/MinimapProjection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,WAAW,iBAAiB;IACjC,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,SAAS,iBAAiB,EAAE,EACpC,KAAK,SAAK,EACV,WAAW,SAAO;;;EAqBlB;AAED,y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,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAI3E;AAED,oFAAoF;AACpF,MAAM,WAAW,mBAAmB;IACnC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACrC,WAAW,EAAE,KAAK,CAAC,iBAAiB,EACpC,aAAa,EAAE,KAAK,CAAC,iBAAiB,EACtC,MAAM,EAAE,KAAK,CAAC,OAAO,EACrB,UAAU,EAAE,QAAQ,EACpB,iBAAiB,EAAE,QAAQ,EAC3B,kBAAkB,EAAE,QAAQ,EAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACZ,mBAAmB,GAAG,IAAI,CAiE5B;AAED,mFAAmF;AACnF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;EAM/F;AAED,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,UAEnD"}
@@ -82,30 +82,31 @@ export function getMinimapViewportRect(stageCamera, minimapCamera, target, stage
82
82
  const maxY = Math.max(...projected.map((point) => point.y));
83
83
  const centerX = (minX + maxX) * 0.5;
84
84
  const centerY = (minY + maxY) * 0.5;
85
- let rectWidth = maxX - minX;
86
- let rectHeight = maxY - minY;
85
+ const rectWidth = maxX - minX;
86
+ const rectHeight = maxY - minY;
87
87
  if (!Number.isFinite(rectWidth) ||
88
88
  !Number.isFinite(rectHeight) ||
89
89
  rectWidth <= 0 ||
90
90
  rectHeight <= 0) {
91
91
  return null;
92
92
  }
93
- const minSize = 8;
94
- const minScale = Math.max(minSize / rectWidth, minSize / rectHeight, 1);
95
- rectWidth *= minScale;
96
- rectHeight *= minScale;
97
- const fitScale = Math.min(width / rectWidth, height / rectHeight, 1);
98
- rectWidth *= fitScale;
99
- rectHeight *= fitScale;
100
- const maxCenterX = Math.max((width - rectWidth) * 0.5, 0);
101
- const maxCenterY = Math.max((height - rectHeight) * 0.5, 0);
93
+ // Preserve the true footprint, including edges outside the minimap. Fitting
94
+ // it into the panel would falsely crop the model on wide/tall viewports.
102
95
  return {
103
- x: THREE.MathUtils.clamp(centerX, -maxCenterX, maxCenterX),
104
- y: THREE.MathUtils.clamp(centerY, -maxCenterY, maxCenterY),
96
+ x: centerX,
97
+ y: centerY,
105
98
  width: rectWidth,
106
99
  height: rectHeight
107
100
  };
108
101
  }
102
+ /** Intersects the projected view with the panel without scaling or shifting it. */
103
+ export function clipMinimapViewportRect(rect, width, height) {
104
+ const left = THREE.MathUtils.clamp(width * 0.5 + rect.x - rect.width * 0.5, 0, width);
105
+ const right = THREE.MathUtils.clamp(width * 0.5 + rect.x + rect.width * 0.5, 0, width);
106
+ const top = THREE.MathUtils.clamp(height * 0.5 - rect.y - rect.height * 0.5, 0, height);
107
+ const bottom = THREE.MathUtils.clamp(height * 0.5 - rect.y + rect.height * 0.5, 0, height);
108
+ return { left, top, width: right - left, height: bottom - top };
109
+ }
109
110
  /** Normalizes a CSS blur radius before it is passed to the WebGPU blur pipeline. */
110
111
  export function getMinimapCssBlurRadius(blur) {
111
112
  return Math.max(blur, 0);
@@ -1 +1 @@
1
- {"version":3,"file":"MinimapProjection.js","sourceRoot":"","sources":["../../../src/stage/minimap/MinimapProjection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAU/D;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CACnC,MAAoC,EACpC,KAAK,GAAG,EAAE,EACV,WAAW,GAAG,IAAI;IAElB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CA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js';\nexport type { CssProjectionPoint, CssProjectionQuad } from '../cssProjection.js';\n\nexport interface MinimapDepthBound {\n\t/** Positive camera-space distance to the bound's center. */\n\tdistance: number;\n\t/** Camera-space radius that must remain inside the clipping range. */\n\tradius: number;\n}\n\n/**\n * Fits a compact clipping range around the panel and live minimap model.\n *\n * The regular panel camera spans thousands of world units. Reusing that range\n * for thumbnail geometry collapses closely layered element surfaces into the\n * same depth values, so a small pointer tilt can make their fragments alternate.\n */\nexport function getMinimapDepthRange(\n\tbounds: readonly MinimapDepthBound[],\n\tguard = 16,\n\tminimumNear = 0.01\n) {\n\tconst safeGuard = Math.max(Number.isFinite(guard) ? guard : 0, 0);\n\tconst safeMinimumNear = Math.max(Number.isFinite(minimumNear) ? minimumNear : 0.01, 0.000001);\n\tlet near = Number.POSITIVE_INFINITY;\n\tlet far = Number.NEGATIVE_INFINITY;\n\n\tbounds.forEach(({ distance, radius }) => {\n\t\tif (!Number.isFinite(distance) || distance <= 0) return;\n\t\tconst safeRadius = Math.max(Number.isFinite(radius) ? radius : 0, 0);\n\t\tnear = Math.min(near, distance - safeRadius);\n\t\tfar = Math.max(far, distance + safeRadius);\n\t});\n\n\tif (!Number.isFinite(near) || !Number.isFinite(far)) {\n\t\treturn { near: safeMinimumNear, far: safeMinimumNear + 1 };\n\t}\n\n\tnear = Math.max(near - safeGuard, safeMinimumNear);\n\tfar = Math.max(far + safeGuard, near + 0.01);\n\treturn { near, far };\n}\n\n/** Returns the FOV that makes panel-local world units match CSS pixels at a distance. */\nexport function getPanelLocalCameraFov(panelHeight: number, distance: number) {\n\treturn THREE.MathUtils.radToDeg(\n\t\t2 * Math.atan(Math.max(panelHeight, 1) / (Math.max(distance, 1) * 2))\n\t);\n}\n\n/** Rectangle, in panel-local pixels, occupied by the main camera's current view. */\nexport interface MinimapViewportRect {\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n}\n\n/**\n * Projects the main camera frustum onto the minimap model's target plane.\n *\n * The conversion intentionally passes through model-local coordinates. This keeps\n * panning and orbiting stable even though the minimap layer itself follows a tilted\n * panel in screen space.\n */\nexport function getMinimapViewportRect(\n\tstageCamera: THREE.PerspectiveCamera,\n\tminimapCamera: THREE.PerspectiveCamera,\n\ttarget: THREE.Vector3,\n\tstageModel: Object3D,\n\tminimapSourceRoot: Object3D,\n\tminimapSourceLayer: Object3D,\n\twidth: number,\n\theight: number\n): MinimapViewportRect | null {\n\tconst stageForward = new THREE.Vector3();\n\tstageCamera.getWorldDirection(stageForward);\n\tif (stageForward.lengthSq() < 0.0001) return null;\n\n\tconst targetPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(stageForward, target);\n\tconst stageOrigin = stageCamera.getWorldPosition(new THREE.Vector3());\n\tconst stageRay = new THREE.Ray();\n\tconst hit = new THREE.Vector3();\n\tconst projected: THREE.Vector2[] = [];\n\tconst corners = [\n\t\tnew THREE.Vector3(-1, -1, 0.5),\n\t\tnew THREE.Vector3(1, -1, 0.5),\n\t\tnew THREE.Vector3(1, 1, 0.5),\n\t\tnew THREE.Vector3(-1, 1, 0.5)\n\t];\n\n\tstageCamera.updateMatrixWorld(true);\n\tstageModel.updateWorldMatrix(true, true);\n\tminimapSourceRoot.updateWorldMatrix(true, true);\n\tminimapSourceLayer.updateWorldMatrix(true, true);\n\tminimapCamera.updateMatrixWorld(true);\n\n\tcorners.forEach((corner) => {\n\t\tconst worldPoint = corner.clone().unproject(stageCamera);\n\t\tconst direction = worldPoint.sub(stageOrigin).normalize();\n\t\tstageRay.set(stageOrigin, direction);\n\t\tconst intersection = stageRay.intersectPlane(targetPlane, hit);\n\t\tif (!intersection) return;\n\n\t\tconst modelPoint = stageModel.worldToLocal(intersection.clone());\n\t\tconst minimapPoint = minimapSourceRoot.localToWorld(modelPoint);\n\t\t// The camera is panel-local, so remove the layer's shared screen transform.\n\t\tminimapSourceLayer.worldToLocal(minimapPoint);\n\t\tconst ndc = minimapPoint.project(minimapCamera);\n\t\tif (!Number.isFinite(ndc.x) || !Number.isFinite(ndc.y)) return;\n\t\tprojected.push(new THREE.Vector2(ndc.x * width * 0.5, ndc.y * height * 0.5));\n\t});\n\n\tif (projected.length < 4) return null;\n\tconst minX = Math.min(...projected.map((point) => point.x));\n\tconst maxX = Math.max(...projected.map((point) => point.x));\n\tconst minY = Math.min(...projected.map((point) => point.y));\n\tconst maxY = Math.max(...projected.map((point) => point.y));\n\tconst centerX = (minX + maxX) * 0.5;\n\tconst centerY = (minY + maxY) * 0.5;\n\tlet rectWidth = maxX - minX;\n\tlet rectHeight = maxY - minY;\n\tif (\n\t\t!Number.isFinite(rectWidth) ||\n\t\t!Number.isFinite(rectHeight) ||\n\t\trectWidth <= 0 ||\n\t\trectHeight <= 0\n\t) {\n\t\treturn null;\n\t}\n\n\tconst minSize = 8;\n\tconst minScale = Math.max(minSize / rectWidth, minSize / rectHeight, 1);\n\trectWidth *= minScale;\n\trectHeight *= minScale;\n\tconst fitScale = Math.min(width / rectWidth, height / rectHeight, 1);\n\trectWidth *= fitScale;\n\trectHeight *= fitScale;\n\tconst maxCenterX = Math.max((width - rectWidth) * 0.5, 0);\n\tconst maxCenterY = Math.max((height - rectHeight) * 0.5, 0);\n\n\treturn {\n\t\tx: THREE.MathUtils.clamp(centerX, -maxCenterX, maxCenterX),\n\t\ty: THREE.MathUtils.clamp(centerY, -maxCenterY, maxCenterY),\n\t\twidth: rectWidth,\n\t\theight: rectHeight\n\t};\n}\n\n/** Normalizes a CSS blur radius before it is passed to the WebGPU blur pipeline. */\nexport function getMinimapCssBlurRadius(blur: number) {\n\treturn Math.max(blur, 0);\n}\n"]}
1
+ {"version":3,"file":"MinimapProjection.js","sourceRoot":"","sources":["../../../src/stage/minimap/MinimapProjection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAU/D;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CACnC,MAAoC,EACpC,KA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AAI,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,CAAC;AACjE,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,uBAAuB,CAAC,IAAY;IACnD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import * as THREE from 'three/webgpu';\nimport type { Object3D } from 'three';\n\nexport { getProjectiveCssMatrix3d } from '../cssProjection.js';\nexport type { CssProjectionPoint, CssProjectionQuad } from '../cssProjection.js';\n\nexport interface MinimapDepthBound {\n\t/** Positive camera-space distance to the bound's center. */\n\tdistance: number;\n\t/** Camera-space radius that must remain inside the clipping range. */\n\tradius: number;\n}\n\n/**\n * Fits a compact clipping range around the panel and live minimap model.\n *\n * The regular panel camera spans thousands of world units. Reusing that range\n * for thumbnail geometry collapses closely layered element surfaces into the\n * same depth values, so a small pointer tilt can make their fragments alternate.\n */\nexport function getMinimapDepthRange(\n\tbounds: readonly MinimapDepthBound[],\n\tguard = 16,\n\tminimumNear = 0.01\n) {\n\tconst safeGuard = Math.max(Number.isFinite(guard) ? guard : 0, 0);\n\tconst safeMinimumNear = Math.max(Number.isFinite(minimumNear) ? minimumNear : 0.01, 0.000001);\n\tlet near = Number.POSITIVE_INFINITY;\n\tlet far = Number.NEGATIVE_INFINITY;\n\n\tbounds.forEach(({ distance, radius }) => {\n\t\tif (!Number.isFinite(distance) || distance <= 0) return;\n\t\tconst safeRadius = Math.max(Number.isFinite(radius) ? radius : 0, 0);\n\t\tnear = Math.min(near, distance - safeRadius);\n\t\tfar = Math.max(far, distance + safeRadius);\n\t});\n\n\tif (!Number.isFinite(near) || !Number.isFinite(far)) {\n\t\treturn { near: safeMinimumNear, far: safeMinimumNear + 1 };\n\t}\n\n\tnear = Math.max(near - safeGuard, safeMinimumNear);\n\tfar = Math.max(far + safeGuard, near + 0.01);\n\treturn { near, far };\n}\n\n/** Returns the FOV that makes panel-local world units match CSS pixels at a distance. */\nexport function getPanelLocalCameraFov(panelHeight: number, distance: number) {\n\treturn THREE.MathUtils.radToDeg(\n\t\t2 * Math.atan(Math.max(panelHeight, 1) / (Math.max(distance, 1) * 2))\n\t);\n}\n\n/** Rectangle, in panel-local pixels, occupied by the main camera's current view. */\nexport interface MinimapViewportRect {\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n}\n\n/**\n * Projects the main camera frustum onto the minimap model's target plane.\n *\n * The conversion intentionally passes through model-local coordinates. This keeps\n * panning and orbiting stable even though the minimap layer itself follows a tilted\n * panel in screen space.\n */\nexport function getMinimapViewportRect(\n\tstageCamera: THREE.PerspectiveCamera,\n\tminimapCamera: THREE.PerspectiveCamera,\n\ttarget: THREE.Vector3,\n\tstageModel: Object3D,\n\tminimapSourceRoot: Object3D,\n\tminimapSourceLayer: Object3D,\n\twidth: number,\n\theight: number\n): MinimapViewportRect | null {\n\tconst stageForward = new THREE.Vector3();\n\tstageCamera.getWorldDirection(stageForward);\n\tif (stageForward.lengthSq() < 0.0001) return null;\n\n\tconst targetPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(stageForward, target);\n\tconst stageOrigin = stageCamera.getWorldPosition(new THREE.Vector3());\n\tconst stageRay = new THREE.Ray();\n\tconst hit = new THREE.Vector3();\n\tconst projected: THREE.Vector2[] = [];\n\tconst corners = [\n\t\tnew THREE.Vector3(-1, -1, 0.5),\n\t\tnew THREE.Vector3(1, -1, 0.5),\n\t\tnew THREE.Vector3(1, 1, 0.5),\n\t\tnew THREE.Vector3(-1, 1, 0.5)\n\t];\n\n\tstageCamera.updateMatrixWorld(true);\n\tstageModel.updateWorldMatrix(true, true);\n\tminimapSourceRoot.updateWorldMatrix(true, true);\n\tminimapSourceLayer.updateWorldMatrix(true, true);\n\tminimapCamera.updateMatrixWorld(true);\n\n\tcorners.forEach((corner) => {\n\t\tconst worldPoint = corner.clone().unproject(stageCamera);\n\t\tconst direction = worldPoint.sub(stageOrigin).normalize();\n\t\tstageRay.set(stageOrigin, direction);\n\t\tconst intersection = stageRay.intersectPlane(targetPlane, hit);\n\t\tif (!intersection) return;\n\n\t\tconst modelPoint = stageModel.worldToLocal(intersection.clone());\n\t\tconst minimapPoint = minimapSourceRoot.localToWorld(modelPoint);\n\t\t// The camera is panel-local, so remove the layer's shared screen transform.\n\t\tminimapSourceLayer.worldToLocal(minimapPoint);\n\t\tconst ndc = minimapPoint.project(minimapCamera);\n\t\tif (!Number.isFinite(ndc.x) || !Number.isFinite(ndc.y)) return;\n\t\tprojected.push(new THREE.Vector2(ndc.x * width * 0.5, ndc.y * height * 0.5));\n\t});\n\n\tif (projected.length < 4) return null;\n\tconst minX = Math.min(...projected.map((point) => point.x));\n\tconst maxX = Math.max(...projected.map((point) => point.x));\n\tconst minY = Math.min(...projected.map((point) => point.y));\n\tconst maxY = Math.max(...projected.map((point) => point.y));\n\tconst centerX = (minX + maxX) * 0.5;\n\tconst centerY = (minY + maxY) * 0.5;\n\tconst rectWidth = maxX - minX;\n\tconst rectHeight = maxY - minY;\n\tif (\n\t\t!Number.isFinite(rectWidth) ||\n\t\t!Number.isFinite(rectHeight) ||\n\t\trectWidth <= 0 ||\n\t\trectHeight <= 0\n\t) {\n\t\treturn null;\n\t}\n\n\t// Preserve the true footprint, including edges outside the minimap. Fitting\n\t// it into the panel would falsely crop the model on wide/tall viewports.\n\treturn {\n\t\tx: centerX,\n\t\ty: centerY,\n\t\twidth: rectWidth,\n\t\theight: rectHeight\n\t};\n}\n\n/** Intersects the projected view with the panel without scaling or shifting it. */\nexport function clipMinimapViewportRect(rect: MinimapViewportRect, width: number, height: number) {\n\tconst left = THREE.MathUtils.clamp(width * 0.5 + rect.x - rect.width * 0.5, 0, width);\n\tconst right = THREE.MathUtils.clamp(width * 0.5 + rect.x + rect.width * 0.5, 0, width);\n\tconst top = THREE.MathUtils.clamp(height * 0.5 - rect.y - rect.height * 0.5, 0, height);\n\tconst bottom = THREE.MathUtils.clamp(height * 0.5 - rect.y + rect.height * 0.5, 0, height);\n\treturn { left, top, width: right - left, height: bottom - top };\n}\n\n/** Normalizes a CSS blur radius before it is passed to the WebGPU blur pipeline. */\nexport function getMinimapCssBlurRadius(blur: number) {\n\treturn Math.max(blur, 0);\n}\n"]}
@@ -69,10 +69,19 @@ export interface StageViewportRegistration {
69
69
  getElement(): HTMLElement | undefined;
70
70
  }
71
71
  export interface StageContext {
72
+ /** Reactive in framework adapters; false during SSR and until the GPU has painted. */
73
+ isEnhanced?(): boolean;
72
74
  prefetchSpatialElement?(stage: import('../spatial-element/spatialElementScene.js').SpatialElementScene): void;
73
75
  registerPanel(panel: StagePanelRegistration): () => void;
76
+ /** Refresh appearance from registered getters without rebinding the page or its camera. */
77
+ updatePanelAppearance?(): void;
74
78
  registerViewport(viewport: StageViewportRegistration): () => void;
75
79
  /** Restores the element camera to its initial fitted pose. */
76
80
  resetView(): void;
81
+ /** True for both native fullscreen and its viewport fallback. */
82
+ isFullscreen?(): boolean;
83
+ /** Current camera zoom focus, from the fitted detail view (0) to close-up (1). */
84
+ getZoomFocus?(): number;
85
+ setFullscreen?(fullscreen: boolean): void;
77
86
  }
78
87
  //# sourceMappingURL=panelContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"panelContext.d.ts","sourceRoot":"","sources":["../../src/stage/panelContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEjF,eAAO,MAAM,iBAAiB,eAAkB,CAAC;AAEjD,uFAAuF;AACvF,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAE7D,+FAA+F;AAC/F,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAE7D,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,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,CAAC;CAC1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"panelContext.js","sourceRoot":"","sources":["../../src/stage/panelContext.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AAEjD,uFAAuF;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE7D,+FAA+F;AAC/F,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC","sourcesContent":["\nimport type { LiquidGlassPanelOptions } from './LiquidGlassPanel.js';\nimport type { StageMinimapDockedView, StagePanelSurface } from './stageTypes.js';\n\nexport const STAGE_CONTEXT_KEY = Symbol('stage');\n\n/** Notifies an active stage that externally positioned panel frames changed layout. */\nexport const STAGE_PANEL_LAYOUT_EVENT = 'stage:panel-layout';\n\n/** Notifies an active stage that an external panel visual changed without affecting layout. */\nexport const STAGE_PANEL_VISUAL_EVENT = 'stage:panel-visual';\n\nexport interface StagePanelPose {\n\twidth: number;\n\theight: number;\n\tposition: { x: number; y: number };\n}\n\nexport interface StagePanelShape {\n\tradius: number;\n\tcontentInset?: number;\n}\n\nexport type StagePanelTheme = Omit<\n\tLiquidGlassPanelOptions,\n\t'width' | 'height' | 'position' | 'radius'\n> & {\n\t/** Semantic surface style. Defaults to the WebGPU-backed `glass` mode. */\n\tsurface?: StagePanelSurface;\n};\n\n\n\nexport interface StagePanelMinimapOptions {\n\texpandedHeight?: number;\n\tinset?: number;\n\t/** Additional unbounded scale applied to the fitted model. Values below 0.2 are clamped. */\n\tmodelScale?: number;\n\t/** Model multiplier at full pointer hover. Use 1 to disable hover enlargement. */\n\thoverModelScale?: number;\n\t/** Hover multiplier used once the minimap is expanded by camera zoom. */\n\texpandedHoverModelScale?: number;\n\t/** Optional spatial-element-specific presentation used while the minimap is docked. */\n\tdockedView?: StageMinimapDockedView;\n\toverlayColor?: string | number;\n\toverlayOpacity?: number;\n\t/** Gaussian blur radius in CSS pixels. */\n\toverlayBlur?: number;\n\tcontextColor?: string | number;\n\tcontextOpacity?: number;\n\tviewportColor?: string | number;\n}\n\nexport interface StagePanelRegistration {\n\tgetContentInset(): number;\n\tgetElement(): HTMLElement | undefined;\n\tgetFrameElement(): HTMLElement | undefined;\n\tgetSurfaceElement(): HTMLElement | undefined;\n\tgetPointerReactive(): boolean | 'lift';\n\tgetFocusReactive?(): boolean | 'top-right';\n\t/** Neighbouring panel frame that shares a corner control's exit path. */\n\tgetFocusAnchor?(): HTMLElement | undefined;\n\tgetNativeContent?(): boolean;\n\t/** Runs synchronously before the native panel surface is measured and drawn. */\n\tupdateNativeLayout?(): void;\n\tgetVisible?(): boolean;\n\tgetMinimapOptions(): StagePanelMinimapOptions | undefined;\n\tgetOptions(): LiquidGlassPanelOptions;\n\tgetSurface(): StagePanelSurface;\n\t/** Returns the opacity of the panel surface without affecting panel content. */\n\tgetSurfaceOpacity(): number;\n\t/** Returns a transient presentation scale applied to a rendered minimap model. */\n\tgetMinimapModelScale(): number;\n\t/** Returns the animated transition from the regular to the docked minimap view. */\n\tgetMinimapDockProgress(): number;\n\t/** Returns the viewport-space top edge used to anchor the rendered model. */\n\tgetMinimapModelTop(): number | undefined;\n}\n\nexport interface StageViewportRegistration {\n\tgetElement(): HTMLElement | undefined;\n}\n\nexport interface StageContext {\n\tprefetchSpatialElement?(stage: import('../spatial-element/spatialElementScene.js').SpatialElementScene): void;\n\tregisterPanel(panel: StagePanelRegistration): () => void;\n\tregisterViewport(viewport: StageViewportRegistration): () => void;\n\t/** Restores the element camera to its initial fitted pose. */\n\tresetView(): void;\n}\n"]}
1
+ {"version":3,"file":"panelContext.js","sourceRoot":"","sources":["../../src/stage/panelContext.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AAEjD,uFAAuF;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE7D,+FAA+F;AAC/F,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC","sourcesContent":["\nimport type { LiquidGlassPanelOptions } from './LiquidGlassPanel.js';\nimport type { StageMinimapDockedView, StagePanelSurface } from './stageTypes.js';\n\nexport const STAGE_CONTEXT_KEY = Symbol('stage');\n\n/** Notifies an active stage that externally positioned panel frames changed layout. */\nexport const STAGE_PANEL_LAYOUT_EVENT = 'stage:panel-layout';\n\n/** Notifies an active stage that an external panel visual changed without affecting layout. */\nexport const STAGE_PANEL_VISUAL_EVENT = 'stage:panel-visual';\n\nexport interface StagePanelPose {\n\twidth: number;\n\theight: number;\n\tposition: { x: number; y: number };\n}\n\nexport interface StagePanelShape {\n\tradius: number;\n\tcontentInset?: number;\n}\n\nexport type StagePanelTheme = Omit<\n\tLiquidGlassPanelOptions,\n\t'width' | 'height' | 'position' | 'radius'\n> & {\n\t/** Semantic surface style. Defaults to the WebGPU-backed `glass` mode. */\n\tsurface?: StagePanelSurface;\n};\n\n\n\nexport interface StagePanelMinimapOptions {\n\texpandedHeight?: number;\n\tinset?: number;\n\t/** Additional unbounded scale applied to the fitted model. Values below 0.2 are clamped. */\n\tmodelScale?: number;\n\t/** Model multiplier at full pointer hover. Use 1 to disable hover enlargement. */\n\thoverModelScale?: number;\n\t/** Hover multiplier used once the minimap is expanded by camera zoom. */\n\texpandedHoverModelScale?: number;\n\t/** Optional spatial-element-specific presentation used while the minimap is docked. */\n\tdockedView?: StageMinimapDockedView;\n\toverlayColor?: string | number;\n\toverlayOpacity?: number;\n\t/** Gaussian blur radius in CSS pixels. */\n\toverlayBlur?: number;\n\tcontextColor?: string | number;\n\tcontextOpacity?: number;\n\tviewportColor?: string | number;\n}\n\nexport interface StagePanelRegistration {\n\tgetContentInset(): number;\n\tgetElement(): HTMLElement | undefined;\n\tgetFrameElement(): HTMLElement | undefined;\n\tgetSurfaceElement(): HTMLElement | undefined;\n\tgetPointerReactive(): boolean | 'lift';\n\tgetFocusReactive?(): boolean | 'top-right';\n\t/** Neighbouring panel frame that shares a corner control's exit path. */\n\tgetFocusAnchor?(): HTMLElement | undefined;\n\tgetNativeContent?(): boolean;\n\t/** Runs synchronously before the native panel surface is measured and drawn. */\n\tupdateNativeLayout?(): void;\n\tgetVisible?(): boolean;\n\tgetMinimapOptions(): StagePanelMinimapOptions | undefined;\n\tgetOptions(): LiquidGlassPanelOptions;\n\tgetSurface(): StagePanelSurface;\n\t/** Returns the opacity of the panel surface without affecting panel content. */\n\tgetSurfaceOpacity(): number;\n\t/** Returns a transient presentation scale applied to a rendered minimap model. */\n\tgetMinimapModelScale(): number;\n\t/** Returns the animated transition from the regular to the docked minimap view. */\n\tgetMinimapDockProgress(): number;\n\t/** Returns the viewport-space top edge used to anchor the rendered model. */\n\tgetMinimapModelTop(): number | undefined;\n}\n\nexport interface StageViewportRegistration {\n\tgetElement(): HTMLElement | undefined;\n}\n\nexport interface StageContext {\n\t/** Reactive in framework adapters; false during SSR and until the GPU has painted. */\n\tisEnhanced?(): boolean;\n\tprefetchSpatialElement?(stage: import('../spatial-element/spatialElementScene.js').SpatialElementScene): void;\n\tregisterPanel(panel: StagePanelRegistration): () => void;\n\t/** Refresh appearance from registered getters without rebinding the page or its camera. */\n\tupdatePanelAppearance?(): void;\n\tregisterViewport(viewport: StageViewportRegistration): () => void;\n\t/** Restores the element camera to its initial fitted pose. */\n\tresetView(): void;\n\t/** True for both native fullscreen and its viewport fallback. */\n\tisFullscreen?(): boolean;\n\t/** Current camera zoom focus, from the fitted detail view (0) to close-up (1). */\n\tgetZoomFocus?(): number;\n\tsetFullscreen?(fullscreen: boolean): void;\n}\n"]}
@@ -7,4 +7,6 @@ export declare function getStagePositionFromRect(rect: Pick<DOMRect, 'height' |
7
7
  };
8
8
  /** Returns whether a rectangle intersects the viewport plus an optional preload margin. */
9
9
  export declare function isViewportRectVisible(rect: Pick<DOMRect, 'bottom' | 'left' | 'right' | 'top'>, viewportWidth: number, viewportHeight: number, margin?: number): boolean;
10
+ /** Resolves a sticky panel inside its document-space containing block. */
11
+ export declare function getStickyPanelTop(documentTop: number, height: number, boundaryBottom: number, inset: number, scrollY: number): number;
10
12
  //# sourceMappingURL=stageDom.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stageDom.d.ts","sourceRoot":"","sources":["../../src/stage/stageDom.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,WAOzD;AAED,yFAAyF;AACzF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC;;;EAKhG;AAED,2FAA2F;AAC3F,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC,EACxD,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,MAAM,SAAI,WASV"}
1
+ {"version":3,"file":"stageDom.d.ts","sourceRoot":"","sources":["../../src/stage/stageDom.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,WAOzD;AAED,yFAAyF;AACzF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC;;;EAKhG;AAED,2FAA2F;AAC3F,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC,EACxD,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,MAAM,SAAI,WASV;AAED,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAE5H"}
@@ -19,4 +19,8 @@ export function isViewportRectVisible(rect, viewportWidth, viewportHeight, margi
19
19
  rect.bottom >= -safeMargin &&
20
20
  rect.top <= viewportHeight + safeMargin);
21
21
  }
22
+ /** Resolves a sticky panel inside its document-space containing block. */
23
+ export function getStickyPanelTop(documentTop, height, boundaryBottom, inset, scrollY) {
24
+ return Math.min(Math.max(documentTop - scrollY, inset), boundaryBottom - scrollY - height);
25
+ }
22
26
  //# sourceMappingURL=stageDom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stageDom.js","sourceRoot":"","sources":["../../src/stage/stageDom.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,UAAU,eAAe,CAAC,MAA0B;IACzD,IAAI,CAAC,CAAC,MAAM,YAAY,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IAC/C,OAAO,OAAO,CACb,MAAM,CAAC,OAAO,CACb,sIAAsI,CACtI,CACD,CAAC;AACH,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,wBAAwB,CAAC,IAAwD;IAChG,OAAO;QACN,CAAC,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,MAAM,CAAC,UAAU,GAAG,GAAG;QACzD,CAAC,EAAE,MAAM,CAAC,WAAW,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;KAC5D,CAAC;AACH,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,qBAAqB,CACpC,IAAwD,EACxD,aAAqB,EACrB,cAAsB,EACtB,MAAM,GAAG,CAAC;IAEV,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrE,OAAO,CACN,IAAI,CAAC,KAAK,IAAI,CAAC,UAAU;QACzB,IAAI,CAAC,IAAI,IAAI,aAAa,GAAG,UAAU;QACvC,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU;QAC1B,IAAI,CAAC,GAAG,IAAI,cAAc,GAAG,UAAU,CACvC,CAAC;AACH,CAAC","sourcesContent":["/** Returns true when a pointer event belongs to interactive stage UI instead of the model. */\nexport function isStageUiTarget(target: EventTarget | null) {\n\tif (!(target instanceof Element)) return false;\n\treturn Boolean(\n\t\ttarget.closest(\n\t\t\t'[data-stage-panel-content], [data-stage-panel-css-surface], [data-stage-panel-fallback], button, a, input, textarea, select, summary'\n\t\t)\n\t);\n}\n\n/** Converts a DOM rectangle center into the stage's centered, y-up coordinate system. */\nexport function getStagePositionFromRect(rect: Pick<DOMRect, 'height' | 'left' | 'top' | 'width'>) {\n\treturn {\n\t\tx: rect.left + rect.width * 0.5 - window.innerWidth * 0.5,\n\t\ty: window.innerHeight * 0.5 - (rect.top + rect.height * 0.5)\n\t};\n}\n\n/** Returns whether a rectangle intersects the viewport plus an optional preload margin. */\nexport function isViewportRectVisible(\n\trect: Pick<DOMRect, 'bottom' | 'left' | 'right' | 'top'>,\n\tviewportWidth: number,\n\tviewportHeight: number,\n\tmargin = 0\n) {\n\tconst safeMargin = Math.max(Number.isFinite(margin) ? margin : 0, 0);\n\treturn (\n\t\trect.right >= -safeMargin &&\n\t\trect.left <= viewportWidth + safeMargin &&\n\t\trect.bottom >= -safeMargin &&\n\t\trect.top <= viewportHeight + safeMargin\n\t);\n}\n"]}
1
+ {"version":3,"file":"stageDom.js","sourceRoot":"","sources":["../../src/stage/stageDom.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,UAAU,eAAe,CAAC,MAA0B;IACzD,IAAI,CAAC,CAAC,MAAM,YAAY,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IAC/C,OAAO,OAAO,CACb,MAAM,CAAC,OAAO,CACb,sIAAsI,CACtI,CACD,CAAC;AACH,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,wBAAwB,CAAC,IAAwD;IAChG,OAAO;QACN,CAAC,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,MAAM,CAAC,UAAU,GAAG,GAAG;QACzD,CAAC,EAAE,MAAM,CAAC,WAAW,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;KAC5D,CAAC;AACH,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,qBAAqB,CACpC,IAAwD,EACxD,aAAqB,EACrB,cAAsB,EACtB,MAAM,GAAG,CAAC;IAEV,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrE,OAAO,CACN,IAAI,CAAC,KAAK,IAAI,CAAC,UAAU;QACzB,IAAI,CAAC,IAAI,IAAI,aAAa,GAAG,UAAU;QACvC,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU;QAC1B,IAAI,CAAC,GAAG,IAAI,cAAc,GAAG,UAAU,CACvC,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,iBAAiB,CAAC,WAAmB,EAAE,MAAc,EAAE,cAAsB,EAAE,KAAa,EAAE,OAAe;IAC5H,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,OAAO,EAAE,KAAK,CAAC,EAAE,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;AAC5F,CAAC","sourcesContent":["/** Returns true when a pointer event belongs to interactive stage UI instead of the model. */\nexport function isStageUiTarget(target: EventTarget | null) {\n\tif (!(target instanceof Element)) return false;\n\treturn Boolean(\n\t\ttarget.closest(\n\t\t\t'[data-stage-panel-content], [data-stage-panel-css-surface], [data-stage-panel-fallback], button, a, input, textarea, select, summary'\n\t\t)\n\t);\n}\n\n/** Converts a DOM rectangle center into the stage's centered, y-up coordinate system. */\nexport function getStagePositionFromRect(rect: Pick<DOMRect, 'height' | 'left' | 'top' | 'width'>) {\n\treturn {\n\t\tx: rect.left + rect.width * 0.5 - window.innerWidth * 0.5,\n\t\ty: window.innerHeight * 0.5 - (rect.top + rect.height * 0.5)\n\t};\n}\n\n/** Returns whether a rectangle intersects the viewport plus an optional preload margin. */\nexport function isViewportRectVisible(\n\trect: Pick<DOMRect, 'bottom' | 'left' | 'right' | 'top'>,\n\tviewportWidth: number,\n\tviewportHeight: number,\n\tmargin = 0\n) {\n\tconst safeMargin = Math.max(Number.isFinite(margin) ? margin : 0, 0);\n\treturn (\n\t\trect.right >= -safeMargin &&\n\t\trect.left <= viewportWidth + safeMargin &&\n\t\trect.bottom >= -safeMargin &&\n\t\trect.top <= viewportHeight + safeMargin\n\t);\n}\n\n/** Resolves a sticky panel inside its document-space containing block. */\nexport function getStickyPanelTop(documentTop: number, height: number, boundaryBottom: number, inset: number, scrollY: number) {\n\treturn Math.min(Math.max(documentTop - scrollY, inset), boundaryBottom - scrollY - height);\n}\n"]}
@@ -69,6 +69,8 @@ export interface StageVisualTestController {
69
69
  getModelRect(): StageVisualTestRect | null;
70
70
  /** Returns the projected 3D element bounds in viewport pixels. */
71
71
  getMinimapModelRect(): StageVisualTestRect | null;
72
+ /** Returns the visible viewport mask in minimap-local pixels. */
73
+ getMinimapViewportRect(): StageVisualTestRect | null;
72
74
  /** Returns canonical, displayed, and fully synchronized minimap orientations. */
73
75
  getMinimapOrientation(): StageVisualTestMinimapOrientation | null;
74
76
  /** Returns minimap overlay submissions for performance regression tests. */
@@ -1 +1 @@
1
- {"version":3,"file":"stageVisualTest.d.ts","sourceRoot":"","sources":["../../src/stage/stageVisualTest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,M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B,IAAI,mBAAmB,GAAG,IAAI,CAAC;IAClD,iEAAiE;IACjE,sBAAsB,IAAI,mBAAmB,GAAG,IAAI,CAAC;IACrD,iFAAiF;IACjF,qBAAqB,IAAI,iCAAiC,GAAG,IAAI,CAAC;IAClE,4EAA4E;IAC5E,qBAAqB,IAAI,iCAAiC,CAAC;IAC3D,+DAA+D;IAC/D,oBAAoB,IAAI,gCAAgC,CAAC;IACzD,wEAAwE;IACxE,kBAAkB,IAAI,8BAA8B,CAAC;IACrD,6FAA6F;IAC7F,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,mEAAmE;IACnE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,4DAA4D;IAC5D,QAAQ,IAAI,mBAAmB,CAAC;CAChC;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;KAC9C;CACD;AAED,gGAAgG;AAChG,wBAAgB,qBAAqB,YAEpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"stageVisualTest.js","sourceRoot":"","sources":["../../src/stage/stageVisualTest.ts"],"names":[],"mappings":"AA0GA,gGAAgG;AAChG,MAAM,UAAU,qBAAqB;IACpC,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,GAAG,CAAC;AAC9E,CAAC","sourcesContent":["import type { StageVisualTestView, StageZoomFocusState } from './stageTypes.js';\nimport type { StageExperience } from './StageExperience.js';\n\nexport interface StageVisualTestRect {\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n}\n\nexport interface StageVisualTestMinimapRenderStats {\n\toverlayCapturePasses: number;\n\tdepthNear: number;\n\tdepthFar: number;\n\tviewportRingInForeground: boolean;\n}\n\nexport type StageVisualTestQuaternion = [number, number, number, number];\n\nexport interface StageVisualTestMinimapOrientation {\n\trest: StageVisualTestQuaternion;\n\tdisplay: StageVisualTestQuaternion;\n\tlive: StageVisualTestQuaternion;\n\tdocked: StageVisualTestQuaternion | null;\n\tdockProgress: number;\n}\n\nexport type StageVisualTestRenderTargetStats = ReturnType<\n\tStageExperience['getVisualTestRenderTargetStats']\n>;\n\nexport interface StageVisualTestVisibilityStats {\n\tstageViewportVisible: boolean;\n\tvisiblePanels: number;\n\tvisibleMinimaps: number;\n\tstageModelRenderPasses: number;\n\tpanelBlurRenderPasses: number;\n\tpanelSceneRenderPasses: number;\n\tminimapSceneRenderPasses: number;\n}\n\n/** Browser-only controls exposed when a stage is opened with `?stage-test=1`. */\nexport interface StageVisualTestController {\n\tgetNavigationTimings(): { dataReady: number; captured: number; restoring: number; bound: number };\n\tcaptureHeroPresentation(): boolean;\n\tgetSpatialCapture(): ReturnType<StageExperience['getSpatialCapture']> | null;\n\treleaseSpatialCapture(): void;\n\tgetCatalogOwnership(): ReturnType<\n\t\timport('../catalog/CatalogTransition.js').CatalogTransition['getOwnership']\n\t>;\n\t/** Query-gated fixture registration for ambiguity/teardown tests. */\n\tregisterCatalogEndpoint(\n\t\taddress: import('../catalog/CatalogEndpointRegistry.js').CatalogEndpointAddress,\n\t\telement: HTMLElement\n\t): () => void;\n\tgetCatalogEndpoints(): ReturnType<\n\t\timport('../catalog/CatalogEndpointRegistry.js').CatalogEndpointRegistry['getSnapshot']\n\t>;\n\tloseDevice(): void;\n\t/** Holds one destination after DOM commit to verify its pre-render visibility gate. */\n\tholdNextPageBinding(): void;\n\treleasePageBinding(): void;\n\tgetCatalogPresentation(): ReturnType<StageExperience['getCatalogPresentation']> | null;\n\t/** Resource ownership diagnostics for catalog navigation acceptance. */\n\tgetCarouselStats(): ReturnType<\n\t\timport('../catalog/CatalogSpatialElementLayer.js').CatalogSpatialElementLayer['getStats']\n\t> | null;\n\tgetCatalogStats(): ReturnType<StageExperience['assets']['getStats']> | null;\n\t/** Applies a deterministic camera pose and waits until dependent render state settles. */\n\tsetView(view: StageVisualTestView, frames?: number): Promise<void>;\n\t/** Applies an equivalent zoom through the SpaceMouse camera/target dolly path. */\n\tsetSpaceMouseZoom(zoom: number): Promise<void>;\n\t/** Repeats SpaceMouse updates while frames render, leaving the synthetic gesture active. */\n\tdriveSpaceMouseZoom(zoom: number, frames?: number): Promise<void>;\n\t/** Ends a synthetic SpaceMouse gesture and lets dependent render state settle. */\n\tstopSpaceMouse(): Promise<void>;\n\t/** Returns the current rendered minimap bounds in viewport pixels. */\n\tgetMinimapRect(): StageVisualTestRect | null;\n\t/** Returns the current projected surface bounds for a registered panel frame. */\n\tgetPanelRect(frame: HTMLElement): StageVisualTestRect | null;\n\t/** Returns the projected main element bounds in viewport pixels. */\n\tgetModelRect(): StageVisualTestRect | null;\n\t/** Returns the projected 3D element bounds in viewport pixels. */\n\tgetMinimapModelRect(): StageVisualTestRect | null;\n\t/** Returns canonical, displayed, and fully synchronized minimap orientations. */\n\tgetMinimapOrientation(): StageVisualTestMinimapOrientation | null;\n\t/** Returns minimap overlay submissions for performance regression tests. */\n\tgetMinimapRenderStats(): StageVisualTestMinimapRenderStats;\n\t/** Returns target allocation, resize, and warm-up counters. */\n\tgetRenderTargetStats(): StageVisualTestRenderTargetStats;\n\t/** Returns current culling state and submitted render-pass counters. */\n\tgetVisibilityStats(): StageVisualTestVisibilityStats;\n\t/** Restores the exact fitted camera pose without running the user-facing reset animation. */\n\treset(): Promise<void>;\n\t/** Advances the renderer by a fixed number of synthetic frames. */\n\tsettle(frames?: number): Promise<void>;\n\t/** Returns the latest zoom phases reported by the stage. */\n\tgetState(): StageZoomFocusState;\n}\n\ndeclare global {\n\tinterface Window {\n\t\t__stageVisualTest?: StageVisualTestController;\n\t}\n}\n\n/** Returns whether the current page explicitly requested deterministic visual-test controls. */\nexport function isStageVisualTestMode() {\n\treturn new URLSearchParams(window.location.search).get('stage-test') === '1';\n}\n"]}
1
+ {"version":3,"file":"stageVisualTest.js","sourceRoot":"","sources":["../../src/stage/stageVisualTest.ts"],"names":[],"mappings":"AA4GA,gGAAgG;AAChG,MAAM,UAAU,qBAAqB;IACpC,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,GAAG,CAAC;AAC9E,CAAC","sourcesContent":["import type { StageVisualTestView, StageZoomFocusState } from './stageTypes.js';\nimport type { StageExperience } from './StageExperience.js';\n\nexport interface StageVisualTestRect {\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n}\n\nexport interface StageVisualTestMinimapRenderStats {\n\toverlayCapturePasses: number;\n\tdepthNear: number;\n\tdepthFar: number;\n\tviewportRingInForeground: boolean;\n}\n\nexport type StageVisualTestQuaternion = [number, number, number, number];\n\nexport interface StageVisualTestMinimapOrientation {\n\trest: StageVisualTestQuaternion;\n\tdisplay: StageVisualTestQuaternion;\n\tlive: StageVisualTestQuaternion;\n\tdocked: StageVisualTestQuaternion | null;\n\tdockProgress: number;\n}\n\nexport type StageVisualTestRenderTargetStats = ReturnType<\n\tStageExperience['getVisualTestRenderTargetStats']\n>;\n\nexport interface StageVisualTestVisibilityStats {\n\tstageViewportVisible: boolean;\n\tvisiblePanels: number;\n\tvisibleMinimaps: number;\n\tstageModelRenderPasses: number;\n\tpanelBlurRenderPasses: number;\n\tpanelSceneRenderPasses: number;\n\tminimapSceneRenderPasses: number;\n}\n\n/** Browser-only controls exposed when a stage is opened with `?stage-test=1`. */\nexport interface StageVisualTestController {\n\tgetNavigationTimings(): { dataReady: number; captured: number; restoring: number; bound: number };\n\tcaptureHeroPresentation(): boolean;\n\tgetSpatialCapture(): ReturnType<StageExperience['getSpatialCapture']> | null;\n\treleaseSpatialCapture(): void;\n\tgetCatalogOwnership(): ReturnType<\n\t\timport('../catalog/CatalogTransition.js').CatalogTransition['getOwnership']\n\t>;\n\t/** Query-gated fixture registration for ambiguity/teardown tests. */\n\tregisterCatalogEndpoint(\n\t\taddress: import('../catalog/CatalogEndpointRegistry.js').CatalogEndpointAddress,\n\t\telement: HTMLElement\n\t): () => void;\n\tgetCatalogEndpoints(): ReturnType<\n\t\timport('../catalog/CatalogEndpointRegistry.js').CatalogEndpointRegistry['getSnapshot']\n\t>;\n\tloseDevice(): void;\n\t/** Holds one destination after DOM commit to verify its pre-render visibility gate. */\n\tholdNextPageBinding(): void;\n\treleasePageBinding(): void;\n\tgetCatalogPresentation(): ReturnType<StageExperience['getCatalogPresentation']> | null;\n\t/** Resource ownership diagnostics for catalog navigation acceptance. */\n\tgetCarouselStats(): ReturnType<\n\t\timport('../catalog/CatalogSpatialElementLayer.js').CatalogSpatialElementLayer['getStats']\n\t> | null;\n\tgetCatalogStats(): ReturnType<StageExperience['assets']['getStats']> | null;\n\t/** Applies a deterministic camera pose and waits until dependent render state settles. */\n\tsetView(view: StageVisualTestView, frames?: number): Promise<void>;\n\t/** Applies an equivalent zoom through the SpaceMouse camera/target dolly path. */\n\tsetSpaceMouseZoom(zoom: number): Promise<void>;\n\t/** Repeats SpaceMouse updates while frames render, leaving the synthetic gesture active. */\n\tdriveSpaceMouseZoom(zoom: number, frames?: number): Promise<void>;\n\t/** Ends a synthetic SpaceMouse gesture and lets dependent render state settle. */\n\tstopSpaceMouse(): Promise<void>;\n\t/** Returns the current rendered minimap bounds in viewport pixels. */\n\tgetMinimapRect(): StageVisualTestRect | null;\n\t/** Returns the current projected surface bounds for a registered panel frame. */\n\tgetPanelRect(frame: HTMLElement): StageVisualTestRect | null;\n\t/** Returns the projected main element bounds in viewport pixels. */\n\tgetModelRect(): StageVisualTestRect | null;\n\t/** Returns the projected 3D element bounds in viewport pixels. */\n\tgetMinimapModelRect(): StageVisualTestRect | null;\n\t/** Returns the visible viewport mask in minimap-local pixels. */\n\tgetMinimapViewportRect(): StageVisualTestRect | null;\n\t/** Returns canonical, displayed, and fully synchronized minimap orientations. */\n\tgetMinimapOrientation(): StageVisualTestMinimapOrientation | null;\n\t/** Returns minimap overlay submissions for performance regression tests. */\n\tgetMinimapRenderStats(): StageVisualTestMinimapRenderStats;\n\t/** Returns target allocation, resize, and warm-up counters. */\n\tgetRenderTargetStats(): StageVisualTestRenderTargetStats;\n\t/** Returns current culling state and submitted render-pass counters. */\n\tgetVisibilityStats(): StageVisualTestVisibilityStats;\n\t/** Restores the exact fitted camera pose without running the user-facing reset animation. */\n\treset(): Promise<void>;\n\t/** Advances the renderer by a fixed number of synthetic frames. */\n\tsettle(frames?: number): Promise<void>;\n\t/** Returns the latest zoom phases reported by the stage. */\n\tgetState(): StageZoomFocusState;\n}\n\ndeclare global {\n\tinterface Window {\n\t\t__stageVisualTest?: StageVisualTestController;\n\t}\n}\n\n/** Returns whether the current page explicitly requested deterministic visual-test controls. */\nexport function isStageVisualTestMode() {\n\treturn new URLSearchParams(window.location.search).get('stage-test') === '1';\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spatial-elements/core",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.6",
4
4
  "description": "Framework-independent rendering and catalog runtime for Spatial Elements.",
5
5
  "license": "MPL-2.0",
6
6
  "type": "module",