@thednp/dommatrix 2.0.0-alpha3 → 2.0.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.
@@ -158,63 +158,219 @@ const $ = {
158
158
  return g([e, n, i, r, a, l, m, h, c, u, f, w, o, d, A, M]);
159
159
  };
160
160
  class y {
161
+ /**
162
+ * @constructor
163
+ * @param init accepts all parameter configurations:
164
+ * * valid CSS transform string,
165
+ * * CSSMatrix/DOMMatrix instance,
166
+ * * a 6/16 elements *Array*.
167
+ */
161
168
  constructor(t) {
162
169
  return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this.m11 = 1, this.m12 = 0, this.m13 = 0, this.m14 = 0, this.m21 = 0, this.m22 = 1, this.m23 = 0, this.m24 = 0, this.m31 = 0, this.m32 = 0, this.m33 = 1, this.m34 = 0, this.m41 = 0, this.m42 = 0, this.m43 = 0, this.m44 = 1, t ? this.setMatrixValue(t) : this;
163
170
  }
171
+ /**
172
+ * A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity
173
+ * matrix is one in which every value is 0 except those on the main diagonal from top-left
174
+ * to bottom-right corner (in other words, where the offsets in each direction are equal).
175
+ *
176
+ * @return the current property value
177
+ */
164
178
  get isIdentity() {
165
179
  return this.m11 === 1 && this.m12 === 0 && this.m13 === 0 && this.m14 === 0 && this.m21 === 0 && this.m22 === 1 && this.m23 === 0 && this.m24 === 0 && this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m41 === 0 && this.m42 === 0 && this.m43 === 0 && this.m44 === 1;
166
180
  }
181
+ /**
182
+ * A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix
183
+ * and `false` if the matrix is 3D.
184
+ *
185
+ * @return the current property value
186
+ */
167
187
  get is2D() {
168
188
  return this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m43 === 0 && this.m44 === 1;
169
189
  }
190
+ /**
191
+ * The `setMatrixValue` method replaces the existing matrix with one computed
192
+ * in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`
193
+ *
194
+ * The method accepts any *Array* values, the result of
195
+ * `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls
196
+ * or `CSSMatrix` instance method `toArray()`.
197
+ *
198
+ * This method expects valid *matrix()* / *matrix3d()* string values, as well
199
+ * as other transform functions like *translateX(10px)*.
200
+ *
201
+ * @param source
202
+ * @return the matrix instance
203
+ */
170
204
  setMatrixValue(t) {
171
205
  return typeof t == "string" && t.length && t !== "none" ? O(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? g(t) : typeof t == "object" ? X(t) : this;
172
206
  }
207
+ /**
208
+ * Returns a *Float32Array* containing elements which comprise the matrix.
209
+ * The method can return either the 16 elements or the 6 elements
210
+ * depending on the value of the `is2D` parameter.
211
+ *
212
+ * @param is2D *Array* representation of the matrix
213
+ * @return an *Array* representation of the matrix
214
+ */
173
215
  toFloat32Array(t) {
174
216
  return Float32Array.from(x(this, t));
175
217
  }
218
+ /**
219
+ * Returns a *Float64Array* containing elements which comprise the matrix.
220
+ * The method can return either the 16 elements or the 6 elements
221
+ * depending on the value of the `is2D` parameter.
222
+ *
223
+ * @param is2D *Array* representation of the matrix
224
+ * @return an *Array* representation of the matrix
225
+ */
176
226
  toFloat64Array(t) {
177
227
  return Float64Array.from(x(this, t));
178
228
  }
229
+ /**
230
+ * Creates and returns a string representation of the matrix in `CSS` matrix syntax,
231
+ * using the appropriate `CSS` matrix notation.
232
+ *
233
+ * matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*
234
+ * matrix *matrix(a, b, c, d, e, f)*
235
+ *
236
+ * @return a string representation of the matrix
237
+ */
179
238
  toString() {
180
239
  const { is2D: t } = this, e = this.toFloat64Array(t).join(", ");
181
240
  return `${t ? "matrix" : "matrix3d"}(${e})`;
182
241
  }
242
+ /**
243
+ * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*
244
+ * that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well
245
+ * as the `is2D` & `isIdentity` properties.
246
+ *
247
+ * The result can also be used as a second parameter for the `fromMatrix` static method
248
+ * to load values into another matrix instance.
249
+ *
250
+ * @return an *Object* with all matrix values.
251
+ */
183
252
  toJSON() {
184
253
  const { is2D: t, isIdentity: e } = this;
185
254
  return { ...this, is2D: t, isIdentity: e };
186
255
  }
256
+ /**
257
+ * The Multiply method returns a new CSSMatrix which is the result of this
258
+ * matrix multiplied by the passed matrix, with the passed matrix to the right.
259
+ * This matrix is not modified.
260
+ *
261
+ * @param m2 CSSMatrix
262
+ * @return The resulted matrix.
263
+ */
187
264
  multiply(t) {
188
265
  return N(this, t);
189
266
  }
267
+ /**
268
+ * The translate method returns a new matrix which is this matrix post
269
+ * multiplied by a translation matrix containing the passed values. If the z
270
+ * component is undefined, a 0 value is used in its place. This matrix is not
271
+ * modified.
272
+ *
273
+ * @param x X component of the translation value.
274
+ * @param y Y component of the translation value.
275
+ * @param z Z component of the translation value.
276
+ * @return The resulted matrix
277
+ */
190
278
  translate(t, e, n) {
191
279
  const i = t;
192
280
  let r = e, a = n;
193
281
  return typeof r > "u" && (r = 0), typeof a > "u" && (a = 0), N(this, Y(i, r, a));
194
282
  }
283
+ /**
284
+ * The scale method returns a new matrix which is this matrix post multiplied by
285
+ * a scale matrix containing the passed values. If the z component is undefined,
286
+ * a 1 value is used in its place. If the y component is undefined, the x
287
+ * component value is used in its place. This matrix is not modified.
288
+ *
289
+ * @param x The X component of the scale value.
290
+ * @param y The Y component of the scale value.
291
+ * @param z The Z component of the scale value.
292
+ * @return The resulted matrix
293
+ */
195
294
  scale(t, e, n) {
196
295
  const i = t;
197
296
  let r = e, a = n;
198
297
  return typeof r > "u" && (r = t), typeof a > "u" && (a = 1), N(this, I(i, r, a));
199
298
  }
299
+ /**
300
+ * The rotate method returns a new matrix which is this matrix post multiplied
301
+ * by each of 3 rotation matrices about the major axes, first X, then Y, then Z.
302
+ * If the y and z components are undefined, the x value is used to rotate the
303
+ * object about the z axis, as though the vector (0,0,x) were passed. All
304
+ * rotation values are in degrees. This matrix is not modified.
305
+ *
306
+ * @param rx The X component of the rotation, or Z if Y and Z are null.
307
+ * @param ry The (optional) Y component of the rotation value.
308
+ * @param rz The (optional) Z component of the rotation value.
309
+ * @return The resulted matrix
310
+ */
200
311
  rotate(t, e, n) {
201
312
  let i = t, r = e || 0, a = n || 0;
202
313
  return typeof t == "number" && typeof e > "u" && typeof n > "u" && (a = i, i = 0, r = 0), N(this, F(i, r, a));
203
314
  }
315
+ /**
316
+ * The rotateAxisAngle method returns a new matrix which is this matrix post
317
+ * multiplied by a rotation matrix with the given axis and `angle`. The right-hand
318
+ * rule is used to determine the direction of rotation. All rotation values are
319
+ * in degrees. This matrix is not modified.
320
+ *
321
+ * @param x The X component of the axis vector.
322
+ * @param y The Y component of the axis vector.
323
+ * @param z The Z component of the axis vector.
324
+ * @param angle The angle of rotation about the axis vector, in degrees.
325
+ * @return The resulted matrix
326
+ */
204
327
  rotateAxisAngle(t, e, n, i) {
205
328
  if ([t, e, n, i].some((r) => Number.isNaN(+r)))
206
329
  throw new TypeError("CSSMatrix: expecting 4 values");
207
330
  return N(this, T(t, e, n, i));
208
331
  }
332
+ /**
333
+ * Specifies a skew transformation along the `x-axis` by the given angle.
334
+ * This matrix is not modified.
335
+ *
336
+ * @param angle The angle amount in degrees to skew.
337
+ * @return The resulted matrix
338
+ */
209
339
  skewX(t) {
210
340
  return N(this, R(t));
211
341
  }
342
+ /**
343
+ * Specifies a skew transformation along the `y-axis` by the given angle.
344
+ * This matrix is not modified.
345
+ *
346
+ * @param angle The angle amount in degrees to skew.
347
+ * @return The resulted matrix
348
+ */
212
349
  skewY(t) {
213
350
  return N(this, D(t));
214
351
  }
352
+ /**
353
+ * Specifies a skew transformation along both the `x-axis` and `y-axis`.
354
+ * This matrix is not modified.
355
+ *
356
+ * @param angleX The X-angle amount in degrees to skew.
357
+ * @param angleY The angle amount in degrees to skew.
358
+ * @return The resulted matrix
359
+ */
215
360
  skew(t, e) {
216
361
  return N(this, v(t, e));
217
362
  }
363
+ /**
364
+ * Transforms a specified vector using the matrix, returning a new
365
+ * {x,y,z,w} Tuple *Object* comprising the transformed vector.
366
+ * Neither the matrix nor the original vector are altered.
367
+ *
368
+ * The method is equivalent with `transformPoint()` method
369
+ * of the `DOMMatrix` constructor.
370
+ *
371
+ * @param t Tuple with `{x,y,z,w}` components
372
+ * @return the resulting Tuple
373
+ */
218
374
  transformPoint(t) {
219
375
  const e = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, n = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, i = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, r = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;
220
376
  return t instanceof DOMPoint ? new DOMPoint(e, n, i, r) : {
@@ -1 +1 @@
1
- {"version":3,"file":"dommatrix.mjs","sources":["../src/index.ts"],"sourcesContent":["import type { Matrix, Matrix3d, JSONMatrix, CSSMatrixInput, PointTuple } from './types';\n\n/** A model for JSONMatrix */\nconst JSON_MATRIX: JSONMatrix = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0,\n m11: 1,\n m12: 0,\n m13: 0,\n m14: 0,\n m21: 0,\n m22: 1,\n m23: 0,\n m24: 0,\n m31: 0,\n m32: 0,\n m33: 1,\n m34: 0,\n m41: 0,\n m42: 0,\n m43: 0,\n m44: 1,\n is2D: true,\n isIdentity: true,\n};\n\n// CSSMatrix Static methods\n// * `fromArray` is a more simple implementation, should also accept Float[32/64]Array;\n// * `fromMatrix` load values from another CSSMatrix/DOMMatrix instance or JSON object;\n// * `fromString` parses and loads values from any valid CSS transform string (TransformList).\n// * `isCompatibleArray` Checks if an array is compatible with CSSMatrix.\n// * `isCompatibleObject` Checks if an object is compatible with CSSMatrix.\n\n/** Checks if an array is compatible with CSSMatrix */\nconst isCompatibleArray = (array?: unknown): array is Matrix | Matrix3d | Float32Array | Float64Array => {\n return (\n (array instanceof Float64Array ||\n array instanceof Float32Array ||\n (Array.isArray(array) && array.every(x => typeof x === 'number'))) &&\n [6, 16].some(x => array.length === x)\n );\n};\n\n/** Checks if an object is compatible with CSSMatrix */\nconst isCompatibleObject = (object?: unknown): object is CSSMatrix | DOMMatrix | JSONMatrix => {\n return (\n object instanceof DOMMatrix ||\n object instanceof CSSMatrix ||\n (typeof object === 'object' && Object.keys(JSON_MATRIX).every(k => object && k in object))\n );\n};\n\n/**\n * Creates a new mutable `CSSMatrix` instance given an array of 16/6 floating point values.\n * This static method invalidates arrays that contain non-number elements.\n *\n * If the array has six values, the result is a 2D matrix; if the array has 16 values,\n * the result is a 3D matrix. Otherwise, a TypeError exception is thrown.\n *\n * @param array an `Array` to feed values from.\n * @return the resulted matrix.\n */\nconst fromArray = (array: any[] | Float32Array | Float64Array): CSSMatrix => {\n const m = new CSSMatrix();\n const a = Array.from(array);\n\n if (!isCompatibleArray(a)) {\n throw TypeError(`CSSMatrix: \"${a.join(',')}\" must be an array with 6/16 numbers.`);\n }\n if (a.length === 16) {\n const [m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44] = a;\n\n m.m11 = m11;\n m.a = m11;\n\n m.m21 = m21;\n m.c = m21;\n\n m.m31 = m31;\n\n m.m41 = m41;\n m.e = m41;\n\n m.m12 = m12;\n m.b = m12;\n\n m.m22 = m22;\n m.d = m22;\n\n m.m32 = m32;\n\n m.m42 = m42;\n m.f = m42;\n\n m.m13 = m13;\n m.m23 = m23;\n m.m33 = m33;\n m.m43 = m43;\n m.m14 = m14;\n m.m24 = m24;\n m.m34 = m34;\n m.m44 = m44;\n } else if (a.length === 6) {\n const [M11, M12, M21, M22, M41, M42] = a;\n\n m.m11 = M11;\n m.a = M11;\n\n m.m12 = M12;\n m.b = M12;\n\n m.m21 = M21;\n m.c = M21;\n\n m.m22 = M22;\n m.d = M22;\n\n m.m41 = M41;\n m.e = M41;\n\n m.m42 = M42;\n m.f = M42;\n }\n return m;\n};\n\n/**\n * Creates a new mutable `CSSMatrix` instance given an existing matrix or a\n * `DOMMatrix` instance which provides the values for its properties.\n *\n * @param m the source matrix to feed values from.\n * @return the resulted matrix.\n */\nconst fromMatrix = (m: CSSMatrix | DOMMatrix | JSONMatrix): CSSMatrix => {\n if (isCompatibleObject(m)) {\n return fromArray([\n m.m11,\n m.m12,\n m.m13,\n m.m14,\n m.m21,\n m.m22,\n m.m23,\n m.m24,\n m.m31,\n m.m32,\n m.m33,\n m.m34,\n m.m41,\n m.m42,\n m.m43,\n m.m44,\n ]);\n }\n throw TypeError(`CSSMatrix: \"${JSON.stringify(m)}\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);\n};\n\n/**\n * Creates a new mutable `CSSMatrix` given any valid CSS transform string,\n * or what we call `TransformList`:\n *\n * * `matrix(a, b, c, d, e, f)` - valid matrix() transform function\n * * `matrix3d(m11, m12, m13, ...m44)` - valid matrix3d() transform function\n * * `translate(tx, ty) rotateX(alpha)` - any valid transform function(s)\n *\n * @copyright thednp © 2021\n *\n * @param source valid CSS transform string syntax.\n * @return the resulted matrix.\n */\nconst fromString = (source: string): CSSMatrix => {\n if (typeof source !== 'string') {\n throw TypeError(`CSSMatrix: \"${JSON.stringify(source)}\" is not a string.`);\n }\n const str = String(source).replace(/\\s/g, '');\n let m = new CSSMatrix();\n const invalidStringError = `CSSMatrix: invalid transform string \"${source}\"`;\n\n // const px = ['perspective'];\n // const length = ['translate', 'translate3d', 'translateX', 'translateY', 'translateZ'];\n // const deg = ['rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'skew', 'skewX', 'skewY'];\n // const abs = ['scale', 'scale3d', 'matrix', 'matrix3d'];\n // const transformFunctions = px.concat(length, deg, abs);\n\n str\n .split(')')\n .filter(f => f)\n .forEach(tf => {\n const [prop, value] = tf.split('(');\n\n // invalidate empty string\n if (!value) throw TypeError(invalidStringError);\n\n const components = value\n .split(',')\n .map(n => (n.includes('rad') ? parseFloat(n) * (180 / Math.PI) : parseFloat(n)));\n\n const [x, y, z, a] = components;\n const xyz = [x, y, z];\n const xyza = [x, y, z, a];\n\n // single number value expected\n if (prop === 'perspective' && x && [y, z].every(n => n === undefined)) {\n m.m34 = -1 / x;\n // 6/16 number values expected\n } else if (\n prop.includes('matrix') &&\n [6, 16].includes(components.length) &&\n components.every(n => !Number.isNaN(+n))\n ) {\n const values = components.map(n => (Math.abs(n) < 1e-6 ? 0 : n));\n m = m.multiply(fromArray(values as Matrix | Matrix3d));\n // 3 values expected\n } else if (prop === 'translate3d' && xyz.every(n => !Number.isNaN(+n))) {\n m = m.translate(x, y, z);\n // single/double number value(s) expected\n } else if (prop === 'translate' && x && z === undefined) {\n m = m.translate(x, y || 0, 0);\n // all 4 values expected\n } else if (prop === 'rotate3d' && xyza.every(n => !Number.isNaN(+n)) && a) {\n m = m.rotateAxisAngle(x, y, z, a);\n // single value expected\n } else if (prop === 'rotate' && x && [y, z].every(n => n === undefined)) {\n m = m.rotate(0, 0, x);\n // 3 values expected\n } else if (prop === 'scale3d' && xyz.every(n => !Number.isNaN(+n)) && xyz.some(n => n !== 1)) {\n m = m.scale(x, y, z);\n // single value expected\n } else if (prop === 'scale' && !Number.isNaN(x) && x !== 1 && z === undefined) {\n const nosy = Number.isNaN(+y);\n const sy = nosy ? x : y;\n m = m.scale(x, sy, 1);\n // single/double value expected\n } else if (prop === 'skew' && (x || (!Number.isNaN(x) && y)) && z === undefined) {\n m = m.skew(x, y || 0);\n } else if (\n ['translate', 'rotate', 'scale', 'skew'].some(p => prop.includes(p)) &&\n /[XYZ]/.test(prop) &&\n x &&\n [y, z].every(n => n === undefined) // a single value expected\n ) {\n if ('skewX' === prop || 'skewY' === prop) {\n m = m[prop](x);\n } else {\n const fn = prop.replace(/[XYZ]/, '') as 'scale' | 'translate' | 'rotate';\n const axis = prop.replace(fn, '');\n const idx = ['X', 'Y', 'Z'].indexOf(axis);\n const def = fn === 'scale' ? 1 : 0;\n const axeValues: [number, number, number] = [idx === 0 ? x : def, idx === 1 ? x : def, idx === 2 ? x : def];\n m = m[fn](...axeValues);\n }\n } else {\n throw TypeError(invalidStringError);\n }\n });\n\n return m;\n};\n\n/**\n * Returns an *Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param m the source matrix to feed values from.\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\nconst toArray = (m: CSSMatrix | DOMMatrix | JSONMatrix, is2D?: boolean): Matrix | Matrix3d => {\n if (is2D) {\n return [m.a, m.b, m.c, m.d, m.e, m.f];\n }\n return [\n m.m11,\n m.m12,\n m.m13,\n m.m14,\n m.m21,\n m.m22,\n m.m23,\n m.m24,\n m.m31,\n m.m32,\n m.m33,\n m.m34,\n m.m41,\n m.m42,\n m.m43,\n m.m44,\n ];\n};\n\n// Transform Functions\n// https://www.w3.org/TR/css-transforms-1/#transform-functions\n\n/**\n * Creates a new `CSSMatrix` for the translation matrix and returns it.\n * This method is equivalent to the CSS `translate3d()` function.\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/translate3d\n *\n * @param x the `x-axis` position.\n * @param y the `y-axis` position.\n * @param z the `z-axis` position.\n * @return the resulted matrix.\n */\nconst Translate = (x: number, y: number, z: number): CSSMatrix => {\n const m = new CSSMatrix();\n m.m41 = x;\n m.e = x;\n m.m42 = y;\n m.f = y;\n m.m43 = z;\n return m;\n};\n\n/**\n * Creates a new `CSSMatrix` for the rotation matrix and returns it.\n *\n * http://en.wikipedia.org/wiki/Rotation_matrix\n *\n * @param rx the `x-axis` rotation.\n * @param ry the `y-axis` rotation.\n * @param rz the `z-axis` rotation.\n * @return the resulted matrix.\n */\nconst Rotate = (rx: number, ry: number, rz: number): CSSMatrix => {\n const m = new CSSMatrix();\n const degToRad = Math.PI / 180;\n const radX = rx * degToRad;\n const radY = ry * degToRad;\n const radZ = rz * degToRad;\n\n // minus sin() because of right-handed system\n const cosx = Math.cos(radX);\n const sinx = -Math.sin(radX);\n const cosy = Math.cos(radY);\n const siny = -Math.sin(radY);\n const cosz = Math.cos(radZ);\n const sinz = -Math.sin(radZ);\n\n const m11 = cosy * cosz;\n const m12 = -cosy * sinz;\n\n m.m11 = m11;\n m.a = m11;\n\n m.m12 = m12;\n m.b = m12;\n\n m.m13 = siny;\n\n const m21 = sinx * siny * cosz + cosx * sinz;\n m.m21 = m21;\n m.c = m21;\n\n const m22 = cosx * cosz - sinx * siny * sinz;\n m.m22 = m22;\n m.d = m22;\n\n m.m23 = -sinx * cosy;\n\n m.m31 = sinx * sinz - cosx * siny * cosz;\n m.m32 = sinx * cosz + cosx * siny * sinz;\n m.m33 = cosx * cosy;\n\n return m;\n};\n\n/**\n * Creates a new `CSSMatrix` for the rotation matrix and returns it.\n * This method is equivalent to the CSS `rotate3d()` function.\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate3d\n *\n * @param x the `x-axis` vector length.\n * @param y the `y-axis` vector length.\n * @param z the `z-axis` vector length.\n * @param alpha the value in degrees of the rotation.\n * @return the resulted matrix.\n */\nconst RotateAxisAngle = (x: number, y: number, z: number, alpha: number): CSSMatrix => {\n const m = new CSSMatrix();\n const length = Math.sqrt(x * x + y * y + z * z);\n\n if (length === 0) {\n // bad vector length, return identity\n return m;\n }\n\n const X = x / length;\n const Y = y / length;\n const Z = z / length;\n\n const angle = alpha * (Math.PI / 360);\n const sinA = Math.sin(angle);\n const cosA = Math.cos(angle);\n const sinA2 = sinA * sinA;\n const x2 = X * X;\n const y2 = Y * Y;\n const z2 = Z * Z;\n\n const m11 = 1 - 2 * (y2 + z2) * sinA2;\n m.m11 = m11;\n m.a = m11;\n\n const m12 = 2 * (X * Y * sinA2 + Z * sinA * cosA);\n m.m12 = m12;\n m.b = m12;\n\n m.m13 = 2 * (X * Z * sinA2 - Y * sinA * cosA);\n\n const m21 = 2 * (Y * X * sinA2 - Z * sinA * cosA);\n m.m21 = m21;\n m.c = m21;\n\n const m22 = 1 - 2 * (z2 + x2) * sinA2;\n m.m22 = m22;\n m.d = m22;\n\n m.m23 = 2 * (Y * Z * sinA2 + X * sinA * cosA);\n m.m31 = 2 * (Z * X * sinA2 + Y * sinA * cosA);\n m.m32 = 2 * (Z * Y * sinA2 - X * sinA * cosA);\n m.m33 = 1 - 2 * (x2 + y2) * sinA2;\n\n return m;\n};\n\n/**\n * Creates a new `CSSMatrix` for the scale matrix and returns it.\n * This method is equivalent to the CSS `scale3d()` function, except it doesn't\n * accept {x, y, z} transform origin parameters.\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale3d\n *\n * @param x the `x-axis` scale.\n * @param y the `y-axis` scale.\n * @param z the `z-axis` scale.\n * @return the resulted matrix.\n */\nconst Scale = (x: number, y: number, z: number): CSSMatrix => {\n const m = new CSSMatrix();\n m.m11 = x;\n m.a = x;\n\n m.m22 = y;\n m.d = y;\n\n m.m33 = z;\n return m;\n};\n\n/**\n * Creates a new `CSSMatrix` for the shear of both the `x-axis` and`y-axis`\n * matrix and returns it. This method is equivalent to the CSS `skew()` function.\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/skew\n *\n * @param angleX the X-angle in degrees.\n * @param angleY the Y-angle in degrees.\n * @return the resulted matrix.\n */\nconst Skew = (angleX: number, angleY: number): CSSMatrix => {\n const m = new CSSMatrix();\n if (angleX) {\n const radX = (angleX * Math.PI) / 180;\n const tX = Math.tan(radX);\n m.m21 = tX;\n m.c = tX;\n }\n if (angleY) {\n const radY = (angleY * Math.PI) / 180;\n const tY = Math.tan(radY);\n m.m12 = tY;\n m.b = tY;\n }\n return m;\n};\n\n/**\n * Creates a new `CSSMatrix` for the shear of the `x-axis` rotation matrix and\n * returns it. This method is equivalent to the CSS `skewX()` function.\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/skewX\n *\n * @param angle the angle in degrees.\n * @return the resulted matrix.\n */\nconst SkewX = (angle: number): CSSMatrix => {\n return Skew(angle, 0);\n};\n\n/**\n * Creates a new `CSSMatrix` for the shear of the `y-axis` rotation matrix and\n * returns it. This method is equivalent to the CSS `skewY()` function.\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/skewY\n *\n * @param angle the angle in degrees.\n * @return the resulted matrix.\n */\nconst SkewY = (angle: number): CSSMatrix => {\n return Skew(0, angle);\n};\n\n/**\n * Creates a new `CSSMatrix` resulted from the multiplication of two matrixes\n * and returns it. Both matrixes are not changed.\n *\n * @param m1 the first matrix.\n * @param m2 the second matrix.\n * @return the resulted matrix.\n */\nconst Multiply = (m1: CSSMatrix | DOMMatrix | JSONMatrix, m2: CSSMatrix | DOMMatrix | JSONMatrix): CSSMatrix => {\n const m11 = m2.m11 * m1.m11 + m2.m12 * m1.m21 + m2.m13 * m1.m31 + m2.m14 * m1.m41;\n const m12 = m2.m11 * m1.m12 + m2.m12 * m1.m22 + m2.m13 * m1.m32 + m2.m14 * m1.m42;\n const m13 = m2.m11 * m1.m13 + m2.m12 * m1.m23 + m2.m13 * m1.m33 + m2.m14 * m1.m43;\n const m14 = m2.m11 * m1.m14 + m2.m12 * m1.m24 + m2.m13 * m1.m34 + m2.m14 * m1.m44;\n\n const m21 = m2.m21 * m1.m11 + m2.m22 * m1.m21 + m2.m23 * m1.m31 + m2.m24 * m1.m41;\n const m22 = m2.m21 * m1.m12 + m2.m22 * m1.m22 + m2.m23 * m1.m32 + m2.m24 * m1.m42;\n const m23 = m2.m21 * m1.m13 + m2.m22 * m1.m23 + m2.m23 * m1.m33 + m2.m24 * m1.m43;\n const m24 = m2.m21 * m1.m14 + m2.m22 * m1.m24 + m2.m23 * m1.m34 + m2.m24 * m1.m44;\n\n const m31 = m2.m31 * m1.m11 + m2.m32 * m1.m21 + m2.m33 * m1.m31 + m2.m34 * m1.m41;\n const m32 = m2.m31 * m1.m12 + m2.m32 * m1.m22 + m2.m33 * m1.m32 + m2.m34 * m1.m42;\n const m33 = m2.m31 * m1.m13 + m2.m32 * m1.m23 + m2.m33 * m1.m33 + m2.m34 * m1.m43;\n const m34 = m2.m31 * m1.m14 + m2.m32 * m1.m24 + m2.m33 * m1.m34 + m2.m34 * m1.m44;\n\n const m41 = m2.m41 * m1.m11 + m2.m42 * m1.m21 + m2.m43 * m1.m31 + m2.m44 * m1.m41;\n const m42 = m2.m41 * m1.m12 + m2.m42 * m1.m22 + m2.m43 * m1.m32 + m2.m44 * m1.m42;\n const m43 = m2.m41 * m1.m13 + m2.m42 * m1.m23 + m2.m43 * m1.m33 + m2.m44 * m1.m43;\n const m44 = m2.m41 * m1.m14 + m2.m42 * m1.m24 + m2.m43 * m1.m34 + m2.m44 * m1.m44;\n\n return fromArray([m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44]);\n};\n\n/**\n * Creates and returns a new `DOMMatrix` compatible instance\n * with equivalent instance.\n *\n * @class CSSMatrix\n *\n * @author thednp <https://github.com/thednp/DOMMatrix/>\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrix\n */\nexport default class CSSMatrix {\n declare m11: number;\n declare m12: number;\n declare m13: number;\n declare m14: number;\n declare m21: number;\n declare m22: number;\n declare m23: number;\n declare m24: number;\n declare m31: number;\n declare m32: number;\n declare m33: number;\n declare m34: number;\n declare m41: number;\n declare m42: number;\n declare m43: number;\n declare m44: number;\n declare a: number;\n declare b: number;\n declare c: number;\n declare d: number;\n declare e: number;\n declare f: number;\n static Translate = Translate;\n static Rotate = Rotate;\n static RotateAxisAngle = RotateAxisAngle;\n static Scale = Scale;\n static SkewX = SkewX;\n static SkewY = SkewY;\n static Skew = Skew;\n static Multiply = Multiply;\n static fromArray = fromArray;\n static fromMatrix = fromMatrix;\n static fromString = fromString;\n static toArray = toArray;\n static isCompatibleArray = isCompatibleArray;\n static isCompatibleObject = isCompatibleObject;\n\n /**\n * @constructor\n * @param init accepts all parameter configurations:\n * * valid CSS transform string,\n * * CSSMatrix/DOMMatrix instance,\n * * a 6/16 elements *Array*.\n */\n constructor(init?: CSSMatrixInput) {\n // array 6\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.e = 0;\n this.f = 0;\n // array 16\n this.m11 = 1;\n this.m12 = 0;\n this.m13 = 0;\n this.m14 = 0;\n this.m21 = 0;\n this.m22 = 1;\n this.m23 = 0;\n this.m24 = 0;\n this.m31 = 0;\n this.m32 = 0;\n this.m33 = 1;\n this.m34 = 0;\n this.m41 = 0;\n this.m42 = 0;\n this.m43 = 0;\n this.m44 = 1;\n\n if (init) {\n return this.setMatrixValue(init);\n }\n return this;\n }\n\n /**\n * A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity\n * matrix is one in which every value is 0 except those on the main diagonal from top-left\n * to bottom-right corner (in other words, where the offsets in each direction are equal).\n *\n * @return the current property value\n */\n get isIdentity(): boolean {\n return (\n this.m11 === 1 &&\n this.m12 === 0 &&\n this.m13 === 0 &&\n this.m14 === 0 &&\n this.m21 === 0 &&\n this.m22 === 1 &&\n this.m23 === 0 &&\n this.m24 === 0 &&\n this.m31 === 0 &&\n this.m32 === 0 &&\n this.m33 === 1 &&\n this.m34 === 0 &&\n this.m41 === 0 &&\n this.m42 === 0 &&\n this.m43 === 0 &&\n this.m44 === 1\n );\n }\n\n /**\n * A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix\n * and `false` if the matrix is 3D.\n *\n * @return the current property value\n */\n get is2D(): boolean {\n return this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n\n /**\n * The `setMatrixValue` method replaces the existing matrix with one computed\n * in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`\n *\n * The method accepts any *Array* values, the result of\n * `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls\n * or `CSSMatrix` instance method `toArray()`.\n *\n * This method expects valid *matrix()* / *matrix3d()* string values, as well\n * as other transform functions like *translateX(10px)*.\n *\n * @param source\n * @return the matrix instance\n */\n setMatrixValue(source?: CSSMatrixInput): CSSMatrix {\n // CSS transform string source - TransformList first\n if (typeof source === 'string' && source.length && source !== 'none') {\n return fromString(source);\n }\n\n // [Array | Float[32/64]Array] come next\n if (Array.isArray(source) || source instanceof Float64Array || source instanceof Float32Array) {\n return fromArray(source);\n }\n\n // new CSSMatrix(CSSMatrix | DOMMatrix | JSONMatrix) last\n if (typeof source === 'object') {\n return fromMatrix(source);\n }\n\n return this;\n }\n\n /**\n * Returns a *Float32Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat32Array(is2D?: boolean): Float32Array {\n return Float32Array.from(toArray(this, is2D));\n }\n\n /**\n * Returns a *Float64Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat64Array(is2D?: boolean): Float64Array {\n return Float64Array.from(toArray(this, is2D));\n }\n\n /**\n * Creates and returns a string representation of the matrix in `CSS` matrix syntax,\n * using the appropriate `CSS` matrix notation.\n *\n * matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*\n * matrix *matrix(a, b, c, d, e, f)*\n *\n * @return a string representation of the matrix\n */\n toString(): string {\n const { is2D } = this;\n const values = this.toFloat64Array(is2D).join(', ');\n const type = is2D ? 'matrix' : 'matrix3d';\n return `${type}(${values})`;\n }\n\n /**\n * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*\n * that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well\n * as the `is2D` & `isIdentity` properties.\n *\n * The result can also be used as a second parameter for the `fromMatrix` static method\n * to load values into another matrix instance.\n *\n * @return an *Object* with all matrix values.\n */\n toJSON(): JSONMatrix {\n const { is2D, isIdentity } = this;\n return { ...this, is2D, isIdentity };\n }\n\n /**\n * The Multiply method returns a new CSSMatrix which is the result of this\n * matrix multiplied by the passed matrix, with the passed matrix to the right.\n * This matrix is not modified.\n *\n * @param m2 CSSMatrix\n * @return The resulted matrix.\n */\n multiply(m2: CSSMatrix | DOMMatrix | JSONMatrix): CSSMatrix {\n return Multiply(this, m2);\n }\n\n /**\n * The translate method returns a new matrix which is this matrix post\n * multiplied by a translation matrix containing the passed values. If the z\n * component is undefined, a 0 value is used in its place. This matrix is not\n * modified.\n *\n * @param x X component of the translation value.\n * @param y Y component of the translation value.\n * @param z Z component of the translation value.\n * @return The resulted matrix\n */\n translate(x: number, y?: number, z?: number): CSSMatrix {\n const X = x;\n let Y = y;\n let Z = z;\n if (typeof Y === 'undefined') Y = 0;\n if (typeof Z === 'undefined') Z = 0;\n return Multiply(this, Translate(X, Y, Z));\n }\n\n /**\n * The scale method returns a new matrix which is this matrix post multiplied by\n * a scale matrix containing the passed values. If the z component is undefined,\n * a 1 value is used in its place. If the y component is undefined, the x\n * component value is used in its place. This matrix is not modified.\n *\n * @param x The X component of the scale value.\n * @param y The Y component of the scale value.\n * @param z The Z component of the scale value.\n * @return The resulted matrix\n */\n scale(x: number, y?: number, z?: number): CSSMatrix {\n const X = x;\n let Y = y;\n let Z = z;\n if (typeof Y === 'undefined') Y = x;\n if (typeof Z === 'undefined') Z = 1; // Z must be 1 if undefined\n\n return Multiply(this, Scale(X, Y, Z));\n }\n\n /**\n * The rotate method returns a new matrix which is this matrix post multiplied\n * by each of 3 rotation matrices about the major axes, first X, then Y, then Z.\n * If the y and z components are undefined, the x value is used to rotate the\n * object about the z axis, as though the vector (0,0,x) were passed. All\n * rotation values are in degrees. This matrix is not modified.\n *\n * @param rx The X component of the rotation, or Z if Y and Z are null.\n * @param ry The (optional) Y component of the rotation value.\n * @param rz The (optional) Z component of the rotation value.\n * @return The resulted matrix\n */\n rotate(rx: number, ry?: number, rz?: number): CSSMatrix {\n let RX = rx;\n let RY = ry || 0;\n let RZ = rz || 0;\n\n if (typeof rx === 'number' && typeof ry === 'undefined' && typeof rz === 'undefined') {\n RZ = RX;\n RX = 0;\n RY = 0;\n }\n\n return Multiply(this, Rotate(RX, RY, RZ));\n }\n\n /**\n * The rotateAxisAngle method returns a new matrix which is this matrix post\n * multiplied by a rotation matrix with the given axis and `angle`. The right-hand\n * rule is used to determine the direction of rotation. All rotation values are\n * in degrees. This matrix is not modified.\n *\n * @param x The X component of the axis vector.\n * @param y The Y component of the axis vector.\n * @param z The Z component of the axis vector.\n * @param angle The angle of rotation about the axis vector, in degrees.\n * @return The resulted matrix\n */\n rotateAxisAngle(x: number, y: number, z: number, angle: number): CSSMatrix {\n if ([x, y, z, angle].some(n => Number.isNaN(+n))) {\n throw new TypeError('CSSMatrix: expecting 4 values');\n }\n return Multiply(this, RotateAxisAngle(x, y, z, angle));\n }\n\n /**\n * Specifies a skew transformation along the `x-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewX(angle: number): CSSMatrix {\n return Multiply(this, SkewX(angle));\n }\n\n /**\n * Specifies a skew transformation along the `y-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewY(angle: number): CSSMatrix {\n return Multiply(this, SkewY(angle));\n }\n\n /**\n * Specifies a skew transformation along both the `x-axis` and `y-axis`.\n * This matrix is not modified.\n *\n * @param angleX The X-angle amount in degrees to skew.\n * @param angleY The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skew(angleX: number, angleY: number): CSSMatrix {\n return Multiply(this, Skew(angleX, angleY));\n }\n\n /**\n * Transforms a specified vector using the matrix, returning a new\n * {x,y,z,w} Tuple *Object* comprising the transformed vector.\n * Neither the matrix nor the original vector are altered.\n *\n * The method is equivalent with `transformPoint()` method\n * of the `DOMMatrix` constructor.\n *\n * @param t Tuple with `{x,y,z,w}` components\n * @return the resulting Tuple\n */\n transformPoint(t: PointTuple | DOMPoint): PointTuple | DOMPoint {\n const x = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w;\n const y = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w;\n const z = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w;\n const w = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;\n\n return t instanceof DOMPoint\n ? new DOMPoint(x, y, z, w)\n : {\n x,\n y,\n z,\n w,\n };\n }\n}\n"],"names":["JSON_MATRIX","isCompatibleArray","array","x","isCompatibleObject","object","CSSMatrix","k","fromArray","m","a","m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44","M11","M12","M21","M22","M41","M42","fromMatrix","fromString","source","str","invalidStringError","f","tf","prop","value","components","n","y","z","xyz","xyza","values","sy","p","fn","axis","idx","def","axeValues","toArray","is2D","Translate","Rotate","rx","ry","rz","degToRad","radX","radY","radZ","cosx","sinx","cosy","siny","cosz","sinz","RotateAxisAngle","alpha","length","X","Y","Z","angle","sinA","cosA","sinA2","x2","y2","z2","Scale","Skew","angleX","angleY","tX","tY","SkewX","SkewY","Multiply","m1","m2","init","isIdentity","RX","RY","RZ","w","__publicField"],"mappings":";;;AAGA,MAAMA,IAA0B;AAAA,EAC9B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,YAAY;AACd,GAUMC,IAAoB,CAAC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,MAAM,EAAE,IAAI,KAAK,MAAM,EAAE,IAAI,KAAK,MAAM,EAAE,IAAI,KAAK,MAAM,EAAE,GACpEC,IAAI,KAAK,MAAM,EAAE,IAAI,KAAK,MAAM,EAAE,IAAI,KAAK,MAAM,EAAE,IAAI,KAAK,MAAM,EAAE,GACpEyD,IAAI,KAAK,MAAM,EAAE,IAAI,KAAK,MAAM,EAAE,IAAI,KAAK,MAAM,EAAE,IAAI,KAAK,MAAM,EAAE;AAEnE,WAAA,aAAa,WAChB,IAAI,SAASnG,GAAGyC,GAAGC,GAAGyD,CAAC,IACvB;AAAA,MACE,GAAAnG;AAAA,MACA,GAAAyC;AAAA,MACA,GAAAC;AAAA,MACA,GAAAyD;AAAA,IAAA;AAAA,EAER;AACF;AAlVEC,EAvBmBjG,GAuBZ,aAAYoD,IACnB6C,EAxBmBjG,GAwBZ,UAASqD,IAChB4C,EAzBmBjG,GAyBZ,mBAAkBmE,IACzB8B,EA1BmBjG,GA0BZ,SAAQgF,IACfiB,EA3BmBjG,GA2BZ,SAAQsF,IACfW,EA5BmBjG,GA4BZ,SAAQuF,IACfU,EA7BmBjG,GA6BZ,QAAOiF,IACdgB,EA9BmBjG,GA8BZ,YAAWwF,IAClBS,EA/BmBjG,GA+BZ,aAAYE,IACnB+F,EAhCmBjG,GAgCZ,cAAa2B,IACpBsE,EAjCmBjG,GAiCZ,cAAa4B,IACpBqE,EAlCmBjG,GAkCZ,WAAUkD,IACjB+C,EAnCmBjG,GAmCZ,qBAAoBL,IAC3BsG,EApCmBjG,GAoCZ,sBAAqBF;"}
1
+ {"version":3,"file":"dommatrix.mjs","sources":["../src/index.ts"],"sourcesContent":["import type { Matrix, Matrix3d, JSONMatrix, CSSMatrixInput, PointTuple } from './types';\n\n/** A model for JSONMatrix */\nconst JSON_MATRIX: JSONMatrix = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0,\n m11: 1,\n m12: 0,\n m13: 0,\n m14: 0,\n m21: 0,\n m22: 1,\n m23: 0,\n m24: 0,\n m31: 0,\n m32: 0,\n m33: 1,\n m34: 0,\n m41: 0,\n m42: 0,\n m43: 0,\n m44: 1,\n is2D: true,\n isIdentity: true,\n};\n\n// CSSMatrix Static methods\n// * `fromArray` is a more simple implementation, should also accept Float[32/64]Array;\n// * `fromMatrix` load values from another CSSMatrix/DOMMatrix instance or JSON object;\n// * `fromString` parses and loads values from any valid CSS transform string (TransformList).\n// * `isCompatibleArray` Checks if an array is compatible with CSSMatrix.\n// * `isCompatibleObject` Checks if an object is compatible with CSSMatrix.\n\n/** Checks if an array is compatible with CSSMatrix */\nconst isCompatibleArray = (array?: unknown): array is Matrix | Matrix3d | Float32Array | Float64Array => {\n return (\n (array instanceof Float64Array ||\n array instanceof Float32Array ||\n (Array.isArray(array) && array.every(x => typeof x === 'number'))) &&\n [6, 16].some(x => array.length === x)\n );\n};\n\n/** Checks if an object is compatible with CSSMatrix */\nconst isCompatibleObject = (object?: unknown): object is CSSMatrix | DOMMatrix | JSONMatrix => {\n return (\n object instanceof DOMMatrix ||\n object instanceof CSSMatrix ||\n (typeof object === 'object' && Object.keys(JSON_MATRIX).every(k => object && k in object))\n );\n};\n\n/**\n * Creates a new mutable `CSSMatrix` instance given an array of 16/6 floating point values.\n * This static method invalidates arrays that contain non-number elements.\n *\n * If the array has six values, the result is a 2D matrix; if the array has 16 values,\n * the result is a 3D matrix. Otherwise, a TypeError exception is thrown.\n *\n * @param array an `Array` to feed values from.\n * @return the resulted matrix.\n */\nconst fromArray = (array: any[] | Float32Array | Float64Array): CSSMatrix => {\n const m = new CSSMatrix();\n const a = Array.from(array);\n\n if (!isCompatibleArray(a)) {\n throw TypeError(`CSSMatrix: \"${a.join(',')}\" must be an array with 6/16 numbers.`);\n }\n if (a.length === 16) {\n const [m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44] = a;\n\n m.m11 = m11;\n m.a = m11;\n\n m.m21 = m21;\n m.c = m21;\n\n m.m31 = m31;\n\n m.m41 = m41;\n m.e = m41;\n\n m.m12 = m12;\n m.b = m12;\n\n m.m22 = m22;\n m.d = m22;\n\n m.m32 = m32;\n\n m.m42 = m42;\n m.f = m42;\n\n m.m13 = m13;\n m.m23 = m23;\n m.m33 = m33;\n m.m43 = m43;\n m.m14 = m14;\n m.m24 = m24;\n m.m34 = m34;\n m.m44 = m44;\n } else if (a.length === 6) {\n const [M11, M12, M21, M22, M41, M42] = a;\n\n m.m11 = M11;\n m.a = M11;\n\n m.m12 = M12;\n m.b = M12;\n\n m.m21 = M21;\n m.c = M21;\n\n m.m22 = M22;\n m.d = M22;\n\n m.m41 = M41;\n m.e = M41;\n\n m.m42 = M42;\n m.f = M42;\n }\n return m;\n};\n\n/**\n * Creates a new mutable `CSSMatrix` instance given an existing matrix or a\n * `DOMMatrix` instance which provides the values for its properties.\n *\n * @param m the source matrix to feed values from.\n * @return the resulted matrix.\n */\nconst fromMatrix = (m: CSSMatrix | DOMMatrix | JSONMatrix): CSSMatrix => {\n if (isCompatibleObject(m)) {\n return fromArray([\n m.m11,\n m.m12,\n m.m13,\n m.m14,\n m.m21,\n m.m22,\n m.m23,\n m.m24,\n m.m31,\n m.m32,\n m.m33,\n m.m34,\n m.m41,\n m.m42,\n m.m43,\n m.m44,\n ]);\n }\n throw TypeError(`CSSMatrix: \"${JSON.stringify(m)}\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);\n};\n\n/**\n * Creates a new mutable `CSSMatrix` given any valid CSS transform string,\n * or what we call `TransformList`:\n *\n * * `matrix(a, b, c, d, e, f)` - valid matrix() transform function\n * * `matrix3d(m11, m12, m13, ...m44)` - valid matrix3d() transform function\n * * `translate(tx, ty) rotateX(alpha)` - any valid transform function(s)\n *\n * @copyright thednp © 2021\n *\n * @param source valid CSS transform string syntax.\n * @return the resulted matrix.\n */\nconst fromString = (source: string): CSSMatrix => {\n if (typeof source !== 'string') {\n throw TypeError(`CSSMatrix: \"${JSON.stringify(source)}\" is not a string.`);\n }\n const str = String(source).replace(/\\s/g, '');\n let m = new CSSMatrix();\n const invalidStringError = `CSSMatrix: invalid transform string \"${source}\"`;\n\n // const px = ['perspective'];\n // const length = ['translate', 'translate3d', 'translateX', 'translateY', 'translateZ'];\n // const deg = ['rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'skew', 'skewX', 'skewY'];\n // const abs = ['scale', 'scale3d', 'matrix', 'matrix3d'];\n // const transformFunctions = px.concat(length, deg, abs);\n\n str\n .split(')')\n .filter(f => f)\n .forEach(tf => {\n const [prop, value] = tf.split('(');\n\n // invalidate empty string\n if (!value) throw TypeError(invalidStringError);\n\n const components = value\n .split(',')\n .map(n => (n.includes('rad') ? parseFloat(n) * (180 / Math.PI) : parseFloat(n)));\n\n const [x, y, z, a] = components;\n const xyz = [x, y, z];\n const xyza = [x, y, z, a];\n\n // single number value expected\n if (prop === 'perspective' && x && [y, z].every(n => n === undefined)) {\n m.m34 = -1 / x;\n // 6/16 number values expected\n } else if (\n prop.includes('matrix') &&\n [6, 16].includes(components.length) &&\n components.every(n => !Number.isNaN(+n))\n ) {\n const values = components.map(n => (Math.abs(n) < 1e-6 ? 0 : n));\n m = m.multiply(fromArray(values as Matrix | Matrix3d));\n // 3 values expected\n } else if (prop === 'translate3d' && xyz.every(n => !Number.isNaN(+n))) {\n m = m.translate(x, y, z);\n // single/double number value(s) expected\n } else if (prop === 'translate' && x && z === undefined) {\n m = m.translate(x, y || 0, 0);\n // all 4 values expected\n } else if (prop === 'rotate3d' && xyza.every(n => !Number.isNaN(+n)) && a) {\n m = m.rotateAxisAngle(x, y, z, a);\n // single value expected\n } else if (prop === 'rotate' && x && [y, z].every(n => n === undefined)) {\n m = m.rotate(0, 0, x);\n // 3 values expected\n } else if (prop === 'scale3d' && xyz.every(n => !Number.isNaN(+n)) && xyz.some(n => n !== 1)) {\n m = m.scale(x, y, z);\n // single value expected\n } else if (prop === 'scale' && !Number.isNaN(x) && x !== 1 && z === undefined) {\n const nosy = Number.isNaN(+y);\n const sy = nosy ? x : y;\n m = m.scale(x, sy, 1);\n // single/double value expected\n } else if (prop === 'skew' && (x || (!Number.isNaN(x) && y)) && z === undefined) {\n m = m.skew(x, y || 0);\n } else if (\n ['translate', 'rotate', 'scale', 'skew'].some(p => prop.includes(p)) &&\n /[XYZ]/.test(prop) &&\n x &&\n [y, z].every(n => n === undefined) // a single value expected\n ) {\n if ('skewX' === prop || 'skewY' === prop) {\n m = m[prop](x);\n } else {\n const fn = prop.replace(/[XYZ]/, '') as 'scale' | 'translate' | 'rotate';\n const axis = prop.replace(fn, '');\n const idx = ['X', 'Y', 'Z'].indexOf(axis);\n const def = fn === 'scale' ? 1 : 0;\n const axeValues: [number, number, number] = [idx === 0 ? x : def, idx === 1 ? x : def, idx === 2 ? x : def];\n m = m[fn](...axeValues);\n }\n } else {\n throw TypeError(invalidStringError);\n }\n });\n\n return m;\n};\n\n/**\n * Returns an *Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param m the source matrix to feed values from.\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\nconst toArray = (m: CSSMatrix | DOMMatrix | JSONMatrix, is2D?: boolean): Matrix | Matrix3d => {\n if (is2D) {\n return [m.a, m.b, m.c, m.d, m.e, m.f];\n }\n return [\n m.m11,\n m.m12,\n m.m13,\n m.m14,\n m.m21,\n m.m22,\n m.m23,\n m.m24,\n m.m31,\n m.m32,\n m.m33,\n m.m34,\n m.m41,\n m.m42,\n m.m43,\n m.m44,\n ];\n};\n\n// Transform Functions\n// https://www.w3.org/TR/css-transforms-1/#transform-functions\n\n/**\n * Creates a new `CSSMatrix` for the translation matrix and returns it.\n * This method is equivalent to the CSS `translate3d()` function.\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/translate3d\n *\n * @param x the `x-axis` position.\n * @param y the `y-axis` position.\n * @param z the `z-axis` position.\n * @return the resulted matrix.\n */\nconst Translate = (x: number, y: number, z: number): CSSMatrix => {\n const m = new CSSMatrix();\n m.m41 = x;\n m.e = x;\n m.m42 = y;\n m.f = y;\n m.m43 = z;\n return m;\n};\n\n/**\n * Creates a new `CSSMatrix` for the rotation matrix and returns it.\n *\n * http://en.wikipedia.org/wiki/Rotation_matrix\n *\n * @param rx the `x-axis` rotation.\n * @param ry the `y-axis` rotation.\n * @param rz the `z-axis` rotation.\n * @return the resulted matrix.\n */\nconst Rotate = (rx: number, ry: number, rz: number): CSSMatrix => {\n const m = new CSSMatrix();\n const degToRad = Math.PI / 180;\n const radX = rx * degToRad;\n const radY = ry * degToRad;\n const radZ = rz * degToRad;\n\n // minus sin() because of right-handed system\n const cosx = Math.cos(radX);\n const sinx = -Math.sin(radX);\n const cosy = Math.cos(radY);\n const siny = -Math.sin(radY);\n const cosz = Math.cos(radZ);\n const sinz = -Math.sin(radZ);\n\n const m11 = cosy * cosz;\n const m12 = -cosy * sinz;\n\n m.m11 = m11;\n m.a = m11;\n\n m.m12 = m12;\n m.b = m12;\n\n m.m13 = siny;\n\n const m21 = sinx * siny * cosz + cosx * sinz;\n m.m21 = m21;\n m.c = m21;\n\n const m22 = cosx * cosz - sinx * siny * sinz;\n m.m22 = m22;\n m.d = m22;\n\n m.m23 = -sinx * cosy;\n\n m.m31 = sinx * sinz - cosx * siny * cosz;\n m.m32 = sinx * cosz + cosx * siny * sinz;\n m.m33 = cosx * cosy;\n\n return m;\n};\n\n/**\n * Creates a new `CSSMatrix` for the rotation matrix and returns it.\n * This method is equivalent to the CSS `rotate3d()` function.\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate3d\n *\n * @param x the `x-axis` vector length.\n * @param y the `y-axis` vector length.\n * @param z the `z-axis` vector length.\n * @param alpha the value in degrees of the rotation.\n * @return the resulted matrix.\n */\nconst RotateAxisAngle = (x: number, y: number, z: number, alpha: number): CSSMatrix => {\n const m = new CSSMatrix();\n const length = Math.sqrt(x * x + y * y + z * z);\n\n if (length === 0) {\n // bad vector length, return identity\n return m;\n }\n\n const X = x / length;\n const Y = y / length;\n const Z = z / length;\n\n const angle = alpha * (Math.PI / 360);\n const sinA = Math.sin(angle);\n const cosA = Math.cos(angle);\n const sinA2 = sinA * sinA;\n const x2 = X * X;\n const y2 = Y * Y;\n const z2 = Z * Z;\n\n const m11 = 1 - 2 * (y2 + z2) * sinA2;\n m.m11 = m11;\n m.a = m11;\n\n const m12 = 2 * (X * Y * sinA2 + Z * sinA * cosA);\n m.m12 = m12;\n m.b = m12;\n\n m.m13 = 2 * (X * Z * sinA2 - Y * sinA * cosA);\n\n const m21 = 2 * (Y * X * sinA2 - Z * sinA * cosA);\n m.m21 = m21;\n m.c = m21;\n\n const m22 = 1 - 2 * (z2 + x2) * sinA2;\n m.m22 = m22;\n m.d = m22;\n\n m.m23 = 2 * (Y * Z * sinA2 + X * sinA * cosA);\n m.m31 = 2 * (Z * X * sinA2 + Y * sinA * cosA);\n m.m32 = 2 * (Z * Y * sinA2 - X * sinA * cosA);\n m.m33 = 1 - 2 * (x2 + y2) * sinA2;\n\n return m;\n};\n\n/**\n * Creates a new `CSSMatrix` for the scale matrix and returns it.\n * This method is equivalent to the CSS `scale3d()` function, except it doesn't\n * accept {x, y, z} transform origin parameters.\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale3d\n *\n * @param x the `x-axis` scale.\n * @param y the `y-axis` scale.\n * @param z the `z-axis` scale.\n * @return the resulted matrix.\n */\nconst Scale = (x: number, y: number, z: number): CSSMatrix => {\n const m = new CSSMatrix();\n m.m11 = x;\n m.a = x;\n\n m.m22 = y;\n m.d = y;\n\n m.m33 = z;\n return m;\n};\n\n/**\n * Creates a new `CSSMatrix` for the shear of both the `x-axis` and`y-axis`\n * matrix and returns it. This method is equivalent to the CSS `skew()` function.\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/skew\n *\n * @param angleX the X-angle in degrees.\n * @param angleY the Y-angle in degrees.\n * @return the resulted matrix.\n */\nconst Skew = (angleX: number, angleY: number): CSSMatrix => {\n const m = new CSSMatrix();\n if (angleX) {\n const radX = (angleX * Math.PI) / 180;\n const tX = Math.tan(radX);\n m.m21 = tX;\n m.c = tX;\n }\n if (angleY) {\n const radY = (angleY * Math.PI) / 180;\n const tY = Math.tan(radY);\n m.m12 = tY;\n m.b = tY;\n }\n return m;\n};\n\n/**\n * Creates a new `CSSMatrix` for the shear of the `x-axis` rotation matrix and\n * returns it. This method is equivalent to the CSS `skewX()` function.\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/skewX\n *\n * @param angle the angle in degrees.\n * @return the resulted matrix.\n */\nconst SkewX = (angle: number): CSSMatrix => {\n return Skew(angle, 0);\n};\n\n/**\n * Creates a new `CSSMatrix` for the shear of the `y-axis` rotation matrix and\n * returns it. This method is equivalent to the CSS `skewY()` function.\n *\n * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/skewY\n *\n * @param angle the angle in degrees.\n * @return the resulted matrix.\n */\nconst SkewY = (angle: number): CSSMatrix => {\n return Skew(0, angle);\n};\n\n/**\n * Creates a new `CSSMatrix` resulted from the multiplication of two matrixes\n * and returns it. Both matrixes are not changed.\n *\n * @param m1 the first matrix.\n * @param m2 the second matrix.\n * @return the resulted matrix.\n */\nconst Multiply = (m1: CSSMatrix | DOMMatrix | JSONMatrix, m2: CSSMatrix | DOMMatrix | JSONMatrix): CSSMatrix => {\n const m11 = m2.m11 * m1.m11 + m2.m12 * m1.m21 + m2.m13 * m1.m31 + m2.m14 * m1.m41;\n const m12 = m2.m11 * m1.m12 + m2.m12 * m1.m22 + m2.m13 * m1.m32 + m2.m14 * m1.m42;\n const m13 = m2.m11 * m1.m13 + m2.m12 * m1.m23 + m2.m13 * m1.m33 + m2.m14 * m1.m43;\n const m14 = m2.m11 * m1.m14 + m2.m12 * m1.m24 + m2.m13 * m1.m34 + m2.m14 * m1.m44;\n\n const m21 = m2.m21 * m1.m11 + m2.m22 * m1.m21 + m2.m23 * m1.m31 + m2.m24 * m1.m41;\n const m22 = m2.m21 * m1.m12 + m2.m22 * m1.m22 + m2.m23 * m1.m32 + m2.m24 * m1.m42;\n const m23 = m2.m21 * m1.m13 + m2.m22 * m1.m23 + m2.m23 * m1.m33 + m2.m24 * m1.m43;\n const m24 = m2.m21 * m1.m14 + m2.m22 * m1.m24 + m2.m23 * m1.m34 + m2.m24 * m1.m44;\n\n const m31 = m2.m31 * m1.m11 + m2.m32 * m1.m21 + m2.m33 * m1.m31 + m2.m34 * m1.m41;\n const m32 = m2.m31 * m1.m12 + m2.m32 * m1.m22 + m2.m33 * m1.m32 + m2.m34 * m1.m42;\n const m33 = m2.m31 * m1.m13 + m2.m32 * m1.m23 + m2.m33 * m1.m33 + m2.m34 * m1.m43;\n const m34 = m2.m31 * m1.m14 + m2.m32 * m1.m24 + m2.m33 * m1.m34 + m2.m34 * m1.m44;\n\n const m41 = m2.m41 * m1.m11 + m2.m42 * m1.m21 + m2.m43 * m1.m31 + m2.m44 * m1.m41;\n const m42 = m2.m41 * m1.m12 + m2.m42 * m1.m22 + m2.m43 * m1.m32 + m2.m44 * m1.m42;\n const m43 = m2.m41 * m1.m13 + m2.m42 * m1.m23 + m2.m43 * m1.m33 + m2.m44 * m1.m43;\n const m44 = m2.m41 * m1.m14 + m2.m42 * m1.m24 + m2.m43 * m1.m34 + m2.m44 * m1.m44;\n\n return fromArray([m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44]);\n};\n\n/**\n * Creates and returns a new `DOMMatrix` compatible instance\n * with equivalent instance.\n *\n * @class CSSMatrix\n *\n * @author thednp <https://github.com/thednp/DOMMatrix/>\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrix\n */\nexport default class CSSMatrix {\n declare m11: number;\n declare m12: number;\n declare m13: number;\n declare m14: number;\n declare m21: number;\n declare m22: number;\n declare m23: number;\n declare m24: number;\n declare m31: number;\n declare m32: number;\n declare m33: number;\n declare m34: number;\n declare m41: number;\n declare m42: number;\n declare m43: number;\n declare m44: number;\n declare a: number;\n declare b: number;\n declare c: number;\n declare d: number;\n declare e: number;\n declare f: number;\n static Translate = Translate;\n static Rotate = Rotate;\n static RotateAxisAngle = RotateAxisAngle;\n static Scale = Scale;\n static SkewX = SkewX;\n static SkewY = SkewY;\n static Skew = Skew;\n static Multiply = Multiply;\n static fromArray = fromArray;\n static fromMatrix = fromMatrix;\n static fromString = fromString;\n static toArray = toArray;\n static isCompatibleArray = isCompatibleArray;\n static isCompatibleObject = isCompatibleObject;\n\n /**\n * @constructor\n * @param init accepts all parameter configurations:\n * * valid CSS transform string,\n * * CSSMatrix/DOMMatrix instance,\n * * a 6/16 elements *Array*.\n */\n constructor(init?: CSSMatrixInput) {\n // array 6\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.e = 0;\n this.f = 0;\n // array 16\n this.m11 = 1;\n this.m12 = 0;\n this.m13 = 0;\n this.m14 = 0;\n this.m21 = 0;\n this.m22 = 1;\n this.m23 = 0;\n this.m24 = 0;\n this.m31 = 0;\n this.m32 = 0;\n this.m33 = 1;\n this.m34 = 0;\n this.m41 = 0;\n this.m42 = 0;\n this.m43 = 0;\n this.m44 = 1;\n\n if (init) {\n return this.setMatrixValue(init);\n }\n return this;\n }\n\n /**\n * A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity\n * matrix is one in which every value is 0 except those on the main diagonal from top-left\n * to bottom-right corner (in other words, where the offsets in each direction are equal).\n *\n * @return the current property value\n */\n get isIdentity(): boolean {\n return (\n this.m11 === 1 &&\n this.m12 === 0 &&\n this.m13 === 0 &&\n this.m14 === 0 &&\n this.m21 === 0 &&\n this.m22 === 1 &&\n this.m23 === 0 &&\n this.m24 === 0 &&\n this.m31 === 0 &&\n this.m32 === 0 &&\n this.m33 === 1 &&\n this.m34 === 0 &&\n this.m41 === 0 &&\n this.m42 === 0 &&\n this.m43 === 0 &&\n this.m44 === 1\n );\n }\n\n /**\n * A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix\n * and `false` if the matrix is 3D.\n *\n * @return the current property value\n */\n get is2D(): boolean {\n return this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n\n /**\n * The `setMatrixValue` method replaces the existing matrix with one computed\n * in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`\n *\n * The method accepts any *Array* values, the result of\n * `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls\n * or `CSSMatrix` instance method `toArray()`.\n *\n * This method expects valid *matrix()* / *matrix3d()* string values, as well\n * as other transform functions like *translateX(10px)*.\n *\n * @param source\n * @return the matrix instance\n */\n setMatrixValue(source?: CSSMatrixInput): CSSMatrix {\n // CSS transform string source - TransformList first\n if (typeof source === 'string' && source.length && source !== 'none') {\n return fromString(source);\n }\n\n // [Array | Float[32/64]Array] come next\n if (Array.isArray(source) || source instanceof Float64Array || source instanceof Float32Array) {\n return fromArray(source);\n }\n\n // new CSSMatrix(CSSMatrix | DOMMatrix | JSONMatrix) last\n if (typeof source === 'object') {\n return fromMatrix(source);\n }\n\n return this;\n }\n\n /**\n * Returns a *Float32Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat32Array(is2D?: boolean): Float32Array {\n return Float32Array.from(toArray(this, is2D));\n }\n\n /**\n * Returns a *Float64Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat64Array(is2D?: boolean): Float64Array {\n return Float64Array.from(toArray(this, is2D));\n }\n\n /**\n * Creates and returns a string representation of the matrix in `CSS` matrix syntax,\n * using the appropriate `CSS` matrix notation.\n *\n * matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*\n * matrix *matrix(a, b, c, d, e, f)*\n *\n * @return a string representation of the matrix\n */\n toString(): string {\n const { is2D } = this;\n const values = this.toFloat64Array(is2D).join(', ');\n const type = is2D ? 'matrix' : 'matrix3d';\n return `${type}(${values})`;\n }\n\n /**\n * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*\n * that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well\n * as the `is2D` & `isIdentity` properties.\n *\n * The result can also be used as a second parameter for the `fromMatrix` static method\n * to load values into another matrix instance.\n *\n * @return an *Object* with all matrix values.\n */\n toJSON(): JSONMatrix {\n const { is2D, isIdentity } = this;\n return { ...this, is2D, isIdentity };\n }\n\n /**\n * The Multiply method returns a new CSSMatrix which is the result of this\n * matrix multiplied by the passed matrix, with the passed matrix to the right.\n * This matrix is not modified.\n *\n * @param m2 CSSMatrix\n * @return The resulted matrix.\n */\n multiply(m2: CSSMatrix | DOMMatrix | JSONMatrix): CSSMatrix {\n return Multiply(this, m2);\n }\n\n /**\n * The translate method returns a new matrix which is this matrix post\n * multiplied by a translation matrix containing the passed values. If the z\n * component is undefined, a 0 value is used in its place. This matrix is not\n * modified.\n *\n * @param x X component of the translation value.\n * @param y Y component of the translation value.\n * @param z Z component of the translation value.\n * @return The resulted matrix\n */\n translate(x: number, y?: number, z?: number): CSSMatrix {\n const X = x;\n let Y = y;\n let Z = z;\n if (typeof Y === 'undefined') Y = 0;\n if (typeof Z === 'undefined') Z = 0;\n return Multiply(this, Translate(X, Y, Z));\n }\n\n /**\n * The scale method returns a new matrix which is this matrix post multiplied by\n * a scale matrix containing the passed values. If the z component is undefined,\n * a 1 value is used in its place. If the y component is undefined, the x\n * component value is used in its place. This matrix is not modified.\n *\n * @param x The X component of the scale value.\n * @param y The Y component of the scale value.\n * @param z The Z component of the scale value.\n * @return The resulted matrix\n */\n scale(x: number, y?: number, z?: number): CSSMatrix {\n const X = x;\n let Y = y;\n let Z = z;\n if (typeof Y === 'undefined') Y = x;\n if (typeof Z === 'undefined') Z = 1; // Z must be 1 if undefined\n\n return Multiply(this, Scale(X, Y, Z));\n }\n\n /**\n * The rotate method returns a new matrix which is this matrix post multiplied\n * by each of 3 rotation matrices about the major axes, first X, then Y, then Z.\n * If the y and z components are undefined, the x value is used to rotate the\n * object about the z axis, as though the vector (0,0,x) were passed. All\n * rotation values are in degrees. This matrix is not modified.\n *\n * @param rx The X component of the rotation, or Z if Y and Z are null.\n * @param ry The (optional) Y component of the rotation value.\n * @param rz The (optional) Z component of the rotation value.\n * @return The resulted matrix\n */\n rotate(rx: number, ry?: number, rz?: number): CSSMatrix {\n let RX = rx;\n let RY = ry || 0;\n let RZ = rz || 0;\n\n if (typeof rx === 'number' && typeof ry === 'undefined' && typeof rz === 'undefined') {\n RZ = RX;\n RX = 0;\n RY = 0;\n }\n\n return Multiply(this, Rotate(RX, RY, RZ));\n }\n\n /**\n * The rotateAxisAngle method returns a new matrix which is this matrix post\n * multiplied by a rotation matrix with the given axis and `angle`. The right-hand\n * rule is used to determine the direction of rotation. All rotation values are\n * in degrees. This matrix is not modified.\n *\n * @param x The X component of the axis vector.\n * @param y The Y component of the axis vector.\n * @param z The Z component of the axis vector.\n * @param angle The angle of rotation about the axis vector, in degrees.\n * @return The resulted matrix\n */\n rotateAxisAngle(x: number, y: number, z: number, angle: number): CSSMatrix {\n if ([x, y, z, angle].some(n => Number.isNaN(+n))) {\n throw new TypeError('CSSMatrix: expecting 4 values');\n }\n return Multiply(this, RotateAxisAngle(x, y, z, angle));\n }\n\n /**\n * Specifies a skew transformation along the `x-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewX(angle: number): CSSMatrix {\n return Multiply(this, SkewX(angle));\n }\n\n /**\n * Specifies a skew transformation along the `y-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewY(angle: number): CSSMatrix {\n return Multiply(this, SkewY(angle));\n }\n\n /**\n * Specifies a skew transformation along both the `x-axis` and `y-axis`.\n * This matrix is not modified.\n *\n * @param angleX The X-angle amount in degrees to skew.\n * @param angleY The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skew(angleX: number, angleY: number): CSSMatrix {\n return Multiply(this, Skew(angleX, angleY));\n }\n\n /**\n * Transforms a specified vector using the matrix, returning a new\n * {x,y,z,w} Tuple *Object* comprising the transformed vector.\n * Neither the matrix nor the original vector are altered.\n *\n * The method is equivalent with `transformPoint()` method\n * of the `DOMMatrix` constructor.\n *\n * @param t Tuple with `{x,y,z,w}` components\n * @return the resulting Tuple\n */\n transformPoint(t: PointTuple | DOMPoint): PointTuple | DOMPoint {\n const x = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w;\n const y = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w;\n const z = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w;\n const w = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;\n\n return t instanceof DOMPoint\n ? new DOMPoint(x, y, z, w)\n : {\n x,\n y,\n z,\n w,\n };\n }\n}\n"],"names":["JSON_MATRIX","isCompatibleArray","array","x","isCompatibleObject","object","CSSMatrix","k","fromArray","m","a","m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44","M11","M12","M21","M22","M41","M42","fromMatrix","fromString","source","str","invalidStringError","f","tf","prop","value","components","n","y","z","xyz","xyza","values","sy","p","fn","axis","idx","def","axeValues","toArray","is2D","Translate","Rotate","rx","ry","rz","degToRad","radX","radY","radZ","cosx","sinx","cosy","siny","cosz","sinz","RotateAxisAngle","alpha","length","X","Y","Z","angle","sinA","cosA","sinA2","x2","y2","z2","Scale","Skew","angleX","angleY","tX","tY","SkewX","SkewY","Multiply","m1","m2","init","isIdentity","RX","RY","RZ","w","__publicField"],"mappings":";;;AAGA,MAAMA,IAA0B;AAAA,EAC9B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAA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SMatrix',
9
+ noBanner: true,
10
+ }
11
+ },
12
+ ],
13
+ };
14
+
15
+ module.exports = config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thednp/dommatrix",
3
- "version": "2.0.0-alpha3",
3
+ "version": "2.0.0",
4
4
  "description": "TypeScript shim for DOMMatrix",
5
5
  "homepage": "https://thednp.github.io/dommatrix/",
6
6
  "author": "thednp",
@@ -8,18 +8,8 @@
8
8
  "source": "src/index.ts",
9
9
  "main": "dist/dommatrix.js",
10
10
  "module": "dist/dommatrix.mjs",
11
+ "esmodule": "dist/dommatrix.mjs",
11
12
  "types": "dist/dommatrix.d.ts",
12
- "exports": {
13
- ".": {
14
- "import": "./dist/dommatrix.mjs",
15
- "require": "./dist/dommatrix.cjs",
16
- "types": "./dist/dommatrix.d.ts"
17
- }
18
- },
19
- "files": [
20
- "dist",
21
- "src"
22
- ],
23
13
  "scripts": {
24
14
  "pre-test": "npm run clean-coverage",
25
15
  "test": "npm run pre-test && npx cypress run",
@@ -61,8 +51,8 @@
61
51
  "@types/istanbul-lib-instrument": "^1.7.4",
62
52
  "@typescript-eslint/eslint-plugin": "^5.47.0",
63
53
  "@typescript-eslint/parser": "^5.47.0",
64
- "cypress": "^12.2.0",
65
- "dts-bundle-generator": "^7.1.0",
54
+ "cypress": "^12.4.1",
55
+ "dts-bundle-generator": "^7.2.0",
66
56
  "eslint": "^8.30.0",
67
57
  "eslint-plugin-jsdoc": "^39.6.4",
68
58
  "eslint-plugin-prefer-arrow": "^1.2.3",
@@ -71,9 +61,9 @@
71
61
  "istanbul-lib-instrument": "^5.2.1",
72
62
  "ncp": "^2.0.0",
73
63
  "nyc": "^15.1.0",
74
- "prettier": "^2.8.1",
64
+ "prettier": "^2.8.3",
75
65
  "rimraf": "^3.0.2",
76
66
  "typescript": "^4.9.4",
77
- "vite": "^4.0.3"
67
+ "vite": "^4.0.4"
78
68
  }
79
69
  }
package/tsconfig.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ // https://janessagarrow.com/blog/typescript-and-esbuild/
3
+ "compilerOptions": {
4
+ "lib": ["DOM", "ESNext", "DOM.Iterable"],
5
+ "types": ["vite", "vite/client", "cypress"],
6
+ "rootDir": "./src",
7
+ "baseUrl": "./",
8
+ "module": "ESNext",
9
+ "target": "ESNext",
10
+ "moduleResolution": "Node",
11
+ "allowJs": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "useDefineForClassFields": true,
14
+ "strict": true,
15
+ "sourceMap": true,
16
+ "resolveJsonModule": true,
17
+ "esModuleInterop": true,
18
+ "isolatedModules": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "noImplicitReturns": true,
22
+ "removeComments": false,
23
+ "allowSyntheticDefaultImports": true,
24
+ "noEmit": true,
25
+ "checkJs": true
26
+ },
27
+ "include": ["src/*"],
28
+ "exclude": ["node_modules", "experiments", "coverage"],
29
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,30 @@
1
+ import {resolve} from 'path';
2
+ import { defineConfig } from 'vite';
3
+ import { name } from './package.json';
4
+
5
+ const getPackageName = () => {
6
+ return name.includes('@') ? name.split('/')[1] : name;
7
+ };
8
+
9
+ const NAME = 'CSSMatrix';
10
+
11
+ const fileName = {
12
+ es: `${getPackageName()}.mjs`,
13
+ cjs: `${getPackageName()}.cjs`,
14
+ iife: `${getPackageName()}.js`,
15
+ };
16
+
17
+ export default defineConfig({
18
+ base: './',
19
+ build: {
20
+ emptyOutDir: true,
21
+ outDir: 'dist',
22
+ lib: {
23
+ entry: resolve(__dirname, 'src/index.ts'),
24
+ name: NAME,
25
+ formats: ['es', 'cjs', 'iife'],
26
+ fileName: (format: string) => fileName[format],
27
+ },
28
+ sourcemap: true,
29
+ },
30
+ });