@pascal-app/viewer 1.0.4 → 1.0.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 (183) hide show
  1. package/dist/capture/capture-runtime.js +1 -1
  2. package/dist/components/error-boundary.d.ts.map +1 -1
  3. package/dist/components/renderers/node-renderer.d.ts +1 -1
  4. package/dist/components/renderers/node-renderer.d.ts.map +1 -1
  5. package/dist/components/renderers/node-renderer.js +4 -1
  6. package/dist/components/renderers/parametric-node-renderer.d.ts.map +1 -1
  7. package/dist/components/viewer/bvh-ecctrl.d.ts.map +1 -1
  8. package/dist/components/viewer/frame-limiter.d.ts.map +1 -1
  9. package/dist/components/viewer/glb-interactive.js +1 -1
  10. package/dist/components/viewer/glb-reference-nodes.js +1 -1
  11. package/dist/components/viewer/glb-replace-instances.js +1 -1
  12. package/dist/components/viewer/glb-scene.d.ts.map +1 -1
  13. package/dist/components/viewer/glb-scene.js +2 -3
  14. package/dist/components/viewer/glb-walkthrough-controller.js +1 -1
  15. package/dist/components/viewer/index.d.ts +10 -1
  16. package/dist/components/viewer/index.d.ts.map +1 -1
  17. package/dist/components/viewer/index.js +28 -12
  18. package/dist/components/viewer/lights.d.ts.map +1 -1
  19. package/dist/components/viewer/lights.js +107 -21
  20. package/dist/components/viewer/perf-panel.d.ts.map +1 -1
  21. package/dist/components/viewer/perf-panel.js +1 -1
  22. package/dist/components/viewer/post-processing.d.ts.map +1 -1
  23. package/dist/components/viewer/post-processing.js +96 -33
  24. package/dist/components/viewer/registered-systems.js +1 -1
  25. package/dist/components/viewer/scene-bvh.d.ts.map +1 -1
  26. package/dist/components/viewer/scene-bvh.js +1 -1
  27. package/dist/components/viewer/scene-environment.d.ts.map +1 -1
  28. package/dist/components/viewer/scene-environment.js +31 -11
  29. package/dist/components/viewer/selection-manager.js +15 -7
  30. package/dist/components/viewer/underground-ambiance.d.ts +9 -0
  31. package/dist/components/viewer/underground-ambiance.d.ts.map +1 -0
  32. package/dist/components/viewer/underground-ambiance.js +105 -0
  33. package/dist/components/viewer/viewer-camera.d.ts.map +1 -1
  34. package/dist/components/viewer/viewer-camera.js +1 -1
  35. package/dist/components/viewer/viewer-presentations.d.ts.map +1 -1
  36. package/dist/hooks/use-gltf-ktx2.d.ts.map +1 -1
  37. package/dist/hooks/use-gltf-ktx2.js +2 -0
  38. package/dist/hooks/use-node-events.d.ts.map +1 -1
  39. package/dist/index.d.ts +16 -7
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +16 -7
  42. package/dist/lib/backdrop.d.ts +17 -0
  43. package/dist/lib/backdrop.d.ts.map +1 -1
  44. package/dist/lib/backdrop.js +18 -1
  45. package/dist/lib/construction-dust.d.ts +57 -0
  46. package/dist/lib/construction-dust.d.ts.map +1 -0
  47. package/dist/lib/construction-dust.js +187 -0
  48. package/dist/lib/csg-utils.js +1 -1
  49. package/dist/lib/foundation-materials.d.ts +26 -0
  50. package/dist/lib/foundation-materials.d.ts.map +1 -0
  51. package/dist/lib/foundation-materials.js +65 -0
  52. package/dist/lib/gltf-unlit.d.ts +10 -0
  53. package/dist/lib/gltf-unlit.d.ts.map +1 -0
  54. package/dist/lib/gltf-unlit.js +23 -0
  55. package/dist/lib/ground-window.d.ts +33 -0
  56. package/dist/lib/ground-window.d.ts.map +1 -0
  57. package/dist/lib/ground-window.js +114 -0
  58. package/dist/lib/hero-pose.d.ts +1 -1
  59. package/dist/lib/hero-pose.d.ts.map +1 -1
  60. package/dist/lib/ink-edges.d.ts +2 -1
  61. package/dist/lib/ink-edges.d.ts.map +1 -1
  62. package/dist/lib/ktx2-loader.d.ts +7 -0
  63. package/dist/lib/ktx2-loader.d.ts.map +1 -1
  64. package/dist/lib/ktx2-loader.js +35 -0
  65. package/dist/lib/layer-pass.d.ts.map +1 -1
  66. package/dist/lib/layers.d.ts +11 -7
  67. package/dist/lib/layers.d.ts.map +1 -1
  68. package/dist/lib/layers.js +16 -6
  69. package/dist/lib/materials.d.ts +5 -0
  70. package/dist/lib/materials.d.ts.map +1 -1
  71. package/dist/lib/materials.js +34 -4
  72. package/dist/lib/merged-outline-node.d.ts +5 -0
  73. package/dist/lib/merged-outline-node.d.ts.map +1 -1
  74. package/dist/lib/merged-outline-node.js +80 -2
  75. package/dist/lib/pointer-events.d.ts +20 -4
  76. package/dist/lib/pointer-events.d.ts.map +1 -1
  77. package/dist/lib/pointer-events.js +78 -14
  78. package/dist/lib/post-processing-resources.d.ts.map +1 -1
  79. package/dist/lib/reveal-candidates.d.ts +80 -0
  80. package/dist/lib/reveal-candidates.d.ts.map +1 -0
  81. package/dist/lib/reveal-candidates.js +524 -0
  82. package/dist/lib/reveal-ghost.d.ts +9 -0
  83. package/dist/lib/reveal-ghost.d.ts.map +1 -0
  84. package/dist/lib/reveal-ghost.js +62 -0
  85. package/dist/lib/reveal-pending.d.ts +12 -0
  86. package/dist/lib/reveal-pending.d.ts.map +1 -0
  87. package/dist/lib/reveal-pending.js +12 -0
  88. package/dist/lib/reveal-pose.d.ts +70 -0
  89. package/dist/lib/reveal-pose.d.ts.map +1 -0
  90. package/dist/lib/reveal-pose.js +248 -0
  91. package/dist/lib/reveal-schedule.d.ts +208 -0
  92. package/dist/lib/reveal-schedule.d.ts.map +1 -0
  93. package/dist/lib/reveal-schedule.js +410 -0
  94. package/dist/lib/reveal-texture-scale.d.ts +5 -0
  95. package/dist/lib/reveal-texture-scale.d.ts.map +1 -0
  96. package/dist/lib/reveal-texture-scale.js +113 -0
  97. package/dist/lib/reveal-windows.d.ts +23 -0
  98. package/dist/lib/reveal-windows.d.ts.map +1 -0
  99. package/dist/lib/reveal-windows.js +31 -0
  100. package/dist/lib/reveal-wipe.d.ts +71 -0
  101. package/dist/lib/reveal-wipe.d.ts.map +1 -0
  102. package/dist/lib/reveal-wipe.js +105 -0
  103. package/dist/lib/scene-pass-mrt.d.ts +12 -0
  104. package/dist/lib/scene-pass-mrt.d.ts.map +1 -0
  105. package/dist/lib/scene-pass-mrt.js +23 -0
  106. package/dist/lib/scene-themes.d.ts +30 -8
  107. package/dist/lib/scene-themes.d.ts.map +1 -1
  108. package/dist/lib/scene-themes.js +36 -0
  109. package/dist/lib/scene-visibility.d.ts +11 -1
  110. package/dist/lib/scene-visibility.d.ts.map +1 -1
  111. package/dist/lib/scene-visibility.js +38 -0
  112. package/dist/lib/site-surfaces.d.ts +32 -0
  113. package/dist/lib/site-surfaces.d.ts.map +1 -0
  114. package/dist/lib/site-surfaces.js +70 -0
  115. package/dist/lib/snapshot-pipeline.d.ts +2 -1
  116. package/dist/lib/snapshot-pipeline.d.ts.map +1 -1
  117. package/dist/lib/snapshot-pipeline.js +35 -15
  118. package/dist/lib/tsl-compat.d.ts +2 -2
  119. package/dist/lib/tsl-compat.d.ts.map +1 -1
  120. package/dist/lib/underground-ambiance.d.ts +168 -0
  121. package/dist/lib/underground-ambiance.d.ts.map +1 -0
  122. package/dist/lib/underground-ambiance.js +334 -0
  123. package/dist/store/use-viewer.d.ts +184 -27
  124. package/dist/store/use-viewer.d.ts.map +1 -1
  125. package/dist/store/use-viewer.js +155 -19
  126. package/dist/systems/ceiling/ceiling-system.d.ts.map +1 -1
  127. package/dist/systems/ceiling/ceiling-system.js +2 -0
  128. package/dist/systems/construction-reveal/construction-dust.d.ts +16 -0
  129. package/dist/systems/construction-reveal/construction-dust.d.ts.map +1 -0
  130. package/dist/systems/construction-reveal/construction-dust.js +92 -0
  131. package/dist/systems/construction-reveal/construction-reveal.d.ts +276 -0
  132. package/dist/systems/construction-reveal/construction-reveal.d.ts.map +1 -0
  133. package/dist/systems/construction-reveal/construction-reveal.js +2383 -0
  134. package/dist/systems/construction-reveal/dust-material.d.ts +10 -0
  135. package/dist/systems/construction-reveal/dust-material.d.ts.map +1 -0
  136. package/dist/systems/construction-reveal/dust-material.js +17 -0
  137. package/dist/systems/construction-reveal/ghost-dress.d.ts +10 -0
  138. package/dist/systems/construction-reveal/ghost-dress.d.ts.map +1 -0
  139. package/dist/systems/construction-reveal/ghost-dress.js +24 -0
  140. package/dist/systems/elevator/elevator-interaction-system.d.ts +7 -0
  141. package/dist/systems/elevator/elevator-interaction-system.d.ts.map +1 -1
  142. package/dist/systems/elevator/elevator-interaction-system.js +18 -1
  143. package/dist/systems/geometry/geometry-system.d.ts.map +1 -1
  144. package/dist/systems/interactive/control-widget.d.ts.map +1 -1
  145. package/dist/systems/interactive/interactive-system.d.ts.map +1 -1
  146. package/dist/systems/interactive/interactive-system.js +16 -6
  147. package/dist/systems/interactive/scripted-clips.js +1 -1
  148. package/dist/systems/item-light/item-light-system.js +1 -1
  149. package/dist/systems/level/level-hold.d.ts +4 -0
  150. package/dist/systems/level/level-hold.d.ts.map +1 -0
  151. package/dist/systems/level/level-hold.js +14 -0
  152. package/dist/systems/level/level-system.d.ts.map +1 -1
  153. package/dist/systems/level/level-system.js +16 -1
  154. package/dist/systems/level/level-utils.d.ts +13 -3
  155. package/dist/systems/level/level-utils.d.ts.map +1 -1
  156. package/dist/systems/level/level-utils.js +56 -8
  157. package/dist/systems/roof/__fixtures__/roof-plane-cases.d.ts +103 -0
  158. package/dist/systems/roof/__fixtures__/roof-plane-cases.d.ts.map +1 -0
  159. package/dist/systems/roof/__fixtures__/roof-plane-cases.js +317 -0
  160. package/dist/systems/roof/roof-materials.d.ts +4 -2
  161. package/dist/systems/roof/roof-materials.d.ts.map +1 -1
  162. package/dist/systems/roof/roof-materials.js +18 -24
  163. package/dist/systems/roof/roof-system.d.ts +8 -1
  164. package/dist/systems/roof/roof-system.d.ts.map +1 -1
  165. package/dist/systems/roof/roof-system.js +195 -45
  166. package/dist/systems/wall/wall-cutout-cache.d.ts +32 -3
  167. package/dist/systems/wall/wall-cutout-cache.d.ts.map +1 -1
  168. package/dist/systems/wall/wall-cutout-cache.js +95 -2
  169. package/dist/systems/wall/wall-cutout.d.ts.map +1 -1
  170. package/dist/systems/wall/wall-material-variant.d.ts.map +1 -1
  171. package/dist/systems/wall/wall-materials.d.ts.map +1 -1
  172. package/dist/systems/wall/wall-materials.js +39 -4
  173. package/dist/systems/wall/wall-placeholder-sweep.d.ts.map +1 -1
  174. package/dist/systems/wall/wall-system.d.ts +5 -0
  175. package/dist/systems/wall/wall-system.d.ts.map +1 -1
  176. package/dist/systems/wall/wall-system.js +42 -19
  177. package/dist/systems/window/corner-frame.d.ts +10 -0
  178. package/dist/systems/window/corner-frame.d.ts.map +1 -0
  179. package/dist/systems/window/corner-frame.js +17 -0
  180. package/dist/systems/window/window-system.d.ts +1 -1
  181. package/dist/systems/window/window-system.d.ts.map +1 -1
  182. package/dist/systems/window/window-system.js +31 -6
  183. package/package.json +8 -8
@@ -0,0 +1,92 @@
1
+ 'use client';
2
+ import { emitter } from '@pascal-app/core';
3
+ import { useFrame, useThree } from '@react-three/fiber';
4
+ import { useEffect, useMemo } from 'react';
5
+ import { DynamicDrawUsage, InstancedBufferAttribute, InstancedMesh, Matrix4, PlaneGeometry, Quaternion, Vector3, } from 'three';
6
+ import { dustSpriteSize } from '../../lib/construction-dust';
7
+ import { GRID_LAYER } from '../../lib/layers';
8
+ import { createDustMaterial } from './dust-material';
9
+ /**
10
+ * Draws a reveal's dust: one instanced mesh of camera-facing soft discs, as
11
+ * many as the pool holds, on the grid layer: inside the scene pass, so walls
12
+ * in front hide it (on the overlay layer it showed through them, Victor run
13
+ * 12), with no depth written, so the ink never outlines it; thumbnails leave
14
+ * it out. Renders nothing itself; it owns the mesh, adds it to the scene and
15
+ * disposes it on unmount.
16
+ */
17
+ export function ConstructionDust({ pool, clock }) {
18
+ const scene = useThree((state) => state.scene);
19
+ const camera = useThree((state) => state.camera);
20
+ const height = useThree((state) => state.size.height);
21
+ const dust = useMemo(() => {
22
+ const geometry = new PlaneGeometry(1, 1);
23
+ const alpha = new InstancedBufferAttribute(new Float32Array(pool.capacity), 1);
24
+ alpha.setUsage(DynamicDrawUsage);
25
+ const material = createDustMaterial(alpha);
26
+ const mesh = new InstancedMesh(geometry, material, pool.capacity);
27
+ mesh.name = 'construction-dust';
28
+ mesh.instanceMatrix.setUsage(DynamicDrawUsage);
29
+ mesh.layers.set(GRID_LAYER);
30
+ mesh.frustumCulled = false;
31
+ mesh.raycast = () => { };
32
+ mesh.count = 0;
33
+ mesh.visible = false;
34
+ return { mesh, alpha, geometry, material };
35
+ }, [pool]);
36
+ useEffect(() => {
37
+ scene.add(dust.mesh);
38
+ // A capture clones the scene in the same tick: no dust in it, whatever the camera layers.
39
+ const hide = () => {
40
+ dust.mesh.visible = false;
41
+ dust.mesh.count = 0;
42
+ };
43
+ emitter.on('thumbnail:before-capture', hide);
44
+ return () => {
45
+ emitter.off('thumbnail:before-capture', hide);
46
+ scene.remove(dust.mesh);
47
+ dust.geometry.dispose();
48
+ dust.material.dispose();
49
+ dust.mesh.dispose();
50
+ };
51
+ }, [dust, scene]);
52
+ const write = useMemo(() => {
53
+ const matrix = new Matrix4();
54
+ const position = new Vector3();
55
+ const size = new Vector3();
56
+ const facing = new Quaternion();
57
+ return {
58
+ facing,
59
+ sprite: (slot, x, y, z, scale, alpha) => {
60
+ position.set(x, y, z);
61
+ const drawn = dustSpriteSize(scale, camera, height, position);
62
+ size.set(drawn, drawn, drawn);
63
+ dust.mesh.setMatrixAt(slot, matrix.compose(position, facing, size));
64
+ dust.alpha.setX(slot, alpha);
65
+ },
66
+ };
67
+ }, [dust, camera, height]);
68
+ useFrame(() => {
69
+ const { mesh, alpha } = dust;
70
+ if (pool.takeWarm()) {
71
+ // One sprite with no size and no alpha: drawn, so its pipeline is built, and nothing to see.
72
+ write.facing.copy(camera.quaternion);
73
+ write.sprite(0, 0, 0, 0, 0, 0);
74
+ mesh.count = 1;
75
+ mesh.visible = true;
76
+ mesh.instanceMatrix.needsUpdate = true;
77
+ alpha.needsUpdate = true;
78
+ return;
79
+ }
80
+ if (!mesh.visible && pool.quietAt(clock.current))
81
+ return;
82
+ write.facing.copy(camera.quaternion);
83
+ const count = pool.step(clock.current, write.sprite);
84
+ mesh.count = count;
85
+ mesh.visible = count > 0;
86
+ if (count === 0)
87
+ return;
88
+ mesh.instanceMatrix.needsUpdate = true;
89
+ alpha.needsUpdate = true;
90
+ });
91
+ return null;
92
+ }
@@ -0,0 +1,276 @@
1
+ import { type AnyNode, type RevealPhase, type SceneCommit } from '@pascal-app/core';
2
+ import { Vector3 } from 'three';
3
+ import { DustPool } from '../../lib/construction-dust';
4
+ import { type ConstructionRevealLevel } from '../../lib/reveal-candidates';
5
+ import { isRevealWaiting } from '../../lib/reveal-pending';
6
+ import { type RevealCandidate } from '../../lib/reveal-schedule';
7
+ import { type PlayedStyle } from '../../lib/reveal-wipe';
8
+ /**
9
+ * Construction reveal: what an agent builds appears as a construction, not a
10
+ * pop. The store write is already done and is one undo step; only the
11
+ * presentation is staggered. New nodes of a revealed commit whose kind
12
+ * declares `capabilities.reveal` stay unmounted until their start time — so
13
+ * their geometry builds over frames, not in one — then move into place in
14
+ * their declared style, phase by phase, every floor at once.
15
+ *
16
+ * The host decides which commits reveal (`reveals`) and how much animation
17
+ * plays (`level`); the viewer knows no agent. A reveal ends at once on a load
18
+ * or hydration, an undo, a capture or export, and for selected nodes; it
19
+ * never plays under reduced motion or in a read-only viewer. A level the person's
20
+ * display hides (the levels above the selected one, solo) shows while its work plays,
21
+ * so the build is seen; a level the author hid shows its build at once.
22
+ */
23
+ export type { ConstructionRevealLevel } from '../../lib/reveal-candidates';
24
+ export { isRevealWaiting };
25
+ export type RevealPhaseEvent = {
26
+ phase: RevealPhase;
27
+ levelId: string | null;
28
+ };
29
+ /**
30
+ * What a reveal says about one (phase, level) group of nodes, on the reveal's own clock:
31
+ * - `start`: its first node begins;
32
+ * - `land`: its first node makes contact, the frame a sound belongs on (a drop's impact);
33
+ * - `settle`: its last node is at rest.
34
+ * `instant` is true when the host showed the build at once (animation off, reduced motion, a
35
+ * level nobody sees) or the reveal was cut short: the three come together, in that order.
36
+ */
37
+ export type RevealGroupEvent = {
38
+ type: 'start' | 'land' | 'settle';
39
+ phase: RevealPhase;
40
+ levelId: string | null;
41
+ /** Every node the group stages (those still to come from a later commit are not in it). */
42
+ nodeIds: readonly string[];
43
+ /** Who wrote the build, as the host named it on the commit. */
44
+ source: string | null;
45
+ instant: boolean;
46
+ atMs: number;
47
+ /** The agent moved what was already there: the group is its pieces, not a build. */
48
+ changed?: true;
49
+ };
50
+ /** One node begins to move in. */
51
+ export type RevealNodeStartEvent = {
52
+ type: 'node-start';
53
+ id: string;
54
+ phase: RevealPhase;
55
+ levelId: string | null;
56
+ /** `glide` is a piece moving from one place to another (`changed`). */
57
+ style: PlayedStyle | 'glide';
58
+ source: string | null;
59
+ atMs: number;
60
+ /** The agent moved this piece; it was already there. */
61
+ changed?: true;
62
+ };
63
+ /**
64
+ * The last piece of a build has arrived (a drop's impact): the moment the build is finished,
65
+ * which a recap and a success sound answer. A build shown at once has none.
66
+ */
67
+ export type RevealFinaleEvent = {
68
+ type: 'finale';
69
+ id: string;
70
+ phase: RevealPhase;
71
+ levelId: string | null;
72
+ source: string | null;
73
+ atMs: number;
74
+ };
75
+ /** Nothing is left to reveal: the last node is at rest. */
76
+ export type RevealCompleteEvent = {
77
+ type: 'complete';
78
+ nodeCount: number;
79
+ /** From the first node staged to the last at rest. */
80
+ durationMs: number;
81
+ source: string | null;
82
+ instant: boolean;
83
+ atMs: number;
84
+ /** What finished was the agent moving what was already there, not a build. */
85
+ changed?: true;
86
+ };
87
+ /**
88
+ * The build played in reverse (an undo, `retractNodes`), one (phase, level) group at a time, the last
89
+ * phase built first:
90
+ * - `retract-start`: its first node begins to go;
91
+ * - `retract-end`: its last node is gone (hidden, and held so until the host takes it out of the scene).
92
+ */
93
+ export type RevealRetractEvent = {
94
+ type: 'retract-start' | 'retract-end';
95
+ phase: RevealPhase;
96
+ levelId: string | null;
97
+ nodeIds: readonly string[];
98
+ source: string | null;
99
+ atMs: number;
100
+ };
101
+ export type RevealEvent = RevealGroupEvent | RevealNodeStartEvent | RevealFinaleEvent | RevealCompleteEvent | RevealRetractEvent;
102
+ /** What `retractNodes` reports once what it could show going has gone. */
103
+ export type RetractResult = {
104
+ /** Every node taken back: those asked for, and what stands under them. */
105
+ retracted: string[];
106
+ /** Those asked for that were not shown going: not in the scene, not mounted, or already going. */
107
+ skipped: string[];
108
+ /** Nothing animated: the animation is off, motion is reduced, or no reveal runs. The host goes on at once. */
109
+ instant: boolean;
110
+ };
111
+ /** A node's reveal as a plan view draws it: its style and how far it has come, 0 → 1. */
112
+ export type RevealPlanState = {
113
+ style: PlayedStyle;
114
+ progress: number;
115
+ };
116
+ /** A plugin's preroll for a candidate: `nodes` is the scene the candidate stood in (the one before a deletion). */
117
+ export type RevealPreroll = (candidate: RevealCandidate, nodes?: Readonly<Record<string, AnyNode>>) => number;
118
+ /** The animation speed the plan in force was made at, for a plugin that stages its own pieces. */
119
+ export declare function getRevealPlanSpeed(): number;
120
+ /**
121
+ * Whether the node waits for its turn (unmounted), is still moving in, is going out (a reverse play,
122
+ * and held gone until the host takes it out of the scene), or is being carried to a new place. A batch
123
+ * hands it back to itself and keeps it out.
124
+ */
125
+ export declare function isNodeRevealing(id: string): boolean;
126
+ /**
127
+ * True while the node waits for its turn: its renderer stays unmounted. A node that mounts up front,
128
+ * hidden, to draw its shaders before the build moves (see `chooseWarm`) is mounted: not pending.
129
+ */
130
+ export declare function useRevealPending(id: string): boolean;
131
+ /**
132
+ * True while the plan has something to play for the node: it waits for its turn, moves in, goes (an
133
+ * undo's reverse play) or is held gone. A plan entry that draws the node itself subscribes to the
134
+ * reveal's ticks only while this is true.
135
+ */
136
+ export declare function useRevealPlanActive(id: string): boolean;
137
+ /**
138
+ * True while the node has not had its turn, mounted up front or not: what a view that draws the node
139
+ * itself (the 2D plan) leaves out until it does.
140
+ */
141
+ export declare function useRevealWaiting(id: string): boolean;
142
+ /** True while an `assemble` node's parts are still on their way: its renderer draws them apart. */
143
+ export declare function isRevealAssembling(id: string): boolean;
144
+ /**
145
+ * Calls `listener` each time `id` starts or stops assembling. It fires
146
+ * synchronously, even when a capture ends the reveal, so a renderer that
147
+ * swaps its parts for a merged shell can do so before the frame is cloned.
148
+ */
149
+ export declare function subscribeRevealAssembling(id: string, listener: (assembling: boolean) => void): () => void;
150
+ /**
151
+ * The node's reveal for a plan view, on the reveal's own clock: `progress` is
152
+ * 0 while it waits and runs to 1 over its style's duration from its start
153
+ * (not from its first 3D build, which a paused canvas never runs). Null once
154
+ * it is done, or if it never revealed.
155
+ */
156
+ export declare function getRevealPlanState(id: string): RevealPlanState | null;
157
+ /**
158
+ * When a waiting node of the plan moves in, on the reveal's clock (`revealClockMs`), and how long its
159
+ * preroll plays before: a plugin that stages its own pieces for it (a wall's frame and boards) plays
160
+ * them in `[startMs - prerollMs, startMs]`. Null once it has started, or when it is not planned.
161
+ */
162
+ export declare function getRevealTurn(id: string): {
163
+ startMs: number;
164
+ prerollMs: number;
165
+ } | null;
166
+ /** The reveal's own clock: what `getRevealTurn` counts in. */
167
+ export declare function revealClockMs(): number;
168
+ /**
169
+ * Lets a plugin ask for a preroll before nodes of the lazy schedule (the `framing` level) move in:
170
+ * the plan leaves `prerollOf(candidate)` ms before each, and the plugin plays its own pieces then.
171
+ * Asked once per node when the plan is made; 0 for none. Null takes it back.
172
+ */
173
+ export declare function setRevealPreroll(next: RevealPreroll | null): void;
174
+ /**
175
+ * A puff of the reveal's dust around `centre` (world), `radius` metres out, `strength` in (0, 1]:
176
+ * for a plugin's own pieces landing. Nothing when no dust plays (the simple level, no reveal).
177
+ */
178
+ export declare function emitRevealPuff(centre: Vector3, radius: number, strength: number): void;
179
+ /** Calls `listener` after every reveal step while anything reveals, and once when it all ends. */
180
+ export declare function subscribeRevealTicks(listener: () => void): () => void;
181
+ /**
182
+ * Everything a reveal says, in order and on its clock: the phase groups starting, landing and
183
+ * settling, each node starting, and the build completing. The chat's step cards, the sounds and the
184
+ * camera that follows the build listen here, so they share one rhythm.
185
+ */
186
+ export declare function subscribeRevealEvents(listener: (event: RevealEvent) => void): () => void;
187
+ /** One event when each (phase, level) group of a reveal starts — at most one sound cue each. */
188
+ export declare function subscribeRevealPhases(listener: (event: RevealPhaseEvent) => void): () => void;
189
+ /**
190
+ * The nodes the agent changed that the reveal has not finished with: pieces moved or edited (not
191
+ * built, not going out), waiting for their turn, carried or replaying. What a commit that edits and
192
+ * moves is made of, read before its first piece plays.
193
+ */
194
+ export declare function revealChangedNodeIds(): string[];
195
+ /**
196
+ * The build is over (the agent's turn has ended): what lifted out of the way comes back down after
197
+ * a beat, without waiting out the hold. Nothing happens when nothing is up.
198
+ */
199
+ export declare function seatLiftedNow(): void;
200
+ /**
201
+ * When a node that is going out (undone, or deleted) plays, on the reveal clock: its own going
202
+ * starts at `startMs` and takes `durationMs`; a plugin that takes it apart plays `prerollMs` after.
203
+ * Null when the node is not going.
204
+ */
205
+ export declare function getRetractTurn(id: string): {
206
+ startMs: number;
207
+ durationMs: number;
208
+ prerollMs: number;
209
+ } | null;
210
+ /**
211
+ * Takes `ids` back, and what stands under them, by playing their construction in reverse: the last
212
+ * phase built goes first (the furniture lifts away, the roof, the openings close, the walls sink,
213
+ * the slab), the last piece to arrive first within a phase, quicker than the build. It is what an
214
+ * Undo of an agent's build shows before the host takes the nodes out of the scene: the promise
215
+ * resolves when all have gone, the nodes stay hidden until they leave the scene (or a couple of seconds
216
+ * pass, and they come back whole), and the host removes them then. `retract-start` and `retract-end`
217
+ * events say each phase's turn, on the reveal's clock, for step cards, sounds and the camera.
218
+ *
219
+ * Nothing animates (so `instant` is true and nothing is retracted) when no reveal runs, the animation is
220
+ * off, or motion is reduced: the host removes the nodes at once.
221
+ */
222
+ export declare function retractNodes(ids: Iterable<string>): Promise<RetractResult>;
223
+ /**
224
+ * Whether the person's animation setting asks for no motion: Off, or reduced motion. What eases
225
+ * for the eye outside a build (the dive under the ground) is instant then, as the builds are.
226
+ */
227
+ export declare function revealMotionOff(): boolean;
228
+ export type ConstructionRevealOptions = {
229
+ /** Which commits stage their new nodes; every other commit appears at once. */
230
+ reveals: (commit: SceneCommit) => boolean;
231
+ /** How much animation plays; defaults to `full`. Reduced motion always means `off`. */
232
+ level?: () => ConstructionRevealLevel;
233
+ /**
234
+ * The person's animation speed, a multiple of the shipped pace (higher is faster); defaults to ×1.
235
+ * Read when a plan is made: a change applies to the next build and never moves one playing.
236
+ */
237
+ speed?: () => number;
238
+ /**
239
+ * Which commits play the nodes they delete backwards, as a snapshot of their picture (the nodes are out
240
+ * of the scene at once); defaults to `reveals`.
241
+ */
242
+ deletes?: (commit: SceneCommit) => boolean;
243
+ /** Defaults to the `prefers-reduced-motion` media query. */
244
+ prefersReducedMotion?: () => boolean;
245
+ /** Where rising walls and landings puff their dust; none without it. */
246
+ dust?: DustPool;
247
+ };
248
+ export type ConstructionRevealDriver = {
249
+ /**
250
+ * Advances the reveal to `nowMs`, a monotonic frame clock. `frameMs` is how long the last frame really
251
+ * took (the clock steps at most 50 ms a frame): a build waits for the frames to be steady again after
252
+ * the first draw of a kind, which is when its shaders are built.
253
+ */
254
+ tick(nowMs: number, frameMs?: number): void;
255
+ /** Ends every reveal and stops listening. */
256
+ stop(): void;
257
+ };
258
+ /**
259
+ * The reveal without a canvas: `<ConstructionReveal>` calls `tick` every
260
+ * frame. One driver runs at a time; a newer one takes over.
261
+ */
262
+ export declare function startConstructionReveal(options: ConstructionRevealOptions): ConstructionRevealDriver;
263
+ /**
264
+ * Mount inside `<Viewer>` to stage the commits `reveals` selects, at the
265
+ * host's `level`. Hosts that never mount it (the read-only viewer, the bake)
266
+ * show every write at once.
267
+ */
268
+ export declare function ConstructionReveal({ reveals, deletes, level, speed, }: {
269
+ reveals: (commit: SceneCommit) => boolean;
270
+ /** Which commits play what they delete backwards; defaults to `reveals`. */
271
+ deletes?: (commit: SceneCommit) => boolean;
272
+ level?: ConstructionRevealLevel;
273
+ /** The person's animation speed (×0.5 to ×2); a change applies to the next build. */
274
+ speed?: number;
275
+ }): import("react").JSX.Element;
276
+ //# sourceMappingURL=construction-reveal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construction-reveal.d.ts","sourceRoot":"","sources":["../../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