diff --git a/README.md b/README.md index cc0f87e..952841c 100755 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![ci](https://github.com/thednp/dommatrix/actions/workflows/ci.yml/badge.svg)](https://github.com/thednp/dommatrix/actions/workflows/ci.yml) [![jsDeliver](https://data.jsdelivr.com/v1/package/npm/@thednp/dommatrix/badge)](https://www.jsdelivr.com/package/npm/@thednp/dommatrix) [![typescript version](https://img.shields.io/badge/typescript-5.7.2-brightgreen)](https://www.typescriptlang.org/) -[![vitest version](https://img.shields.io/badge/vitest-2.1.5-brightgreen)](https://vitest.dev/) +[![vitest version](https://img.shields.io/badge/vitest-2.1.8-brightgreen)](https://vitest.dev/) [![vite version](https://img.shields.io/badge/vite-5.4.11-brightgreen)](https://vitejs.dev/) A TypeScript sourced [DOMMatrix](https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrix) shim for **Node.js** apps and legacy browsers. Since this source is modernized, legacy browsers might need some additional shims. diff --git a/dist/dommatrix.cjs b/dist/dommatrix.cjs index 98df5a6..f7c3bb2 100644 --- a/dist/dommatrix.cjs +++ b/dist/dommatrix.cjs @@ -1,3 +1,3 @@ "use strict";var Z=Object.defineProperty;var z=(s,t,e)=>t in s?Z(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var p=(s,t,e)=>z(s,typeof t!="symbol"?t+"":t,e);const $={a:1,b:0,c:0,d:1,e:0,f:0,m11:1,m12:0,m13:0,m14:0,m21:0,m22:1,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,m41:0,m42:0,m43:0,m44:1,is2D:!0,isIdentity:!0},E=s=>(s instanceof Float64Array||s instanceof Float32Array||Array.isArray(s)&&s.every(t=>typeof t=="number"))&&[6,16].some(t=>s.length===t),P=s=>s instanceof DOMMatrix||s instanceof y||typeof s=="object"&&Object.keys($).every(t=>s&&t in s),g=s=>{const t=new y,e=Array.from(s);if(!E(e))throw TypeError(`CSSMatrix: "${e.join(",")}" must be an array with 6/16 numbers.`);// istanbul ignore else @preserve -if(e.length===16){const[n,i,r,a,l,m,h,c,u,f,w,o,d,A,M,b]=e;t.m11=n,t.a=n,t.m21=l,t.c=l,t.m31=u,t.m41=d,t.e=d,t.m12=i,t.b=i,t.m22=m,t.d=m,t.m32=f,t.m42=A,t.f=A,t.m13=r,t.m23=h,t.m33=w,t.m43=M,t.m14=a,t.m24=c,t.m34=o,t.m44=b}else if(e.length===6){const[n,i,r,a,l,m]=e;t.m11=n,t.a=n,t.m12=i,t.b=i,t.m21=r,t.c=r,t.m22=a,t.d=a,t.m41=l,t.e=l,t.m42=m,t.f=m}return t},X=s=>{if(P(s))return g([s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},O=s=>{if(typeof s!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a string.`);const t=String(s).replace(/\s/g,"");let e=new y;const n=`CSSMatrix: invalid transform string "${s}"`;return t.split(")").filter(i=>i).forEach(i=>{const[r,a]=i.split("(");if(!a)throw TypeError(n);const l=a.split(",").map(o=>o.includes("rad")?parseFloat(o)*(180/Math.PI):parseFloat(o)),[m,h,c,u]=l,f=[m,h,c],w=[m,h,c,u];if(r==="perspective"&&m&&[h,c].every(o=>o===void 0))e.m34=-1/m;else if(r.includes("matrix")&&[6,16].includes(l.length)&&l.every(o=>!Number.isNaN(+o))){const o=l.map(d=>Math.abs(d)<1e-6?0:d);e=e.multiply(g(o))}else if(r==="translate3d"&&f.every(o=>!Number.isNaN(+o)))e=e.translate(m,h,c);else if(r==="translate"&&m&&c===void 0)e=e.translate(m,h||0,0);else if(r==="rotate3d"&&w.every(o=>!Number.isNaN(+o))&&u)e=e.rotateAxisAngle(m,h,c,u);else if(r==="rotate"&&m&&[h,c].every(o=>o===void 0))e=e.rotate(0,0,m);else if(r==="scale3d"&&f.every(o=>!Number.isNaN(+o))&&f.some(o=>o!==1))e=e.scale(m,h,c);else if(r==="scale"&&!Number.isNaN(m)&&m!==1&&c===void 0){const d=Number.isNaN(+h)?m:h;e=e.scale(m,d,1)}else if(r==="skew"&&(m||!Number.isNaN(m)&&h)&&c===void 0)e=e.skew(m,h||0);else if(["translate","rotate","scale","skew"].some(o=>r.includes(o))&&/[XYZ]/.test(r)&&m&&[h,c].every(o=>o===void 0))if(r==="skewX"||r==="skewY")e=e[r](m);else{const o=r.replace(/[XYZ]/,""),d=r.replace(o,""),A=["X","Y","Z"].indexOf(d),M=o==="scale"?1:0,b=[A===0?m:M,A===1?m:M,A===2?m:M];e=e[o](...b)}else throw TypeError(n)}),e},x=(s,t)=>t?[s.a,s.b,s.c,s.d,s.e,s.f]:[s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44],Y=(s,t,e)=>{const n=new y;return n.m41=s,n.e=s,n.m42=t,n.f=t,n.m43=e,n},F=(s,t,e)=>{const n=new y,i=Math.PI/180,r=s*i,a=t*i,l=e*i,m=Math.cos(r),h=-Math.sin(r),c=Math.cos(a),u=-Math.sin(a),f=Math.cos(l),w=-Math.sin(l),o=c*f,d=-c*w;n.m11=o,n.a=o,n.m12=d,n.b=d,n.m13=u;const A=h*u*f+m*w;n.m21=A,n.c=A;const M=m*f-h*u*w;return n.m22=M,n.d=M,n.m23=-h*c,n.m31=h*w-m*u*f,n.m32=h*f+m*u*w,n.m33=m*c,n},T=(s,t,e,n)=>{const i=new y,r=Math.sqrt(s*s+t*t+e*e);if(r===0)return i;const a=s/r,l=t/r,m=e/r,h=n*(Math.PI/360),c=Math.sin(h),u=Math.cos(h),f=c*c,w=a*a,o=l*l,d=m*m,A=1-2*(o+d)*f;i.m11=A,i.a=A;const M=2*(a*l*f+m*c*u);i.m12=M,i.b=M,i.m13=2*(a*m*f-l*c*u);const b=2*(l*a*f-m*c*u);i.m21=b,i.c=b;const k=1-2*(d+w)*f;return i.m22=k,i.d=k,i.m23=2*(l*m*f+a*c*u),i.m31=2*(m*a*f+l*c*u),i.m32=2*(m*l*f-a*c*u),i.m33=1-2*(w+o)*f,i},I=(s,t,e)=>{const n=new y;return n.m11=s,n.a=s,n.m22=t,n.d=t,n.m33=e,n},v=(s,t)=>{const e=new y;if(s){const n=s*Math.PI/180,i=Math.tan(n);e.m21=i,e.c=i}if(t){const n=t*Math.PI/180,i=Math.tan(n);e.m12=i,e.b=i}return e},R=s=>v(s,0),D=s=>v(0,s),N=(s,t)=>{const e=t.m11*s.m11+t.m12*s.m21+t.m13*s.m31+t.m14*s.m41,n=t.m11*s.m12+t.m12*s.m22+t.m13*s.m32+t.m14*s.m42,i=t.m11*s.m13+t.m12*s.m23+t.m13*s.m33+t.m14*s.m43,r=t.m11*s.m14+t.m12*s.m24+t.m13*s.m34+t.m14*s.m44,a=t.m21*s.m11+t.m22*s.m21+t.m23*s.m31+t.m24*s.m41,l=t.m21*s.m12+t.m22*s.m22+t.m23*s.m32+t.m24*s.m42,m=t.m21*s.m13+t.m22*s.m23+t.m23*s.m33+t.m24*s.m43,h=t.m21*s.m14+t.m22*s.m24+t.m23*s.m34+t.m24*s.m44,c=t.m31*s.m11+t.m32*s.m21+t.m33*s.m31+t.m34*s.m41,u=t.m31*s.m12+t.m32*s.m22+t.m33*s.m32+t.m34*s.m42,f=t.m31*s.m13+t.m32*s.m23+t.m33*s.m33+t.m34*s.m43,w=t.m31*s.m14+t.m32*s.m24+t.m33*s.m34+t.m34*s.m44,o=t.m41*s.m11+t.m42*s.m21+t.m43*s.m31+t.m44*s.m41,d=t.m41*s.m12+t.m42*s.m22+t.m43*s.m32+t.m44*s.m42,A=t.m41*s.m13+t.m42*s.m23+t.m43*s.m33+t.m44*s.m43,M=t.m41*s.m14+t.m42*s.m24+t.m43*s.m34+t.m44*s.m44;return g([e,n,i,r,a,l,m,h,c,u,f,w,o,d,A,M])};class y{constructor(t){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}get isIdentity(){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}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){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}toFloat32Array(t){return Float32Array.from(x(this,t))}toFloat64Array(t){return Float64Array.from(x(this,t))}toString(){const{is2D:t}=this,e=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${e})`}toJSON(){const{is2D:t,isIdentity:e}=this;return{...this,is2D:t,isIdentity:e}}multiply(t){return N(this,t)}translate(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=0),typeof a>"u"&&(a=0),N(this,Y(i,r,a))}scale(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=t),typeof a>"u"&&(a=1),N(this,I(i,r,a))}rotate(t,e,n){let i=t,r=e||0,a=n||0;return typeof t=="number"&&typeof e>"u"&&typeof n>"u"&&(a=i,i=0,r=0),N(this,F(i,r,a))}rotateAxisAngle(t,e,n,i){if([t,e,n,i].some(r=>Number.isNaN(+r)))throw new TypeError("CSSMatrix: expecting 4 values");return N(this,T(t,e,n,i))}skewX(t){return N(this,R(t))}skewY(t){return N(this,D(t))}skew(t,e){return N(this,v(t,e))}transformPoint(t){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;return t instanceof DOMPoint?new DOMPoint(e,n,i,r):{x:e,y:n,z:i,w:r}}}p(y,"Translate",Y),p(y,"Rotate",F),p(y,"RotateAxisAngle",T),p(y,"Scale",I),p(y,"SkewX",R),p(y,"SkewY",D),p(y,"Skew",v),p(y,"Multiply",N),p(y,"fromArray",g),p(y,"fromMatrix",X),p(y,"fromString",O),p(y,"toArray",x),p(y,"isCompatibleArray",E),p(y,"isCompatibleObject",P);module.exports=y; +if(e.length===16){const[n,i,r,a,l,m,h,c,u,f,w,o,d,A,M,b]=e;t.m11=n,t.a=n,t.m21=l,t.c=l,t.m31=u,t.m41=d,t.e=d,t.m12=i,t.b=i,t.m22=m,t.d=m,t.m32=f,t.m42=A,t.f=A,t.m13=r,t.m23=h,t.m33=w,t.m43=M,t.m14=a,t.m24=c,t.m34=o,t.m44=b}else if(e.length===6){const[n,i,r,a,l,m]=e;t.m11=n,t.a=n,t.m12=i,t.b=i,t.m21=r,t.c=r,t.m22=a,t.d=a,t.m41=l,t.e=l,t.m42=m,t.f=m}return t},X=s=>{if(P(s))return g([s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},O=s=>{if(typeof s!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a string.`);const t=String(s).replace(/\s/g,"");let e=new y;const n=`CSSMatrix: invalid transform string "${s}"`;return t.split(")").filter(i=>i).forEach(i=>{const[r,a]=i.split("(");if(!a)throw TypeError(n);const l=a.split(",").map(o=>o.includes("rad")?parseFloat(o)*(180/Math.PI):parseFloat(o)),[m,h,c,u]=l,f=[m,h,c],w=[m,h,c,u];if(r==="perspective"&&m&&[h,c].every(o=>o===void 0))e.m34=-1/m;else if(r.includes("matrix")&&[6,16].includes(l.length)&&l.every(o=>!Number.isNaN(+o))){const o=l.map(d=>Math.abs(d)<1e-6?0:d);e=e.multiply(g(o))}else if(r==="translate3d"&&f.every(o=>!Number.isNaN(+o)))e=e.translate(m,h,c);else if(r==="translate"&&m&&c===void 0)e=e.translate(m,h||0,0);else if(r==="rotate3d"&&w.every(o=>!Number.isNaN(+o))&&u)e=e.rotateAxisAngle(m,h,c,u);else if(r==="rotate"&&m&&[h,c].every(o=>o===void 0))e=e.rotate(0,0,m);else if(r==="scale3d"&&f.every(o=>!Number.isNaN(+o))&&f.some(o=>o!==1))e=e.scale(m,h,c);else if(r==="scale"&&!Number.isNaN(m)&&[m,h].some(o=>o!==1)&&c===void 0){const d=Number.isNaN(+h)?m:h;e=e.scale(m,d,1)}else if(r==="skew"&&(m||!Number.isNaN(m)&&h)&&c===void 0)e=e.skew(m,h||0);else if(["translate","rotate","scale","skew"].some(o=>r.includes(o))&&/[XYZ]/.test(r)&&m&&[h,c].every(o=>o===void 0))if(r==="skewX"||r==="skewY")e=e[r](m);else{const o=r.replace(/[XYZ]/,""),d=r.replace(o,""),A=["X","Y","Z"].indexOf(d),M=o==="scale"?1:0,b=[A===0?m:M,A===1?m:M,A===2?m:M];e=e[o](...b)}else throw TypeError(n)}),e},x=(s,t)=>t?[s.a,s.b,s.c,s.d,s.e,s.f]:[s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44],Y=(s,t,e)=>{const n=new y;return n.m41=s,n.e=s,n.m42=t,n.f=t,n.m43=e,n},F=(s,t,e)=>{const n=new y,i=Math.PI/180,r=s*i,a=t*i,l=e*i,m=Math.cos(r),h=-Math.sin(r),c=Math.cos(a),u=-Math.sin(a),f=Math.cos(l),w=-Math.sin(l),o=c*f,d=-c*w;n.m11=o,n.a=o,n.m12=d,n.b=d,n.m13=u;const A=h*u*f+m*w;n.m21=A,n.c=A;const M=m*f-h*u*w;return n.m22=M,n.d=M,n.m23=-h*c,n.m31=h*w-m*u*f,n.m32=h*f+m*u*w,n.m33=m*c,n},T=(s,t,e,n)=>{const i=new y,r=Math.sqrt(s*s+t*t+e*e);if(r===0)return i;const a=s/r,l=t/r,m=e/r,h=n*(Math.PI/360),c=Math.sin(h),u=Math.cos(h),f=c*c,w=a*a,o=l*l,d=m*m,A=1-2*(o+d)*f;i.m11=A,i.a=A;const M=2*(a*l*f+m*c*u);i.m12=M,i.b=M,i.m13=2*(a*m*f-l*c*u);const b=2*(l*a*f-m*c*u);i.m21=b,i.c=b;const k=1-2*(d+w)*f;return i.m22=k,i.d=k,i.m23=2*(l*m*f+a*c*u),i.m31=2*(m*a*f+l*c*u),i.m32=2*(m*l*f-a*c*u),i.m33=1-2*(w+o)*f,i},I=(s,t,e)=>{const n=new y;return n.m11=s,n.a=s,n.m22=t,n.d=t,n.m33=e,n},v=(s,t)=>{const e=new y;if(s){const n=s*Math.PI/180,i=Math.tan(n);e.m21=i,e.c=i}if(t){const n=t*Math.PI/180,i=Math.tan(n);e.m12=i,e.b=i}return e},R=s=>v(s,0),D=s=>v(0,s),N=(s,t)=>{const e=t.m11*s.m11+t.m12*s.m21+t.m13*s.m31+t.m14*s.m41,n=t.m11*s.m12+t.m12*s.m22+t.m13*s.m32+t.m14*s.m42,i=t.m11*s.m13+t.m12*s.m23+t.m13*s.m33+t.m14*s.m43,r=t.m11*s.m14+t.m12*s.m24+t.m13*s.m34+t.m14*s.m44,a=t.m21*s.m11+t.m22*s.m21+t.m23*s.m31+t.m24*s.m41,l=t.m21*s.m12+t.m22*s.m22+t.m23*s.m32+t.m24*s.m42,m=t.m21*s.m13+t.m22*s.m23+t.m23*s.m33+t.m24*s.m43,h=t.m21*s.m14+t.m22*s.m24+t.m23*s.m34+t.m24*s.m44,c=t.m31*s.m11+t.m32*s.m21+t.m33*s.m31+t.m34*s.m41,u=t.m31*s.m12+t.m32*s.m22+t.m33*s.m32+t.m34*s.m42,f=t.m31*s.m13+t.m32*s.m23+t.m33*s.m33+t.m34*s.m43,w=t.m31*s.m14+t.m32*s.m24+t.m33*s.m34+t.m34*s.m44,o=t.m41*s.m11+t.m42*s.m21+t.m43*s.m31+t.m44*s.m41,d=t.m41*s.m12+t.m42*s.m22+t.m43*s.m32+t.m44*s.m42,A=t.m41*s.m13+t.m42*s.m23+t.m43*s.m33+t.m44*s.m43,M=t.m41*s.m14+t.m42*s.m24+t.m43*s.m34+t.m44*s.m44;return g([e,n,i,r,a,l,m,h,c,u,f,w,o,d,A,M])};class y{constructor(t){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}get isIdentity(){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}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){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}toFloat32Array(t){return Float32Array.from(x(this,t))}toFloat64Array(t){return Float64Array.from(x(this,t))}toString(){const{is2D:t}=this,e=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${e})`}toJSON(){const{is2D:t,isIdentity:e}=this;return{...this,is2D:t,isIdentity:e}}multiply(t){return N(this,t)}translate(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=0),typeof a>"u"&&(a=0),N(this,Y(i,r,a))}scale(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=t),typeof a>"u"&&(a=1),N(this,I(i,r,a))}rotate(t,e,n){let i=t,r=e||0,a=n||0;return typeof t=="number"&&typeof e>"u"&&typeof n>"u"&&(a=i,i=0,r=0),N(this,F(i,r,a))}rotateAxisAngle(t,e,n,i){if([t,e,n,i].some(r=>Number.isNaN(+r)))throw new TypeError("CSSMatrix: expecting 4 values");return N(this,T(t,e,n,i))}skewX(t){return N(this,R(t))}skewY(t){return N(this,D(t))}skew(t,e){return N(this,v(t,e))}transformPoint(t){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;return t instanceof DOMPoint?new DOMPoint(e,n,i,r):{x:e,y:n,z:i,w:r}}}p(y,"Translate",Y),p(y,"Rotate",F),p(y,"RotateAxisAngle",T),p(y,"Scale",I),p(y,"SkewX",R),p(y,"SkewY",D),p(y,"Skew",v),p(y,"Multiply",N),p(y,"fromArray",g),p(y,"fromMatrix",X),p(y,"fromString",O),p(y,"toArray",x),p(y,"isCompatibleArray",E),p(y,"isCompatibleObject",P);module.exports=y; //# sourceMappingURL=dommatrix.cjs.map diff --git a/dist/dommatrix.cjs.map b/dist/dommatrix.cjs.map index 9cc3b35..0fe6268 100644 --- a/dist/dommatrix.cjs.map +++ b/dist/dommatrix.cjs.map @@ -1 +1 @@ -{"version":3,"file":"dommatrix.cjs","sources":["../src/index.ts"],"sourcesContent":["import type {\n CSSMatrixInput,\n JSONMatrix,\n Matrix,\n Matrix3d,\n PointTuple,\n} 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 = (\n array?: unknown,\n): 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 = (\n object?: unknown,\n): object is CSSMatrix | DOMMatrix | JSONMatrix => {\n return (\n object instanceof DOMMatrix ||\n object instanceof CSSMatrix ||\n (typeof object === \"object\" &&\n 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 = (\n array: number[] | Float32Array | Float64Array,\n): CSSMatrix => {\n const m = new CSSMatrix();\n const a = Array.from(array);\n\n if (!isCompatibleArray(a)) {\n throw TypeError(\n `CSSMatrix: \"${a.join(\",\")}\" must be an array with 6/16 numbers.`,\n );\n }\n // istanbul ignore else @preserve\n if (a.length === 16) {\n const [\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ] = 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(\n `CSSMatrix: \"${\n JSON.stringify(m)\n }\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`,\n );\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,\n ) => (n.includes(\"rad\")\n ? parseFloat(n) * (180 / Math.PI)\n : parseFloat(n))\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 (\n prop === \"perspective\" && x && [y, z].every((n) => n === undefined)\n ) {\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 (\n prop === \"translate3d\" && xyz.every((n) => !Number.isNaN(+n))\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 (\n prop === \"rotate3d\" && xyza.every((n) => !Number.isNaN(+n)) && a\n ) {\n m = m.rotateAxisAngle(x, y, z, a);\n // single value expected\n } else if (\n prop === \"rotate\" && x && [y, z].every((n) => n === undefined)\n ) {\n m = m.rotate(0, 0, x);\n // 3 values expected\n } else if (\n prop === \"scale3d\" && xyz.every((n) => !Number.isNaN(+n)) &&\n xyz.some((n) => n !== 1)\n ) {\n m = m.scale(x, y, z);\n // single value expected\n } else if (\n prop === \"scale\" && !Number.isNaN(x) && x !== 1 && z === undefined\n ) {\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 (\n prop === \"skew\" && (x || (!Number.isNaN(x) && y)) && z === undefined\n ) {\n m = m.skew(x, y || 0);\n } else if (\n [\"translate\", \"rotate\", \"scale\", \"skew\"].some((p) =>\n prop.includes(p)\n ) &&\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\n | \"scale\"\n | \"translate\"\n | \"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] = [\n idx === 0 ? x : def,\n idx === 1 ? x : def,\n idx === 2 ? x : def,\n ];\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 = (\n m: CSSMatrix | DOMMatrix | JSONMatrix,\n is2D?: boolean,\n): 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 = (\n x: number,\n y: number,\n z: number,\n alpha: number,\n): 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 = (\n m1: CSSMatrix | DOMMatrix | JSONMatrix,\n m2: CSSMatrix | DOMMatrix | JSONMatrix,\n): CSSMatrix => {\n const m11 = m2.m11 * m1.m11 + m2.m12 * m1.m21 + m2.m13 * m1.m31 +\n m2.m14 * m1.m41;\n const m12 = m2.m11 * m1.m12 + m2.m12 * m1.m22 + m2.m13 * m1.m32 +\n m2.m14 * m1.m42;\n const m13 = m2.m11 * m1.m13 + m2.m12 * m1.m23 + m2.m13 * m1.m33 +\n m2.m14 * m1.m43;\n const m14 = m2.m11 * m1.m14 + m2.m12 * m1.m24 + m2.m13 * m1.m34 +\n m2.m14 * m1.m44;\n\n const m21 = m2.m21 * m1.m11 + m2.m22 * m1.m21 + m2.m23 * m1.m31 +\n m2.m24 * m1.m41;\n const m22 = m2.m21 * m1.m12 + m2.m22 * m1.m22 + m2.m23 * m1.m32 +\n m2.m24 * m1.m42;\n const m23 = m2.m21 * m1.m13 + m2.m22 * m1.m23 + m2.m23 * m1.m33 +\n m2.m24 * m1.m43;\n const m24 = m2.m21 * m1.m14 + m2.m22 * m1.m24 + m2.m23 * m1.m34 +\n m2.m24 * m1.m44;\n\n const m31 = m2.m31 * m1.m11 + m2.m32 * m1.m21 + m2.m33 * m1.m31 +\n m2.m34 * m1.m41;\n const m32 = m2.m31 * m1.m12 + m2.m32 * m1.m22 + m2.m33 * m1.m32 +\n m2.m34 * m1.m42;\n const m33 = m2.m31 * m1.m13 + m2.m32 * m1.m23 + m2.m33 * m1.m33 +\n m2.m34 * m1.m43;\n const m34 = m2.m31 * m1.m14 + m2.m32 * m1.m24 + m2.m33 * m1.m34 +\n m2.m34 * m1.m44;\n\n const m41 = m2.m41 * m1.m11 + m2.m42 * m1.m21 + m2.m43 * m1.m31 +\n m2.m44 * m1.m41;\n const m42 = m2.m41 * m1.m12 + m2.m42 * m1.m22 + m2.m43 * m1.m32 +\n m2.m44 * m1.m42;\n const m43 = m2.m41 * m1.m13 + m2.m42 * m1.m23 + m2.m43 * m1.m33 +\n m2.m44 * m1.m43;\n const m44 = m2.m41 * m1.m14 + m2.m42 * m1.m24 + m2.m43 * m1.m34 +\n m2.m44 * m1.m44;\n\n return fromArray([\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ]);\n};\n\n/**\n * Creates and returns a new `DOMMatrix` compatible instance\n * with equivalent instance.\n *\n * @class CSSMatrix\n *\n * @author thednp \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 &&\n 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 (\n Array.isArray(source) || source instanceof Float64Array ||\n source instanceof Float32Array\n ) {\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 (\n typeof rx === \"number\" && typeof ry === \"undefined\" &&\n typeof rz === \"undefined\"\n ) {\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 ? new DOMPoint(x, y, z, w) : {\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":"iLASA,MAAMA,EAA0B,CAC9B,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,KAAM,GACN,WAAY,EACd,EAUMC,EACJC,IAGGA,aAAiB,cAChBA,aAAiB,cAChB,MAAM,QAAQA,CAAK,GAAKA,EAAM,MAAOC,GAAM,OAAOA,GAAM,QAAQ,IACnE,CAAC,EAAG,EAAE,EAAE,KAAMA,GAAMD,EAAM,SAAWC,CAAC,EAKpCC,EACJC,GAGEA,aAAkB,WAClBA,aAAkBC,GACjB,OAAOD,GAAW,UACjB,OAAO,KAAKL,CAAW,EAAE,MAAOO,GAAMF,GAAUE,KAAKF,CAAM,EAc3DG,EACJN,GACc,CACR,MAAAO,EAAI,IAAIH,EACRI,EAAI,MAAM,KAAKR,CAAK,EAEtB,GAAA,CAACD,EAAkBS,CAAC,EAChB,MAAA,UACJ,eAAeA,EAAE,KAAK,GAAG,CAAC,uCAC5B,EACF;AAEI,GAAAA,EAAE,SAAW,GAAI,CACb,KAAA,CACJC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,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,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EACpEyD,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAEnE,OAAA,aAAa,SAAW,IAAI,SAASnG,EAAGyC,EAAGC,EAAGyD,CAAC,EAAI,CACxD,EAAAnG,EACA,EAAAyC,EACA,EAAAC,EACA,EAAAyD,CACF,CAAA,CAEJ,CAvVEC,EAvBmBjG,EAuBZ,YAAYoD,GACnB6C,EAxBmBjG,EAwBZ,SAASqD,GAChB4C,EAzBmBjG,EAyBZ,kBAAkBmE,GACzB8B,EA1BmBjG,EA0BZ,QAAQgF,GACfiB,EA3BmBjG,EA2BZ,QAAQsF,GACfW,EA5BmBjG,EA4BZ,QAAQuF,GACfU,EA7BmBjG,EA6BZ,OAAOiF,GACdgB,EA9BmBjG,EA8BZ,WAAWwF,GAClBS,EA/BmBjG,EA+BZ,YAAYE,GACnB+F,EAhCmBjG,EAgCZ,aAAa2B,GACpBsE,EAjCmBjG,EAiCZ,aAAa4B,GACpBqE,EAlCmBjG,EAkCZ,UAAUkD,GACjB+C,EAnCmBjG,EAmCZ,oBAAoBL,GAC3BsG,EApCmBjG,EAoCZ,qBAAqBF"} \ No newline at end of file +{"version":3,"file":"dommatrix.cjs","sources":["../src/index.ts"],"sourcesContent":["import type {\n CSSMatrixInput,\n JSONMatrix,\n Matrix,\n Matrix3d,\n PointTuple,\n} 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 = (\n array?: unknown,\n): 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 = (\n object?: unknown,\n): object is CSSMatrix | DOMMatrix | JSONMatrix => {\n return (\n object instanceof DOMMatrix ||\n object instanceof CSSMatrix ||\n (typeof object === \"object\" &&\n 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 = (\n array: number[] | Float32Array | Float64Array,\n): CSSMatrix => {\n const m = new CSSMatrix();\n const a = Array.from(array);\n\n if (!isCompatibleArray(a)) {\n throw TypeError(\n `CSSMatrix: \"${a.join(\",\")}\" must be an array with 6/16 numbers.`,\n );\n }\n // istanbul ignore else @preserve\n if (a.length === 16) {\n const [\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ] = 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(\n `CSSMatrix: \"${\n JSON.stringify(m)\n }\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`,\n );\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,\n ) => (n.includes(\"rad\")\n ? parseFloat(n) * (180 / Math.PI)\n : parseFloat(n))\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 (\n prop === \"perspective\" && x && [y, z].every((n) => n === undefined)\n ) {\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 (\n prop === \"translate3d\" && xyz.every((n) => !Number.isNaN(+n))\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 (\n prop === \"rotate3d\" && xyza.every((n) => !Number.isNaN(+n)) && a\n ) {\n m = m.rotateAxisAngle(x, y, z, a);\n // single value expected\n } else if (\n prop === \"rotate\" && x && [y, z].every((n) => n === undefined)\n ) {\n m = m.rotate(0, 0, x);\n // 3 values expected\n } else if (\n prop === \"scale3d\" && xyz.every((n) => !Number.isNaN(+n)) &&\n xyz.some((n) => n !== 1)\n ) {\n m = m.scale(x, y, z);\n // single value expected\n } else if (\n // prop === \"scale\" && !Number.isNaN(x) && x !== 1 && z === undefined\n prop === \"scale\" && !Number.isNaN(x) && [x, y].some((n) => n !== 1) &&\n z === undefined\n ) {\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 (\n prop === \"skew\" && (x || (!Number.isNaN(x) && y)) && z === undefined\n ) {\n m = m.skew(x, y || 0);\n } else if (\n [\"translate\", \"rotate\", \"scale\", \"skew\"].some((p) =>\n prop.includes(p)\n ) &&\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\n | \"scale\"\n | \"translate\"\n | \"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] = [\n idx === 0 ? x : def,\n idx === 1 ? x : def,\n idx === 2 ? x : def,\n ];\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 = (\n m: CSSMatrix | DOMMatrix | JSONMatrix,\n is2D?: boolean,\n): 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 = (\n x: number,\n y: number,\n z: number,\n alpha: number,\n): 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 = (\n m1: CSSMatrix | DOMMatrix | JSONMatrix,\n m2: CSSMatrix | DOMMatrix | JSONMatrix,\n): CSSMatrix => {\n const m11 = m2.m11 * m1.m11 + m2.m12 * m1.m21 + m2.m13 * m1.m31 +\n m2.m14 * m1.m41;\n const m12 = m2.m11 * m1.m12 + m2.m12 * m1.m22 + m2.m13 * m1.m32 +\n m2.m14 * m1.m42;\n const m13 = m2.m11 * m1.m13 + m2.m12 * m1.m23 + m2.m13 * m1.m33 +\n m2.m14 * m1.m43;\n const m14 = m2.m11 * m1.m14 + m2.m12 * m1.m24 + m2.m13 * m1.m34 +\n m2.m14 * m1.m44;\n\n const m21 = m2.m21 * m1.m11 + m2.m22 * m1.m21 + m2.m23 * m1.m31 +\n m2.m24 * m1.m41;\n const m22 = m2.m21 * m1.m12 + m2.m22 * m1.m22 + m2.m23 * m1.m32 +\n m2.m24 * m1.m42;\n const m23 = m2.m21 * m1.m13 + m2.m22 * m1.m23 + m2.m23 * m1.m33 +\n m2.m24 * m1.m43;\n const m24 = m2.m21 * m1.m14 + m2.m22 * m1.m24 + m2.m23 * m1.m34 +\n m2.m24 * m1.m44;\n\n const m31 = m2.m31 * m1.m11 + m2.m32 * m1.m21 + m2.m33 * m1.m31 +\n m2.m34 * m1.m41;\n const m32 = m2.m31 * m1.m12 + m2.m32 * m1.m22 + m2.m33 * m1.m32 +\n m2.m34 * m1.m42;\n const m33 = m2.m31 * m1.m13 + m2.m32 * m1.m23 + m2.m33 * m1.m33 +\n m2.m34 * m1.m43;\n const m34 = m2.m31 * m1.m14 + m2.m32 * m1.m24 + m2.m33 * m1.m34 +\n m2.m34 * m1.m44;\n\n const m41 = m2.m41 * m1.m11 + m2.m42 * m1.m21 + m2.m43 * m1.m31 +\n m2.m44 * m1.m41;\n const m42 = m2.m41 * m1.m12 + m2.m42 * m1.m22 + m2.m43 * m1.m32 +\n m2.m44 * m1.m42;\n const m43 = m2.m41 * m1.m13 + m2.m42 * m1.m23 + m2.m43 * m1.m33 +\n m2.m44 * m1.m43;\n const m44 = m2.m41 * m1.m14 + m2.m42 * m1.m24 + m2.m43 * m1.m34 +\n m2.m44 * m1.m44;\n\n return fromArray([\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ]);\n};\n\n/**\n * Creates and returns a new `DOMMatrix` compatible instance\n * with equivalent instance.\n *\n * @class CSSMatrix\n *\n * @author thednp \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 &&\n 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 (\n Array.isArray(source) || source instanceof Float64Array ||\n source instanceof Float32Array\n ) {\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 (\n typeof rx === \"number\" && typeof ry === \"undefined\" &&\n typeof rz === \"undefined\"\n ) {\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 ? new DOMPoint(x, y, z, w) : {\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":"iLASA,MAAMA,EAA0B,CAC9B,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,KAAM,GACN,WAAY,EACd,EAUMC,EACJC,IAGGA,aAAiB,cAChBA,aAAiB,cAChB,MAAM,QAAQA,CAAK,GAAKA,EAAM,MAAOC,GAAM,OAAOA,GAAM,QAAQ,IACnE,CAAC,EAAG,EAAE,EAAE,KAAMA,GAAMD,EAAM,SAAWC,CAAC,EAKpCC,EACJC,GAGEA,aAAkB,WAClBA,aAAkBC,GACjB,OAAOD,GAAW,UACjB,OAAO,KAAKL,CAAW,EAAE,MAAOO,GAAMF,GAAUE,KAAKF,CAAM,EAc3DG,EACJN,GACc,CACR,MAAAO,EAAI,IAAIH,EACRI,EAAI,MAAM,KAAKR,CAAK,EAEtB,GAAA,CAACD,EAAkBS,CAAC,EAChB,MAAA,UACJ,eAAeA,EAAE,KAAK,GAAG,CAAC,uCAC5B,EACF;AAEI,GAAAA,EAAE,SAAW,GAAI,CACb,KAAA,CACJC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,CAAA,EACEhB,EAEJD,EAAE,IAAME,EACRF,EAAE,EAAIE,EAENF,EAAE,IAAMM,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K,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EACpEyD,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAEnE,OAAA,aAAa,SAAW,IAAI,SAASnG,EAAGyC,EAAGC,EAAGyD,CAAC,EAAI,CACxD,EAAAnG,EACA,EAAAyC,EACA,EAAAC,EACA,EAAAyD,CACF,CAAA,CAEJ,CAvVEC,EAvBmBjG,EAuBZ,YAAYoD,GACnB6C,EAxBmBjG,EAwBZ,SAASqD,GAChB4C,EAzBmBjG,EAyBZ,kBAAkBmE,GACzB8B,EA1BmBjG,EA0BZ,QAAQgF,GACfiB,EA3BmBjG,EA2BZ,QAAQsF,GACfW,EA5BmBjG,EA4BZ,QAAQuF,GACfU,EA7BmBjG,EA6BZ,OAAOiF,GACdgB,EA9BmBjG,EA8BZ,WAAWwF,GAClBS,EA/BmBjG,EA+BZ,YAAYE,GACnB+F,EAhCmBjG,EAgCZ,aAAa2B,GACpBsE,EAjCmBjG,EAiCZ,aAAa4B,GACpBqE,EAlCmBjG,EAkCZ,UAAUkD,GACjB+C,EAnCmBjG,EAmCZ,oBAAoBL,GAC3BsG,EApCmBjG,EAoCZ,qBAAqBF"} \ No newline at end of file diff --git a/dist/dommatrix.js b/dist/dommatrix.js index a5baf4b..7174bb4 100644 --- a/dist/dommatrix.js +++ b/dist/dommatrix.js @@ -1,3 +1,3 @@ var CSSMatrix=function(){"use strict";var z=Object.defineProperty;var S=(g,N,v)=>N in g?z(g,N,{enumerable:!0,configurable:!0,writable:!0,value:v}):g[N]=v;var p=(g,N,v)=>S(g,typeof N!="symbol"?N+"":N,v);const g={a:1,b:0,c:0,d:1,e:0,f:0,m11:1,m12:0,m13:0,m14:0,m21:0,m22:1,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,m41:0,m42:0,m43:0,m44:1,is2D:!0,isIdentity:!0},N=s=>(s instanceof Float64Array||s instanceof Float32Array||Array.isArray(s)&&s.every(t=>typeof t=="number"))&&[6,16].some(t=>s.length===t),v=s=>s instanceof DOMMatrix||s instanceof f||typeof s=="object"&&Object.keys(g).every(t=>s&&t in s),k=s=>{const t=new f,e=Array.from(s);if(!N(e))throw TypeError(`CSSMatrix: "${e.join(",")}" must be an array with 6/16 numbers.`);// istanbul ignore else @preserve -if(e.length===16){const[n,i,r,a,l,m,h,c,y,u,w,o,d,A,M,x]=e;t.m11=n,t.a=n,t.m21=l,t.c=l,t.m31=y,t.m41=d,t.e=d,t.m12=i,t.b=i,t.m22=m,t.d=m,t.m32=u,t.m42=A,t.f=A,t.m13=r,t.m23=h,t.m33=w,t.m43=M,t.m14=a,t.m24=c,t.m34=o,t.m44=x}else if(e.length===6){const[n,i,r,a,l,m]=e;t.m11=n,t.a=n,t.m12=i,t.b=i,t.m21=r,t.c=r,t.m22=a,t.d=a,t.m41=l,t.e=l,t.m42=m,t.f=m}return t},Y=s=>{if(v(s))return k([s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},F=s=>{if(typeof s!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a string.`);const t=String(s).replace(/\s/g,"");let e=new f;const n=`CSSMatrix: invalid transform string "${s}"`;return t.split(")").filter(i=>i).forEach(i=>{const[r,a]=i.split("(");if(!a)throw TypeError(n);const l=a.split(",").map(o=>o.includes("rad")?parseFloat(o)*(180/Math.PI):parseFloat(o)),[m,h,c,y]=l,u=[m,h,c],w=[m,h,c,y];if(r==="perspective"&&m&&[h,c].every(o=>o===void 0))e.m34=-1/m;else if(r.includes("matrix")&&[6,16].includes(l.length)&&l.every(o=>!Number.isNaN(+o))){const o=l.map(d=>Math.abs(d)<1e-6?0:d);e=e.multiply(k(o))}else if(r==="translate3d"&&u.every(o=>!Number.isNaN(+o)))e=e.translate(m,h,c);else if(r==="translate"&&m&&c===void 0)e=e.translate(m,h||0,0);else if(r==="rotate3d"&&w.every(o=>!Number.isNaN(+o))&&y)e=e.rotateAxisAngle(m,h,c,y);else if(r==="rotate"&&m&&[h,c].every(o=>o===void 0))e=e.rotate(0,0,m);else if(r==="scale3d"&&u.every(o=>!Number.isNaN(+o))&&u.some(o=>o!==1))e=e.scale(m,h,c);else if(r==="scale"&&!Number.isNaN(m)&&m!==1&&c===void 0){const d=Number.isNaN(+h)?m:h;e=e.scale(m,d,1)}else if(r==="skew"&&(m||!Number.isNaN(m)&&h)&&c===void 0)e=e.skew(m,h||0);else if(["translate","rotate","scale","skew"].some(o=>r.includes(o))&&/[XYZ]/.test(r)&&m&&[h,c].every(o=>o===void 0))if(r==="skewX"||r==="skewY")e=e[r](m);else{const o=r.replace(/[XYZ]/,""),d=r.replace(o,""),A=["X","Y","Z"].indexOf(d),M=o==="scale"?1:0,x=[A===0?m:M,A===1?m:M,A===2?m:M];e=e[o](...x)}else throw TypeError(n)}),e},O=(s,t)=>t?[s.a,s.b,s.c,s.d,s.e,s.f]:[s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44],T=(s,t,e)=>{const n=new f;return n.m41=s,n.e=s,n.m42=t,n.f=t,n.m43=e,n},I=(s,t,e)=>{const n=new f,i=Math.PI/180,r=s*i,a=t*i,l=e*i,m=Math.cos(r),h=-Math.sin(r),c=Math.cos(a),y=-Math.sin(a),u=Math.cos(l),w=-Math.sin(l),o=c*u,d=-c*w;n.m11=o,n.a=o,n.m12=d,n.b=d,n.m13=y;const A=h*y*u+m*w;n.m21=A,n.c=A;const M=m*u-h*y*w;return n.m22=M,n.d=M,n.m23=-h*c,n.m31=h*w-m*y*u,n.m32=h*u+m*y*w,n.m33=m*c,n},R=(s,t,e,n)=>{const i=new f,r=Math.sqrt(s*s+t*t+e*e);if(r===0)return i;const a=s/r,l=t/r,m=e/r,h=n*(Math.PI/360),c=Math.sin(h),y=Math.cos(h),u=c*c,w=a*a,o=l*l,d=m*m,A=1-2*(o+d)*u;i.m11=A,i.a=A;const M=2*(a*l*u+m*c*y);i.m12=M,i.b=M,i.m13=2*(a*m*u-l*c*y);const x=2*(l*a*u-m*c*y);i.m21=x,i.c=x;const Z=1-2*(d+w)*u;return i.m22=Z,i.d=Z,i.m23=2*(l*m*u+a*c*y),i.m31=2*(m*a*u+l*c*y),i.m32=2*(m*l*u-a*c*y),i.m33=1-2*(w+o)*u,i},D=(s,t,e)=>{const n=new f;return n.m11=s,n.a=s,n.m22=t,n.d=t,n.m33=e,n},X=(s,t)=>{const e=new f;if(s){const n=s*Math.PI/180,i=Math.tan(n);e.m21=i,e.c=i}if(t){const n=t*Math.PI/180,i=Math.tan(n);e.m12=i,e.b=i}return e},E=s=>X(s,0),P=s=>X(0,s),b=(s,t)=>{const e=t.m11*s.m11+t.m12*s.m21+t.m13*s.m31+t.m14*s.m41,n=t.m11*s.m12+t.m12*s.m22+t.m13*s.m32+t.m14*s.m42,i=t.m11*s.m13+t.m12*s.m23+t.m13*s.m33+t.m14*s.m43,r=t.m11*s.m14+t.m12*s.m24+t.m13*s.m34+t.m14*s.m44,a=t.m21*s.m11+t.m22*s.m21+t.m23*s.m31+t.m24*s.m41,l=t.m21*s.m12+t.m22*s.m22+t.m23*s.m32+t.m24*s.m42,m=t.m21*s.m13+t.m22*s.m23+t.m23*s.m33+t.m24*s.m43,h=t.m21*s.m14+t.m22*s.m24+t.m23*s.m34+t.m24*s.m44,c=t.m31*s.m11+t.m32*s.m21+t.m33*s.m31+t.m34*s.m41,y=t.m31*s.m12+t.m32*s.m22+t.m33*s.m32+t.m34*s.m42,u=t.m31*s.m13+t.m32*s.m23+t.m33*s.m33+t.m34*s.m43,w=t.m31*s.m14+t.m32*s.m24+t.m33*s.m34+t.m34*s.m44,o=t.m41*s.m11+t.m42*s.m21+t.m43*s.m31+t.m44*s.m41,d=t.m41*s.m12+t.m42*s.m22+t.m43*s.m32+t.m44*s.m42,A=t.m41*s.m13+t.m42*s.m23+t.m43*s.m33+t.m44*s.m43,M=t.m41*s.m14+t.m42*s.m24+t.m43*s.m34+t.m44*s.m44;return k([e,n,i,r,a,l,m,h,c,y,u,w,o,d,A,M])};class f{constructor(t){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}get isIdentity(){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}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){return typeof t=="string"&&t.length&&t!=="none"?F(t):Array.isArray(t)||t instanceof Float64Array||t instanceof Float32Array?k(t):typeof t=="object"?Y(t):this}toFloat32Array(t){return Float32Array.from(O(this,t))}toFloat64Array(t){return Float64Array.from(O(this,t))}toString(){const{is2D:t}=this,e=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${e})`}toJSON(){const{is2D:t,isIdentity:e}=this;return{...this,is2D:t,isIdentity:e}}multiply(t){return b(this,t)}translate(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=0),typeof a>"u"&&(a=0),b(this,T(i,r,a))}scale(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=t),typeof a>"u"&&(a=1),b(this,D(i,r,a))}rotate(t,e,n){let i=t,r=e||0,a=n||0;return typeof t=="number"&&typeof e>"u"&&typeof n>"u"&&(a=i,i=0,r=0),b(this,I(i,r,a))}rotateAxisAngle(t,e,n,i){if([t,e,n,i].some(r=>Number.isNaN(+r)))throw new TypeError("CSSMatrix: expecting 4 values");return b(this,R(t,e,n,i))}skewX(t){return b(this,E(t))}skewY(t){return b(this,P(t))}skew(t,e){return b(this,X(t,e))}transformPoint(t){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;return t instanceof DOMPoint?new DOMPoint(e,n,i,r):{x:e,y:n,z:i,w:r}}}return p(f,"Translate",T),p(f,"Rotate",I),p(f,"RotateAxisAngle",R),p(f,"Scale",D),p(f,"SkewX",E),p(f,"SkewY",P),p(f,"Skew",X),p(f,"Multiply",b),p(f,"fromArray",k),p(f,"fromMatrix",Y),p(f,"fromString",F),p(f,"toArray",O),p(f,"isCompatibleArray",N),p(f,"isCompatibleObject",v),f}(); +if(e.length===16){const[n,i,r,a,l,m,h,c,y,u,w,o,d,A,M,x]=e;t.m11=n,t.a=n,t.m21=l,t.c=l,t.m31=y,t.m41=d,t.e=d,t.m12=i,t.b=i,t.m22=m,t.d=m,t.m32=u,t.m42=A,t.f=A,t.m13=r,t.m23=h,t.m33=w,t.m43=M,t.m14=a,t.m24=c,t.m34=o,t.m44=x}else if(e.length===6){const[n,i,r,a,l,m]=e;t.m11=n,t.a=n,t.m12=i,t.b=i,t.m21=r,t.c=r,t.m22=a,t.d=a,t.m41=l,t.e=l,t.m42=m,t.f=m}return t},Y=s=>{if(v(s))return k([s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},F=s=>{if(typeof s!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a string.`);const t=String(s).replace(/\s/g,"");let e=new f;const n=`CSSMatrix: invalid transform string "${s}"`;return t.split(")").filter(i=>i).forEach(i=>{const[r,a]=i.split("(");if(!a)throw TypeError(n);const l=a.split(",").map(o=>o.includes("rad")?parseFloat(o)*(180/Math.PI):parseFloat(o)),[m,h,c,y]=l,u=[m,h,c],w=[m,h,c,y];if(r==="perspective"&&m&&[h,c].every(o=>o===void 0))e.m34=-1/m;else if(r.includes("matrix")&&[6,16].includes(l.length)&&l.every(o=>!Number.isNaN(+o))){const o=l.map(d=>Math.abs(d)<1e-6?0:d);e=e.multiply(k(o))}else if(r==="translate3d"&&u.every(o=>!Number.isNaN(+o)))e=e.translate(m,h,c);else if(r==="translate"&&m&&c===void 0)e=e.translate(m,h||0,0);else if(r==="rotate3d"&&w.every(o=>!Number.isNaN(+o))&&y)e=e.rotateAxisAngle(m,h,c,y);else if(r==="rotate"&&m&&[h,c].every(o=>o===void 0))e=e.rotate(0,0,m);else if(r==="scale3d"&&u.every(o=>!Number.isNaN(+o))&&u.some(o=>o!==1))e=e.scale(m,h,c);else if(r==="scale"&&!Number.isNaN(m)&&[m,h].some(o=>o!==1)&&c===void 0){const d=Number.isNaN(+h)?m:h;e=e.scale(m,d,1)}else if(r==="skew"&&(m||!Number.isNaN(m)&&h)&&c===void 0)e=e.skew(m,h||0);else if(["translate","rotate","scale","skew"].some(o=>r.includes(o))&&/[XYZ]/.test(r)&&m&&[h,c].every(o=>o===void 0))if(r==="skewX"||r==="skewY")e=e[r](m);else{const o=r.replace(/[XYZ]/,""),d=r.replace(o,""),A=["X","Y","Z"].indexOf(d),M=o==="scale"?1:0,x=[A===0?m:M,A===1?m:M,A===2?m:M];e=e[o](...x)}else throw TypeError(n)}),e},O=(s,t)=>t?[s.a,s.b,s.c,s.d,s.e,s.f]:[s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44],T=(s,t,e)=>{const n=new f;return n.m41=s,n.e=s,n.m42=t,n.f=t,n.m43=e,n},I=(s,t,e)=>{const n=new f,i=Math.PI/180,r=s*i,a=t*i,l=e*i,m=Math.cos(r),h=-Math.sin(r),c=Math.cos(a),y=-Math.sin(a),u=Math.cos(l),w=-Math.sin(l),o=c*u,d=-c*w;n.m11=o,n.a=o,n.m12=d,n.b=d,n.m13=y;const A=h*y*u+m*w;n.m21=A,n.c=A;const M=m*u-h*y*w;return n.m22=M,n.d=M,n.m23=-h*c,n.m31=h*w-m*y*u,n.m32=h*u+m*y*w,n.m33=m*c,n},R=(s,t,e,n)=>{const i=new f,r=Math.sqrt(s*s+t*t+e*e);if(r===0)return i;const a=s/r,l=t/r,m=e/r,h=n*(Math.PI/360),c=Math.sin(h),y=Math.cos(h),u=c*c,w=a*a,o=l*l,d=m*m,A=1-2*(o+d)*u;i.m11=A,i.a=A;const M=2*(a*l*u+m*c*y);i.m12=M,i.b=M,i.m13=2*(a*m*u-l*c*y);const x=2*(l*a*u-m*c*y);i.m21=x,i.c=x;const Z=1-2*(d+w)*u;return i.m22=Z,i.d=Z,i.m23=2*(l*m*u+a*c*y),i.m31=2*(m*a*u+l*c*y),i.m32=2*(m*l*u-a*c*y),i.m33=1-2*(w+o)*u,i},D=(s,t,e)=>{const n=new f;return n.m11=s,n.a=s,n.m22=t,n.d=t,n.m33=e,n},X=(s,t)=>{const e=new f;if(s){const n=s*Math.PI/180,i=Math.tan(n);e.m21=i,e.c=i}if(t){const n=t*Math.PI/180,i=Math.tan(n);e.m12=i,e.b=i}return e},E=s=>X(s,0),P=s=>X(0,s),b=(s,t)=>{const e=t.m11*s.m11+t.m12*s.m21+t.m13*s.m31+t.m14*s.m41,n=t.m11*s.m12+t.m12*s.m22+t.m13*s.m32+t.m14*s.m42,i=t.m11*s.m13+t.m12*s.m23+t.m13*s.m33+t.m14*s.m43,r=t.m11*s.m14+t.m12*s.m24+t.m13*s.m34+t.m14*s.m44,a=t.m21*s.m11+t.m22*s.m21+t.m23*s.m31+t.m24*s.m41,l=t.m21*s.m12+t.m22*s.m22+t.m23*s.m32+t.m24*s.m42,m=t.m21*s.m13+t.m22*s.m23+t.m23*s.m33+t.m24*s.m43,h=t.m21*s.m14+t.m22*s.m24+t.m23*s.m34+t.m24*s.m44,c=t.m31*s.m11+t.m32*s.m21+t.m33*s.m31+t.m34*s.m41,y=t.m31*s.m12+t.m32*s.m22+t.m33*s.m32+t.m34*s.m42,u=t.m31*s.m13+t.m32*s.m23+t.m33*s.m33+t.m34*s.m43,w=t.m31*s.m14+t.m32*s.m24+t.m33*s.m34+t.m34*s.m44,o=t.m41*s.m11+t.m42*s.m21+t.m43*s.m31+t.m44*s.m41,d=t.m41*s.m12+t.m42*s.m22+t.m43*s.m32+t.m44*s.m42,A=t.m41*s.m13+t.m42*s.m23+t.m43*s.m33+t.m44*s.m43,M=t.m41*s.m14+t.m42*s.m24+t.m43*s.m34+t.m44*s.m44;return k([e,n,i,r,a,l,m,h,c,y,u,w,o,d,A,M])};class f{constructor(t){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}get isIdentity(){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}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){return typeof t=="string"&&t.length&&t!=="none"?F(t):Array.isArray(t)||t instanceof Float64Array||t instanceof Float32Array?k(t):typeof t=="object"?Y(t):this}toFloat32Array(t){return Float32Array.from(O(this,t))}toFloat64Array(t){return Float64Array.from(O(this,t))}toString(){const{is2D:t}=this,e=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${e})`}toJSON(){const{is2D:t,isIdentity:e}=this;return{...this,is2D:t,isIdentity:e}}multiply(t){return b(this,t)}translate(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=0),typeof a>"u"&&(a=0),b(this,T(i,r,a))}scale(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=t),typeof a>"u"&&(a=1),b(this,D(i,r,a))}rotate(t,e,n){let i=t,r=e||0,a=n||0;return typeof t=="number"&&typeof e>"u"&&typeof n>"u"&&(a=i,i=0,r=0),b(this,I(i,r,a))}rotateAxisAngle(t,e,n,i){if([t,e,n,i].some(r=>Number.isNaN(+r)))throw new TypeError("CSSMatrix: expecting 4 values");return b(this,R(t,e,n,i))}skewX(t){return b(this,E(t))}skewY(t){return b(this,P(t))}skew(t,e){return b(this,X(t,e))}transformPoint(t){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;return t instanceof DOMPoint?new DOMPoint(e,n,i,r):{x:e,y:n,z:i,w:r}}}return p(f,"Translate",T),p(f,"Rotate",I),p(f,"RotateAxisAngle",R),p(f,"Scale",D),p(f,"SkewX",E),p(f,"SkewY",P),p(f,"Skew",X),p(f,"Multiply",b),p(f,"fromArray",k),p(f,"fromMatrix",Y),p(f,"fromString",F),p(f,"toArray",O),p(f,"isCompatibleArray",N),p(f,"isCompatibleObject",v),f}(); //# sourceMappingURL=dommatrix.js.map diff --git a/dist/dommatrix.js.map b/dist/dommatrix.js.map index d8d9bed..24e0d0b 100644 --- a/dist/dommatrix.js.map +++ b/dist/dommatrix.js.map @@ -1 +1 @@ -{"version":3,"file":"dommatrix.js","sources":["../src/index.ts"],"sourcesContent":["import type {\n CSSMatrixInput,\n JSONMatrix,\n Matrix,\n Matrix3d,\n PointTuple,\n} 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 = (\n array?: unknown,\n): 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 = (\n object?: unknown,\n): object is CSSMatrix | DOMMatrix | JSONMatrix => {\n return (\n object instanceof DOMMatrix ||\n object instanceof CSSMatrix ||\n (typeof object === \"object\" &&\n 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 = (\n array: number[] | Float32Array | Float64Array,\n): CSSMatrix => {\n const m = new CSSMatrix();\n const a = Array.from(array);\n\n if (!isCompatibleArray(a)) {\n throw TypeError(\n `CSSMatrix: \"${a.join(\",\")}\" must be an array with 6/16 numbers.`,\n );\n }\n // istanbul ignore else @preserve\n if (a.length === 16) {\n const [\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ] = 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(\n `CSSMatrix: \"${\n JSON.stringify(m)\n }\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`,\n );\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,\n ) => (n.includes(\"rad\")\n ? parseFloat(n) * (180 / Math.PI)\n : parseFloat(n))\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 (\n prop === \"perspective\" && x && [y, z].every((n) => n === undefined)\n ) {\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 (\n prop === \"translate3d\" && xyz.every((n) => !Number.isNaN(+n))\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 (\n prop === \"rotate3d\" && xyza.every((n) => !Number.isNaN(+n)) && a\n ) {\n m = m.rotateAxisAngle(x, y, z, a);\n // single value expected\n } else if (\n prop === \"rotate\" && x && [y, z].every((n) => n === undefined)\n ) {\n m = m.rotate(0, 0, x);\n // 3 values expected\n } else if (\n prop === \"scale3d\" && xyz.every((n) => !Number.isNaN(+n)) &&\n xyz.some((n) => n !== 1)\n ) {\n m = m.scale(x, y, z);\n // single value expected\n } else if (\n prop === \"scale\" && !Number.isNaN(x) && x !== 1 && z === undefined\n ) {\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 (\n prop === \"skew\" && (x || (!Number.isNaN(x) && y)) && z === undefined\n ) {\n m = m.skew(x, y || 0);\n } else if (\n [\"translate\", \"rotate\", \"scale\", \"skew\"].some((p) =>\n prop.includes(p)\n ) &&\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\n | \"scale\"\n | \"translate\"\n | \"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] = [\n idx === 0 ? x : def,\n idx === 1 ? x : def,\n idx === 2 ? x : def,\n ];\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 = (\n m: CSSMatrix | DOMMatrix | JSONMatrix,\n is2D?: boolean,\n): 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 = (\n x: number,\n y: number,\n z: number,\n alpha: number,\n): 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 = (\n m1: CSSMatrix | DOMMatrix | JSONMatrix,\n m2: CSSMatrix | DOMMatrix | JSONMatrix,\n): CSSMatrix => {\n const m11 = m2.m11 * m1.m11 + m2.m12 * m1.m21 + m2.m13 * m1.m31 +\n m2.m14 * m1.m41;\n const m12 = m2.m11 * m1.m12 + m2.m12 * m1.m22 + m2.m13 * m1.m32 +\n m2.m14 * m1.m42;\n const m13 = m2.m11 * m1.m13 + m2.m12 * m1.m23 + m2.m13 * m1.m33 +\n m2.m14 * m1.m43;\n const m14 = m2.m11 * m1.m14 + m2.m12 * m1.m24 + m2.m13 * m1.m34 +\n m2.m14 * m1.m44;\n\n const m21 = m2.m21 * m1.m11 + m2.m22 * m1.m21 + m2.m23 * m1.m31 +\n m2.m24 * m1.m41;\n const m22 = m2.m21 * m1.m12 + m2.m22 * m1.m22 + m2.m23 * m1.m32 +\n m2.m24 * m1.m42;\n const m23 = m2.m21 * m1.m13 + m2.m22 * m1.m23 + m2.m23 * m1.m33 +\n m2.m24 * m1.m43;\n const m24 = m2.m21 * m1.m14 + m2.m22 * m1.m24 + m2.m23 * m1.m34 +\n m2.m24 * m1.m44;\n\n const m31 = m2.m31 * m1.m11 + m2.m32 * m1.m21 + m2.m33 * m1.m31 +\n m2.m34 * m1.m41;\n const m32 = m2.m31 * m1.m12 + m2.m32 * m1.m22 + m2.m33 * m1.m32 +\n m2.m34 * m1.m42;\n const m33 = m2.m31 * m1.m13 + m2.m32 * m1.m23 + m2.m33 * m1.m33 +\n m2.m34 * m1.m43;\n const m34 = m2.m31 * m1.m14 + m2.m32 * m1.m24 + m2.m33 * m1.m34 +\n m2.m34 * m1.m44;\n\n const m41 = m2.m41 * m1.m11 + m2.m42 * m1.m21 + m2.m43 * m1.m31 +\n m2.m44 * m1.m41;\n const m42 = m2.m41 * m1.m12 + m2.m42 * m1.m22 + m2.m43 * m1.m32 +\n m2.m44 * m1.m42;\n const m43 = m2.m41 * m1.m13 + m2.m42 * m1.m23 + m2.m43 * m1.m33 +\n m2.m44 * m1.m43;\n const m44 = m2.m41 * m1.m14 + m2.m42 * m1.m24 + m2.m43 * m1.m34 +\n m2.m44 * m1.m44;\n\n return fromArray([\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ]);\n};\n\n/**\n * Creates and returns a new `DOMMatrix` compatible instance\n * with equivalent instance.\n *\n * @class CSSMatrix\n *\n * @author thednp \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 &&\n 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 (\n Array.isArray(source) || source instanceof Float64Array ||\n source instanceof Float32Array\n ) {\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 (\n typeof rx === \"number\" && typeof ry === \"undefined\" &&\n typeof rz === \"undefined\"\n ) {\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 ? new DOMPoint(x, y, z, w) : {\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":"0MASA,MAAMA,EAA0B,CAC9B,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,KAAM,GACN,WAAY,EACd,EAUMC,EACJC,IAGGA,aAAiB,cAChBA,aAAiB,cAChB,MAAM,QAAQA,CAAK,GAAKA,EAAM,MAAOC,GAAM,OAAOA,GAAM,QAAQ,IACnE,CAAC,EAAG,EAAE,EAAE,KAAMA,GAAMD,EAAM,SAAWC,CAAC,EAKpCC,EACJC,GAGEA,aAAkB,WAClBA,aAAkBC,GACjB,OAAOD,GAAW,UACjB,OAAO,KAAKL,CAAW,EAAE,MAAOO,GAAMF,GAAUE,KAAKF,CAAM,EAc3DG,EACJN,GACc,CACR,MAAAO,EAAI,IAAIH,EACRI,EAAI,MAAM,KAAKR,CAAK,EAEtB,GAAA,CAACD,EAA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AAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EACpEyC,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EACpEC,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EACpEyD,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAEnE,OAAA,aAAa,SAAW,IAAI,SAASnG,EAAGyC,EAAGC,EAAGyD,CAAC,EAAI,CACxD,EAAAnG,EACA,EAAAyC,EACA,EAAAC,EACA,EAAAyD,CACF,CAAA,CAEJ,CAvVE,OAAAC,EAvBmBjG,EAuBZ,YAAYoD,GACnB6C,EAxBmBjG,EAwBZ,SAASqD,GAChB4C,EAzBmBjG,EAyBZ,kBAAkBmE,GACzB8B,EA1BmBjG,EA0BZ,QAAQgF,GACfiB,EA3BmBjG,EA2BZ,QAAQsF,GACfW,EA5BmBjG,EA4BZ,QAAQuF,GACfU,EA7BmBjG,EA6BZ,OAAOiF,GACdgB,EA9BmBjG,EA8BZ,WAAWwF,GAClBS,EA/BmBjG,EA+BZ,YAAYE,GACnB+F,EAhCmBjG,EAgCZ,aAAa2B,GACpBsE,EAjCmBjG,EAiCZ,aAAa4B,GACpBqE,EAlCmBjG,EAkCZ,UAAUkD,GACjB+C,EAnCmBjG,EAmCZ,oBAAoBL,GAC3BsG,EApCmBjG,EAoCZ,qBAAqBF"} \ No newline at end of file +{"version":3,"file":"dommatrix.js","sources":["../src/index.ts"],"sourcesContent":["import type {\n CSSMatrixInput,\n JSONMatrix,\n Matrix,\n Matrix3d,\n PointTuple,\n} 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 = (\n array?: unknown,\n): 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 = (\n object?: unknown,\n): object is CSSMatrix | DOMMatrix | JSONMatrix => {\n return (\n object instanceof DOMMatrix ||\n object instanceof CSSMatrix ||\n (typeof object === \"object\" &&\n 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 = (\n array: number[] | Float32Array | Float64Array,\n): CSSMatrix => {\n const m = new CSSMatrix();\n const a = Array.from(array);\n\n if (!isCompatibleArray(a)) {\n throw TypeError(\n `CSSMatrix: \"${a.join(\",\")}\" must be an array with 6/16 numbers.`,\n );\n }\n // istanbul ignore else @preserve\n if (a.length === 16) {\n const [\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ] = 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(\n `CSSMatrix: \"${\n JSON.stringify(m)\n }\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`,\n );\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,\n ) => (n.includes(\"rad\")\n ? parseFloat(n) * (180 / Math.PI)\n : parseFloat(n))\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 (\n prop === \"perspective\" && x && [y, z].every((n) => n === undefined)\n ) {\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 (\n prop === \"translate3d\" && xyz.every((n) => !Number.isNaN(+n))\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 (\n prop === \"rotate3d\" && xyza.every((n) => !Number.isNaN(+n)) && a\n ) {\n m = m.rotateAxisAngle(x, y, z, a);\n // single value expected\n } else if (\n prop === \"rotate\" && x && [y, z].every((n) => n === undefined)\n ) {\n m = m.rotate(0, 0, x);\n // 3 values expected\n } else if (\n prop === \"scale3d\" && xyz.every((n) => !Number.isNaN(+n)) &&\n xyz.some((n) => n !== 1)\n ) {\n m = m.scale(x, y, z);\n // single value expected\n } else if (\n // prop === \"scale\" && !Number.isNaN(x) && x !== 1 && z === undefined\n prop === \"scale\" && !Number.isNaN(x) && [x, y].some((n) => n !== 1) &&\n z === undefined\n ) {\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 (\n prop === \"skew\" && (x || (!Number.isNaN(x) && y)) && z === undefined\n ) {\n m = m.skew(x, y || 0);\n } else if (\n [\"translate\", \"rotate\", \"scale\", \"skew\"].some((p) =>\n prop.includes(p)\n ) &&\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\n | \"scale\"\n | \"translate\"\n | \"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] = [\n idx === 0 ? x : def,\n idx === 1 ? x : def,\n idx === 2 ? x : def,\n ];\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 = (\n m: CSSMatrix | DOMMatrix | JSONMatrix,\n is2D?: boolean,\n): 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 = (\n x: number,\n y: number,\n z: number,\n alpha: number,\n): 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 = (\n m1: CSSMatrix | DOMMatrix | JSONMatrix,\n m2: CSSMatrix | DOMMatrix | JSONMatrix,\n): CSSMatrix => {\n const m11 = m2.m11 * m1.m11 + m2.m12 * m1.m21 + m2.m13 * m1.m31 +\n m2.m14 * m1.m41;\n const m12 = m2.m11 * m1.m12 + m2.m12 * m1.m22 + m2.m13 * m1.m32 +\n m2.m14 * m1.m42;\n const m13 = m2.m11 * m1.m13 + m2.m12 * m1.m23 + m2.m13 * m1.m33 +\n m2.m14 * m1.m43;\n const m14 = m2.m11 * m1.m14 + m2.m12 * m1.m24 + m2.m13 * m1.m34 +\n m2.m14 * m1.m44;\n\n const m21 = m2.m21 * m1.m11 + m2.m22 * m1.m21 + m2.m23 * m1.m31 +\n m2.m24 * m1.m41;\n const m22 = m2.m21 * m1.m12 + m2.m22 * m1.m22 + m2.m23 * m1.m32 +\n m2.m24 * m1.m42;\n const m23 = m2.m21 * m1.m13 + m2.m22 * m1.m23 + m2.m23 * m1.m33 +\n m2.m24 * m1.m43;\n const m24 = m2.m21 * m1.m14 + m2.m22 * m1.m24 + m2.m23 * m1.m34 +\n m2.m24 * m1.m44;\n\n const m31 = m2.m31 * m1.m11 + m2.m32 * m1.m21 + m2.m33 * m1.m31 +\n m2.m34 * m1.m41;\n const m32 = m2.m31 * m1.m12 + m2.m32 * m1.m22 + m2.m33 * m1.m32 +\n m2.m34 * m1.m42;\n const m33 = m2.m31 * m1.m13 + m2.m32 * m1.m23 + m2.m33 * m1.m33 +\n m2.m34 * m1.m43;\n const m34 = m2.m31 * m1.m14 + m2.m32 * m1.m24 + m2.m33 * m1.m34 +\n m2.m34 * m1.m44;\n\n const m41 = m2.m41 * m1.m11 + m2.m42 * m1.m21 + m2.m43 * m1.m31 +\n m2.m44 * m1.m41;\n const m42 = m2.m41 * m1.m12 + m2.m42 * m1.m22 + m2.m43 * m1.m32 +\n m2.m44 * m1.m42;\n const m43 = m2.m41 * m1.m13 + m2.m42 * m1.m23 + m2.m43 * m1.m33 +\n m2.m44 * m1.m43;\n const m44 = m2.m41 * m1.m14 + m2.m42 * m1.m24 + m2.m43 * m1.m34 +\n m2.m44 * m1.m44;\n\n return fromArray([\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ]);\n};\n\n/**\n * Creates and returns a new `DOMMatrix` compatible instance\n * with equivalent instance.\n *\n * @class CSSMatrix\n *\n * @author thednp \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 &&\n 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 (\n Array.isArray(source) || source instanceof Float64Array ||\n source instanceof Float32Array\n ) {\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 (\n typeof rx === \"number\" && typeof ry === \"undefined\" &&\n typeof rz === \"undefined\"\n ) {\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 ? new DOMPoint(x, y, z, w) : {\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":"0MASA,MAAMA,EAA0B,CAC9B,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,KAAM,GACN,WAAY,EACd,EAUMC,EACJC,IAGGA,aAAiB,cAChBA,aAAiB,cAChB,MAAM,QAAQA,CAAK,GAAKA,EAAM,MAAOC,GAAM,OAAOA,GAAM,QAAQ,IACnE,CAAC,EAAG,EAAE,EAAE,KAAMA,GAAMD,EAAM,SAAWC,CAAC,EAKpCC,EACJC,GAGEA,aAAkB,WAClBA,aAAkBC,GACjB,OAAOD,GAAW,UACjB,OAAO,KAAKL,CAAW,EAAE,MAAOO,GAAMF,GAAUE,KAAKF,CAAM,EAc3DG,EACJN,GACc,CACR,MAAAO,EAAI,IAAIH,EACRI,EAAI,MAAM,KAAKR,CAAK,EAEtB,GAAA,CAACD,EAAkBS,CAAC,EAChB,MAAA,UACJ,eAAeA,EAAE,KAAK,GAAG,CAAC,uCAC5B,EACF;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AK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EACpEyC,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EACpEC,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EACpEyD,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAAI,KAAK,IAAM,EAAE,EAEnE,OAAA,aAAa,SAAW,IAAI,SAASnG,EAAGyC,EAAGC,EAAGyD,CAAC,EAAI,CACxD,EAAAnG,EACA,EAAAyC,EACA,EAAAC,EACA,EAAAyD,CACF,CAAA,CAEJ,CAvVE,OAAAC,EAvBmBjG,EAuBZ,YAAYoD,GACnB6C,EAxBmBjG,EAwBZ,SAASqD,GAChB4C,EAzBmBjG,EAyBZ,kBAAkBmE,GACzB8B,EA1BmBjG,EA0BZ,QAAQgF,GACfiB,EA3BmBjG,EA2BZ,QAAQsF,GACfW,EA5BmBjG,EA4BZ,QAAQuF,GACfU,EA7BmBjG,EA6BZ,OAAOiF,GACdgB,EA9BmBjG,EA8BZ,WAAWwF,GAClBS,EA/BmBjG,EA+BZ,YAAYE,GACnB+F,EAhCmBjG,EAgCZ,aAAa2B,GACpBsE,EAjCmBjG,EAiCZ,aAAa4B,GACpBqE,EAlCmBjG,EAkCZ,UAAUkD,GACjB+C,EAnCmBjG,EAmCZ,oBAAoBL,GAC3BsG,EApCmBjG,EAoCZ,qBAAqBF"} \ No newline at end of file diff --git a/dist/dommatrix.mjs b/dist/dommatrix.mjs index af4c482..374a5b4 100644 --- a/dist/dommatrix.mjs +++ b/dist/dommatrix.mjs @@ -37,10 +37,10 @@ const $ = { const [ n, i, - r, + m, a, l, - m, + r, h, c, u, @@ -52,10 +52,10 @@ const $ = { M, b ] = e; - t.m11 = n, t.a = n, t.m21 = l, t.c = l, t.m31 = u, t.m41 = d, t.e = d, t.m12 = i, t.b = i, t.m22 = m, t.d = m, t.m32 = f, t.m42 = A, t.f = A, t.m13 = r, t.m23 = h, t.m33 = w, t.m43 = M, t.m14 = a, t.m24 = c, t.m34 = o, t.m44 = b; + t.m11 = n, t.a = n, t.m21 = l, t.c = l, t.m31 = u, t.m41 = d, t.e = d, t.m12 = i, t.b = i, t.m22 = r, t.d = r, t.m32 = f, t.m42 = A, t.f = A, t.m13 = m, t.m23 = h, t.m33 = w, t.m43 = M, t.m14 = a, t.m24 = c, t.m34 = o, t.m44 = b; } else if (e.length === 6) { - const [n, i, r, a, l, m] = e; - t.m11 = n, t.a = n, t.m12 = i, t.b = i, t.m21 = r, t.c = r, t.m22 = a, t.d = a, t.m41 = l, t.e = l, t.m42 = m, t.f = m; + const [n, i, m, a, l, r] = e; + t.m11 = n, t.a = n, t.m12 = i, t.b = i, t.m21 = m, t.c = m, t.m22 = a, t.d = a, t.m41 = l, t.e = l, t.m42 = r, t.f = r; } return t; }, X = (s) => { @@ -88,41 +88,44 @@ const $ = { let e = new y(); const n = `CSSMatrix: invalid transform string "${s}"`; return t.split(")").filter((i) => i).forEach((i) => { - const [r, a] = i.split("("); + const [m, a] = i.split("("); if (!a) throw TypeError(n); const l = a.split(",").map( (o) => o.includes("rad") ? parseFloat(o) * (180 / Math.PI) : parseFloat(o) - ), [m, h, c, u] = l, f = [m, h, c], w = [m, h, c, u]; - if (r === "perspective" && m && [h, c].every((o) => o === void 0)) - e.m34 = -1 / m; - else if (r.includes("matrix") && [6, 16].includes(l.length) && l.every((o) => !Number.isNaN(+o))) { + ), [r, h, c, u] = l, f = [r, h, c], w = [r, h, c, u]; + if (m === "perspective" && r && [h, c].every((o) => o === void 0)) + e.m34 = -1 / r; + else if (m.includes("matrix") && [6, 16].includes(l.length) && l.every((o) => !Number.isNaN(+o))) { const o = l.map((d) => Math.abs(d) < 1e-6 ? 0 : d); e = e.multiply(g(o)); - } else if (r === "translate3d" && f.every((o) => !Number.isNaN(+o))) - e = e.translate(m, h, c); - else if (r === "translate" && m && c === void 0) - e = e.translate(m, h || 0, 0); - else if (r === "rotate3d" && w.every((o) => !Number.isNaN(+o)) && u) - e = e.rotateAxisAngle(m, h, c, u); - else if (r === "rotate" && m && [h, c].every((o) => o === void 0)) - e = e.rotate(0, 0, m); - else if (r === "scale3d" && f.every((o) => !Number.isNaN(+o)) && f.some((o) => o !== 1)) - e = e.scale(m, h, c); - else if (r === "scale" && !Number.isNaN(m) && m !== 1 && c === void 0) { - const d = Number.isNaN(+h) ? m : h; - e = e.scale(m, d, 1); - } else if (r === "skew" && (m || !Number.isNaN(m) && h) && c === void 0) - e = e.skew(m, h || 0); + } else if (m === "translate3d" && f.every((o) => !Number.isNaN(+o))) + e = e.translate(r, h, c); + else if (m === "translate" && r && c === void 0) + e = e.translate(r, h || 0, 0); + else if (m === "rotate3d" && w.every((o) => !Number.isNaN(+o)) && u) + e = e.rotateAxisAngle(r, h, c, u); + else if (m === "rotate" && r && [h, c].every((o) => o === void 0)) + e = e.rotate(0, 0, r); + else if (m === "scale3d" && f.every((o) => !Number.isNaN(+o)) && f.some((o) => o !== 1)) + e = e.scale(r, h, c); + else if ( + // prop === "scale" && !Number.isNaN(x) && x !== 1 && z === undefined + m === "scale" && !Number.isNaN(r) && [r, h].some((o) => o !== 1) && c === void 0 + ) { + const d = Number.isNaN(+h) ? r : h; + e = e.scale(r, d, 1); + } else if (m === "skew" && (r || !Number.isNaN(r) && h) && c === void 0) + e = e.skew(r, h || 0); else if (["translate", "rotate", "scale", "skew"].some( - (o) => r.includes(o) - ) && /[XYZ]/.test(r) && m && [h, c].every((o) => o === void 0)) - if (r === "skewX" || r === "skewY") - e = e[r](m); + (o) => m.includes(o) + ) && /[XYZ]/.test(m) && r && [h, c].every((o) => o === void 0)) + if (m === "skewX" || m === "skewY") + e = e[m](r); else { - const o = r.replace(/[XYZ]/, ""), d = r.replace(o, ""), A = ["X", "Y", "Z"].indexOf(d), M = o === "scale" ? 1 : 0, b = [ - A === 0 ? m : M, - A === 1 ? m : M, - A === 2 ? m : M + const o = m.replace(/[XYZ]/, ""), d = m.replace(o, ""), A = ["X", "Y", "Z"].indexOf(d), M = o === "scale" ? 1 : 0, b = [ + A === 0 ? r : M, + A === 1 ? r : M, + A === 2 ? r : M ]; e = e[o](...b); } @@ -150,24 +153,24 @@ const $ = { const n = new y(); return n.m41 = s, n.e = s, n.m42 = t, n.f = t, n.m43 = e, n; }, F = (s, t, e) => { - const n = new y(), i = Math.PI / 180, r = s * i, a = t * i, l = e * i, m = Math.cos(r), h = -Math.sin(r), c = Math.cos(a), u = -Math.sin(a), f = Math.cos(l), w = -Math.sin(l), o = c * f, d = -c * w; + const n = new y(), i = Math.PI / 180, m = s * i, a = t * i, l = e * i, r = Math.cos(m), h = -Math.sin(m), c = Math.cos(a), u = -Math.sin(a), f = Math.cos(l), w = -Math.sin(l), o = c * f, d = -c * w; n.m11 = o, n.a = o, n.m12 = d, n.b = d, n.m13 = u; - const A = h * u * f + m * w; + const A = h * u * f + r * w; n.m21 = A, n.c = A; - const M = m * f - h * u * w; - return n.m22 = M, n.d = M, n.m23 = -h * c, n.m31 = h * w - m * u * f, n.m32 = h * f + m * u * w, n.m33 = m * c, n; + const M = r * f - h * u * w; + return n.m22 = M, n.d = M, n.m23 = -h * c, n.m31 = h * w - r * u * f, n.m32 = h * f + r * u * w, n.m33 = r * c, n; }, T = (s, t, e, n) => { - const i = new y(), r = Math.sqrt(s * s + t * t + e * e); - if (r === 0) + const i = new y(), m = Math.sqrt(s * s + t * t + e * e); + if (m === 0) return i; - const a = s / r, l = t / r, m = e / r, h = n * (Math.PI / 360), c = Math.sin(h), u = Math.cos(h), f = c * c, w = a * a, o = l * l, d = m * m, A = 1 - 2 * (o + d) * f; + const a = s / m, l = t / m, r = e / m, h = n * (Math.PI / 360), c = Math.sin(h), u = Math.cos(h), f = c * c, w = a * a, o = l * l, d = r * r, A = 1 - 2 * (o + d) * f; i.m11 = A, i.a = A; - const M = 2 * (a * l * f + m * c * u); - i.m12 = M, i.b = M, i.m13 = 2 * (a * m * f - l * c * u); - const b = 2 * (l * a * f - m * c * u); + const M = 2 * (a * l * f + r * c * u); + i.m12 = M, i.b = M, i.m13 = 2 * (a * r * f - l * c * u); + const b = 2 * (l * a * f - r * c * u); i.m21 = b, i.c = b; const k = 1 - 2 * (d + w) * f; - return i.m22 = k, i.d = k, i.m23 = 2 * (l * m * f + a * c * u), i.m31 = 2 * (m * a * f + l * c * u), i.m32 = 2 * (m * l * f - a * c * u), i.m33 = 1 - 2 * (w + o) * f, i; + return i.m22 = k, i.d = k, i.m23 = 2 * (l * r * f + a * c * u), i.m31 = 2 * (r * a * f + l * c * u), i.m32 = 2 * (r * l * f - a * c * u), i.m33 = 1 - 2 * (w + o) * f, i; }, I = (s, t, e) => { const n = new y(); return n.m11 = s, n.a = s, n.m22 = t, n.d = t, n.m33 = e, n; @@ -183,15 +186,15 @@ const $ = { } return e; }, R = (s) => v(s, 0), D = (s) => v(0, s), N = (s, t) => { - const e = t.m11 * s.m11 + t.m12 * s.m21 + t.m13 * s.m31 + t.m14 * s.m41, n = t.m11 * s.m12 + t.m12 * s.m22 + t.m13 * s.m32 + t.m14 * s.m42, i = t.m11 * s.m13 + t.m12 * s.m23 + t.m13 * s.m33 + t.m14 * s.m43, r = t.m11 * s.m14 + t.m12 * s.m24 + t.m13 * s.m34 + t.m14 * s.m44, a = t.m21 * s.m11 + t.m22 * s.m21 + t.m23 * s.m31 + t.m24 * s.m41, l = t.m21 * s.m12 + t.m22 * s.m22 + t.m23 * s.m32 + t.m24 * s.m42, m = t.m21 * s.m13 + t.m22 * s.m23 + t.m23 * s.m33 + t.m24 * s.m43, h = t.m21 * s.m14 + t.m22 * s.m24 + t.m23 * s.m34 + t.m24 * s.m44, c = t.m31 * s.m11 + t.m32 * s.m21 + t.m33 * s.m31 + t.m34 * s.m41, u = t.m31 * s.m12 + t.m32 * s.m22 + t.m33 * s.m32 + t.m34 * s.m42, f = t.m31 * s.m13 + t.m32 * s.m23 + t.m33 * s.m33 + t.m34 * s.m43, w = t.m31 * s.m14 + t.m32 * s.m24 + t.m33 * s.m34 + t.m34 * s.m44, o = t.m41 * s.m11 + t.m42 * s.m21 + t.m43 * s.m31 + t.m44 * s.m41, d = t.m41 * s.m12 + t.m42 * s.m22 + t.m43 * s.m32 + t.m44 * s.m42, A = t.m41 * s.m13 + t.m42 * s.m23 + t.m43 * s.m33 + t.m44 * s.m43, M = t.m41 * s.m14 + t.m42 * s.m24 + t.m43 * s.m34 + t.m44 * s.m44; + const e = t.m11 * s.m11 + t.m12 * s.m21 + t.m13 * s.m31 + t.m14 * s.m41, n = t.m11 * s.m12 + t.m12 * s.m22 + t.m13 * s.m32 + t.m14 * s.m42, i = t.m11 * s.m13 + t.m12 * s.m23 + t.m13 * s.m33 + t.m14 * s.m43, m = t.m11 * s.m14 + t.m12 * s.m24 + t.m13 * s.m34 + t.m14 * s.m44, a = t.m21 * s.m11 + t.m22 * s.m21 + t.m23 * s.m31 + t.m24 * s.m41, l = t.m21 * s.m12 + t.m22 * s.m22 + t.m23 * s.m32 + t.m24 * s.m42, r = t.m21 * s.m13 + t.m22 * s.m23 + t.m23 * s.m33 + t.m24 * s.m43, h = t.m21 * s.m14 + t.m22 * s.m24 + t.m23 * s.m34 + t.m24 * s.m44, c = t.m31 * s.m11 + t.m32 * s.m21 + t.m33 * s.m31 + t.m34 * s.m41, u = t.m31 * s.m12 + t.m32 * s.m22 + t.m33 * s.m32 + t.m34 * s.m42, f = t.m31 * s.m13 + t.m32 * s.m23 + t.m33 * s.m33 + t.m34 * s.m43, w = t.m31 * s.m14 + t.m32 * s.m24 + t.m33 * s.m34 + t.m34 * s.m44, o = t.m41 * s.m11 + t.m42 * s.m21 + t.m43 * s.m31 + t.m44 * s.m41, d = t.m41 * s.m12 + t.m42 * s.m22 + t.m43 * s.m32 + t.m44 * s.m42, A = t.m41 * s.m13 + t.m42 * s.m23 + t.m43 * s.m33 + t.m44 * s.m43, M = t.m41 * s.m14 + t.m42 * s.m24 + t.m43 * s.m34 + t.m44 * s.m44; return g([ e, n, i, - r, + m, a, l, - m, + r, h, c, u, @@ -323,8 +326,8 @@ class y { */ translate(t, e, n) { const i = t; - let r = e, a = n; - return typeof r > "u" && (r = 0), typeof a > "u" && (a = 0), N(this, Y(i, r, a)); + let m = e, a = n; + return typeof m > "u" && (m = 0), typeof a > "u" && (a = 0), N(this, Y(i, m, a)); } /** * The scale method returns a new matrix which is this matrix post multiplied by @@ -339,8 +342,8 @@ class y { */ scale(t, e, n) { const i = t; - let r = e, a = n; - return typeof r > "u" && (r = t), typeof a > "u" && (a = 1), N(this, I(i, r, a)); + let m = e, a = n; + return typeof m > "u" && (m = t), typeof a > "u" && (a = 1), N(this, I(i, m, a)); } /** * The rotate method returns a new matrix which is this matrix post multiplied @@ -355,8 +358,8 @@ class y { * @return The resulted matrix */ rotate(t, e, n) { - let i = t, r = e || 0, a = n || 0; - return typeof t == "number" && typeof e > "u" && typeof n > "u" && (a = i, i = 0, r = 0), N(this, F(i, r, a)); + let i = t, m = e || 0, a = n || 0; + return typeof t == "number" && typeof e > "u" && typeof n > "u" && (a = i, i = 0, m = 0), N(this, F(i, m, a)); } /** * The rotateAxisAngle method returns a new matrix which is this matrix post @@ -371,7 +374,7 @@ class y { * @return The resulted matrix */ rotateAxisAngle(t, e, n, i) { - if ([t, e, n, i].some((r) => Number.isNaN(+r))) + if ([t, e, n, i].some((m) => Number.isNaN(+m))) throw new TypeError("CSSMatrix: expecting 4 values"); return N(this, T(t, e, n, i)); } @@ -418,12 +421,12 @@ class y { * @return the resulting Tuple */ transformPoint(t) { - 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; - return t instanceof DOMPoint ? new DOMPoint(e, n, i, r) : { + 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, m = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w; + return t instanceof DOMPoint ? new DOMPoint(e, n, i, m) : { x: e, y: n, z: i, - w: r + w: m }; } } diff --git a/dist/dommatrix.mjs.map b/dist/dommatrix.mjs.map index d30e4d9..bf51fae 100644 --- a/dist/dommatrix.mjs.map +++ b/dist/dommatrix.mjs.map @@ -1 +1 @@ -{"version":3,"file":"dommatrix.mjs","sources":["../src/index.ts"],"sourcesContent":["import type {\n CSSMatrixInput,\n JSONMatrix,\n Matrix,\n Matrix3d,\n PointTuple,\n} 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 = (\n array?: unknown,\n): 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 = (\n object?: unknown,\n): object is CSSMatrix | DOMMatrix | JSONMatrix => {\n return (\n object instanceof DOMMatrix ||\n object instanceof CSSMatrix ||\n (typeof object === \"object\" &&\n 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 = (\n array: number[] | Float32Array | Float64Array,\n): CSSMatrix => {\n const m = new CSSMatrix();\n const a = Array.from(array);\n\n if (!isCompatibleArray(a)) {\n throw TypeError(\n `CSSMatrix: \"${a.join(\",\")}\" must be an array with 6/16 numbers.`,\n );\n }\n // istanbul ignore else @preserve\n if (a.length === 16) {\n const [\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ] = 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(\n `CSSMatrix: \"${\n JSON.stringify(m)\n }\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`,\n );\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,\n ) => (n.includes(\"rad\")\n ? parseFloat(n) * (180 / Math.PI)\n : parseFloat(n))\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 (\n prop === \"perspective\" && x && [y, z].every((n) => n === undefined)\n ) {\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 (\n prop === \"translate3d\" && xyz.every((n) => !Number.isNaN(+n))\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 (\n prop === \"rotate3d\" && xyza.every((n) => !Number.isNaN(+n)) && a\n ) {\n m = m.rotateAxisAngle(x, y, z, a);\n // single value expected\n } else if (\n prop === \"rotate\" && x && [y, z].every((n) => n === undefined)\n ) {\n m = m.rotate(0, 0, x);\n // 3 values expected\n } else if (\n prop === \"scale3d\" && xyz.every((n) => !Number.isNaN(+n)) &&\n xyz.some((n) => n !== 1)\n ) {\n m = m.scale(x, y, z);\n // single value expected\n } else if (\n prop === \"scale\" && !Number.isNaN(x) && x !== 1 && z === undefined\n ) {\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 (\n prop === \"skew\" && (x || (!Number.isNaN(x) && y)) && z === undefined\n ) {\n m = m.skew(x, y || 0);\n } else if (\n [\"translate\", \"rotate\", \"scale\", \"skew\"].some((p) =>\n prop.includes(p)\n ) &&\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\n | \"scale\"\n | \"translate\"\n | \"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] = [\n idx === 0 ? x : def,\n idx === 1 ? x : def,\n idx === 2 ? x : def,\n ];\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 = (\n m: CSSMatrix | DOMMatrix | JSONMatrix,\n is2D?: boolean,\n): 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 = (\n x: number,\n y: number,\n z: number,\n alpha: number,\n): 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 = (\n m1: CSSMatrix | DOMMatrix | JSONMatrix,\n m2: CSSMatrix | DOMMatrix | JSONMatrix,\n): CSSMatrix => {\n const m11 = m2.m11 * m1.m11 + m2.m12 * m1.m21 + m2.m13 * m1.m31 +\n m2.m14 * m1.m41;\n const m12 = m2.m11 * m1.m12 + m2.m12 * m1.m22 + m2.m13 * m1.m32 +\n m2.m14 * m1.m42;\n const m13 = m2.m11 * m1.m13 + m2.m12 * m1.m23 + m2.m13 * m1.m33 +\n m2.m14 * m1.m43;\n const m14 = m2.m11 * m1.m14 + m2.m12 * m1.m24 + m2.m13 * m1.m34 +\n m2.m14 * m1.m44;\n\n const m21 = m2.m21 * m1.m11 + m2.m22 * m1.m21 + m2.m23 * m1.m31 +\n m2.m24 * m1.m41;\n const m22 = m2.m21 * m1.m12 + m2.m22 * m1.m22 + m2.m23 * m1.m32 +\n m2.m24 * m1.m42;\n const m23 = m2.m21 * m1.m13 + m2.m22 * m1.m23 + m2.m23 * m1.m33 +\n m2.m24 * m1.m43;\n const m24 = m2.m21 * m1.m14 + m2.m22 * m1.m24 + m2.m23 * m1.m34 +\n m2.m24 * m1.m44;\n\n const m31 = m2.m31 * m1.m11 + m2.m32 * m1.m21 + m2.m33 * m1.m31 +\n m2.m34 * m1.m41;\n const m32 = m2.m31 * m1.m12 + m2.m32 * m1.m22 + m2.m33 * m1.m32 +\n m2.m34 * m1.m42;\n const m33 = m2.m31 * m1.m13 + m2.m32 * m1.m23 + m2.m33 * m1.m33 +\n m2.m34 * m1.m43;\n const m34 = m2.m31 * m1.m14 + m2.m32 * m1.m24 + m2.m33 * m1.m34 +\n m2.m34 * m1.m44;\n\n const m41 = m2.m41 * m1.m11 + m2.m42 * m1.m21 + m2.m43 * m1.m31 +\n m2.m44 * m1.m41;\n const m42 = m2.m41 * m1.m12 + m2.m42 * m1.m22 + m2.m43 * m1.m32 +\n m2.m44 * m1.m42;\n const m43 = m2.m41 * m1.m13 + m2.m42 * m1.m23 + m2.m43 * m1.m33 +\n m2.m44 * m1.m43;\n const m44 = m2.m41 * m1.m14 + m2.m42 * m1.m24 + m2.m43 * m1.m34 +\n m2.m44 * m1.m44;\n\n return fromArray([\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ]);\n};\n\n/**\n * Creates and returns a new `DOMMatrix` compatible instance\n * with equivalent instance.\n *\n * @class CSSMatrix\n *\n * @author thednp \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 &&\n 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 (\n Array.isArray(source) || source instanceof Float64Array ||\n source instanceof Float32Array\n ) {\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 (\n typeof rx === \"number\" && typeof ry === \"undefined\" &&\n typeof rz === \"undefined\"\n ) {\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 ? new DOMPoint(x, y, z, w) : {\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":";;;AASA,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;AAA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BL,IAC3BsG,EApCmBjG,GAoCZ,sBAAqBF;"} \ No newline at end of file +{"version":3,"file":"dommatrix.mjs","sources":["../src/index.ts"],"sourcesContent":["import type {\n CSSMatrixInput,\n JSONMatrix,\n Matrix,\n Matrix3d,\n PointTuple,\n} 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 = (\n array?: unknown,\n): 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 = (\n object?: unknown,\n): object is CSSMatrix | DOMMatrix | JSONMatrix => {\n return (\n object instanceof DOMMatrix ||\n object instanceof CSSMatrix ||\n (typeof object === \"object\" &&\n 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 = (\n array: number[] | Float32Array | Float64Array,\n): CSSMatrix => {\n const m = new CSSMatrix();\n const a = Array.from(array);\n\n if (!isCompatibleArray(a)) {\n throw TypeError(\n `CSSMatrix: \"${a.join(\",\")}\" must be an array with 6/16 numbers.`,\n );\n }\n // istanbul ignore else @preserve\n if (a.length === 16) {\n const [\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ] = 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(\n `CSSMatrix: \"${\n JSON.stringify(m)\n }\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`,\n );\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,\n ) => (n.includes(\"rad\")\n ? parseFloat(n) * (180 / Math.PI)\n : parseFloat(n))\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 (\n prop === \"perspective\" && x && [y, z].every((n) => n === undefined)\n ) {\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 (\n prop === \"translate3d\" && xyz.every((n) => !Number.isNaN(+n))\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 (\n prop === \"rotate3d\" && xyza.every((n) => !Number.isNaN(+n)) && a\n ) {\n m = m.rotateAxisAngle(x, y, z, a);\n // single value expected\n } else if (\n prop === \"rotate\" && x && [y, z].every((n) => n === undefined)\n ) {\n m = m.rotate(0, 0, x);\n // 3 values expected\n } else if (\n prop === \"scale3d\" && xyz.every((n) => !Number.isNaN(+n)) &&\n xyz.some((n) => n !== 1)\n ) {\n m = m.scale(x, y, z);\n // single value expected\n } else if (\n // prop === \"scale\" && !Number.isNaN(x) && x !== 1 && z === undefined\n prop === \"scale\" && !Number.isNaN(x) && [x, y].some((n) => n !== 1) &&\n z === undefined\n ) {\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 (\n prop === \"skew\" && (x || (!Number.isNaN(x) && y)) && z === undefined\n ) {\n m = m.skew(x, y || 0);\n } else if (\n [\"translate\", \"rotate\", \"scale\", \"skew\"].some((p) =>\n prop.includes(p)\n ) &&\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\n | \"scale\"\n | \"translate\"\n | \"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] = [\n idx === 0 ? x : def,\n idx === 1 ? x : def,\n idx === 2 ? x : def,\n ];\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 = (\n m: CSSMatrix | DOMMatrix | JSONMatrix,\n is2D?: boolean,\n): 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 = (\n x: number,\n y: number,\n z: number,\n alpha: number,\n): 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 = (\n m1: CSSMatrix | DOMMatrix | JSONMatrix,\n m2: CSSMatrix | DOMMatrix | JSONMatrix,\n): CSSMatrix => {\n const m11 = m2.m11 * m1.m11 + m2.m12 * m1.m21 + m2.m13 * m1.m31 +\n m2.m14 * m1.m41;\n const m12 = m2.m11 * m1.m12 + m2.m12 * m1.m22 + m2.m13 * m1.m32 +\n m2.m14 * m1.m42;\n const m13 = m2.m11 * m1.m13 + m2.m12 * m1.m23 + m2.m13 * m1.m33 +\n m2.m14 * m1.m43;\n const m14 = m2.m11 * m1.m14 + m2.m12 * m1.m24 + m2.m13 * m1.m34 +\n m2.m14 * m1.m44;\n\n const m21 = m2.m21 * m1.m11 + m2.m22 * m1.m21 + m2.m23 * m1.m31 +\n m2.m24 * m1.m41;\n const m22 = m2.m21 * m1.m12 + m2.m22 * m1.m22 + m2.m23 * m1.m32 +\n m2.m24 * m1.m42;\n const m23 = m2.m21 * m1.m13 + m2.m22 * m1.m23 + m2.m23 * m1.m33 +\n m2.m24 * m1.m43;\n const m24 = m2.m21 * m1.m14 + m2.m22 * m1.m24 + m2.m23 * m1.m34 +\n m2.m24 * m1.m44;\n\n const m31 = m2.m31 * m1.m11 + m2.m32 * m1.m21 + m2.m33 * m1.m31 +\n m2.m34 * m1.m41;\n const m32 = m2.m31 * m1.m12 + m2.m32 * m1.m22 + m2.m33 * m1.m32 +\n m2.m34 * m1.m42;\n const m33 = m2.m31 * m1.m13 + m2.m32 * m1.m23 + m2.m33 * m1.m33 +\n m2.m34 * m1.m43;\n const m34 = m2.m31 * m1.m14 + m2.m32 * m1.m24 + m2.m33 * m1.m34 +\n m2.m34 * m1.m44;\n\n const m41 = m2.m41 * m1.m11 + m2.m42 * m1.m21 + m2.m43 * m1.m31 +\n m2.m44 * m1.m41;\n const m42 = m2.m41 * m1.m12 + m2.m42 * m1.m22 + m2.m43 * m1.m32 +\n m2.m44 * m1.m42;\n const m43 = m2.m41 * m1.m13 + m2.m42 * m1.m23 + m2.m43 * m1.m33 +\n m2.m44 * m1.m43;\n const m44 = m2.m41 * m1.m14 + m2.m42 * m1.m24 + m2.m43 * m1.m34 +\n m2.m44 * m1.m44;\n\n return fromArray([\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ]);\n};\n\n/**\n * Creates and returns a new `DOMMatrix` compatible instance\n * with equivalent instance.\n *\n * @class CSSMatrix\n *\n * @author thednp \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 &&\n 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 (\n Array.isArray(source) || source instanceof Float64Array ||\n source instanceof Float32Array\n ) {\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 (\n typeof rx === \"number\" && typeof ry === \"undefined\" &&\n typeof rz === \"undefined\"\n ) {\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 ? new DOMPoint(x, y, z, w) : {\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":";;;AASA,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,CACxBC,OAGGA,aAAiB,gBAChBA,aAAiB,gBAChB,MAAM,QAAQA,CAAK,KAAKA,EAAM,M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K,MAAM,EAAE,GACpEyC,IAAI,KAAK,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,WAAW,IAAI,SAASnG,GAAGyC,GAAGC,GAAGyD,CAAC,IAAI;AAAA,MACxD,GAAAnG;AAAA,MACA,GAAAyC;AAAA,MACA,GAAAC;AAAA,MACA,GAAAyD;AAAA,IACF;AAAA,EAAA;AAEJ;AAvVEC,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;"} \ No newline at end of file diff --git a/docs/dommatrix.js b/docs/dommatrix.js index a5baf4b..7174bb4 100755 --- a/docs/dommatrix.js +++ b/docs/dommatrix.js @@ -1,3 +1,3 @@ var CSSMatrix=function(){"use strict";var z=Object.defineProperty;var S=(g,N,v)=>N in g?z(g,N,{enumerable:!0,configurable:!0,writable:!0,value:v}):g[N]=v;var p=(g,N,v)=>S(g,typeof N!="symbol"?N+"":N,v);const g={a:1,b:0,c:0,d:1,e:0,f:0,m11:1,m12:0,m13:0,m14:0,m21:0,m22:1,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,m41:0,m42:0,m43:0,m44:1,is2D:!0,isIdentity:!0},N=s=>(s instanceof Float64Array||s instanceof Float32Array||Array.isArray(s)&&s.every(t=>typeof t=="number"))&&[6,16].some(t=>s.length===t),v=s=>s instanceof DOMMatrix||s instanceof f||typeof s=="object"&&Object.keys(g).every(t=>s&&t in s),k=s=>{const t=new f,e=Array.from(s);if(!N(e))throw TypeError(`CSSMatrix: "${e.join(",")}" must be an array with 6/16 numbers.`);// istanbul ignore else @preserve -if(e.length===16){const[n,i,r,a,l,m,h,c,y,u,w,o,d,A,M,x]=e;t.m11=n,t.a=n,t.m21=l,t.c=l,t.m31=y,t.m41=d,t.e=d,t.m12=i,t.b=i,t.m22=m,t.d=m,t.m32=u,t.m42=A,t.f=A,t.m13=r,t.m23=h,t.m33=w,t.m43=M,t.m14=a,t.m24=c,t.m34=o,t.m44=x}else if(e.length===6){const[n,i,r,a,l,m]=e;t.m11=n,t.a=n,t.m12=i,t.b=i,t.m21=r,t.c=r,t.m22=a,t.d=a,t.m41=l,t.e=l,t.m42=m,t.f=m}return t},Y=s=>{if(v(s))return k([s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},F=s=>{if(typeof s!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a string.`);const t=String(s).replace(/\s/g,"");let e=new f;const n=`CSSMatrix: invalid transform string "${s}"`;return t.split(")").filter(i=>i).forEach(i=>{const[r,a]=i.split("(");if(!a)throw TypeError(n);const l=a.split(",").map(o=>o.includes("rad")?parseFloat(o)*(180/Math.PI):parseFloat(o)),[m,h,c,y]=l,u=[m,h,c],w=[m,h,c,y];if(r==="perspective"&&m&&[h,c].every(o=>o===void 0))e.m34=-1/m;else if(r.includes("matrix")&&[6,16].includes(l.length)&&l.every(o=>!Number.isNaN(+o))){const o=l.map(d=>Math.abs(d)<1e-6?0:d);e=e.multiply(k(o))}else if(r==="translate3d"&&u.every(o=>!Number.isNaN(+o)))e=e.translate(m,h,c);else if(r==="translate"&&m&&c===void 0)e=e.translate(m,h||0,0);else if(r==="rotate3d"&&w.every(o=>!Number.isNaN(+o))&&y)e=e.rotateAxisAngle(m,h,c,y);else if(r==="rotate"&&m&&[h,c].every(o=>o===void 0))e=e.rotate(0,0,m);else if(r==="scale3d"&&u.every(o=>!Number.isNaN(+o))&&u.some(o=>o!==1))e=e.scale(m,h,c);else if(r==="scale"&&!Number.isNaN(m)&&m!==1&&c===void 0){const d=Number.isNaN(+h)?m:h;e=e.scale(m,d,1)}else if(r==="skew"&&(m||!Number.isNaN(m)&&h)&&c===void 0)e=e.skew(m,h||0);else if(["translate","rotate","scale","skew"].some(o=>r.includes(o))&&/[XYZ]/.test(r)&&m&&[h,c].every(o=>o===void 0))if(r==="skewX"||r==="skewY")e=e[r](m);else{const o=r.replace(/[XYZ]/,""),d=r.replace(o,""),A=["X","Y","Z"].indexOf(d),M=o==="scale"?1:0,x=[A===0?m:M,A===1?m:M,A===2?m:M];e=e[o](...x)}else throw TypeError(n)}),e},O=(s,t)=>t?[s.a,s.b,s.c,s.d,s.e,s.f]:[s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44],T=(s,t,e)=>{const n=new f;return n.m41=s,n.e=s,n.m42=t,n.f=t,n.m43=e,n},I=(s,t,e)=>{const n=new f,i=Math.PI/180,r=s*i,a=t*i,l=e*i,m=Math.cos(r),h=-Math.sin(r),c=Math.cos(a),y=-Math.sin(a),u=Math.cos(l),w=-Math.sin(l),o=c*u,d=-c*w;n.m11=o,n.a=o,n.m12=d,n.b=d,n.m13=y;const A=h*y*u+m*w;n.m21=A,n.c=A;const M=m*u-h*y*w;return n.m22=M,n.d=M,n.m23=-h*c,n.m31=h*w-m*y*u,n.m32=h*u+m*y*w,n.m33=m*c,n},R=(s,t,e,n)=>{const i=new f,r=Math.sqrt(s*s+t*t+e*e);if(r===0)return i;const a=s/r,l=t/r,m=e/r,h=n*(Math.PI/360),c=Math.sin(h),y=Math.cos(h),u=c*c,w=a*a,o=l*l,d=m*m,A=1-2*(o+d)*u;i.m11=A,i.a=A;const M=2*(a*l*u+m*c*y);i.m12=M,i.b=M,i.m13=2*(a*m*u-l*c*y);const x=2*(l*a*u-m*c*y);i.m21=x,i.c=x;const Z=1-2*(d+w)*u;return i.m22=Z,i.d=Z,i.m23=2*(l*m*u+a*c*y),i.m31=2*(m*a*u+l*c*y),i.m32=2*(m*l*u-a*c*y),i.m33=1-2*(w+o)*u,i},D=(s,t,e)=>{const n=new f;return n.m11=s,n.a=s,n.m22=t,n.d=t,n.m33=e,n},X=(s,t)=>{const e=new f;if(s){const n=s*Math.PI/180,i=Math.tan(n);e.m21=i,e.c=i}if(t){const n=t*Math.PI/180,i=Math.tan(n);e.m12=i,e.b=i}return e},E=s=>X(s,0),P=s=>X(0,s),b=(s,t)=>{const e=t.m11*s.m11+t.m12*s.m21+t.m13*s.m31+t.m14*s.m41,n=t.m11*s.m12+t.m12*s.m22+t.m13*s.m32+t.m14*s.m42,i=t.m11*s.m13+t.m12*s.m23+t.m13*s.m33+t.m14*s.m43,r=t.m11*s.m14+t.m12*s.m24+t.m13*s.m34+t.m14*s.m44,a=t.m21*s.m11+t.m22*s.m21+t.m23*s.m31+t.m24*s.m41,l=t.m21*s.m12+t.m22*s.m22+t.m23*s.m32+t.m24*s.m42,m=t.m21*s.m13+t.m22*s.m23+t.m23*s.m33+t.m24*s.m43,h=t.m21*s.m14+t.m22*s.m24+t.m23*s.m34+t.m24*s.m44,c=t.m31*s.m11+t.m32*s.m21+t.m33*s.m31+t.m34*s.m41,y=t.m31*s.m12+t.m32*s.m22+t.m33*s.m32+t.m34*s.m42,u=t.m31*s.m13+t.m32*s.m23+t.m33*s.m33+t.m34*s.m43,w=t.m31*s.m14+t.m32*s.m24+t.m33*s.m34+t.m34*s.m44,o=t.m41*s.m11+t.m42*s.m21+t.m43*s.m31+t.m44*s.m41,d=t.m41*s.m12+t.m42*s.m22+t.m43*s.m32+t.m44*s.m42,A=t.m41*s.m13+t.m42*s.m23+t.m43*s.m33+t.m44*s.m43,M=t.m41*s.m14+t.m42*s.m24+t.m43*s.m34+t.m44*s.m44;return k([e,n,i,r,a,l,m,h,c,y,u,w,o,d,A,M])};class f{constructor(t){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}get isIdentity(){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}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){return typeof t=="string"&&t.length&&t!=="none"?F(t):Array.isArray(t)||t instanceof Float64Array||t instanceof Float32Array?k(t):typeof t=="object"?Y(t):this}toFloat32Array(t){return Float32Array.from(O(this,t))}toFloat64Array(t){return Float64Array.from(O(this,t))}toString(){const{is2D:t}=this,e=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${e})`}toJSON(){const{is2D:t,isIdentity:e}=this;return{...this,is2D:t,isIdentity:e}}multiply(t){return b(this,t)}translate(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=0),typeof a>"u"&&(a=0),b(this,T(i,r,a))}scale(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=t),typeof a>"u"&&(a=1),b(this,D(i,r,a))}rotate(t,e,n){let i=t,r=e||0,a=n||0;return typeof t=="number"&&typeof e>"u"&&typeof n>"u"&&(a=i,i=0,r=0),b(this,I(i,r,a))}rotateAxisAngle(t,e,n,i){if([t,e,n,i].some(r=>Number.isNaN(+r)))throw new TypeError("CSSMatrix: expecting 4 values");return b(this,R(t,e,n,i))}skewX(t){return b(this,E(t))}skewY(t){return b(this,P(t))}skew(t,e){return b(this,X(t,e))}transformPoint(t){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;return t instanceof DOMPoint?new DOMPoint(e,n,i,r):{x:e,y:n,z:i,w:r}}}return p(f,"Translate",T),p(f,"Rotate",I),p(f,"RotateAxisAngle",R),p(f,"Scale",D),p(f,"SkewX",E),p(f,"SkewY",P),p(f,"Skew",X),p(f,"Multiply",b),p(f,"fromArray",k),p(f,"fromMatrix",Y),p(f,"fromString",F),p(f,"toArray",O),p(f,"isCompatibleArray",N),p(f,"isCompatibleObject",v),f}(); +if(e.length===16){const[n,i,r,a,l,m,h,c,y,u,w,o,d,A,M,x]=e;t.m11=n,t.a=n,t.m21=l,t.c=l,t.m31=y,t.m41=d,t.e=d,t.m12=i,t.b=i,t.m22=m,t.d=m,t.m32=u,t.m42=A,t.f=A,t.m13=r,t.m23=h,t.m33=w,t.m43=M,t.m14=a,t.m24=c,t.m34=o,t.m44=x}else if(e.length===6){const[n,i,r,a,l,m]=e;t.m11=n,t.a=n,t.m12=i,t.b=i,t.m21=r,t.c=r,t.m22=a,t.d=a,t.m41=l,t.e=l,t.m42=m,t.f=m}return t},Y=s=>{if(v(s))return k([s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},F=s=>{if(typeof s!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a string.`);const t=String(s).replace(/\s/g,"");let e=new f;const n=`CSSMatrix: invalid transform string "${s}"`;return t.split(")").filter(i=>i).forEach(i=>{const[r,a]=i.split("(");if(!a)throw TypeError(n);const l=a.split(",").map(o=>o.includes("rad")?parseFloat(o)*(180/Math.PI):parseFloat(o)),[m,h,c,y]=l,u=[m,h,c],w=[m,h,c,y];if(r==="perspective"&&m&&[h,c].every(o=>o===void 0))e.m34=-1/m;else if(r.includes("matrix")&&[6,16].includes(l.length)&&l.every(o=>!Number.isNaN(+o))){const o=l.map(d=>Math.abs(d)<1e-6?0:d);e=e.multiply(k(o))}else if(r==="translate3d"&&u.every(o=>!Number.isNaN(+o)))e=e.translate(m,h,c);else if(r==="translate"&&m&&c===void 0)e=e.translate(m,h||0,0);else if(r==="rotate3d"&&w.every(o=>!Number.isNaN(+o))&&y)e=e.rotateAxisAngle(m,h,c,y);else if(r==="rotate"&&m&&[h,c].every(o=>o===void 0))e=e.rotate(0,0,m);else if(r==="scale3d"&&u.every(o=>!Number.isNaN(+o))&&u.some(o=>o!==1))e=e.scale(m,h,c);else if(r==="scale"&&!Number.isNaN(m)&&[m,h].some(o=>o!==1)&&c===void 0){const d=Number.isNaN(+h)?m:h;e=e.scale(m,d,1)}else if(r==="skew"&&(m||!Number.isNaN(m)&&h)&&c===void 0)e=e.skew(m,h||0);else if(["translate","rotate","scale","skew"].some(o=>r.includes(o))&&/[XYZ]/.test(r)&&m&&[h,c].every(o=>o===void 0))if(r==="skewX"||r==="skewY")e=e[r](m);else{const o=r.replace(/[XYZ]/,""),d=r.replace(o,""),A=["X","Y","Z"].indexOf(d),M=o==="scale"?1:0,x=[A===0?m:M,A===1?m:M,A===2?m:M];e=e[o](...x)}else throw TypeError(n)}),e},O=(s,t)=>t?[s.a,s.b,s.c,s.d,s.e,s.f]:[s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44],T=(s,t,e)=>{const n=new f;return n.m41=s,n.e=s,n.m42=t,n.f=t,n.m43=e,n},I=(s,t,e)=>{const n=new f,i=Math.PI/180,r=s*i,a=t*i,l=e*i,m=Math.cos(r),h=-Math.sin(r),c=Math.cos(a),y=-Math.sin(a),u=Math.cos(l),w=-Math.sin(l),o=c*u,d=-c*w;n.m11=o,n.a=o,n.m12=d,n.b=d,n.m13=y;const A=h*y*u+m*w;n.m21=A,n.c=A;const M=m*u-h*y*w;return n.m22=M,n.d=M,n.m23=-h*c,n.m31=h*w-m*y*u,n.m32=h*u+m*y*w,n.m33=m*c,n},R=(s,t,e,n)=>{const i=new f,r=Math.sqrt(s*s+t*t+e*e);if(r===0)return i;const a=s/r,l=t/r,m=e/r,h=n*(Math.PI/360),c=Math.sin(h),y=Math.cos(h),u=c*c,w=a*a,o=l*l,d=m*m,A=1-2*(o+d)*u;i.m11=A,i.a=A;const M=2*(a*l*u+m*c*y);i.m12=M,i.b=M,i.m13=2*(a*m*u-l*c*y);const x=2*(l*a*u-m*c*y);i.m21=x,i.c=x;const Z=1-2*(d+w)*u;return i.m22=Z,i.d=Z,i.m23=2*(l*m*u+a*c*y),i.m31=2*(m*a*u+l*c*y),i.m32=2*(m*l*u-a*c*y),i.m33=1-2*(w+o)*u,i},D=(s,t,e)=>{const n=new f;return n.m11=s,n.a=s,n.m22=t,n.d=t,n.m33=e,n},X=(s,t)=>{const e=new f;if(s){const n=s*Math.PI/180,i=Math.tan(n);e.m21=i,e.c=i}if(t){const n=t*Math.PI/180,i=Math.tan(n);e.m12=i,e.b=i}return e},E=s=>X(s,0),P=s=>X(0,s),b=(s,t)=>{const e=t.m11*s.m11+t.m12*s.m21+t.m13*s.m31+t.m14*s.m41,n=t.m11*s.m12+t.m12*s.m22+t.m13*s.m32+t.m14*s.m42,i=t.m11*s.m13+t.m12*s.m23+t.m13*s.m33+t.m14*s.m43,r=t.m11*s.m14+t.m12*s.m24+t.m13*s.m34+t.m14*s.m44,a=t.m21*s.m11+t.m22*s.m21+t.m23*s.m31+t.m24*s.m41,l=t.m21*s.m12+t.m22*s.m22+t.m23*s.m32+t.m24*s.m42,m=t.m21*s.m13+t.m22*s.m23+t.m23*s.m33+t.m24*s.m43,h=t.m21*s.m14+t.m22*s.m24+t.m23*s.m34+t.m24*s.m44,c=t.m31*s.m11+t.m32*s.m21+t.m33*s.m31+t.m34*s.m41,y=t.m31*s.m12+t.m32*s.m22+t.m33*s.m32+t.m34*s.m42,u=t.m31*s.m13+t.m32*s.m23+t.m33*s.m33+t.m34*s.m43,w=t.m31*s.m14+t.m32*s.m24+t.m33*s.m34+t.m34*s.m44,o=t.m41*s.m11+t.m42*s.m21+t.m43*s.m31+t.m44*s.m41,d=t.m41*s.m12+t.m42*s.m22+t.m43*s.m32+t.m44*s.m42,A=t.m41*s.m13+t.m42*s.m23+t.m43*s.m33+t.m44*s.m43,M=t.m41*s.m14+t.m42*s.m24+t.m43*s.m34+t.m44*s.m44;return k([e,n,i,r,a,l,m,h,c,y,u,w,o,d,A,M])};class f{constructor(t){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}get isIdentity(){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}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){return typeof t=="string"&&t.length&&t!=="none"?F(t):Array.isArray(t)||t instanceof Float64Array||t instanceof Float32Array?k(t):typeof t=="object"?Y(t):this}toFloat32Array(t){return Float32Array.from(O(this,t))}toFloat64Array(t){return Float64Array.from(O(this,t))}toString(){const{is2D:t}=this,e=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${e})`}toJSON(){const{is2D:t,isIdentity:e}=this;return{...this,is2D:t,isIdentity:e}}multiply(t){return b(this,t)}translate(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=0),typeof a>"u"&&(a=0),b(this,T(i,r,a))}scale(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=t),typeof a>"u"&&(a=1),b(this,D(i,r,a))}rotate(t,e,n){let i=t,r=e||0,a=n||0;return typeof t=="number"&&typeof e>"u"&&typeof n>"u"&&(a=i,i=0,r=0),b(this,I(i,r,a))}rotateAxisAngle(t,e,n,i){if([t,e,n,i].some(r=>Number.isNaN(+r)))throw new TypeError("CSSMatrix: expecting 4 values");return b(this,R(t,e,n,i))}skewX(t){return b(this,E(t))}skewY(t){return b(this,P(t))}skew(t,e){return b(this,X(t,e))}transformPoint(t){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;return t instanceof DOMPoint?new DOMPoint(e,n,i,r):{x:e,y:n,z:i,w:r}}}return p(f,"Translate",T),p(f,"Rotate",I),p(f,"RotateAxisAngle",R),p(f,"Scale",D),p(f,"SkewX",E),p(f,"SkewY",P),p(f,"Skew",X),p(f,"Multiply",b),p(f,"fromArray",k),p(f,"fromMatrix",Y),p(f,"fromString",F),p(f,"toArray",O),p(f,"isCompatibleArray",N),p(f,"isCompatibleObject",v),f}(); //# sourceMappingURL=dommatrix.js.map diff --git a/docs/dommatrix.js.map b/docs/dommatrix.js.map index d8d9bed..24e0d0b 100755 --- a/docs/dommatrix.js.map +++ b/docs/dommatrix.js.map @@ -1 +1 @@ -{"version":3,"file":"dommatrix.js","sources":["../src/index.ts"],"sourcesContent":["import type {\n CSSMatrixInput,\n JSONMatrix,\n Matrix,\n Matrix3d,\n PointTuple,\n} 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 = (\n array?: unknown,\n): 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 = (\n object?: unknown,\n): object is CSSMatrix | DOMMatrix | JSONMatrix => {\n return (\n object instanceof DOMMatrix ||\n object instanceof CSSMatrix ||\n (typeof object === \"object\" &&\n 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 = (\n array: number[] | Float32Array | Float64Array,\n): CSSMatrix => {\n const m = new CSSMatrix();\n const a = Array.from(array);\n\n if (!isCompatibleArray(a)) {\n throw TypeError(\n `CSSMatrix: \"${a.join(\",\")}\" must be an array with 6/16 numbers.`,\n );\n }\n // istanbul ignore else @preserve\n if (a.length === 16) {\n const [\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ] = 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(\n `CSSMatrix: \"${\n JSON.stringify(m)\n }\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`,\n );\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,\n ) => (n.includes(\"rad\")\n ? parseFloat(n) * (180 / Math.PI)\n : parseFloat(n))\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 (\n prop === \"perspective\" && x && [y, z].every((n) => n === undefined)\n ) {\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 (\n prop === \"translate3d\" && xyz.every((n) => !Number.isNaN(+n))\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 (\n prop === \"rotate3d\" && xyza.every((n) => !Number.isNaN(+n)) && a\n ) {\n m = m.rotateAxisAngle(x, y, z, a);\n // single value expected\n } else if (\n prop === \"rotate\" && x && [y, z].every((n) => n === undefined)\n ) {\n m = m.rotate(0, 0, x);\n // 3 values expected\n } else if (\n prop === \"scale3d\" && xyz.every((n) => !Number.isNaN(+n)) &&\n xyz.some((n) => n !== 1)\n ) {\n m = m.scale(x, y, z);\n // single value expected\n } else if (\n prop === \"scale\" && !Number.isNaN(x) && x !== 1 && z === undefined\n ) {\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 (\n prop === \"skew\" && (x || (!Number.isNaN(x) && y)) && z === undefined\n ) {\n m = m.skew(x, y || 0);\n } else if (\n [\"translate\", \"rotate\", \"scale\", \"skew\"].some((p) =>\n prop.includes(p)\n ) &&\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\n | \"scale\"\n | \"translate\"\n | \"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] = [\n idx === 0 ? x : def,\n idx === 1 ? x : def,\n idx === 2 ? x : def,\n ];\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 = (\n m: CSSMatrix | DOMMatrix | JSONMatrix,\n is2D?: boolean,\n): 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 = (\n x: number,\n y: number,\n z: number,\n alpha: number,\n): 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 = (\n m1: CSSMatrix | DOMMatrix | JSONMatrix,\n m2: CSSMatrix | DOMMatrix | JSONMatrix,\n): CSSMatrix => {\n const m11 = m2.m11 * m1.m11 + m2.m12 * m1.m21 + m2.m13 * m1.m31 +\n m2.m14 * m1.m41;\n const m12 = m2.m11 * m1.m12 + m2.m12 * m1.m22 + m2.m13 * m1.m32 +\n m2.m14 * m1.m42;\n const m13 = m2.m11 * m1.m13 + m2.m12 * m1.m23 + m2.m13 * m1.m33 +\n m2.m14 * m1.m43;\n const m14 = m2.m11 * m1.m14 + m2.m12 * m1.m24 + m2.m13 * m1.m34 +\n m2.m14 * m1.m44;\n\n const m21 = m2.m21 * m1.m11 + m2.m22 * m1.m21 + m2.m23 * m1.m31 +\n m2.m24 * m1.m41;\n const m22 = m2.m21 * m1.m12 + m2.m22 * m1.m22 + m2.m23 * m1.m32 +\n m2.m24 * m1.m42;\n const m23 = m2.m21 * m1.m13 + m2.m22 * m1.m23 + m2.m23 * m1.m33 +\n m2.m24 * m1.m43;\n const m24 = m2.m21 * m1.m14 + m2.m22 * m1.m24 + m2.m23 * m1.m34 +\n m2.m24 * m1.m44;\n\n const m31 = m2.m31 * m1.m11 + m2.m32 * m1.m21 + m2.m33 * m1.m31 +\n m2.m34 * m1.m41;\n const m32 = m2.m31 * m1.m12 + m2.m32 * m1.m22 + m2.m33 * m1.m32 +\n m2.m34 * m1.m42;\n const m33 = m2.m31 * m1.m13 + m2.m32 * m1.m23 + m2.m33 * m1.m33 +\n m2.m34 * m1.m43;\n const m34 = m2.m31 * m1.m14 + m2.m32 * m1.m24 + m2.m33 * m1.m34 +\n m2.m34 * m1.m44;\n\n const m41 = m2.m41 * m1.m11 + m2.m42 * m1.m21 + m2.m43 * m1.m31 +\n m2.m44 * m1.m41;\n const m42 = m2.m41 * m1.m12 + m2.m42 * m1.m22 + m2.m43 * m1.m32 +\n m2.m44 * m1.m42;\n const m43 = m2.m41 * m1.m13 + m2.m42 * m1.m23 + m2.m43 * m1.m33 +\n m2.m44 * m1.m43;\n const m44 = m2.m41 * m1.m14 + m2.m42 * m1.m24 + m2.m43 * m1.m34 +\n m2.m44 * m1.m44;\n\n return fromArray([\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ]);\n};\n\n/**\n * Creates and returns a new `DOMMatrix` compatible instance\n * with equivalent instance.\n *\n * @class CSSMatrix\n *\n * @author thednp \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 &&\n 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 (\n Array.isArray(source) || source instanceof Float64Array ||\n source instanceof Float32Array\n ) {\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 (\n typeof rx === \"number\" && typeof ry === \"undefined\" &&\n typeof rz === \"undefined\"\n ) {\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 ? new DOMPoint(x, y, z, w) : {\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":"0MASA,MAAMA,EAA0B,CAC9B,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,KAAM,GACN,WAAY,EACd,EAUMC,EACJC,IAGGA,aAAiB,cAChBA,aAAiB,cAChB,MAAM,QAAQA,CAAK,GAAKA,EAAM,MAAOC,GAAM,OAAOA,GAAM,QAAQ,IACnE,CAAC,EAAG,EAAE,EAAE,KAAMA,GAAMD,EAAM,SAAWC,CAAC,EAKpCC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mBjG,EAoCZ,qBAAqBF"} \ No newline at end of file +{"version":3,"file":"dommatrix.js","sources":["../src/index.ts"],"sourcesContent":["import type {\n CSSMatrixInput,\n JSONMatrix,\n Matrix,\n Matrix3d,\n PointTuple,\n} 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 = (\n array?: unknown,\n): 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 = (\n object?: unknown,\n): object is CSSMatrix | DOMMatrix | JSONMatrix => {\n return (\n object instanceof DOMMatrix ||\n object instanceof CSSMatrix ||\n (typeof object === \"object\" &&\n 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 = (\n array: number[] | Float32Array | Float64Array,\n): CSSMatrix => {\n const m = new CSSMatrix();\n const a = Array.from(array);\n\n if (!isCompatibleArray(a)) {\n throw TypeError(\n `CSSMatrix: \"${a.join(\",\")}\" must be an array with 6/16 numbers.`,\n );\n }\n // istanbul ignore else @preserve\n if (a.length === 16) {\n const [\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ] = 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(\n `CSSMatrix: \"${\n JSON.stringify(m)\n }\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`,\n );\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,\n ) => (n.includes(\"rad\")\n ? parseFloat(n) * (180 / Math.PI)\n : parseFloat(n))\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 (\n prop === \"perspective\" && x && [y, z].every((n) => n === undefined)\n ) {\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 (\n prop === \"translate3d\" && xyz.every((n) => !Number.isNaN(+n))\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 (\n prop === \"rotate3d\" && xyza.every((n) => !Number.isNaN(+n)) && a\n ) {\n m = m.rotateAxisAngle(x, y, z, a);\n // single value expected\n } else if (\n prop === \"rotate\" && x && [y, z].every((n) => n === undefined)\n ) {\n m = m.rotate(0, 0, x);\n // 3 values expected\n } else if (\n prop === \"scale3d\" && xyz.every((n) => !Number.isNaN(+n)) &&\n xyz.some((n) => n !== 1)\n ) {\n m = m.scale(x, y, z);\n // single value expected\n } else if (\n // prop === \"scale\" && !Number.isNaN(x) && x !== 1 && z === undefined\n prop === \"scale\" && !Number.isNaN(x) && [x, y].some((n) => n !== 1) &&\n z === undefined\n ) {\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 (\n prop === \"skew\" && (x || (!Number.isNaN(x) && y)) && z === undefined\n ) {\n m = m.skew(x, y || 0);\n } else if (\n [\"translate\", \"rotate\", \"scale\", \"skew\"].some((p) =>\n prop.includes(p)\n ) &&\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\n | \"scale\"\n | \"translate\"\n | \"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] = [\n idx === 0 ? x : def,\n idx === 1 ? x : def,\n idx === 2 ? x : def,\n ];\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 = (\n m: CSSMatrix | DOMMatrix | JSONMatrix,\n is2D?: boolean,\n): 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 = (\n x: number,\n y: number,\n z: number,\n alpha: number,\n): 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 = (\n m1: CSSMatrix | DOMMatrix | JSONMatrix,\n m2: CSSMatrix | DOMMatrix | JSONMatrix,\n): CSSMatrix => {\n const m11 = m2.m11 * m1.m11 + m2.m12 * m1.m21 + m2.m13 * m1.m31 +\n m2.m14 * m1.m41;\n const m12 = m2.m11 * m1.m12 + m2.m12 * m1.m22 + m2.m13 * m1.m32 +\n m2.m14 * m1.m42;\n const m13 = m2.m11 * m1.m13 + m2.m12 * m1.m23 + m2.m13 * m1.m33 +\n m2.m14 * m1.m43;\n const m14 = m2.m11 * m1.m14 + m2.m12 * m1.m24 + m2.m13 * m1.m34 +\n m2.m14 * m1.m44;\n\n const m21 = m2.m21 * m1.m11 + m2.m22 * m1.m21 + m2.m23 * m1.m31 +\n m2.m24 * m1.m41;\n const m22 = m2.m21 * m1.m12 + m2.m22 * m1.m22 + m2.m23 * m1.m32 +\n m2.m24 * m1.m42;\n const m23 = m2.m21 * m1.m13 + m2.m22 * m1.m23 + m2.m23 * m1.m33 +\n m2.m24 * m1.m43;\n const m24 = m2.m21 * m1.m14 + m2.m22 * m1.m24 + m2.m23 * m1.m34 +\n m2.m24 * m1.m44;\n\n const m31 = m2.m31 * m1.m11 + m2.m32 * m1.m21 + m2.m33 * m1.m31 +\n m2.m34 * m1.m41;\n const m32 = m2.m31 * m1.m12 + m2.m32 * m1.m22 + m2.m33 * m1.m32 +\n m2.m34 * m1.m42;\n const m33 = m2.m31 * m1.m13 + m2.m32 * m1.m23 + m2.m33 * m1.m33 +\n m2.m34 * m1.m43;\n const m34 = m2.m31 * m1.m14 + m2.m32 * m1.m24 + m2.m33 * m1.m34 +\n m2.m34 * m1.m44;\n\n const m41 = m2.m41 * m1.m11 + m2.m42 * m1.m21 + m2.m43 * m1.m31 +\n m2.m44 * m1.m41;\n const m42 = m2.m41 * m1.m12 + m2.m42 * m1.m22 + m2.m43 * m1.m32 +\n m2.m44 * m1.m42;\n const m43 = m2.m41 * m1.m13 + m2.m42 * m1.m23 + m2.m43 * m1.m33 +\n m2.m44 * m1.m43;\n const m44 = m2.m41 * m1.m14 + m2.m42 * m1.m24 + m2.m43 * m1.m34 +\n m2.m44 * m1.m44;\n\n return fromArray([\n m11,\n m12,\n m13,\n m14,\n m21,\n m22,\n m23,\n m24,\n m31,\n m32,\n m33,\n m34,\n m41,\n m42,\n m43,\n m44,\n ]);\n};\n\n/**\n * Creates and returns a new `DOMMatrix` compatible instance\n * with equivalent instance.\n *\n * @class CSSMatrix\n *\n * @author thednp \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 &&\n 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 (\n Array.isArray(source) || source instanceof Float64Array ||\n source instanceof Float32Array\n ) {\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 (\n typeof rx === \"number\" && typeof ry === \"undefined\" &&\n typeof rz === \"undefined\"\n ) {\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 ? new DOMPoint(x, y, z, w) : {\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":"0MASA,MAAMA,EAA0B,CAC9B,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,KAAM,GACN,WAAY,EACd,EAUMC,EACJC,IAGGA,aAAiB,cAChBA,aAAiB,cAChB,MAAM,QAAQA,CAAK,GAAKA,EAAM,MAAOC,GAAM,OAAOA,GAAM,QAAQ,IACnE,CAAC,EAAG,EAAE,EAAE,KAAMA,GAAMD,EAAM,SAAWC,CAAC,EAKpCC,EACJC,GAGEA,aAAkB,WAClBA,aAAkBC,GACjB,OAAOD,GAAW,UACjB,OAAO,KAAK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at end of file diff --git a/docs/index.html b/docs/index.html index d5f2e46..ae06987 100755 --- a/docs/index.html +++ b/docs/index.html @@ -102,7 +102,7 @@

-

2023 © thednp

+

2024 © thednp

diff --git a/package.json b/package.json index 268863a..b71c9fd 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@thednp/dommatrix", - "version": "2.0.10", + "version": "2.0.11", "description": "TypeScript shim for DOMMatrix", "homepage": "https://thednp.github.io/dommatrix/", "author": "thednp", @@ -53,14 +53,14 @@ "url": "https://github.com/thednp/dommatrix/issues" }, "devDependencies": { - "@vitest/browser": "^2.1.5", - "@vitest/coverage-istanbul": "^2.1.5", - "@vitest/ui": "^2.1.5", - "playwright": "^1.49.0", + "@vitest/browser": "^2.1.8", + "@vitest/coverage-istanbul": "^2.1.8", + "@vitest/ui": "^2.1.8", + "playwright": "^1.49.1", "typescript": "^5.7.2", "vite": "^5.4.11", "vite-plugin-dts": "^4.3.0", - "vitest": "^2.1.5" + "vitest": "^2.1.8" }, "packageManager": "pnpm@8.6.12", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4b7281e..bc0b653 100755 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,17 +9,17 @@ importers: .: devDependencies: '@vitest/browser': - specifier: ^2.1.5 - version: 2.1.5(@types/node@22.5.4)(playwright@1.49.0)(typescript@5.7.2)(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3))(vitest@2.1.5) + specifier: ^2.1.8 + version: 2.1.8(@types/node@22.5.4)(playwright@1.49.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3))(vitest@2.1.8) '@vitest/coverage-istanbul': - specifier: ^2.1.5 - version: 2.1.5(vitest@2.1.5) + specifier: ^2.1.8 + version: 2.1.8(vitest@2.1.8) '@vitest/ui': - specifier: ^2.1.5 - version: 2.1.5(vitest@2.1.5) + specifier: ^2.1.8 + version: 2.1.8(vitest@2.1.8) playwright: - specifier: ^1.49.0 - version: 1.49.0 + specifier: ^1.49.1 + version: 1.49.1 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -28,10 +28,10 @@ importers: version: 5.4.11(@types/node@22.5.4)(terser@5.31.3) vite-plugin-dts: specifier: ^4.3.0 - version: 4.3.0(@types/node@22.5.4)(rollup@4.27.4)(typescript@5.7.2)(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3)) + version: 4.3.0(@types/node@22.5.4)(rollup@4.28.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3)) vitest: - specifier: ^2.1.5 - version: 2.1.5(@types/node@22.5.4)(@vitest/browser@2.1.5)(@vitest/ui@2.1.5)(msw@2.6.6(@types/node@22.5.4)(typescript@5.7.2))(terser@5.31.3) + specifier: ^2.1.8 + version: 2.1.8(@types/node@22.5.4)(@vitest/browser@2.1.8)(@vitest/ui@2.1.8)(msw@2.6.8(@types/node@22.5.4)(typescript@5.7.2))(terser@5.31.3) packages: @@ -43,16 +43,16 @@ packages: resolution: {integrity: sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==} engines: {node: '>=6.9.0'} - '@babel/compat-data@7.26.2': - resolution: {integrity: sha512-Z0WgzSEa+aUcdiJuCIqgujCshpMWgUpgOxXotrYPSA53hA3qopNaqcJpyr0hVb1FeWdnqFA35/fUtXgBK8srQg==} + '@babel/compat-data@7.26.3': + resolution: {integrity: sha512-nHIxvKPniQXpmQLb0vhY3VaFb3S0YrTAwpOWJZh1wn3oJPjJk9Asva204PsBdmAE8vpzfHudT8DB0scYvy9q0g==} engines: {node: '>=6.9.0'} '@babel/core@7.26.0': resolution: {integrity: sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==} engines: {node: '>=6.9.0'} - '@babel/generator@7.26.2': - resolution: {integrity: sha512-zevQbhbau95nkoxSq3f/DC/SC+EEOUZd3DYqfSkMhY2/wfSeaHV1Ew4vk8e+x8lja31IbyuUa2uQ3JONqKbysw==} + '@babel/generator@7.26.3': + resolution: {integrity: sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==} engines: {node: '>=6.9.0'} '@babel/helper-compilation-targets@7.25.9': @@ -85,8 +85,8 @@ packages: resolution: {integrity: sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==} engines: {node: '>=6.9.0'} - '@babel/parser@7.26.2': - resolution: {integrity: sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ==} + '@babel/parser@7.26.3': + resolution: {integrity: sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==} engines: {node: '>=6.0.0'} hasBin: true @@ -98,12 +98,12 @@ packages: resolution: {integrity: sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==} engines: {node: '>=6.9.0'} - '@babel/traverse@7.25.9': - resolution: {integrity: sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw==} + '@babel/traverse@7.26.4': + resolution: {integrity: sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==} engines: {node: '>=6.9.0'} - '@babel/types@7.26.0': - resolution: {integrity: sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA==} + '@babel/types@7.26.3': + resolution: {integrity: sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==} engines: {node: '>=6.9.0'} '@bundled-es-modules/cookie@2.0.1': @@ -253,14 +253,14 @@ packages: cpu: [x64] os: [win32] - '@inquirer/confirm@5.0.2': - resolution: {integrity: sha512-KJLUHOaKnNCYzwVbryj3TNBxyZIrr56fR5N45v6K9IPrbT6B7DcudBMfylkV1A8PUdJE15mybkEQyp2/ZUpxUA==} + '@inquirer/confirm@5.1.0': + resolution: {integrity: sha512-osaBbIMEqVFjTX5exoqPXs6PilWQdjaLhGtMDXMXg/yxkHXNq43GlxGyTA35lK2HpzUgDN+Cjh/2AmqCN0QJpw==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' - '@inquirer/core@10.1.0': - resolution: {integrity: sha512-I+ETk2AL+yAVbvuKx5AJpQmoaWhpiTFOg/UJb7ZkMAK4blmtG8ATh5ct+T/8xNld0CZG/2UhtkdMwpgvld92XQ==} + '@inquirer/core@10.1.1': + resolution: {integrity: sha512-rmZVXy9iZvO3ZStEe/ayuuwIJ23LSF13aPMlLMTQARX6lGUBDHGV8UB5i9MRrfy0+mZwt5/9bdy8llszSD3NQA==} engines: {node: '>=18'} '@inquirer/figures@1.0.8': @@ -315,8 +315,8 @@ packages: '@microsoft/tsdoc@0.15.1': resolution: {integrity: sha512-4aErSrCR/On/e5G2hDP0wjooqDdauzEbIq8hIkIe5pXV0rtWJZvdCEKL0ykZxex+IxIwBp0eGeV48hQN07dXtw==} - '@mswjs/interceptors@0.37.1': - resolution: {integrity: sha512-SvE+tSpcX884RJrPCskXxoS965Ky/pYABDEhWW6oeSRhpUDLrS5nTvT5n1LLSDVDYvty4imVmXsy+3/ROVuknA==} + '@mswjs/interceptors@0.37.3': + resolution: {integrity: sha512-USvgCL/uOGFtVa6SVyRrC8kIAedzRohxIXN5LISlg5C5vLZCn7dgMFVSNhSF9cuBEFrm/O2spDWEZeMnw4ZXYg==} engines: {node: '>=18'} '@open-draft/deferred-promise@2.2.0': @@ -344,93 +344,98 @@ packages: rollup: optional: true - '@rollup/rollup-android-arm-eabi@4.27.4': - resolution: {integrity: sha512-2Y3JT6f5MrQkICUyRVCw4oa0sutfAsgaSsb0Lmmy1Wi2y7X5vT9Euqw4gOsCyy0YfKURBg35nhUKZS4mDcfULw==} + '@rollup/rollup-android-arm-eabi@4.28.1': + resolution: {integrity: sha512-2aZp8AES04KI2dy3Ss6/MDjXbwBzj+i0GqKtWXgw2/Ma6E4jJvujryO6gJAghIRVz7Vwr9Gtl/8na3nDUKpraQ==} cpu: [arm] os: [android] - '@rollup/rollup-android-arm64@4.27.4': - resolution: {integrity: sha512-wzKRQXISyi9UdCVRqEd0H4cMpzvHYt1f/C3CoIjES6cG++RHKhrBj2+29nPF0IB5kpy9MS71vs07fvrNGAl/iA==} + '@rollup/rollup-android-arm64@4.28.1': + resolution: {integrity: sha512-EbkK285O+1YMrg57xVA+Dp0tDBRB93/BZKph9XhMjezf6F4TpYjaUSuPt5J0fZXlSag0LmZAsTmdGGqPp4pQFA==} cpu: [arm64] os: [android] - '@rollup/rollup-darwin-arm64@4.27.4': - resolution: {integrity: sha512-PlNiRQapift4LNS8DPUHuDX/IdXiLjf8mc5vdEmUR0fF/pyy2qWwzdLjB+iZquGr8LuN4LnUoSEvKRwjSVYz3Q==} + '@rollup/rollup-darwin-arm64@4.28.1': + resolution: {integrity: sha512-prduvrMKU6NzMq6nxzQw445zXgaDBbMQvmKSJaxpaZ5R1QDM8w+eGxo6Y/jhT/cLoCvnZI42oEqf9KQNYz1fqQ==} cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-x64@4.27.4': - resolution: {integrity: sha512-o9bH2dbdgBDJaXWJCDTNDYa171ACUdzpxSZt+u/AAeQ20Nk5x+IhA+zsGmrQtpkLiumRJEYef68gcpn2ooXhSQ==} + '@rollup/rollup-darwin-x64@4.28.1': + resolution: {integrity: sha512-WsvbOunsUk0wccO/TV4o7IKgloJ942hVFK1CLatwv6TJspcCZb9umQkPdvB7FihmdxgaKR5JyxDjWpCOp4uZlQ==} cpu: [x64] os: [darwin] - '@rollup/rollup-freebsd-arm64@4.27.4': - resolution: {integrity: sha512-NBI2/i2hT9Q+HySSHTBh52da7isru4aAAo6qC3I7QFVsuhxi2gM8t/EI9EVcILiHLj1vfi+VGGPaLOUENn7pmw==} + '@rollup/rollup-freebsd-arm64@4.28.1': + resolution: {integrity: sha512-HTDPdY1caUcU4qK23FeeGxCdJF64cKkqajU0iBnTVxS8F7H/7BewvYoG+va1KPSL63kQ1PGNyiwKOfReavzvNA==} cpu: [arm64] os: [freebsd] - '@rollup/rollup-freebsd-x64@4.27.4': - resolution: {integrity: sha512-wYcC5ycW2zvqtDYrE7deary2P2UFmSh85PUpAx+dwTCO9uw3sgzD6Gv9n5X4vLaQKsrfTSZZ7Z7uynQozPVvWA==} + '@rollup/rollup-freebsd-x64@4.28.1': + resolution: {integrity: sha512-m/uYasxkUevcFTeRSM9TeLyPe2QDuqtjkeoTpP9SW0XxUWfcYrGDMkO/m2tTw+4NMAF9P2fU3Mw4ahNvo7QmsQ==} cpu: [x64] os: [freebsd] - '@rollup/rollup-linux-arm-gnueabihf@4.27.4': - resolution: {integrity: sha512-9OwUnK/xKw6DyRlgx8UizeqRFOfi9mf5TYCw1uolDaJSbUmBxP85DE6T4ouCMoN6pXw8ZoTeZCSEfSaYo+/s1w==} + '@rollup/rollup-linux-arm-gnueabihf@4.28.1': + resolution: {integrity: sha512-QAg11ZIt6mcmzpNE6JZBpKfJaKkqTm1A9+y9O+frdZJEuhQxiugM05gnCWiANHj4RmbgeVJpTdmKRmH/a+0QbA==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-musleabihf@4.27.4': - resolution: {integrity: sha512-Vgdo4fpuphS9V24WOV+KwkCVJ72u7idTgQaBoLRD0UxBAWTF9GWurJO9YD9yh00BzbkhpeXtm6na+MvJU7Z73A==} + '@rollup/rollup-linux-arm-musleabihf@4.28.1': + resolution: {integrity: sha512-dRP9PEBfolq1dmMcFqbEPSd9VlRuVWEGSmbxVEfiq2cs2jlZAl0YNxFzAQS2OrQmsLBLAATDMb3Z6MFv5vOcXg==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm64-gnu@4.27.4': - resolution: {integrity: sha512-pleyNgyd1kkBkw2kOqlBx+0atfIIkkExOTiifoODo6qKDSpnc6WzUY5RhHdmTdIJXBdSnh6JknnYTtmQyobrVg==} + '@rollup/rollup-linux-arm64-gnu@4.28.1': + resolution: {integrity: sha512-uGr8khxO+CKT4XU8ZUH1TTEUtlktK6Kgtv0+6bIFSeiSlnGJHG1tSFSjm41uQ9sAO/5ULx9mWOz70jYLyv1QkA==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-musl@4.27.4': - resolution: {integrity: sha512-caluiUXvUuVyCHr5DxL8ohaaFFzPGmgmMvwmqAITMpV/Q+tPoaHZ/PWa3t8B2WyoRcIIuu1hkaW5KkeTDNSnMA==} + '@rollup/rollup-linux-arm64-musl@4.28.1': + resolution: {integrity: sha512-QF54q8MYGAqMLrX2t7tNpi01nvq5RI59UBNx+3+37zoKX5KViPo/gk2QLhsuqok05sSCRluj0D00LzCwBikb0A==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-powerpc64le-gnu@4.27.4': - resolution: {integrity: sha512-FScrpHrO60hARyHh7s1zHE97u0KlT/RECzCKAdmI+LEoC1eDh/RDji9JgFqyO+wPDb86Oa/sXkily1+oi4FzJQ==} + '@rollup/rollup-linux-loongarch64-gnu@4.28.1': + resolution: {integrity: sha512-vPul4uodvWvLhRco2w0GcyZcdyBfpfDRgNKU+p35AWEbJ/HPs1tOUrkSueVbBS0RQHAf/A+nNtDpvw95PeVKOA==} + cpu: [loong64] + os: [linux] + + '@rollup/rollup-linux-powerpc64le-gnu@4.28.1': + resolution: {integrity: sha512-pTnTdBuC2+pt1Rmm2SV7JWRqzhYpEILML4PKODqLz+C7Ou2apEV52h19CR7es+u04KlqplggmN9sqZlekg3R1A==} cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-riscv64-gnu@4.27.4': - resolution: {integrity: sha512-qyyprhyGb7+RBfMPeww9FlHwKkCXdKHeGgSqmIXw9VSUtvyFZ6WZRtnxgbuz76FK7LyoN8t/eINRbPUcvXB5fw==} + '@rollup/rollup-linux-riscv64-gnu@4.28.1': + resolution: {integrity: sha512-vWXy1Nfg7TPBSuAncfInmAI/WZDd5vOklyLJDdIRKABcZWojNDY0NJwruY2AcnCLnRJKSaBgf/GiJfauu8cQZA==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-s390x-gnu@4.27.4': - resolution: {integrity: sha512-PFz+y2kb6tbh7m3A7nA9++eInGcDVZUACulf/KzDtovvdTizHpZaJty7Gp0lFwSQcrnebHOqxF1MaKZd7psVRg==} + '@rollup/rollup-linux-s390x-gnu@4.28.1': + resolution: {integrity: sha512-/yqC2Y53oZjb0yz8PVuGOQQNOTwxcizudunl/tFs1aLvObTclTwZ0JhXF2XcPT/zuaymemCDSuuUPXJJyqeDOg==} cpu: [s390x] os: [linux] - '@rollup/rollup-linux-x64-gnu@4.27.4': - resolution: {integrity: sha512-Ni8mMtfo+o/G7DVtweXXV/Ol2TFf63KYjTtoZ5f078AUgJTmaIJnj4JFU7TK/9SVWTaSJGxPi5zMDgK4w+Ez7Q==} + '@rollup/rollup-linux-x64-gnu@4.28.1': + resolution: {integrity: sha512-fzgeABz7rrAlKYB0y2kSEiURrI0691CSL0+KXwKwhxvj92VULEDQLpBYLHpF49MSiPG4sq5CK3qHMnb9tlCjBw==} cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-musl@4.27.4': - resolution: {integrity: sha512-5AeeAF1PB9TUzD+3cROzFTnAJAcVUGLuR8ng0E0WXGkYhp6RD6L+6szYVX+64Rs0r72019KHZS1ka1q+zU/wUw==} + '@rollup/rollup-linux-x64-musl@4.28.1': + resolution: {integrity: sha512-xQTDVzSGiMlSshpJCtudbWyRfLaNiVPXt1WgdWTwWz9n0U12cI2ZVtWe/Jgwyv/6wjL7b66uu61Vg0POWVfz4g==} cpu: [x64] os: [linux] - '@rollup/rollup-win32-arm64-msvc@4.27.4': - resolution: {integrity: sha512-yOpVsA4K5qVwu2CaS3hHxluWIK5HQTjNV4tWjQXluMiiiu4pJj4BN98CvxohNCpcjMeTXk/ZMJBRbgRg8HBB6A==} + '@rollup/rollup-win32-arm64-msvc@4.28.1': + resolution: {integrity: sha512-wSXmDRVupJstFP7elGMgv+2HqXelQhuNf+IS4V+nUpNVi/GUiBgDmfwD0UGN3pcAnWsgKG3I52wMOBnk1VHr/A==} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.27.4': - resolution: {integrity: sha512-KtwEJOaHAVJlxV92rNYiG9JQwQAdhBlrjNRp7P9L8Cb4Rer3in+0A+IPhJC9y68WAi9H0sX4AiG2NTsVlmqJeQ==} + '@rollup/rollup-win32-ia32-msvc@4.28.1': + resolution: {integrity: sha512-ZkyTJ/9vkgrE/Rk9vhMXhf8l9D+eAhbAVbsGsXKy2ohmJaWg0LPQLnIxRdRp/bKyr8tXuPlXhIoGlEB5XpJnGA==} cpu: [ia32] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.27.4': - resolution: {integrity: sha512-3j4jx1TppORdTAoBJRd+/wJRGCPC0ETWkXOecJ6PPZLj6SptXkrXcNqdj0oclbKML6FkQltdz7bBA3rUSirZug==} + '@rollup/rollup-win32-x64-msvc@4.28.1': + resolution: {integrity: sha512-ZvK2jBafvttJjoIdKm/Q/Bh7IJ1Ose9IBOwpOXcOvW3ikGTQGmKDgxTC6oCAzW6PynbkKP8+um1du81XJHZ0JA==} cpu: [x64] os: [win32] @@ -487,12 +492,12 @@ packages: '@types/tough-cookie@4.0.5': resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==} - '@vitest/browser@2.1.5': - resolution: {integrity: sha512-JrpnxvkrjlBrF7oXbK/YytWVYfJIzWYeDKppANlUaisBKwDso+yXlWocAJrANx8gUxyirF355Yx80S+SKQqayg==} + '@vitest/browser@2.1.8': + resolution: {integrity: sha512-OWVvEJThRgxlNMYNVLEK/9qVkpRcLvyuKLngIV3Hob01P56NjPHprVBYn+rx4xAJudbM9yrCrywPIEuA3Xyo8A==} peerDependencies: playwright: '*' safaridriver: '*' - vitest: 2.1.5 + vitest: 2.1.8 webdriverio: '*' peerDependenciesMeta: playwright: @@ -502,16 +507,16 @@ packages: webdriverio: optional: true - '@vitest/coverage-istanbul@2.1.5': - resolution: {integrity: sha512-jJsS5jeHncmSvzMNE03F1pk8F9etmjzGmGyQnGMkdHdVek/bxK/3vo8Qr3e9XmVuDM3UZKOy1ObeQHgC2OxvHg==} + '@vitest/coverage-istanbul@2.1.8': + resolution: {integrity: sha512-cSaCd8KcWWvgDwEJSXm0NEWZ1YTiJzjicKHy+zOEbUm0gjbbkz+qJf1p8q71uBzSlS7vdnZA8wRLeiwVE3fFTA==} peerDependencies: - vitest: 2.1.5 + vitest: 2.1.8 - '@vitest/expect@2.1.5': - resolution: {integrity: sha512-nZSBTW1XIdpZvEJyoP/Sy8fUg0b8od7ZpGDkTUcfJ7wz/VoZAFzFfLyxVxGFhUjJzhYqSbIpfMtl/+k/dpWa3Q==} + '@vitest/expect@2.1.8': + resolution: {integrity: sha512-8ytZ/fFHq2g4PJVAtDX57mayemKgDR6X3Oa2Foro+EygiOJHUXhCqBAAKQYYajZpFoIfvBCF1j6R6IYRSIUFuw==} - '@vitest/mocker@2.1.5': - resolution: {integrity: sha512-XYW6l3UuBmitWqSUXTNXcVBUCRytDogBsWuNXQijc00dtnU/9OqpXWp4OJroVrad/gLIomAq9aW8yWDBtMthhQ==} + '@vitest/mocker@2.1.8': + resolution: {integrity: sha512-7guJ/47I6uqfttp33mgo6ga5Gr1VnL58rcqYKyShoRK9ebu8T5Rs6HN3s1NABiBeVTdWNrwUMcHH54uXZBN4zA==} peerDependencies: msw: ^2.4.9 vite: ^5.0.0 @@ -521,25 +526,25 @@ packages: vite: optional: true - '@vitest/pretty-format@2.1.5': - resolution: {integrity: sha512-4ZOwtk2bqG5Y6xRGHcveZVr+6txkH7M2e+nPFd6guSoN638v/1XQ0K06eOpi0ptVU/2tW/pIU4IoPotY/GZ9fw==} + '@vitest/pretty-format@2.1.8': + resolution: {integrity: sha512-9HiSZ9zpqNLKlbIDRWOnAWqgcA7xu+8YxXSekhr0Ykab7PAYFkhkwoqVArPOtJhPmYeE2YHgKZlj3CP36z2AJQ==} - '@vitest/runner@2.1.5': - resolution: {integrity: sha512-pKHKy3uaUdh7X6p1pxOkgkVAFW7r2I818vHDthYLvUyjRfkKOU6P45PztOch4DZarWQne+VOaIMwA/erSSpB9g==} + '@vitest/runner@2.1.8': + resolution: {integrity: sha512-17ub8vQstRnRlIU5k50bG+QOMLHRhYPAna5tw8tYbj+jzjcspnwnwtPtiOlkuKC4+ixDPTuLZiqiWWQ2PSXHVg==} - '@vitest/snapshot@2.1.5': - resolution: {integrity: sha512-zmYw47mhfdfnYbuhkQvkkzYroXUumrwWDGlMjpdUr4jBd3HZiV2w7CQHj+z7AAS4VOtWxI4Zt4bWt4/sKcoIjg==} + '@vitest/snapshot@2.1.8': + resolution: {integrity: sha512-20T7xRFbmnkfcmgVEz+z3AU/3b0cEzZOt/zmnvZEctg64/QZbSDJEVm9fLnnlSi74KibmRsO9/Qabi+t0vCRPg==} - '@vitest/spy@2.1.5': - resolution: {integrity: sha512-aWZF3P0r3w6DiYTVskOYuhBc7EMc3jvn1TkBg8ttylFFRqNN2XGD7V5a4aQdk6QiUzZQ4klNBSpCLJgWNdIiNw==} + '@vitest/spy@2.1.8': + resolution: {integrity: sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg==} - '@vitest/ui@2.1.5': - resolution: {integrity: sha512-ERgKkDMTfngrZip6VG5h8L9B5D0AH/4+bga4yR1UzGH7c2cxv3LWogw2Dvuwr9cP3/iKDHYys7kIFLDKpxORTg==} + '@vitest/ui@2.1.8': + resolution: {integrity: sha512-5zPJ1fs0ixSVSs5+5V2XJjXLmNzjugHRyV11RqxYVR+oMcogZ9qTuSfKW+OcTV0JeFNznI83BNylzH6SSNJ1+w==} peerDependencies: - vitest: 2.1.5 + vitest: 2.1.8 - '@vitest/utils@2.1.5': - resolution: {integrity: sha512-yfj6Yrp0Vesw2cwJbP+cl04OC+IHFsuQsrsJBL9pyGeQXE56v1UAOQco+SR55Vf1nQzfV0QJg1Qum7AaWUwwYg==} + '@vitest/utils@2.1.8': + resolution: {integrity: sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==} '@volar/language-core@2.4.10': resolution: {integrity: sha512-hG3Z13+nJmGaT+fnQzAkS0hjJRa2FCeqZt6Bd+oGNhUkQ+mTFsDETg5rqUTxyzIh5pSOGY7FHCWUS8G82AzLCA==} @@ -652,8 +657,8 @@ packages: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} - caniuse-lite@1.0.30001684: - resolution: {integrity: sha512-G1LRwLIQjBQoyq0ZJGqGIJUXzJ8irpbjHLpVRXDvBEScFJ9b17sgK6vlx0GAJFE21okD7zXl08rRRUfq6HdoEQ==} + caniuse-lite@1.0.30001687: + resolution: {integrity: sha512-0S/FDhf4ZiqrTUiQ39dKeUjYRjkv7lOZU1Dgif2rIqrTzX/1wV2hfKu9TOm1IHkdSijfLswxTFzl/cvir+SLSQ==} chai@5.1.2: resolution: {integrity: sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==} @@ -711,8 +716,8 @@ packages: de-indent@1.0.2: resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==} - debug@4.3.7: - resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} + debug@4.4.0: + resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==} engines: {node: '>=6.0'} peerDependencies: supports-color: '*' @@ -734,8 +739,8 @@ packages: eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - electron-to-chromium@1.5.64: - resolution: {integrity: sha512-IXEuxU+5ClW2IGEYFC2T7szbyVgehupCWQe5GNh+H065CD6U6IFN0s4KeAMFGNmQolRU4IV7zGBWSYMmZ8uuqQ==} + electron-to-chromium@1.5.72: + resolution: {integrity: sha512-ZpSAUOZ2Izby7qnZluSrAlGgGQzucmFbN0n64dYzocYxnxV5ufurpj3VgEe4cUp7ir9LmeLxNYo8bVnlM8bQHw==} emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -938,8 +943,8 @@ packages: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} hasBin: true - magic-string@0.30.13: - resolution: {integrity: sha512-8rYBO+MsWkgjDSOvLomYnzhdwEG51olQ4zL5KXnNJWV5MNmrb4rTZdrtkhxjnD/QyZUqR/Z/XDsUs/4ej2nx0g==} + magic-string@0.30.15: + resolution: {integrity: sha512-zXeaYRgZ6ldS1RJJUrMrYgNJ4fdwnyI6tVqoiIhyCyv5IVTK9BU8Ic2l253GGETQHxI4HNUwhJ3fjDhKqEoaAw==} magicast@0.3.5: resolution: {integrity: sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==} @@ -969,8 +974,8 @@ packages: ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - msw@2.6.6: - resolution: {integrity: sha512-npfIIVRHKQX3Lw4aLWX4wBh+lQwpqdZNyJYB5K/+ktK8NhtkdsTxGK7WDrgknozcVyRI7TOqY6yBS9j2FTR+YQ==} + msw@2.6.8: + resolution: {integrity: sha512-nxXxnH6WALZ9a7rsQp4HU2AaD4iGAiouMmE/MY4al7pXTibgA6OZOuKhmN2WBIM6w9qMKwRtX8p2iOb45B2M/Q==} engines: {node: '>=18'} hasBin: true peerDependencies: @@ -986,13 +991,13 @@ packages: resolution: {integrity: sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==} engines: {node: ^18.17.0 || >=20.5.0} - nanoid@3.3.7: - resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + nanoid@3.3.8: + resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - node-releases@2.0.18: - resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==} + node-releases@2.0.19: + resolution: {integrity: sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==} outvariant@1.4.3: resolution: {integrity: sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==} @@ -1034,13 +1039,13 @@ packages: pkg-types@1.2.1: resolution: {integrity: sha512-sQoqa8alT3nHjGuTjuKgOnvjo4cljkufdtLMnO2LBP/wRwuDlo1tkaEdMxCRhyGRPacv/ztlZgDPm2b7FAmEvw==} - playwright-core@1.49.0: - resolution: {integrity: sha512-R+3KKTQF3npy5GTiKH/T+kdhoJfJojjHESR1YEWhYuEKRVfVaxH3+4+GvXE5xyCngCxhxnykk0Vlah9v8fs3jA==} + playwright-core@1.49.1: + resolution: {integrity: sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==} engines: {node: '>=18'} hasBin: true - playwright@1.49.0: - resolution: {integrity: sha512-eKpmys0UFDnfNb3vfsf8Vx2LEOtflgRebl0Im2eQQnYMA4Aqd+Zw8bEOB+7ZKvN76901mRnqdsiOGKxzVTbi7A==} + playwright@1.49.1: + resolution: {integrity: sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==} engines: {node: '>=18'} hasBin: true @@ -1052,8 +1057,8 @@ packages: resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - psl@1.13.0: - resolution: {integrity: sha512-BFwmFXiJoFqlUpZ5Qssolv15DMyc84gTBds1BjsV1BfXEo1UyyD7GsmN67n7J77uRhoSNW1AXtXKPLcBFQn9Aw==} + psl@1.15.0: + resolution: {integrity: sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==} punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} @@ -1083,8 +1088,8 @@ packages: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true - rollup@4.27.4: - resolution: {integrity: sha512-RLKxqHEMjh/RGLsDxAEsaLO3mWgyoU6x9w6n1ikAzet4B3gI2/3yP6PWY2p9QzRTh6MfEIXB3MwsOY0Iv3vNrw==} + rollup@4.28.1: + resolution: {integrity: sha512-61fXYl/qNVinKmGSTHAZ6Yy8I3YIJC/r2m9feHo6SwVAVcLT5MPwOUFe7EuURA/4m0NR8lXG4BBXuo/IZEsjMg==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true @@ -1227,8 +1232,8 @@ packages: resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} engines: {node: '>=10'} - type-fest@4.27.1: - resolution: {integrity: sha512-3Ta7CyV6daqpwuGJMJKABaUChZZejpzysZkQg1//bLRg2wKQ4duwsg3MMIsHuElq58iDqizg4DBUmK8H8wExJg==} + type-fest@4.30.0: + resolution: {integrity: sha512-G6zXWS1dLj6eagy6sVhOMQiLtJdxQBHIA9Z6HFUNLOlr6MFOgzV8wvmidtPONfPtEUv0uZsy77XJNzTAfwPDaA==} engines: {node: '>=16'} typescript@5.4.2: @@ -1267,8 +1272,8 @@ packages: url-parse@1.5.10: resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} - vite-node@2.1.5: - resolution: {integrity: sha512-rd0QIgx74q4S1Rd56XIiL2cYEdyWn13cunYBIuqh9mpmQr7gGS0IxXoP8R6OaZtNQQLyXSWbd4rXKYUbhFpK5w==} + vite-node@2.1.8: + resolution: {integrity: sha512-uPAwSr57kYjAUux+8E2j0q0Fxpn8M9VoyfGiRI8Kfktz9NcYMCenwY5RnZxnF1WTu3TGiYipirIzacLL3VVGFg==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true @@ -1313,15 +1318,15 @@ packages: terser: optional: true - vitest@2.1.5: - resolution: {integrity: sha512-P4ljsdpuzRTPI/kbND2sDZ4VmieerR2c9szEZpjc+98Z9ebvnXmM5+0tHEKqYZumXqlvnmfWsjeFOjXVriDG7A==} + vitest@2.1.8: + resolution: {integrity: sha512-1vBKTZskHw/aosXqQUlVWWlGUxSJR8YtiyZDJAFeW2kPAeX6S3Sool0mjspO+kXLuxVWlEDDowBAeqeAQefqLQ==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' '@types/node': ^18.0.0 || >=20.0.0 - '@vitest/browser': 2.1.5 - '@vitest/ui': 2.1.5 + '@vitest/browser': 2.1.8 + '@vitest/ui': 2.1.8 happy-dom: '*' jsdom: '*' peerDependenciesMeta: @@ -1410,39 +1415,39 @@ snapshots: js-tokens: 4.0.0 picocolors: 1.1.1 - '@babel/compat-data@7.26.2': {} + '@babel/compat-data@7.26.3': {} '@babel/core@7.26.0': dependencies: '@ampproject/remapping': 2.3.0 '@babel/code-frame': 7.26.2 - '@babel/generator': 7.26.2 + '@babel/generator': 7.26.3 '@babel/helper-compilation-targets': 7.25.9 '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) '@babel/helpers': 7.26.0 - '@babel/parser': 7.26.2 + '@babel/parser': 7.26.3 '@babel/template': 7.25.9 - '@babel/traverse': 7.25.9 - '@babel/types': 7.26.0 + '@babel/traverse': 7.26.4 + '@babel/types': 7.26.3 convert-source-map: 2.0.0 - debug: 4.3.7 + debug: 4.4.0 gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 transitivePeerDependencies: - supports-color - '@babel/generator@7.26.2': + '@babel/generator@7.26.3': dependencies: - '@babel/parser': 7.26.2 - '@babel/types': 7.26.0 + '@babel/parser': 7.26.3 + '@babel/types': 7.26.3 '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 jsesc: 3.0.2 '@babel/helper-compilation-targets@7.25.9': dependencies: - '@babel/compat-data': 7.26.2 + '@babel/compat-data': 7.26.3 '@babel/helper-validator-option': 7.25.9 browserslist: 4.24.2 lru-cache: 5.1.1 @@ -1450,8 +1455,8 @@ snapshots: '@babel/helper-module-imports@7.25.9': dependencies: - '@babel/traverse': 7.25.9 - '@babel/types': 7.26.0 + '@babel/traverse': 7.26.4 + '@babel/types': 7.26.3 transitivePeerDependencies: - supports-color @@ -1460,7 +1465,7 @@ snapshots: '@babel/core': 7.26.0 '@babel/helper-module-imports': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.26.4 transitivePeerDependencies: - supports-color @@ -1473,11 +1478,11 @@ snapshots: '@babel/helpers@7.26.0': dependencies: '@babel/template': 7.25.9 - '@babel/types': 7.26.0 + '@babel/types': 7.26.3 - '@babel/parser@7.26.2': + '@babel/parser@7.26.3': dependencies: - '@babel/types': 7.26.0 + '@babel/types': 7.26.3 '@babel/runtime@7.26.0': dependencies: @@ -1486,22 +1491,22 @@ snapshots: '@babel/template@7.25.9': dependencies: '@babel/code-frame': 7.26.2 - '@babel/parser': 7.26.2 - '@babel/types': 7.26.0 + '@babel/parser': 7.26.3 + '@babel/types': 7.26.3 - '@babel/traverse@7.25.9': + '@babel/traverse@7.26.4': dependencies: '@babel/code-frame': 7.26.2 - '@babel/generator': 7.26.2 - '@babel/parser': 7.26.2 + '@babel/generator': 7.26.3 + '@babel/parser': 7.26.3 '@babel/template': 7.25.9 - '@babel/types': 7.26.0 - debug: 4.3.7 + '@babel/types': 7.26.3 + debug: 4.4.0 globals: 11.12.0 transitivePeerDependencies: - supports-color - '@babel/types@7.26.0': + '@babel/types@7.26.3': dependencies: '@babel/helper-string-parser': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 @@ -1588,13 +1593,13 @@ snapshots: '@esbuild/win32-x64@0.21.5': optional: true - '@inquirer/confirm@5.0.2(@types/node@22.5.4)': + '@inquirer/confirm@5.1.0(@types/node@22.5.4)': dependencies: - '@inquirer/core': 10.1.0(@types/node@22.5.4) + '@inquirer/core': 10.1.1(@types/node@22.5.4) '@inquirer/type': 3.0.1(@types/node@22.5.4) '@types/node': 22.5.4 - '@inquirer/core@10.1.0(@types/node@22.5.4)': + '@inquirer/core@10.1.1(@types/node@22.5.4)': dependencies: '@inquirer/figures': 1.0.8 '@inquirer/type': 3.0.1(@types/node@22.5.4) @@ -1683,7 +1688,7 @@ snapshots: '@microsoft/tsdoc@0.15.1': {} - '@mswjs/interceptors@0.37.1': + '@mswjs/interceptors@0.37.3': dependencies: '@open-draft/deferred-promise': 2.2.0 '@open-draft/logger': 0.3.0 @@ -1706,66 +1711,69 @@ snapshots: '@polka/url@1.0.0-next.28': {} - '@rollup/pluginutils@5.1.3(rollup@4.27.4)': + '@rollup/pluginutils@5.1.3(rollup@4.28.1)': dependencies: '@types/estree': 1.0.6 estree-walker: 2.0.2 picomatch: 4.0.2 optionalDependencies: - rollup: 4.27.4 + rollup: 4.28.1 + + '@rollup/rollup-android-arm-eabi@4.28.1': + optional: true - '@rollup/rollup-android-arm-eabi@4.27.4': + '@rollup/rollup-android-arm64@4.28.1': optional: true - '@rollup/rollup-android-arm64@4.27.4': + '@rollup/rollup-darwin-arm64@4.28.1': optional: true - '@rollup/rollup-darwin-arm64@4.27.4': + '@rollup/rollup-darwin-x64@4.28.1': optional: true - '@rollup/rollup-darwin-x64@4.27.4': + '@rollup/rollup-freebsd-arm64@4.28.1': optional: true - '@rollup/rollup-freebsd-arm64@4.27.4': + '@rollup/rollup-freebsd-x64@4.28.1': optional: true - '@rollup/rollup-freebsd-x64@4.27.4': + '@rollup/rollup-linux-arm-gnueabihf@4.28.1': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.27.4': + '@rollup/rollup-linux-arm-musleabihf@4.28.1': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.27.4': + '@rollup/rollup-linux-arm64-gnu@4.28.1': optional: true - '@rollup/rollup-linux-arm64-gnu@4.27.4': + '@rollup/rollup-linux-arm64-musl@4.28.1': optional: true - '@rollup/rollup-linux-arm64-musl@4.27.4': + '@rollup/rollup-linux-loongarch64-gnu@4.28.1': optional: true - '@rollup/rollup-linux-powerpc64le-gnu@4.27.4': + '@rollup/rollup-linux-powerpc64le-gnu@4.28.1': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.27.4': + '@rollup/rollup-linux-riscv64-gnu@4.28.1': optional: true - '@rollup/rollup-linux-s390x-gnu@4.27.4': + '@rollup/rollup-linux-s390x-gnu@4.28.1': optional: true - '@rollup/rollup-linux-x64-gnu@4.27.4': + '@rollup/rollup-linux-x64-gnu@4.28.1': optional: true - '@rollup/rollup-linux-x64-musl@4.27.4': + '@rollup/rollup-linux-x64-musl@4.28.1': optional: true - '@rollup/rollup-win32-arm64-msvc@4.27.4': + '@rollup/rollup-win32-arm64-msvc@4.28.1': optional: true - '@rollup/rollup-win32-ia32-msvc@4.27.4': + '@rollup/rollup-win32-ia32-msvc@4.28.1': optional: true - '@rollup/rollup-win32-x64-msvc@4.27.4': + '@rollup/rollup-win32-x64-msvc@4.28.1': optional: true '@rushstack/node-core-library@5.10.0(@types/node@22.5.4)': @@ -1833,20 +1841,20 @@ snapshots: '@types/tough-cookie@4.0.5': {} - '@vitest/browser@2.1.5(@types/node@22.5.4)(playwright@1.49.0)(typescript@5.7.2)(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3))(vitest@2.1.5)': + '@vitest/browser@2.1.8(@types/node@22.5.4)(playwright@1.49.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3))(vitest@2.1.8)': dependencies: '@testing-library/dom': 10.4.0 '@testing-library/user-event': 14.5.2(@testing-library/dom@10.4.0) - '@vitest/mocker': 2.1.5(msw@2.6.6(@types/node@22.5.4)(typescript@5.7.2))(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3)) - '@vitest/utils': 2.1.5 - magic-string: 0.30.13 - msw: 2.6.6(@types/node@22.5.4)(typescript@5.7.2) + '@vitest/mocker': 2.1.8(msw@2.6.8(@types/node@22.5.4)(typescript@5.7.2))(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3)) + '@vitest/utils': 2.1.8 + magic-string: 0.30.15 + msw: 2.6.8(@types/node@22.5.4)(typescript@5.7.2) sirv: 3.0.0 tinyrainbow: 1.2.0 - vitest: 2.1.5(@types/node@22.5.4)(@vitest/browser@2.1.5)(@vitest/ui@2.1.5)(msw@2.6.6(@types/node@22.5.4)(typescript@5.7.2))(terser@5.31.3) + vitest: 2.1.8(@types/node@22.5.4)(@vitest/browser@2.1.8)(@vitest/ui@2.1.8)(msw@2.6.8(@types/node@22.5.4)(typescript@5.7.2))(terser@5.31.3) ws: 8.18.0 optionalDependencies: - playwright: 1.49.0 + playwright: 1.49.1 transitivePeerDependencies: - '@types/node' - bufferutil @@ -1854,10 +1862,10 @@ snapshots: - utf-8-validate - vite - '@vitest/coverage-istanbul@2.1.5(vitest@2.1.5)': + '@vitest/coverage-istanbul@2.1.8(vitest@2.1.8)': dependencies: '@istanbuljs/schema': 0.1.3 - debug: 4.3.7 + debug: 4.4.0 istanbul-lib-coverage: 3.2.2 istanbul-lib-instrument: 6.0.3 istanbul-lib-report: 3.0.1 @@ -1866,59 +1874,59 @@ snapshots: magicast: 0.3.5 test-exclude: 7.0.1 tinyrainbow: 1.2.0 - vitest: 2.1.5(@types/node@22.5.4)(@vitest/browser@2.1.5)(@vitest/ui@2.1.5)(msw@2.6.6(@types/node@22.5.4)(typescript@5.7.2))(terser@5.31.3) + vitest: 2.1.8(@types/node@22.5.4)(@vitest/browser@2.1.8)(@vitest/ui@2.1.8)(msw@2.6.8(@types/node@22.5.4)(typescript@5.7.2))(terser@5.31.3) transitivePeerDependencies: - supports-color - '@vitest/expect@2.1.5': + '@vitest/expect@2.1.8': dependencies: - '@vitest/spy': 2.1.5 - '@vitest/utils': 2.1.5 + '@vitest/spy': 2.1.8 + '@vitest/utils': 2.1.8 chai: 5.1.2 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.5(msw@2.6.6(@types/node@22.5.4)(typescript@5.7.2))(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3))': + '@vitest/mocker@2.1.8(msw@2.6.8(@types/node@22.5.4)(typescript@5.7.2))(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3))': dependencies: - '@vitest/spy': 2.1.5 + '@vitest/spy': 2.1.8 estree-walker: 3.0.3 - magic-string: 0.30.13 + magic-string: 0.30.15 optionalDependencies: - msw: 2.6.6(@types/node@22.5.4)(typescript@5.7.2) + msw: 2.6.8(@types/node@22.5.4)(typescript@5.7.2) vite: 5.4.11(@types/node@22.5.4)(terser@5.31.3) - '@vitest/pretty-format@2.1.5': + '@vitest/pretty-format@2.1.8': dependencies: tinyrainbow: 1.2.0 - '@vitest/runner@2.1.5': + '@vitest/runner@2.1.8': dependencies: - '@vitest/utils': 2.1.5 + '@vitest/utils': 2.1.8 pathe: 1.1.2 - '@vitest/snapshot@2.1.5': + '@vitest/snapshot@2.1.8': dependencies: - '@vitest/pretty-format': 2.1.5 - magic-string: 0.30.13 + '@vitest/pretty-format': 2.1.8 + magic-string: 0.30.15 pathe: 1.1.2 - '@vitest/spy@2.1.5': + '@vitest/spy@2.1.8': dependencies: tinyspy: 3.0.2 - '@vitest/ui@2.1.5(vitest@2.1.5)': + '@vitest/ui@2.1.8(vitest@2.1.8)': dependencies: - '@vitest/utils': 2.1.5 + '@vitest/utils': 2.1.8 fflate: 0.8.2 flatted: 3.3.2 pathe: 1.1.2 sirv: 3.0.0 tinyglobby: 0.2.10 tinyrainbow: 1.2.0 - vitest: 2.1.5(@types/node@22.5.4)(@vitest/browser@2.1.5)(@vitest/ui@2.1.5)(msw@2.6.6(@types/node@22.5.4)(typescript@5.7.2))(terser@5.31.3) + vitest: 2.1.8(@types/node@22.5.4)(@vitest/browser@2.1.8)(@vitest/ui@2.1.8)(msw@2.6.8(@types/node@22.5.4)(typescript@5.7.2))(terser@5.31.3) - '@vitest/utils@2.1.5': + '@vitest/utils@2.1.8': dependencies: - '@vitest/pretty-format': 2.1.5 + '@vitest/pretty-format': 2.1.8 loupe: 3.1.2 tinyrainbow: 1.2.0 @@ -1936,7 +1944,7 @@ snapshots: '@vue/compiler-core@3.5.13': dependencies: - '@babel/parser': 7.26.2 + '@babel/parser': 7.26.3 '@vue/shared': 3.5.13 entities: 4.5.0 estree-walker: 2.0.2 @@ -2030,9 +2038,9 @@ snapshots: browserslist@4.24.2: dependencies: - caniuse-lite: 1.0.30001684 - electron-to-chromium: 1.5.64 - node-releases: 2.0.18 + caniuse-lite: 1.0.30001687 + electron-to-chromium: 1.5.72 + node-releases: 2.0.19 update-browserslist-db: 1.1.1(browserslist@4.24.2) buffer-from@1.1.2: @@ -2040,7 +2048,7 @@ snapshots: cac@6.7.14: {} - caniuse-lite@1.0.30001684: {} + caniuse-lite@1.0.30001687: {} chai@5.1.2: dependencies: @@ -2094,7 +2102,7 @@ snapshots: de-indent@1.0.2: {} - debug@4.3.7: + debug@4.4.0: dependencies: ms: 2.1.3 @@ -2106,7 +2114,7 @@ snapshots: eastasianwidth@0.2.0: {} - electron-to-chromium@1.5.64: {} + electron-to-chromium@1.5.72: {} emoji-regex@8.0.0: {} @@ -2229,7 +2237,7 @@ snapshots: istanbul-lib-instrument@6.0.3: dependencies: '@babel/core': 7.26.0 - '@babel/parser': 7.26.2 + '@babel/parser': 7.26.3 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.2 semver: 7.6.3 @@ -2245,7 +2253,7 @@ snapshots: istanbul-lib-source-maps@5.0.6: dependencies: '@jridgewell/trace-mapping': 0.3.25 - debug: 4.3.7 + debug: 4.4.0 istanbul-lib-coverage: 3.2.2 transitivePeerDependencies: - supports-color @@ -2298,14 +2306,14 @@ snapshots: lz-string@1.5.0: {} - magic-string@0.30.13: + magic-string@0.30.15: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 magicast@0.3.5: dependencies: - '@babel/parser': 7.26.2 - '@babel/types': 7.26.0 + '@babel/parser': 7.26.3 + '@babel/types': 7.26.3 source-map-js: 1.2.1 make-dir@4.0.0: @@ -2333,13 +2341,13 @@ snapshots: ms@2.1.3: {} - msw@2.6.6(@types/node@22.5.4)(typescript@5.7.2): + msw@2.6.8(@types/node@22.5.4)(typescript@5.7.2): dependencies: '@bundled-es-modules/cookie': 2.0.1 '@bundled-es-modules/statuses': 1.0.1 '@bundled-es-modules/tough-cookie': 0.1.6 - '@inquirer/confirm': 5.0.2(@types/node@22.5.4) - '@mswjs/interceptors': 0.37.1 + '@inquirer/confirm': 5.1.0(@types/node@22.5.4) + '@mswjs/interceptors': 0.37.3 '@open-draft/deferred-promise': 2.2.0 '@open-draft/until': 2.1.0 '@types/cookie': 0.6.0 @@ -2351,7 +2359,7 @@ snapshots: outvariant: 1.4.3 path-to-regexp: 6.3.0 strict-event-emitter: 0.5.1 - type-fest: 4.27.1 + type-fest: 4.30.0 yargs: 17.7.2 optionalDependencies: typescript: 5.7.2 @@ -2362,9 +2370,9 @@ snapshots: mute-stream@2.0.0: {} - nanoid@3.3.7: {} + nanoid@3.3.8: {} - node-releases@2.0.18: {} + node-releases@2.0.19: {} outvariant@1.4.3: {} @@ -2397,17 +2405,17 @@ snapshots: mlly: 1.7.3 pathe: 1.1.2 - playwright-core@1.49.0: {} + playwright-core@1.49.1: {} - playwright@1.49.0: + playwright@1.49.1: dependencies: - playwright-core: 1.49.0 + playwright-core: 1.49.1 optionalDependencies: fsevents: 2.3.2 postcss@8.4.49: dependencies: - nanoid: 3.3.7 + nanoid: 3.3.8 picocolors: 1.1.1 source-map-js: 1.2.1 @@ -2417,7 +2425,7 @@ snapshots: ansi-styles: 5.2.0 react-is: 17.0.2 - psl@1.13.0: + psl@1.15.0: dependencies: punycode: 2.3.1 @@ -2441,28 +2449,29 @@ snapshots: path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 - rollup@4.27.4: + rollup@4.28.1: dependencies: '@types/estree': 1.0.6 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.27.4 - '@rollup/rollup-android-arm64': 4.27.4 - '@rollup/rollup-darwin-arm64': 4.27.4 - '@rollup/rollup-darwin-x64': 4.27.4 - '@rollup/rollup-freebsd-arm64': 4.27.4 - '@rollup/rollup-freebsd-x64': 4.27.4 - '@rollup/rollup-linux-arm-gnueabihf': 4.27.4 - '@rollup/rollup-linux-arm-musleabihf': 4.27.4 - '@rollup/rollup-linux-arm64-gnu': 4.27.4 - '@rollup/rollup-linux-arm64-musl': 4.27.4 - '@rollup/rollup-linux-powerpc64le-gnu': 4.27.4 - '@rollup/rollup-linux-riscv64-gnu': 4.27.4 - '@rollup/rollup-linux-s390x-gnu': 4.27.4 - '@rollup/rollup-linux-x64-gnu': 4.27.4 - '@rollup/rollup-linux-x64-musl': 4.27.4 - '@rollup/rollup-win32-arm64-msvc': 4.27.4 - '@rollup/rollup-win32-ia32-msvc': 4.27.4 - '@rollup/rollup-win32-x64-msvc': 4.27.4 + '@rollup/rollup-android-arm-eabi': 4.28.1 + '@rollup/rollup-android-arm64': 4.28.1 + '@rollup/rollup-darwin-arm64': 4.28.1 + '@rollup/rollup-darwin-x64': 4.28.1 + '@rollup/rollup-freebsd-arm64': 4.28.1 + '@rollup/rollup-freebsd-x64': 4.28.1 + '@rollup/rollup-linux-arm-gnueabihf': 4.28.1 + '@rollup/rollup-linux-arm-musleabihf': 4.28.1 + '@rollup/rollup-linux-arm64-gnu': 4.28.1 + '@rollup/rollup-linux-arm64-musl': 4.28.1 + '@rollup/rollup-linux-loongarch64-gnu': 4.28.1 + '@rollup/rollup-linux-powerpc64le-gnu': 4.28.1 + '@rollup/rollup-linux-riscv64-gnu': 4.28.1 + '@rollup/rollup-linux-s390x-gnu': 4.28.1 + '@rollup/rollup-linux-x64-gnu': 4.28.1 + '@rollup/rollup-linux-x64-musl': 4.28.1 + '@rollup/rollup-win32-arm64-msvc': 4.28.1 + '@rollup/rollup-win32-ia32-msvc': 4.28.1 + '@rollup/rollup-win32-x64-msvc': 4.28.1 fsevents: 2.3.3 semver@6.3.1: {} @@ -2576,14 +2585,14 @@ snapshots: tough-cookie@4.1.4: dependencies: - psl: 1.13.0 + psl: 1.15.0 punycode: 2.3.1 universalify: 0.2.0 url-parse: 1.5.10 type-fest@0.21.3: {} - type-fest@4.27.1: {} + type-fest@4.30.0: {} typescript@5.4.2: {} @@ -2612,10 +2621,10 @@ snapshots: querystringify: 2.2.0 requires-port: 1.0.0 - vite-node@2.1.5(@types/node@22.5.4)(terser@5.31.3): + vite-node@2.1.8(@types/node@22.5.4)(terser@5.31.3): dependencies: cac: 6.7.14 - debug: 4.3.7 + debug: 4.4.0 es-module-lexer: 1.5.4 pathe: 1.1.2 vite: 5.4.11(@types/node@22.5.4)(terser@5.31.3) @@ -2630,17 +2639,17 @@ snapshots: - supports-color - terser - vite-plugin-dts@4.3.0(@types/node@22.5.4)(rollup@4.27.4)(typescript@5.7.2)(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3)): + vite-plugin-dts@4.3.0(@types/node@22.5.4)(rollup@4.28.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3)): dependencies: '@microsoft/api-extractor': 7.48.0(@types/node@22.5.4) - '@rollup/pluginutils': 5.1.3(rollup@4.27.4) + '@rollup/pluginutils': 5.1.3(rollup@4.28.1) '@volar/typescript': 2.4.10 '@vue/language-core': 2.1.6(typescript@5.7.2) compare-versions: 6.1.1 - debug: 4.3.7 + debug: 4.4.0 kolorist: 1.8.0 local-pkg: 0.5.1 - magic-string: 0.30.13 + magic-string: 0.30.15 typescript: 5.7.2 optionalDependencies: vite: 5.4.11(@types/node@22.5.4)(terser@5.31.3) @@ -2653,25 +2662,25 @@ snapshots: dependencies: esbuild: 0.21.5 postcss: 8.4.49 - rollup: 4.27.4 + rollup: 4.28.1 optionalDependencies: '@types/node': 22.5.4 fsevents: 2.3.3 terser: 5.31.3 - vitest@2.1.5(@types/node@22.5.4)(@vitest/browser@2.1.5)(@vitest/ui@2.1.5)(msw@2.6.6(@types/node@22.5.4)(typescript@5.7.2))(terser@5.31.3): + vitest@2.1.8(@types/node@22.5.4)(@vitest/browser@2.1.8)(@vitest/ui@2.1.8)(msw@2.6.8(@types/node@22.5.4)(typescript@5.7.2))(terser@5.31.3): dependencies: - '@vitest/expect': 2.1.5 - '@vitest/mocker': 2.1.5(msw@2.6.6(@types/node@22.5.4)(typescript@5.7.2))(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3)) - '@vitest/pretty-format': 2.1.5 - '@vitest/runner': 2.1.5 - '@vitest/snapshot': 2.1.5 - '@vitest/spy': 2.1.5 - '@vitest/utils': 2.1.5 + '@vitest/expect': 2.1.8 + '@vitest/mocker': 2.1.8(msw@2.6.8(@types/node@22.5.4)(typescript@5.7.2))(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3)) + '@vitest/pretty-format': 2.1.8 + '@vitest/runner': 2.1.8 + '@vitest/snapshot': 2.1.8 + '@vitest/spy': 2.1.8 + '@vitest/utils': 2.1.8 chai: 5.1.2 - debug: 4.3.7 + debug: 4.4.0 expect-type: 1.1.0 - magic-string: 0.30.13 + magic-string: 0.30.15 pathe: 1.1.2 std-env: 3.8.0 tinybench: 2.9.0 @@ -2679,12 +2688,12 @@ snapshots: tinypool: 1.0.2 tinyrainbow: 1.2.0 vite: 5.4.11(@types/node@22.5.4)(terser@5.31.3) - vite-node: 2.1.5(@types/node@22.5.4)(terser@5.31.3) + vite-node: 2.1.8(@types/node@22.5.4)(terser@5.31.3) why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 22.5.4 - '@vitest/browser': 2.1.5(@types/node@22.5.4)(playwright@1.49.0)(typescript@5.7.2)(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3))(vitest@2.1.5) - '@vitest/ui': 2.1.5(vitest@2.1.5) + '@vitest/browser': 2.1.8(@types/node@22.5.4)(playwright@1.49.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.5.4)(terser@5.31.3))(vitest@2.1.8) + '@vitest/ui': 2.1.8(vitest@2.1.8) transitivePeerDependencies: - less - lightningcss diff --git a/src/index.ts b/src/index.ts index 0cf1c64..f08e69f 100755 --- a/src/index.ts +++ b/src/index.ts @@ -284,7 +284,9 @@ const fromString = (source: string): CSSMatrix => { m = m.scale(x, y, z); // single value expected } else if ( - prop === "scale" && !Number.isNaN(x) && x !== 1 && z === undefined + // prop === "scale" && !Number.isNaN(x) && x !== 1 && z === undefined + prop === "scale" && !Number.isNaN(x) && [x, y].some((n) => n !== 1) && + z === undefined ) { const nosy = Number.isNaN(+y); const sy = nosy ? x : y; diff --git a/test/__screenshots__/dommatrix.test.ts/DOMMatrix-Class-Test-Test-scale-issue--3-1.png b/test/__screenshots__/dommatrix.test.ts/DOMMatrix-Class-Test-Test-scale-issue--3-1.png new file mode 100644 index 0000000..80cfc2e Binary files /dev/null and b/test/__screenshots__/dommatrix.test.ts/DOMMatrix-Class-Test-Test-scale-issue--3-1.png differ diff --git a/test/dommatrix.test.ts b/test/dommatrix.test.ts index 35d5ca7..5638df3 100755 --- a/test/dommatrix.test.ts +++ b/test/dommatrix.test.ts @@ -84,7 +84,15 @@ describe('DOMMatrix Class Test', () => { expect(css.is2D).to.equal(new CSSMatrix(css).is2D) expect(css.isIdentity).to.equal(dom.isIdentity) expect(css.isIdentity).to.equal((new CSSMatrix(dom)).isIdentity) + }); + + it('Test scale issue #3', () => { + const matrix = new CSSMatrix('scale(1, -1)'); + + expect(matrix.toString()).toBe('matrix(1, 0, 0, -1, 0, 0)'); + const matrix2 = new CSSMatrix('scale(2, -1)'); + expect(matrix2.toString()).toBe('matrix(2, 0, 0, -1, 0, 0)'); }); it('Test specific private methods', () => {