@pascal-app/viewer 1.0.3 → 1.0.5
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/dist/capture/capture-runtime.js +1 -1
- package/dist/components/error-boundary.d.ts.map +1 -1
- package/dist/components/renderers/node-renderer.d.ts +1 -1
- package/dist/components/renderers/node-renderer.d.ts.map +1 -1
- package/dist/components/renderers/node-renderer.js +12 -4
- package/dist/components/renderers/parametric-node-renderer.d.ts.map +1 -1
- package/dist/components/viewer/bvh-ecctrl.d.ts.map +1 -1
- package/dist/components/viewer/frame-limiter.d.ts +1 -0
- package/dist/components/viewer/frame-limiter.d.ts.map +1 -1
- package/dist/components/viewer/frame-limiter.js +22 -3
- package/dist/components/viewer/glb-interactive.d.ts +25 -1
- package/dist/components/viewer/glb-interactive.d.ts.map +1 -1
- package/dist/components/viewer/glb-interactive.js +253 -86
- package/dist/components/viewer/glb-mechanisms.d.ts +10 -0
- package/dist/components/viewer/glb-mechanisms.d.ts.map +1 -0
- package/dist/components/viewer/glb-mechanisms.js +19 -0
- package/dist/components/viewer/glb-reference-nodes.js +1 -1
- package/dist/components/viewer/glb-replace-instances.js +1 -1
- package/dist/components/viewer/glb-scene.d.ts +45 -27
- package/dist/components/viewer/glb-scene.d.ts.map +1 -1
- package/dist/components/viewer/glb-scene.js +421 -508
- package/dist/components/viewer/glb-walkthrough-controller.d.ts +1 -1
- package/dist/components/viewer/glb-walkthrough-controller.d.ts.map +1 -1
- package/dist/components/viewer/glb-walkthrough-controller.js +13 -2
- package/dist/components/viewer/index.d.ts +24 -1
- package/dist/components/viewer/index.d.ts.map +1 -1
- package/dist/components/viewer/index.js +111 -37
- package/dist/components/viewer/lights.d.ts.map +1 -1
- package/dist/components/viewer/lights.js +113 -22
- package/dist/components/viewer/perf-monitor.d.ts.map +1 -1
- package/dist/components/viewer/perf-monitor.js +6 -0
- package/dist/components/viewer/perf-panel.d.ts.map +1 -1
- package/dist/components/viewer/perf-panel.js +1 -1
- package/dist/components/viewer/post-processing.d.ts.map +1 -1
- package/dist/components/viewer/post-processing.js +104 -36
- package/dist/components/viewer/registered-systems.d.ts.map +1 -1
- package/dist/components/viewer/registered-systems.js +17 -3
- package/dist/components/viewer/render-error.d.ts +18 -0
- package/dist/components/viewer/render-error.d.ts.map +1 -0
- package/dist/components/viewer/render-error.js +29 -0
- package/dist/components/viewer/scene-bvh.d.ts.map +1 -1
- package/dist/components/viewer/scene-bvh.js +1 -1
- package/dist/components/viewer/scene-environment.d.ts.map +1 -1
- package/dist/components/viewer/scene-environment.js +31 -11
- package/dist/components/viewer/scene-ground-replacement.d.ts +6 -0
- package/dist/components/viewer/scene-ground-replacement.d.ts.map +1 -1
- package/dist/components/viewer/scene-ground-replacement.js +15 -0
- package/dist/components/viewer/selection-manager.d.ts.map +1 -1
- package/dist/components/viewer/selection-manager.js +25 -7
- package/dist/components/viewer/underground-ambiance.d.ts +9 -0
- package/dist/components/viewer/underground-ambiance.d.ts.map +1 -0
- package/dist/components/viewer/underground-ambiance.js +105 -0
- package/dist/components/viewer/viewer-camera.d.ts +4 -0
- package/dist/components/viewer/viewer-camera.d.ts.map +1 -1
- package/dist/components/viewer/viewer-camera.js +12 -2
- package/dist/components/viewer/viewer-presentations.d.ts.map +1 -1
- package/dist/hooks/use-gltf-ktx2.d.ts.map +1 -1
- package/dist/hooks/use-gltf-ktx2.js +2 -0
- package/dist/hooks/use-node-events.d.ts.map +1 -1
- package/dist/index.d.ts +36 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -19
- package/dist/lib/asset-url.d.ts.map +1 -1
- package/dist/lib/asset-url.js +7 -1
- package/dist/lib/backdrop.d.ts +17 -0
- package/dist/lib/backdrop.d.ts.map +1 -1
- package/dist/lib/backdrop.js +18 -1
- package/dist/lib/construction-dust.d.ts +57 -0
- package/dist/lib/construction-dust.d.ts.map +1 -0
- package/dist/lib/construction-dust.js +187 -0
- package/dist/lib/csg-utils.js +1 -1
- package/dist/lib/display-state.d.ts +25 -0
- package/dist/lib/display-state.d.ts.map +1 -0
- package/dist/lib/display-state.js +1 -0
- package/dist/lib/foundation-materials.d.ts +26 -0
- package/dist/lib/foundation-materials.d.ts.map +1 -0
- package/dist/lib/foundation-materials.js +65 -0
- package/dist/lib/gltf-unlit.d.ts +10 -0
- package/dist/lib/gltf-unlit.d.ts.map +1 -0
- package/dist/lib/gltf-unlit.js +23 -0
- package/dist/lib/ground-window.d.ts +33 -0
- package/dist/lib/ground-window.d.ts.map +1 -0
- package/dist/lib/ground-window.js +114 -0
- package/dist/lib/hero-pose.d.ts +13 -3
- package/dist/lib/hero-pose.d.ts.map +1 -1
- package/dist/lib/hero-pose.js +72 -5
- package/dist/lib/ink-edges.d.ts +6 -3
- package/dist/lib/ink-edges.d.ts.map +1 -1
- package/dist/lib/ink-edges.js +17 -7
- package/dist/lib/key-light-override.d.ts +11 -0
- package/dist/lib/key-light-override.d.ts.map +1 -0
- package/dist/lib/key-light-override.js +14 -0
- package/dist/lib/ktx2-loader.d.ts +7 -0
- package/dist/lib/ktx2-loader.d.ts.map +1 -1
- package/dist/lib/ktx2-loader.js +35 -0
- package/dist/lib/layer-pass.d.ts.map +1 -1
- package/dist/lib/layers.d.ts +11 -7
- package/dist/lib/layers.d.ts.map +1 -1
- package/dist/lib/layers.js +16 -6
- package/dist/lib/live-frame-hold.d.ts +14 -0
- package/dist/lib/live-frame-hold.d.ts.map +1 -0
- package/dist/lib/live-frame-hold.js +28 -0
- package/dist/lib/materials.d.ts +19 -7
- package/dist/lib/materials.d.ts.map +1 -1
- package/dist/lib/materials.js +65 -9
- package/dist/lib/merged-outline-node.d.ts +5 -0
- package/dist/lib/merged-outline-node.d.ts.map +1 -1
- package/dist/lib/merged-outline-node.js +80 -2
- package/dist/lib/node-top-surface-height.d.ts +6 -0
- package/dist/lib/node-top-surface-height.d.ts.map +1 -0
- package/dist/lib/node-top-surface-height.js +74 -0
- package/dist/lib/perf-probe-state.d.ts +39 -0
- package/dist/lib/perf-probe-state.d.ts.map +1 -0
- package/dist/lib/perf-probe-state.js +17 -0
- package/dist/lib/pointer-events.d.ts +26 -2
- package/dist/lib/pointer-events.d.ts.map +1 -1
- package/dist/lib/pointer-events.js +99 -12
- package/dist/lib/post-processing-resources.d.ts.map +1 -1
- package/dist/lib/procedural-emission.d.ts +7 -0
- package/dist/lib/procedural-emission.d.ts.map +1 -0
- package/dist/lib/procedural-emission.js +54 -0
- package/dist/lib/reveal-candidates.d.ts +80 -0
- package/dist/lib/reveal-candidates.d.ts.map +1 -0
- package/dist/lib/reveal-candidates.js +524 -0
- package/dist/lib/reveal-ghost.d.ts +9 -0
- package/dist/lib/reveal-ghost.d.ts.map +1 -0
- package/dist/lib/reveal-ghost.js +62 -0
- package/dist/lib/reveal-pending.d.ts +12 -0
- package/dist/lib/reveal-pending.d.ts.map +1 -0
- package/dist/lib/reveal-pending.js +12 -0
- package/dist/lib/reveal-pose.d.ts +70 -0
- package/dist/lib/reveal-pose.d.ts.map +1 -0
- package/dist/lib/reveal-pose.js +248 -0
- package/dist/lib/reveal-schedule.d.ts +208 -0
- package/dist/lib/reveal-schedule.d.ts.map +1 -0
- package/dist/lib/reveal-schedule.js +410 -0
- package/dist/lib/reveal-texture-scale.d.ts +5 -0
- package/dist/lib/reveal-texture-scale.d.ts.map +1 -0
- package/dist/lib/reveal-texture-scale.js +113 -0
- package/dist/lib/reveal-windows.d.ts +23 -0
- package/dist/lib/reveal-windows.d.ts.map +1 -0
- package/dist/lib/reveal-windows.js +31 -0
- package/dist/lib/reveal-wipe.d.ts +71 -0
- package/dist/lib/reveal-wipe.d.ts.map +1 -0
- package/dist/lib/reveal-wipe.js +105 -0
- package/dist/lib/scene-pass-mrt.d.ts +12 -0
- package/dist/lib/scene-pass-mrt.d.ts.map +1 -0
- package/dist/lib/scene-pass-mrt.js +23 -0
- package/dist/lib/scene-support-height.d.ts +4 -0
- package/dist/lib/scene-support-height.d.ts.map +1 -0
- package/dist/lib/scene-support-height.js +34 -0
- package/dist/lib/scene-themes.d.ts +30 -8
- package/dist/lib/scene-themes.d.ts.map +1 -1
- package/dist/lib/scene-themes.js +36 -0
- package/dist/lib/scene-visibility.d.ts +17 -1
- package/dist/lib/scene-visibility.d.ts.map +1 -1
- package/dist/lib/scene-visibility.js +53 -3
- package/dist/lib/scripted-opening.d.ts +11 -0
- package/dist/lib/scripted-opening.d.ts.map +1 -0
- package/dist/lib/scripted-opening.js +20 -0
- package/dist/lib/site-surfaces.d.ts +32 -0
- package/dist/lib/site-surfaces.d.ts.map +1 -0
- package/dist/lib/site-surfaces.js +70 -0
- package/dist/lib/snapshot-pipeline.d.ts +34 -3
- package/dist/lib/snapshot-pipeline.d.ts.map +1 -1
- package/dist/lib/snapshot-pipeline.js +247 -117
- package/dist/lib/terrain-perimeter-fill.d.ts.map +1 -1
- package/dist/lib/terrain-perimeter-fill.js +22 -14
- package/dist/lib/tsl-compat.d.ts +2 -2
- package/dist/lib/tsl-compat.d.ts.map +1 -1
- package/dist/lib/underground-ambiance.d.ts +168 -0
- package/dist/lib/underground-ambiance.d.ts.map +1 -0
- package/dist/lib/underground-ambiance.js +334 -0
- package/dist/lib/zone-geometry.d.ts +11 -0
- package/dist/lib/zone-geometry.d.ts.map +1 -0
- package/dist/lib/zone-geometry.js +46 -0
- package/dist/store/use-item-light-pool.d.ts +14 -10
- package/dist/store/use-item-light-pool.d.ts.map +1 -1
- package/dist/store/use-item-light-pool.js +52 -26
- package/dist/store/use-viewer.d.ts +194 -26
- package/dist/store/use-viewer.d.ts.map +1 -1
- package/dist/store/use-viewer.js +164 -21
- package/dist/systems/ceiling/ceiling-system.d.ts +15 -1
- package/dist/systems/ceiling/ceiling-system.d.ts.map +1 -1
- package/dist/systems/ceiling/ceiling-system.js +88 -6
- package/dist/systems/construction-reveal/construction-dust.d.ts +16 -0
- package/dist/systems/construction-reveal/construction-dust.d.ts.map +1 -0
- package/dist/systems/construction-reveal/construction-dust.js +92 -0
- package/dist/systems/construction-reveal/construction-reveal.d.ts +276 -0
- package/dist/systems/construction-reveal/construction-reveal.d.ts.map +1 -0
- package/dist/systems/construction-reveal/construction-reveal.js +2383 -0
- package/dist/systems/construction-reveal/dust-material.d.ts +10 -0
- package/dist/systems/construction-reveal/dust-material.d.ts.map +1 -0
- package/dist/systems/construction-reveal/dust-material.js +17 -0
- package/dist/systems/construction-reveal/ghost-dress.d.ts +10 -0
- package/dist/systems/construction-reveal/ghost-dress.d.ts.map +1 -0
- package/dist/systems/construction-reveal/ghost-dress.js +24 -0
- package/dist/systems/door/door-system.d.ts.map +1 -1
- package/dist/systems/door/door-system.js +55 -17
- package/dist/systems/elevator/elevator-interaction-system.d.ts +7 -0
- package/dist/systems/elevator/elevator-interaction-system.d.ts.map +1 -1
- package/dist/systems/elevator/elevator-interaction-system.js +18 -1
- package/dist/systems/floor-elevation/floor-elevation-system.d.ts +3 -1
- package/dist/systems/floor-elevation/floor-elevation-system.d.ts.map +1 -1
- package/dist/systems/floor-elevation/floor-elevation-system.js +33 -5
- package/dist/systems/geometry/geometry-system.d.ts.map +1 -1
- package/dist/systems/geometry/geometry-system.js +71 -11
- package/dist/systems/interactive/control-widget.d.ts.map +1 -1
- package/dist/systems/interactive/interactive-system.d.ts.map +1 -1
- package/dist/systems/interactive/interactive-system.js +52 -17
- package/dist/systems/interactive/procedural-controls.d.ts +13 -0
- package/dist/systems/interactive/procedural-controls.d.ts.map +1 -0
- package/dist/systems/interactive/procedural-controls.js +17 -0
- package/dist/systems/interactive/scripted-clips.d.ts +19 -0
- package/dist/systems/interactive/scripted-clips.d.ts.map +1 -0
- package/dist/systems/interactive/scripted-clips.js +134 -0
- package/dist/systems/item/item-system.d.ts.map +1 -1
- package/dist/systems/item/item-system.js +9 -3
- package/dist/systems/item/object-cut-invalidation.d.ts +3 -0
- package/dist/systems/item/object-cut-invalidation.d.ts.map +1 -0
- package/dist/systems/item/object-cut-invalidation.js +68 -0
- package/dist/systems/item-light/item-light-system.d.ts +1 -1
- package/dist/systems/item-light/item-light-system.d.ts.map +1 -1
- package/dist/systems/item-light/item-light-system.js +48 -53
- package/dist/systems/level/level-hold.d.ts +4 -0
- package/dist/systems/level/level-hold.d.ts.map +1 -0
- package/dist/systems/level/level-hold.js +14 -0
- package/dist/systems/level/level-system.d.ts.map +1 -1
- package/dist/systems/level/level-system.js +19 -6
- package/dist/systems/level/level-utils.d.ts +19 -6
- package/dist/systems/level/level-utils.d.ts.map +1 -1
- package/dist/systems/level/level-utils.js +68 -9
- package/dist/systems/level/shadow-only-levels.d.ts +9 -0
- package/dist/systems/level/shadow-only-levels.d.ts.map +1 -0
- package/dist/systems/level/shadow-only-levels.js +7 -0
- package/dist/systems/roof/__fixtures__/roof-plane-cases.d.ts +103 -0
- package/dist/systems/roof/__fixtures__/roof-plane-cases.d.ts.map +1 -0
- package/dist/systems/roof/__fixtures__/roof-plane-cases.js +317 -0
- package/dist/systems/roof/roof-materials.d.ts +16 -2
- package/dist/systems/roof/roof-materials.d.ts.map +1 -1
- package/dist/systems/roof/roof-materials.js +64 -31
- package/dist/systems/roof/roof-system.d.ts +21 -4
- package/dist/systems/roof/roof-system.d.ts.map +1 -1
- package/dist/systems/roof/roof-system.js +374 -49
- package/dist/systems/slab/slab-system.d.ts +1 -1
- package/dist/systems/slab/slab-system.d.ts.map +1 -1
- package/dist/systems/slab/slab-system.js +49 -19
- package/dist/systems/stair/stair-system.d.ts.map +1 -1
- package/dist/systems/stair/stair-system.js +133 -354
- package/dist/systems/wall/wall-cutout-cache.d.ts +39 -3
- package/dist/systems/wall/wall-cutout-cache.d.ts.map +1 -1
- package/dist/systems/wall/wall-cutout-cache.js +141 -19
- package/dist/systems/wall/wall-cutout.d.ts +6 -0
- package/dist/systems/wall/wall-cutout.d.ts.map +1 -1
- package/dist/systems/wall/wall-cutout.js +42 -28
- package/dist/systems/wall/wall-finish-data.d.ts +22 -0
- package/dist/systems/wall/wall-finish-data.d.ts.map +1 -0
- package/dist/systems/wall/wall-finish-data.js +17 -0
- package/dist/systems/wall/wall-material-variant.d.ts.map +1 -1
- package/dist/systems/wall/wall-materials.d.ts +9 -4
- package/dist/systems/wall/wall-materials.d.ts.map +1 -1
- package/dist/systems/wall/wall-materials.js +135 -153
- package/dist/systems/wall/wall-placeholder-sweep.d.ts.map +1 -1
- package/dist/systems/wall/wall-system.d.ts +33 -2
- package/dist/systems/wall/wall-system.d.ts.map +1 -1
- package/dist/systems/wall/wall-system.js +621 -159
- package/dist/systems/window/corner-frame.d.ts +10 -0
- package/dist/systems/window/corner-frame.d.ts.map +1 -0
- package/dist/systems/window/corner-frame.js +17 -0
- package/dist/systems/window/window-system.d.ts +1 -1
- package/dist/systems/window/window-system.d.ts.map +1 -1
- package/dist/systems/window/window-system.js +71 -27
- package/package.json +10 -10
- package/dist/systems/fence/fence-system.d.ts +0 -22
- package/dist/systems/fence/fence-system.d.ts.map +0 -1
- package/dist/systems/fence/fence-system.js +0 -357
|
@@ -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":["../../../src/systems/construction-reveal/construction-reveal.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,OAAO,EAOZ,KAAK,WAAW,EAChB,KAAK,WAAW,EAIjB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EAAuB,OAAO,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAiC,MAAM,6BAA6B,CAAA;AAErF,OAAO,EAGL,KAAK,uBAAuB,EAQ7B,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAiB,MAAM,0BAA0B,CAAA;AAezE,OAAO,EAYL,KAAK,eAAe,EAKrB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAML,KAAK,WAAW,EAEjB,MAAM,uBAAuB,CAAA;AAO9B;;;;;;;;;;;;;;GAcG;AAEH,YAAY,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,CAAA;AAgE1B,MAAM,MAAM,gBAAgB,GAAG;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAA;AAE7E;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;IACjC,KAAK,EAAE,WAAW,CAAA;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,2FAA2F;IAC3F,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1B,+DAA+D;IAC/D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,oFAAoF;IACpF,OAAO,CAAC,EAAE,IAAI,CAAA;CACf,CAAA;AAED,kCAAkC;AAClC,MAAM,MAAM,oBAAoB,GA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