@overpunch/threadtext 0.4.6 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +218 -208
- package/dist/core.cjs +7 -0
- package/dist/core.d.ts +142 -0
- package/dist/core.js +778 -0
- package/dist/index.cjs +1 -7
- package/dist/index.d.ts +12 -16
- package/dist/index.js +74 -736
- package/dist/threadtext.webflow.min.js +7 -7
- package/package.json +93 -88
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var ThreadText=(function(Rt){"use strict";const Jt={bg:"tt-bg",fx:"tt-fx",caret:"tt-caret"};function Z(u,o){let n=Math.imul(u|0,374761393)+Math.imul(o|0,668265263)|0;return n=Math.imul(n^n>>>13,1274126177),((n^n>>>16)>>>0)/4294967295}function Qt(u,o){const n=Math.floor(u),s=Math.floor(o),l=u-n,v=o-s,x=l*l*(3-2*l),p=v*v*(3-2*v),I=Z(n,s),j=Z(n+1,s),b=Z(n,s+1),w=Z(n+1,s+1);return I+(j-I)*x+(b-I)*p+(I-j-b+w)*x*p}function Zt(u,o,n,s,l){let x=0;s[0]=0,l[0]=-1e20,l[1]=1e20;for(let p=1;p<o;p++){let I=(u[p]+p*p-(u[s[x]]+s[x]*s[x]))/(2*p-2*s[x]);for(;I<=l[x];)x--,I=(u[p]+p*p-(u[s[x]]+s[x]*s[x]))/(2*p-2*s[x]);x++,s[x]=p,l[x]=I,l[x+1]=1e20}x=0;for(let p=0;p<o;p++){for(;l[x+1]<p;)x++;n[p]=(p-s[x])*(p-s[x])+u[s[x]]}}function he(u,o,n){const l=new Float64Array(o*n);for(let w=0;w<o*n;w++)l[w]=u[w]?1e20:0;const v=Math.max(o,n),x=new Float64Array(v),p=new Float64Array(v),I=new Int32Array(v),j=new Float64Array(v+1);for(let w=0;w<o;w++){for(let M=0;M<n;M++)x[M]=l[M*o+w];Zt(x,n,p,I,j);for(let M=0;M<n;M++)l[M*o+w]=p[M]}for(let w=0;w<n;w++){for(let M=0;M<o;M++)x[M]=l[w*o+M];Zt(x,o,p,I,j);for(let M=0;M<o;M++)l[w*o+M]=p[M]}const b=new Float32Array(o*n);for(let w=0;w<o*n;w++)b[w]=Math.sqrt(l[w]);return b}function Ht(u,o,n,s,l){let v=Float32Array.from(u);const x=new Float32Array(o*n),p=1/(2*s+1),I=(j,b)=>j<0?0:j>b?b:j;for(let j=0;j<l;j++){for(let b=0;b<n;b++){const w=b*o;let M=0;for(let N=-s;N<=s;N++)M+=v[w+I(N,o-1)];for(let N=0;N<o;N++)x[w+N]=M*p,M+=v[w+I(N+s+1,o-1)]-v[w+I(N-s,o-1)]}for(let b=0;b<o;b++){let w=0;for(let M=-s;M<=s;M++)w+=x[I(M,n-1)*o+b];for(let M=0;M<n;M++)v[M*o+b]=w*p,w+=x[I(M+s+1,n-1)*o+b]-x[I(M-s,n-1)*o+b]}}return v}function Wt(u,o){if(!u)return o;const n=u.trim();if(n[0]==="#"){let l=n.slice(1);if(l.length===3&&(l=l[0]+l[0]+l[1]+l[1]+l[2]+l[2]),l.length>=6){const v=parseInt(l.slice(0,2),16),x=parseInt(l.slice(2,4),16),p=parseInt(l.slice(4,6),16);if(!Number.isNaN(v)&&!Number.isNaN(x)&&!Number.isNaN(p))return[v,x,p]}return o}const s=n.match(/rgba?\(([^)]+)\)/i);if(s){const l=s[1].split(",").map(v=>parseFloat(v));if(l.length>=3&&l.slice(0,3).every(v=>!Number.isNaN(v)))return[Math.round(l[0]),Math.round(l[1]),Math.round(l[2])]}return o}function H(u){return u<0?0:u>255?255:Math.round(u)}function Nt(u,o,n){return u<o?o:u>n?n:u}function ge(u){return(u.split(",")[0]||"serif").trim().replace(/^["']|["']$/g,"")}function te(u,o,n){const s=new Uint8Array(o*n);for(let A=0;A<n;A++)for(let L=0;L<o;L++){const E=A*o+L,U=u[E*4+3]/255,q=Qt(L*.5,A*.5)*.22+Qt(L*1.8,A*1.8)*.1;s[E]=U>.5+(q-.16)?1:0}const l=he(s,o,n),v=new Float32Array(o*n);for(let A=1;A<n-1;A++)for(let L=1;L<o-1;L++){const E=A*o+L;v[E]=(l[E]*4+l[E-1]+l[E+1]+l[E-o]+l[E+o])/8}const x=new Float32Array(o*n),p=new Float32Array(o*n),I=new Float32Array(o*n),j=new Float32Array(o*n);for(let A=1;A<n-1;A++)for(let L=1;L<o-1;L++){const E=A*o+L;if(!s[E])continue;const U=(v[E+1]-v[E-1])*.5,q=(v[E+o]-v[E-o])*.5;I[E]=U,j[E]=q,x[E]=U*U-q*q,p[E]=2*U*q}const b=Math.max(7,Math.round(n*.05)),w=Ht(x,o,n,b,2),M=Ht(p,o,n,b,2),N=new Float32Array(o*n),lt=new Float32Array(o*n);for(let A=0;A<o*n;A++){if(!s[A])continue;const L=.5*Math.atan2(M[A],w[A]);N[A]=Math.cos(L),lt[A]=Math.sin(L)}const vt=Math.max(9,n*.04),z=new Float32Array(o*n),xt=-.45,St=-.62,ct=.64;for(let A=1;A<n-1;A++)for(let L=1;L<o-1;L++){const E=A*o+L;if(!s[E])continue;let U=I[E],q=j[E];const ft=Math.hypot(U,q)||1;U/=ft,q/=ft;const Pt=v[E],W=(1-Math.min(Pt/vt,1))*1.25;let bt=-U*W,tt=-q*W;const Y=1.5,X=Math.hypot(bt,tt,Y);bt/=X,tt/=X;let dt=bt*xt+tt*St+Y/X*ct;dt<0&&(dt=0);const $t=Math.min(1,.45+.55*Math.min(Pt/(vt*.7),1));z[E]=Math.min(1.12,(.5+.75*dt)*$t)}return{mask:s,ex:N,ey:lt,shade:z}}function Ne(u,o){if(typeof window>"u"||typeof document>"u"||!u)return{setText(){},replay(){},resize(){},update(){},focus(){},destroy(){},get text(){return o.text??""}};let n=o.text??"",s=o.font??"Georgia, serif",l=Nt(o.weight??680,1,1e3),v=Nt(o.fill??.9,.05,1),x=o.align==="left"||o.align==="right"?o.align:"center",p=Math.max(1,o.sewRate??110),I=o.sewStyle==="hand"?"hand":"machine";const j=["satin","cross","chain","running"];let b=j.includes(o.stitchMode??"")?o.stitchMode:"satin",w=o.sheen??!0,M=o.animate??!0,N=o.editable??!1,lt=o.pitch;const vt=["solid","twotone","gradient"];let z=vt.includes(o.colorMode??"")?o.colorMode:"solid",xt=o.threadColor??"#fffbf3",St=o.threadColor2??xt,ct=o.backstitch??!1,A=o.outlineColor,L=o.axes,E=o.onTextChange,U=ge(s);function q(){if(!L)return"";const t=[];for(const e in L){const i=L[e];typeof i=="number"&&isFinite(i)&&t.push(`"${e}" ${i}`)}return t.join(", ")}function ft(t){"fontVariationSettings"in t&&(t.fontVariationSettings=q()||"normal")}const Pt=o.reducedMotion??!!(window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches),W=t=>({peak:t,mid:[t[0]*.585,t[1]*.585,t[2]*.585],end:[t[0]*.47,t[1]*.47,t[2]*.47]}),bt=(t,e,i)=>[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i],tt=6;let Y=[255,251,243],X=[],dt=W([0,0,0]);function $t(){const t=Wt(xt,[255,251,243]),e=Wt(St,t);if(z==="twotone")X=[W(t),W(e)];else if(z==="gradient"){X=[];for(let i=0;i<tt;i++)X.push(W(bt(t,e,i/(tt-1))))}else X=[W(t)];Y=X[0].peak,dt=W(A?Wt(A,[0,0,0]):[t[0]*.32,t[1]*.32,t[2]*.32])}$t();const Tt=[];let D,P;u instanceof HTMLCanvasElement?(D=u,P=u.parentElement??u):(P=u,D=document.createElement("canvas"),Tt.push(D),P.appendChild(D)),D.classList.add(Jt.bg);const ut=document.createElement("canvas");Tt.push(ut),ut.classList.add(Jt.fx),P.appendChild(ut),getComputedStyle(P).position==="static"&&(P.style.position="relative"),D.style.display="block",D.style.width="100%",Object.assign(ut.style,{position:"absolute",inset:"0",width:"100%",pointerEvents:"none",mixBlendMode:"screen"});let T=null,$=null,jt=!1,S=0,F=0,ht=0,ne=0,J=4,At=[],pt=0,Mt=0,oe=[],ye=0,xe=-1,pe="",Me=-1,we=-1,K=new Uint8Array(0),Bt=new Float32Array(0),ie=new Float32Array(0),re=new Float32Array(0),ot=null,wt=null,Dt=null,Et=[],it=[],kt=[],gt=3;const R={rows:[],idx:0,acc:0,rate:0,on:!1},et={x:0,y:0,set:!1};let mt=!0,ae=0,Lt=!1,Ft=0,_=!1,rt=!1,Q=null,It="",_t=!1,se=0,le=!1,V;function Be(){const t=P.getBoundingClientRect(),e=Math.max(1,Math.round(t.width||Math.min(window.innerWidth*.95,1240))),i=n||"Ag",r=D.getContext("2d");r&&(r.textBaseline="middle");let c=100;r&&(r.font=`${l} 100px ${s}`,ft(r),c=r.measureText(i).width||100);const a=Math.max(8,100*(e*v)/c);let f=a*.62,C=a*.62,d=e*v;if(r){r.font=`${l} ${a}px ${s}`,ft(r);const y=r.measureText(i);d=y.width||d,y.actualBoundingBoxAscent>0&&(f=y.actualBoundingBoxAscent),y.actualBoundingBoxDescent>0&&(C=y.actualBoundingBoxDescent)}const g=Math.max(1,Math.round(2*Math.max(f,C)*1.1));let m=Math.min(window.devicePixelRatio||1,1.7);for(;e*m*g*m>9e5&&m>.4;)m-=.1;S=Math.max(1,Math.round(e*m)),F=Math.max(1,Math.round(g*m)),ht=Math.max(4,Math.round(a*m));const h=d*m,k=Math.max(2,Math.round(ht*.08));ne=Math.round(x==="left"?k:x==="right"?S-h-k:S/2-h/2);for(const y of[D,ut])y.width=S,y.height=F,y.style.height=g+"px";P.style.height=g+"px",J=lt??Math.max(3,F*.0095)}function De(){wt&&Me===S&&we===F||(wt=document.createElement("canvas"),wt.width=S,wt.height=F,Dt=wt.getContext("2d",{willReadFrequently:!0}),Me=S,we=F)}function Ce(){return X.map(t=>t.peak.join(",")).join(";")+"|"+b+"|"+z+(ct?"|bs"+dt.peak.join(","):"")}function ve(t,e){const i=Math.max(7,J*2.5),r=Math.max(3.2,J*1.3),c=[];for(let a=0;a<20;a++){const f=.34+a/19*.82,C=document.createElement("canvas");C.width=pt,C.height=Mt;const d=C.getContext("2d");if(!d){c.push(C);continue}const g=pt/2,m=Mt/2,h=(y,O)=>`rgba(${H(y[0]*f)},${H(y[1]*f)},${H(y[2]*f)},${O})`,k=(y,O,at,nt)=>{d.save(),d.translate(g,m),d.rotate(at);const G=d.createLinearGradient(0,-O/2,0,O/2);G.addColorStop(0,h(t.end,0)),G.addColorStop(.16,h(t.mid,1)),G.addColorStop(.5,h(t.peak,1)),G.addColorStop(.84,h(t.mid,1)),G.addColorStop(1,h(t.end,0)),d.fillStyle=G;const B=O/2;if(d.beginPath(),d.moveTo(-y/2+B,-B),d.lineTo(y/2-B,-B),d.arc(y/2-B,0,B,-Math.PI/2,Math.PI/2),d.lineTo(-y/2+B,B),d.arc(-y/2+B,0,B,Math.PI/2,-Math.PI/2),d.closePath(),d.fill(),nt){d.globalCompositeOperation="destination-in";const st=d.createLinearGradient(-y/2,0,y/2,0);st.addColorStop(0,"rgba(0,0,0,0)"),st.addColorStop(.22,"rgba(0,0,0,1)"),st.addColorStop(.78,"rgba(0,0,0,1)"),st.addColorStop(1,"rgba(0,0,0,0)"),d.fillStyle=st,d.fillRect(-y/2-1,-O/2-1,y+2,O+2),d.globalCompositeOperation="source-over"}d.restore()};if(e==="cross")k(i*.92,r*.82,Math.PI/4,!1),k(i*.92,r*.82,-Math.PI/4,!1);else if(e==="chain"){d.save(),d.translate(g,m);const y=d.createLinearGradient(0,-r,0,r);y.addColorStop(0,h(t.mid,1)),y.addColorStop(.5,h(t.peak,1)),y.addColorStop(1,h(t.mid,1)),d.strokeStyle=y,d.lineWidth=Math.max(1.6,r*.7),d.lineCap="round",d.beginPath(),d.ellipse(0,0,i*.34,r*1.05,0,0,Math.PI*2),d.stroke(),d.restore()}else e==="running"?k(i*.5,r,0,!1):k(i,r,0,!0);c.push(C)}return c}function ce(){const t=Math.max(7,J*2.5),e=Math.max(3.2,J*1.3);b==="cross"||b==="chain"?pt=Mt=Math.ceil(t)+2:(pt=Math.ceil(t)+2,Mt=Math.ceil(e)+2),ye=b==="chain"||b==="running"?Math.PI/2:0,At=[];for(const i of X)for(const r of ve(i,b))At.push(r);oe=ct?ve(dt,"running"):[],xe=J,pe=Ce()}function _e(){At.length&&xe===J&&pe===Ce()||ce()}function Se(){if(!Dt)return null;const t=Dt;return t.clearRect(0,0,S,F),t.fillStyle="#fff",t.textAlign="left",t.textBaseline="middle",t.font=`${l} ${ht}px ${s}`,ft(t),t.fillText(n,ne,F*.5),t.getImageData(0,0,S,F).data}function fe(t){K=t.mask,ie=t.ex,re=t.ey,Bt=t.shade,ot=document.createElement("canvas"),ot.width=S,ot.height=F;const e=ot.getContext("2d");if(e){const i=e.createImageData(S,F);for(let r=0;r<S*F;r++)K[r]&&(i.data[r*4]=255,i.data[r*4+1]=255,i.data[r*4+2]=255,i.data[r*4+3]=255);e.putImageData(i,0,0)}}function be(){const t=Math.max(1.6,J*.6);gt=t;const e=[],i=[];let r=1/0,c=-1/0;for(let a=0;a<F;a+=t)for(let f=0;f<S;f+=t){const C=(Z(Math.floor(f),Math.floor(a))-.5)*t*.9,d=(Z(Math.floor(a),Math.floor(f))-.5)*t*.9,g=Math.round(f+C),m=Math.round(a+d);if(g<1||m<1||g>=S-1||m>=F-1)continue;const h=m*S+g;if(!K[h])continue;const k=Math.atan2(re[h],ie[h]),y=.86+Z(g*7,m*13)*.18;let O=Bt[h]*y;O=O<0?0:O>1.12?1.12:O,e.push({x:g,y:m,ang:k,idx:Math.min(19,Math.max(0,Math.round(O/1.12*19)))}),g<r&&(r=g),g>c&&(c=g)}if(z==="twotone")if(b==="satin"){const a=Math.max(4,J*1.6);for(const f of e){const C=-Math.sin(f.ang)*f.x+Math.cos(f.ang)*f.y;f.pal=Math.floor(C/a)&1}}else for(const a of e)a.pal=Math.round(a.x/t)+Math.round(a.y/t)&1;else if(z==="gradient"){const a=Math.max(1,c-r);for(const f of e){const C=(f.x-r)/a*(tt-1),d=Math.min(tt-1,Math.max(0,Math.floor(C)));f.pal=d,d<tt-1&&Z(f.x*3+1,f.y*5+2)<C-d&&i.push({x:f.x,y:f.y,ang:f.ang,idx:f.idx,pal:d+1})}}Et=e,kt=i,Ue()}function Ue(){if(it=[],!ct||!K.length)return;const t=Math.max(3,J*1.5),e=Math.max(1,Math.ceil(S/t)),i=new Set,r=(c,a)=>K[a*S+c]?1:0;for(let c=1;c<F-1;c++)for(let a=1;a<S-1;a++){const f=c*S+a;if(!K[f]||K[f-1]&&K[f+1]&&K[f-S]&&K[f+S])continue;const C=Math.floor(c/t)*e+Math.floor(a/t);if(i.has(C))continue;i.add(C);const d=r(a+1,c-1)+2*r(a+1,c)+r(a+1,c+1)-(r(a-1,c-1)+2*r(a-1,c)+r(a-1,c+1)),g=r(a-1,c+1)+2*r(a,c+1)+r(a+1,c+1)-(r(a-1,c-1)+2*r(a,c-1)+r(a+1,c-1)),m=Math.atan2(d,-g);let h=Bt[f];h=h<0?0:h>1.12?1.12:h,it.push({x:a,y:c,ang:m,idx:Math.min(19,Math.max(8,Math.round(h/1.12*19))),outline:1})}}function Ut(t,e){t.save(),t.translate(e.x,e.y),e.outline?(t.rotate(e.ang),t.drawImage(oe[e.idx],-pt/2,-Mt/2)):(t.rotate(e.ang+ye),t.drawImage(At[(e.pal||0)*20+e.idx],-pt/2,-Mt/2)),t.restore()}function Gt(){const t=D.getContext("2d");if(t){for(const e of Et)Ut(t,e);for(const e of kt)Ut(t,e);for(const e of it)Ut(t,e)}}function qt(){const t=D.getContext("2d");t&&t.clearRect(0,0,S,F)}function Te(t){if(!t.length)return[];const e=Math.max(4,gt*1.5),i=new Map,r=(g,m)=>g+","+m;t.forEach((g,m)=>{const h=r(Math.floor(g.x/e),Math.floor(g.y/e));let k=i.get(h);k||i.set(h,k=[]),k.push(m)});const c=gt*1.8*(gt*1.8);function a(g){const m=t[g],h=Math.floor(m.x/e),k=Math.floor(m.y/e),y=[];for(let O=-1;O<=1;O++)for(let at=-1;at<=1;at++){const nt=i.get(r(h+O,k+at));if(nt)for(const G of nt){if(G===g)continue;const B=t[G].x-m.x,st=t[G].y-m.y;B*B+st*st<=c&&y.push(G)}}return y}const f=new Uint8Array(t.length),C=[],d=t.map((g,m)=>m).sort((g,m)=>t[g].x+t[g].y-(t[m].x+t[m].y));for(const g of d){if(f[g])continue;let m=[g];for(f[g]=1;m.length;){C.push(m.map(k=>t[k]));const h=[];for(const k of m)for(const y of a(k))f[y]||(f[y]=1,h.push(y));m=h}}return C}function Ge(t){const e=Math.max(4,gt*1.5),i=new Map,r=(d,g)=>d+","+g;t.forEach((d,g)=>{const m=r(Math.floor(d.x/e),Math.floor(d.y/e));let h=i.get(m);h||i.set(m,h=[]),h.push(g)});const c=gt*1.8*(gt*1.8),a=d=>{const g=t[d],m=Math.floor(g.x/e),h=Math.floor(g.y/e),k=[];for(let y=-1;y<=1;y++)for(let O=-1;O<=1;O++){const at=i.get(r(m+y,h+O));if(at)for(const nt of at){if(nt===d)continue;const G=t[nt].x-g.x,B=t[nt].y-g.y;G*G+B*B<=c&&k.push(nt)}}return k},f=new Uint8Array(t.length),C=[];for(let d=0;d<t.length;d++){if(f[d])continue;const g=[];let m=[d];for(f[d]=1;m.length;){const h=[];for(const k of m){g.push(t[k]);for(const y of a(k))f[y]||(f[y]=1,h.push(y))}m=h}C.push(g)}return C}function qe(t){if(!t.length)return[];const e=a=>{let f=1/0;for(const C of a)C.x<f&&(f=C.x);return f},i=a=>{let f=0;for(const C of a)f+=C.y;return f/a.length},r=Ge(t).sort((a,f)=>e(a)-e(f)),c=[];for(const a of r){const f=Te(a);let C=1;for(const h of f)h.length>C&&(C=h.length);const d=Math.max(2,C*.45),g=f.filter(h=>h.length>=d).sort((h,k)=>i(h)-i(k)),m=f.filter(h=>h.length<d).sort((h,k)=>i(h)-i(k));for(const h of g)c.push(h);for(const h of m)c.push(h)}return c}function Xe(){if(qt(),Pt||!M){Gt(),R.on=!1;return}const t=I==="hand"?qe:Te;let e;if(z==="gradient"&&X.length>1){e=[];const i=new Map;for(const r of Et){const c=r.pal||0,a=i.get(c);a?a.push(r):i.set(c,[r])}for(const r of[...i.keys()].sort((c,a)=>c-a))for(const c of t(i.get(r)))e.push(c)}else e=t(Et);if(kt.length)for(const i of t(kt))e.push(i);if(it.length){const r=Math.ceil(it.length/24);for(let c=0;c<it.length;c+=r)e.push(it.slice(c,c+r))}R.rows=e,R.idx=0,R.acc=0,R.rate=p,R.on=R.rows.length>0}function ze(t){const e=D.getContext("2d");if(e)for(t>R.rows.length&&(t=R.rows.length);R.idx<t;){const i=R.rows[R.idx++];for(const r of i)Ut(e,r)}}function Ke(t,e){const i=ut.getContext("2d");if(!i||(i.clearRect(0,0,S,F),!w||!ot))return;const r=S*.32,c=i.createRadialGradient(t,e,0,t,e,r);c.addColorStop(0,"rgba(255,250,238,0.18)"),c.addColorStop(.5,"rgba(255,250,238,0.055)"),c.addColorStop(1,"rgba(255,250,238,0)"),i.fillStyle=c,i.fillRect(0,0,S,F),i.globalCompositeOperation="destination-in",i.drawImage(ot,0,0),i.globalCompositeOperation="source-over"}function Ve(){$||!N||($=document.createElement("span"),$.className=Jt.caret,$.setAttribute("aria-hidden","true"),Object.assign($.style,{position:"absolute",pointerEvents:"none",borderRadius:"1px",opacity:"0",background:`rgb(${H(Y[0])},${H(Y[1])},${H(Y[2])})`}),P.appendChild($),Tt.push($))}function Xt(){if(!N||!$)return;const t=D.getContext("2d");if(!t)return;t.font=`${l} ${ht}px ${s}`,ft(t);const e=t.measureText(n).width,i=(D.clientWidth||S)/S,r=ht*.7;$.style.left=(ne+e+ht*.05)*i+"px",$.style.top=.5*(D.clientHeight||F)-r*i/2+"px",$.style.height=r*i+"px",$.style.width=Math.max(2,Math.round(ht*.02*i))+"px",$.style.background=`rgb(${H(Y[0])},${H(Y[1])},${H(Y[2])})`}function yt(){_||Lt||(Lt=!0,Ft=0,ae=requestAnimationFrame(Ae))}function Ae(t){if(_){Lt=!1;return}Ft||(Ft=t);const e=Math.min(.25,(t-Ft)/1e3);Ft=t,R.on&&(R.acc+=R.rate*e,ze(R.acc),R.idx>=R.rows.length&&(R.on=!1)),mt&&ot&&(Ke(et.set?et.x:S*.5,et.set?et.y:F*.45),mt=!1);const i=N&&jt;if($&&($.style.opacity=i&&Math.floor(t/530)%2===0?"1":"0"),!R.on&&!mt&&!i){Lt=!1;return}ae=requestAnimationFrame(Ae)}function zt(t){const e=P.getBoundingClientRect();et.x=(t.clientX-e.left)/(e.width||1)*S,et.y=(t.clientY-e.top)/(e.height||1)*F,et.set=!0,mt=!0,yt()}function Kt(){et.set=!1,mt=!0,yt()}function Ye(){T&&Le(T.value,!0)}function Je(t){t.key==="Enter"&&(t.preventDefault(),ue.replay())}function Qe(){jt=!0,yt()}function Ze(){jt=!1,$&&($.style.opacity="0")}function Ee(t){t===N&&T||(N=t,t?(T||(T=document.createElement("input"),T.type="text",T.value=n,T.maxLength=64,T.setAttribute("aria-label","Embroidered text — type to change it"),T.setAttribute("autocomplete","off"),T.setAttribute("autocapitalize","off"),T.spellcheck=!1,Object.assign(T.style,{position:"absolute",inset:"0",width:"100%",height:"100%",margin:"0",padding:"0",border:"0",outline:"none",background:"transparent",color:"transparent",caretColor:"transparent",font:"inherit",textAlign:"center",cursor:"text"}),T.addEventListener("input",Ye),T.addEventListener("keydown",Je),T.addEventListener("focus",Qe),T.addEventListener("blur",Ze),P.appendChild(T),Tt.push(T)),Ve(),Xt()):(T&&(T.remove(),T=null),jt=!1,$&&($.style.opacity="0")))}function He(t){if(t!==w)if(w=t,t)P.addEventListener("pointermove",zt,{passive:!0}),P.addEventListener("pointerleave",Kt,{passive:!0}),et.set=!1,mt=!0,yt();else{P.removeEventListener("pointermove",zt),P.removeEventListener("pointerleave",Kt);const e=ut.getContext("2d");e&&e.clearRect(0,0,S,F)}}function Vt(t){be(),t?Xe():(qt(),Gt(),R.on=!1),T&&T.value!==n&&(T.value=n),Xt(),mt=!0,yt()}function Ct(t){Be(),De(),_e();const e=Se();if(!e){Vt(t);return}if(Q&&_t){const i=++se;le=t,V&&clearTimeout(V),V=setTimeout(()=>ke(i),800);try{Q.postMessage({id:i,W:S,H:F,alpha:e},[e.buffer])}catch{ke(i)}return}fe(te(e,S,F)),Vt(t)}function ke(t){if(t!==se||_)return;V&&(clearTimeout(V),V=void 0),_t=!1;const e=Se();e&&(fe(te(e,S,F)),Vt(le))}function Le(t,e){t=t??"",!(t===n&&rt)&&(n=t,rt&&(Ct(!1),e&&E&&E(n)))}const Yt=new Set;function Fe(t,e,i){const r=`${e} 200px ${t}`;let c=!1;try{c=!!document.fonts&&document.fonts.check(r)}catch{c=!0}if(!document.fonts||c){i();return}let a=!1,f;const C=()=>{a||(a=!0,clearTimeout(f),Yt.delete(f),_||i())};document.fonts.load(r,n).then(()=>document.fonts.ready).then(C,C),f=setTimeout(C,1500),Yt.add(f)}function We(t){const e=t.data;if(e&&e.type==="pong"){_t=!0;return}!e||_||e.id!==se||(V&&(clearTimeout(V),V=void 0),fe({mask:e.mask,ex:e.ex,ey:e.ey,shade:e.shade}),Vt(le))}function tn(){if(!(typeof Worker>"u"||typeof Blob>"u"||typeof URL>"u"||!URL.createObjectURL))try{const t=`${Z}
|
|
2
|
-
${
|
|
3
|
-
${
|
|
4
|
-
${
|
|
5
|
-
${
|
|
6
|
-
var __cg=${
|
|
7
|
-
self.onmessage=function(ev){var d=ev.data;if(d&&d.type==='ping'){try{__cg(new Uint8ClampedArray(4),1,1);self.postMessage({type:'pong'})}catch(e){}return}var g=__cg(d.alpha,d.W,d.H);self.postMessage({id:d.id,mask:g.mask,ex:g.ex,ey:g.ey,shade:g.shade},[g.mask.buffer,g.ex.buffer,g.ey.buffer,g.shade.buffer])};`;
|
|
1
|
+
var ThreadText=(function(Ft){"use strict";const kt={bg:"tt-bg",fx:"tt-fx",text:"tt-text",caret:"tt-caret"};function ot(l,o){let n=Math.imul(l|0,374761393)+Math.imul(o|0,668265263)|0;return n=Math.imul(n^n>>>13,1274126177),((n^n>>>16)>>>0)/4294967295}function re(l,o){const n=Math.floor(l),a=Math.floor(o),s=l-n,M=o-a,p=s*s*(3-2*s),C=M*M*(3-2*M),k=ot(n,a),j=ot(n+1,a),R=ot(n,a+1),x=ot(n+1,a+1);return k+(j-k)*p+(R-k)*C+(k-j-R+x)*p*C}function se(l,o,n,a,s){let p=0;a[0]=0,s[0]=-1e20,s[1]=1e20;for(let C=1;C<o;C++){let k=(l[C]+C*C-(l[a[p]]+a[p]*a[p]))/(2*C-2*a[p]);for(;k<=s[p];)p--,k=(l[C]+C*C-(l[a[p]]+a[p]*a[p]))/(2*C-2*a[p]);p++,a[p]=C,s[p]=k,s[p+1]=1e20}p=0;for(let C=0;C<o;C++){for(;s[p+1]<C;)p++;n[C]=(C-a[p])*(C-a[p])+l[a[p]]}}function Ee(l,o,n){const s=new Float64Array(o*n);for(let x=0;x<o*n;x++)s[x]=l[x]?1e20:0;const M=Math.max(o,n),p=new Float64Array(M),C=new Float64Array(M),k=new Int32Array(M),j=new Float64Array(M+1);for(let x=0;x<o;x++){for(let w=0;w<n;w++)p[w]=s[w*o+x];se(p,n,C,k,j);for(let w=0;w<n;w++)s[w*o+x]=C[w]}for(let x=0;x<n;x++){for(let w=0;w<o;w++)p[w]=s[x*o+w];se(p,o,C,k,j);for(let w=0;w<o;w++)s[x*o+w]=C[w]}const R=new Float32Array(o*n);for(let x=0;x<o*n;x++)R[x]=Math.sqrt(s[x]);return R}function ae(l,o,n,a,s){let M=Float32Array.from(l);const p=new Float32Array(o*n),C=1/(2*a+1),k=(j,R)=>j<0?0:j>R?R:j;for(let j=0;j<s;j++){for(let R=0;R<n;R++){const x=R*o;let w=0;for(let z=-a;z<=a;z++)w+=M[x+k(z,o-1)];for(let z=0;z<o;z++)p[x+z]=w*C,w+=M[x+k(z+a+1,o-1)]-M[x+k(z-a,o-1)]}for(let R=0;R<o;R++){let x=0;for(let w=-a;w<=a;w++)x+=p[k(w,n-1)*o+R];for(let w=0;w<n;w++)M[w*o+R]=x*C,x+=p[k(w+a+1,n-1)*o+R]-p[k(w-a,n-1)*o+R]}}return M}function ce(l,o){if(!l)return o;const n=l.trim();if(n[0]==="#"){let s=n.slice(1);if(s.length===3&&(s=s[0]+s[0]+s[1]+s[1]+s[2]+s[2]),s.length>=6){const M=parseInt(s.slice(0,2),16),p=parseInt(s.slice(2,4),16),C=parseInt(s.slice(4,6),16);if(!Number.isNaN(M)&&!Number.isNaN(p)&&!Number.isNaN(C))return[M,p,C]}return o}const a=n.match(/rgba?\(([^)]+)\)/i);if(a){const s=a[1].split(",").map(M=>parseFloat(M));if(s.length>=3&&s.slice(0,3).every(M=>!Number.isNaN(M)))return[Math.round(s[0]),Math.round(s[1]),Math.round(s[2])]}return o}function it(l){return l<0?0:l>255?255:Math.round(l)}function qt(l,o,n){return l<o?o:l>n?n:l}function Rt(l,o){return typeof l=="number"&&Number.isFinite(l)?l:o}function le(l){const o="Georgia, serif";if(typeof l!="string"||!l.trim())return o;try{const n=document.createElement("canvas").getContext("2d");if(!n)return l;if(n.font="13px serif",n.font=`100px ${l}`,/13px/.test(n.font))return console.warn(`[threadText] the font ${JSON.stringify(l)} isn't a valid font-family list; using ${o}`),o}catch{}return l}const Ae="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0";function Le(l){return(l.split(",")[0]||"serif").trim().replace(/^["']|["']$/g,"")}function fe(l,o,n){const a=new Uint8Array(o*n);for(let A=0;A<n;A++)for(let F=0;F<o;F++){const E=A*o+F,q=l[E*4+3]/255,K=re(F*.5,A*.5)*.22+re(F*1.8,A*1.8)*.1;a[E]=q>.5+(K-.16)?1:0}const s=Ee(a,o,n),M=new Float32Array(o*n);for(let A=1;A<n-1;A++)for(let F=1;F<o-1;F++){const E=A*o+F;M[E]=(s[E]*4+s[E-1]+s[E+1]+s[E-o]+s[E+o])/8}const p=new Float32Array(o*n),C=new Float32Array(o*n),k=new Float32Array(o*n),j=new Float32Array(o*n);for(let A=1;A<n-1;A++)for(let F=1;F<o-1;F++){const E=A*o+F;if(!a[E])continue;const q=(M[E+1]-M[E-1])*.5,K=(M[E+o]-M[E-o])*.5;k[E]=q,j[E]=K,p[E]=q*q-K*K,C[E]=2*q*K}const R=Math.max(7,Math.round(n*.05)),x=ae(p,o,n,R,2),w=ae(C,o,n,R,2),z=new Float32Array(o*n),X=new Float32Array(o*n);for(let A=0;A<o*n;A++){if(!a[A])continue;const F=.5*Math.atan2(w[A],x[A]);z[A]=Math.cos(F),X[A]=Math.sin(F)}const Ct=Math.max(9,n*.04),yt=new Float32Array(o*n),Kt=-.45,W=-.62,vt=.64;for(let A=1;A<n-1;A++)for(let F=1;F<o-1;F++){const E=A*o+F;if(!a[E])continue;let q=k[E],K=j[E];const bt=Math.hypot(q,K)||1;q/=bt,K/=bt;const Vt=M[E],pt=(1-Math.min(Vt/Ct,1))*1.25;let B=-q*pt,J=-K*pt;const rt=1.5,Ot=Math.hypot(B,J,rt);B/=Ot,J/=Ot;let st=B*Kt+J*W+rt/Ot*vt;st<0&&(st=0);const at=Math.min(1,.45+.55*Math.min(Vt/(Ct*.7),1));yt[E]=Math.min(1.12,(.5+.75*st)*at)}return{mask:a,ex:z,ey:X,shade:yt}}function We(l,o){var ie,Qe,He;if(typeof window>"u"||typeof document>"u"||!l)return{setText(){},replay(){},resize(){},update(){},focus(){},destroy(){},get text(){return o.text??""}};let n=o.text??"",a=le(o.font),s=qt(Rt(o.weight,680),1,1e3),M=qt(Rt(o.fill,.9),.05,1),p=o.align==="left"||o.align==="right"?o.align:"center";const C=(t,e)=>{const i=Rt(t,e);return i>=1?Math.min(i,1e5):e};let k=C(o.sewRate,110),j=o.sewStyle==="hand"?"hand":"machine";const R=["satin","cross","chain","running"];let x=R.includes(o.stitchMode??"")?o.stitchMode:"satin",w=o.sheen??!0,z=o.animate??!0,X=o.editable??!1;const Ct=t=>typeof t=="number"&&Number.isFinite(t)&&t>=1&&t<=200?t:void 0;let yt=Ct(o.pitch);const Kt=["solid","twotone","gradient"];let W=Kt.includes(o.colorMode??"")?o.colorMode:"solid",vt=o.threadColor??"#fffbf3",A=o.threadColor2??vt,F=o.backstitch??!1,E=o.outlineColor,q=o.axes,K=o.onTextChange,bt=Le(a);function Vt(){if(!q)return"";const t=[];for(const e in q){const i=q[e];typeof i=="number"&&isFinite(i)&&t.push(`"${e}" ${i}`)}return t.join(", ")}function pt(t){"fontVariationSettings"in t&&(t.fontVariationSettings=Vt()||"normal")}const B=o.reducedMotion===void 0&&window.matchMedia?window.matchMedia("(prefers-reduced-motion: reduce)"):null;let J=o.reducedMotion??!!(B!=null&&B.matches);const rt=t=>({peak:t,mid:[t[0]*.585,t[1]*.585,t[2]*.585],end:[t[0]*.47,t[1]*.47,t[2]*.47]}),Ot=(t,e,i)=>[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i],st=6;let at=[255,251,243],lt=[],he=rt([0,0,0]);function Re(){const t=ce(vt,[255,251,243]),e=ce(A,t);if(W==="twotone")lt=[rt(t),rt(e)];else if(W==="gradient"){lt=[];for(let i=0;i<st;i++)lt.push(rt(Ot(t,e,i/(st-1))))}else lt=[rt(t)];at=lt[0].peak,he=rt(E?ce(E,[0,0,0]):[t[0]*.32,t[1]*.32,t[2]*.32])}Re();const Nt=[];let N,v,_=null,U=null;if(l instanceof HTMLCanvasElement)N=l,v=l.parentElement??l;else{v=l;const t=i=>i.replace(/\s+/g," ").trim(),e=Array.from(v.childNodes);if(e.some(i=>i.nodeType===1||(i.textContent??"").trim())){_=document.createElement("span"),_.className=kt.text,_.style.cssText=Ae;for(const i of e)_.appendChild(i);v.appendChild(_),t(n)&&t(_.textContent??"")!==t(n)&&(_.style.display="none")}(!_||_.style.display==="none")&&(U=document.createElement("span"),U.className=kt.text,U.style.cssText=Ae,U.textContent=n,v.appendChild(U)),N=document.createElement("canvas"),Nt.push(N),v.appendChild(N)}const $t={height:v.style.height,position:v.style.position,hadStyle:v.hasAttribute("style")};N.setAttribute("aria-hidden","true"),N.classList.add(kt.bg);const Y=document.createElement("canvas");Nt.push(Y),Y.classList.add(kt.fx),Y.setAttribute("aria-hidden","true"),v.appendChild(Y),getComputedStyle(v).position==="static"&&(v.style.position="relative"),N.style.display="block",N.style.width="100%",Object.assign(Y.style,{position:"absolute",top:"0",left:"0",width:"100%",pointerEvents:"none",mixBlendMode:"screen"});let T=null,$=null,St=!1,S=0,I=0,xt=0,ge=0,tt=4,Pt=[],Tt=0,Et=0,me=[],Ie=0,Oe=-1,Ne="",$e=-1,Pe=-1,Z=new Uint8Array(0),Yt=new Float32Array(0),ye=new Float32Array(0),pe=new Float32Array(0),ft=null,At=null,Jt=null,Bt=[],dt=[],jt=[],Mt=3;const O={rows:[],idx:0,acc:0,rate:0,on:!1},et={x:0,y:0,set:!1};let ut=!0,xe=0,_t=!1,Dt=0,Me=-1,D=!1,Q=!1,nt=null,Ut="",Zt=!1,we=0,Ce=!1,H;function on(){const t=v.getBoundingClientRect(),e=Math.max(1,Math.round(t.width||Math.min(window.innerWidth*.95,1240))),i=n||"Ag",r=N.getContext("2d");r&&(r.textBaseline="middle",r.direction=_e());let f=100;r&&(r.font=`${s} 100px ${a}`,pt(r),f=r.measureText(i).width||100);const c=Math.max(8,100*(e*M)/f);let d=c*.62,b=c*.62,u=e*M;if(r){r.font=`${s} ${c}px ${a}`,pt(r);const y=r.measureText(i);u=y.width||u,y.actualBoundingBoxAscent>0&&(d=y.actualBoundingBoxAscent),y.actualBoundingBoxDescent>0&&(b=y.actualBoundingBoxDescent)}const g=Math.max(1,Math.round(2*Math.max(d,b)*1.1));let m=Math.min(window.devicePixelRatio||1,1.7);for(;e*m*g*m>9e5&&m>.4;)m-=.1;S=Math.max(1,Math.round(e*m)),I=Math.max(1,Math.round(g*m)),xt=Math.max(4,Math.round(c*m));const h=u*m,L=Math.max(2,Math.round(xt*.08));ge=Math.round(p==="left"?L:p==="right"?S-h-L:S/2-h/2);for(const y of[N,Y])y.width=S,y.height=I,y.style.height=g+"px";v.style.height=g+"px",Y.style.left=N.offsetLeft+"px",Y.style.top=N.offsetTop+"px",Y.style.width=(N.offsetWidth||N.getBoundingClientRect().width)+"px",tt=yt??Math.max(3,I*.0095)}function rn(){At&&$e===S&&Pe===I||(At=document.createElement("canvas"),At.width=S,At.height=I,Jt=At.getContext("2d",{willReadFrequently:!0}),$e=S,Pe=I)}function Be(){return lt.map(t=>t.peak.join(",")).join(";")+"|"+x+"|"+W+(F?"|bs"+he.peak.join(","):"")}function je(t,e){const i=Math.max(7,tt*2.5),r=Math.max(3.2,tt*1.3),f=[];for(let c=0;c<20;c++){const d=.34+c/19*.82,b=document.createElement("canvas");b.width=Tt,b.height=Et;const u=b.getContext("2d");if(!u){f.push(b);continue}const g=Tt/2,m=Et/2,h=(y,P)=>`rgba(${it(y[0]*d)},${it(y[1]*d)},${it(y[2]*d)},${P})`,L=(y,P,gt,ct)=>{u.save(),u.translate(g,m),u.rotate(gt);const V=u.createLinearGradient(0,-P/2,0,P/2);V.addColorStop(0,h(t.end,0)),V.addColorStop(.16,h(t.mid,1)),V.addColorStop(.5,h(t.peak,1)),V.addColorStop(.84,h(t.mid,1)),V.addColorStop(1,h(t.end,0)),u.fillStyle=V;const G=P/2;if(u.beginPath(),u.moveTo(-y/2+G,-G),u.lineTo(y/2-G,-G),u.arc(y/2-G,0,G,-Math.PI/2,Math.PI/2),u.lineTo(-y/2+G,G),u.arc(-y/2+G,0,G,Math.PI/2,-Math.PI/2),u.closePath(),u.fill(),ct){u.globalCompositeOperation="destination-in";const mt=u.createLinearGradient(-y/2,0,y/2,0);mt.addColorStop(0,"rgba(0,0,0,0)"),mt.addColorStop(.22,"rgba(0,0,0,1)"),mt.addColorStop(.78,"rgba(0,0,0,1)"),mt.addColorStop(1,"rgba(0,0,0,0)"),u.fillStyle=mt,u.fillRect(-y/2-1,-P/2-1,y+2,P+2),u.globalCompositeOperation="source-over"}u.restore()};if(e==="cross")L(i*.92,r*.82,Math.PI/4,!1),L(i*.92,r*.82,-Math.PI/4,!1);else if(e==="chain"){u.save(),u.translate(g,m);const y=u.createLinearGradient(0,-r,0,r);y.addColorStop(0,h(t.mid,1)),y.addColorStop(.5,h(t.peak,1)),y.addColorStop(1,h(t.mid,1)),u.strokeStyle=y,u.lineWidth=Math.max(1.6,r*.7),u.lineCap="round",u.beginPath(),u.ellipse(0,0,i*.34,r*1.05,0,0,Math.PI*2),u.stroke(),u.restore()}else e==="running"?L(i*.5,r,0,!1):L(i,r,0,!0);f.push(b)}return f}function ve(){const t=Math.max(7,tt*2.5),e=Math.max(3.2,tt*1.3);x==="cross"||x==="chain"?Tt=Et=Math.ceil(t)+2:(Tt=Math.ceil(t)+2,Et=Math.ceil(e)+2),Ie=x==="chain"||x==="running"?Math.PI/2:0,Pt=[];for(const i of lt)for(const r of je(i,x))Pt.push(r);me=F?je(he,"running"):[],Oe=tt,Ne=Be()}function sn(){Pt.length&&Oe===tt&&Ne===Be()||ve()}function _e(){try{return getComputedStyle(v).direction==="rtl"?"rtl":"ltr"}catch{return"ltr"}}function De(){if(!Jt)return null;const t=Jt;return t.clearRect(0,0,S,I),t.fillStyle="#fff",t.textAlign="left",t.textBaseline="middle",t.direction=_e(),t.font=`${s} ${xt}px ${a}`,pt(t),t.fillText(n,ge,I*.5),t.getImageData(0,0,S,I).data}function be(t){Z=t.mask,ye=t.ex,pe=t.ey,Yt=t.shade,ft=document.createElement("canvas"),ft.width=S,ft.height=I;const e=ft.getContext("2d");if(e){const i=e.createImageData(S,I);for(let r=0;r<S*I;r++)Z[r]&&(i.data[r*4]=255,i.data[r*4+1]=255,i.data[r*4+2]=255,i.data[r*4+3]=255);e.putImageData(i,0,0)}}function Ue(){const t=Math.max(1.6,tt*.6);Mt=t;const e=[],i=[];let r=1/0,f=-1/0;for(let c=0;c<I;c+=t)for(let d=0;d<S;d+=t){const b=(ot(Math.floor(d),Math.floor(c))-.5)*t*.9,u=(ot(Math.floor(c),Math.floor(d))-.5)*t*.9,g=Math.round(d+b),m=Math.round(c+u);if(g<1||m<1||g>=S-1||m>=I-1)continue;const h=m*S+g;if(!Z[h])continue;const L=Math.atan2(pe[h],ye[h]),y=.86+ot(g*7,m*13)*.18;let P=Yt[h]*y;P=P<0?0:P>1.12?1.12:P,e.push({x:g,y:m,ang:L,idx:Math.min(19,Math.max(0,Math.round(P/1.12*19)))}),g<r&&(r=g),g>f&&(f=g)}if(W==="twotone")if(x==="satin"){const c=Math.max(4,tt*1.6);for(const d of e){const b=-Math.sin(d.ang)*d.x+Math.cos(d.ang)*d.y;d.pal=Math.floor(b/c)&1}}else for(const c of e)c.pal=Math.round(c.x/t)+Math.round(c.y/t)&1;else if(W==="gradient"){const c=Math.max(1,f-r);for(const d of e){const b=(d.x-r)/c*(st-1),u=Math.min(st-1,Math.max(0,Math.floor(b)));d.pal=u,u<st-1&&ot(d.x*3+1,d.y*5+2)<b-u&&i.push({x:d.x,y:d.y,ang:d.ang,idx:d.idx,pal:u+1})}}Bt=e,jt=i,an()}function an(){if(dt=[],!F||!Z.length)return;const t=Math.max(3,tt*1.5),e=Math.max(1,Math.ceil(S/t)),i=new Set,r=(f,c)=>Z[c*S+f]?1:0;for(let f=1;f<I-1;f++)for(let c=1;c<S-1;c++){const d=f*S+c;if(!Z[d]||Z[d-1]&&Z[d+1]&&Z[d-S]&&Z[d+S])continue;const b=Math.floor(f/t)*e+Math.floor(c/t);if(i.has(b))continue;i.add(b);const u=r(c+1,f-1)+2*r(c+1,f)+r(c+1,f+1)-(r(c-1,f-1)+2*r(c-1,f)+r(c-1,f+1)),g=r(c-1,f+1)+2*r(c,f+1)+r(c+1,f+1)-(r(c-1,f-1)+2*r(c,f-1)+r(c+1,f-1)),m=Math.atan2(u,-g);let h=Yt[d];h=h<0?0:h>1.12?1.12:h,dt.push({x:c,y:f,ang:m,idx:Math.min(19,Math.max(8,Math.round(h/1.12*19))),outline:1})}}function Qt(t,e){t.save(),t.translate(e.x,e.y),e.outline?(t.rotate(e.ang),t.drawImage(me[e.idx],-Tt/2,-Et/2)):(t.rotate(e.ang+Ie),t.drawImage(Pt[(e.pal||0)*20+e.idx],-Tt/2,-Et/2)),t.restore()}function Gt(){const t=N.getContext("2d");if(t){for(const e of Bt)Qt(t,e);for(const e of jt)Qt(t,e);for(const e of dt)Qt(t,e)}}function zt(){const t=N.getContext("2d");t&&t.clearRect(0,0,S,I)}function Ge(t){if(!t.length)return[];const e=Math.max(4,Mt*1.5),i=new Map,r=(g,m)=>g+","+m;t.forEach((g,m)=>{const h=r(Math.floor(g.x/e),Math.floor(g.y/e));let L=i.get(h);L||i.set(h,L=[]),L.push(m)});const f=Mt*1.8*(Mt*1.8);function c(g){const m=t[g],h=Math.floor(m.x/e),L=Math.floor(m.y/e),y=[];for(let P=-1;P<=1;P++)for(let gt=-1;gt<=1;gt++){const ct=i.get(r(h+P,L+gt));if(ct)for(const V of ct){if(V===g)continue;const G=t[V].x-m.x,mt=t[V].y-m.y;G*G+mt*mt<=f&&y.push(V)}}return y}const d=new Uint8Array(t.length),b=[],u=t.map((g,m)=>m).sort((g,m)=>t[g].x+t[g].y-(t[m].x+t[m].y));for(const g of u){if(d[g])continue;let m=[g];for(d[g]=1;m.length;){b.push(m.map(L=>t[L]));const h=[];for(const L of m)for(const y of c(L))d[y]||(d[y]=1,h.push(y));m=h}}return b}function cn(t){const e=Math.max(4,Mt*1.5),i=new Map,r=(u,g)=>u+","+g;t.forEach((u,g)=>{const m=r(Math.floor(u.x/e),Math.floor(u.y/e));let h=i.get(m);h||i.set(m,h=[]),h.push(g)});const f=Mt*1.8*(Mt*1.8),c=u=>{const g=t[u],m=Math.floor(g.x/e),h=Math.floor(g.y/e),L=[];for(let y=-1;y<=1;y++)for(let P=-1;P<=1;P++){const gt=i.get(r(m+y,h+P));if(gt)for(const ct of gt){if(ct===u)continue;const V=t[ct].x-g.x,G=t[ct].y-g.y;V*V+G*G<=f&&L.push(ct)}}return L},d=new Uint8Array(t.length),b=[];for(let u=0;u<t.length;u++){if(d[u])continue;const g=[];let m=[u];for(d[u]=1;m.length;){const h=[];for(const L of m){g.push(t[L]);for(const y of c(L))d[y]||(d[y]=1,h.push(y))}m=h}b.push(g)}return b}function ln(t){if(!t.length)return[];const e=c=>{let d=1/0;for(const b of c)b.x<d&&(d=b.x);return d},i=c=>{let d=0;for(const b of c)d+=b.y;return d/c.length},r=cn(t).sort((c,d)=>e(c)-e(d)),f=[];for(const c of r){const d=Ge(c);let b=1;for(const h of d)h.length>b&&(b=h.length);const u=Math.max(2,b*.45),g=d.filter(h=>h.length>=u).sort((h,L)=>i(h)-i(L)),m=d.filter(h=>h.length<u).sort((h,L)=>i(h)-i(L));for(const h of g)f.push(h);for(const h of m)f.push(h)}return f}function fn(){if(zt(),J||!z){Gt(),O.on=!1;return}const t=j==="hand"?ln:Ge;let e;if(W==="gradient"&<.length>1){e=[];const i=new Map;for(const r of Bt){const f=r.pal||0,c=i.get(f);c?c.push(r):i.set(f,[r])}for(const r of[...i.keys()].sort((f,c)=>f-c))for(const f of t(i.get(r)))e.push(f)}else e=t(Bt);if(jt.length)for(const i of t(jt))e.push(i);if(dt.length){const r=Math.ceil(dt.length/24);for(let f=0;f<dt.length;f+=r)e.push(dt.slice(f,f+r))}O.rows=e,O.idx=0,O.acc=0,O.rate=k,O.on=O.rows.length>0}function dn(t){const e=N.getContext("2d");if(e)for(t>O.rows.length&&(t=O.rows.length);O.idx<t;){const i=O.rows[O.idx++];for(const r of i)Qt(e,r)}}function un(t,e){const i=Y.getContext("2d");if(!i||(i.clearRect(0,0,S,I),!w||!ft))return;const r=S*.32,f=i.createRadialGradient(t,e,0,t,e,r);f.addColorStop(0,"rgba(255,250,238,0.18)"),f.addColorStop(.5,"rgba(255,250,238,0.055)"),f.addColorStop(1,"rgba(255,250,238,0)"),i.fillStyle=f,i.fillRect(0,0,S,I),i.globalCompositeOperation="destination-in",i.drawImage(ft,0,0),i.globalCompositeOperation="source-over"}function hn(){$||!X||($=document.createElement("span"),$.className=kt.caret,$.setAttribute("aria-hidden","true"),Object.assign($.style,{position:"absolute",pointerEvents:"none",borderRadius:"1px",opacity:"0",background:`rgb(${it(at[0])},${it(at[1])},${it(at[2])})`}),v.appendChild($),Nt.push($))}function Ht(){if(!X||!$)return;const t=N.getContext("2d");if(!t)return;t.font=`${s} ${xt}px ${a}`,pt(t);const e=t.measureText(n).width,i=(N.clientWidth||S)/S,r=xt*.7;$.style.left=(ge+e+xt*.05)*i+"px",$.style.top=.5*(N.clientHeight||I)-r*i/2+"px",$.style.height=r*i+"px",$.style.width=Math.max(2,Math.round(xt*.02*i))+"px",$.style.background=`rgb(${it(at[0])},${it(at[1])},${it(at[2])})`}function ht(){D||_t||(_t=!0,Dt=0,xe=requestAnimationFrame(ze))}function ze(t){if(D){_t=!1;return}Dt||(Dt=t);const e=Math.min(.25,(t-Dt)/1e3);Dt=t,O.on&&(O.acc+=O.rate*e,dn(O.acc),O.idx>=O.rows.length&&(O.on=!1)),ut&&ft&&(un(et.set?et.x:S*.5,et.set?et.y:I*.45),ut=!1);const i=X&&St&&!J;if($&&($.style.opacity=X&&St&&(J||Math.floor(t/530)%2===0)?"1":"0"),!O.on&&!ut&&!i){_t=!1;return}xe=requestAnimationFrame(ze)}function Wt(t){if(J)return;const e=v.getBoundingClientRect();et.x=(t.clientX-e.left)/(e.width||1)*S,et.y=(t.clientY-e.top)/(e.height||1)*I,et.set=!0,ut=!0,ht()}function te(){J||(et.set=!1,ut=!0,ht())}function gn(){T&&Ve(T.value,!0)}function mn(t){t.key==="Enter"&&(t.preventDefault(),oe.replay())}function yn(){St=!0,ht(),qe()}function qe(){J&&$&&X&&St&&($.style.opacity="1")}function pn(){St=!1,$&&($.style.opacity="0")}function Xe(t){if(!(t===X&&T))if(X=t,t){T||(T=document.createElement("input"),T.type="text",T.value=n,T.maxLength=64,T.setAttribute("aria-label","Embroidered text — type to change it"),T.setAttribute("autocomplete","off"),T.setAttribute("autocapitalize","off"),T.spellcheck=!1,Object.assign(T.style,{position:"absolute",inset:"0",width:"100%",height:"100%",margin:"0",padding:"0",border:"0",outline:"none",background:"transparent",color:"transparent",caretColor:"transparent",font:"inherit",textAlign:"center",cursor:"text"}),T.addEventListener("input",gn),T.addEventListener("keydown",mn),T.addEventListener("focus",yn),T.addEventListener("blur",pn),v.appendChild(T),Nt.push(T)),hn(),Ht();for(const e of[_,U])e==null||e.setAttribute("aria-hidden","true")}else{for(const e of[_,U])e==null||e.removeAttribute("aria-hidden");T&&(T.remove(),T=null),St=!1,$&&($.style.opacity="0")}}function xn(t){if(t!==w)if(w=t,t)v.addEventListener("pointermove",Wt,{passive:!0}),v.addEventListener("pointerleave",te,{passive:!0}),et.set=!1,ut=!0,ht();else{v.removeEventListener("pointermove",Wt),v.removeEventListener("pointerleave",te);const e=Y.getContext("2d");e&&e.clearRect(0,0,S,I)}}function ee(t){Ue(),t?fn():(zt(),Gt(),O.on=!1),T&&T.value!==n&&(T.value=n),Ht(),ut=!0,ht()}function wt(t){if(!n.trim()&&!X){for(const i of[N,Y])i.width=0,i.height=0,i.style.height="0px";v.style.height=$t.height;return}on(),rn(),sn();const e=De();if(!e){ee(t);return}if(nt&&Zt){const i=++we;Ce=t,H&&clearTimeout(H),H=setTimeout(()=>Ke(i),800);try{nt.postMessage({id:i,W:S,H:I,alpha:e},[e.buffer])}catch{Ke(i)}return}be(fe(e,S,I)),ee(t)}function Ke(t){if(t!==we||D)return;H&&(clearTimeout(H),H=void 0),Zt=!1;const e=De();e&&(be(fe(e,S,I)),ee(Ce))}function Ve(t,e){t=t??"",U&&(U.textContent=t),!(t===n&&Q)&&(n=t,Q&&(wt(!1),e&&K&&K(n)))}const ne=new Set;function Ye(t,e,i){const r=`${e} 200px ${t}`;let f=!1;try{f=!!document.fonts&&document.fonts.check(r)}catch{f=!0}if(!document.fonts||f){i();return}let c=!1,d;const b=()=>{c||(c=!0,clearTimeout(d),ne.delete(d),D||i())};document.fonts.load(r,n).then(()=>document.fonts.ready).then(b,b),d=setTimeout(b,1500),ne.add(d)}function Mn(t){const e=t.data;if(e&&e.type==="pong"){Zt=!0;return}!e||D||e.id!==we||(H&&(clearTimeout(H),H=void 0),be({mask:e.mask,ex:e.ex,ey:e.ey,shade:e.shade}),ee(Ce))}function wn(){if(!(typeof Worker>"u"||typeof Blob>"u"||typeof URL>"u"||!URL.createObjectURL))try{const t=`${ot}
|
|
2
|
+
${re}
|
|
3
|
+
${se}
|
|
4
|
+
${Ee}
|
|
5
|
+
${ae}
|
|
6
|
+
var __cg=${fe};
|
|
7
|
+
self.onmessage=function(ev){var d=ev.data;if(d&&d.type==='ping'){try{__cg(new Uint8ClampedArray(4),1,1);self.postMessage({type:'pong'})}catch(e){}return}var g=__cg(d.alpha,d.W,d.H);self.postMessage({id:d.id,mask:g.mask,ex:g.ex,ey:g.ey,shade:g.shade},[g.mask.buffer,g.ex.buffer,g.ey.buffer,g.shade.buffer])};`;Ut=URL.createObjectURL(new Blob([t],{type:"application/javascript"})),nt=new Worker(Ut),nt.onmessage=Mn,nt.onerror=()=>{Zt=!1},nt.postMessage({type:"ping"})}catch{nt=null}}function Cn(){if(!D){if(!N.getContext("2d")){const t=U??_;t&&(t.style.cssText="");for(const e of[N,Y])e.style.display="none";v.style.height=$t.height,Q=!0;return}wt(!0),Me=Math.round(v.getBoundingClientRect().width),Q=!0}}wn(),X&&(X=!1,Xe(!0)),w&&(v.addEventListener("pointermove",Wt,{passive:!0}),v.addEventListener("pointerleave",te,{passive:!0})),Ye(bt,s,Cn);const Je=()=>{if(!(D||!Q))try{document.fonts.check(`${s} 200px ${a}`)&&wt(!1)}catch{}};(Qe=(ie=document.fonts)==null?void 0:ie.addEventListener)==null||Qe.call(ie,"loadingdone",Je);const Ze=()=>{D||(J=!!(B!=null&&B.matches),J&&Q&&(O.on&&(O.on=!1,zt(),Gt()),et.set=!1,ut=!0,ht(),qe()))};(He=B==null?void 0:B.addEventListener)==null||He.call(B,"change",Ze);let Se;function Te(){clearTimeout(Se),Se=setTimeout(()=>{if(D)return;if(!v.isConnected){oe.destroy();return}if(!Q)return;const t=Math.round(v.getBoundingClientRect().width);t!==Me&&(Me=t,wt(!1))},200)}window.addEventListener("resize",Te);const Lt=typeof ResizeObserver<"u"?new ResizeObserver(Te):null;Lt==null||Lt.observe(v);const oe={get text(){return n},setText(t){if(!D){if(!Q){n=t??"",T&&(T.value=n),U&&(U.textContent=n);return}Ve(t,!1)}},replay(){D||!Q||wt(!0)},resize(){D||!Q||wt(!1)},update(t){if(D)return;t.text!==void 0&&oe.setText(t.text);let e=!1,i=!1,r=!1,f=!1;if(t.font!==void 0&&le(t.font)!==a&&(a=le(t.font),bt=Le(a),e=!0),t.weight!==void 0){const c=qt(Rt(t.weight,s),1,1e3);c!==s&&(s=c,e=!0)}if(t.fill!==void 0){const c=qt(Rt(t.fill,M),.05,1);c!==M&&(M=c,e=!0)}if(t.align!==void 0){const c=t.align==="left"||t.align==="right"?t.align:"center";c!==p&&(p=c,e=!0)}t.pitch!==void 0&&Ct(t.pitch)!==yt&&(yt=Ct(t.pitch),e=!0),t.axes!==void 0&&(q=t.axes,e=!0),t.threadColor!==void 0&&t.threadColor!==vt&&(vt=t.threadColor,f=!0),t.threadColor2!==void 0&&t.threadColor2!==A&&(A=t.threadColor2,f=!0),t.outlineColor!==void 0&&t.outlineColor!==E&&(E=t.outlineColor,f=!0),t.colorMode!==void 0&&t.colorMode!==W&&Kt.includes(t.colorMode)&&(W=t.colorMode,f=!0,r=!0),t.backstitch!==void 0&&t.backstitch!==F&&(F=t.backstitch,r=!0),t.stitchMode!==void 0&&t.stitchMode!==x&&R.includes(t.stitchMode)&&(x=t.stitchMode,i=!0),t.sewRate!==void 0&&(k=C(t.sewRate,k)),t.sewStyle!==void 0&&(j=t.sewStyle==="hand"?"hand":"machine"),t.animate!==void 0&&(z=t.animate),t.onTextChange!==void 0&&(K=t.onTextChange),t.sheen!==void 0&&xn(t.sheen),t.editable!==void 0&&Xe(t.editable),f&&Re(),Q&&(e?Ye(bt,s,()=>{D||wt(!1)}):r?(ve(),Ue(),zt(),Gt(),Ht(),ht()):(i||f)&&(ve(),zt(),Gt(),Ht(),ht()))},focus(){!D&&X&&(T==null||T.focus())},destroy(){var t,e,i;if(!D){D=!0,_t=!1,cancelAnimationFrame(xe),clearTimeout(Se),H&&clearTimeout(H);for(const r of ne)clearTimeout(r);if(ne.clear(),nt&&(nt.terminate(),nt=null),Ut){try{URL.revokeObjectURL(Ut)}catch{}Ut=""}window.removeEventListener("resize",Te),Lt==null||Lt.disconnect(),(t=B==null?void 0:B.removeEventListener)==null||t.call(B,"change",Ze),(i=(e=document.fonts)==null?void 0:e.removeEventListener)==null||i.call(e,"loadingdone",Je),v.removeEventListener("pointermove",Wt),v.removeEventListener("pointerleave",te);for(const r of Nt)r.remove();if(_){for(;_.firstChild;)v.insertBefore(_.firstChild,_);_.remove(),_=null}U==null||U.remove(),U=null,v.style.height=$t.height,v.style.position=$t.position,!$t.hadStyle&&!v.getAttribute("style")&&v.removeAttribute("style"),Pt=[],me=[],Bt=[],dt=[],jt=[],O.rows=[],Z=new Uint8Array(0),Yt=new Float32Array(0),ye=new Float32Array(0),pe=new Float32Array(0),ft=At=null,Jt=null,$=null,T=null}}};return oe}const Fe="data-threadtext",Xt=new WeakMap,de=new Set;function tn(l,o){const n=l.dataset,a={text:n.ttText??o};if(n.ttFont&&(a.font=n.ttFont),n.ttWeight!==void 0){const s=parseFloat(n.ttWeight);Number.isFinite(s)&&(a.weight=s)}if(n.ttThreadColor&&(a.threadColor=n.ttThreadColor),n.ttThreadColor2&&(a.threadColor2=n.ttThreadColor2),n.ttColorMode&&["solid","twotone","gradient"].includes(n.ttColorMode)&&(a.colorMode=n.ttColorMode),n.ttBackstitch==="true"&&(a.backstitch=!0),n.ttOutlineColor&&(a.outlineColor=n.ttOutlineColor),n.ttPitch!==void 0){const s=parseFloat(n.ttPitch);Number.isFinite(s)&&(a.pitch=s)}if(n.ttFill!==void 0){const s=parseFloat(n.ttFill);Number.isFinite(s)&&(a.fill=s)}if(n.ttAlign&&["left","center","right"].includes(n.ttAlign)&&(a.align=n.ttAlign),n.ttSewStyle==="hand"&&(a.sewStyle="hand"),n.ttStitchMode&&["satin","cross","chain","running"].includes(n.ttStitchMode)&&(a.stitchMode=n.ttStitchMode),n.ttAxes)try{const s=JSON.parse(n.ttAxes);s&&typeof s=="object"&&(a.axes=s)}catch{}if(n.ttSewRate!==void 0){const s=parseFloat(n.ttSewRate);Number.isFinite(s)&&(a.sewRate=s)}return n.ttSheen==="false"&&(a.sheen=!1),n.ttAnimate==="false"&&(a.animate=!1),n.ttEditable==="true"&&(a.editable=!0),a}function ke(l){ue(l);const o=(l.dataset.ttText??l.textContent??"").trim();if(!o)return;const n=We(l,tn(l,o));Xt.set(l,{instance:n,originalHTML:""}),de.add(l)}function ue(l){const o=Xt.get(l);o&&(o.instance.destroy(),Xt.delete(l),de.delete(l))}function It(l=document){const o=[];l instanceof HTMLElement&&l.matches(`[${Fe}]`)&&o.push(l),l.querySelectorAll(`[${Fe}]`).forEach(n=>o.push(n));for(const n of o)Xt.has(n)||ke(n)}function en(l){ke(l)}function nn(){const l=()=>{var o;typeof document<"u"&&((o=document.fonts)!=null&&o.ready)?document.fonts.ready.then(()=>It()).catch(()=>It()):It(),typeof MutationObserver<"u"&&document.body&&new MutationObserver(n=>{let a=!1;for(const s of n)s.removedNodes.length&&(a=!0),s.addedNodes.forEach(M=>{M instanceof HTMLElement&&M.isConnected&&!M.classList.contains("tt-text")&&It(M)});a&&de.forEach(s=>{s.isConnected||ue(s)})}).observe(document.body,{childList:!0,subtree:!0})};typeof document<"u"&&document.readyState==="loading"?document.addEventListener("DOMContentLoaded",l,{once:!0}):l()}return nn(),Ft.destroy=ue,Ft.init=It,Ft.restart=en,Object.defineProperty(Ft,Symbol.toStringTag,{value:"Module"}),Ft})({});
|
package/package.json
CHANGED
|
@@ -1,88 +1,93 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@overpunch/threadtext",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Render any text as photorealistic procedural satin-stitch embroidery, in real time in the browser, from the font's glyph geometry",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.cjs",
|
|
7
|
-
"module": "dist/index.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.js",
|
|
13
|
-
"require": "./dist/index.cjs"
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
"react": "^19.0.0",
|
|
49
|
-
"react
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"text
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@overpunch/threadtext",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Render any text as photorealistic procedural satin-stitch embroidery, in real time in the browser, from the font's glyph geometry",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./core": {
|
|
16
|
+
"types": "./dist/core.d.ts",
|
|
17
|
+
"import": "./dist/core.js",
|
|
18
|
+
"require": "./dist/core.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "vite build",
|
|
26
|
+
"build:webflow": "vite build --config vite.webflow.config.ts",
|
|
27
|
+
"test": "vitest",
|
|
28
|
+
"test:run": "vitest run",
|
|
29
|
+
"lint": "tsc --noEmit",
|
|
30
|
+
"capture": "node scripts/capture/capture.mjs",
|
|
31
|
+
"demo": "python3 -m http.server 8080",
|
|
32
|
+
"prepublishOnly": "npm run test:run && npm run build && npm run build:webflow"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": ">=17",
|
|
36
|
+
"react-dom": ">=17"
|
|
37
|
+
},
|
|
38
|
+
"peerDependenciesMeta": {
|
|
39
|
+
"react": {
|
|
40
|
+
"optional": true
|
|
41
|
+
},
|
|
42
|
+
"react-dom": {
|
|
43
|
+
"optional": true
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@testing-library/react": "^16.3.2",
|
|
48
|
+
"@types/react": "^19.0.0",
|
|
49
|
+
"@vitejs/plugin-react": "^4.0.0",
|
|
50
|
+
"happy-dom": "^20.10.6",
|
|
51
|
+
"next": "16.2.2",
|
|
52
|
+
"playwright": "^1.61.1",
|
|
53
|
+
"react": "^19.0.0",
|
|
54
|
+
"react-dom": "^19.0.0",
|
|
55
|
+
"typescript": "^5.0.0",
|
|
56
|
+
"vite": "^6.0.0",
|
|
57
|
+
"vite-plugin-dts": "^4.0.0",
|
|
58
|
+
"vitest": "^3.0.0"
|
|
59
|
+
},
|
|
60
|
+
"keywords": [
|
|
61
|
+
"typography",
|
|
62
|
+
"web-typography",
|
|
63
|
+
"embroidery",
|
|
64
|
+
"satin-stitch",
|
|
65
|
+
"cross-stitch",
|
|
66
|
+
"thread",
|
|
67
|
+
"thread-text",
|
|
68
|
+
"procedural",
|
|
69
|
+
"canvas",
|
|
70
|
+
"real-time",
|
|
71
|
+
"variable-font",
|
|
72
|
+
"text-effect",
|
|
73
|
+
"liiift-studio",
|
|
74
|
+
"type-tools",
|
|
75
|
+
"frontend",
|
|
76
|
+
"react",
|
|
77
|
+
"typescript"
|
|
78
|
+
],
|
|
79
|
+
"author": "Quinn Keaveney <quinn@overpunch.ca>",
|
|
80
|
+
"license": "MIT",
|
|
81
|
+
"homepage": "https://threadtext.com",
|
|
82
|
+
"repository": {
|
|
83
|
+
"type": "git",
|
|
84
|
+
"url": "git+https://github.com/over-punch/ThreadText.git"
|
|
85
|
+
},
|
|
86
|
+
"bugs": {
|
|
87
|
+
"url": "https://github.com/over-punch/ThreadText/issues"
|
|
88
|
+
},
|
|
89
|
+
"sideEffects": false,
|
|
90
|
+
"publishConfig": {
|
|
91
|
+
"access": "public"
|
|
92
|
+
}
|
|
93
|
+
}
|