path2d-polyfill 3.2.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var X=b=>{throw TypeError(b)};var Y=(b,M,v)=>M.has(b)||X("Cannot "+v);var h=(b,M,v)=>(Y(b,M,"read from private field"),v?v.call(b):M.get(b)),_=(b,M,v)=>M.has(b)?X("Cannot add the same private member more than once"):M instanceof WeakSet?M.add(b):M.set(b,v),Q=(b,M,v,$)=>(Y(b,M,"write to private field"),$?$.call(b,v):M.set(b,v),v);(function(){"use strict";var i;const b={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},M=/([astvzqmhlc])([^astvzqmhlc]*)/gi,v=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function $(s){const t=s.match(v);return t?t.map(Number):[]}function J(s){const t=[],n=String(s).trim();return n[0]!=="M"&&n[0]!=="m"||n.replace(M,(o,r,a)=>{const l=$(a);let f=r.toLowerCase(),c=r;if(f==="m"&&l.length>2&&(t.push([c,...l.splice(0,2)]),f="l",c=c==="m"?"l":"L"),l.length<b[f])return"";for(t.push([c,...l.splice(0,b[f])]);l.length>=b[f]&&l.length&&b[f];)t.push([c,...l.splice(0,b[f])]);return""}),t}function j(s,t){const n=s.x*Math.cos(t)-s.y*Math.sin(t),o=s.y*Math.cos(t)+s.x*Math.sin(t);s.x=n,s.y=o}function K(s,t,n){s.x+=t,s.y+=n}function B(s,t){s.x*=t,s.y*=t}const F=class F{constructor(t){_(this,i);Q(this,i,[]),t&&t instanceof F?h(this,i).push(...h(t,i)):t&&Q(this,i,J(t))}addCustomCommand(t){h(this,i).push(t)}addPath(t){t&&t instanceof F&&h(this,i).push(...h(t,i))}moveTo(t,n){h(this,i).push(["M",t,n])}lineTo(t,n){h(this,i).push(["L",t,n])}arc(t,n,o,r,a,l){h(this,i).push(["AC",t,n,o,r,a,!!l])}arcTo(t,n,o,r,a){h(this,i).push(["AT",t,n,o,r,a])}ellipse(t,n,o,r,a,l,f,c){h(this,i).push(["E",t,n,o,r,a,l,f,!!c])}closePath(){h(this,i).push(["Z"])}bezierCurveTo(t,n,o,r,a,l){h(this,i).push(["C",t,n,o,r,a,l])}quadraticCurveTo(t,n,o,r){h(this,i).push(["Q",t,n,o,r])}rect(t,n,o,r){h(this,i).push(["R",t,n,o,r])}roundRect(t,n,o,r,a){typeof a>"u"?h(this,i).push(["RR",t,n,o,r,0]):h(this,i).push(["RR",t,n,o,r,a])}buildPathInCanvas(t){let n=0,o=0,r,a,l,f,c,u,p,m,z,k,V,Z,L,T,d,N,S,x,q,G,U,w=null,I=null,P=null,R=null,C=null,A=null;t.beginPath();for(let y=0;y<h(this,i).length;++y){x=h(this,i)[y][0],x!=="S"&&x!=="s"&&x!=="C"&&x!=="c"&&(w=null,I=null),x!=="T"&&x!=="t"&&x!=="Q"&&x!=="q"&&(P=null,R=null);let e;switch(x){case"m":case"M":e=h(this,i)[y],x==="m"?(n+=e[1],o+=e[2]):(n=e[1],o=e[2]),(x==="M"||!C)&&(C={x:n,y:o}),t.moveTo(n,o);break;case"l":e=h(this,i)[y],n+=e[1],o+=e[2],t.lineTo(n,o);break;case"L":e=h(this,i)[y],n=e[1],o=e[2],t.lineTo(n,o);break;case"H":e=h(this,i)[y],n=e[1],t.lineTo(n,o);break;case"h":e=h(this,i)[y],n+=e[1],t.lineTo(n,o);break;case"V":e=h(this,i)[y],o=e[1],t.lineTo(n,o);break;case"v":e=h(this,i)[y],o+=e[1],t.lineTo(n,o);break;case"a":case"A":if(e=h(this,i)[y],A===null)throw new Error("This should never happen");x==="a"?(n+=e[6],o+=e[7]):(n=e[6],o=e[7]),T=e[1],d=e[2],p=e[3]*Math.PI/180,l=!!e[4],f=!!e[5],c={x:n,y:o},u={x:(A.x-c.x)/2,y:(A.y-c.y)/2},j(u,-p),m=u.x*u.x/(T*T)+u.y*u.y/(d*d),m>1&&(m=Math.sqrt(m),T*=m,d*=m),q={x:T*u.y/d,y:-(d*u.x)/T},z=T*T*d*d,k=T*T*u.y*u.y+d*d*u.x*u.x,f!==l?B(q,Math.sqrt((z-k)/k)||0):B(q,-Math.sqrt((z-k)/k)||0),a=Math.atan2((u.y-q.y)/d,(u.x-q.x)/T),r=Math.atan2(-(u.y+q.y)/d,-(u.x+q.x)/T),j(q,p),K(q,(c.x+A.x)/2,(c.y+A.y)/2),t.save(),t.translate(q.x,q.y),t.rotate(p),t.scale(T,d),t.arc(0,0,1,a,r,!f),t.restore();break;case"C":e=h(this,i)[y],w=e[3],I=e[4],n=e[5],o=e[6],t.bezierCurveTo(e[1],e[2],w,I,n,o);break;case"c":e=h(this,i)[y],t.bezierCurveTo(e[1]+n,e[2]+o,e[3]+n,e[4]+o,e[5]+n,e[6]+o),w=e[3]+n,I=e[4]+o,n+=e[5],o+=e[6];break;case"S":e=h(this,i)[y],(w===null||I===null)&&(w=n,I=o),t.bezierCurveTo(2*n-w,2*o-I,e[1],e[2],e[3],e[4]),w=e[1],I=e[2],n=e[3],o=e[4];break;case"s":e=h(this,i)[y],(w===null||I===null)&&(w=n,I=o),t.bezierCurveTo(2*n-w,2*o-I,e[1]+n,e[2]+o,e[3]+n,e[4]+o),w=e[1]+n,I=e[2]+o,n+=e[3],o+=e[4];break;case"Q":e=h(this,i)[y],P=e[1],R=e[2],n=e[3],o=e[4],t.quadraticCurveTo(P,R,n,o);break;case"q":e=h(this,i)[y],P=e[1]+n,R=e[2]+o,n+=e[3],o+=e[4],t.quadraticCurveTo(P,R,n,o);break;case"T":e=h(this,i)[y],(P===null||R===null)&&(P=n,R=o),P=2*n-P,R=2*o-R,n=e[1],o=e[2],t.quadraticCurveTo(P,R,n,o);break;case"t":e=h(this,i)[y],(P===null||R===null)&&(P=n,R=o),P=2*n-P,R=2*o-R,n+=e[1],o+=e[2],t.quadraticCurveTo(P,R,n,o);break;case"z":case"Z":C&&(n=C.x,o=C.y),C=null,t.closePath();break;case"AC":e=h(this,i)[y],n=e[1],o=e[2],L=e[3],a=e[4],r=e[5],G=e[6],t.arc(n,o,L,a,r,G);break;case"AT":e=h(this,i)[y],V=e[1],Z=e[2],n=e[3],o=e[4],L=e[5],t.arcTo(V,Z,n,o,L);break;case"E":e=h(this,i)[y],n=e[1],o=e[2],T=e[3],d=e[4],p=e[5],a=e[6],r=e[7],G=e[8],t.save(),t.translate(n,o),t.rotate(p),t.scale(T,d),t.arc(0,0,1,a,r,G),t.restore();break;case"R":e=h(this,i)[y],n=e[1],o=e[2],N=e[3],S=e[4],C={x:n,y:o},t.rect(n,o,N,S);break;case"RR":e=h(this,i)[y],n=e[1],o=e[2],N=e[3],S=e[4],U=e[5],C={x:n,y:o},t.roundRect(n,o,N,S,U);break;default:throw new Error(`Invalid path command: ${x}`)}A?(A.x=n,A.y=o):A={x:n,y:o}}}};i=new WeakMap;let E=F;function H(s){return s!==null&&typeof s=="object"&&("x"in s||"y"in s)&&(typeof s.x=="number"||typeof s.y=="number"||typeof s.x>"u"||typeof s.y>"u")}function W(s){return typeof s=="number"?{x:s,y:s}:{x:typeof s.x=="number"?s.x:0,y:typeof s.y=="number"?s.y:0}}function O(s,t,n,o,r=0){if(typeof r=="number")r=[r];else if(H(r))r=[r];else if(!Array.isArray(r))return;if(Array.isArray(r)){if(r.length===0||r.length>4)throw new RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': ${r.length} radii provided. Between one and four radii are necessary.`);r.forEach(z=>{if(H(z)){const k=z;if(typeof k.x=="number"&&k.x<0)throw new RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': Radius value ${k.x} is negative.`);if(typeof k.y=="number"&&k.y<0)throw new RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': Radius value ${k.y} is negative.`)}else{if(typeof z!="number")throw new TypeError(`Failed to execute 'roundRect' on '${this.constructor.name}': Radius value ${z} is not a number or DOMPointInit.`);if(typeof z=="number"&&z<0)throw new RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': Radius value ${z} is negative.`)}})}const a=r.map(W);if(r.length===1&&a[0].x===0&&a[0].y===0){this.rect(s,t,n,o);return}const l=n/2,f=o/2,c={x:Math.min(l,a[0].x),y:Math.min(f,a[0].y)};let u=c,p=c,m=c;a.length===2&&(u={x:Math.min(l,a[1].x),y:Math.min(f,a[1].y)},m=u),a.length===3&&(u={x:Math.min(l,a[1].x),y:Math.min(f,a[1].y)},m=u,p={x:Math.min(l,a[2].x),y:Math.min(f,a[2].y)}),a.length===4&&(u={x:Math.min(l,a[1].x),y:Math.min(f,a[1].y)},p={x:Math.min(l,a[2].x),y:Math.min(f,a[2].y)},m={x:Math.min(l,a[3].x),y:Math.min(f,a[3].y)}),this.moveTo(s,t+o-m.y),c.x===c.y&&c.x>0?this.arcTo(s,t,s+c.x,t,c.x):c.x>0||c.y>0?this.ellipse(s+c.x,t+c.y,c.x,c.y,0,Math.PI,Math.PI*1.5,!1):this.lineTo(s,t),this.lineTo(s+n-u.x,t),u.x===u.y&&u.x>0?this.arcTo(s+n,t,s+n,t+u.y,u.x):u.x>0||u.y>0?this.ellipse(s+n-u.x,t+u.y,u.x,u.y,0,Math.PI*1.5,0,!1):this.lineTo(s+n,t),this.lineTo(s+n,t+o-p.y),p.x===p.y&&p.x>0?this.arcTo(s+n,t+o,s+n-p.x,t+o,p.x):p.x>0||p.y>0?this.ellipse(s+n-p.x,t+o-p.y,p.x,p.y,0,0,Math.PI*.5,!1):this.lineTo(s+n,t+o),this.lineTo(s+m.x,t+o),m.x===m.y&&m.x>0?this.arcTo(s,t+o,s,t+o-m.y,m.x):m.x>0||m.y>0?this.ellipse(s+m.x,t+o-m.y,m.x,m.y,0,Math.PI*.5,Math.PI,!1):this.lineTo(s,t+o),this.closePath(),this.moveTo(s,t)}function D(s){if(!s)return;const t=s.prototype.clip,n=s.prototype.fill,o=s.prototype.stroke,r=s.prototype.isPointInPath;s.prototype.clip=function(...l){if(l[0]instanceof E){const c=l[0],u=l[1]!==void 0?l[1]:"nonzero";c.buildPathInCanvas(this),t.apply(this,[u]);return}const f=l[0]!==void 0?l[0]:"nonzero";t.apply(this,[f])},s.prototype.fill=function(...l){if(l[0]instanceof E){const c=l[0],u=l[1]!==void 0?l[1]:"nonzero";c.buildPathInCanvas(this),n.apply(this,[u]);return}const f=l[0]!==void 0?l[0]:"nonzero";n.apply(this,[f])},s.prototype.stroke=function(l){l&&l.buildPathInCanvas(this),o.apply(this)},s.prototype.isPointInPath=function(...l){if(l[0]instanceof E){const f=l[0],c=l[1],u=l[2],p=l[3]!==void 0?l[3]:"nonzero";return f.buildPathInCanvas(this),r.apply(this,[c,u,p])}return r.apply(this,l)}}function g(s){s&&!s.prototype.roundRect&&(s.prototype.roundRect=O)}function ee(s){s&&!s.prototype.roundRect&&(s.prototype.roundRect=O)}function te(){window&&(window.CanvasRenderingContext2D&&!window.Path2D&&(window.Path2D=E,D(window.CanvasRenderingContext2D)),ee(window.Path2D),g(window.CanvasRenderingContext2D))}te()})();
1
+ (function(){var e={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},t=/([astvzqmhlc])([^astvzqmhlc]*)/gi,n=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function r(e){let t=e.match(n);return t?t.map(Number):[]}function i(n){let i=[],a=String(n).trim();return a[0]!==`M`&&a[0]!==`m`||a.replace(t,(t,n,a)=>{let o=r(a),s=n.toLowerCase(),c=n;if(s===`m`&&o.length>2&&(i.push([c,...o.splice(0,2)]),s=`l`,c=c===`m`?`l`:`L`),o.length<e[s])return``;for(i.push([c,...o.splice(0,e[s])]);o.length>=e[s]&&o.length&&e[s];)i.push([c,...o.splice(0,e[s])]);return``}),i}function a(e,t){let n=e.x*Math.cos(t)-e.y*Math.sin(t),r=e.y*Math.cos(t)+e.x*Math.sin(t);e.x=n,e.y=r}function o(e,t,n){e.x+=t,e.y+=n}function s(e,t){e.x*=t,e.y*=t}var c=class e{#e;constructor(t){this.#e=[],t&&t instanceof e?this.#e.push(...t.#e):t&&(this.#e=i(t))}addCustomCommand(e){this.#e.push(e)}addPath(t){t&&t instanceof e&&this.#e.push(...t.#e)}moveTo(e,t){this.#e.push([`M`,e,t])}lineTo(e,t){this.#e.push([`L`,e,t])}arc(e,t,n,r,i,a){this.#e.push([`AC`,e,t,n,r,i,!!a])}arcTo(e,t,n,r,i){this.#e.push([`AT`,e,t,n,r,i])}ellipse(e,t,n,r,i,a,o,s){this.#e.push([`E`,e,t,n,r,i,a,o,!!s])}closePath(){this.#e.push([`Z`])}bezierCurveTo(e,t,n,r,i,a){this.#e.push([`C`,e,t,n,r,i,a])}quadraticCurveTo(e,t,n,r){this.#e.push([`Q`,e,t,n,r])}rect(e,t,n,r){this.#e.push([`R`,e,t,n,r])}roundRect(e,t,n,r,i){i===void 0?this.#e.push([`RR`,e,t,n,r,0]):this.#e.push([`RR`,e,t,n,r,i])}buildPathInCanvas(e){let t=0,n=0,r,i,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D=null,O=null,k=null,A=null,j=null,M=null;e.beginPath();for(let N=0;N<this.#e.length;++N){C=this.#e[N][0],C!==`S`&&C!==`s`&&C!==`C`&&C!==`c`&&(D=null,O=null),C!==`T`&&C!==`t`&&C!==`Q`&&C!==`q`&&(k=null,A=null);let P;switch(C){case`m`:case`M`:P=this.#e[N],C===`m`?(t+=P[1],n+=P[2]):(t=P[1],n=P[2]),(C===`M`||!j)&&(j={x:t,y:n}),e.moveTo(t,n);break;case`l`:P=this.#e[N],t+=P[1],n+=P[2],e.lineTo(t,n);break;case`L`:P=this.#e[N],t=P[1],n=P[2],e.lineTo(t,n);break;case`H`:P=this.#e[N],t=P[1],e.lineTo(t,n);break;case`h`:P=this.#e[N],t+=P[1],e.lineTo(t,n);break;case`V`:P=this.#e[N],n=P[1],e.lineTo(t,n);break;case`v`:P=this.#e[N],n+=P[1],e.lineTo(t,n);break;case`a`:case`A`:if(P=this.#e[N],M===null)throw Error(`This should never happen`);C===`a`?(t+=P[6],n+=P[7]):(t=P[6],n=P[7]),y=P[1],b=P[2],f=P[3]*Math.PI/180,c=!!P[4],l=!!P[5],u={x:t,y:n},d={x:(M.x-u.x)/2,y:(M.y-u.y)/2},a(d,-f),p=d.x*d.x/(y*y)+d.y*d.y/(b*b),p>1&&(p=Math.sqrt(p),y*=p,b*=p),w={x:y*d.y/b,y:-(b*d.x)/y},m=y*y*b*b,h=y*y*d.y*d.y+b*b*d.x*d.x,l===c?s(w,-Math.sqrt((m-h)/h)||0):s(w,Math.sqrt((m-h)/h)||0),i=Math.atan2((d.y-w.y)/b,(d.x-w.x)/y),r=Math.atan2(-(d.y+w.y)/b,-(d.x+w.x)/y),a(w,f),o(w,(u.x+M.x)/2,(u.y+M.y)/2),e.save(),e.translate(w.x,w.y),e.rotate(f),e.scale(y,b),e.arc(0,0,1,i,r,!l),e.restore();break;case`C`:P=this.#e[N],D=P[3],O=P[4],t=P[5],n=P[6],e.bezierCurveTo(P[1],P[2],D,O,t,n);break;case`c`:P=this.#e[N],e.bezierCurveTo(P[1]+t,P[2]+n,P[3]+t,P[4]+n,P[5]+t,P[6]+n),D=P[3]+t,O=P[4]+n,t+=P[5],n+=P[6];break;case`S`:P=this.#e[N],(D===null||O===null)&&(D=t,O=n),e.bezierCurveTo(2*t-D,2*n-O,P[1],P[2],P[3],P[4]),D=P[1],O=P[2],t=P[3],n=P[4];break;case`s`:P=this.#e[N],(D===null||O===null)&&(D=t,O=n),e.bezierCurveTo(2*t-D,2*n-O,P[1]+t,P[2]+n,P[3]+t,P[4]+n),D=P[1]+t,O=P[2]+n,t+=P[3],n+=P[4];break;case`Q`:P=this.#e[N],k=P[1],A=P[2],t=P[3],n=P[4],e.quadraticCurveTo(k,A,t,n);break;case`q`:P=this.#e[N],k=P[1]+t,A=P[2]+n,t+=P[3],n+=P[4],e.quadraticCurveTo(k,A,t,n);break;case`T`:P=this.#e[N],(k===null||A===null)&&(k=t,A=n),k=2*t-k,A=2*n-A,t=P[1],n=P[2],e.quadraticCurveTo(k,A,t,n);break;case`t`:P=this.#e[N],(k===null||A===null)&&(k=t,A=n),k=2*t-k,A=2*n-A,t+=P[1],n+=P[2],e.quadraticCurveTo(k,A,t,n);break;case`z`:case`Z`:j&&(t=j.x,n=j.y),j=null,e.closePath();break;case`AC`:P=this.#e[N],t=P[1],n=P[2],v=P[3],i=P[4],r=P[5],T=P[6],e.arc(t,n,v,i,r,T);break;case`AT`:P=this.#e[N],g=P[1],_=P[2],t=P[3],n=P[4],v=P[5],e.arcTo(g,_,t,n,v);break;case`E`:P=this.#e[N],t=P[1],n=P[2],y=P[3],b=P[4],f=P[5],i=P[6],r=P[7],T=P[8],e.save(),e.translate(t,n),e.rotate(f),e.scale(y,b),e.arc(0,0,1,i,r,T),e.restore();break;case`R`:P=this.#e[N],t=P[1],n=P[2],x=P[3],S=P[4],j={x:t,y:n},e.rect(t,n,x,S);break;case`RR`:P=this.#e[N],t=P[1],n=P[2],x=P[3],S=P[4],E=P[5],j={x:t,y:n},e.roundRect(t,n,x,S,E);break;default:throw Error(`Invalid path command: ${C}`)}M?(M.x=t,M.y=n):M={x:t,y:n}}}};function l(e){return typeof e==`object`&&!!e&&(`x`in e||`y`in e)&&(typeof e.x==`number`||typeof e.y==`number`||e.x===void 0||e.y===void 0)}function u(e){return typeof e==`number`?{x:e,y:e}:{x:typeof e.x==`number`?e.x:0,y:typeof e.y==`number`?e.y:0}}function d(e,t,n,r,i=0){if(typeof i==`number`)i=[i];else if(l(i))i=[i];else if(!Array.isArray(i))return;if(Array.isArray(i)){if(i.length===0||i.length>4)throw RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': ${i.length} radii provided. Between one and four radii are necessary.`);i.forEach(e=>{if(l(e)){let t=e;if(typeof t.x==`number`&&t.x<0)throw RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': Radius value ${t.x} is negative.`);if(typeof t.y==`number`&&t.y<0)throw RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': Radius value ${t.y} is negative.`)}else if(typeof e!=`number`)throw TypeError(`Failed to execute 'roundRect' on '${this.constructor.name}': Radius value is not a number or DOMPointInit.`);else if(typeof e==`number`&&e<0)throw RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': Radius value ${e} is negative.`)})}let a=i.map(u);if(i.length===1&&a[0].x===0&&a[0].y===0){this.rect(e,t,n,r);return}let o=n/2,s=r/2,c={x:Math.min(o,a[0].x),y:Math.min(s,a[0].y)},d=c,f=c,p=c;a.length===2&&(d={x:Math.min(o,a[1].x),y:Math.min(s,a[1].y)},p=d),a.length===3&&(d={x:Math.min(o,a[1].x),y:Math.min(s,a[1].y)},p=d,f={x:Math.min(o,a[2].x),y:Math.min(s,a[2].y)}),a.length===4&&(d={x:Math.min(o,a[1].x),y:Math.min(s,a[1].y)},f={x:Math.min(o,a[2].x),y:Math.min(s,a[2].y)},p={x:Math.min(o,a[3].x),y:Math.min(s,a[3].y)}),this.moveTo(e,t+r-p.y),c.x===c.y&&c.x>0?this.arcTo(e,t,e+c.x,t,c.x):c.x>0||c.y>0?this.ellipse(e+c.x,t+c.y,c.x,c.y,0,Math.PI,Math.PI*1.5,!1):this.lineTo(e,t),this.lineTo(e+n-d.x,t),d.x===d.y&&d.x>0?this.arcTo(e+n,t,e+n,t+d.y,d.x):d.x>0||d.y>0?this.ellipse(e+n-d.x,t+d.y,d.x,d.y,0,Math.PI*1.5,0,!1):this.lineTo(e+n,t),this.lineTo(e+n,t+r-f.y),f.x===f.y&&f.x>0?this.arcTo(e+n,t+r,e+n-f.x,t+r,f.x):f.x>0||f.y>0?this.ellipse(e+n-f.x,t+r-f.y,f.x,f.y,0,0,Math.PI*.5,!1):this.lineTo(e+n,t+r),this.lineTo(e+p.x,t+r),p.x===p.y&&p.x>0?this.arcTo(e,t+r,e,t+r-p.y,p.x):p.x>0||p.y>0?this.ellipse(e+p.x,t+r-p.y,p.x,p.y,0,Math.PI*.5,Math.PI,!1):this.lineTo(e,t+r),this.closePath(),this.moveTo(e,t)}function f(e){if(!e)return;let t=e.prototype.clip,n=e.prototype.fill,r=e.prototype.stroke,i=e.prototype.isPointInPath;e.prototype.clip=function(...e){if(e[0]instanceof c){let n=e[0],r=e[1]===void 0?`nonzero`:e[1];n.buildPathInCanvas(this),t.apply(this,[r]);return}let n=e[0]===void 0?`nonzero`:e[0];t.apply(this,[n])},e.prototype.fill=function(...e){if(e[0]instanceof c){let t=e[0],r=e[1]===void 0?`nonzero`:e[1];t.buildPathInCanvas(this),n.apply(this,[r]);return}let t=e[0]===void 0?`nonzero`:e[0];n.apply(this,[t])},e.prototype.stroke=function(e){e&&e.buildPathInCanvas(this),r.apply(this)},e.prototype.isPointInPath=function(...e){if(e[0]instanceof c){let t=e[0],n=e[1],r=e[2],a=e[3]===void 0?`nonzero`:e[3];return t.buildPathInCanvas(this),i.apply(this,[n,r,a])}return i.apply(this,e)}}function p(e){e&&!e.prototype.roundRect&&(e.prototype.roundRect=d)}function m(e){e&&!e.prototype.roundRect&&(e.prototype.roundRect=d)}function h(){window&&(window.CanvasRenderingContext2D&&!window.Path2D&&(window.Path2D=c,f(window.CanvasRenderingContext2D)),m(window.Path2D),p(window.CanvasRenderingContext2D))}h()})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "path2d-polyfill",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
4
4
  "description": "Polyfills Path2D api for canvas rendering",
5
5
  "keywords": [
6
6
  "Path2D",
@@ -33,18 +33,16 @@
33
33
  "not dead"
34
34
  ],
35
35
  "dependencies": {
36
- "path2d": "^0.3.0"
36
+ "path2d": "^0.3.3"
37
37
  },
38
38
  "devDependencies": {
39
- "@babel/core": "^7.27.4",
40
- "@babel/preset-env": "^7.27.2",
41
- "@qlik/tsconfig": "^0.3.1",
42
- "@rollup/plugin-babel": "^6.0.4",
43
- "@vitest/coverage-v8": "^3.2.4",
44
- "jsdom": "^26.1.0",
45
- "typescript": "^5.8.3",
46
- "vite": "^6.3.5",
47
- "vitest": "^3.2.4"
39
+ "@babel/core": "^7.29.7",
40
+ "@babel/preset-env": "^7.29.7",
41
+ "@qlik/tsconfig": "^1.0.0",
42
+ "@rollup/plugin-babel": "^7.1.0",
43
+ "@vitest/coverage-v8": "^4.1.9",
44
+ "jsdom": "^29.1.1",
45
+ "vite": "^8.0.16"
48
46
  },
49
47
  "publishConfig": {
50
48
  "access": "public"