@zylem/game-lib 0.8.2 → 0.8.3

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 (43) hide show
  1. package/dist/api/game-lib.api.json +1310 -704
  2. package/dist/api/game-lib.api.md +125 -88
  3. package/dist/api/game-lib.d.ts +255 -92
  4. package/dist/api/game-lib.typedoc.json +127368 -201231
  5. package/dist/bridge.d.ts +97 -0
  6. package/dist/bridge.js +1 -0
  7. package/dist/chunk-2VSVOPQN.js +19 -0
  8. package/dist/{chunk-KVSJE4XD.js → chunk-3I537JFL.js} +1 -1
  9. package/dist/chunk-AIQ6IVT5.js +1 -0
  10. package/dist/chunk-C5NEGC3S.js +1 -0
  11. package/dist/{chunk-CD7ZOZ35.js → chunk-CV75NSES.js} +1 -1
  12. package/dist/chunk-GKHAJ3MW.js +1 -0
  13. package/dist/chunk-HNCTOJP7.js +1 -0
  14. package/dist/{chunk-MZZCDXFB.js → chunk-LGS5N5M4.js} +1 -1
  15. package/dist/chunk-LKFF6XJC.js +1 -0
  16. package/dist/chunk-Q27ULMXY.js +24 -0
  17. package/dist/chunk-TV3AZKT4.js +9 -0
  18. package/dist/chunk-W5SXED5T.js +1 -0
  19. package/dist/chunk-WVSYUWTT.js +1 -0
  20. package/dist/core.d.ts +2 -2
  21. package/dist/core.js +1 -1
  22. package/dist/debug-state-Dp9CQQZ4.d.ts +49 -0
  23. package/dist/debug.d.ts +22 -3
  24. package/dist/debug.js +1 -1
  25. package/dist/entity.js +1 -1
  26. package/dist/events.d.ts +1 -64
  27. package/dist/events.js +1 -1
  28. package/dist/{game-DbqBQiFC.d.ts → game-NHkubIfI.d.ts} +49 -21
  29. package/dist/game-default-5TB3T5N7.js +1 -0
  30. package/dist/public.d.ts +5 -3
  31. package/dist/public.js +1 -1
  32. package/dist/web-components.d.ts +2 -2
  33. package/dist/web-components.js +1 -1
  34. package/package.json +8 -3
  35. package/dist/chunk-3PRBSSTS.js +0 -24
  36. package/dist/chunk-CFVRRRZZ.js +0 -1
  37. package/dist/chunk-COM6HJ2L.js +0 -1
  38. package/dist/chunk-JQKS42G4.js +0 -1
  39. package/dist/chunk-TAUWDQZF.js +0 -9
  40. package/dist/chunk-VS2D4B3W.js +0 -1
  41. package/dist/chunk-YHEWKN7N.js +0 -1
  42. package/dist/debug-state-DRoeasG2.d.ts +0 -17
  43. package/dist/game-default-6AZZCNST.js +0 -1
@@ -5,6 +5,7 @@
5
5
  ```ts
6
6
 
7
7
  import { abs } from 'three/tsl';
8
+ import { announceBridgeReady } from '@zylem/bridge';
8
9
  import { asin } from 'three/tsl';
9
10
  import { atan } from 'three/tsl';
10
11
  import { BehaviorDescriptor } from '@zylem/behaviors';
@@ -26,6 +27,14 @@ import { BoundaryRicochet3DEntity } from '@zylem/behaviors';
26
27
  import { BoundaryRicochetCoordinator } from '@zylem/behaviors';
27
28
  import { BoundaryRicochetEntity } from '@zylem/behaviors';
28
29
  import { BoundaryRicochetUpdate } from '@zylem/behaviors';
30
+ import { BRIDGE_READY_EVENT } from '@zylem/bridge';
31
+ import { BridgeChannel } from '@zylem/bridge';
32
+ import { BridgeDebugTool } from '@zylem/bridge';
33
+ import { BridgeHandler } from '@zylem/bridge';
34
+ import { GameLoadingPayload as BridgeLoadingPayload } from '@zylem/bridge';
35
+ import { BridgeMessages } from '@zylem/bridge';
36
+ import { BridgeMessageType } from '@zylem/bridge';
37
+ import { BridgeVec3 } from '@zylem/bridge';
29
38
  import { BufferGeometry } from 'three';
30
39
  import { BurstParticlePresetOptions } from '@zylem/behaviors';
31
40
  import { Camera } from 'three';
@@ -77,11 +86,14 @@ import { Destructible3DHandle } from '@zylem/behaviors';
77
86
  import { DestructibleMesh } from '@zylem/behaviors';
78
87
  import { DestructiblePrebakeWorkerAPI } from '@zylem/behaviors';
79
88
  import { dot } from 'three/tsl';
89
+ import { EditorToGameMessages } from '@zylem/bridge';
80
90
  import { emitRuntimeGoal } from '@zylem/behaviors/runtime-2d';
81
91
  import { emitRuntimeRicochet } from '@zylem/behaviors/runtime-2d';
82
92
  import { emitRuntimeTriggerRegionEnter } from '@zylem/behaviors/runtime-2d';
83
93
  import { EntityDefinition } from '@zylem/behaviors/core';
84
94
  import { EntityHandle } from '@zylem/behaviors/core';
95
+ import { EntitySummaryPayload } from '@zylem/bridge';
96
+ import { EntityThumbnailPayload } from '@zylem/bridge';
85
97
  import { exp } from 'three/tsl';
86
98
  import { FacingAngle2DEntity } from '@zylem/behaviors';
87
99
  import { fireCooldown } from '@zylem/behaviors';
@@ -108,11 +120,16 @@ import { FogExp2 } from 'three';
108
120
  import { fract } from 'three/tsl';
109
121
  import { FractureOptions } from '@zylem/behaviors';
110
122
  import { FractureOptionsInput } from '@zylem/behaviors';
123
+ import { GameConfigPayload } from '@zylem/bridge';
124
+ import { GameNoticePayload } from '@zylem/bridge';
125
+ import { GameToEditorMessages } from '@zylem/bridge';
126
+ import { GameVariablePayload } from '@zylem/bridge';
111
127
  import { getCooldown } from '@zylem/behaviors';
112
128
  import { getCooldownStore } from '@zylem/behaviors';
113
129
  import { getEntityFacingAngle2D } from '@zylem/behaviors';
114
130
  import { getPosition } from '@zylem/behaviors/core';
115
131
  import { getVelocity } from '@zylem/behaviors/core';
132
+ import { getZylemBridge } from '@zylem/bridge';
116
133
  import { Group } from 'three';
117
134
  import { hasAnyWorldBoundary2DHit } from '@zylem/behaviors';
118
135
  import { hasAnyWorldBoundary3DHit } from '@zylem/behaviors';
@@ -308,6 +325,7 @@ import { StageBodyKindValue } from '@zylem/behaviors/core';
308
325
  import { StageBoundaryDim } from '@zylem/behaviors/core';
309
326
  import { StageColliderConfig } from '@zylem/behaviors/core';
310
327
  import { StageColliderShape } from '@zylem/behaviors/core';
328
+ import { StageConfigPayload } from '@zylem/bridge';
311
329
  import { StageDebugRender } from '@zylem/behaviors/core';
312
330
  import { StageEvent } from '@zylem/behaviors/core';
313
331
  import { StageEventType } from '@zylem/behaviors/core';
@@ -316,6 +334,7 @@ import { StageRaycastHit } from '@zylem/behaviors/core';
316
334
  import { StageRenderSlot } from '@zylem/behaviors/core';
317
335
  import { StageRicochetDim } from '@zylem/behaviors/core';
318
336
  import { StageRicochetReflection } from '@zylem/behaviors/core';
337
+ import { StageSnapshotPayload } from '@zylem/bridge';
319
338
  import { StageTopDownPlane } from '@zylem/behaviors/core';
320
339
  import { Static } from '@sinclair/typebox';
321
340
  import { step } from 'three/tsl';
@@ -380,6 +399,7 @@ import { WorldBoundary3DPosition } from '@zylem/behaviors';
380
399
  import { WorldBoundary3DState } from '@zylem/behaviors';
381
400
  import { wrapAround3D } from '@zylem/behaviors/core';
382
401
  import { wrapAroundXY } from '@zylem/behaviors/core';
402
+ import { ZylemBridge } from '@zylem/bridge';
383
403
 
384
404
  export { abs }
385
405
 
@@ -411,6 +431,8 @@ export interface AnalogState {
411
431
  value: number;
412
432
  }
413
433
 
434
+ export { announceBridgeReady }
435
+
414
436
  // Warning: (ae-forgotten-export) The symbol "TransformableEntity" needs to be exported by the entry point public.d.ts
415
437
  //
416
438
  // @public
@@ -469,6 +491,22 @@ export function boxCollision(opts?: BoxCollisionOptions): CollisionComponent;
469
491
  // @public
470
492
  export function boxMesh(opts?: BoxMeshOptions): Mesh;
471
493
 
494
+ export { BRIDGE_READY_EVENT }
495
+
496
+ export { BridgeChannel }
497
+
498
+ export { BridgeDebugTool }
499
+
500
+ export { BridgeHandler }
501
+
502
+ export { BridgeLoadingPayload }
503
+
504
+ export { BridgeMessages }
505
+
506
+ export { BridgeMessageType }
507
+
508
+ export { BridgeVec3 }
509
+
472
510
  // @public
473
511
  export function buildBoxCollider(size: Vec3Input, options?: RuntimeColliderOptions): StageColliderConfig;
474
512
 
@@ -920,13 +958,16 @@ export function cylinderCollision(opts?: CylinderCollisionOptions): CollisionCom
920
958
  // @public
921
959
  export function cylinderMesh(opts?: CylinderMeshOptions): Mesh;
922
960
 
961
+ // @public
962
+ export type DebugEntityResolver = (uuid: string) => GameEntity<any> | null;
963
+
923
964
  // Warning: (ae-forgotten-export) The symbol "DebugState" needs to be exported by the entry point public.d.ts
924
965
  //
925
966
  // @public (undocumented)
926
967
  export const debugState: DebugState;
927
968
 
928
969
  // @public (undocumented)
929
- export type DebugTools = 'select' | 'translate' | 'rotate' | 'scale' | 'delete' | 'none';
970
+ export type DebugTools = 'select' | 'translate' | 'rotate' | 'scale' | 'delete' | 'add' | 'none';
930
971
 
931
972
  // @public
932
973
  export function defaultTouchControls(player?: InputPlayer, options?: DefaultTouchControlsOptions): GameInputConfig;
@@ -989,6 +1030,8 @@ export function dispatchStageState(): void;
989
1030
 
990
1031
  export { dot }
991
1032
 
1033
+ export { EditorToGameMessages }
1034
+
992
1035
  export { emitRuntimeGoal }
993
1036
 
994
1037
  export { emitRuntimeRicochet }
@@ -998,40 +1041,6 @@ export { emitRuntimeTriggerRegionEnter }
998
1041
  // @public (undocumented)
999
1042
  export type EntityBlueprint = Static<typeof EntitySchema>;
1000
1043
 
1001
- // @public
1002
- export interface EntityConfigPayload {
1003
- bounds?: {
1004
- width: number;
1005
- height: number;
1006
- depth: number;
1007
- };
1008
- // (undocumented)
1009
- name: string;
1010
- // (undocumented)
1011
- position: {
1012
- x: number;
1013
- y: number;
1014
- z: number;
1015
- };
1016
- // (undocumented)
1017
- rotation: {
1018
- x: number;
1019
- y: number;
1020
- z: number;
1021
- };
1022
- // (undocumented)
1023
- scale: {
1024
- x: number;
1025
- y: number;
1026
- z: number;
1027
- };
1028
- thumbnail?: string | null;
1029
- // (undocumented)
1030
- type: string;
1031
- // (undocumented)
1032
- uuid: string;
1033
- }
1034
-
1035
1044
  export { EntityDefinition }
1036
1045
 
1037
1046
  // @public (undocumented)
@@ -1138,9 +1147,12 @@ export const EntitySchema: _sinclair_typebox.TObject<{
1138
1147
  // @public (undocumented)
1139
1148
  export function entitySpawner(factory: (x: number, y: number) => Promise<any> | GameEntity<any>): EntitySpawner;
1140
1149
 
1150
+ export { EntitySummaryPayload }
1151
+
1141
1152
  // @public
1142
1153
  export class EntityThumbnailCache {
1143
- constructor(size?: number);
1154
+ constructor(size?: number, maxEntries?: number);
1155
+ get cacheSize(): number;
1144
1156
  // (undocumented)
1145
1157
  clear(): void;
1146
1158
  ensure(uuid: string, object: Object3D | null | undefined): Promise<EntityThumbnailCacheEntry | null>;
@@ -1148,6 +1160,7 @@ export class EntityThumbnailCache {
1148
1160
  get(uuid: string): EntityThumbnailCacheEntry | null;
1149
1161
  // (undocumented)
1150
1162
  invalidate(uuid: string): void;
1163
+ get pendingCount(): number;
1151
1164
  // (undocumented)
1152
1165
  setRenderer(renderer: WebGPURenderer | null): void;
1153
1166
  }
@@ -1161,13 +1174,14 @@ export interface EntityThumbnailCacheEntry extends EntityThumbnailResult {
1161
1174
  uuid: string;
1162
1175
  }
1163
1176
 
1177
+ export { EntityThumbnailPayload }
1178
+
1164
1179
  // @public (undocumented)
1165
1180
  export interface EntityThumbnailResult {
1166
1181
  // Warning: (ae-forgotten-export) The symbol "ObjectBounds" needs to be exported by the entry point public.d.ts
1167
1182
  //
1168
1183
  // (undocumented)
1169
1184
  bounds: Pick<ObjectBounds, 'width' | 'height' | 'depth'>;
1170
- // (undocumented)
1171
1185
  dataUrl: string;
1172
1186
  }
1173
1187
 
@@ -1405,6 +1419,40 @@ export class Game<TGlobals extends BaseGlobals> implements IGame<TGlobals> {
1405
1419
  step(deltaTime?: number): void;
1406
1420
  }
1407
1421
 
1422
+ // @public (undocumented)
1423
+ export class GameBridge {
1424
+ constructor();
1425
+ connect(host: GameBridgeHost, announceTarget?: EventTarget): void;
1426
+ // (undocumented)
1427
+ disconnect(): void;
1428
+ onEditorAttached(callback: () => void): () => void;
1429
+ // (undocumented)
1430
+ publishConfig(config: GameConfigPayload): void;
1431
+ // (undocumented)
1432
+ publishLoading(payload: BridgeLoadingPayload): void;
1433
+ publishNotice(level: GameNoticePayload['level'], message: string): void;
1434
+ // (undocumented)
1435
+ publishStageSnapshot(snapshot: StageSnapshotPayload): void;
1436
+ // (undocumented)
1437
+ publishStatus(status: {
1438
+ paused?: boolean;
1439
+ debug?: boolean;
1440
+ }): void;
1441
+ // (undocumented)
1442
+ publishVariable(payload: GameVariablePayload): void;
1443
+ queueEntityRemoved(uuids: string[]): void;
1444
+ queueEntityUpsert(entities: EntitySummaryPayload[]): void;
1445
+ queueThumbnails(thumbnails: EntityThumbnailPayload[]): void;
1446
+ wantsEntityUpdates(): boolean;
1447
+ wantsThumbnails(): boolean;
1448
+ }
1449
+
1450
+ // @public
1451
+ export interface GameBridgeHost {
1452
+ resolveEntity(uuid: string): GameEntity<any> | null;
1453
+ setStageVariable?(key: string, value: unknown): void;
1454
+ }
1455
+
1408
1456
  // @public
1409
1457
  export function gameConfig(config: GameConfigLike): GameConfigLike;
1410
1458
 
@@ -1538,6 +1586,8 @@ export type GameConfigLike = Partial<{
1538
1586
  canvas: HTMLCanvasElement;
1539
1587
  }>;
1540
1588
 
1589
+ export { GameConfigPayload }
1590
+
1541
1591
  // @public (undocumented)
1542
1592
  export type GameDeviceConfig = Partial<{
1543
1593
  aspectRatio: AspectRatioValue | keyof typeof AspectRatio;
@@ -1777,7 +1827,6 @@ export type GameEvents = {
1777
1827
  'debug': {
1778
1828
  enabled: boolean;
1779
1829
  };
1780
- 'state:dispatch': StateDispatchPayload;
1781
1830
  };
1782
1831
 
1783
1832
  // @public (undocumented)
@@ -2009,6 +2058,10 @@ export interface GameLoadingPayload extends LoadingEvent {
2009
2058
  stageName?: string;
2010
2059
  }
2011
2060
 
2061
+ export { GameToEditorMessages }
2062
+
2063
+ export { GameVariablePayload }
2064
+
2012
2065
  export { getCooldown }
2013
2066
 
2014
2067
  export { getCooldownStore }
@@ -2024,6 +2077,12 @@ export function getGlobal<T = unknown>(path: string): T | undefined;
2024
2077
  // @public
2025
2078
  export function getGlobals<T = Record<string, unknown>>(): T;
2026
2079
 
2080
+ // @public
2081
+ export function getHoveredEntity(): GameEntity<any> | null;
2082
+
2083
+ // @public (undocumented)
2084
+ export function getHoveredEntityId(): string | null;
2085
+
2027
2086
  export { getPosition }
2028
2087
 
2029
2088
  // @public (undocumented)
@@ -2034,11 +2093,19 @@ export function getPresetResolution(preset: RetroPresetKey, key?: string): Retro
2034
2093
  // @public
2035
2094
  export function getRotation(entity: RotatableEntity): any;
2036
2095
 
2096
+ // @public
2097
+ export function getSelectedEntity(): GameEntity<any> | null;
2098
+
2099
+ // @public (undocumented)
2100
+ export function getSelectedEntityId(): string | null;
2101
+
2037
2102
  // @public
2038
2103
  export function getVariable<T = unknown>(target: object, path: string): T | undefined;
2039
2104
 
2040
2105
  export { getVelocity }
2041
2106
 
2107
+ export { getZylemBridge }
2108
+
2042
2109
  // @public
2043
2110
  export function globalChange<T = any>(key: string, callback: (value: T, ctx: UpdateContext<any>) => void): (ctx: UpdateContext<any>) => void;
2044
2111
 
@@ -2593,6 +2660,9 @@ export const RECT_TYPE: unique symbol;
2593
2660
 
2594
2661
  export { registerCooldown }
2595
2662
 
2663
+ // @public
2664
+ export function registerDebugEntityResolver(resolver: DebugEntityResolver): () => void;
2665
+
2596
2666
  // @public
2597
2667
  export function registerEntityFocusContext(context: EntityFocusContext): () => void;
2598
2668
 
@@ -2666,6 +2736,9 @@ export function resolveButtonAccent(theme: TouchTheme, slot: VirtualTouchButtonS
2666
2736
 
2667
2737
  export { ResolvedAim2D }
2668
2738
 
2739
+ // @public
2740
+ export function resolveDebugEntity(uuid: string | null): GameEntity<any> | null;
2741
+
2669
2742
  // @public (undocumented)
2670
2743
  export interface ResolveGameConfigRuntime {
2671
2744
  // (undocumented)
@@ -2934,6 +3007,9 @@ export function setDebugTool(tool: DebugTools): void;
2934
3007
  // @public
2935
3008
  export function setGlobal(path: string, value: unknown): void;
2936
3009
 
3010
+ // @public (undocumented)
3011
+ export function setHoveredEntityId(uuid: string | null): void;
3012
+
2937
3013
  // @public (undocumented)
2938
3014
  export function setPaused(paused: boolean): void;
2939
3015
 
@@ -2969,8 +3045,11 @@ export function setRotationY(entity: RotatableEntity, y: number): void;
2969
3045
  // @public
2970
3046
  export function setRotationZ(entity: RotatableEntity, z: number): void;
2971
3047
 
3048
+ // @public @deprecated (undocumented)
3049
+ export function setSelectedEntity(entity: GameEntity<any> | string | null): void;
3050
+
2972
3051
  // @public (undocumented)
2973
- export function setSelectedEntity(entity: GameEntity<any> | null): void;
3052
+ export function setSelectedEntityId(uuid: string | null): void;
2974
3053
 
2975
3054
  // @public (undocumented)
2976
3055
  export function setStageFrameProfilerEnabled(value: boolean): void;
@@ -3226,25 +3305,7 @@ export type StageConfigLike = Partial<{
3226
3305
  postProcessingEffects: ZylemPostEffect[];
3227
3306
  }>;
3228
3307
 
3229
- // @public
3230
- export interface StageConfigPayload {
3231
- // (undocumented)
3232
- backgroundColor: string;
3233
- // (undocumented)
3234
- backgroundImage: string | null;
3235
- // (undocumented)
3236
- gravity: {
3237
- x: number;
3238
- y: number;
3239
- z: number;
3240
- };
3241
- // (undocumented)
3242
- id: string;
3243
- // (undocumented)
3244
- inputs: Record<string, string[]>;
3245
- // (undocumented)
3246
- variables: Record<string, unknown>;
3247
- }
3308
+ export { StageConfigPayload }
3248
3309
 
3249
3310
  export { StageDebugRender }
3250
3311
 
@@ -3407,6 +3468,8 @@ export const StageSchema: _sinclair_typebox.TObject<{
3407
3468
  assets: _sinclair_typebox.TOptional<_sinclair_typebox.TArray<_sinclair_typebox.TString>>;
3408
3469
  }>;
3409
3470
 
3471
+ export { StageSnapshotPayload }
3472
+
3410
3473
  // @public (undocumented)
3411
3474
  export const stageState: {
3412
3475
  previous: StageBlueprint | null;
@@ -3446,34 +3509,6 @@ export const standardShader: {
3446
3509
  fragment: string;
3447
3510
  };
3448
3511
 
3449
- // @public
3450
- export interface StateDispatchPayload {
3451
- // (undocumented)
3452
- config?: {
3453
- id: string;
3454
- aspectRatio: number;
3455
- fullscreen: boolean;
3456
- bodyBackground: string | undefined;
3457
- internalResolution: {
3458
- width: number;
3459
- height: number;
3460
- } | undefined;
3461
- debug: boolean;
3462
- } | null;
3463
- // (undocumented)
3464
- entities?: EntityConfigPayload[] | null;
3465
- // (undocumented)
3466
- path: string;
3467
- // (undocumented)
3468
- previousValue?: unknown;
3469
- // (undocumented)
3470
- scope: 'game' | 'stage' | 'entity';
3471
- // (undocumented)
3472
- stageConfig?: StageConfigPayload | null;
3473
- // (undocumented)
3474
- value: unknown;
3475
- }
3476
-
3477
3512
  export { step }
3478
3513
 
3479
3514
  // @public
@@ -4182,6 +4217,8 @@ export class ZylemBox extends GameEntity<ZylemBoxOptions> {
4182
4217
  static type: symbol;
4183
4218
  }
4184
4219
 
4220
+ export { ZylemBridge }
4221
+
4185
4222
  // Warning: (ae-forgotten-export) The symbol "ZylemConeOptions" needs to be exported by the entry point public.d.ts
4186
4223
  //
4187
4224
  // @public
@@ -4600,8 +4637,8 @@ export class ZylemZone extends GameEntity<ZylemZoneOptions> implements Collision
4600
4637
  // dist/entity-BGEq1yfC.d.ts:434:9 - (ae-forgotten-export) The symbol "EntityMeshBuilder" needs to be exported by the entry point public.d.ts
4601
4638
  // dist/entity-BGEq1yfC.d.ts:435:9 - (ae-forgotten-export) The symbol "EntityCollisionBuilder" needs to be exported by the entry point public.d.ts
4602
4639
  // dist/entity-BGEq1yfC.d.ts:436:9 - (ae-forgotten-export) The symbol "MaterialBuilder" needs to be exported by the entry point public.d.ts
4603
- // dist/game-DbqBQiFC.d.ts:937:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" needs to be exported by the entry point public.d.ts
4604
- // dist/game-DbqBQiFC.d.ts:1549:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
4640
+ // dist/game-NHkubIfI.d.ts:951:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" needs to be exported by the entry point public.d.ts
4641
+ // dist/game-NHkubIfI.d.ts:1563:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
4605
4642
 
4606
4643
  // (No @packageDocumentation comment for this package)
4607
4644