@zylem/game-lib 0.6.3 → 0.7.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 (97) hide show
  1. package/README.md +3 -1
  2. package/dist/actions.d.ts +255 -8
  3. package/dist/actions.js +1 -772
  4. package/dist/audio.d.ts +13 -0
  5. package/dist/audio.js +1 -0
  6. package/dist/base-node-life-cycle-CnJ-7zX-.d.ts +143 -0
  7. package/dist/behavior.d.ts +3 -0
  8. package/dist/behavior.js +1 -0
  9. package/dist/chunk-4QLJUQSJ.js +1 -0
  10. package/dist/chunk-73VZQZUL.js +1 -0
  11. package/dist/chunk-A34ZG3L4.js +1 -0
  12. package/dist/chunk-CDPY4VOQ.js +1 -0
  13. package/dist/chunk-DR6XXZE7.js +19 -0
  14. package/dist/chunk-FM5TBEPO.js +1 -0
  15. package/dist/chunk-G2IIMSUH.js +1 -0
  16. package/dist/chunk-MSC2BEO5.js +1 -0
  17. package/dist/chunk-NIH5CONO.js +1 -0
  18. package/dist/chunk-ONWXGBWB.js +1 -0
  19. package/dist/chunk-QEDQDR27.js +1 -0
  20. package/dist/chunk-QXVH6POE.js +1 -0
  21. package/dist/chunk-RXDTAWI2.js +29 -0
  22. package/dist/chunk-WKHW2QO2.js +1 -0
  23. package/dist/chunk-XRP4JJXL.js +1 -0
  24. package/dist/chunk-YHEWKN7N.js +1 -0
  25. package/dist/chunk-YHKXQ2ZN.js +1 -0
  26. package/dist/core.d.ts +206 -13
  27. package/dist/core.js +24 -9160
  28. package/dist/debug.d.ts +24 -0
  29. package/dist/debug.js +1 -0
  30. package/dist/default-controls-BGc61yYl.d.ts +111 -0
  31. package/dist/entity-DNkYKfdp.d.ts +1043 -0
  32. package/dist/entity-type-map-C94h2TDW.d.ts +781 -0
  33. package/dist/entity.d.ts +265 -0
  34. package/dist/entity.js +1 -0
  35. package/dist/events.d.ts +172 -0
  36. package/dist/events.js +1 -0
  37. package/dist/game-Cuj5gy7U.d.ts +1590 -0
  38. package/dist/game-default-PZLLHYL7.js +1 -0
  39. package/dist/game-interfaces-tfpM5NBk.d.ts +90 -0
  40. package/dist/globals.d.ts +104 -0
  41. package/dist/globals.js +1 -0
  42. package/dist/graphics.d.ts +83 -0
  43. package/dist/graphics.js +1 -0
  44. package/dist/input-ui.d.ts +34 -0
  45. package/dist/input-ui.js +1 -0
  46. package/dist/input.d.ts +72 -0
  47. package/dist/input.js +1 -0
  48. package/dist/material-Wz83vTTp.d.ts +151 -0
  49. package/dist/runtime.d.ts +433 -0
  50. package/dist/runtime.js +1 -0
  51. package/dist/web-components.d.ts +67 -0
  52. package/dist/web-components.js +9 -0
  53. package/dist/world-C9zdyl5d.d.ts +103 -0
  54. package/dist/zylem-stage-runtime-Cs-UDEVU.d.ts +777 -0
  55. package/package.json +54 -41
  56. package/dist/actions.js.map +0 -1
  57. package/dist/behavior/platformer-3d.d.ts +0 -296
  58. package/dist/behavior/platformer-3d.js +0 -518
  59. package/dist/behavior/platformer-3d.js.map +0 -1
  60. package/dist/behavior/ricochet-2d.d.ts +0 -274
  61. package/dist/behavior/ricochet-2d.js +0 -394
  62. package/dist/behavior/ricochet-2d.js.map +0 -1
  63. package/dist/behavior/screen-wrap.d.ts +0 -86
  64. package/dist/behavior/screen-wrap.js +0 -195
  65. package/dist/behavior/screen-wrap.js.map +0 -1
  66. package/dist/behavior/thruster.d.ts +0 -10
  67. package/dist/behavior/thruster.js +0 -234
  68. package/dist/behavior/thruster.js.map +0 -1
  69. package/dist/behavior/world-boundary-2d.d.ts +0 -141
  70. package/dist/behavior/world-boundary-2d.js +0 -181
  71. package/dist/behavior/world-boundary-2d.js.map +0 -1
  72. package/dist/behavior-descriptor-BWNWmIjv.d.ts +0 -142
  73. package/dist/blueprints-BWGz8fII.d.ts +0 -26
  74. package/dist/camera-B5e4c78l.d.ts +0 -468
  75. package/dist/camera.d.ts +0 -6
  76. package/dist/camera.js +0 -1406
  77. package/dist/camera.js.map +0 -1
  78. package/dist/composition-DrzFrbqI.d.ts +0 -218
  79. package/dist/core-DAkskq6Y.d.ts +0 -498
  80. package/dist/core.js.map +0 -1
  81. package/dist/entities-DC9ce_vx.d.ts +0 -416
  82. package/dist/entities.d.ts +0 -9
  83. package/dist/entities.js +0 -4069
  84. package/dist/entities.js.map +0 -1
  85. package/dist/entity-BpbZqg19.d.ts +0 -1100
  86. package/dist/entity-Bq_eNEDI.d.ts +0 -28
  87. package/dist/entity-types-DAu8sGJH.d.ts +0 -26
  88. package/dist/global-change-Dc8uCKi2.d.ts +0 -25
  89. package/dist/main.d.ts +0 -654
  90. package/dist/main.js +0 -13355
  91. package/dist/main.js.map +0 -1
  92. package/dist/stage-types-BFsm3qsZ.d.ts +0 -567
  93. package/dist/stage.d.ts +0 -51
  94. package/dist/stage.js +0 -5738
  95. package/dist/stage.js.map +0 -1
  96. package/dist/thruster-DhRaJnoL.d.ts +0 -172
  97. package/dist/world-Be5m1XC1.d.ts +0 -31
@@ -1,416 +0,0 @@
1
- import { I as GameEntity, P as GameEntityOptions, U as UpdateContext, M as DestroyContext, N as BaseNode, as as TexturePath, V as Vec3, R as MaterialOptions } from './entity-BpbZqg19.js';
2
- import { Vector3, Sprite, Color, Vector2, Object3D } from 'three';
3
- import { C as CollisionHandlerDelegate } from './world-Be5m1XC1.js';
4
-
5
- type SpriteImage = {
6
- name: string;
7
- file: string;
8
- };
9
- type SpriteAnimation = {
10
- name: string;
11
- frames: string[];
12
- speed: number | number[];
13
- loop: boolean;
14
- };
15
- type ZylemSpriteOptions = GameEntityOptions & {
16
- images?: SpriteImage[];
17
- animations?: SpriteAnimation[];
18
- size?: Vector3;
19
- collisionSize?: Vector3;
20
- };
21
- declare const SPRITE_TYPE: unique symbol;
22
- declare class ZylemSprite extends GameEntity<ZylemSpriteOptions> {
23
- static type: symbol;
24
- protected sprites: Sprite[];
25
- protected spriteMap: Map<string, number>;
26
- protected currentSpriteIndex: number;
27
- protected animations: Map<string, any>;
28
- protected currentAnimation: any;
29
- protected currentAnimationFrame: string;
30
- protected currentAnimationIndex: number;
31
- protected currentAnimationTime: number;
32
- constructor(options?: ZylemSpriteOptions);
33
- create(): this;
34
- protected createSpritesFromImages(images: SpriteImage[]): void;
35
- protected createAnimations(animations: SpriteAnimation[]): void;
36
- setSprite(key: string): void;
37
- setAnimation(name: string, delta: number): void;
38
- spriteUpdate(params: UpdateContext<ZylemSpriteOptions>): void;
39
- spriteDestroy(params: DestroyContext<ZylemSpriteOptions>): void;
40
- buildInfo(): Record<string, any>;
41
- }
42
- type SpriteOptions = BaseNode | Partial<ZylemSpriteOptions>;
43
- declare function createSprite(...args: Array<SpriteOptions>): ZylemSprite;
44
-
45
- type ZylemSphereOptions = GameEntityOptions & {
46
- radius?: number;
47
- };
48
- declare const SPHERE_TYPE: unique symbol;
49
- declare class ZylemSphere extends GameEntity<ZylemSphereOptions> {
50
- static type: symbol;
51
- constructor(options?: ZylemSphereOptions);
52
- buildInfo(): Record<string, any>;
53
- }
54
- type SphereOptions = BaseNode | Partial<ZylemSphereOptions>;
55
- declare function createSphere(...args: Array<SphereOptions>): ZylemSphere;
56
-
57
- type ZylemRectOptions = GameEntityOptions & {
58
- width?: number;
59
- height?: number;
60
- fillColor?: Color | string | null;
61
- strokeColor?: Color | string | null;
62
- strokeWidth?: number;
63
- radius?: number;
64
- padding?: number;
65
- stickToViewport?: boolean;
66
- screenPosition?: Vector2;
67
- zDistance?: number;
68
- anchor?: Vector2;
69
- bounds?: {
70
- screen?: {
71
- x: number;
72
- y: number;
73
- width: number;
74
- height: number;
75
- };
76
- world?: {
77
- left: number;
78
- right: number;
79
- top: number;
80
- bottom: number;
81
- z?: number;
82
- };
83
- };
84
- };
85
- declare const RECT_TYPE: unique symbol;
86
- declare class ZylemRect extends GameEntity<ZylemRectOptions> {
87
- static type: symbol;
88
- private _sprite;
89
- private _mesh;
90
- private _texture;
91
- private _canvas;
92
- private _ctx;
93
- private _cameraRef;
94
- private _lastCanvasW;
95
- private _lastCanvasH;
96
- constructor(options?: ZylemRectOptions);
97
- private createSprite;
98
- private redrawRect;
99
- getWidth(): number;
100
- getHeight(): number;
101
- private roundedRectPath;
102
- private toCssColor;
103
- /**
104
- * Get the viewport resolution from the renderer DOM element,
105
- * falling back to the camera's screenResolution if the renderer
106
- * is not available (e.g. when using the new RendererManager path).
107
- */
108
- private getResolution;
109
- private rectSetup;
110
- private rectUpdate;
111
- private updateStickyTransform;
112
- private worldToScreen;
113
- private computeScreenBoundsFromOptions;
114
- updateRect(options?: Partial<Pick<ZylemRectOptions, 'width' | 'height' | 'fillColor' | 'strokeColor' | 'strokeWidth' | 'radius'>>): void;
115
- buildInfo(): Record<string, any>;
116
- }
117
- type RectOptions = BaseNode | Partial<ZylemRectOptions>;
118
- declare function createRect(...args: Array<RectOptions>): ZylemRect;
119
-
120
- type ZylemTextOptions = GameEntityOptions & {
121
- text?: string;
122
- fontFamily?: string;
123
- fontSize?: number;
124
- fontColor?: Color | string;
125
- backgroundColor?: Color | string | null;
126
- padding?: number;
127
- stickToViewport?: boolean;
128
- screenPosition?: Vector2;
129
- zDistance?: number;
130
- };
131
- declare const TEXT_TYPE: unique symbol;
132
- declare class ZylemText extends GameEntity<ZylemTextOptions> {
133
- static type: symbol;
134
- private _sprite;
135
- private _texture;
136
- private _canvas;
137
- private _ctx;
138
- private _cameraRef;
139
- private _lastCanvasW;
140
- private _lastCanvasH;
141
- constructor(options?: ZylemTextOptions);
142
- create(): this;
143
- private createSprite;
144
- private measureAndResizeCanvas;
145
- private drawCenteredText;
146
- private updateTexture;
147
- private redrawText;
148
- private toCssColor;
149
- private textSetup;
150
- private textUpdate;
151
- private getResolution;
152
- private getScreenPixels;
153
- private computeWorldExtents;
154
- private updateSpriteScale;
155
- private updateStickyTransform;
156
- updateText(_text: string): void;
157
- buildInfo(): Record<string, any>;
158
- /**
159
- * Dispose of Three.js resources when the entity is destroyed.
160
- */
161
- private textDestroy;
162
- }
163
- type TextOptions = BaseNode | Partial<ZylemTextOptions>;
164
- declare function createText(...args: Array<TextOptions>): ZylemText;
165
-
166
- type ZylemBoxOptions = GameEntityOptions;
167
- declare const BOX_TYPE: unique symbol;
168
- declare class ZylemBox extends GameEntity<ZylemBoxOptions> {
169
- static type: symbol;
170
- constructor(options?: ZylemBoxOptions);
171
- buildInfo(): Record<string, any>;
172
- }
173
- type BoxOptions = BaseNode | Partial<ZylemBoxOptions>;
174
- declare function createBox(...args: Array<BoxOptions>): ZylemBox;
175
-
176
- type ZylemPlaneOptions = GameEntityOptions & {
177
- tile?: Vector2;
178
- repeat?: Vector2;
179
- texture?: TexturePath;
180
- subdivisions?: number;
181
- randomizeHeight?: boolean;
182
- heightMap?: number[];
183
- heightScale?: number;
184
- };
185
- declare const PLANE_TYPE: unique symbol;
186
- declare class ZylemPlane extends GameEntity<ZylemPlaneOptions> {
187
- static type: symbol;
188
- constructor(options?: ZylemPlaneOptions);
189
- }
190
- type PlaneOptions = BaseNode | Partial<ZylemPlaneOptions>;
191
- declare function createPlane(...args: Array<PlaneOptions>): ZylemPlane;
192
-
193
- type OnHeldParams = {
194
- delta: number;
195
- self: ZylemZone;
196
- visitor: GameEntity<any>;
197
- heldTime: number;
198
- globals: any;
199
- };
200
- type OnEnterParams = Pick<OnHeldParams, 'self' | 'visitor' | 'globals'>;
201
- type OnExitParams = Pick<OnHeldParams, 'self' | 'visitor' | 'globals'>;
202
- type ZylemZoneOptions = GameEntityOptions & {
203
- size?: Vector3;
204
- static?: boolean;
205
- onEnter?: (params: OnEnterParams) => void;
206
- onHeld?: (params: OnHeldParams) => void;
207
- onExit?: (params: OnExitParams) => void;
208
- };
209
- declare const ZONE_TYPE: unique symbol;
210
- declare class ZylemZone extends GameEntity<ZylemZoneOptions> implements CollisionHandlerDelegate {
211
- static type: symbol;
212
- private _enteredZone;
213
- private _exitedZone;
214
- private _zoneEntities;
215
- constructor(options?: ZylemZoneOptions);
216
- handlePostCollision({ delta }: {
217
- delta: number;
218
- }): boolean;
219
- handleIntersectionEvent({ other, delta }: {
220
- other: any;
221
- delta: number;
222
- }): void;
223
- onEnter(callback: (params: OnEnterParams) => void): this;
224
- onHeld(callback: (params: OnHeldParams) => void): this;
225
- onExit(callback: (params: OnExitParams) => void): this;
226
- entered(other: any): void;
227
- exited(delta: number, key: string): void;
228
- held(delta: number, other: any): void;
229
- }
230
- type ZoneOptions = BaseNode | Partial<ZylemZoneOptions>;
231
- declare function createZone(...args: Array<ZoneOptions>): ZylemZone;
232
-
233
- interface EntityLoaderDelegate {
234
- /** Initiates loading (may be async internally, but call returns immediately) */
235
- load(): void;
236
- /** Returns data synchronously (may be null if still loading) */
237
- data(): any;
238
- }
239
-
240
- type AnimationOptions = {
241
- key: string;
242
- pauseAtEnd?: boolean;
243
- pauseAtPercentage?: number;
244
- fadeToKey?: string;
245
- fadeDuration?: number;
246
- };
247
-
248
- /**
249
- * Interface for entities that provide custom debug information
250
- */
251
- interface DebugInfoProvider {
252
- getDebugInfo(): Record<string, any>;
253
- }
254
-
255
- type AnimationObject = {
256
- key?: string;
257
- path: string;
258
- };
259
- type CollisionShapeType = 'capsule' | 'model';
260
- type ZylemActorOptions = GameEntityOptions & {
261
- static?: boolean;
262
- animations?: AnimationObject[];
263
- models?: string[];
264
- scale?: Vec3;
265
- material?: MaterialOptions;
266
- collisionShape?: CollisionShapeType;
267
- };
268
- declare const ACTOR_TYPE: unique symbol;
269
- declare class ZylemActor extends GameEntity<ZylemActorOptions> implements EntityLoaderDelegate, DebugInfoProvider {
270
- static type: symbol;
271
- private _object;
272
- private _animationDelegate;
273
- private _modelFileNames;
274
- private _assetLoader;
275
- controlledRotation: boolean;
276
- constructor(options?: ZylemActorOptions);
277
- /**
278
- * Initiates model and animation loading in background (deferred).
279
- * Call returns immediately; assets will be ready on subsequent updates.
280
- */
281
- load(): void;
282
- /**
283
- * Returns current data synchronously.
284
- * May return null values if loading is still in progress.
285
- */
286
- data(): any;
287
- actorUpdate(params: UpdateContext<ZylemActorOptions>): void;
288
- /**
289
- * Clean up actor resources including animations, models, and groups
290
- */
291
- actorDestroy(): void;
292
- /**
293
- * Deferred loading - starts async load and updates entity when complete.
294
- * Called by synchronous load() method.
295
- */
296
- private loadModelsDeferred;
297
- playAnimation(animationOptions: AnimationOptions): void;
298
- /**
299
- * Apply material overrides from options to all meshes in the loaded model.
300
- * Only applies if material options are explicitly specified (not just defaults).
301
- */
302
- private applyMaterialOverrides;
303
- get object(): Object3D | null;
304
- /**
305
- * Provide custom debug information for the actor
306
- * This will be merged with the default debug information
307
- */
308
- getDebugInfo(): Record<string, any>;
309
- }
310
- type ActorOptions = BaseNode | ZylemActorOptions;
311
- declare function createActor(...args: Array<ActorOptions>): ZylemActor;
312
-
313
- type ZylemConeOptions = GameEntityOptions & {
314
- /** Base radius of the cone */
315
- radius?: number;
316
- /** Height of the cone */
317
- height?: number;
318
- /** Number of radial segments (higher = smoother) */
319
- radialSegments?: number;
320
- };
321
- declare const CONE_TYPE: unique symbol;
322
- /**
323
- * A cone entity with configurable radius, height, and radial segments.
324
- * Uses a Rapier cone collider for physics.
325
- */
326
- declare class ZylemCone extends GameEntity<ZylemConeOptions> {
327
- static type: symbol;
328
- constructor(options?: ZylemConeOptions);
329
- buildInfo(): Record<string, any>;
330
- }
331
- type ConeOptions = BaseNode | Partial<ZylemConeOptions>;
332
- /**
333
- * Create a cone entity.
334
- * @param args Options or child nodes
335
- */
336
- declare function createCone(...args: Array<ConeOptions>): ZylemCone;
337
-
338
- type ZylemPyramidOptions = GameEntityOptions & {
339
- /** Base radius of the pyramid */
340
- radius?: number;
341
- /** Height of the pyramid */
342
- height?: number;
343
- };
344
- declare const PYRAMID_TYPE: unique symbol;
345
- /**
346
- * A pyramid entity (4-sided cone).
347
- * Uses ConeGeometry with 4 radial segments for the visual mesh
348
- * and a Rapier cone collider for physics.
349
- */
350
- declare class ZylemPyramid extends GameEntity<ZylemPyramidOptions> {
351
- static type: symbol;
352
- constructor(options?: ZylemPyramidOptions);
353
- buildInfo(): Record<string, any>;
354
- }
355
- type PyramidOptions = BaseNode | Partial<ZylemPyramidOptions>;
356
- /**
357
- * Create a pyramid entity.
358
- * @param args Options or child nodes
359
- */
360
- declare function createPyramid(...args: Array<PyramidOptions>): ZylemPyramid;
361
-
362
- type ZylemCylinderOptions = GameEntityOptions & {
363
- /** Top radius of the cylinder */
364
- radiusTop?: number;
365
- /** Bottom radius of the cylinder */
366
- radiusBottom?: number;
367
- /** Height of the cylinder */
368
- height?: number;
369
- /** Number of radial segments (higher = smoother) */
370
- radialSegments?: number;
371
- };
372
- declare const CYLINDER_TYPE: unique symbol;
373
- /**
374
- * A cylinder entity with configurable top/bottom radii, height, and segments.
375
- * Uses a Rapier cylinder collider for physics.
376
- */
377
- declare class ZylemCylinder extends GameEntity<ZylemCylinderOptions> {
378
- static type: symbol;
379
- constructor(options?: ZylemCylinderOptions);
380
- buildInfo(): Record<string, any>;
381
- }
382
- type CylinderOptions = BaseNode | Partial<ZylemCylinderOptions>;
383
- /**
384
- * Create a cylinder entity.
385
- * @param args Options or child nodes
386
- */
387
- declare function createCylinder(...args: Array<CylinderOptions>): ZylemCylinder;
388
-
389
- type ZylemPillOptions = GameEntityOptions & {
390
- /** Radius of the capsule hemispheres */
391
- radius?: number;
392
- /** Length of the cylindrical middle section */
393
- length?: number;
394
- /** Number of cap segments (higher = smoother) */
395
- capSegments?: number;
396
- /** Number of radial segments (higher = smoother) */
397
- radialSegments?: number;
398
- };
399
- declare const PILL_TYPE: unique symbol;
400
- /**
401
- * A pill/capsule entity with configurable radius and cylindrical length.
402
- * Uses Three.js CapsuleGeometry for rendering and Rapier capsule collider for physics.
403
- */
404
- declare class ZylemPill extends GameEntity<ZylemPillOptions> {
405
- static type: symbol;
406
- constructor(options?: ZylemPillOptions);
407
- buildInfo(): Record<string, any>;
408
- }
409
- type PillOptions = BaseNode | Partial<ZylemPillOptions>;
410
- /**
411
- * Create a pill (capsule) entity.
412
- * @param args Options or child nodes
413
- */
414
- declare function createPill(...args: Array<PillOptions>): ZylemPill;
415
-
416
- export { ACTOR_TYPE as A, BOX_TYPE as B, CONE_TYPE as C, createCylinder as D, createPill as E, PLANE_TYPE as P, RECT_TYPE as R, SPRITE_TYPE as S, TEXT_TYPE as T, ZylemSprite as Z, SPHERE_TYPE as a, ZylemSphere as b, ZylemRect as c, ZylemText as d, ZylemBox as e, ZylemPlane as f, ZONE_TYPE as g, ZylemZone as h, ZylemActor as i, ZylemCone as j, PYRAMID_TYPE as k, ZylemPyramid as l, CYLINDER_TYPE as m, ZylemCylinder as n, PILL_TYPE as o, ZylemPill as p, createBox as q, createSphere as r, createSprite as s, createPlane as t, createZone as u, createActor as v, createText as w, createRect as x, createCone as y, createPyramid as z };
@@ -1,9 +0,0 @@
1
- export { e as ZylemBox, v as createActor, q as createBox, y as createCone, D as createCylinder, E as createPill, t as createPlane, z as createPyramid, x as createRect, r as createSphere, s as createSprite, w as createText, u as createZone } from './entities-DC9ce_vx.js';
2
- import './entity-BpbZqg19.js';
3
- import 'three';
4
- import '@dimforge/rapier3d-compat';
5
- import 'bitecs';
6
- import 'mitt';
7
- import './behavior-descriptor-BWNWmIjv.js';
8
- import './world-Be5m1XC1.js';
9
- import './entity-Bq_eNEDI.js';