@ludic-labs/assembly 0.0.0-stage → 0.4.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 (78) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/LICENSE +2 -0
  3. package/README.md +50 -2
  4. package/dist/bake.d.ts +80 -0
  5. package/dist/bake.js +214 -0
  6. package/dist/browser.d.ts +89 -0
  7. package/dist/browser.js +534 -0
  8. package/dist/compat.d.ts +17 -0
  9. package/dist/compat.js +153 -0
  10. package/dist/compiler.d.ts +18 -0
  11. package/dist/compiler.js +1264 -0
  12. package/dist/diagnostics.d.ts +5 -0
  13. package/dist/diagnostics.js +8 -0
  14. package/dist/export.d.ts +54 -0
  15. package/dist/export.js +272 -0
  16. package/dist/index.d.ts +4 -0
  17. package/dist/index.js +3 -0
  18. package/dist/legacy.d.ts +36 -0
  19. package/dist/legacy.js +180 -0
  20. package/dist/math.d.ts +16 -0
  21. package/dist/math.js +62 -0
  22. package/dist/mesh.d.ts +11 -0
  23. package/dist/mesh.js +153 -0
  24. package/dist/motion.d.ts +63 -0
  25. package/dist/motion.js +1476 -0
  26. package/dist/pixel.d.ts +268 -0
  27. package/dist/pixel.js +942 -0
  28. package/dist/required.d.ts +2 -0
  29. package/dist/required.js +6 -0
  30. package/dist/shapes.d.ts +71 -0
  31. package/dist/shapes.js +396 -0
  32. package/dist/sprite-brief.d.ts +5 -0
  33. package/dist/sprite-brief.js +47 -0
  34. package/dist/sprite-compiler.d.ts +62 -0
  35. package/dist/sprite-compiler.js +1745 -0
  36. package/dist/sprite-decompile.d.ts +68 -0
  37. package/dist/sprite-decompile.js +786 -0
  38. package/dist/sprite-format.d.ts +4 -0
  39. package/dist/sprite-format.js +155 -0
  40. package/dist/sprite-guide.d.ts +40 -0
  41. package/dist/sprite-guide.js +330 -0
  42. package/dist/sprite-scene.d.ts +277 -0
  43. package/dist/sprite-scene.js +664 -0
  44. package/dist/sprite-types.d.ts +110 -0
  45. package/dist/sprite-types.js +1 -0
  46. package/dist/sprite.d.ts +8 -0
  47. package/dist/sprite.js +8 -0
  48. package/dist/svg/schema.d.ts +71 -0
  49. package/dist/svg/schema.js +217 -0
  50. package/dist/svg/types.d.ts +148 -0
  51. package/dist/svg/types.js +1 -0
  52. package/dist/svg.d.ts +26 -0
  53. package/dist/svg.js +539 -0
  54. package/dist/text.d.ts +12 -0
  55. package/dist/text.js +75 -0
  56. package/dist/types.d.ts +478 -0
  57. package/dist/types.js +1 -0
  58. package/docs/svg/README.md +150 -0
  59. package/docs/svg/specification.md +108 -0
  60. package/examples/svg/arcane-shield.json +261 -0
  61. package/examples/svg/aurora-ribbon.json +158 -0
  62. package/examples/svg/bouncing-ember.json +76 -0
  63. package/examples/svg/ember-fountain.json +224 -0
  64. package/examples/svg/lantern-keeper.json +1159 -0
  65. package/examples/svg/night-workshop.json +1120 -0
  66. package/examples/svg/waygate-platform.json +64 -0
  67. package/examples/svg/waygate-spark.json +92 -0
  68. package/examples/svg/waygate-wisp.json +105 -0
  69. package/examples/svg/waygate.json +485 -0
  70. package/package.json +132 -4
  71. package/schemas/asset-assembly-0.1.schema.json +354 -0
  72. package/schemas/asset-assembly-0.2.schema.json +429 -0
  73. package/schemas/asset-assembly-0.3.schema.json +572 -0
  74. package/schemas/motion-set-0.1.schema.json +178 -0
  75. package/schemas/pixel-sprite-0.1.schema.json +892 -0
  76. package/schemas/pixel-sprite-scene-0.1.schema.json +149 -0
  77. package/schemas/svg-asset-0.1.schema.json +1157 -0
  78. package/tools/svg-asset.mjs +106 -0
@@ -0,0 +1,429 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://libraries.ludic-assembly.victorqueiroz.dev/schema-0.2.json",
4
+ "title": "Ludic Assembly 0.2",
5
+ "description": "Structural schema for characters: joints, mirrored sides, slots, identities, states and limbs. Use validateAsset for references, sides, joint graphs, bounds and geometry.",
6
+ "type": "object",
7
+ "properties": {
8
+ "schema": { "const": "asset-assembly/0.2" },
9
+ "units": { "enum": ["meters", "tiles"] },
10
+ "parameters": {
11
+ "type": "object",
12
+ "minProperties": 0,
13
+ "maxProperties": 256,
14
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
15
+ "additionalProperties": { "type": "number" }
16
+ },
17
+ "materials": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "maxProperties": 256,
21
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
22
+ "additionalProperties": {
23
+ "type": "object",
24
+ "properties": {
25
+ "color": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
26
+ "tintable": { "type": "boolean" }
27
+ },
28
+ "required": ["color"],
29
+ "additionalProperties": false
30
+ }
31
+ },
32
+ "groups": {
33
+ "type": "object",
34
+ "minProperties": 0,
35
+ "maxProperties": 256,
36
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
37
+ "additionalProperties": {
38
+ "type": "object",
39
+ "properties": {
40
+ "parent": { "type": "string" },
41
+ "position": { "$ref": "#/$defs/point" }
42
+ },
43
+ "required": ["position"],
44
+ "additionalProperties": false
45
+ }
46
+ },
47
+ "parts": {
48
+ "type": "object",
49
+ "minProperties": 1,
50
+ "maxProperties": 256,
51
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
52
+ "additionalProperties": {
53
+ "type": "object",
54
+ "properties": {
55
+ "shape": {
56
+ "oneOf": [
57
+ {
58
+ "type": "object",
59
+ "properties": {
60
+ "type": { "const": "box" },
61
+ "size": {
62
+ "type": "object",
63
+ "properties": {
64
+ "width": { "$ref": "#/$defs/scalar" },
65
+ "height": { "$ref": "#/$defs/scalar" },
66
+ "depth": { "$ref": "#/$defs/scalar" }
67
+ },
68
+ "required": ["width", "height", "depth"],
69
+ "additionalProperties": false
70
+ },
71
+ "bevel": { "$ref": "#/$defs/scalar" }
72
+ },
73
+ "required": ["type", "size"],
74
+ "additionalProperties": false
75
+ },
76
+ {
77
+ "type": "object",
78
+ "properties": {
79
+ "type": { "const": "cylinder" },
80
+ "radius": { "$ref": "#/$defs/scalar" },
81
+ "height": { "$ref": "#/$defs/scalar" }
82
+ },
83
+ "required": ["type", "radius", "height"],
84
+ "additionalProperties": false
85
+ },
86
+ {
87
+ "type": "object",
88
+ "properties": {
89
+ "type": { "const": "funnel" },
90
+ "bottomRadius": { "$ref": "#/$defs/scalar" },
91
+ "topRadius": { "$ref": "#/$defs/scalar" },
92
+ "height": { "$ref": "#/$defs/scalar" }
93
+ },
94
+ "required": ["type", "bottomRadius", "topRadius", "height"],
95
+ "additionalProperties": false
96
+ },
97
+ {
98
+ "type": "object",
99
+ "properties": {
100
+ "type": { "const": "beam" },
101
+ "from": { "$ref": "#/$defs/point" },
102
+ "to": { "$ref": "#/$defs/point" },
103
+ "width": { "$ref": "#/$defs/scalar" }
104
+ },
105
+ "required": ["type", "from", "to", "width"],
106
+ "additionalProperties": false
107
+ },
108
+ {
109
+ "type": "object",
110
+ "properties": {
111
+ "type": { "const": "tube" },
112
+ "from": { "$ref": "#/$defs/point" },
113
+ "to": { "$ref": "#/$defs/point" },
114
+ "radius": { "$ref": "#/$defs/scalar" }
115
+ },
116
+ "required": ["type", "from", "to", "radius"],
117
+ "additionalProperties": false
118
+ },
119
+ {
120
+ "type": "object",
121
+ "properties": {
122
+ "type": { "const": "coil" },
123
+ "radius": { "$ref": "#/$defs/scalar" },
124
+ "thickness": { "$ref": "#/$defs/scalar" }
125
+ },
126
+ "required": ["type", "radius", "thickness"],
127
+ "additionalProperties": false
128
+ }
129
+ ]
130
+ },
131
+ "material": { "type": "string" },
132
+ "placement": {
133
+ "oneOf": [
134
+ {
135
+ "type": "object",
136
+ "properties": {
137
+ "type": { "const": "absolute" },
138
+ "selfAnchor": { "type": "string" },
139
+ "position": { "$ref": "#/$defs/point" }
140
+ },
141
+ "required": ["type", "selfAnchor", "position"],
142
+ "additionalProperties": false
143
+ },
144
+ {
145
+ "type": "object",
146
+ "properties": {
147
+ "type": { "const": "attach" },
148
+ "selfAnchor": { "type": "string" },
149
+ "target": {
150
+ "type": "object",
151
+ "properties": {
152
+ "part": { "type": "string" },
153
+ "anchor": { "type": "string" }
154
+ },
155
+ "required": ["part", "anchor"],
156
+ "additionalProperties": false
157
+ },
158
+ "offset": { "$ref": "#/$defs/point" }
159
+ },
160
+ "required": ["type", "selfAnchor", "target"],
161
+ "additionalProperties": false
162
+ },
163
+ {
164
+ "type": "object",
165
+ "properties": {
166
+ "type": { "const": "repeat" },
167
+ "pattern": { "const": "corners" },
168
+ "selfAnchor": { "type": "string" },
169
+ "target": {
170
+ "type": "object",
171
+ "properties": {
172
+ "part": { "type": "string" },
173
+ "face": { "enum": ["top", "bottom"] }
174
+ },
175
+ "required": ["part", "face"],
176
+ "additionalProperties": false
177
+ },
178
+ "edgeInset": {
179
+ "type": "object",
180
+ "properties": {
181
+ "x": { "$ref": "#/$defs/scalar" },
182
+ "z": { "$ref": "#/$defs/scalar" }
183
+ },
184
+ "required": ["x", "z"],
185
+ "additionalProperties": false
186
+ }
187
+ },
188
+ "required": ["type", "pattern", "selfAnchor", "target", "edgeInset"],
189
+ "additionalProperties": false
190
+ }
191
+ ]
192
+ },
193
+ "parent": { "type": "string" },
194
+ "anchors": {
195
+ "type": "object",
196
+ "minProperties": 0,
197
+ "maxProperties": 256,
198
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
199
+ "additionalProperties": { "$ref": "#/$defs/point" }
200
+ },
201
+ "joint": { "type": "string" },
202
+ "sides": { "const": "both" },
203
+ "slot": { "type": "string" },
204
+ "option": { "type": "string" },
205
+ "when": {
206
+ "type": "object",
207
+ "minProperties": 0,
208
+ "maxProperties": 256,
209
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
210
+ "additionalProperties": {
211
+ "type": "array",
212
+ "minItems": 1,
213
+ "uniqueItems": true,
214
+ "items": {
215
+ "type": "string",
216
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$"
217
+ }
218
+ }
219
+ }
220
+ },
221
+ "required": ["shape", "material", "placement"],
222
+ "additionalProperties": false,
223
+ "dependentRequired": { "slot": ["option"], "option": ["slot"] }
224
+ }
225
+ },
226
+ "groundPivot": { "$ref": "#/$defs/point" },
227
+ "joints": {
228
+ "type": "object",
229
+ "minProperties": 0,
230
+ "maxProperties": 256,
231
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
232
+ "additionalProperties": {
233
+ "type": "object",
234
+ "properties": {
235
+ "parent": { "type": "string" },
236
+ "sides": { "const": "both" },
237
+ "face": { "type": "boolean" },
238
+ "pivot": {
239
+ "oneOf": [
240
+ {
241
+ "type": "object",
242
+ "properties": {
243
+ "part": { "type": "string" },
244
+ "anchor": { "type": "string" }
245
+ },
246
+ "required": ["part", "anchor"],
247
+ "additionalProperties": false
248
+ },
249
+ {
250
+ "type": "object",
251
+ "properties": { "position": { "$ref": "#/$defs/point" } },
252
+ "required": ["position"],
253
+ "additionalProperties": false
254
+ }
255
+ ]
256
+ },
257
+ "dofs": {
258
+ "type": "array",
259
+ "minItems": 1,
260
+ "maxItems": 3,
261
+ "items": { "$ref": "#/$defs/dof" }
262
+ }
263
+ },
264
+ "required": ["pivot", "dofs"],
265
+ "additionalProperties": false
266
+ }
267
+ },
268
+ "limbs": {
269
+ "type": "object",
270
+ "minProperties": 0,
271
+ "maxProperties": 256,
272
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
273
+ "additionalProperties": {
274
+ "type": "object",
275
+ "properties": {
276
+ "sides": { "const": "both" },
277
+ "effector": {
278
+ "type": "object",
279
+ "properties": {
280
+ "part": { "type": "string" },
281
+ "anchor": { "type": "string" }
282
+ },
283
+ "required": ["part", "anchor"],
284
+ "additionalProperties": false
285
+ },
286
+ "reach": {
287
+ "type": "array",
288
+ "minItems": 1,
289
+ "maxItems": 3,
290
+ "items": { "$ref": "#/$defs/dofRef" }
291
+ },
292
+ "level": { "$ref": "#/$defs/dofRef" }
293
+ },
294
+ "required": ["effector", "reach"],
295
+ "additionalProperties": false
296
+ }
297
+ },
298
+ "states": {
299
+ "type": "object",
300
+ "minProperties": 0,
301
+ "maxProperties": 256,
302
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
303
+ "additionalProperties": {
304
+ "type": "array",
305
+ "minItems": 2,
306
+ "maxItems": 16,
307
+ "uniqueItems": true,
308
+ "items": {
309
+ "type": "string",
310
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$"
311
+ }
312
+ }
313
+ },
314
+ "slots": {
315
+ "type": "object",
316
+ "minProperties": 0,
317
+ "maxProperties": 256,
318
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
319
+ "additionalProperties": {
320
+ "type": "array",
321
+ "minItems": 1,
322
+ "maxItems": 32,
323
+ "uniqueItems": true,
324
+ "items": {
325
+ "type": "string",
326
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$"
327
+ }
328
+ }
329
+ },
330
+ "identities": {
331
+ "type": "object",
332
+ "minProperties": 0,
333
+ "maxProperties": 256,
334
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
335
+ "additionalProperties": {
336
+ "type": "object",
337
+ "properties": {
338
+ "parameters": {
339
+ "type": "object",
340
+ "minProperties": 0,
341
+ "maxProperties": 256,
342
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
343
+ "additionalProperties": { "type": "number" }
344
+ },
345
+ "materials": {
346
+ "type": "object",
347
+ "minProperties": 0,
348
+ "maxProperties": 256,
349
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
350
+ "additionalProperties": {
351
+ "type": "object",
352
+ "properties": {
353
+ "color": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" }
354
+ },
355
+ "required": ["color"],
356
+ "additionalProperties": false
357
+ }
358
+ },
359
+ "slots": {
360
+ "type": "object",
361
+ "minProperties": 0,
362
+ "maxProperties": 256,
363
+ "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$" },
364
+ "additionalProperties": {
365
+ "type": "string",
366
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$"
367
+ }
368
+ }
369
+ },
370
+ "additionalProperties": false
371
+ }
372
+ }
373
+ },
374
+ "required": ["schema", "units", "materials", "parts"],
375
+ "additionalProperties": false,
376
+ "$defs": {
377
+ "scalar": {
378
+ "oneOf": [
379
+ { "type": "number" },
380
+ {
381
+ "type": "object",
382
+ "properties": { "parameter": { "type": "string" } },
383
+ "required": ["parameter"],
384
+ "additionalProperties": false
385
+ }
386
+ ]
387
+ },
388
+ "point": {
389
+ "type": "object",
390
+ "properties": {
391
+ "x": { "$ref": "#/$defs/scalar" },
392
+ "y": { "$ref": "#/$defs/scalar" },
393
+ "z": { "$ref": "#/$defs/scalar" }
394
+ },
395
+ "required": ["x", "y", "z"],
396
+ "additionalProperties": false
397
+ },
398
+ "dofRef": {
399
+ "type": "object",
400
+ "properties": {
401
+ "joint": { "type": "string" },
402
+ "dof": { "type": "string" }
403
+ },
404
+ "required": ["joint", "dof"],
405
+ "additionalProperties": false
406
+ },
407
+ "dof": {
408
+ "type": "object",
409
+ "properties": {
410
+ "name": {
411
+ "type": "string",
412
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$"
413
+ },
414
+ "axis": { "enum": ["+x", "-x", "+y", "-y", "+z", "-z"] },
415
+ "limits": {
416
+ "type": "array",
417
+ "prefixItems": [
418
+ { "type": "number", "minimum": -360, "maximum": 0 },
419
+ { "type": "number", "minimum": 0, "maximum": 360 }
420
+ ],
421
+ "minItems": 2,
422
+ "maxItems": 2
423
+ }
424
+ },
425
+ "required": ["name", "axis", "limits"],
426
+ "additionalProperties": false
427
+ }
428
+ }
429
+ }