lecodes-cli 0.1.5 → 0.1.7

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 (81) hide show
  1. package/dist/index.js +300 -149
  2. package/package.json +5 -3
  3. package/runtime/sdk/animate/animate.ts +238 -0
  4. package/runtime/sdk/animate/bezier.ts +138 -0
  5. package/runtime/sdk/animate/easings.ts +126 -0
  6. package/runtime/sdk/core/color.ts +66 -0
  7. package/runtime/sdk/core/events.ts +38 -0
  8. package/runtime/sdk/core/registry.ts +23 -0
  9. package/runtime/sdk/g2/Camera2D.ts +73 -0
  10. package/runtime/sdk/g2/Node2D.ts +104 -0
  11. package/runtime/sdk/g2/Scene2D.ts +73 -0
  12. package/runtime/sdk/g2/Sprite.ts +164 -0
  13. package/runtime/sdk/g2/Texture2D.ts +37 -0
  14. package/runtime/sdk/g2/Tilemap.ts +41 -0
  15. package/runtime/sdk/g2/loop.ts +22 -0
  16. package/runtime/sdk/gl/Body.ts +101 -0
  17. package/runtime/sdk/gl/Camera.ts +40 -0
  18. package/runtime/sdk/gl/Geometry.ts +218 -0
  19. package/runtime/sdk/gl/Light.ts +37 -0
  20. package/runtime/sdk/gl/Material.ts +124 -0
  21. package/runtime/sdk/gl/Mesh.ts +123 -0
  22. package/runtime/sdk/gl/Node.ts +307 -0
  23. package/runtime/sdk/gl/Noise.ts +30 -0
  24. package/runtime/sdk/gl/Particles.ts +185 -0
  25. package/runtime/sdk/gl/Plane.ts +53 -0
  26. package/runtime/sdk/gl/Ray.ts +16 -0
  27. package/runtime/sdk/gl/Scene.ts +179 -0
  28. package/runtime/sdk/gl/Texture.ts +35 -0
  29. package/runtime/sdk/gl/controls.ts +95 -0
  30. package/runtime/sdk/gl/state.ts +6 -0
  31. package/runtime/sdk/gl/touch.ts +56 -0
  32. package/runtime/sdk/inject.ts +72 -0
  33. package/runtime/sdk/math/Mathf.ts +118 -0
  34. package/runtime/sdk/math/mat4.ts +278 -0
  35. package/runtime/sdk/math/quat.ts +232 -0
  36. package/runtime/sdk/math/vec.ts +255 -0
  37. package/runtime/sdk/plugins/qr.ts +36 -0
  38. package/runtime/sdk/runtime/device.ts +33 -0
  39. package/runtime/sdk/runtime/fetch.ts +71 -0
  40. package/runtime/sdk/runtime/files.ts +23 -0
  41. package/runtime/sdk/runtime/input.ts +12 -0
  42. package/runtime/sdk/runtime/media.ts +111 -0
  43. package/runtime/sdk/runtime/misc.ts +12 -0
  44. package/runtime/sdk/runtime/net.ts +36 -0
  45. package/runtime/sdk/runtime/storage.ts +13 -0
  46. package/runtime/sdk/runtime/touch.ts +44 -0
  47. package/runtime/sdk/ui/UI.ts +19 -0
  48. package/runtime/sdk/ui/UIButton.ts +84 -0
  49. package/runtime/sdk/ui/UIContainer.ts +100 -0
  50. package/runtime/sdk/ui/UIImage.ts +68 -0
  51. package/runtime/sdk/ui/UIInput.ts +78 -0
  52. package/runtime/sdk/ui/UINode.ts +342 -0
  53. package/runtime/sdk/ui/UIScreen.ts +122 -0
  54. package/runtime/sdk/ui/UIScrollable.ts +70 -0
  55. package/runtime/sdk/ui/UISpacer.ts +14 -0
  56. package/runtime/sdk/ui/UIText.ts +40 -0
  57. package/runtime/sdk/ui/UIVideo.ts +38 -0
  58. package/runtime/sdk/ui/UIVirtualizedList.ts +222 -0
  59. package/runtime/sdk/ui/UIWidget.ts +97 -0
  60. package/runtime/sdk/ui/fonts.ts +10 -0
  61. package/runtime/sdk/ui/router.ts +73 -0
  62. package/runtime/gl-matrix/common.js +0 -54
  63. package/runtime/gl-matrix/header.js +0 -12
  64. package/runtime/gl-matrix/index.js +0 -11
  65. package/runtime/gl-matrix/mat2.js +0 -425
  66. package/runtime/gl-matrix/mat2d.js +0 -476
  67. package/runtime/gl-matrix/mat3.js +0 -765
  68. package/runtime/gl-matrix/mat4.js +0 -1947
  69. package/runtime/gl-matrix/quat.js +0 -737
  70. package/runtime/gl-matrix/quat2.js +0 -822
  71. package/runtime/gl-matrix/vec2.js +0 -620
  72. package/runtime/gl-matrix/vec3.js +0 -791
  73. package/runtime/gl-matrix/vec4.js +0 -652
  74. package/runtime/worker/animate.js +0 -304
  75. package/runtime/worker/chunk-4ZN32GYS.js +0 -34
  76. package/runtime/worker/chunk-G5ZA3LKB.js +0 -52
  77. package/runtime/worker/chunk-MI3UXE5H.js +0 -1395
  78. package/runtime/worker/creator.js +0 -930
  79. package/runtime/worker/globals.js +0 -208
  80. package/runtime/worker/ui.js +0 -763
  81. package/runtime/worker/utils.js +0 -16
@@ -1,476 +0,0 @@
1
- import * as glMatrix from "./common.js";
2
-
3
- /**
4
- * 2x3 Matrix
5
- * @module mat2d
6
- * @description
7
- * A mat2d contains six elements defined as:
8
- * <pre>
9
- * [a, b,
10
- * c, d,
11
- * tx, ty]
12
- * </pre>
13
- * This is a short form for the 3x3 matrix:
14
- * <pre>
15
- * [a, b, 0,
16
- * c, d, 0,
17
- * tx, ty, 1]
18
- * </pre>
19
- * The last column is ignored so the array is shorter and operations are faster.
20
- */
21
-
22
- /**
23
- * Creates a new identity mat2d
24
- *
25
- * @returns {mat2d} a new 2x3 matrix
26
- */
27
- export function create() {
28
- var out = new Float32Array(6);
29
- out[0] = 1;
30
- out[3] = 1;
31
- return out;
32
- }
33
-
34
- /**
35
- * Creates a new mat2d initialized with values from an existing matrix
36
- *
37
- * @param {ReadonlyMat2d} a matrix to clone
38
- * @returns {mat2d} a new 2x3 matrix
39
- */
40
- export function clone(a) {
41
- var out = new Float32Array(6);
42
- out[0] = a[0];
43
- out[1] = a[1];
44
- out[2] = a[2];
45
- out[3] = a[3];
46
- out[4] = a[4];
47
- out[5] = a[5];
48
- return out;
49
- }
50
-
51
- /**
52
- * Copy the values from one mat2d to another
53
- *
54
- * @param {mat2d} out the receiving matrix
55
- * @param {ReadonlyMat2d} a the source matrix
56
- * @returns {mat2d} out
57
- */
58
- export function copy(out, a) {
59
- out[0] = a[0];
60
- out[1] = a[1];
61
- out[2] = a[2];
62
- out[3] = a[3];
63
- out[4] = a[4];
64
- out[5] = a[5];
65
- return out;
66
- }
67
-
68
- /**
69
- * Set a mat2d to the identity matrix
70
- *
71
- * @param {mat2d} out the receiving matrix
72
- * @returns {mat2d} out
73
- */
74
- export function identity(out) {
75
- out[0] = 1;
76
- out[1] = 0;
77
- out[2] = 0;
78
- out[3] = 1;
79
- out[4] = 0;
80
- out[5] = 0;
81
- return out;
82
- }
83
-
84
- /**
85
- * Create a new mat2d with the given values
86
- *
87
- * @param {Number} a Component A (index 0)
88
- * @param {Number} b Component B (index 1)
89
- * @param {Number} c Component C (index 2)
90
- * @param {Number} d Component D (index 3)
91
- * @param {Number} tx Component TX (index 4)
92
- * @param {Number} ty Component TY (index 5)
93
- * @returns {mat2d} A new mat2d
94
- */
95
- export function fromValues(a, b, c, d, tx, ty) {
96
- var out = new Float32Array(6);
97
- out[0] = a;
98
- out[1] = b;
99
- out[2] = c;
100
- out[3] = d;
101
- out[4] = tx;
102
- out[5] = ty;
103
- return out;
104
- }
105
-
106
- /**
107
- * Set the components of a mat2d to the given values
108
- *
109
- * @param {mat2d} out the receiving matrix
110
- * @param {Number} a Component A (index 0)
111
- * @param {Number} b Component B (index 1)
112
- * @param {Number} c Component C (index 2)
113
- * @param {Number} d Component D (index 3)
114
- * @param {Number} tx Component TX (index 4)
115
- * @param {Number} ty Component TY (index 5)
116
- * @returns {mat2d} out
117
- */
118
- export function set(out, a, b, c, d, tx, ty) {
119
- out[0] = a;
120
- out[1] = b;
121
- out[2] = c;
122
- out[3] = d;
123
- out[4] = tx;
124
- out[5] = ty;
125
- return out;
126
- }
127
-
128
- /**
129
- * Inverts a mat2d
130
- *
131
- * @param {mat2d} out the receiving matrix
132
- * @param {ReadonlyMat2d} a the source matrix
133
- * @returns {mat2d | null} out, or null if source matrix is not invertible
134
- */
135
- export function invert(out, a) {
136
- var aa = a[0],
137
- ab = a[1],
138
- ac = a[2],
139
- ad = a[3];
140
- var atx = a[4],
141
- aty = a[5];
142
- var det = aa * ad - ab * ac;
143
- if (!det) {
144
- return null;
145
- }
146
- det = 1.0 / det;
147
- out[0] = ad * det;
148
- out[1] = -ab * det;
149
- out[2] = -ac * det;
150
- out[3] = aa * det;
151
- out[4] = (ac * aty - ad * atx) * det;
152
- out[5] = (ab * atx - aa * aty) * det;
153
- return out;
154
- }
155
-
156
- /**
157
- * Calculates the determinant of a mat2d
158
- *
159
- * @param {ReadonlyMat2d} a the source matrix
160
- * @returns {Number} determinant of a
161
- */
162
- export function determinant(a) {
163
- return a[0] * a[3] - a[1] * a[2];
164
- }
165
-
166
- /**
167
- * Multiplies two mat2d's
168
- *
169
- * @param {mat2d} out the receiving matrix
170
- * @param {ReadonlyMat2d} a the first operand
171
- * @param {ReadonlyMat2d} b the second operand
172
- * @returns {mat2d} out
173
- */
174
- export function multiply(out, a, b) {
175
- var a0 = a[0],
176
- a1 = a[1],
177
- a2 = a[2],
178
- a3 = a[3],
179
- a4 = a[4],
180
- a5 = a[5];
181
- var b0 = b[0],
182
- b1 = b[1],
183
- b2 = b[2],
184
- b3 = b[3],
185
- b4 = b[4],
186
- b5 = b[5];
187
- out[0] = a0 * b0 + a2 * b1;
188
- out[1] = a1 * b0 + a3 * b1;
189
- out[2] = a0 * b2 + a2 * b3;
190
- out[3] = a1 * b2 + a3 * b3;
191
- out[4] = a0 * b4 + a2 * b5 + a4;
192
- out[5] = a1 * b4 + a3 * b5 + a5;
193
- return out;
194
- }
195
-
196
- /**
197
- * Rotates a mat2d by the given angle
198
- *
199
- * @param {mat2d} out the receiving matrix
200
- * @param {ReadonlyMat2d} a the matrix to rotate
201
- * @param {Number} rad the angle to rotate the matrix by
202
- * @returns {mat2d} out
203
- */
204
- export function rotate(out, a, rad) {
205
- var a0 = a[0],
206
- a1 = a[1],
207
- a2 = a[2],
208
- a3 = a[3],
209
- a4 = a[4],
210
- a5 = a[5];
211
- var s = Math.sin(rad);
212
- var c = Math.cos(rad);
213
- out[0] = a0 * c + a2 * s;
214
- out[1] = a1 * c + a3 * s;
215
- out[2] = a0 * -s + a2 * c;
216
- out[3] = a1 * -s + a3 * c;
217
- out[4] = a4;
218
- out[5] = a5;
219
- return out;
220
- }
221
-
222
- /**
223
- * Scales the mat2d by the dimensions in the given vec2
224
- *
225
- * @param {mat2d} out the receiving matrix
226
- * @param {ReadonlyMat2d} a the matrix to translate
227
- * @param {ReadonlyVec2} v the vec2 to scale the matrix by
228
- * @returns {mat2d} out
229
- **/
230
- export function scale(out, a, v) {
231
- var a0 = a[0],
232
- a1 = a[1],
233
- a2 = a[2],
234
- a3 = a[3],
235
- a4 = a[4],
236
- a5 = a[5];
237
- var v0 = v[0],
238
- v1 = v[1];
239
- out[0] = a0 * v0;
240
- out[1] = a1 * v0;
241
- out[2] = a2 * v1;
242
- out[3] = a3 * v1;
243
- out[4] = a4;
244
- out[5] = a5;
245
- return out;
246
- }
247
-
248
- /**
249
- * Translates the mat2d by the dimensions in the given vec2
250
- *
251
- * @param {mat2d} out the receiving matrix
252
- * @param {ReadonlyMat2d} a the matrix to translate
253
- * @param {ReadonlyVec2} v the vec2 to translate the matrix by
254
- * @returns {mat2d} out
255
- **/
256
- export function translate(out, a, v) {
257
- var a0 = a[0],
258
- a1 = a[1],
259
- a2 = a[2],
260
- a3 = a[3],
261
- a4 = a[4],
262
- a5 = a[5];
263
- var v0 = v[0],
264
- v1 = v[1];
265
- out[0] = a0;
266
- out[1] = a1;
267
- out[2] = a2;
268
- out[3] = a3;
269
- out[4] = a0 * v0 + a2 * v1 + a4;
270
- out[5] = a1 * v0 + a3 * v1 + a5;
271
- return out;
272
- }
273
-
274
- /**
275
- * Creates a matrix from a given angle
276
- * This is equivalent to (but much faster than):
277
- *
278
- * mat2d.identity(dest);
279
- * mat2d.rotate(dest, dest, rad);
280
- *
281
- * @param {mat2d} out mat2d receiving operation result
282
- * @param {Number} rad the angle to rotate the matrix by
283
- * @returns {mat2d} out
284
- */
285
- export function fromRotation(out, rad) {
286
- var s = Math.sin(rad),
287
- c = Math.cos(rad);
288
- out[0] = c;
289
- out[1] = s;
290
- out[2] = -s;
291
- out[3] = c;
292
- out[4] = 0;
293
- out[5] = 0;
294
- return out;
295
- }
296
-
297
- /**
298
- * Creates a matrix from a vector scaling
299
- * This is equivalent to (but much faster than):
300
- *
301
- * mat2d.identity(dest);
302
- * mat2d.scale(dest, dest, vec);
303
- *
304
- * @param {mat2d} out mat2d receiving operation result
305
- * @param {ReadonlyVec2} v Scaling vector
306
- * @returns {mat2d} out
307
- */
308
- export function fromScaling(out, v) {
309
- out[0] = v[0];
310
- out[1] = 0;
311
- out[2] = 0;
312
- out[3] = v[1];
313
- out[4] = 0;
314
- out[5] = 0;
315
- return out;
316
- }
317
-
318
- /**
319
- * Creates a matrix from a vector translation
320
- * This is equivalent to (but much faster than):
321
- *
322
- * mat2d.identity(dest);
323
- * mat2d.translate(dest, dest, vec);
324
- *
325
- * @param {mat2d} out mat2d receiving operation result
326
- * @param {ReadonlyVec2} v Translation vector
327
- * @returns {mat2d} out
328
- */
329
- export function fromTranslation(out, v) {
330
- out[0] = 1;
331
- out[1] = 0;
332
- out[2] = 0;
333
- out[3] = 1;
334
- out[4] = v[0];
335
- out[5] = v[1];
336
- return out;
337
- }
338
-
339
- /**
340
- * Returns a string representation of a mat2d
341
- *
342
- * @param {ReadonlyMat2d} a matrix to represent as a string
343
- * @returns {String} string representation of the matrix
344
- */
345
- export function str(a) {
346
- return "mat2d(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ")";
347
- }
348
-
349
- /**
350
- * Returns Frobenius norm of a mat2d
351
- *
352
- * @param {ReadonlyMat2d} a the matrix to calculate Frobenius norm of
353
- * @returns {Number} Frobenius norm
354
- */
355
- export function frob(a) {
356
- return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);
357
- }
358
-
359
- /**
360
- * Adds two mat2d's
361
- *
362
- * @param {mat2d} out the receiving matrix
363
- * @param {ReadonlyMat2d} a the first operand
364
- * @param {ReadonlyMat2d} b the second operand
365
- * @returns {mat2d} out
366
- */
367
- export function add(out, a, b) {
368
- out[0] = a[0] + b[0];
369
- out[1] = a[1] + b[1];
370
- out[2] = a[2] + b[2];
371
- out[3] = a[3] + b[3];
372
- out[4] = a[4] + b[4];
373
- out[5] = a[5] + b[5];
374
- return out;
375
- }
376
-
377
- /**
378
- * Subtracts matrix b from matrix a
379
- *
380
- * @param {mat2d} out the receiving matrix
381
- * @param {ReadonlyMat2d} a the first operand
382
- * @param {ReadonlyMat2d} b the second operand
383
- * @returns {mat2d} out
384
- */
385
- export function subtract(out, a, b) {
386
- out[0] = a[0] - b[0];
387
- out[1] = a[1] - b[1];
388
- out[2] = a[2] - b[2];
389
- out[3] = a[3] - b[3];
390
- out[4] = a[4] - b[4];
391
- out[5] = a[5] - b[5];
392
- return out;
393
- }
394
-
395
- /**
396
- * Multiply each element of the matrix by a scalar.
397
- *
398
- * @param {mat2d} out the receiving matrix
399
- * @param {ReadonlyMat2d} a the matrix to scale
400
- * @param {Number} b amount to scale the matrix's elements by
401
- * @returns {mat2d} out
402
- */
403
- export function multiplyScalar(out, a, b) {
404
- out[0] = a[0] * b;
405
- out[1] = a[1] * b;
406
- out[2] = a[2] * b;
407
- out[3] = a[3] * b;
408
- out[4] = a[4] * b;
409
- out[5] = a[5] * b;
410
- return out;
411
- }
412
-
413
- /**
414
- * Adds two mat2d's after multiplying each element of the second operand by a scalar value.
415
- *
416
- * @param {mat2d} out the receiving vector
417
- * @param {ReadonlyMat2d} a the first operand
418
- * @param {ReadonlyMat2d} b the second operand
419
- * @param {Number} scale the amount to scale b's elements by before adding
420
- * @returns {mat2d} out
421
- */
422
- export function multiplyScalarAndAdd(out, a, b, scale) {
423
- out[0] = a[0] + b[0] * scale;
424
- out[1] = a[1] + b[1] * scale;
425
- out[2] = a[2] + b[2] * scale;
426
- out[3] = a[3] + b[3] * scale;
427
- out[4] = a[4] + b[4] * scale;
428
- out[5] = a[5] + b[5] * scale;
429
- return out;
430
- }
431
-
432
- /**
433
- * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
434
- *
435
- * @param {ReadonlyMat2d} a The first matrix.
436
- * @param {ReadonlyMat2d} b The second matrix.
437
- * @returns {Boolean} True if the matrices are equal, false otherwise.
438
- */
439
- export function exactEquals(a, b) {
440
- return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5];
441
- }
442
-
443
- /**
444
- * Returns whether or not the matrices have approximately the same elements in the same position.
445
- *
446
- * @param {ReadonlyMat2d} a The first matrix.
447
- * @param {ReadonlyMat2d} b The second matrix.
448
- * @returns {Boolean} True if the matrices are equal, false otherwise.
449
- */
450
- export function equals(a, b) {
451
- var a0 = a[0],
452
- a1 = a[1],
453
- a2 = a[2],
454
- a3 = a[3],
455
- a4 = a[4],
456
- a5 = a[5];
457
- var b0 = b[0],
458
- b1 = b[1],
459
- b2 = b[2],
460
- b3 = b[3],
461
- b4 = b[4],
462
- b5 = b[5];
463
- return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5));
464
- }
465
-
466
- /**
467
- * Alias for {@link mat2d.multiply}
468
- * @function
469
- */
470
- export var mul = multiply;
471
-
472
- /**
473
- * Alias for {@link mat2d.subtract}
474
- * @function
475
- */
476
- export var sub = subtract;