@relu-interactives/spatial-ecs 0.8.0 → 0.10.0

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 (56) hide show
  1. package/dist/{System-8D-XBDKZ.d.cts → System-BldSHxZV.d.cts} +214 -81
  2. package/dist/{System-DPMAW30g.d.ts → System-CADhPyQs.d.ts} +214 -81
  3. package/dist/{XRHandPose-G0Dl-F0w.d.ts → XRHandPose-BNSwd1y9.d.ts} +145 -2
  4. package/dist/{XRHandPose-VQMT1WXj.d.cts → XRHandPose-D3Ab1Dfs.d.cts} +145 -2
  5. package/dist/{chunk-G4XJ53LS.js → chunk-JEPUCLZX.js} +3 -3
  6. package/dist/{chunk-G4XJ53LS.js.map → chunk-JEPUCLZX.js.map} +1 -1
  7. package/dist/{chunk-NNDUOQ7O.js → chunk-JNYPJB55.js} +250 -3
  8. package/dist/chunk-JNYPJB55.js.map +1 -0
  9. package/dist/{chunk-SGF73YTF.js → chunk-NXASMBDS.js} +4 -4
  10. package/dist/{chunk-SGF73YTF.js.map → chunk-NXASMBDS.js.map} +1 -1
  11. package/dist/{chunk-JIJQFW6P.js → chunk-TY3XCHOR.js} +1390 -485
  12. package/dist/chunk-TY3XCHOR.js.map +1 -0
  13. package/dist/{chunk-U727NTWQ.js → chunk-WWP46AEF.js} +26 -4
  14. package/dist/chunk-WWP46AEF.js.map +1 -0
  15. package/dist/components/index.cjs +151 -0
  16. package/dist/components/index.cjs.map +1 -1
  17. package/dist/components/index.d.cts +3 -3
  18. package/dist/components/index.d.ts +3 -3
  19. package/dist/components/index.js +1 -1
  20. package/dist/docs/guide/bone-attachments-and-ik.md +1 -1
  21. package/dist/docs/guide/multiplayer.md +65 -0
  22. package/dist/docs/guide/spatial-ui.md +83 -7
  23. package/dist/factories/index.cjs +151 -0
  24. package/dist/factories/index.cjs.map +1 -1
  25. package/dist/factories/index.d.cts +2 -2
  26. package/dist/factories/index.d.ts +2 -2
  27. package/dist/factories/index.js +3 -3
  28. package/dist/{index-C61n65PE.d.ts → index-6pZO_gV7.d.ts} +27 -2
  29. package/dist/{index-D9DjrUn3.d.cts → index-BXjwEdNq.d.cts} +6 -3
  30. package/dist/{index-C70N4BYG.d.cts → index-BdghvXKE.d.cts} +27 -2
  31. package/dist/{index-DppafVu4.d.ts → index-CVG-hREM.d.ts} +6 -3
  32. package/dist/index.cjs +1800 -626
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.cts +8 -30
  35. package/dist/index.d.ts +8 -30
  36. package/dist/index.js +10 -10
  37. package/dist/network/index.cjs +858 -8
  38. package/dist/network/index.cjs.map +1 -1
  39. package/dist/network/index.d.cts +126 -5
  40. package/dist/network/index.d.ts +126 -5
  41. package/dist/network/index.js +683 -8
  42. package/dist/network/index.js.map +1 -1
  43. package/dist/systems/index.cjs +1702 -528
  44. package/dist/systems/index.cjs.map +1 -1
  45. package/dist/systems/index.d.cts +2 -2
  46. package/dist/systems/index.d.ts +2 -2
  47. package/dist/systems/index.js +4 -4
  48. package/dist/types.d.cts +1 -1
  49. package/dist/types.d.ts +1 -1
  50. package/dist/webgpu/index.d.ts +2 -2
  51. package/dist/worldSnapshotUtils.d.cts +1 -1
  52. package/dist/worldSnapshotUtils.d.ts +1 -1
  53. package/package.json +1 -1
  54. package/dist/chunk-JIJQFW6P.js.map +0 -1
  55. package/dist/chunk-NNDUOQ7O.js.map +0 -1
  56. package/dist/chunk-U727NTWQ.js.map +0 -1
@@ -127,6 +127,106 @@ declare class SlotChooser {
127
127
  choose(id: string, slot: SoundSlot, now: number): SoundTake | null;
128
128
  }
129
129
 
130
+ /**
131
+ * The volume groups every sound plays through: each sound's output goes to its
132
+ * bus instead of straight to the listener, so a game can turn music down
133
+ * without touching a single sound, and music dips while a voice plays.
134
+ */
135
+ declare class AudioMixer {
136
+ readonly listener: THREE.AudioListener;
137
+ private readonly buses;
138
+ private readonly volumes;
139
+ private readonly routed;
140
+ constructor(listener: THREE.AudioListener);
141
+ /** The node a sound connects to for this bus. */
142
+ input(bus: AudioBus): GainNode;
143
+ /** Send a three.js sound through a bus. Does nothing when it's already there. */
144
+ route(sound: THREE.Audio<GainNode> | THREE.PositionalAudio, bus: AudioBus): void;
145
+ setVolume(bus: AudioBus, volume: number): void;
146
+ getVolume(bus: AudioBus): number;
147
+ /** Dip the music for `seconds`, then bring it back. A later duck replaces this one. */
148
+ duckMusic(seconds: number): void;
149
+ dispose(): void;
150
+ }
151
+
152
+ /** Options for {@link AudioSystem.playSlot}. */
153
+ type PlaySlotOptions = {
154
+ /** Multiplies the slot's volume. */
155
+ volume?: number;
156
+ /** Play from this point in the world instead of everywhere. */
157
+ position?: {
158
+ x: number;
159
+ y: number;
160
+ z: number;
161
+ };
162
+ };
163
+ /**
164
+ * Reconciles `AudioComponent` state with the underlying THREE.js audio objects
165
+ * each frame.
166
+ *
167
+ * **Playback** — drives `play()`, `pause()`, and `stop()` on the THREE.js
168
+ * audio node based on the `isPlaying` / `isPaused` flags set by
169
+ * `AudioComponent.play()`, `.pause()`, and `.stop()`.
170
+ *
171
+ * **Option sync** — detects changes to `loop`, `pitch`, `volume`,
172
+ * `refDistance`, `distanceModel`, and `rolloffFactor` and applies them live.
173
+ * Changes take effect on the next frame, so scripts and inspector edits during
174
+ * runtime are reflected without reloading the scene.
175
+ *
176
+ * **Mixing** — every sound plays through a bus (`sfx`, `voice`, `music`) with
177
+ * its own volume, and music dips while a voice plays.
178
+ *
179
+ * **Sound banks** — {@link loadSoundBank} and {@link playSlot} play named
180
+ * sounds from a `.soundbank.json` asset, as a random take.
181
+ *
182
+ * Only active in **preview** mode (`isEditor: true` makes every update a
183
+ * no-op so the editor is unaffected).
184
+ *
185
+ * @category Systems
186
+ */
187
+ declare class AudioSystem implements EcsSystem {
188
+ private readonly isEditor;
189
+ /** THREE.js `isPlaying` state captured at the end of the previous frame. */
190
+ private readonly prevPlayingState;
191
+ /** Snapshot of options applied in the previous frame, for change detection. */
192
+ private readonly prevOptions;
193
+ /** Tracks entities that were stopped due to invisibility. */
194
+ private readonly stoppedDueToInvisibility;
195
+ private world;
196
+ private mixer;
197
+ private readonly slots;
198
+ private readonly buffers;
199
+ private readonly chooser;
200
+ private voice;
201
+ constructor({ isEditor }?: {
202
+ isEditor?: boolean;
203
+ });
204
+ /** Scripts can load a bank in `init`, before this system's first update. */
205
+ attachWorld(world: World): void;
206
+ /** The mixer, made with the listener on first use. */
207
+ getMixer(): AudioMixer | null;
208
+ /** Set a bus's volume (`0` silent, `1` as mixed). */
209
+ setBusVolume(bus: AudioBus, volume: number): void;
210
+ getBusVolume(bus: AudioBus): number;
211
+ /**
212
+ * Fetch a `.soundbank.json` and decode its recordings. Its slots add to any
213
+ * loaded before, and a slot id used twice takes the later one.
214
+ * @param source an asset path, or a script's `AssetInput` field
215
+ */
216
+ loadSoundBank(source: string | {
217
+ path: string;
218
+ }): Promise<void>;
219
+ /**
220
+ * Play a named sound from a loaded bank. Returns whether it sounded: a slot's
221
+ * chance, cooldown and priority can each keep it quiet, and that's normal.
222
+ */
223
+ playSlot(id: string, options?: PlaySlotOptions): boolean;
224
+ update(world: World, _deltaTime: number): void;
225
+ /** Apply any changed options from the component to the THREE.js audio node. */
226
+ private _syncOptions;
227
+ dispose(_world: World): void;
228
+ }
229
+
130
230
  /** Skybox rendering modes. `none` disables skybox rendering entirely. */
131
231
  type EnvironmentSkyboxType = "gradient" | "color" | "image" | "none";
132
232
  /** Gradient distribution applied when {@link EnvironmentSkyboxState.type} is `"gradient"`. */
@@ -687,6 +787,67 @@ type NetEntityView = {
687
787
  props: Record<string, string>;
688
788
  };
689
789
  type NetPose = Pick<NetEntityView, "x" | "y" | "z" | "qx" | "qy" | "qz" | "qw">;
790
+ /** A sound-bank slot one player plays for everyone. */
791
+ type NetSound = {
792
+ id: string;
793
+ volume?: number;
794
+ x?: number;
795
+ y?: number;
796
+ z?: number;
797
+ };
798
+ /** What sets up a direct voice connection between two players. */
799
+ type VoiceSignal = {
800
+ kind: "offer" | "answer";
801
+ sdp: string;
802
+ } | {
803
+ kind: "ice";
804
+ candidate: RTCIceCandidateInit;
805
+ };
806
+ type VoiceToRoom = {
807
+ t: "hello";
808
+ } | {
809
+ t: "join";
810
+ } | {
811
+ t: "leave";
812
+ } | {
813
+ t: "mic";
814
+ on: boolean;
815
+ } | {
816
+ t: "signal";
817
+ to: string;
818
+ signal: VoiceSignal;
819
+ };
820
+ type VoiceFromRoom = {
821
+ t: "caps";
822
+ available: boolean;
823
+ maxPeers: number;
824
+ } | {
825
+ t: "welcome";
826
+ peers: {
827
+ id: string;
828
+ mic: boolean;
829
+ }[];
830
+ iceServers: RTCIceServer[];
831
+ /** Send through the relay only, so players never see each other's addresses. */
832
+ relayOnly: boolean;
833
+ } | {
834
+ t: "refused";
835
+ reason: "off" | "full";
836
+ } | {
837
+ t: "joined";
838
+ id: string;
839
+ } | {
840
+ t: "left";
841
+ id: string;
842
+ } | {
843
+ t: "mic";
844
+ id: string;
845
+ on: boolean;
846
+ } | {
847
+ t: "signal";
848
+ from: string;
849
+ signal: VoiceSignal;
850
+ };
690
851
  /** What a shared-world connection must do. `ColyseusTransport` is the real one. */
691
852
  interface NetworkTransport {
692
853
  readonly sessionId: string;
@@ -702,6 +863,9 @@ interface NetworkTransport {
702
863
  onMessage(cb: (name: string, payload: unknown, from: string) => void): void;
703
864
  /** The server overruled the owner's pose. */
704
865
  onCorrect(cb: (id: string, pose: NetPose) => void): void;
866
+ /** Another player played a sound for everyone. */
867
+ onSound(cb: (sound: NetSound, from: string) => void): void;
868
+ onVoice(cb: (message: VoiceFromRoom) => void): void;
705
869
  onClose(cb: () => void): void;
706
870
  /** Tell the room about the scene's shared objects; the first client's copy wins. */
707
871
  registerScene(entities: (NetPose & {
@@ -716,6 +880,8 @@ interface NetworkTransport {
716
880
  sendPose(id: string, pose: NetPose): void;
717
881
  setProp(id: string, key: string, json: string): void;
718
882
  send(name: string, payload: unknown): void;
883
+ sendSound(sound: NetSound): void;
884
+ sendVoice(message: VoiceToRoom): void;
719
885
  leave(): void;
720
886
  }
721
887
  /** Options for {@link NetworkHandle.spawn}. */
@@ -733,6 +899,42 @@ type NetSpawnOptions = {
733
899
  };
734
900
  props?: Record<string, NetValue>;
735
901
  };
902
+ /** Someone else in voice chat. */
903
+ interface VoicePeer {
904
+ readonly id: string;
905
+ /** The direct connection is up. */
906
+ readonly connected: boolean;
907
+ readonly talking: boolean;
908
+ /** They haven't muted their own mic. */
909
+ readonly micOn: boolean;
910
+ /** This player muted them. */
911
+ readonly muted: boolean;
912
+ readonly volume: number;
913
+ }
914
+ /** Voice chat: `this.network.voice`, `null` when the project doesn't have it on. */
915
+ interface VoiceHandle {
916
+ /** The room offers voice and this page can use a mic. */
917
+ readonly available: boolean;
918
+ readonly state: "off" | "connecting" | "on";
919
+ readonly micMuted: boolean;
920
+ /** This player is talking right now. */
921
+ readonly talking: boolean;
922
+ /** Why the last attempt failed, in words for the player. */
923
+ readonly error: string;
924
+ readonly peers: VoicePeer[];
925
+ /** Hear each voice from its character, when there is one. On by default. */
926
+ positional: boolean;
927
+ /** Turn voice on. Call from a tap or key: that's what lets the browser ask for the mic. */
928
+ enable(): Promise<boolean>;
929
+ disable(): void;
930
+ setMicMuted(muted: boolean): Promise<void>;
931
+ /** Stop hearing someone. They aren't told. */
932
+ setPeerMuted(id: string, muted: boolean): void;
933
+ /** 0 to 2. */
934
+ setPeerVolume(id: string, volume: number): void;
935
+ /** Something above changed. Returns the way to stop listening. */
936
+ onChange(listener: () => void): () => void;
937
+ }
736
938
  /** A Behaviour's view of the shared world: `this.network`, `null` in a single-player run. */
737
939
  interface NetworkHandle {
738
940
  readonly connected: boolean;
@@ -744,10 +946,17 @@ interface NetworkHandle {
744
946
  readonly isOwner: boolean;
745
947
  /** Everyone in the room, by session id. */
746
948
  readonly players: string[];
949
+ /** Voice chat, when the project has it on. */
950
+ readonly voice: VoiceHandle | null;
747
951
  /** Send to the room. Others hear it in `onMessage`, unless a server hook keeps it. */
748
952
  send(name: string, payload?: unknown): void;
749
953
  /** Listen for a message. Returns the way to stop. */
750
954
  onMessage(name: string, handler: (payload: unknown, from: string) => void): () => void;
955
+ /**
956
+ * Play a sound-bank slot here and for everyone in the room. Returns whether it
957
+ * sounded: a slot's chance and cooldown can keep it quiet, and then no one hears it.
958
+ */
959
+ playSlot(id: string, options?: PlaySlotOptions): boolean;
751
960
  /** Spawn a prefab everyone sees, owned by this client. */
752
961
  spawn(prefab: string | {
753
962
  path: string;
@@ -1402,84 +1611,6 @@ declare class TransformSyncSystem implements EcsSystem {
1402
1611
  update(world: World): void;
1403
1612
  }
1404
1613
 
1405
- /** Options for {@link AudioSystem.playSlot}. */
1406
- type PlaySlotOptions = {
1407
- /** Multiplies the slot's volume. */
1408
- volume?: number;
1409
- /** Play from this point in the world instead of everywhere. */
1410
- position?: {
1411
- x: number;
1412
- y: number;
1413
- z: number;
1414
- };
1415
- };
1416
- /**
1417
- * Reconciles `AudioComponent` state with the underlying THREE.js audio objects
1418
- * each frame.
1419
- *
1420
- * **Playback** — drives `play()`, `pause()`, and `stop()` on the THREE.js
1421
- * audio node based on the `isPlaying` / `isPaused` flags set by
1422
- * `AudioComponent.play()`, `.pause()`, and `.stop()`.
1423
- *
1424
- * **Option sync** — detects changes to `loop`, `pitch`, `volume`,
1425
- * `refDistance`, `distanceModel`, and `rolloffFactor` and applies them live.
1426
- * Changes take effect on the next frame, so scripts and inspector edits during
1427
- * runtime are reflected without reloading the scene.
1428
- *
1429
- * **Mixing** — every sound plays through a bus (`sfx`, `voice`, `music`) with
1430
- * its own volume, and music dips while a voice plays.
1431
- *
1432
- * **Sound banks** — {@link loadSoundBank} and {@link playSlot} play named
1433
- * sounds from a `.soundbank.json` asset, as a random take.
1434
- *
1435
- * Only active in **preview** mode (`isEditor: true` makes every update a
1436
- * no-op so the editor is unaffected).
1437
- *
1438
- * @category Systems
1439
- */
1440
- declare class AudioSystem implements EcsSystem {
1441
- private readonly isEditor;
1442
- /** THREE.js `isPlaying` state captured at the end of the previous frame. */
1443
- private readonly prevPlayingState;
1444
- /** Snapshot of options applied in the previous frame, for change detection. */
1445
- private readonly prevOptions;
1446
- /** Tracks entities that were stopped due to invisibility. */
1447
- private readonly stoppedDueToInvisibility;
1448
- private world;
1449
- private mixer;
1450
- private readonly slots;
1451
- private readonly buffers;
1452
- private readonly chooser;
1453
- private voice;
1454
- constructor({ isEditor }?: {
1455
- isEditor?: boolean;
1456
- });
1457
- /** Scripts can load a bank in `init`, before this system's first update. */
1458
- attachWorld(world: World): void;
1459
- /** The mixer, made with the listener on first use. */
1460
- private getMixer;
1461
- /** Set a bus's volume (`0` silent, `1` as mixed). */
1462
- setBusVolume(bus: AudioBus, volume: number): void;
1463
- getBusVolume(bus: AudioBus): number;
1464
- /**
1465
- * Fetch a `.soundbank.json` and decode its recordings. Its slots add to any
1466
- * loaded before, and a slot id used twice takes the later one.
1467
- * @param source an asset path, or a script's `AssetInput` field
1468
- */
1469
- loadSoundBank(source: string | {
1470
- path: string;
1471
- }): Promise<void>;
1472
- /**
1473
- * Play a named sound from a loaded bank. Returns whether it sounded: a slot's
1474
- * chance, cooldown and priority can each keep it quiet, and that's normal.
1475
- */
1476
- playSlot(id: string, options?: PlaySlotOptions): boolean;
1477
- update(world: World, _deltaTime: number): void;
1478
- /** Apply any changed options from the component to the THREE.js audio node. */
1479
- private _syncOptions;
1480
- dispose(_world: World): void;
1481
- }
1482
-
1483
1614
  /**
1484
1615
  * Runs each {@link IKComponent}'s chains after the animation: hands and feet
1485
1616
  * reach their target entities. Bones the animation doesn't drive would keep
@@ -1490,8 +1621,10 @@ declare class AudioSystem implements EcsSystem {
1490
1621
  */
1491
1622
  declare class IKSystem implements EcsSystem {
1492
1623
  private readonly runtimes;
1493
- private readonly reach;
1494
- /** How far a limb's end stayed from its target last frame, in metres (0 = reached). */
1624
+ /**
1625
+ * How far a limb's end stayed from its target last frame, in metres
1626
+ * (0 = reached), or null if the limb's chain didn't run.
1627
+ */
1495
1628
  getReachError(entityId: EntityId, limb: IKLimb): number | null;
1496
1629
  private restore;
1497
1630
  update(world: World): void;
@@ -1880,4 +2013,4 @@ interface EcsSystem {
1880
2013
  dispose?(world: World): void;
1881
2014
  }
1882
2015
 
1883
- export { type EcsEntityKind as $, type TransformData as A, normalizeEnvironmentLighting as B, type ChromaKeyOptions as C, DEFAULT_ENVIRONMENT_LIGHTING as D, type EcsRenderer as E, normalizeIKChain as F, type NetworkTransport as G, type NetEntityView as H, type IKChain as I, type NetPose as J, type EcsSystem as K, type NetworkService as L, type EntityId as M, type NetValue as N, type NetworkHandle as O, type PostprocessingPipeline as P, type NetSpawnOptions as Q, type RenderBackend as R, type WorldEntityView$1 as S, TransformComponent as T, type SpawnPrefabSource as U, type Vec3$1 as V, World as W, type SpawnPrefabOptions as X, type PlaySlotOptions as Y, type ComponentClass as Z, type ParentLookup as _, type PostprocessingBuildContext as a, ObjectManagementSystem as a0, type SubtreeSnapshot as a1, type ExternalRefWarning as a2, type AudioBus as a3, type AssetInput as a4, AudioSystem as a5, type CheckboxInput as a6, type ColorInput as a7, type ComponentFactory as a8, type ComponentInput as a9, SlotChooser as aA, type SoundBankAsset as aB, type SoundSlot as aC, type SoundTake as aD, type TextInput as aE, type ToggleInput as aF, TransformSyncSystem as aG, type Vec3 as aH, type Vector2Input as aI, type Vector3Input as aJ, clearPrefabCache as aK, despawnPrefab as aL, findModelBone as aM, listModelBones as aN, loadPrefab as aO, parsePrefabAsset as aP, prefabFileVersionFor as aQ, remapSnapshotEntityIds as aR, setPrefabAssetUrlResolver as aS, soundBankFiles as aT, spawnPrefab as aU, type AnyComponent as aV, DEBUG_CHANGE_IGNORED_SYSTEMS as aW, type WorldHistorySnapshot as aX, cloneHistoryValue as aY, normalizeDebugValue as aZ, type ComponentKind as aa, type DropdownInput as ab, type DropdownOption as ac, type EcsComponentFactoryKind as ad, type EcsEntityEditorKind as ae, type EntityInput as af, type FloatInput as ag, IKSystem as ah, InputSystem as ai, type IntersectionResult as aj, type KeyboardKey as ak, KeyboardKeys as al, type ModelBoneInfo as am, type MouseButton as an, PREFAB_FILE_VERSION as ao, PREFAB_FILE_VERSION_NESTED as ap, type PrefabAsset as aq, type RemapSnapshotOptions as ar, RenderSystem as as, type ScriptErrorEvent as at, type ScriptErrorListener as au, type ScriptErrorPhase as av, type ScriptErrorReport as aw, type ScriptErrorSource as ax, type SelectionListener as ay, type SliderInput as az, type PostprocessingState as b, type RendererKind as c, Component as d, DEFAULT_ENVIRONMENT_STATE as e, DEFAULT_POSTPROCESSING_STATE as f, Environment as g, type EnvironmentFogState as h, type EnvironmentFogType as i, type EnvironmentGradientEffect as j, type EnvironmentLightingState as k, type EnvironmentSkyboxImageProjection as l, type EnvironmentSkyboxState as m, type EnvironmentSkyboxType as n, type EnvironmentState as o, type EnvironmentToneMapping as p, IKComponent as q, type IKLimb as r, type IKOptions as s, NetworkIdentityComponent as t, NetworkSpawnerComponent as u, NetworkTransformComponent as v, type NetworkTransformOptions as w, NetworkedPropsComponent as x, ParentId as y, Postprocessing as z };
2016
+ export { type WorldEntityView$1 as $, type TransformData as A, normalizeEnvironmentLighting as B, type ChromaKeyOptions as C, DEFAULT_ENVIRONMENT_LIGHTING as D, type EcsRenderer as E, normalizeIKChain as F, type NetworkTransport as G, type NetEntityView as H, type IKChain as I, type NetPose as J, type NetSound as K, type VoiceFromRoom as L, type VoiceToRoom as M, type NetValue as N, type VoiceHandle as O, type PostprocessingPipeline as P, type VoicePeer as Q, type RenderBackend as R, type EcsSystem as S, TransformComponent as T, type NetworkService as U, type Vec3$1 as V, World as W, type EntityId as X, type NetworkHandle as Y, type NetSpawnOptions as Z, type VoiceSignal as _, type PostprocessingBuildContext as a, spawnPrefab as a$, type SpawnPrefabSource as a0, type SpawnPrefabOptions as a1, type PlaySlotOptions as a2, type ComponentClass as a3, type ParentLookup as a4, type EcsEntityKind as a5, ObjectManagementSystem as a6, type SubtreeSnapshot as a7, type ExternalRefWarning as a8, type AssetInput as a9, type ScriptErrorEvent as aA, type ScriptErrorListener as aB, type ScriptErrorPhase as aC, type ScriptErrorReport as aD, type ScriptErrorSource as aE, type SelectionListener as aF, type SliderInput as aG, SlotChooser as aH, type SoundBankAsset as aI, type SoundSlot as aJ, type SoundTake as aK, type TextInput as aL, type ToggleInput as aM, TransformSyncSystem as aN, type Vec3 as aO, type Vector2Input as aP, type Vector3Input as aQ, clearPrefabCache as aR, despawnPrefab as aS, findModelBone as aT, listModelBones as aU, loadPrefab as aV, parsePrefabAsset as aW, prefabFileVersionFor as aX, remapSnapshotEntityIds as aY, setPrefabAssetUrlResolver as aZ, soundBankFiles as a_, type AudioBus as aa, AudioMixer as ab, AudioSystem as ac, type CheckboxInput as ad, type ColorInput as ae, type ComponentFactory as af, type ComponentInput as ag, type ComponentKind as ah, type DropdownInput as ai, type DropdownOption as aj, type EcsComponentFactoryKind as ak, type EcsEntityEditorKind as al, type EntityInput as am, type FloatInput as an, IKSystem as ao, InputSystem as ap, type IntersectionResult as aq, type KeyboardKey as ar, KeyboardKeys as as, type ModelBoneInfo as at, type MouseButton as au, PREFAB_FILE_VERSION as av, PREFAB_FILE_VERSION_NESTED as aw, type PrefabAsset as ax, type RemapSnapshotOptions as ay, RenderSystem as az, type PostprocessingState as b, type AnyComponent as b0, DEBUG_CHANGE_IGNORED_SYSTEMS as b1, type WorldHistorySnapshot as b2, cloneHistoryValue as b3, normalizeDebugValue as b4, type RendererKind as c, Component as d, DEFAULT_ENVIRONMENT_STATE as e, DEFAULT_POSTPROCESSING_STATE as f, Environment as g, type EnvironmentFogState as h, type EnvironmentFogType as i, type EnvironmentGradientEffect as j, type EnvironmentLightingState as k, type EnvironmentSkyboxImageProjection as l, type EnvironmentSkyboxState as m, type EnvironmentSkyboxType as n, type EnvironmentState as o, type EnvironmentToneMapping as p, IKComponent as q, type IKLimb as r, type IKOptions as s, NetworkIdentityComponent as t, NetworkSpawnerComponent as u, NetworkTransformComponent as v, type NetworkTransformOptions as w, NetworkedPropsComponent as x, ParentId as y, Postprocessing as z };
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three';
2
- import { d as Component, a3 as AudioBus, $ as EcsEntityKind, ae as EcsEntityEditorKind, M as EntityId } from './System-DPMAW30g.js';
2
+ import { d as Component, aa as AudioBus, a5 as EcsEntityKind, al as EcsEntityEditorKind, X as EntityId } from './System-CADhPyQs.js';
3
3
  import * as RAPIER from '@dimforge/rapier3d-compat';
4
4
  import { a as XrFinger, c as XrHandPoseDirection, b as XrHandPoseOrientation, X as XrHandPoseDefinition } from './handPose-DlcTtqgx.js';
5
5
 
@@ -1663,6 +1663,80 @@ declare class BoneAttachmentComponent extends Component {
1663
1663
  constructor(options?: BoneAttachmentOptions);
1664
1664
  }
1665
1665
 
1666
+ /**
1667
+ * The style model for spatial UI.
1668
+ *
1669
+ * Every field here is optional and stays ABSENT until authored. A defaulted
1670
+ * field would show up as a change on every instance of a prefab saved before
1671
+ * it existed, pinning those instances against later prefab edits. Old flat
1672
+ * fields (`backgroundColor`, `cornerRadius`…) stay as the fallback, so a scene
1673
+ * saved before this model renders the same.
1674
+ *
1675
+ * Units are metres. Any colour or file string may be a token, `$name`, which
1676
+ * resolves through `tokens` on the nearest panel above the widget. A theme
1677
+ * therefore travels with a prefab, and editing one panel restyles a menu.
1678
+ *
1679
+ * Pure and free of three.js and the DOM.
1680
+ */
1681
+ type UiColorStop = {
1682
+ at: number;
1683
+ color: string;
1684
+ };
1685
+ type UiPaint = {
1686
+ kind: "solid";
1687
+ color: string;
1688
+ }
1689
+ /** `angle` is in degrees and reads like CSS: 0 points up, 90 points right. */
1690
+ | {
1691
+ kind: "linear";
1692
+ angle: number;
1693
+ stops: UiColorStop[];
1694
+ } | {
1695
+ kind: "radial";
1696
+ stops: UiColorStop[];
1697
+ } | {
1698
+ kind: "image";
1699
+ src: string;
1700
+ fit: "cover" | "contain" | "fill";
1701
+ tint?: string;
1702
+ };
1703
+ type UiShadow = {
1704
+ x: number;
1705
+ y: number;
1706
+ blur: number;
1707
+ color: string;
1708
+ };
1709
+ type UiTextStyle = {
1710
+ /** A font file in the project, such as one `add_font` bundled. */
1711
+ font?: string;
1712
+ weight?: number;
1713
+ /** Letter spacing in metres. */
1714
+ tracking?: number;
1715
+ transform?: "upper" | "lower";
1716
+ paint?: UiPaint;
1717
+ maxLines?: number;
1718
+ shadow?: UiShadow;
1719
+ };
1720
+ type UiStyle = {
1721
+ fill?: UiPaint;
1722
+ border?: {
1723
+ width: number;
1724
+ paint: UiPaint;
1725
+ };
1726
+ /** One radius, or top-left, top-right, bottom-right, bottom-left. */
1727
+ radius?: number | [number, number, number, number];
1728
+ shadows?: UiShadow[];
1729
+ /** A thin highlight along the top inner edge. */
1730
+ edge?: {
1731
+ width: number;
1732
+ color: string;
1733
+ };
1734
+ /** 0–1. Multiplies down the widget tree, so fading a panel fades its menu. */
1735
+ opacity?: number;
1736
+ text?: UiTextStyle;
1737
+ };
1738
+ type UiTokens = Record<string, string>;
1739
+
1666
1740
  /** How a panel orients itself while the experience runs. */
1667
1741
  type UiFollowMode = "world" | "billboard";
1668
1742
  /** Optional initializer for {@link UIPanelComponent}. */
@@ -1676,6 +1750,8 @@ type UIPanelOptions = {
1676
1750
  borderColor?: string;
1677
1751
  pixelDensity?: number;
1678
1752
  follow?: UiFollowMode;
1753
+ style?: UiStyle;
1754
+ tokens?: UiTokens;
1679
1755
  };
1680
1756
  /**
1681
1757
  * A flat UI surface in the world — the backdrop menus and HUDs are built on.
@@ -1707,6 +1783,13 @@ declare class UIPanelComponent extends Component {
1707
1783
  /** Texture density in px/metre, clamped 256–2048 at render time. */
1708
1784
  pixelDensity: number;
1709
1785
  follow: UiFollowMode;
1786
+ /** Modern styling; wins over the flat fields above. Absent until authored. */
1787
+ style?: UiStyle;
1788
+ /**
1789
+ * Named values widgets under this panel use as `$name`. The nearest panel
1790
+ * wins, so a theme travels with the panel and one edit restyles the menu.
1791
+ */
1792
+ tokens?: UiTokens;
1710
1793
  constructor(options?: UIPanelOptions);
1711
1794
  }
1712
1795
 
@@ -1724,6 +1807,8 @@ type UITextOptions = {
1724
1807
  valign?: UiTextVAlign;
1725
1808
  lineHeight?: number;
1726
1809
  padding?: number;
1810
+ pixelDensity?: number;
1811
+ style?: UiStyle;
1727
1812
  };
1728
1813
  /**
1729
1814
  * A block of text drawn onto a transparent canvas quad.
@@ -1752,9 +1837,18 @@ declare class UITextComponent extends Component {
1752
1837
  lineHeight: number;
1753
1838
  /** Inner padding in metres. */
1754
1839
  padding: number;
1840
+ /**
1841
+ * Texture density in px/metre, clamped 256–2048 at render time. Absent means
1842
+ * the default: a defaulted field would count as a change on every instance
1843
+ * of a prefab saved before it existed.
1844
+ */
1845
+ pixelDensity?: number;
1846
+ /** Modern styling; wins over the flat fields above. Absent until authored. */
1847
+ style?: UiStyle;
1755
1848
  constructor(options?: UITextOptions);
1756
1849
  }
1757
1850
 
1851
+ type UiIconPosition = "left" | "right";
1758
1852
  /** Optional initializer for {@link UIButtonComponent}. */
1759
1853
  type UIButtonOptions = {
1760
1854
  label?: string;
@@ -1769,6 +1863,10 @@ type UIButtonOptions = {
1769
1863
  cornerRadius?: number;
1770
1864
  borderWidth?: number;
1771
1865
  borderColor?: string;
1866
+ pixelDensity?: number;
1867
+ style?: UiStyle;
1868
+ icon?: string;
1869
+ iconPosition?: UiIconPosition;
1772
1870
  };
1773
1871
  /**
1774
1872
  * A pressable control.
@@ -1799,9 +1897,21 @@ declare class UIButtonComponent extends Component {
1799
1897
  cornerRadius: number;
1800
1898
  borderWidth: number;
1801
1899
  borderColor: string;
1900
+ /**
1901
+ * Texture density in px/metre, clamped 256–2048 at render time. Absent means
1902
+ * the default: a defaulted field would count as a change on every instance
1903
+ * of a prefab saved before it existed.
1904
+ */
1905
+ pixelDensity?: number;
1906
+ /** Modern styling; wins over the flat fields above. Absent until authored. */
1907
+ style?: UiStyle;
1908
+ /** An image or SVG file drawn beside the label, tinted to the text colour. */
1909
+ icon?: string;
1910
+ iconPosition?: UiIconPosition;
1802
1911
  constructor(options?: UIButtonOptions);
1803
1912
  }
1804
1913
 
1914
+ type UiToggleVariant = "switch" | "checkbox" | "radio";
1805
1915
  /** Optional initializer for {@link UIToggleComponent}. */
1806
1916
  type UIToggleOptions = {
1807
1917
  value?: boolean;
@@ -1811,6 +1921,9 @@ type UIToggleOptions = {
1811
1921
  trackColor?: string;
1812
1922
  accentColor?: string;
1813
1923
  knobColor?: string;
1924
+ pixelDensity?: number;
1925
+ style?: UiStyle;
1926
+ variant?: UiToggleVariant;
1814
1927
  };
1815
1928
  /**
1816
1929
  * An on/off switch.
@@ -1835,9 +1948,20 @@ declare class UIToggleComponent extends Component {
1835
1948
  /** Track colour while ON. */
1836
1949
  accentColor: string;
1837
1950
  knobColor: string;
1951
+ /**
1952
+ * Texture density in px/metre, clamped 256–2048 at render time. Absent means
1953
+ * the default: a defaulted field would count as a change on every instance
1954
+ * of a prefab saved before it existed.
1955
+ */
1956
+ pixelDensity?: number;
1957
+ /** Modern styling; wins over the flat fields above. Absent until authored. */
1958
+ style?: UiStyle;
1959
+ /** How the control is drawn. Absent means `switch`. */
1960
+ variant?: UiToggleVariant;
1838
1961
  constructor(options?: UIToggleOptions);
1839
1962
  }
1840
1963
 
1964
+ type UiSliderVariant = "slider" | "progress" | "ring";
1841
1965
  /** Optional initializer for {@link UISliderComponent}. */
1842
1966
  type UISliderOptions = {
1843
1967
  value?: number;
@@ -1849,6 +1973,11 @@ type UISliderOptions = {
1849
1973
  trackColor?: string;
1850
1974
  accentColor?: string;
1851
1975
  knobColor?: string;
1976
+ pixelDensity?: number;
1977
+ style?: UiStyle;
1978
+ variant?: UiSliderVariant;
1979
+ step?: number;
1980
+ readOnly?: boolean;
1852
1981
  };
1853
1982
  /**
1854
1983
  * A draggable value control.
@@ -1876,6 +2005,20 @@ declare class UISliderComponent extends Component {
1876
2005
  /** Fill colour between min and the current value. */
1877
2006
  accentColor: string;
1878
2007
  knobColor: string;
2008
+ /**
2009
+ * Texture density in px/metre, clamped 256–2048 at render time. Absent means
2010
+ * the default: a defaulted field would count as a change on every instance
2011
+ * of a prefab saved before it existed.
2012
+ */
2013
+ pixelDensity?: number;
2014
+ /** Modern styling; wins over the flat fields above. Absent until authored. */
2015
+ style?: UiStyle;
2016
+ /** How the value is drawn. `progress` and `ring` are read-only. */
2017
+ variant?: UiSliderVariant;
2018
+ /** Snap to multiples of this, measured from `min`. */
2019
+ step?: number;
2020
+ /** Shows the value but takes no input. */
2021
+ readOnly?: boolean;
1879
2022
  constructor(options?: UISliderOptions);
1880
2023
  }
1881
2024
 
@@ -2043,4 +2186,4 @@ declare class XRHandPoseComponent extends Component {
2043
2186
  constructor(options?: XRHandPoseOptions);
2044
2187
  }
2045
2188
 
2046
- export { ScriptComponent as $, AnimationComponent as A, BoneAttachmentComponent as B, CameraComponent as C, DEFAULT_COLLIDER_STATE as D, type EditableMeshObjectKind as E, type LightValueState as F, MaterialComponent as G, type MaterialTypeValue as H, ImageComponent as I, type MaterialValueState as J, MeshComponent as K, LightComponent as L, MODEL_NO_PATH_MESSAGE as M, MeshGeometryComponent as N, type MeshGeometryParameters as O, type MeshGeometryParametersByKind as P, ModelComponent as Q, type ModelLoadState as R, Name as S, Object3DRef as T, PhysicsComponent as U, type PhysicsState as V, type PlaneMeshParameters as W, type RadiusHeightMeshParameters as X, type RadiusMeshParameters as Y, type RigidbodyState as Z, type RigidbodyType as _, type AnimationComponentOptions as a, type ScriptEntry as a0, ScriptObjectComponent as a1, type ScriptObjectComponentInput as a2, type ScriptObjectRuntimeState as a3, Selectable as a4, SelectionTransformState as a5, SpriteComponent as a6, type TextureFilteringValue as a7, type TransformModeValue as a8, type TransformSpaceValue as a9, XRRigComponent as aA, type XRRigOptions as aB, type XrAttachPoint as aC, type XrDistanceGrabBehavior as aD, type XrEnvironmentPhysics as aE, type XrGrabGesture as aF, type XrGrabHands as aG, type XrGrabReach as aH, type XrHandPoseEntry as aI, type XrHandPreset as aJ, type XrInteractorSide as aK, type XrInteractorType as aL, type XrLocomotionMode as aM, type XrTrackingOrigin as aN, type XrTwoHandRotation as aO, createAttachPoint as aP, createHandPoseEntry as aQ, defaultMaterialValue as aR, handPoseDefinitionFor as aS, normalizePhysicsState as aT, setModelLoadState as aU, setPhysicsLiveRef as aV, type AnimationStateCallbacks as aW, AnimationStateMachine as aX, AnimationStateManager as aY, type StateMachine as aZ, UIButtonComponent as aa, type UIButtonOptions as ab, UIPanelComponent as ac, type UIPanelOptions as ad, UISliderComponent as ae, type UISliderOptions as af, UITextComponent as ag, type UITextOptions as ah, UIToggleComponent as ai, type UIToggleOptions as aj, type UiFollowMode as ak, type UiTextAlign as al, type UiTextVAlign as am, VRTeleportAreaComponent as an, type VRTeleportAreaOptions as ao, VideoComponent as ap, type VrTeleportShape as aq, XRAnchorComponent as ar, type XRAnchorOptions as as, XRHandPoseComponent as at, type XRHandPoseOptions as au, XRInteractableComponent as av, type XRInteractableOptions as aw, XRInteractorComponent as ax, type XRInteractorOptions as ay, XRInteractorSideComponent as az, AudioComponent as b, type BoneAttachmentOptions as c, type CameraComponentOptions as d, type CameraProjection as e, type CameraRuntimeType as f, type ColliderShape as g, type ColliderState as h, type CubeMeshParameters as i, DEFAULT_INSTANCED_MESH_PARAMETERS as j, DEFAULT_INSTANCE_TRANSFORM as k, DEFAULT_MESH_GEOMETRY_PARAMETERS as l, DEFAULT_PHYSICS_STATE as m, DEFAULT_POSE_CURLS as n, DEFAULT_POSE_DIRECTIONS as o, DEFAULT_RIGIDBODY_STATE as p, EntityType as q, ImageTarget as r, ImageTargetAnchor as s, type ImageTargetAnchorOptions as t, type ImageTargetReference as u, InstanceSlotComponent as v, type InstanceTransform as w, InstancedMeshComponent as x, type InstancedMeshKind as y, type LightShadowState as z };
2189
+ export { ScriptComponent as $, AnimationComponent as A, BoneAttachmentComponent as B, CameraComponent as C, DEFAULT_COLLIDER_STATE as D, type EditableMeshObjectKind as E, type LightValueState as F, MaterialComponent as G, type MaterialTypeValue as H, ImageComponent as I, type MaterialValueState as J, MeshComponent as K, LightComponent as L, MODEL_NO_PATH_MESSAGE as M, MeshGeometryComponent as N, type MeshGeometryParameters as O, type MeshGeometryParametersByKind as P, ModelComponent as Q, type ModelLoadState as R, Name as S, Object3DRef as T, PhysicsComponent as U, type PhysicsState as V, type PlaneMeshParameters as W, type RadiusHeightMeshParameters as X, type RadiusMeshParameters as Y, type RigidbodyState as Z, type RigidbodyType as _, type AnimationComponentOptions as a, AnimationStateManager as a$, type ScriptEntry as a0, ScriptObjectComponent as a1, type ScriptObjectComponentInput as a2, type ScriptObjectRuntimeState as a3, Selectable as a4, SelectionTransformState as a5, SpriteComponent as a6, type TextureFilteringValue as a7, type TransformModeValue as a8, type TransformSpaceValue as a9, XRInteractorComponent as aA, type XRInteractorOptions as aB, XRInteractorSideComponent as aC, XRRigComponent as aD, type XRRigOptions as aE, type XrAttachPoint as aF, type XrDistanceGrabBehavior as aG, type XrEnvironmentPhysics as aH, type XrGrabGesture as aI, type XrGrabHands as aJ, type XrGrabReach as aK, type XrHandPoseEntry as aL, type XrHandPreset as aM, type XrInteractorSide as aN, type XrInteractorType as aO, type XrLocomotionMode as aP, type XrTrackingOrigin as aQ, type XrTwoHandRotation as aR, createAttachPoint as aS, createHandPoseEntry as aT, defaultMaterialValue as aU, handPoseDefinitionFor as aV, normalizePhysicsState as aW, setModelLoadState as aX, setPhysicsLiveRef as aY, type AnimationStateCallbacks as aZ, AnimationStateMachine as a_, UIButtonComponent as aa, type UIButtonOptions as ab, UIPanelComponent as ac, type UIPanelOptions as ad, UISliderComponent as ae, type UISliderOptions as af, UITextComponent as ag, type UITextOptions as ah, UIToggleComponent as ai, type UIToggleOptions as aj, type UiFollowMode as ak, type UiIconPosition as al, type UiSliderVariant as am, type UiTextAlign as an, type UiTextVAlign as ao, type UiToggleVariant as ap, VRTeleportAreaComponent as aq, type VRTeleportAreaOptions as ar, VideoComponent as as, type VrTeleportShape as at, XRAnchorComponent as au, type XRAnchorOptions as av, XRHandPoseComponent as aw, type XRHandPoseOptions as ax, XRInteractableComponent as ay, type XRInteractableOptions as az, AudioComponent as b, type StateMachine as b0, type UiColorStop as b1, type UiPaint as b2, type UiShadow as b3, type UiStyle as b4, type UiTextStyle as b5, type UiTokens as b6, type BoneAttachmentOptions as c, type CameraComponentOptions as d, type CameraProjection as e, type CameraRuntimeType as f, type ColliderShape as g, type ColliderState as h, type CubeMeshParameters as i, DEFAULT_INSTANCED_MESH_PARAMETERS as j, DEFAULT_INSTANCE_TRANSFORM as k, DEFAULT_MESH_GEOMETRY_PARAMETERS as l, DEFAULT_PHYSICS_STATE as m, DEFAULT_POSE_CURLS as n, DEFAULT_POSE_DIRECTIONS as o, DEFAULT_RIGIDBODY_STATE as p, EntityType as q, ImageTarget as r, ImageTargetAnchor as s, type ImageTargetAnchorOptions as t, type ImageTargetReference as u, InstanceSlotComponent as v, type InstanceTransform as w, InstancedMeshComponent as x, type InstancedMeshKind as y, type LightShadowState as z };