@zylem/game-lib 0.8.9 → 0.9.1

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 (69) hide show
  1. package/README.md +7 -1
  2. package/dist/api/game-lib.api.json +37952 -19547
  3. package/dist/api/game-lib.api.md +1302 -7
  4. package/dist/api/game-lib.d.ts +1696 -3
  5. package/dist/api/game-lib.typedoc.json +174596 -76562
  6. package/dist/audio.d.ts +193 -1
  7. package/dist/audio.js +1 -1
  8. package/dist/bridge.d.ts +17 -2
  9. package/dist/bridge.js +1 -1
  10. package/dist/catalog.js +1 -1
  11. package/dist/chunk-2PFNNGTV.js +1 -0
  12. package/dist/chunk-2XMG3NJS.js +1 -0
  13. package/dist/chunk-4CZZZCFB.js +9 -0
  14. package/dist/chunk-7CBJKE42.js +1 -0
  15. package/dist/{chunk-CBUQBP2U.js → chunk-BQRMYLYD.js} +1 -1
  16. package/dist/chunk-FZNEWOC5.js +1 -0
  17. package/dist/chunk-GPCSX3M6.js +1 -0
  18. package/dist/chunk-K3NNXZIJ.js +1 -0
  19. package/dist/{chunk-JNFFTNMH.js → chunk-KSEP7AUF.js} +1 -1
  20. package/dist/{chunk-7JSZEEAE.js → chunk-LI43BZQN.js} +1 -1
  21. package/dist/chunk-NVVLLWIM.js +1 -0
  22. package/dist/chunk-QGIYILYI.js +1 -0
  23. package/dist/chunk-SHDHPDOV.js +24 -0
  24. package/dist/chunk-STVEILJJ.js +1 -0
  25. package/dist/chunk-SWDNK4GG.js +1 -0
  26. package/dist/chunk-UUOPT2N4.js +1 -0
  27. package/dist/chunk-VMXSE3EC.js +0 -0
  28. package/dist/{chunk-EYDC2PMO.js → chunk-VSFULLND.js} +1 -1
  29. package/dist/chunk-YNX3Q3CL.js +1 -0
  30. package/dist/chunk-ZZO4CKRU.js +1 -0
  31. package/dist/cinematics.d.ts +279 -0
  32. package/dist/cinematics.js +1 -0
  33. package/dist/core.d.ts +124 -10
  34. package/dist/core.js +1 -1
  35. package/dist/cutscene-definition-C479fkei.d.ts +509 -0
  36. package/dist/debug.d.ts +1 -0
  37. package/dist/debug.js +1 -1
  38. package/dist/{entity-type-map-D6BeAdvg.d.ts → entity-type-map-CrsrKT8c.d.ts} +12 -3
  39. package/dist/entity.d.ts +2 -1
  40. package/dist/entity.js +1 -1
  41. package/dist/game-D8KTP3fD.d.ts +652 -0
  42. package/dist/game-default-JV3Q6JAL.js +1 -0
  43. package/dist/graphics.d.ts +1 -1
  44. package/dist/graphics.js +1 -1
  45. package/dist/public.d.ts +12 -6
  46. package/dist/public.js +1 -1
  47. package/dist/schema/cutscene.schema.json +782 -0
  48. package/dist/schema/song.schema.json +430 -0
  49. package/dist/schema.d.ts +2 -0
  50. package/dist/schema.js +1 -1
  51. package/dist/selection-bounds-BKmSo9aG.d.ts +50 -0
  52. package/dist/song-definition-rEKksP0B.d.ts +263 -0
  53. package/dist/song-player-7QPLFLAS.js +1 -0
  54. package/dist/{game-DyKbOeck.d.ts → stage-CAPlk_cN.d.ts} +146 -647
  55. package/dist/web-components.d.ts +5 -3
  56. package/dist/web-components.js +1 -1
  57. package/dist/{zylem-camera-DZTpPOiD.d.ts → zylem-camera-CYDtrVgi.d.ts} +134 -102
  58. package/package.json +11 -4
  59. package/dist/chunk-34MYRTRP.js +0 -9
  60. package/dist/chunk-AXJTUVGC.js +0 -24
  61. package/dist/chunk-BWOZF5YK.js +0 -1
  62. package/dist/chunk-EVMLNMGU.js +0 -1
  63. package/dist/chunk-G3TBBZUI.js +0 -1
  64. package/dist/chunk-J6KD2G6F.js +0 -1
  65. package/dist/chunk-X7T7QRYP.js +0 -1
  66. package/dist/chunk-YVWDCZNT.js +0 -1
  67. package/dist/chunk-ZRT3ZQVH.js +0 -1
  68. package/dist/game-default-6YXFFZ2Q.js +0 -1
  69. /package/dist/{chunk-MSCVL5OK.js → chunk-ELQN62PQ.js} +0 -0
@@ -0,0 +1,430 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "SongDefinition",
4
+ "title": "SongDefinition",
5
+ "additionalProperties": false,
6
+ "type": "object",
7
+ "required": [
8
+ "id",
9
+ "name",
10
+ "bpm",
11
+ "timeSignature",
12
+ "lengthBars",
13
+ "instruments",
14
+ "tracks",
15
+ "clips"
16
+ ],
17
+ "properties": {
18
+ "id": {
19
+ "type": "string"
20
+ },
21
+ "name": {
22
+ "type": "string"
23
+ },
24
+ "bpm": {
25
+ "exclusiveMinimum": 0,
26
+ "type": "number"
27
+ },
28
+ "timeSignature": {
29
+ "title": "TimeSignature",
30
+ "additionalProperties": false,
31
+ "type": "object",
32
+ "required": [
33
+ "numerator",
34
+ "denominator"
35
+ ],
36
+ "properties": {
37
+ "numerator": {
38
+ "minimum": 1,
39
+ "type": "integer"
40
+ },
41
+ "denominator": {
42
+ "minimum": 1,
43
+ "type": "integer"
44
+ }
45
+ }
46
+ },
47
+ "lengthBars": {
48
+ "minimum": 1,
49
+ "type": "integer"
50
+ },
51
+ "loop": {
52
+ "title": "SongLoop",
53
+ "additionalProperties": false,
54
+ "type": "object",
55
+ "required": [
56
+ "enabled",
57
+ "start",
58
+ "end"
59
+ ],
60
+ "properties": {
61
+ "enabled": {
62
+ "type": "boolean"
63
+ },
64
+ "start": {
65
+ "minimum": 0,
66
+ "type": "number"
67
+ },
68
+ "end": {
69
+ "exclusiveMinimum": 0,
70
+ "type": "number"
71
+ }
72
+ }
73
+ },
74
+ "instruments": {
75
+ "type": "array",
76
+ "items": {
77
+ "title": "InstrumentDefinition",
78
+ "additionalProperties": false,
79
+ "type": "object",
80
+ "required": [
81
+ "id",
82
+ "name",
83
+ "preset"
84
+ ],
85
+ "properties": {
86
+ "id": {
87
+ "type": "string"
88
+ },
89
+ "name": {
90
+ "type": "string"
91
+ },
92
+ "preset": {
93
+ "title": "InstrumentPreset",
94
+ "anyOf": [
95
+ {
96
+ "const": "synth",
97
+ "type": "string"
98
+ },
99
+ {
100
+ "const": "polySynth",
101
+ "type": "string"
102
+ },
103
+ {
104
+ "const": "fmSynth",
105
+ "type": "string"
106
+ },
107
+ {
108
+ "const": "amSynth",
109
+ "type": "string"
110
+ },
111
+ {
112
+ "const": "membraneSynth",
113
+ "type": "string"
114
+ },
115
+ {
116
+ "const": "metalSynth",
117
+ "type": "string"
118
+ },
119
+ {
120
+ "const": "noiseSynth",
121
+ "type": "string"
122
+ },
123
+ {
124
+ "const": "pluckSynth",
125
+ "type": "string"
126
+ }
127
+ ]
128
+ },
129
+ "oscillator": {
130
+ "title": "OscillatorType",
131
+ "anyOf": [
132
+ {
133
+ "const": "sine",
134
+ "type": "string"
135
+ },
136
+ {
137
+ "const": "square",
138
+ "type": "string"
139
+ },
140
+ {
141
+ "const": "sawtooth",
142
+ "type": "string"
143
+ },
144
+ {
145
+ "const": "triangle",
146
+ "type": "string"
147
+ }
148
+ ]
149
+ },
150
+ "envelope": {
151
+ "title": "Envelope",
152
+ "additionalProperties": false,
153
+ "type": "object",
154
+ "required": [
155
+ "attack",
156
+ "decay",
157
+ "sustain",
158
+ "release"
159
+ ],
160
+ "properties": {
161
+ "attack": {
162
+ "minimum": 0,
163
+ "type": "number"
164
+ },
165
+ "decay": {
166
+ "minimum": 0,
167
+ "type": "number"
168
+ },
169
+ "sustain": {
170
+ "minimum": 0,
171
+ "maximum": 1,
172
+ "type": "number"
173
+ },
174
+ "release": {
175
+ "minimum": 0,
176
+ "type": "number"
177
+ }
178
+ }
179
+ },
180
+ "volume": {
181
+ "type": "number"
182
+ },
183
+ "effects": {
184
+ "type": "array",
185
+ "items": {
186
+ "title": "InstrumentEffect",
187
+ "additionalProperties": false,
188
+ "type": "object",
189
+ "required": [
190
+ "id",
191
+ "type"
192
+ ],
193
+ "properties": {
194
+ "id": {
195
+ "type": "string"
196
+ },
197
+ "type": {
198
+ "title": "EffectType",
199
+ "anyOf": [
200
+ {
201
+ "const": "reverb",
202
+ "type": "string"
203
+ },
204
+ {
205
+ "const": "delay",
206
+ "type": "string"
207
+ },
208
+ {
209
+ "const": "distortion",
210
+ "type": "string"
211
+ },
212
+ {
213
+ "const": "filter",
214
+ "type": "string"
215
+ }
216
+ ]
217
+ },
218
+ "wet": {
219
+ "minimum": 0,
220
+ "maximum": 1,
221
+ "type": "number"
222
+ },
223
+ "options": {
224
+ "type": "object",
225
+ "patternProperties": {
226
+ "^(.*)$": {
227
+ "anyOf": [
228
+ {
229
+ "type": "number"
230
+ },
231
+ {
232
+ "type": "string"
233
+ },
234
+ {
235
+ "type": "boolean"
236
+ }
237
+ ]
238
+ }
239
+ }
240
+ }
241
+ }
242
+ }
243
+ }
244
+ }
245
+ }
246
+ },
247
+ "tracks": {
248
+ "type": "array",
249
+ "items": {
250
+ "title": "SongTrack",
251
+ "additionalProperties": false,
252
+ "type": "object",
253
+ "required": [
254
+ "id",
255
+ "name",
256
+ "kind"
257
+ ],
258
+ "properties": {
259
+ "id": {
260
+ "type": "string"
261
+ },
262
+ "name": {
263
+ "type": "string"
264
+ },
265
+ "kind": {
266
+ "anyOf": [
267
+ {
268
+ "const": "instrument",
269
+ "type": "string"
270
+ },
271
+ {
272
+ "const": "audio",
273
+ "type": "string"
274
+ }
275
+ ]
276
+ },
277
+ "instrumentId": {
278
+ "type": "string"
279
+ },
280
+ "color": {
281
+ "type": "string"
282
+ },
283
+ "volume": {
284
+ "type": "number"
285
+ },
286
+ "pan": {
287
+ "minimum": -1,
288
+ "maximum": 1,
289
+ "type": "number"
290
+ },
291
+ "mute": {
292
+ "type": "boolean"
293
+ },
294
+ "solo": {
295
+ "type": "boolean"
296
+ }
297
+ }
298
+ }
299
+ },
300
+ "clips": {
301
+ "type": "array",
302
+ "items": {
303
+ "title": "SongClip",
304
+ "anyOf": [
305
+ {
306
+ "title": "NoteClip",
307
+ "additionalProperties": false,
308
+ "type": "object",
309
+ "required": [
310
+ "kind",
311
+ "id",
312
+ "trackId",
313
+ "start",
314
+ "length",
315
+ "notes"
316
+ ],
317
+ "properties": {
318
+ "kind": {
319
+ "const": "notes",
320
+ "type": "string"
321
+ },
322
+ "id": {
323
+ "type": "string"
324
+ },
325
+ "trackId": {
326
+ "type": "string"
327
+ },
328
+ "name": {
329
+ "type": "string"
330
+ },
331
+ "start": {
332
+ "minimum": 0,
333
+ "type": "number"
334
+ },
335
+ "length": {
336
+ "exclusiveMinimum": 0,
337
+ "type": "number"
338
+ },
339
+ "notes": {
340
+ "type": "array",
341
+ "items": {
342
+ "title": "SongNote",
343
+ "additionalProperties": false,
344
+ "type": "object",
345
+ "required": [
346
+ "pitch",
347
+ "start",
348
+ "duration"
349
+ ],
350
+ "properties": {
351
+ "id": {
352
+ "type": "string"
353
+ },
354
+ "pitch": {
355
+ "minimum": 0,
356
+ "maximum": 127,
357
+ "type": "integer"
358
+ },
359
+ "start": {
360
+ "minimum": 0,
361
+ "type": "number"
362
+ },
363
+ "duration": {
364
+ "exclusiveMinimum": 0,
365
+ "type": "number"
366
+ },
367
+ "velocity": {
368
+ "minimum": 0,
369
+ "maximum": 1,
370
+ "type": "number"
371
+ }
372
+ }
373
+ }
374
+ }
375
+ }
376
+ },
377
+ {
378
+ "title": "AudioClip",
379
+ "additionalProperties": false,
380
+ "type": "object",
381
+ "required": [
382
+ "kind",
383
+ "id",
384
+ "trackId",
385
+ "url",
386
+ "start",
387
+ "length"
388
+ ],
389
+ "properties": {
390
+ "kind": {
391
+ "const": "audio",
392
+ "type": "string"
393
+ },
394
+ "id": {
395
+ "type": "string"
396
+ },
397
+ "trackId": {
398
+ "type": "string"
399
+ },
400
+ "name": {
401
+ "type": "string"
402
+ },
403
+ "url": {
404
+ "type": "string"
405
+ },
406
+ "start": {
407
+ "minimum": 0,
408
+ "type": "number"
409
+ },
410
+ "offset": {
411
+ "minimum": 0,
412
+ "type": "number"
413
+ },
414
+ "length": {
415
+ "exclusiveMinimum": 0,
416
+ "type": "number"
417
+ },
418
+ "gain": {
419
+ "type": "number"
420
+ }
421
+ }
422
+ }
423
+ ]
424
+ }
425
+ },
426
+ "masterVolume": {
427
+ "type": "number"
428
+ }
429
+ }
430
+ }
package/dist/schema.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export { f as EntityBlueprint, j as EntityJson, d as EntityJsonSchema, E as EntitySchema, i as LineEntityData, L as LineEntityDataSchema, h as SpriteEntityData, b as SpriteEntityDataSchema, S as StageBlueprint, k as StageJson, e as StageJsonSchema, c as StageSchema, g as TextEntityData, T as TextEntityDataSchema, V as Vector2Schema, a as Vector3TupleSchema } from './blueprints-TbGY-h53.js';
2
2
  import * as _sinclair_typebox from '@sinclair/typebox';
3
3
  import { Static } from '@sinclair/typebox';
4
+ export { g as SongDefinition, S as SongDefinitionSchema } from './song-definition-rEKksP0B.js';
5
+ export { g as CutsceneDefinition, C as CutsceneDefinitionSchema } from './cutscene-definition-C479fkei.js';
4
6
 
5
7
  /** Keyboard action → key-code list mapping. */
6
8
  declare const KeyboardMappingSchema: _sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TArray<_sinclair_typebox.TString>>;
package/dist/schema.js CHANGED
@@ -1 +1 @@
1
- import{A,B,C,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-JNFFTNMH.js";import"./chunk-WOT6VMZA.js";export{v as ColorJsonSchema,h as EntityJsonSchema,b as EntitySchema,C as GameConfigJsonSchema,B as GameDeviceConfigJsonSchema,u as GameInputConfigSchema,t as GameInputPlayerConfigSchema,j as KeyboardMappingSchema,f as LineEntityDataSchema,s as MouseConfigSchema,k as MouseMappingSchema,A as ResolutionInputSchema,g as SpriteEntityDataSchema,y as StageAssetLoaderConfigSchema,z as StageConfigJsonSchema,x as StageGLTFAssetLoaderConfigSchema,i as StageJsonSchema,c as StageSchema,d as TextEntityDataSchema,w as Vec3ComponentsSchema,a as Vector2Schema,e as Vector3TupleSchema,n as VirtualTouchButtonConfigSchema,p as VirtualTouchButtonsConfigSchema,r as VirtualTouchConfigSchema,o as VirtualTouchJoystickConfigSchema,q as VirtualTouchJoysticksConfigSchema,m as VirtualTouchPositionSchema,l as VirtualTouchStyleSchema};
1
+ import{A as C,B as D,C as E,a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n,m as o,n as p,o as q,p as r,q as s,r as t,s as u,t as v,u as w,v as x,w as y,x as z,y as A,z as B}from"./chunk-KSEP7AUF.js";import{k as a}from"./chunk-NVVLLWIM.js";import{k as b}from"./chunk-YNX3Q3CL.js";import"./chunk-WOT6VMZA.js";export{x as ColorJsonSchema,b as CutsceneDefinitionSchema,j as EntityJsonSchema,d as EntitySchema,E as GameConfigJsonSchema,D as GameDeviceConfigJsonSchema,w as GameInputConfigSchema,v as GameInputPlayerConfigSchema,l as KeyboardMappingSchema,h as LineEntityDataSchema,u as MouseConfigSchema,m as MouseMappingSchema,C as ResolutionInputSchema,a as SongDefinitionSchema,i as SpriteEntityDataSchema,A as StageAssetLoaderConfigSchema,B as StageConfigJsonSchema,z as StageGLTFAssetLoaderConfigSchema,k as StageJsonSchema,e as StageSchema,f as TextEntityDataSchema,y as Vec3ComponentsSchema,c as Vector2Schema,g as Vector3TupleSchema,p as VirtualTouchButtonConfigSchema,r as VirtualTouchButtonsConfigSchema,t as VirtualTouchConfigSchema,q as VirtualTouchJoystickConfigSchema,s as VirtualTouchJoysticksConfigSchema,o as VirtualTouchPositionSchema,n as VirtualTouchStyleSchema};
@@ -0,0 +1,50 @@
1
+ import { Box3, Object3D } from 'three';
2
+
3
+ /**
4
+ * The volume an entity presents to the editor's selection tools.
5
+ *
6
+ * Outlines, the hover cursor and the marquee hit test all need "the box
7
+ * around this entity", and a raw world AABB is a poor answer for anything
8
+ * flat: a plane has zero height, a sprite zero depth, a line is thin on two
9
+ * axes, and a zone or particle emitter has no renderable at all. This module
10
+ * gives every consumer one answer, in two layers:
11
+ *
12
+ * - a default that measures `group ?? mesh` and pads thin axes up to a
13
+ * minimum thickness proportional to the entity's size, plus a small margin
14
+ * so the outline sits just outside the surface;
15
+ * - an optional per-entity override, {@link SelectionBoundsProvider}, for
16
+ * entities whose selection view cannot be derived from their render object.
17
+ */
18
+
19
+ /** Uniform margin around the box, as a fraction of its largest extent. */
20
+ declare const SELECTION_BOUNDS_MARGIN = 0.02;
21
+ /** A thin axis is padded up to this fraction of the largest extent... */
22
+ declare const SELECTION_THIN_AXIS_FRACTION = 0.05;
23
+ /** ...clamped between these world-unit bounds. */
24
+ declare const SELECTION_THIN_AXIS_MIN = 0.1;
25
+ declare const SELECTION_THIN_AXIS_MAX = 1;
26
+ /**
27
+ * Implemented by entities that define their own selection view. `target`
28
+ * is a scratch box to write into; return it, or `null` when the entity
29
+ * currently has no selectable volume. World space.
30
+ */
31
+ interface SelectionBoundsProvider {
32
+ getSelectionBounds(target: Box3): Box3 | null;
33
+ }
34
+ /**
35
+ * Thicken any axis thinner than the minimum and add the uniform margin, in
36
+ * place. The minimum is proportional to the entity's largest extent so a
37
+ * 10-unit floor gets a visible slab while a coin-sized disk does not turn
38
+ * into a cube. Empty or non-finite boxes are returned untouched.
39
+ */
40
+ declare function padSelectionBounds(box: Box3): Box3;
41
+ /** The default selection view: the object's world AABB, padded. */
42
+ declare function measureObjectSelectionBounds(object: Object3D, target: Box3): Box3;
43
+ /**
44
+ * The selection bounds for an entity: its own {@link SelectionBoundsProvider}
45
+ * answer when it has one, otherwise the padded AABB of `group ?? mesh`.
46
+ * Returns `null` when there is nothing to select, so callers need one check.
47
+ */
48
+ declare function resolveSelectionBounds(entity: unknown, target: Box3): Box3 | null;
49
+
50
+ export { SELECTION_BOUNDS_MARGIN as S, SELECTION_THIN_AXIS_FRACTION as a, SELECTION_THIN_AXIS_MIN as b, SELECTION_THIN_AXIS_MAX as c, type SelectionBoundsProvider as d, measureObjectSelectionBounds as m, padSelectionBounds as p, resolveSelectionBounds as r };