asciify-engine 4.23.0 → 4.24.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.
Files changed (87) hide show
  1. package/README.md +7 -0
  2. package/dist/core.cjs +1 -1
  3. package/dist/core.js +1 -1
  4. package/dist/field.cjs +1 -1
  5. package/dist/field.js +1 -1
  6. package/dist/index.cjs +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/kit/chunk-2CF4PX6U.js +1 -0
  9. package/dist/kit/chunk-2NVKPXPL.js +1 -0
  10. package/dist/kit/chunk-3473NPIN.js +1 -0
  11. package/dist/kit/chunk-3A5LID2G.js +1 -0
  12. package/dist/kit/chunk-3PCKMO6I.js +1 -0
  13. package/dist/kit/chunk-4HWMQCAM.js +1 -0
  14. package/dist/kit/chunk-4OT66HSZ.js +1 -0
  15. package/dist/kit/chunk-4QHFEMFS.js +1 -0
  16. package/dist/kit/chunk-4ZQFDFEH.js +1 -0
  17. package/dist/kit/chunk-5BEBNKYM.js +1 -0
  18. package/dist/kit/chunk-5I4IZTL5.js +1 -0
  19. package/dist/kit/chunk-5QE6UMXN.js +1 -0
  20. package/dist/kit/chunk-5Z2EJAUV.js +1 -0
  21. package/dist/kit/chunk-73M2OESE.js +1 -0
  22. package/dist/kit/chunk-7ABNWOW4.js +1 -0
  23. package/dist/kit/chunk-AIM3J2US.js +1 -0
  24. package/dist/kit/chunk-BN7HL52Z.js +1 -0
  25. package/dist/kit/chunk-BNVRKD3V.js +1 -0
  26. package/dist/kit/chunk-BQZCLGCY.js +1 -0
  27. package/dist/kit/chunk-BR6ZNJZW.js +1 -0
  28. package/dist/kit/chunk-BTD6EFAW.js +1 -0
  29. package/dist/kit/chunk-C3C7AYKL.js +1 -0
  30. package/dist/kit/chunk-C4KZYCPF.js +1 -0
  31. package/dist/kit/chunk-DFOWXOZR.js +1 -0
  32. package/dist/kit/chunk-DZ5XGHTJ.js +1 -0
  33. package/dist/kit/chunk-E3TUOX2A.js +1 -0
  34. package/dist/kit/chunk-ENTDGT2V.js +1 -0
  35. package/dist/kit/chunk-FR3ZJNOY.js +1 -0
  36. package/dist/kit/chunk-FUI5AVIF.js +1 -0
  37. package/dist/kit/chunk-G57QACJG.js +1 -0
  38. package/dist/kit/chunk-H2UZBVKE.js +1 -0
  39. package/dist/kit/chunk-HTUGMGVA.js +1 -0
  40. package/dist/kit/chunk-I4QVLLRQ.js +1 -0
  41. package/dist/kit/chunk-IPVN22ZM.js +1 -0
  42. package/dist/kit/chunk-IQTGJRDX.js +1 -0
  43. package/dist/kit/chunk-IUKSHYED.js +1 -0
  44. package/dist/kit/chunk-J2YZBT3N.js +1 -0
  45. package/dist/kit/chunk-K563CCOL.js +1 -0
  46. package/dist/kit/chunk-KWTF6Q5W.js +1 -0
  47. package/dist/kit/chunk-MGVPLQ3Z.js +1 -0
  48. package/dist/kit/chunk-MIZ2DUHU.js +1 -0
  49. package/dist/kit/chunk-MQJQIDO5.js +1 -0
  50. package/dist/kit/chunk-NURPDP3Y.js +1 -0
  51. package/dist/kit/chunk-O7SGY4YJ.js +1 -0
  52. package/dist/kit/chunk-OWEZV7TQ.js +1 -0
  53. package/dist/kit/chunk-PCIAA2LL.js +1 -0
  54. package/dist/kit/chunk-PFKYKAIP.js +1 -0
  55. package/dist/kit/chunk-PIU2BMFU.js +1 -0
  56. package/dist/kit/chunk-QALCXKU6.js +1 -0
  57. package/dist/kit/chunk-QRCXXS5Z.js +1 -0
  58. package/dist/kit/chunk-RFLIFKZ4.js +1 -0
  59. package/dist/kit/chunk-ROR6MG3K.js +1 -0
  60. package/dist/kit/chunk-S62H7ZIU.js +1 -0
  61. package/dist/kit/chunk-S7RZP2MT.js +1 -0
  62. package/dist/kit/chunk-SARCZMLN.js +1 -0
  63. package/dist/kit/chunk-SNCXU7KF.js +1 -0
  64. package/dist/kit/chunk-T3GWGPST.js +1 -0
  65. package/dist/kit/chunk-TTGMK4EA.js +1 -0
  66. package/dist/kit/chunk-UML6XQAR.js +1 -0
  67. package/dist/kit/chunk-UO7RB7RC.js +1 -0
  68. package/dist/kit/chunk-VC2ZQG63.js +1 -0
  69. package/dist/kit/chunk-VVW7LZT2.js +1 -0
  70. package/dist/kit/chunk-W2STAN6V.js +1 -0
  71. package/dist/kit/chunk-WJLZM3DR.js +1 -0
  72. package/dist/kit/chunk-XANKANGR.js +1 -0
  73. package/dist/kit/chunk-XB4DKPGL.js +1 -0
  74. package/dist/kit/chunk-XDKKCIIL.js +1 -0
  75. package/dist/kit/chunk-XM56OTYT.js +1 -0
  76. package/dist/kit/chunk-XPXMCXYI.js +1 -0
  77. package/dist/kit/chunk-YBRP6BFW.js +1 -0
  78. package/dist/kit/chunk-YCWMOTYH.js +1 -0
  79. package/dist/kit/chunk-ZCHGV2CV.js +1 -0
  80. package/dist/kit/chunk-ZRJVOUWH.js +1 -0
  81. package/dist/kit.cjs +1 -1
  82. package/dist/kit.js +1 -1
  83. package/dist/studio.cjs +1 -1
  84. package/dist/studio.js +1 -1
  85. package/package.json +2 -2
  86. package/skills/asciify-engine/SKILL.md +3 -3
  87. package/skills/asciify-engine/references/performance.md +30 -0
@@ -0,0 +1 @@
1
+ import{snapshot as t}from"./chunk-BNVRKD3V.js";import{hash as e,styleKeeper as a,mountSurface as n,handle as o,house as i,prefersReduced as s}from"./chunk-S7RZP2MT.js";var r={dissolve:300,condense:300},c=10,l=16,h=t=>.5-.5*Math.cos(Math.PI*Math.min(1,Math.max(0,t))),d=t=>i(Math.min(1,Math.max(0,t))),u=()=>{let t=()=>{};return[new Promise(e=>{t=e}),t]};function g(t,a,n,o,i,s=!1){const r=a.width,h=a.height,d=Math.ceil(r/c),u=Math.ceil(h/l),g=[],m=[],f=Math.max(...[[0,0],[r,0],[0,h],[r,h]].map(([t,e])=>Math.hypot(t-o.x,e-o.y)))||1,x=function(t,e,a){const n=p.get(t);if(n)return n;const o=Object.assign(document.createElement("canvas"),{width:e,height:a}),i=Object.assign(document.createElement("canvas"),{width:t.width,height:t.height}),s=o.getContext("2d"),r=i.getContext("2d"),c={mask:o,maskPen:s,data:s.createImageData(e,a),clip:i,clipPen:r};return p.set(t,c),c}(a,d,u),M=x.data.data;let w=0;for(let t=0;t<u;t++)for(let a=0;a<d;a++){const i=a*c,r=t*l,h=Math.hypot(i+5-o.x,r+8-o.y)/f*.72+.28*e(i,r),u=s?n-h-.12:h-n;M[4*(t*d+a)+3]=u>0?255:0,u>0&&w++,u>0&&u<.07?g.push([i,r]):u<=0&&u>-.12&&m.push([i,r,-u/.12])}if(w){x.maskPen.putImageData(x.data,0,0);const e=x.clipPen;e.globalCompositeOperation="source-over",e.clearRect(0,0,r,h),e.drawImage(a,0,0),e.globalCompositeOperation="destination-in",e.imageSmoothingEnabled=!1,e.drawImage(x.mask,0,0,d*c,u*l),e.globalCompositeOperation="source-over",t.drawImage(x.clip,0,0)}for(const[n,o,r]of m)t.globalAlpha=(1-r)*(s?.7:1),t.drawImage(a,n,o,c,l,n+18*(e(o,n+i)-.5)*r,o-10*r*(s?-.6:1),c,l);t.globalAlpha=1,t.globalCompositeOperation="lighter",t.globalAlpha=s?.5:1;for(const[e,n]of g)t.drawImage(a,e,n,c,l,e,n,c,l);t.globalAlpha=1,t.globalCompositeOperation="source-over"}var p=new WeakMap;function m(e,i={}){const c={current:{...r,...i}},l=a();let p=null,m=0,f=0,x=Promise.resolve(),M=0,w=null;const b="function"==typeof matchMedia&&matchMedia("(pointer: coarse)").matches?1:2,k=t=>{t.handed(),t.landing(),t.done()};w=n({host:e,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:8,cellAspect:.6,glyphScale:.9,contrast:1.15,shade:.55,...c.current.look}),ink:()=>c.current.ink??"--ascii-ink-strong",kit:{get current(){return{...c.current,poster:void 0}}},reducedMotion:()=>c.current.reducedMotion,resolution:b,onFail:()=>{w=null;const t=p;p=null,l.restore(),t&&k(t)},paint:({pen:t,width:e,height:a,now:n})=>{const o=p;if(!o)return!1;const i=n-o.start,s=i/o.outMs,r=o.next?(n-o.nextAt)/o.nextMs:0;var c;s<1&&g(t,o.out,1.12*h(s),o.at,++f),o.next&&r>0&&g(t,o.next,.1+1.14*(c=r,1-(1-Math.min(1,Math.max(0,c)))**2),o.at,f,!0);const l=o.next?(n-o.nextAt-o.nextMs+o.hand)/o.hand:-1,u=d(i/o.hand)*(1-d(l));u<1&&(t.globalAlpha=1-u,t.fillStyle="#000",t.fillRect(0,0,e,a),t.globalAlpha=1);const x=Math.round(-160*h(2*s)*(o.next?1-h(r):1))/1e3;return x!==m&&(m=x,w?.field.update({brightness:x})),0===o.stage&&i>=o.hand&&(o.stage=1,o.handed()),1===o.stage&&l>=0&&(o.stage=2,o.landing()),!(l>=1)||(p=null,o.done(),!1)}});const v=(t,a)=>{if(t&&"getBoundingClientRect"in t){const e=a.box(t);return{x:(e.x+e.w/2)*b,y:(e.y+e.h/2)*b}}return t?{x:t.x*b,y:t.y*b}:{x:e.offsetWidth/2*b,y:0}},y=a=>t(e,a.box,e.offsetWidth,e.offsetHeight,b,{skip:a.canvas}),A=(t,a)=>{for(const n of[...e.children].filter(t=>void 0===t.dataset.asciiKit&&void 0===t.dataset.asciiPoster))l.set(n,"transition",a?`opacity ${a}ms cubic-bezier(.16, 1, .3, 1)`:"none"),l.set(n,"opacity",t?"1":"0")},C=async(t,a)=>{const n=w;if(!n||(c.current.reducedMotion??s())||!n.live)return void await t();const{dissolve:o,condense:i}=c.current,r=Math.max(1,Math.min(110,o/2,i/2)),[h,d]=u(),[g,f]=u(),[x,M]=u(),b=p={at:v(a??c.current.origin,n),start:performance.now(),hand:r,out:y(n),outMs:Math.max(1,o),next:null,nextAt:0,nextMs:Math.max(1,i),handed:d,landing:f,done:M,stage:0};if(e.dataset.state="out",A(!1,r),n.kick(),await h,p===b){try{await t()}catch(t){throw p===b&&(p=null,l.restore(),w?.field.update({brightness:0})),t}w&&p===b&&(n.canvas.isConnected&&n.canvas.parentElement===e||e.appendChild(n.canvas),A(!1,0),e.dataset.state="in",b.next=y(n),b.nextAt=performance.now(),n.kick(),await g,p===b&&A(!0,r),await x,l.restore(),m=0,w?.field.update({brightness:0}),w?.kick())}};return o(()=>w,c,()=>w?.refresh(),{swap(t,a){M++;const n=x.then(()=>C(t,a)).finally(()=>{0===--M&&delete e.dataset.state});return x=n.catch(()=>{}),n},get busy(){return M>0}},()=>{const t=p;p=null,l.restore(),delete e.dataset.state,t&&k(t)})}var f=r;export{f as PAGE_DISSOLVE_DEFAULTS,g as dissolveFrame,m as pageDissolve};//# sourceMappingURL=chunk-WJLZM3DR.js.map
@@ -0,0 +1 @@
1
+ import{parseColor as t,hash2 as o}from"./chunk-ZCHGV2CV.js";import{mountCanvas as e}from"./chunk-BR6ZNJZW.js";import{mixHex as l}from"./chunk-S7RZP2MT.js";var r=1,i=2,n=4,f=8,c={3:"─",12:"│",9:"┌",10:"┐",5:"└",6:"┘",11:"┬",7:"┴",13:"├",14:"┤",15:"┼",[r]:"╶",[i]:"╴",[n]:"╵",[f]:"╷"};function a(e,l,r,i,n={}){const{fontSize:f=13,pulseColor:a="#ffffff",color:s="#00ff88",density:h=.38,speed:g=1,lightMode:p=!1}=n,u=.62*f,b=1.4*f,m=Math.ceil(l/u),M=Math.ceil(r/b),d=t(s)??{r:0,g:255,b:136},S=t(a)??{r:255,g:255,b:255},$=(t,e)=>{if(o(17*t+1,7*e+2)>h)return 0;let l=0;return t+1<m&&o(17*t+1,7*e+2)>.15&&(l|=1),t-1>=0&&o(17*(t-1)+1,7*e+2)>.15&&(l|=2),e+1<M&&o(17*t+1,7*(e+1)+2)>.15&&(l|=8),e-1>=0&&o(17*t+1,7*(e-1)+2)>.15&&(l|=4),l};e.clearRect(0,0,l,r),e.font=`${f}px "JetBrains Mono", monospace`,e.textBaseline="top";const C=i*g;for(let t=0;t<M;t++)for(let l=0;l<m;l++){const r=$(l,t);if(0===r)continue;const i=c[r]??"·",n=(8*C+40*o(l,23*t))%m,f=(6*C+40*o(17*t,11*l))%M,a=(1&r||2&r)&&Math.abs(l-n)<1.5,s=(4&r||8&r)&&Math.abs(t-f)<1.5,h=a||s,g=.25+.35*o(3*l,5*t);h?(e.globalAlpha=.95,e.fillStyle=`rgb(${S.r},${S.g},${S.b})`):(e.globalAlpha=g,e.fillStyle=`rgb(${d.r},${d.g},${d.b})`),e.fillText(i,l*u,t*b)}e.globalAlpha=1}var s={id:"circuit",name:"Circuit",description:"Circuit traces with signals running along them.",cellSize:13,speed:1,cursor:!1,mount:t=>e(t,(t,o,e,r,i,n)=>a(t,o,e,r,{fontSize:n.fontSize,chars:n.chars,lightMode:n.lightMode,color:n.ink,pulseColor:n.accent??l(n.ink,"#ffffff",.7)}))};export{s as circuit,a as renderCircuitBackground};//# sourceMappingURL=chunk-XANKANGR.js.map
@@ -0,0 +1 @@
1
+ import{parseColor as o,hash2 as t}from"./chunk-ZCHGV2CV.js";import{mountCanvas as l}from"./chunk-BR6ZNJZW.js";import{mixHex as e}from"./chunk-S7RZP2MT.js";function r(l,e,r,a,i={}){const{fontSize:n=13,baseChars:f="ATCG",bridgeChars:h="-=≡",color:c="#00e5ff",color2:s="#ff4081",bridgeColor:M="#88ffcc",speed:b=1,helixCount:g,lightMode:p=!1}=i,d=.62*n,m=1.4*n,u=Math.ceil(e/d),$=Math.ceil(r/m),x=g??Math.max(1,Math.floor(e/80)),C=u/x,S=o(c)??{r:0,g:229,b:255},k=o(s)??{r:255,g:64,b:129},A=o(M)??{r:136,g:255,b:204};l.clearRect(0,0,e,r),l.font=`${n}px "JetBrains Mono", monospace`,l.textBaseline="top";const T=a*b,z=.35*C;for(let o=0;o<x;o++){const e=C*(o+.5);for(let r=0;r<$;r++){const a=r/$*Math.PI*6-1.8*T,i=e+Math.sin(a)*z,n=e+Math.sin(a+Math.PI)*z,c=Math.round(i),s=Math.round(n);if(c<0||c>=u)continue;const M=t(31*o+7*r,3),b=f[Math.floor(M*f.length)],g=.5*(Math.sin(a)+1),p=.5*(Math.sin(a+Math.PI)+1);if(l.globalAlpha=.35+.65*g,l.fillStyle=`rgb(${S.r},${S.g},${S.b})`,l.fillText(b,c*d,r*m),s>=0&&s<u){const e=t(53*o+11*r,7),a=f[Math.floor(e*f.length)];l.globalAlpha=.35+.65*p,l.fillStyle=`rgb(${k.r},${k.g},${k.b})`,l.fillText(a,s*d,r*m)}if(r%3===0){const e=Math.min(c,s),a=Math.max(c,s);if(a-e>1){const i=t(17*r+43*o,5),n=h[Math.floor(i*h.length)],f=.25*(g+p)+.2;l.globalAlpha=f,l.fillStyle=`rgb(${A.r},${A.g},${A.b})`;for(let o=e+1;o<a;o++)l.fillText(n,o*d,r*m)}}}}l.globalAlpha=1}var a={id:"dna",name:"DNA",description:"Double helices scroll past with base-pair letters.",cellSize:13,speed:1,cursor:!1,mount:o=>l(o,(o,t,l,a,i,n)=>r(o,t,l,a,{fontSize:n.fontSize,color:n.ink,color2:n.accent??e(n.ink,"#ffffff",.55),bridgeColor:e(n.ink,"#0c0d0b",.35)}))};export{a as dna,r as renderDnaBackground};//# sourceMappingURL=chunk-XB4DKPGL.js.map
@@ -0,0 +1 @@
1
+ import{parseColor as t,hash2 as o}from"./chunk-ZCHGV2CV.js";import{mountCanvas as e}from"./chunk-BR6ZNJZW.js";function n(e,n,c,l,i={}){const{fontSize:r=13,chars:a="0123456789ABCDEF@#$&*+=/<>",accentColor:s,color:f,speed:h=1,density:g=.55,tailLength:d=14,lightMode:$=!1}=i,p=s??($?"#6b8700":"#d4ff00"),m=.62*r,u=1.4*r,M=Math.ceil(n/m),b=Math.ceil(c/u);e.clearRect(0,0,n,c),e.font=`${r}px monospace`,e.textBaseline="top";let C=255,S=255,x=255;if($&&(C=55,S=55,x=55),f){const o=t(f);o&&(C=o.r,S=o.g,x=o.b)}let z=212,k=255,y=0;const B=t(p);B&&(z=B.r,k=B.g,y=B.b);const R=b+d;for(let t=0;t<M;t++){if(o(17*t,3)>g)continue;const n=(.5+1.5*o(31*t,7))*h,c=o(13*t,11)*R,i=Math.floor((l*n*7+c)%R),r=t*m;for(let n=0;n<=d;n++){const c=i-(d-n);if(c<0||c>=b)continue;const s=c*u,f=o(53*t+Math.floor(5*l+n),7*c),h=a[Math.floor(f*a.length)],g=n/d;if(n===d)e.fillStyle=`rgba(${z},${k},${y},${$?.7:.85})`;else{const t=$?.85*g:.15*g;e.fillStyle=`rgba(${C},${S},${x},${t})`}e.fillText(h,r,s)}}}var c={id:"rain",name:"Rain",description:"Columns of falling characters with bright heads.",cellSize:13,speed:1,cursor:!1,mount:t=>e(t,(t,o,e,c,l,i)=>n(t,o,e,c,{fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};export{c as rain,n as renderRainBackground};//# sourceMappingURL=chunk-XDKKCIIL.js.map
@@ -0,0 +1 @@
1
+ import{MONO as t,GRAPHITE_LIGHT as e,GRAPHITE_DARK as o,pixelSnap as r,parseColor as n,band as c,ditherIndex as i,toneAlpha as a,vnoise as l}from"./chunk-ZCHGV2CV.js";import{mountCanvas as s}from"./chunk-BR6ZNJZW.js";function h(s,h,f,d,g={x:.5,y:.5},u={}){const{fontSize:m=13,chars:M=" .:-=+*#%@",accentColor:p,color:$,octaves:x=4,speed:S=1,scale:b=1,accentThreshold:y=.9,mouseWarp:z=.3,lightMode:C=!1}=u,k=Array.from(M),Z=.62*m,j=1.3*m,v=Math.ceil(h/Z),w=Math.ceil(f/j);s.clearRect(0,0,h,f),s.font=`${m}px ${t}`,s.textBaseline="top";const A=C?e:o;let B=A.r,N=A.g,R=A.b;const T=r(s);if($){const t=n($);t&&(B=t.r,N=t.g,R=t.b)}let V=B,W=N,q=R;const G=p?n(p):null;G&&(V=G.r,W=G.g,q=G.b);const H=.035*b,J=d*S,D=Math.min(6,Math.max(1,x)),E=(t,e)=>{let o=0,r=.5,n=1,c=0;for(let i=0;i<D;i++)o+=l(t*n,e*n)*r,c+=r,r*=.5,n*=2.1;return o/c};for(let t=0;t<w;t++)for(let e=0;e<v;e++){const o=e*H+.06*J,r=t*H*1.3-.04*J,n=e/v-g.x,l=t/w-g.y,h=Math.sqrt(n*n+l*l),f=z>0?.12*Math.max(0,1-h/z):0,d=E(o+f*Math.sin(1.3*J+8*l),r+f*Math.cos(.9*J+8*n)),m=c(.5*d+.5,.7,.83);if(m<=0)continue;const M=k[i(m,k.length,e,t,u.ditherStrength)];if(" "===M)continue;const p=!!G&&m>y,$=a(m);s.fillStyle=p?`rgba(${V},${W},${q},${$})`:`rgba(${B},${N},${R},${$})`,s.fillText(M,T(e*Z),T(t*j))}}var f={id:"noise",name:"Noise",description:"A slow fractal noise field that warps around the cursor.",cellSize:13,speed:.5,cursor:!0,mount:t=>s(t,(t,e,o,r,n,c)=>h(t,e,o,r,n,{ditherStrength:c.ditherStrength,fontSize:c.fontSize,chars:c.chars,lightMode:c.lightMode,color:c.ink,accentColor:c.accent}))};export{f as noise,h as renderNoiseBackground};//# sourceMappingURL=chunk-XM56OTYT.js.map
@@ -0,0 +1 @@
1
+ import{parseColor as t,GRAPHITE_LIGHT as o,GRAPHITE_DARK as e,pixelSnap as r,MONO as n,band as a,ditherIndex as c,toneAlpha as l}from"./chunk-ZCHGV2CV.js";function h(h,i,f,s,m,x={}){if(f<=0||s<=0)return;const M=Math.max(6,x.fontSize??12),u=.62*M,$=1.2*M,d=t(x.color??x.accentColor??"")??(x.lightMode?o:e),g=r(i),p=m*Math.max(0,x.speed??.35),C=f/s;i.clearRect(0,0,f,s),i.font=`${M}px ${n}`,i.textBaseline="top";const S=Array.from(x.chars||" .:-=+*#%@");for(let t=0;t<s;t+=$)for(let o=0;o<f;o+=u){const e=o/s,r=t/s,n=a(Math.min(1,Math.max(0,h(e,r,C,p))),.06,.72);if(n<=0)continue;const f=S[c(n,S.length,Math.round(o/u),Math.round(t/$),x.ditherStrength)];" "!==f&&(i.fillStyle=`rgba(${d.r},${d.g},${d.b},${l(n)})`,i.fillText(f,g(o),g(t)))}}export{h as renderMaterial};//# sourceMappingURL=chunk-XPXMCXYI.js.map
@@ -0,0 +1 @@
1
+ import{scenePreset as e}from"./chunk-C3C7AYKL.js";var r=e({id:"mesh",name:"Mesh",description:"Four soft lights on slow paths: a gradient mesh written in characters.",cellSize:11,scene:"mesh",charset:" .:-=+*#%@",hover:"trail"});export{r as mesh};//# sourceMappingURL=chunk-YBRP6BFW.js.map
@@ -0,0 +1 @@
1
+ import{mountSurface as t,house as e,styleKeeper as n,handle as r,clamp as o}from"./chunk-S7RZP2MT.js";var l={values:[],duration:560},a=.46,i=(t,e)=>e?Math.min(e-1,Math.max(0,Math.floor(t*e))):-1;function c(t,e){if(!e)return{bar:0,gap:0,left:0};const n=e<=7?.5:.6;let r=Math.max(1,Math.floor(t/e));for(;r>1&&e*r+(e-1)*Math.max(1,Math.round(r*n))>t;)r--;const o=e>1?Math.max(0,Math.min(Math.ceil(r*n*1.6),Math.floor((t-e*r)/(e-1)))):0;return{bar:r,gap:o,left:Math.max(0,Math.floor((t-e*r-(e-1)*o)/2))}}function s(s,h={}){const u={current:{...l,...h}};let d=u.current.values,m=null,f=[],p=0,M=!1,x=null,g=!1===u.current.intro?-1e9:performance.now(),v=[],b=[],w=[],k={cols:0,rows:0};const y=()=>u.current.values??[],E=()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:7,cellAspect:1,glyphScale:1.1,shade:.5,blend:"off",...u.current.look}),A=(t,e)=>{const{cellSize:n=7,maxPixelRatio:r=2}=E(),o=Math.min("number"==typeof devicePixelRatio&&devicePixelRatio>0?devicePixelRatio:1,r),l=Math.max(2,Math.round(n*o)),a=l/o,i=t=>{const e=Math.max(1,Math.floor(t*o/l));for(let t=e;t>1&&t>e-8;t--)if(Math.abs(t*a-Math.round(t*a))<.01)return t;return e},c=i(t),s=Math.max(2,i(e));return{cols:c,rows:s,cell:a,gw:Math.round(c*a),gh:Math.round(s*a)}};let L={left:0,cell:0};const C=(t,e)=>null===m?t===e-1?.8:a:t===m?.8:.3,$=(t,n)=>e((n-g-(b[t]??0))/u.current.duration),S=(t,e,n,r)=>{const l=((t,e,n,r)=>{const{bar:l,gap:a,left:i}=c(n,e.length),s=u.current.max??1.04*Math.max(...e,0),h=s>0?o(Math.max(0,e[t])/s)*(r-1):0,d=i+t*(l+a);return{x0:d,x1:d+l,h:h>0?Math.max(1,Math.round(h)):0}})(t,e,k.cols,k.rows);if(r)return l;const a=v[t]??{...l,h:0},i=$(t,n);return{x0:a.x0+(l.x0-a.x0)*i,x1:a.x1+(l.x1-a.x1)*i,h:a.h+(l.h-a.h)*i}};x=t({host:s,look:E,ink:()=>u.current.ink??"--ascii-ink-strong",kit:u,reducedMotion:()=>u.current.reducedMotion,resolution:(t,e)=>{const{cell:n}=A(t,e);return[Math.max(2,2*Math.round(t/n)),Math.max(4,2*Math.round(e/n))]},onFail:()=>{x=null},paint:({pen:t,width:n,height:r,now:l,still:i})=>{const c=(()=>{const t=x?.canvas;if(!t||!s.offsetWidth)return!1;const{gw:e,gh:n,cell:r}=A(s.offsetWidth,s.offsetHeight),o=Math.round((s.offsetWidth-e)/2),l=[`${o}px`,s.offsetHeight-n+"px",`${e}px`,`${n}px`];L={left:o,cell:r};let a=!1;return["left","top","width","height"].forEach((e,n)=>{t.style[e]!==l[n]&&(t.style[e]=l[n],a=!0)}),a&&x?.field.resize(),a})(),h=n/2,d=r/2;k={cols:h,rows:d};const m=y(),M=m.length,v=p?Math.min(64,l-p):16;p=l;const b=new Float32Array(h*d),E=(t,e,n)=>{const r=(d-1-e)*h+t;n>b[r]&&(b[r]=n)};for(let t=0;t<h;t++)E(t,0,.16);const R=({x0:t,x1:e,h:n},r)=>{if(n<=.01)return;const l=Math.ceil(n)-1;for(let a=Math.max(0,Math.floor(t));a<Math.min(h,Math.ceil(e));a++){const i=o(Math.min(a+1,e)-Math.max(a,t));for(let t=0;t<=l&&t<d-1;t++)E(a,t+1,(t===l?Math.min(1,r+.2):r)*i*o(n-t))}};let P=!1;const H=i?1:e((l-g)/u.current.duration);H<1&&(P=!0);for(const t of w)R({...t,h:t.h*(1-H)},a);H>=1&&(w=[]);for(let t=0;t<M;t++){!i&&$(t,l)<1&&(P=!0);const e=C(t,M),n=f[t]??e;f[t]=i?e:n+(e-n)*(1-Math.exp(-v/70)),Math.abs(f[t]-e)>.004&&(P=!0),R(S(t,m,l,i),f[t])}for(let e=0;e<b.length;e++){if(b[e]<=0)continue;const n=Math.round(255*b[e]);t.fillStyle=`rgb(${n} ${n} ${n})`,t.fillRect(e%h*2,2*Math.floor(e/h),2,2)}return c&&i&&x?.kick(),P||c}});const R=n(),P=x?null:document.createElement("div"),H=()=>{if(!P)return;const t=y(),e=t.length,n=u.current.max??1.04*Math.max(...t,0);P.replaceChildren(...t.map((t,r)=>{const l=document.createElement("div");return l.setAttribute("style",`flex:1 1 0;height:${n>0?(100*o(t/n)).toFixed(2):0}%;margin:0 ${e<=7?22:18}%;background:currentColor;opacity:${.9*(.16+.84*C(r,e))}`),l}))};P&&("static"===getComputedStyle(s).position&&R.set(s,"position","relative"),P.setAttribute("aria-hidden","true"),P.setAttribute("style","position:absolute;inset:0;display:flex;align-items:flex-end;pointer-events:none"),s.appendChild(P));const I=document.createElement("table");I.setAttribute("style","position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0");const W=()=>{const t=u.current.format??(t=>t.toLocaleString()),e=u.current.labels??[],n=document.createElement("tbody");y().forEach((r,o)=>{const l=document.createElement("tr"),a=document.createElement("th"),i=document.createElement("td");a.setAttribute("scope","row"),a.setAttribute("style","font-weight:inherit"),a.textContent=e[o]??String(o+1),i.textContent=t(r),l.appendChild(a),l.appendChild(i),n.appendChild(l)}),I.replaceChildren(n)};W(),s.appendChild(I);const z=!s.hasAttribute("tabindex"),F=!s.hasAttribute("role");z&&(s.tabIndex=0),F&&s.setAttribute("role","group");const O=t=>{const e=y().length,n=null!==t&&e?Math.min(e-1,Math.max(0,Math.round(t))):null;n!==m&&(m=n,x?.kick(),H(),u.current.onHover?.(m,null===m?null:y()[m],null===m?null:u.current.labels?.[m]??null))},X=t=>u.current.stagger??(t<=7?45:12),j=(t,n)=>{const r=y(),o=u.current.labels,l=performance.now(),i=!!x?.still(),c=k.cols&&!i?t.map((e,n)=>S(n,t,l,!1)):[],s=i?[]:w.map(t=>({...t,h:t.h*(1-e((l-g)/u.current.duration))})),h=new Map,m=(t,e,r)=>o&&n?r?.[t]??`#${t}`:"#"+(e-1-t);t.forEach((e,r)=>h.set(m(r,t.length,n),r));const p=new Set,M=f;let E=0;const A=r.length;v=r.map((t,e)=>{const n=h.get(m(e,A,o));return void 0!==n&&c[n]?(p.add(n),c[n]):null}),f=r.map((t,e)=>{const n=h.get(m(e,A,o));return void 0!==n?M[n]??a:a}),b=v.map(t=>t?0:E++*X(A)*.6),w=[...s,...c.filter((t,e)=>!p.has(e))].filter(t=>t.h>.01),d=r,g=l,x?.kick(),H()};H();const B=t=>{const e=s.getBoundingClientRect(),n=y().length;if(!e.width)return;const r=(t.clientX-e.left)/e.width,o=t.clientY-e.top;if(r<0||r>1||o<0||o>e.height)return void O(null);if(!k.cols)return void O(i(r,n));const{bar:l,gap:a,left:h}=c(k.cols,n);O(Math.round(((t.clientX-e.left-L.left)/L.cell-h-l/2)/Math.max(1,l+a)))},D=()=>O(null),G=t=>{const e=y().length,n="ArrowRight"===t.key?null===m?0:Math.min(e-1,m+1):"ArrowLeft"===t.key?null===m?e-1:Math.max(0,m-1):"Home"===t.key?0:"End"===t.key?e-1:"Escape"===t.key?null:void 0;void 0!==n&&e&&(t.preventDefault(),O(n))};s.addEventListener("pointermove",B),s.addEventListener("pointerdown",B),s.addEventListener("pointerleave",D),s.addEventListener("pointercancel",D),s.addEventListener("keydown",G),s.addEventListener("blur",D);const T="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{t?.isIntersecting&&!M&&(M=!0,!1!==u.current.intro&&(()=>{const t=y().length;d=y(),g=performance.now(),v=[],w=[],b=Array.from({length:t},(e,n)=>n*X(t)),f=y().map((t,e,n)=>C(e,n.length)),x?.kick(),H()})())},{threshold:.4}):null;T?.observe(s);let Y=u.current.labels;return r(()=>x,u,t=>{W(),t.values!==d&&(j(d,Y),Y=t.labels),x?.refresh()},{set(t,e){const n=d,r=Y;u.current={...u.current,values:[...t],...e?{labels:[...e]}:{}},Y=u.current.labels,null!==m&&m>=t.length&&O(null),W(),j(n,r)},highlight:O,get active(){return m},get values(){return y()}},()=>{T?.disconnect(),I.remove(),P?.remove(),R.restore(),s.removeEventListener("pointermove",B),s.removeEventListener("pointerdown",B),s.removeEventListener("pointerleave",D),s.removeEventListener("pointercancel",D),s.removeEventListener("keydown",G),s.removeEventListener("blur",D),z&&s.removeAttribute("tabindex"),F&&s.removeAttribute("role")})}var h=l;export{h as BLOCK_CHART_DEFAULTS,i as barAt,c as barLayout,s as blockChart};//# sourceMappingURL=chunk-YCWMOTYH.js.map
@@ -0,0 +1 @@
1
+ function n(n){const t=n.match(/^#([0-9a-f]{3,8})$/i)?.[1];if(t){const n=t.length<=4?t.split("").map(n=>parseInt(n+n,16)):[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];return{r:n[0],g:n[1],b:n[2]}}const r=n.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);return r?{r:+r[1],g:+r[2],b:+r[3]}:null}function t(n){return n*n*n*(n*(6*n-15)+10)}function r(n,t,r){return n+(t-n)*r}function o(n,t){let r=127*n+311*t;return r^=r>>13,(r*(r*r*15731+789221)+1376312589&2147483647)/2147483647}function a(n,a){const e=Math.floor(n),i=Math.floor(a),u=a-i,c=t(n-e),s=t(u),f=o(e,i),M=o(e+1,i),h=o(e,i+1),m=o(e+1,i+1);return r(r(f,M,c),r(h,m,c),s)}function e(n,t){return(.5*a(n,t)+.25*a(2.1*n,2.1*t)+.125*a(4.3*n,4.3*t))/.875}var i='"Geist Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace';function u(n){const t=("function"==typeof n.getTransform?n.getTransform().a:1)||1;return n=>Math.round(n*t)/t}var c={r:111,g:109,b:103},s={r:143,g:141,b:134};function f(n,t,r){return Math.min(1,Math.max(0,(n-t)/(r-t)))}function M(n,t=.3,r=.95){return t+(r-t)*Math.min(1,Math.max(0,n))}var h=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function m(n,t,r,o,a=0){const e=(h[(3&o)<<2|3&r]+.5)/16;return Math.min(t-1,Math.max(0,Math.floor(n*(t-1)+e*Math.min(1,Math.max(0,a)))))}export{s as GRAPHITE_DARK,c as GRAPHITE_LIGHT,i as MONO,f as band,m as ditherIndex,e as fbm,o as hash2,n as parseColor,u as pixelSnap,M as toneAlpha,a as vnoise};//# sourceMappingURL=chunk-ZCHGV2CV.js.map
@@ -0,0 +1 @@
1
+ import{styleKeeper as t,mountSurface as e,handle as n,hash as r,house as o}from"./chunk-S7RZP2MT.js";var a={duration:800,trigger:"visible",replayOnHover:!0,settle:"glyphs"};function i(t,e,n=.82){const o=t.getContext("2d");if(!o)return;const a=t.width,i=t.height,l=o.createImageData(a,i),c=t=>t*t*(3-2*t),s=(t,e)=>{const n=Math.floor(t),o=Math.floor(e),a=c(t-n),i=c(e-o),l=r(n,o),s=r(n+1,o),f=r(n,o+1);return l+(s-l)*a+(f-l)*i+(l-s-f+r(n+1,o+1))*a*i};for(let t=0;t<i;t++)for(let r=0;r<a;r++){const o=.6*s(r/6+2.4*e,t/3.5-.8*e)+.4*s(r/2.5-3*e,t/2),c=Math.min(1,2.4*(1-Math.hypot(2*(r/a-.5),2*(t/i-.5))*n)),f=.72*Math.max(0,o-.42)*Math.max(0,c)*255,g=4*(t*a+r);l.data[g]=l.data[g+1]=l.data[g+2]=f,l.data[g+3]=255}o.putImageData(l,0,0)}function l(l,c={}){const s={current:{...a,...c}},f=t(),g=document.createElement("canvas"),d=document.createElement("canvas");let h=-1,p="",u=!1,m=!1,x=null;const v=(t,e)=>{const n=`${t}x${e}:${s.current.text??""}:${l.textContent}`;if(n===p)return;p=n,g.width=t,g.height=e;const r=g.getContext("2d");r.fillStyle="#000",r.fillRect(0,0,t,e),void 0!==s.current.text?function(t,e,n,r,o){const a=getComputedStyle(e),i=n.split("\n");t.fillStyle="#fff",t.textAlign="center",t.textBaseline="middle";const l=(parseFloat(a.letterSpacing)||0)/(parseFloat(a.fontSize)||16),c=e=>{"letterSpacing"in t&&(t.letterSpacing=l*e+"px")};t.font=`${a.fontWeight} 100px ${a.fontFamily}`,c(0);const s=Math.max(1,...i.map(e=>t.measureText(e).width)),f=Math.min(.94*r/s*100,.9*o/i.length);t.font=`${a.fontWeight} ${f}px ${a.fontFamily}`,c(f),i.forEach((e,n)=>t.fillText(e,r/2,o/2+(n-(i.length-1)/2)*f*1.04))}(r,l,s.current.text,t,e):function(t,e,n,r){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),a=document.createRange();t.fillStyle="#fff",t.textAlign="left",t.textBaseline="alphabetic";for(let e=o.nextNode();e;e=o.nextNode()){const o=e.parentElement;if(!o)continue;const i=getComputedStyle(o);t.font=`${i.fontStyle} ${i.fontWeight} ${parseFloat(i.fontSize)*r}px ${i.fontFamily}`,"letterSpacing"in t&&(t.letterSpacing=(parseFloat(i.letterSpacing)||0)*r+"px");const l=t.measureText("Hg"),c=l.fontBoundingBoxAscent||parseFloat(i.fontSize)*r*.8,s=l.fontBoundingBoxDescent||parseFloat(i.fontSize)*r*.2,f="uppercase"===i.textTransform?t=>t.toUpperCase():"lowercase"===i.textTransform?t=>t.toLowerCase():t=>t;for(const o of e.data.matchAll(/\S+/g)){a.setStart(e,o.index),a.setEnd(e,o.index+o[0].length);const i=a.getClientRects()[0];if(!i)continue;const l=(i.top-n.top)*r,g=i.height*r;t.fillText(f(o[0]),(i.left-n.left)*r,l+(g-c-s)/2+c)}}a.detach?.()}(r,l,l.getBoundingClientRect(),t/(l.getBoundingClientRect().width||1))};x=e({host:l,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4.5,cellAspect:.62,glyphScale:.92,contrast:1.35,hover:"trail",trail:{strength:.6,radius:.2},...s.current.look}),ink:()=>s.current.ink??getComputedStyle(l).color,kit:s,reducedMotion:()=>s.current.reducedMotion,resolution:2,onFail:()=>{x=null,f.restore()},paint:({pen:t,width:e,height:n,now:a,still:l})=>{v(e,n);const c=s.current,f="text"===c.settle;if(h<0||l)return!(!m&&"visible"===c.trigger&&!l)&&(f&&h>=0||t.drawImage(g,0,0),h>=0&&S(),!1);const p=a-h,x=.3*c.duration,w=.7*c.duration,y=Math.max(2,Math.ceil(e/20)),M=Math.max(2,Math.ceil(n/20));if(d.width===y&&d.height===M||(d.width=y,d.height=M),i(d,p/1e3),t.imageSmoothingEnabled=!0,p<x)return t.drawImage(d,0,0,e,n),u&&(t.globalAlpha=1-o(p/x),t.drawImage(g,0,0),t.globalAlpha=1),!0;const b=Math.min(1,(p-x)/w),E=(1.18*b-.02)*e,k=.14*e,I=5.58,$=Math.floor(a/16);if(b>=1)return f||t.drawImage(g,0,0),S(),!1;t.drawImage(d,0,0,e,n),E>0&&t.drawImage(g,0,0,E,n,0,0,E,n);for(let e=Math.max(0,Math.floor(E/I)*I);e<E+k;e+=I){const o=(e-E)/k;for(let a=0;a<n;a+=9)r(e+13*$,a)<o||(t.globalAlpha=.35+.65*r(a+7*$,e),t.fillStyle="#000",t.fillRect(e,a,I,9),t.drawImage(g,e,a,I,9,e,a,I,9))}return t.globalAlpha=1,!0}});const S=()=>{h=-1,u="text"!==s.current.settle,u||f.restore()},w=()=>{x&&(f.set(l,"-webkit-text-fill-color","transparent"),m=!0,h=performance.now(),x.kick())};let y=!1;const M=x&&"visible"===s.current.trigger&&"function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{t.isIntersecting&&!y&&w(),y=t.isIntersecting},{threshold:.5}):null;x&&("text"!==s.current.settle&&f.set(l,"-webkit-text-fill-color","transparent"),u="text"!==s.current.settle&&"manual"===s.current.trigger,M?M.observe(l):"visible"===s.current.trigger&&w());let b=!1;const E=()=>{b||(b=!0,s.current.replayOnHover&&h<0&&w())},k=()=>{b=!1},I=t=>{!b||t.target instanceof Node&&l.contains(t.target)||(b=!1)};return x&&(l.addEventListener("pointerenter",E),l.addEventListener("pointermove",E),l.addEventListener("pointerleave",k),document.addEventListener("pointermove",I,!0)),x&&document.fonts?.ready.then(()=>{p="",x?.kick()}),n(()=>x,s,()=>{p="",x?.refresh()},{replay:w},()=>{M?.disconnect(),l.removeEventListener("pointerenter",E),l.removeEventListener("pointermove",E),l.removeEventListener("pointerleave",k),document.removeEventListener("pointermove",I,!0),f.restore()})}var c=a;export{c as DECODE_DEFAULTS,l as decode,i as driftNoise};//# sourceMappingURL=chunk-ZRJVOUWH.js.map