@oscharko-dev/keiko 0.2.0-beta.0 → 0.2.0-beta.2

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 (102) hide show
  1. package/README.md +6 -5
  2. package/dist/ui/csp-hashes.json +20 -20
  3. package/dist/ui/static/404.html +1 -1
  4. package/dist/ui/static/_next/static/chunks/{422-70c16ea4b1f77f2e.js → 923-4141696576191bc0.js} +1 -1
  5. package/dist/ui/static/_next/static/chunks/app/_not-found/page-03d642dcd0f15b52.js +1 -0
  6. package/dist/ui/static/_next/static/chunks/app/launch/page-c725ff0c02b50663.js +1 -0
  7. package/dist/ui/static/_next/static/chunks/app/layout-aadefe615729db05.js +1 -0
  8. package/dist/ui/static/_next/static/chunks/app/local-knowledge/capsule/{page-0dc74e194a1f0092.js → page-4a7f242906e19a07.js} +1 -1
  9. package/dist/ui/static/_next/static/chunks/app/local-knowledge/page-3361769b8964e659.js +1 -0
  10. package/dist/ui/static/_next/static/chunks/app/memoriaviva/consolidation/{page-dc6c6bd180bc47a3.js → page-44b3f4fa3e10085f.js} +1 -1
  11. package/dist/ui/static/_next/static/chunks/app/memoriaviva/detail/{page-659e308e68ab2b1e.js → page-0cdfb3eeb659daeb.js} +1 -1
  12. package/dist/ui/static/_next/static/chunks/app/memoriaviva/{page-d6ba78f54207b69f.js → page-e78e0cd2876fec41.js} +1 -1
  13. package/dist/ui/static/_next/static/chunks/app/memoriaviva/review-queue/page-e32fe86466827484.js +1 -0
  14. package/dist/ui/static/_next/static/chunks/app/page-9ad91065d05ddfa0.js +1 -0
  15. package/dist/ui/static/_next/static/chunks/{main-app-5b043f6c611974ae.js → main-app-b52a8fa1d8127a5f.js} +1 -1
  16. package/dist/ui/static/apple-touch-icon.png +0 -0
  17. package/dist/ui/static/favicon.ico +0 -0
  18. package/dist/ui/static/icon-192-maskable.png +0 -0
  19. package/dist/ui/static/icon-192.png +0 -0
  20. package/dist/ui/static/icon-512-maskable.png +0 -0
  21. package/dist/ui/static/icon-512.png +0 -0
  22. package/dist/ui/static/index.html +1 -1
  23. package/dist/ui/static/index.txt +3 -3
  24. package/dist/ui/static/launch.html +1 -1
  25. package/dist/ui/static/launch.txt +3 -3
  26. package/dist/ui/static/local-knowledge/capsule.html +1 -1
  27. package/dist/ui/static/local-knowledge/capsule.txt +2 -2
  28. package/dist/ui/static/local-knowledge.html +1 -1
  29. package/dist/ui/static/local-knowledge.txt +2 -2
  30. package/dist/ui/static/memoriaviva/consolidation.html +1 -1
  31. package/dist/ui/static/memoriaviva/consolidation.txt +2 -2
  32. package/dist/ui/static/memoriaviva/detail.html +1 -1
  33. package/dist/ui/static/memoriaviva/detail.txt +2 -2
  34. package/dist/ui/static/memoriaviva/review-queue.html +1 -1
  35. package/dist/ui/static/memoriaviva/review-queue.txt +2 -2
  36. package/dist/ui/static/memoriaviva.html +1 -1
  37. package/dist/ui/static/memoriaviva.txt +2 -2
  38. package/node_modules/@oscharko-dev/keiko-cli/dist/.tsbuildinfo +1 -1
  39. package/node_modules/@oscharko-dev/keiko-cli/package.json +1 -1
  40. package/node_modules/@oscharko-dev/keiko-contracts/dist/.tsbuildinfo +1 -1
  41. package/node_modules/@oscharko-dev/keiko-contracts/dist/index.d.ts +1 -1
  42. package/node_modules/@oscharko-dev/keiko-contracts/dist/index.js +1 -1
  43. package/node_modules/@oscharko-dev/keiko-contracts/package.json +1 -1
  44. package/node_modules/@oscharko-dev/keiko-evaluations/dist/.tsbuildinfo +1 -1
  45. package/node_modules/@oscharko-dev/keiko-evaluations/package.json +1 -1
  46. package/node_modules/@oscharko-dev/keiko-evidence/dist/.tsbuildinfo +1 -1
  47. package/node_modules/@oscharko-dev/keiko-evidence/package.json +1 -1
  48. package/node_modules/@oscharko-dev/keiko-harness/dist/.tsbuildinfo +1 -1
  49. package/node_modules/@oscharko-dev/keiko-harness/package.json +1 -1
  50. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/.tsbuildinfo +1 -1
  51. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/parsers/pdf-parser.d.ts.map +1 -1
  52. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/parsers/pdf-parser.js +2 -2
  53. package/node_modules/@oscharko-dev/keiko-local-knowledge/package.json +1 -1
  54. package/node_modules/@oscharko-dev/keiko-memory-capture/package.json +1 -1
  55. package/node_modules/@oscharko-dev/keiko-memory-consolidation/package.json +1 -1
  56. package/node_modules/@oscharko-dev/keiko-memory-governance/package.json +1 -1
  57. package/node_modules/@oscharko-dev/keiko-memory-retrieval/package.json +1 -1
  58. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/.tsbuildinfo +1 -1
  59. package/node_modules/@oscharko-dev/keiko-memory-vault/package.json +1 -1
  60. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/.tsbuildinfo +1 -1
  61. package/node_modules/@oscharko-dev/keiko-model-gateway/package.json +1 -1
  62. package/node_modules/@oscharko-dev/keiko-quality-intelligence/dist/.tsbuildinfo +1 -1
  63. package/node_modules/@oscharko-dev/keiko-quality-intelligence/package.json +1 -1
  64. package/node_modules/@oscharko-dev/keiko-sdk/dist/.tsbuildinfo +1 -1
  65. package/node_modules/@oscharko-dev/keiko-sdk/package.json +1 -1
  66. package/node_modules/@oscharko-dev/keiko-security/dist/.tsbuildinfo +1 -1
  67. package/node_modules/@oscharko-dev/keiko-security/package.json +1 -1
  68. package/node_modules/@oscharko-dev/keiko-server/dist/.tsbuildinfo +1 -1
  69. package/node_modules/@oscharko-dev/keiko-server/package.json +1 -1
  70. package/node_modules/@oscharko-dev/keiko-tools/dist/.tsbuildinfo +1 -1
  71. package/node_modules/@oscharko-dev/keiko-tools/package.json +1 -1
  72. package/node_modules/@oscharko-dev/keiko-verification/dist/.tsbuildinfo +1 -1
  73. package/node_modules/@oscharko-dev/keiko-verification/package.json +1 -1
  74. package/node_modules/@oscharko-dev/keiko-workflows/dist/.tsbuildinfo +1 -1
  75. package/node_modules/@oscharko-dev/keiko-workflows/package.json +1 -1
  76. package/node_modules/@oscharko-dev/keiko-workspace/dist/.tsbuildinfo +1 -1
  77. package/node_modules/@oscharko-dev/keiko-workspace/package.json +1 -1
  78. package/package.json +4 -3
  79. package/dist/ui/static/_next/static/chunks/app/_not-found/page-c4d800f366186be0.js +0 -1
  80. package/dist/ui/static/_next/static/chunks/app/launch/page-08afd1a052e7662c.js +0 -1
  81. package/dist/ui/static/_next/static/chunks/app/layout-0f75a39edc90325d.js +0 -1
  82. package/dist/ui/static/_next/static/chunks/app/local-knowledge/page-48bd57c5e542349e.js +0 -1
  83. package/dist/ui/static/_next/static/chunks/app/memoriaviva/review-queue/page-7186cd8b22efc78b.js +0 -1
  84. package/dist/ui/static/_next/static/chunks/app/page-f8386b8e05b3db03.js +0 -1
  85. package/node_modules/@napi-rs/canvas/LICENSE +0 -21
  86. package/node_modules/@napi-rs/canvas/README.md +0 -448
  87. package/node_modules/@napi-rs/canvas/geometry.js +0 -873
  88. package/node_modules/@napi-rs/canvas/index.d.ts +0 -1097
  89. package/node_modules/@napi-rs/canvas/index.js +0 -196
  90. package/node_modules/@napi-rs/canvas/js-binding.js +0 -464
  91. package/node_modules/@napi-rs/canvas/load-image.js +0 -156
  92. package/node_modules/@napi-rs/canvas/node-canvas.d.ts +0 -216
  93. package/node_modules/@napi-rs/canvas/node-canvas.js +0 -379
  94. package/node_modules/@napi-rs/canvas/package.json +0 -179
  95. package/node_modules/@napi-rs/canvas-linux-x64-gnu/README.md +0 -3
  96. package/node_modules/@napi-rs/canvas-linux-x64-gnu/package.json +0 -47
  97. package/node_modules/@napi-rs/canvas-linux-x64-gnu/skia.linux-x64-gnu.node +0 -0
  98. package/node_modules/@napi-rs/canvas-linux-x64-musl/README.md +0 -3
  99. package/node_modules/@napi-rs/canvas-linux-x64-musl/package.json +0 -47
  100. package/node_modules/@napi-rs/canvas-linux-x64-musl/skia.linux-x64-musl.node +0 -0
  101. /package/dist/ui/static/_next/static/{IZjQES_2JaG9qZ7_fkEPl → BNiyfCos3TiM2QdurajIZ}/_buildManifest.js +0 -0
  102. /package/dist/ui/static/_next/static/{IZjQES_2JaG9qZ7_fkEPl → BNiyfCos3TiM2QdurajIZ}/_ssgManifest.js +0 -0
@@ -1,873 +0,0 @@
1
- const { inspect } = require('util')
2
- /*
3
- * vendored in order to fix its dependence on the window global [cds 2020/08/04]
4
- * otherwise unchanged from https://github.com/jarek-foksa/geometry-polyfill/tree/f36bbc8f4bc43539d980687904ce46c8e915543d
5
- */
6
-
7
- // @info
8
- // DOMPoint polyfill
9
- // @src
10
- // https://drafts.fxtf.org/geometry/#DOMPoint
11
- // https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/core/geometry/dom_point_read_only.cc
12
- class DOMPoint {
13
- constructor(x = 0, y = 0, z = 0, w = 1) {
14
- this.x = x
15
- this.y = y
16
- this.z = z
17
- this.w = w
18
- }
19
-
20
- static fromPoint(otherPoint) {
21
- return new DOMPoint(
22
- otherPoint.x,
23
- otherPoint.y,
24
- otherPoint.z !== undefined ? otherPoint.z : 0,
25
- otherPoint.w !== undefined ? otherPoint.w : 1,
26
- )
27
- }
28
-
29
- matrixTransform(matrix) {
30
- if ((matrix.is2D || matrix instanceof SVGMatrix) && this.z === 0 && this.w === 1) {
31
- return new DOMPoint(
32
- this.x * matrix.a + this.y * matrix.c + matrix.e,
33
- this.x * matrix.b + this.y * matrix.d + matrix.f,
34
- 0,
35
- 1,
36
- )
37
- } else {
38
- return new DOMPoint(
39
- this.x * matrix.m11 + this.y * matrix.m21 + this.z * matrix.m31 + this.w * matrix.m41,
40
- this.x * matrix.m12 + this.y * matrix.m22 + this.z * matrix.m32 + this.w * matrix.m42,
41
- this.x * matrix.m13 + this.y * matrix.m23 + this.z * matrix.m33 + this.w * matrix.m43,
42
- this.x * matrix.m14 + this.y * matrix.m24 + this.z * matrix.m34 + this.w * matrix.m44,
43
- )
44
- }
45
- }
46
-
47
- toJSON() {
48
- return {
49
- x: this.x,
50
- y: this.y,
51
- z: this.z,
52
- w: this.w,
53
- }
54
- }
55
- }
56
-
57
- // @info
58
- // DOMRect polyfill
59
- // @src
60
- // https://drafts.fxtf.org/geometry/#DOMRect
61
- // https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/core/geometry/dom_rect_read_only.cc
62
-
63
- class DOMRect {
64
- constructor(x = 0, y = 0, width = 0, height = 0) {
65
- this.x = x
66
- this.y = y
67
- this.width = width
68
- this.height = height
69
- }
70
-
71
- static fromRect(otherRect) {
72
- return new DOMRect(otherRect.x, otherRect.y, otherRect.width, otherRect.height)
73
- }
74
-
75
- get top() {
76
- return this.y
77
- }
78
-
79
- get left() {
80
- return this.x
81
- }
82
-
83
- get right() {
84
- return this.x + this.width
85
- }
86
-
87
- get bottom() {
88
- return this.y + this.height
89
- }
90
-
91
- toJSON() {
92
- return {
93
- x: this.x,
94
- y: this.y,
95
- width: this.width,
96
- height: this.height,
97
- top: this.top,
98
- left: this.left,
99
- right: this.right,
100
- bottom: this.bottom,
101
- }
102
- }
103
- }
104
-
105
- for (const propertyName of ['top', 'right', 'bottom', 'left']) {
106
- const propertyDescriptor = Object.getOwnPropertyDescriptor(DOMRect.prototype, propertyName)
107
- propertyDescriptor.enumerable = true
108
- Object.defineProperty(DOMRect.prototype, propertyName, propertyDescriptor)
109
- }
110
-
111
- // @info
112
- // DOMMatrix polyfill (SVG 2)
113
- // @src
114
- // https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/core/geometry/dom_matrix_read_only.cc
115
- // https://github.com/tocharomera/generativecanvas/blob/master/node-canvas/lib/DOMMatrix.js
116
-
117
- const M11 = 0,
118
- M12 = 1,
119
- M13 = 2,
120
- M14 = 3
121
- const M21 = 4,
122
- M22 = 5,
123
- M23 = 6,
124
- M24 = 7
125
- const M31 = 8,
126
- M32 = 9,
127
- M33 = 10,
128
- M34 = 11
129
- const M41 = 12,
130
- M42 = 13,
131
- M43 = 14,
132
- M44 = 15
133
-
134
- const A = M11,
135
- B = M12
136
- const C = M21,
137
- D = M22
138
- const E = M41,
139
- F = M42
140
-
141
- const DEGREE_PER_RAD = 180 / Math.PI
142
- const RAD_PER_DEGREE = Math.PI / 180
143
-
144
- const VALUES = Symbol('values')
145
- const IS_2D = Symbol('is2D')
146
-
147
- function parseMatrix(init) {
148
- let parsed = init.replace(/matrix\(/, '').split(/,/, 7)
149
-
150
- if (parsed.length !== 6) {
151
- throw new Error(`Failed to parse ${init}`)
152
- }
153
-
154
- parsed = parsed.map(parseFloat)
155
-
156
- return [parsed[0], parsed[1], 0, 0, parsed[2], parsed[3], 0, 0, 0, 0, 1, 0, parsed[4], parsed[5], 0, 1]
157
- }
158
-
159
- function parseMatrix3d(init) {
160
- const parsed = init.replace(/matrix3d\(/, '').split(/,/, 17)
161
-
162
- if (parsed.length !== 16) {
163
- throw new Error(`Failed to parse ${init}`)
164
- }
165
-
166
- return parsed.map(parseFloat)
167
- }
168
-
169
- function parseTransform(tform) {
170
- const type = tform.split(/\(/, 1)[0]
171
-
172
- if (type === 'matrix') {
173
- return parseMatrix(tform)
174
- } else if (type === 'matrix3d') {
175
- return parseMatrix3d(tform)
176
- } else {
177
- throw new Error(`${type} parsing not implemented`)
178
- }
179
- }
180
-
181
- const setNumber2D = (receiver, index, value) => {
182
- if (typeof value !== 'number') {
183
- throw new TypeError('Expected number')
184
- }
185
-
186
- receiver[VALUES][index] = value
187
- }
188
-
189
- const setNumber3D = (receiver, index, value) => {
190
- if (typeof value !== 'number') {
191
- throw new TypeError('Expected number')
192
- }
193
-
194
- if (index === M33 || index === M44) {
195
- if (value !== 1) {
196
- receiver[IS_2D] = false
197
- }
198
- } else if (value !== 0) {
199
- receiver[IS_2D] = false
200
- }
201
-
202
- receiver[VALUES][index] = value
203
- }
204
-
205
- const newInstance = (values) => {
206
- const instance = Object.create(DOMMatrix.prototype)
207
- instance.constructor = DOMMatrix
208
- instance[IS_2D] = true
209
- instance[VALUES] = values
210
-
211
- return instance
212
- }
213
-
214
- const multiply = (first, second) => {
215
- const dest = new Float64Array(16)
216
-
217
- for (let i = 0; i < 4; i++) {
218
- for (let j = 0; j < 4; j++) {
219
- let sum = 0
220
-
221
- for (let k = 0; k < 4; k++) {
222
- sum += first[i * 4 + k] * second[k * 4 + j]
223
- }
224
-
225
- dest[i * 4 + j] = sum
226
- }
227
- }
228
-
229
- return dest
230
- }
231
-
232
- class DOMMatrix {
233
- get m11() {
234
- return this[VALUES][M11]
235
- }
236
- set m11(value) {
237
- setNumber2D(this, M11, value)
238
- }
239
- get m12() {
240
- return this[VALUES][M12]
241
- }
242
- set m12(value) {
243
- setNumber2D(this, M12, value)
244
- }
245
- get m13() {
246
- return this[VALUES][M13]
247
- }
248
- set m13(value) {
249
- setNumber3D(this, M13, value)
250
- }
251
- get m14() {
252
- return this[VALUES][M14]
253
- }
254
- set m14(value) {
255
- setNumber3D(this, M14, value)
256
- }
257
- get m21() {
258
- return this[VALUES][M21]
259
- }
260
- set m21(value) {
261
- setNumber2D(this, M21, value)
262
- }
263
- get m22() {
264
- return this[VALUES][M22]
265
- }
266
- set m22(value) {
267
- setNumber2D(this, M22, value)
268
- }
269
- get m23() {
270
- return this[VALUES][M23]
271
- }
272
- set m23(value) {
273
- setNumber3D(this, M23, value)
274
- }
275
- get m24() {
276
- return this[VALUES][M24]
277
- }
278
- set m24(value) {
279
- setNumber3D(this, M24, value)
280
- }
281
- get m31() {
282
- return this[VALUES][M31]
283
- }
284
- set m31(value) {
285
- setNumber3D(this, M31, value)
286
- }
287
- get m32() {
288
- return this[VALUES][M32]
289
- }
290
- set m32(value) {
291
- setNumber3D(this, M32, value)
292
- }
293
- get m33() {
294
- return this[VALUES][M33]
295
- }
296
- set m33(value) {
297
- setNumber3D(this, M33, value)
298
- }
299
- get m34() {
300
- return this[VALUES][M34]
301
- }
302
- set m34(value) {
303
- setNumber3D(this, M34, value)
304
- }
305
- get m41() {
306
- return this[VALUES][M41]
307
- }
308
- set m41(value) {
309
- setNumber2D(this, M41, value)
310
- }
311
- get m42() {
312
- return this[VALUES][M42]
313
- }
314
- set m42(value) {
315
- setNumber2D(this, M42, value)
316
- }
317
- get m43() {
318
- return this[VALUES][M43]
319
- }
320
- set m43(value) {
321
- setNumber3D(this, M43, value)
322
- }
323
- get m44() {
324
- return this[VALUES][M44]
325
- }
326
- set m44(value) {
327
- setNumber3D(this, M44, value)
328
- }
329
-
330
- get a() {
331
- return this[VALUES][A]
332
- }
333
- set a(value) {
334
- setNumber2D(this, A, value)
335
- }
336
- get b() {
337
- return this[VALUES][B]
338
- }
339
- set b(value) {
340
- setNumber2D(this, B, value)
341
- }
342
- get c() {
343
- return this[VALUES][C]
344
- }
345
- set c(value) {
346
- setNumber2D(this, C, value)
347
- }
348
- get d() {
349
- return this[VALUES][D]
350
- }
351
- set d(value) {
352
- setNumber2D(this, D, value)
353
- }
354
- get e() {
355
- return this[VALUES][E]
356
- }
357
- set e(value) {
358
- setNumber2D(this, E, value)
359
- }
360
- get f() {
361
- return this[VALUES][F]
362
- }
363
- set f(value) {
364
- setNumber2D(this, F, value)
365
- }
366
-
367
- get is2D() {
368
- return this[IS_2D]
369
- }
370
-
371
- get isIdentity() {
372
- const values = this[VALUES]
373
-
374
- return (
375
- values[M11] === 1 &&
376
- values[M12] === 0 &&
377
- values[M13] === 0 &&
378
- values[M14] === 0 &&
379
- values[M21] === 0 &&
380
- values[M22] === 1 &&
381
- values[M23] === 0 &&
382
- values[M24] === 0 &&
383
- values[M31] === 0 &&
384
- values[M32] === 0 &&
385
- values[M33] === 1 &&
386
- values[M34] === 0 &&
387
- values[M41] === 0 &&
388
- values[M42] === 0 &&
389
- values[M43] === 0 &&
390
- values[M44] === 1
391
- )
392
- }
393
-
394
- static fromMatrix(init) {
395
- if (init instanceof DOMMatrix) {
396
- return new DOMMatrix(init[VALUES])
397
- } else if (init instanceof SVGMatrix) {
398
- return new DOMMatrix([init.a, init.b, init.c, init.d, init.e, init.f])
399
- } else {
400
- throw new TypeError('Expected DOMMatrix')
401
- }
402
- }
403
-
404
- static fromFloat32Array(init) {
405
- if (!(init instanceof Float32Array)) throw new TypeError('Expected Float32Array')
406
- return new DOMMatrix(init)
407
- }
408
-
409
- static fromFloat64Array(init) {
410
- if (!(init instanceof Float64Array)) throw new TypeError('Expected Float64Array')
411
- return new DOMMatrix(init)
412
- }
413
-
414
- // @type
415
- // (Float64Array) => void
416
- constructor(init) {
417
- this[IS_2D] = true
418
-
419
- this[VALUES] = new Float64Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
420
-
421
- // Parse CSS transformList
422
- if (typeof init === 'string') {
423
- if (init === '') {
424
- return
425
- } else {
426
- const tforms = init.split(/\)\s+/, 20).map(parseTransform)
427
-
428
- if (tforms.length === 0) {
429
- return
430
- }
431
-
432
- init = tforms[0]
433
-
434
- for (let i = 1; i < tforms.length; i++) {
435
- init = multiply(tforms[i], init)
436
- }
437
- }
438
- }
439
-
440
- let i = 0
441
-
442
- if (init && init.length === 6) {
443
- setNumber2D(this, A, init[i++])
444
- setNumber2D(this, B, init[i++])
445
- setNumber2D(this, C, init[i++])
446
- setNumber2D(this, D, init[i++])
447
- setNumber2D(this, E, init[i++])
448
- setNumber2D(this, F, init[i++])
449
- } else if (init && init.length === 16) {
450
- setNumber2D(this, M11, init[i++])
451
- setNumber2D(this, M12, init[i++])
452
- setNumber3D(this, M13, init[i++])
453
- setNumber3D(this, M14, init[i++])
454
- setNumber2D(this, M21, init[i++])
455
- setNumber2D(this, M22, init[i++])
456
- setNumber3D(this, M23, init[i++])
457
- setNumber3D(this, M24, init[i++])
458
- setNumber3D(this, M31, init[i++])
459
- setNumber3D(this, M32, init[i++])
460
- setNumber3D(this, M33, init[i++])
461
- setNumber3D(this, M34, init[i++])
462
- setNumber2D(this, M41, init[i++])
463
- setNumber2D(this, M42, init[i++])
464
- setNumber3D(this, M43, init[i++])
465
- setNumber3D(this, M44, init[i])
466
- } else if (init !== undefined) {
467
- throw new TypeError('Expected string or array.')
468
- }
469
- }
470
-
471
- dump() {
472
- const mat = this[VALUES]
473
- console.info([mat.slice(0, 4), mat.slice(4, 8), mat.slice(8, 12), mat.slice(12, 16)])
474
- }
475
-
476
- [inspect.custom](depth) {
477
- if (depth < 0) return '[DOMMatrix]'
478
-
479
- const { a, b, c, d, e, f, is2D, isIdentity } = this
480
- if (this.is2D) {
481
- return `DOMMatrix ${inspect({ a, b, c, d, e, f, is2D, isIdentity }, { colors: true })}`
482
- } else {
483
- const { m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44, is2D, isIdentity } = this
484
- return `DOMMatrix ${inspect(
485
- {
486
- a,
487
- b,
488
- c,
489
- d,
490
- e,
491
- f,
492
- m11,
493
- m12,
494
- m13,
495
- m14,
496
- m21,
497
- m22,
498
- m23,
499
- m24,
500
- m31,
501
- m32,
502
- m33,
503
- m34,
504
- m41,
505
- m42,
506
- m43,
507
- m44,
508
- is2D,
509
- isIdentity,
510
- },
511
- { colors: true },
512
- )}`
513
- }
514
- }
515
-
516
- multiply(other) {
517
- return newInstance(this[VALUES]).multiplySelf(other)
518
- }
519
-
520
- multiplySelf(other) {
521
- this[VALUES] = multiply(other[VALUES], this[VALUES])
522
-
523
- if (!other.is2D) {
524
- this[IS_2D] = false
525
- }
526
-
527
- return this
528
- }
529
-
530
- preMultiplySelf(other) {
531
- this[VALUES] = multiply(this[VALUES], other[VALUES])
532
-
533
- if (!other.is2D) {
534
- this[IS_2D] = false
535
- }
536
-
537
- return this
538
- }
539
-
540
- translate(tx, ty, tz) {
541
- return newInstance(this[VALUES]).translateSelf(tx, ty, tz)
542
- }
543
-
544
- translateSelf(tx = 0, ty = 0, tz = 0) {
545
- this[VALUES] = multiply([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1], this[VALUES])
546
-
547
- if (tz !== 0) {
548
- this[IS_2D] = false
549
- }
550
-
551
- return this
552
- }
553
-
554
- scale(scaleX, scaleY, scaleZ, originX, originY, originZ) {
555
- return newInstance(this[VALUES]).scaleSelf(scaleX, scaleY, scaleZ, originX, originY, originZ)
556
- }
557
-
558
- scale3d(scale, originX, originY, originZ) {
559
- return newInstance(this[VALUES]).scale3dSelf(scale, originX, originY, originZ)
560
- }
561
-
562
- scale3dSelf(scale, originX, originY, originZ) {
563
- return this.scaleSelf(scale, scale, scale, originX, originY, originZ)
564
- }
565
-
566
- scaleSelf(scaleX, scaleY, scaleZ, originX, originY, originZ) {
567
- // Not redundant with translate's checks because we need to negate the values later.
568
- if (typeof originX !== 'number') originX = 0
569
- if (typeof originY !== 'number') originY = 0
570
- if (typeof originZ !== 'number') originZ = 0
571
-
572
- this.translateSelf(originX, originY, originZ)
573
-
574
- if (typeof scaleX !== 'number') scaleX = 1
575
- if (typeof scaleY !== 'number') scaleY = scaleX
576
- if (typeof scaleZ !== 'number') scaleZ = 1
577
-
578
- this[VALUES] = multiply([scaleX, 0, 0, 0, 0, scaleY, 0, 0, 0, 0, scaleZ, 0, 0, 0, 0, 1], this[VALUES])
579
-
580
- this.translateSelf(-originX, -originY, -originZ)
581
-
582
- if (scaleZ !== 1 || originZ !== 0) {
583
- this[IS_2D] = false
584
- }
585
-
586
- return this
587
- }
588
-
589
- rotateFromVector(x, y) {
590
- return newInstance(this[VALUES]).rotateFromVectorSelf(x, y)
591
- }
592
-
593
- rotateFromVectorSelf(x = 0, y = 0) {
594
- const theta = x === 0 && y === 0 ? 0 : Math.atan2(y, x) * DEGREE_PER_RAD
595
- return this.rotateSelf(theta)
596
- }
597
-
598
- rotate(rotX, rotY, rotZ) {
599
- return newInstance(this[VALUES]).rotateSelf(rotX, rotY, rotZ)
600
- }
601
-
602
- rotateSelf(rotX, rotY, rotZ) {
603
- if (rotY === undefined && rotZ === undefined) {
604
- rotZ = rotX
605
- rotX = rotY = 0
606
- }
607
-
608
- if (typeof rotY !== 'number') rotY = 0
609
- if (typeof rotZ !== 'number') rotZ = 0
610
-
611
- if (rotX !== 0 || rotY !== 0) {
612
- this[IS_2D] = false
613
- }
614
-
615
- rotX *= RAD_PER_DEGREE
616
- rotY *= RAD_PER_DEGREE
617
- rotZ *= RAD_PER_DEGREE
618
-
619
- let c = Math.cos(rotZ)
620
- let s = Math.sin(rotZ)
621
-
622
- this[VALUES] = multiply([c, s, 0, 0, -s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], this[VALUES])
623
-
624
- c = Math.cos(rotY)
625
- s = Math.sin(rotY)
626
-
627
- this[VALUES] = multiply([c, 0, -s, 0, 0, 1, 0, 0, s, 0, c, 0, 0, 0, 0, 1], this[VALUES])
628
-
629
- c = Math.cos(rotX)
630
- s = Math.sin(rotX)
631
-
632
- this[VALUES] = multiply([1, 0, 0, 0, 0, c, s, 0, 0, -s, c, 0, 0, 0, 0, 1], this[VALUES])
633
-
634
- return this
635
- }
636
-
637
- rotateAxisAngle(x, y, z, angle) {
638
- return newInstance(this[VALUES]).rotateAxisAngleSelf(x, y, z, angle)
639
- }
640
-
641
- rotateAxisAngleSelf(x = 0, y = 0, z = 0, angle = 0) {
642
- const length = Math.sqrt(x * x + y * y + z * z)
643
-
644
- if (length === 0) {
645
- return this
646
- }
647
-
648
- if (length !== 1) {
649
- x /= length
650
- y /= length
651
- z /= length
652
- }
653
-
654
- angle *= RAD_PER_DEGREE
655
-
656
- const c = Math.cos(angle)
657
- const s = Math.sin(angle)
658
- const t = 1 - c
659
- const tx = t * x
660
- const ty = t * y
661
-
662
- this[VALUES] = multiply(
663
- [
664
- tx * x + c,
665
- tx * y + s * z,
666
- tx * z - s * y,
667
- 0,
668
- tx * y - s * z,
669
- ty * y + c,
670
- ty * z + s * x,
671
- 0,
672
- tx * z + s * y,
673
- ty * z - s * x,
674
- t * z * z + c,
675
- 0,
676
- 0,
677
- 0,
678
- 0,
679
- 1,
680
- ],
681
- this[VALUES],
682
- )
683
-
684
- if (x !== 0 || y !== 0) {
685
- this[IS_2D] = false
686
- }
687
-
688
- return this
689
- }
690
-
691
- skewX(sx) {
692
- return newInstance(this[VALUES]).skewXSelf(sx)
693
- }
694
-
695
- skewXSelf(sx) {
696
- if (typeof sx !== 'number') {
697
- return this
698
- }
699
-
700
- const t = Math.tan(sx * RAD_PER_DEGREE)
701
-
702
- this[VALUES] = multiply([1, 0, 0, 0, t, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], this[VALUES])
703
-
704
- return this
705
- }
706
-
707
- skewY(sy) {
708
- return newInstance(this[VALUES]).skewYSelf(sy)
709
- }
710
-
711
- skewYSelf(sy) {
712
- if (typeof sy !== 'number') {
713
- return this
714
- }
715
-
716
- const t = Math.tan(sy * RAD_PER_DEGREE)
717
-
718
- this[VALUES] = multiply([1, t, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], this[VALUES])
719
-
720
- return this
721
- }
722
-
723
- flipX() {
724
- return newInstance(multiply([-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], this[VALUES]))
725
- }
726
-
727
- flipY() {
728
- return newInstance(multiply([1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], this[VALUES]))
729
- }
730
-
731
- inverse() {
732
- return newInstance(this[VALUES].slice()).invertSelf()
733
- }
734
-
735
- invertSelf() {
736
- if (this[IS_2D]) {
737
- const det = this[VALUES][A] * this[VALUES][D] - this[VALUES][B] * this[VALUES][C]
738
-
739
- // Invertable
740
- if (det !== 0) {
741
- const newA = this[VALUES][D] / det
742
- const newB = -this[VALUES][B] / det
743
- const newC = -this[VALUES][C] / det
744
- const newD = this[VALUES][A] / det
745
- const newE = (this[VALUES][C] * this[VALUES][F] - this[VALUES][D] * this[VALUES][E]) / det
746
- const newF = (this[VALUES][B] * this[VALUES][E] - this[VALUES][A] * this[VALUES][F]) / det
747
-
748
- this.a = newA
749
- this.b = newB
750
- this.c = newC
751
- this.d = newD
752
- this.e = newE
753
- this.f = newF
754
-
755
- return this
756
- }
757
-
758
- // Not invertable
759
- else {
760
- this[IS_2D] = false
761
-
762
- this[VALUES] = [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]
763
-
764
- return this
765
- }
766
- } else {
767
- throw new Error('3D matrix inversion is not implemented.')
768
- }
769
- }
770
-
771
- setMatrixValue(transformList) {
772
- const temp = new DOMMatrix(transformList)
773
-
774
- this[VALUES] = temp[VALUES]
775
- this[IS_2D] = temp[IS_2D]
776
-
777
- return this
778
- }
779
-
780
- transformPoint(point) {
781
- const x = point.x || 0
782
- const y = point.y || 0
783
- const z = point.z || 0
784
- const w = point.w || 1
785
-
786
- const values = this[VALUES]
787
-
788
- const nx = values[M11] * x + values[M21] * y + values[M31] * z + values[M41] * w
789
- const ny = values[M12] * x + values[M22] * y + values[M32] * z + values[M42] * w
790
- const nz = values[M13] * x + values[M23] * y + values[M33] * z + values[M43] * w
791
- const nw = values[M14] * x + values[M24] * y + values[M34] * z + values[M44] * w
792
-
793
- return new DOMPoint(nx, ny, nz, nw)
794
- }
795
-
796
- toFloat32Array() {
797
- return Float32Array.from(this[VALUES])
798
- }
799
-
800
- toFloat64Array() {
801
- return this[VALUES].slice(0)
802
- }
803
-
804
- toJSON() {
805
- return {
806
- a: this.a,
807
- b: this.b,
808
- c: this.c,
809
- d: this.d,
810
- e: this.e,
811
- f: this.f,
812
- m11: this.m11,
813
- m12: this.m12,
814
- m13: this.m13,
815
- m14: this.m14,
816
- m21: this.m21,
817
- m22: this.m22,
818
- m23: this.m23,
819
- m24: this.m24,
820
- m31: this.m31,
821
- m32: this.m32,
822
- m33: this.m33,
823
- m34: this.m34,
824
- m41: this.m41,
825
- m42: this.m42,
826
- m43: this.m43,
827
- m44: this.m44,
828
- is2D: this.is2D,
829
- isIdentity: this.isIdentity,
830
- }
831
- }
832
-
833
- toString() {
834
- if (this.is2D) {
835
- return `matrix(${this.a}, ${this.b}, ${this.c}, ${this.d}, ${this.e}, ${this.f})`
836
- } else {
837
- return `matrix3d(${this[VALUES].join(', ')})`
838
- }
839
- }
840
- }
841
-
842
- for (const propertyName of [
843
- 'a',
844
- 'b',
845
- 'c',
846
- 'd',
847
- 'e',
848
- 'f',
849
- 'm11',
850
- 'm12',
851
- 'm13',
852
- 'm14',
853
- 'm21',
854
- 'm22',
855
- 'm23',
856
- 'm24',
857
- 'm31',
858
- 'm32',
859
- 'm33',
860
- 'm34',
861
- 'm41',
862
- 'm42',
863
- 'm43',
864
- 'm44',
865
- 'is2D',
866
- 'isIdentity',
867
- ]) {
868
- const propertyDescriptor = Object.getOwnPropertyDescriptor(DOMMatrix.prototype, propertyName)
869
- propertyDescriptor.enumerable = true
870
- Object.defineProperty(DOMMatrix.prototype, propertyName, propertyDescriptor)
871
- }
872
-
873
- module.exports = { DOMPoint, DOMMatrix, DOMRect }