@zylem/game-lib 0.8.8 → 0.8.9

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 (64) hide show
  1. package/LICENSE +21 -0
  2. package/dist/actions.d.ts +2 -2
  3. package/dist/actions.js +1 -1
  4. package/dist/api/game-lib.api.json +794 -175
  5. package/dist/api/game-lib.api.md +63 -11
  6. package/dist/api/game-lib.d.ts +180 -5
  7. package/dist/api/game-lib.typedoc.json +157334 -208944
  8. package/dist/audio.js +1 -1
  9. package/dist/behavior.js +1 -1
  10. package/dist/bridge.d.ts +31 -6
  11. package/dist/bridge.js +1 -1
  12. package/dist/catalog.d.ts +91 -3
  13. package/dist/catalog.js +1 -1
  14. package/dist/chunk-2HSR5XDQ.js +1 -0
  15. package/dist/{chunk-7NYP4YAG.js → chunk-6FGXC4T6.js} +1 -1
  16. package/dist/chunk-6XFXPIVB.js +1 -0
  17. package/dist/{chunk-YOVE25NW.js → chunk-7JSZEEAE.js} +1 -1
  18. package/dist/chunk-AXJTUVGC.js +24 -0
  19. package/dist/chunk-BWOZF5YK.js +1 -0
  20. package/dist/chunk-EYDC2PMO.js +1 -0
  21. package/dist/chunk-G3TBBZUI.js +1 -0
  22. package/dist/chunk-J6KD2G6F.js +1 -0
  23. package/dist/chunk-KP6DLLJO.js +1 -0
  24. package/dist/chunk-VUJXR5K5.js +1 -0
  25. package/dist/chunk-WOT6VMZA.js +1 -0
  26. package/dist/{chunk-BMRFDDMR.js → chunk-X7T7QRYP.js} +1 -1
  27. package/dist/chunk-YQS7CGXE.js +1 -0
  28. package/dist/{chunk-GHJQ2HKI.js → chunk-YVWDCZNT.js} +1 -1
  29. package/dist/core.d.ts +4 -4
  30. package/dist/core.js +1 -1
  31. package/dist/{debug-state-CpnNRUFh.d.ts → debug-state-Cg3f5FB6.d.ts} +1 -1
  32. package/dist/debug.d.ts +2 -2
  33. package/dist/debug.js +1 -1
  34. package/dist/{entity-XZNGBeca.d.ts → entity-XqvuWgPm.d.ts} +54 -0
  35. package/dist/{entity-type-map-CkkFMSrL.d.ts → entity-type-map-D6BeAdvg.d.ts} +1 -1
  36. package/dist/entity.d.ts +3 -3
  37. package/dist/entity.js +1 -1
  38. package/dist/events.js +1 -1
  39. package/dist/{game-BPOr7zTB.d.ts → game-DyKbOeck.d.ts} +74 -7
  40. package/dist/game-default-6YXFFZ2Q.js +1 -0
  41. package/dist/globals.js +1 -1
  42. package/dist/graphics.js +1 -1
  43. package/dist/input-ui.js +1 -1
  44. package/dist/input.js +1 -1
  45. package/dist/public.d.ts +6 -6
  46. package/dist/public.js +1 -1
  47. package/dist/runtime.js +1 -1
  48. package/dist/schema/entity.schema.json +24 -24
  49. package/dist/schema/game-config.schema.json +10 -10
  50. package/dist/schema/stage.schema.json +29 -29
  51. package/dist/schema.js +1 -1
  52. package/dist/web-components.d.ts +4 -4
  53. package/dist/web-components.js +1 -1
  54. package/package.json +28 -27
  55. package/dist/chunk-AE3CTVHY.js +0 -1
  56. package/dist/chunk-F5LROYZL.js +0 -24
  57. package/dist/chunk-HNCTOJP7.js +0 -1
  58. package/dist/chunk-IBJLPJLE.js +0 -1
  59. package/dist/chunk-MXO4VGDB.js +0 -1
  60. package/dist/chunk-QDQ4QMAI.js +0 -1
  61. package/dist/chunk-SAQA4SXW.js +0 -1
  62. package/dist/chunk-XK63E4SX.js +0 -1
  63. package/dist/chunk-ZTYNZ2N2.js +0 -1
  64. package/dist/game-default-7HCJJF5S.js +0 -1
@@ -6,6 +6,7 @@
6
6
 
7
7
  import { abs } from 'three/tsl';
8
8
  import { announceBridgeReady } from '@zylem/bridge';
9
+ import { applySwatchesToSelection } from '@zylem/bridge';
9
10
  import { asin } from 'three/tsl';
10
11
  import { atan } from 'three/tsl';
11
12
  import { BehaviorDescriptor } from '@zylem/behaviors';
@@ -34,6 +35,7 @@ import { BridgeHandler } from '@zylem/bridge';
34
35
  import { GameLoadingPayload as BridgeLoadingPayload } from '@zylem/bridge';
35
36
  import { BridgeMessages } from '@zylem/bridge';
36
37
  import { BridgeMessageType } from '@zylem/bridge';
38
+ import { BridgeNdc } from '@zylem/bridge';
37
39
  import { BridgePose } from '@zylem/bridge';
38
40
  import { BridgeVec3 } from '@zylem/bridge';
39
41
  import { BufferGeometry } from 'three';
@@ -94,7 +96,10 @@ import { emitRuntimeTriggerRegionEnter } from '@zylem/behaviors/runtime-2d';
94
96
  import { EntityApplySwatchPayload } from '@zylem/bridge';
95
97
  import { EntityDefinition } from '@zylem/behaviors/core';
96
98
  import { EntityHandle } from '@zylem/behaviors/core';
99
+ import { EntityPickPayload } from '@zylem/bridge';
100
+ import { EntityPickResultPayload } from '@zylem/bridge';
97
101
  import { EntitySummaryPayload } from '@zylem/bridge';
102
+ import { EntitySwatchAppliedPayload } from '@zylem/bridge';
98
103
  import { EntityThumbnailPayload } from '@zylem/bridge';
99
104
  import { EntityTypeDescriptor } from '@zylem/bridge';
100
105
  import { exp } from 'three/tsl';
@@ -282,6 +287,7 @@ import { RuntimeTriggerRegion2DEvent } from '@zylem/behaviors/runtime-2d';
282
287
  import { RuntimeTriggerRegion2DHandle } from '@zylem/behaviors/runtime-2d';
283
288
  import { RuntimeTriggerRegion2DOptions } from '@zylem/behaviors/runtime-2d';
284
289
  import { Scene } from 'three';
290
+ import { SceneOperationEntry } from '@zylem/bridge';
285
291
  import { SceneOperationPayload } from '@zylem/bridge';
286
292
  import { ScreenVisibilityBehavior } from '@zylem/behaviors';
287
293
  import { ScreenVisibilityChangeContext } from '@zylem/behaviors';
@@ -342,6 +348,10 @@ import { StageSnapshotPayload } from '@zylem/bridge';
342
348
  import { StageTopDownPlane } from '@zylem/behaviors/core';
343
349
  import { Static } from '@sinclair/typebox';
344
350
  import { step } from 'three/tsl';
351
+ import { SwatchApplyFailureReason } from '@zylem/bridge';
352
+ import { SwatchApplyResult } from '@zylem/bridge';
353
+ import { SwatchKind } from '@zylem/bridge';
354
+ import { SwatchSpec } from '@zylem/bridge';
345
355
  import { Texture } from 'three';
346
356
  import * as three from 'three';
347
357
  import { ThrusterBehavior } from '@zylem/behaviors';
@@ -438,6 +448,8 @@ export interface AnalogState {
438
448
 
439
449
  export { announceBridgeReady }
440
450
 
451
+ export { applySwatchesToSelection }
452
+
441
453
  // Warning: (ae-forgotten-export) The symbol "TransformableEntity" needs to be exported by the entry point public.d.ts
442
454
  //
443
455
  // @public
@@ -510,6 +522,8 @@ export { BridgeMessages }
510
522
 
511
523
  export { BridgeMessageType }
512
524
 
525
+ export { BridgeNdc }
526
+
513
527
  export { BridgeVec3 }
514
528
 
515
529
  // @public
@@ -1164,6 +1178,10 @@ export const EntityJsonSchema: _sinclair_typebox.TUnion<[_sinclair_typebox.TObje
1164
1178
  data: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TUnknown>>;
1165
1179
  }>]>;
1166
1180
 
1181
+ export { EntityPickPayload }
1182
+
1183
+ export { EntityPickResultPayload }
1184
+
1167
1185
  // @public
1168
1186
  export const EntitySchema: _sinclair_typebox.TObject<{
1169
1187
  id: _sinclair_typebox.TString;
@@ -1179,6 +1197,8 @@ export function entitySpawner(factory: (x: number, y: number) => Promise<any> |
1179
1197
 
1180
1198
  export { EntitySummaryPayload }
1181
1199
 
1200
+ export { EntitySwatchAppliedPayload }
1201
+
1182
1202
  // @public
1183
1203
  export class EntityThumbnailCache {
1184
1204
  constructor(size?: number, maxEntries?: number);
@@ -1485,8 +1505,11 @@ export class GameBridge {
1485
1505
  // @public
1486
1506
  export interface GameBridgeHost {
1487
1507
  applySceneOperation?(op: SceneOperationPayload, direction: 'undo' | 'redo'): void;
1488
- applySwatch?(payload: EntityApplySwatchPayload): void;
1508
+ applySwatches?(payload: EntityApplySwatchPayload & {
1509
+ opId: string;
1510
+ }): SwatchApplyOutcome;
1489
1511
  createEntity?(typeId: string, props: Record<string, unknown> | undefined, pose: BridgePose | undefined): void;
1512
+ pickEntity?(ndc: BridgeNdc): EntitySummaryPayload | null;
1490
1513
  resolveEntity(uuid: string): GameEntity<any> | null;
1491
1514
  setStageVariable?(key: string, value: unknown): void;
1492
1515
  }
@@ -1702,6 +1725,7 @@ export class GameEntity<O extends GameEntityOptions> extends BaseNode<O> impleme
1702
1725
  protected eventDelegate: EventEmitterDelegate<EntityEvents>;
1703
1726
  // (undocumented)
1704
1727
  finalizeCloneSupport(factory: (options?: Partial<O>) => GameEntity<O>): this;
1728
+ getBehaviorRef<O extends Record<string, any>>(descriptor: BehaviorDescriptor_2<O, any>): BehaviorRef_2<O> | null;
1705
1729
  getBehaviorRefs(): BehaviorRef_2[];
1706
1730
  // (undocumented)
1707
1731
  getCollisionCallbacks(): Array<(params: CollisionContext<this, O>) => void>;
@@ -1709,6 +1733,7 @@ export class GameEntity<O extends GameEntityOptions> extends BaseNode<O> impleme
1709
1733
  //
1710
1734
  // (undocumented)
1711
1735
  getCollisionRegistrations(): Array<CollisionRegistration<this, O>>;
1736
+ getMaterials(): Material[];
1712
1737
  getPose(): {
1713
1738
  position: Vec3;
1714
1739
  rotation: {
@@ -1727,6 +1752,9 @@ export class GameEntity<O extends GameEntityOptions> extends BaseNode<O> impleme
1727
1752
  getVelocity: () => Vector | null;
1728
1753
  // (undocumented)
1729
1754
  group: Group | undefined;
1755
+ // (undocumented)
1756
+ hasBehavior(descriptor: BehaviorDescriptor_2<any, any>): boolean;
1757
+ hasMaterial(): boolean;
1730
1758
  instanceId: number;
1731
1759
  isBundled: boolean;
1732
1760
  isInstanced: boolean;
@@ -1762,8 +1790,13 @@ export class GameEntity<O extends GameEntityOptions> extends BaseNode<O> impleme
1762
1790
  // (undocumented)
1763
1791
  physicsAttached: boolean;
1764
1792
  physicsWorldRef: unknown;
1793
+ removeBehavior(target: BehaviorDescriptor_2<any, any> | BehaviorRef_2<any>): BehaviorRef_2<any> | null;
1794
+ replaceMaterials(materials: Material[], settings?: {
1795
+ disposePrevious?: boolean;
1796
+ }): Material[] | null;
1765
1797
  // (undocumented)
1766
1798
  resetVelocity: () => void;
1799
+ restoreBehaviorRef(ref: BehaviorRef_2<any>): void;
1767
1800
  reveal(): void;
1768
1801
  // (undocumented)
1769
1802
  rotateEuler: (eulerRotation: Vector3) => void;
@@ -1780,6 +1813,10 @@ export class GameEntity<O extends GameEntityOptions> extends BaseNode<O> impleme
1780
1813
  runAction<A extends Action>(action: A): A;
1781
1814
  runtimeAttached: boolean;
1782
1815
  runtimeHandle: number;
1816
+ // Warning: (ae-forgotten-export) The symbol "MaterialOptions" needs to be exported by the entry point public.d.ts
1817
+ setMaterial(options: Partial<MaterialOptions>, settings?: {
1818
+ disposePrevious?: boolean;
1819
+ }): Material[] | null;
1783
1820
  setPose(input: {
1784
1821
  position?: Vec3Input;
1785
1822
  rotation?: {
@@ -3658,6 +3695,22 @@ export const standardShader: {
3658
3695
 
3659
3696
  export { step }
3660
3697
 
3698
+ export { SwatchApplyFailureReason }
3699
+
3700
+ // @public
3701
+ export interface SwatchApplyOutcome {
3702
+ // (undocumented)
3703
+ entries: SceneOperationEntry[];
3704
+ // (undocumented)
3705
+ results: SwatchApplyResult[];
3706
+ }
3707
+
3708
+ export { SwatchApplyResult }
3709
+
3710
+ export { SwatchKind }
3711
+
3712
+ export { SwatchSpec }
3713
+
3661
3714
  // @public
3662
3715
  export interface TemplateFactory<E extends GameEntity<O>, O extends GameEntityOptions = GameEntityOptions> {
3663
3716
  generate(count: number): E[];
@@ -4823,16 +4876,15 @@ export class ZylemZone extends GameEntity<ZylemZoneOptions> implements Collision
4823
4876
 
4824
4877
  // Warnings were encountered during analysis:
4825
4878
  //
4826
- // dist/entity-XZNGBeca.d.ts:332:5 - (ae-forgotten-export) The symbol "RenderCategory_2" needs to be exported by the entry point public.d.ts
4827
- // dist/entity-XZNGBeca.d.ts:333:5 - (ae-forgotten-export) The symbol "RuntimeEntityOptions" needs to be exported by the entry point public.d.ts
4828
- // dist/entity-XZNGBeca.d.ts:334:5 - (ae-forgotten-export) The symbol "CollisionOptions" needs to be exported by the entry point public.d.ts
4829
- // dist/entity-XZNGBeca.d.ts:335:5 - (ae-forgotten-export) The symbol "MaterialOptions" needs to be exported by the entry point public.d.ts
4830
- // dist/entity-XZNGBeca.d.ts:343:9 - (ae-forgotten-export) The symbol "IBuilder" needs to be exported by the entry point public.d.ts
4831
- // dist/entity-XZNGBeca.d.ts:343:9 - (ae-forgotten-export) The symbol "EntityMeshBuilder" needs to be exported by the entry point public.d.ts
4832
- // dist/entity-XZNGBeca.d.ts:344:9 - (ae-forgotten-export) The symbol "EntityCollisionBuilder" needs to be exported by the entry point public.d.ts
4833
- // dist/entity-XZNGBeca.d.ts:345:9 - (ae-forgotten-export) The symbol "MaterialBuilder" needs to be exported by the entry point public.d.ts
4834
- // dist/game-BPOr7zTB.d.ts:1060:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" needs to be exported by the entry point public.d.ts
4835
- // dist/game-BPOr7zTB.d.ts:1735:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
4879
+ // dist/entity-XqvuWgPm.d.ts:332:5 - (ae-forgotten-export) The symbol "RenderCategory_2" needs to be exported by the entry point public.d.ts
4880
+ // dist/entity-XqvuWgPm.d.ts:333:5 - (ae-forgotten-export) The symbol "RuntimeEntityOptions" needs to be exported by the entry point public.d.ts
4881
+ // dist/entity-XqvuWgPm.d.ts:334:5 - (ae-forgotten-export) The symbol "CollisionOptions" needs to be exported by the entry point public.d.ts
4882
+ // dist/entity-XqvuWgPm.d.ts:343:9 - (ae-forgotten-export) The symbol "IBuilder" needs to be exported by the entry point public.d.ts
4883
+ // dist/entity-XqvuWgPm.d.ts:343:9 - (ae-forgotten-export) The symbol "EntityMeshBuilder" needs to be exported by the entry point public.d.ts
4884
+ // dist/entity-XqvuWgPm.d.ts:344:9 - (ae-forgotten-export) The symbol "EntityCollisionBuilder" needs to be exported by the entry point public.d.ts
4885
+ // dist/entity-XqvuWgPm.d.ts:345:9 - (ae-forgotten-export) The symbol "MaterialBuilder" needs to be exported by the entry point public.d.ts
4886
+ // dist/game-DyKbOeck.d.ts:1097:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" needs to be exported by the entry point public.d.ts
4887
+ // dist/game-DyKbOeck.d.ts:1796:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
4836
4888
 
4837
4889
  // (No @packageDocumentation comment for this package)
4838
4890
 
@@ -1,5 +1,6 @@
1
1
  import { abs } from 'three/tsl';
2
2
  import { announceBridgeReady } from '@zylem/bridge';
3
+ import { applySwatchesToSelection } from '@zylem/bridge';
3
4
  import { asin } from 'three/tsl';
4
5
  import { atan } from 'three/tsl';
5
6
  import { BehaviorDescriptor } from '@zylem/behaviors';
@@ -28,6 +29,7 @@ import { BridgeHandler } from '@zylem/bridge';
28
29
  import { GameLoadingPayload as BridgeLoadingPayload } from '@zylem/bridge';
29
30
  import { BridgeMessages } from '@zylem/bridge';
30
31
  import { BridgeMessageType } from '@zylem/bridge';
32
+ import { BridgeNdc } from '@zylem/bridge';
31
33
  import { BridgePose } from '@zylem/bridge';
32
34
  import { BridgeVec3 } from '@zylem/bridge';
33
35
  import { BufferGeometry } from 'three';
@@ -88,7 +90,10 @@ import { emitRuntimeTriggerRegionEnter } from '@zylem/behaviors/runtime-2d';
88
90
  import { EntityApplySwatchPayload } from '@zylem/bridge';
89
91
  import { EntityDefinition } from '@zylem/behaviors/core';
90
92
  import { EntityHandle } from '@zylem/behaviors/core';
93
+ import { EntityPickPayload } from '@zylem/bridge';
94
+ import { EntityPickResultPayload } from '@zylem/bridge';
91
95
  import { EntitySummaryPayload } from '@zylem/bridge';
96
+ import { EntitySwatchAppliedPayload } from '@zylem/bridge';
92
97
  import { EntityThumbnailPayload } from '@zylem/bridge';
93
98
  import { EntityTypeDescriptor } from '@zylem/bridge';
94
99
  import { exp } from 'three/tsl';
@@ -276,6 +281,7 @@ import { RuntimeTriggerRegion2DEvent } from '@zylem/behaviors/runtime-2d';
276
281
  import { RuntimeTriggerRegion2DHandle } from '@zylem/behaviors/runtime-2d';
277
282
  import { RuntimeTriggerRegion2DOptions } from '@zylem/behaviors/runtime-2d';
278
283
  import { Scene } from 'three';
284
+ import { SceneOperationEntry } from '@zylem/bridge';
279
285
  import { SceneOperationPayload } from '@zylem/bridge';
280
286
  import { ScreenVisibilityBehavior } from '@zylem/behaviors';
281
287
  import { ScreenVisibilityChangeContext } from '@zylem/behaviors';
@@ -336,6 +342,10 @@ import { StageSnapshotPayload } from '@zylem/bridge';
336
342
  import { StageTopDownPlane } from '@zylem/behaviors/core';
337
343
  import { Static } from '@sinclair/typebox';
338
344
  import { step } from 'three/tsl';
345
+ import { SwatchApplyFailureReason } from '@zylem/bridge';
346
+ import { SwatchApplyResult } from '@zylem/bridge';
347
+ import { SwatchKind } from '@zylem/bridge';
348
+ import { SwatchSpec } from '@zylem/bridge';
339
349
  import { Texture } from 'three';
340
350
  import * as three from 'three';
341
351
  import { ThrusterBehavior } from '@zylem/behaviors';
@@ -471,6 +481,8 @@ export { announceBridgeReady }
471
481
 
472
482
  declare type AnyNode = NodeLike | Promise<NodeLike>;
473
483
 
484
+ export { applySwatchesToSelection }
485
+
474
486
  /**
475
487
  * Apply accumulated transformations from the store to the physics body.
476
488
  *
@@ -724,6 +736,8 @@ export { BridgeMessages }
724
736
 
725
737
  export { BridgeMessageType }
726
738
 
739
+ export { BridgeNdc }
740
+
727
741
  export { BridgeVec3 }
728
742
 
729
743
  /** Cuboid collider sized as `size.xyz` (full extents — half-extents are computed). */
@@ -2104,6 +2118,10 @@ declare abstract class EntityMeshBuilder extends MeshBuilder {
2104
2118
  postBuild(): void;
2105
2119
  }
2106
2120
 
2121
+ export { EntityPickPayload }
2122
+
2123
+ export { EntityPickResultPayload }
2124
+
2107
2125
  /**
2108
2126
  * Runtime entity blueprint (open `data` for factory spreading).
2109
2127
  * Prefer {@link EntityJsonSchema} for editor / Monaco JSON Schema.
@@ -2134,6 +2152,8 @@ export declare function entitySpawner(factory: (x: number, y: number) => Promise
2134
2152
 
2135
2153
  export { EntitySummaryPayload }
2136
2154
 
2155
+ export { EntitySwatchAppliedPayload }
2156
+
2137
2157
  /**
2138
2158
  * Generates and caches entity thumbnail previews for the editor entity list.
2139
2159
  * Renders a cloned Object3D into an offscreen RenderTarget on the shared WebGPU renderer.
@@ -2616,6 +2636,15 @@ export declare class GameBridge {
2616
2636
  */
2617
2637
  connect(host: GameBridgeHost, announceTarget?: EventTarget): void;
2618
2638
  disconnect(): void;
2639
+ /**
2640
+ * Run a swatch batch and report back.
2641
+ *
2642
+ * Order matters for the consumer: selection changes first (so a following
2643
+ * `entity:selection` describes the new targets), then the undo record, then
2644
+ * the ack — a consumer that persists on `ok` sees the operation already on
2645
+ * the stack.
2646
+ */
2647
+ private handleApplySwatch;
2619
2648
  /**
2620
2649
  * Publish only the parts of `debugState` the editor does not already know.
2621
2650
  * Values that arrived as editor commands are recorded on `editorKnown`
@@ -2708,8 +2737,19 @@ export declare interface GameBridgeHost {
2708
2737
  createEntity?(typeId: string, props: Record<string, unknown> | undefined, pose: BridgePose | undefined): void;
2709
2738
  /** Undo or redo a committed scene operation (`scene:operation:apply`). */
2710
2739
  applySceneOperation?(op: SceneOperationPayload, direction: 'undo' | 'redo'): void;
2711
- /** Attach a catalog shader or behavior to a live entity (`entity:apply-swatch`). */
2712
- applySwatch?(payload: EntityApplySwatchPayload): void;
2740
+ /**
2741
+ * Raycast at normalized device coordinates and describe the entity hit
2742
+ * (`entity:pick`). Hover should follow the pick only while pick mode is on.
2743
+ */
2744
+ pickEntity?(ndc: BridgeNdc): EntitySummaryPayload | null;
2745
+ /**
2746
+ * Apply every swatch to every uuid (`entity:apply-swatch`). Must report one
2747
+ * result per uuid × swatch pair and return a `scene:operation` entry for
2748
+ * each success so the batch is undoable as a single step.
2749
+ */
2750
+ applySwatches?(payload: EntityApplySwatchPayload & {
2751
+ opId: string;
2752
+ }): SwatchApplyOutcome;
2713
2753
  }
2714
2754
 
2715
2755
  /**
@@ -3164,6 +3204,30 @@ export declare class GameEntity<O extends GameEntityOptions> extends BaseNode<O>
3164
3204
  * Used by the stage to auto-register required systems.
3165
3205
  */
3166
3206
  getBehaviorRefs(): BehaviorRef_2[];
3207
+ /**
3208
+ * Find the attached ref for a behavior, matched by descriptor key so a
3209
+ * re-imported copy of the same descriptor still resolves.
3210
+ */
3211
+ getBehaviorRef<O extends Record<string, any>>(descriptor: BehaviorDescriptor_2<O, any>): BehaviorRef_2<O> | null;
3212
+ hasBehavior(descriptor: BehaviorDescriptor_2<any, any>): boolean;
3213
+ /**
3214
+ * Detach a behavior from this entity.
3215
+ *
3216
+ * Removes the ref so future spawns skip it. If the entity is live in a
3217
+ * stage, the stage must also drop the system link (see
3218
+ * `StageEntityDelegate.detachBehaviorLink`); `StageDebugDelegate` does this
3219
+ * for editor-driven removals.
3220
+ *
3221
+ * @param target The descriptor (matched by key) or the exact ref to remove.
3222
+ * @returns The removed ref, or `null` when nothing matched.
3223
+ */
3224
+ removeBehavior(target: BehaviorDescriptor_2<any, any> | BehaviorRef_2<any>): BehaviorRef_2<any> | null;
3225
+ /**
3226
+ * Re-attach a previously removed ref as-is (options, FSM state and all).
3227
+ * Used by undo so a restored behavior is the same object, not a re-created
3228
+ * one.
3229
+ */
3230
+ restoreBehaviorRef(ref: BehaviorRef_2<any>): void;
3167
3231
  getCollisionCallbacks(): Array<(params: CollisionContext<this, O>) => void>;
3168
3232
  getCollisionRegistrations(): Array<CollisionRegistration<this, O>>;
3169
3233
  private copyBehaviorRefsTo;
@@ -3194,6 +3258,36 @@ export declare class GameEntity<O extends GameEntityOptions> extends BaseNode<O>
3194
3258
  */
3195
3259
  protected _cleanup(_params: CleanupContext<this>): void;
3196
3260
  _collision(other: GameEntity<O>, globals?: any, dispatch?: CollisionDispatchMetadata): void;
3261
+ /**
3262
+ * Whether this entity renders a mesh that a material can be assigned to.
3263
+ * Lights, zones, and other mesh-less entities return `false`.
3264
+ */
3265
+ hasMaterial(): boolean;
3266
+ /** The materials currently driving this entity's meshes. */
3267
+ getMaterials(): Material[];
3268
+ /**
3269
+ * Rebuild this entity's material from creation-style options and swap it in
3270
+ * on the live mesh, so a runtime change (an editor applying a shader swatch)
3271
+ * renders exactly like a restart with `material: options` would.
3272
+ *
3273
+ * @param options Same shape as `GameEntityOptions.material`.
3274
+ * @param settings `disposePrevious` (default `true`) frees the replaced
3275
+ * materials; pass `false` when keeping them for undo.
3276
+ * @returns The replaced materials, or `null` when the entity has no mesh.
3277
+ */
3278
+ setMaterial(options: Partial<MaterialOptions>, settings?: {
3279
+ disposePrevious?: boolean;
3280
+ }): Material[] | null;
3281
+ /**
3282
+ * Assign already-built materials to every mesh this entity renders. Meshes
3283
+ * that carried a material array keep the array shape, cycling through the
3284
+ * supplied list so multi-material geometry stays fully covered.
3285
+ *
3286
+ * @returns The replaced materials, or `null` when the entity has no mesh.
3287
+ */
3288
+ replaceMaterials(materials: Material[], settings?: {
3289
+ disposePrevious?: boolean;
3290
+ }): Material[] | null;
3197
3291
  protected updateMaterials(params: any): void;
3198
3292
  buildInfo(): Record<string, string>;
3199
3293
  /**
@@ -5974,6 +6068,7 @@ declare class StageDebugDelegate {
5974
6068
  private lastDebugEnabled;
5975
6069
  private warnedMissingAddFactory;
5976
6070
  private transformTool;
6071
+ private swatchApplier;
5977
6072
  private grid;
5978
6073
  private lastTool;
5979
6074
  /** Element the current gizmo drag captured, so pointerup is never missed. */
@@ -6032,13 +6127,27 @@ declare class StageDebugDelegate {
6032
6127
  update(): void;
6033
6128
  /**
6034
6129
  * Raycast at NDC coordinates (from a host that cannot send DOM pointer
6035
- * events, e.g. an overlay sitting on a preview iframe). Updates hover so
6036
- * the next `update()` paints the highlight.
6130
+ * events, e.g. an overlay sitting on a preview iframe, or the bridge's
6131
+ * `entity:pick`).
6132
+ *
6133
+ * Hover follows the pick only while pick mode is armed (a drag in flight),
6134
+ * so a one-shot pick from an inspector does not disturb the user's hover.
6135
+ * While armed, the next `update()` paints the highlight.
6037
6136
  */
6038
- pickAtNdc(ndcX: number, ndcY: number): {
6137
+ pickAtNdc(ndcX: number, ndcY: number, options?: {
6138
+ updateHover?: boolean;
6139
+ }): {
6039
6140
  uuid: string;
6040
6141
  name: string;
6041
6142
  } | null;
6143
+ /**
6144
+ * Apply swatches to live entities (`entity:apply-swatch`). Every uuid ×
6145
+ * swatch pair is attempted and reported; successful pairs are recorded so
6146
+ * the operation can be undone exactly via {@link applySceneOperation}.
6147
+ */
6148
+ applySwatches(payload: EntityApplySwatchPayload & {
6149
+ opId: string;
6150
+ }): SwatchApplyOutcome_2;
6042
6151
  /** Collider wireframes, straight from the wasm simulation. */
6043
6152
  private updateColliderWireframes;
6044
6153
  /**
@@ -6286,11 +6395,35 @@ declare class StageEntityDelegate {
6286
6395
  */
6287
6396
  destroyAll(): void;
6288
6397
  private registerBehaviorLinks;
6398
+ /**
6399
+ * Index one ref, lazily create its system, and attach. Shared by spawn-time
6400
+ * registration and late per-ref attaches.
6401
+ */
6402
+ private linkBehaviorRef;
6403
+ private unlinkBehaviorLink;
6289
6404
  /**
6290
6405
  * Re-index an entity's behavior refs after a late `entity.use(...)`.
6291
6406
  * Spawn-time registration only sees refs that existed at attach.
6407
+ *
6408
+ * Detaches and re-attaches every behavior on the entity, which resets their
6409
+ * per-link state. Prefer {@link attachBehaviorLink} /
6410
+ * {@link detachBehaviorLink} when only one ref changed.
6292
6411
  */
6293
6412
  syncBehaviorLinks(entity: any): void;
6413
+ /**
6414
+ * Attach a single ref that was added to a live entity (`entity.use(...)`
6415
+ * after spawn) without disturbing the entity's other behaviors.
6416
+ *
6417
+ * @returns `false` when the stage is not loaded or the ref is already linked.
6418
+ */
6419
+ attachBehaviorLink(entity: any, ref: BehaviorRef_2): boolean;
6420
+ /**
6421
+ * Detach a single ref's system link from a live entity, leaving its other
6422
+ * behaviors attached.
6423
+ *
6424
+ * @returns `false` when no link for that ref exists.
6425
+ */
6426
+ detachBehaviorLink(entity: any, ref: BehaviorRef_2): boolean;
6294
6427
  private unregisterBehaviorLinks;
6295
6428
  }
6296
6429
 
@@ -6611,6 +6744,42 @@ export declare const standardShader: {
6611
6744
 
6612
6745
  export { step }
6613
6746
 
6747
+ export { SwatchApplyFailureReason }
6748
+
6749
+ /** What a host reports back from a swatch batch. */
6750
+ export declare interface SwatchApplyOutcome {
6751
+ results: SwatchApplyResult[];
6752
+ entries: SceneOperationEntry[];
6753
+ }
6754
+
6755
+ /**
6756
+ * Applies swatches (configured shaders / behaviors) to live entities and
6757
+ * inverts those applications for undo.
6758
+ *
6759
+ * One `entity:apply-swatch` message is a batch: every swatch is applied to
6760
+ * every uuid, in order, under a single operation id. Each pair reports its own
6761
+ * result so a multi-select apply can partially succeed (a light in the
6762
+ * selection has no material) while the rest still land.
6763
+ *
6764
+ * Undo follows the stage's "editor holds the history, game holds the
6765
+ * instances" rule. The original material and any displaced behavior refs are
6766
+ * kept here per operation, so undo puts back the exact objects rather than a
6767
+ * reconstruction — the pre-swatch material (texture, tint, standard shader) is
6768
+ * usually not describable as a swatch at all.
6769
+ */
6770
+
6771
+ declare interface SwatchApplyOutcome_2 {
6772
+ results: SwatchApplyResult[];
6773
+ /** One entry per successful pair, ready for a `scene:operation`. */
6774
+ entries: SceneOperationEntry[];
6775
+ }
6776
+
6777
+ export { SwatchApplyResult }
6778
+
6779
+ export { SwatchKind }
6780
+
6781
+ export { SwatchSpec }
6782
+
6614
6783
  /**
6615
6784
  * Factory interface for generating entity copies
6616
6785
  */
@@ -8276,6 +8445,12 @@ declare class ZylemGame<TGlobals extends BaseGlobals> {
8276
8445
  static FRAME_DURATION: number;
8277
8446
  static MAX_DELTA_SECONDS: number;
8278
8447
  constructor(options: ZylemGameOptions<TGlobals>, wrapperRef: Game<TGlobals>, displayRuntime?: ResolveGameConfigRuntime);
8448
+ /**
8449
+ * Raycast at normalized device coordinates (editor `entity:pick`) and
8450
+ * describe the hit the same way the entity list does, so a consumer can
8451
+ * show name, type, and pose for whatever is under the pointer.
8452
+ */
8453
+ private pickEntityAtNdc;
8279
8454
  /** Publish the placeable entity types the editor's Add palette lists. */
8280
8455
  private publishEntityCatalog;
8281
8456
  /** Spawn a catalog type programmatically (editor `entity:create`). */