asciify-engine 4.26.1 → 4.27.1
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/CHANGELOG.md +10 -0
- package/dist/kit/{chunk-JELJEEJO.js → chunk-3YSK7V26.js} +1 -1
- package/dist/kit/{chunk-VIUEAEBX.js → chunk-4NV5APSJ.js} +1 -1
- package/dist/kit/{chunk-MJJSZS23.js → chunk-4U72YE65.js} +1 -1
- package/dist/kit/{chunk-7NVKRDKE.js → chunk-G4ZSMTFN.js} +1 -1
- package/dist/kit/{chunk-IBNDCKEX.js → chunk-HYVTFKWX.js} +1 -1
- package/dist/kit/{chunk-DCLJHSWM.js → chunk-OZFSNW5N.js} +1 -1
- package/dist/kit/chunk-PB5E3D4E.js +1 -0
- package/dist/kit/{chunk-VX2AD3M7.js → chunk-PGFBIU7R.js} +1 -1
- package/dist/kit/{chunk-MZFK765W.js → chunk-YSN7EHSH.js} +1 -1
- package/dist/kit.cjs +1 -1
- package/dist/kit.js +1 -1
- package/dist/studio-worker.js +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +1 -1
- package/package.json +2 -1
- package/skills/asciify-engine/SKILL.md +2 -2
- package/dist/kit/chunk-LE53AVKR.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
Notable changes to `asciify-engine`, newest first. Releases are published to [npm](https://www.npmjs.com/package/asciify-engine) from version tags.
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## 4.27.1
|
|
9
|
+
|
|
10
|
+
- Fixed: kit components drawing an `<img>` that uses `srcset` (compare, image accordion) took only the top-left part of the file, because `naturalWidth` is density-corrected while a source rectangle is read in file pixels. `drawCover` now places the whole image, so the before/after slider lines up across the divider.
|
|
11
|
+
## 4.27: Smooth dot looks and steady hover
|
|
12
|
+
|
|
13
|
+
- LED (Scoreboard), Dots and Stipple draw in one instanced GPU pass, like Pointillism, instead of thousands of Canvas 2D fills per frame: Scoreboard's hover costs 5 ms instead of 12, Lookbook goes from 93 to 120 fps. Output matches within the parity tolerance; frames mixing sub-pixel dots fall back to Canvas 2D exactly.
|
|
14
|
+
- Hover pacing steps down only when a look's own frames are late for several frames, ignores one-off stalls, and returns to full rate within a second (it used to wait up to 16 s). A new hover starts at full rate.
|
|
15
|
+
- `npm run bench:looks` fails a look whose hover cost regresses past its recorded budget.
|
|
6
16
|
## 4.26.1
|
|
7
17
|
|
|
8
18
|
- Fixed: the pill's hover sparkle could read a character before the start of its set (progress slightly below zero) and throw.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{snapshot as e}from"./chunk-
|
|
1
|
+
import{snapshot as e}from"./chunk-PB5E3D4E.js";import{styleKeeper as t,mountSurface as o,clamp as r,house as n}from"./chunk-GF72XM4C.js";var a={duration:620,collapse:!0,remove:!1},i=16,l=new WeakMap;function s(s,c={}){const d=l.get(s);if(d)return d;const h={...a,...c},p=t(),u=s.offsetHeight,g=()=>{for(const e of s.children)p.set(e,"opacity","0");p.set(s,"color","transparent"),p.set(s,"pointer-events","none"),s.setAttribute("aria-hidden","true")},f=e=>{h.collapse&&(p.set(s,"box-sizing","border-box"),p.set(s,"overflow","hidden"),p.set(s,"min-height","0"),p.set(s,"height",`${(u*(1-e)).toFixed(2)}px`),e>=1&&(p.set(s,"padding-block","0"),p.set(s,"margin-block","0"),p.set(s,"border-width","0")))},m=h.host??s.parentElement??s;let k=0,b=!1,w=null,v={x:0,y:0,w:0,h:0},x=()=>{};const y=o({host:m,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,contrast:1.6,drift:5,...h.look}),outset:i,resolution:2,ink:()=>h.ink??"--ascii-ink-strong",kit:{current:{lazy:!1,globalLook:h.globalLook}},reducedMotion:()=>h.reducedMotion,onFail:()=>x(),paint:({pen:e,now:t,still:o,scale:a})=>{if(o)return queueMicrotask(x),!1;if(!w||!b)return!1;const l=t-k,s=r(l/h.duration);e.setTransform(a,0,0,a,0,0),l>=300&&f(n(r((l-300)/260))),e.save(),e.globalAlpha=r(2.2*(1-s))*(1-.9*s*s),e.translate(8*s,-14*s),e.drawImage(w,0,0,w.width/2,w.height/2),e.globalCompositeOperation="destination-out";const c=v.x+v.w,d=c-(1.3*s-.3)*v.w,p=c-1.3*s*v.w,u=e.createLinearGradient(p,0,Math.max(p+1,d),0);u.addColorStop(0,"rgba(0,0,0,0)"),u.addColorStop(1,"rgba(0,0,0,1)"),e.globalAlpha=1,e.fillStyle=u,e.fillRect(v.x-i,v.y-i,v.w+32,v.h+32),e.restore();const g=l>=Math.max(h.duration,h.collapse?560:0);return g&&queueMicrotask(x),!g}}),M=new Promise(t=>{let o=!1;if(x=()=>{o||(o=!0,y?.destroy(),f(1),h.remove&&s.remove(),l.delete(s),t())},!y||y.still())return g(),void x();v=y.box(s),w=e(s,y.canvas.clientWidth||v.w+32,y.canvas.clientHeight||v.h+32,y.box).canvas;y.field.ready.then(()=>{o||b||(g(),b=!0,k=performance.now(),y.kick())},()=>{g(),x()})});return l.set(s,M),M}var c=a;export{c as DISINTEGRATE_DEFAULTS,s as disintegrate};//# sourceMappingURL=chunk-3YSK7V26.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{injectStyle as e}from"./chunk-
|
|
1
|
+
import{injectStyle as e}from"./chunk-PB5E3D4E.js";import{mountSurface as t,hash as n,handle as r,prefersReduced as i,clamp as o,house as a,smoothstep as s}from"./chunk-GF72XM4C.js";var l={caret:!0,settle:60,stagger:18,reasoningLines:2,transition:"flicker",roll:300,glyphs:"#%*+=-:"},c="cubic-bezier(.16, 1, .3, 1)",d=`\n:where(.ascii-reasoning){display:grid;grid-template-rows:1fr;transition:grid-template-rows 260ms ${c},opacity 200ms ${c}}\n:where(.ascii-reasoning[data-collapsed]){grid-template-rows:0fr;opacity:0}\n:where(.ascii-reasoning-in){min-height:0;overflow:hidden}\n:where(.ascii-reasoning ol){height:calc(var(--ascii-reasoning-lines, 2) * 1.5em);margin:0 0 .5em;padding:0;list-style:none;overflow:hidden;-webkit-mask-image:linear-gradient(to bottom,transparent,#000 45%);mask-image:linear-gradient(to bottom,transparent,#000 45%)}\n:where(.ascii-reasoning li){height:1.5em;line-height:1.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:.62;translate:0 calc(var(--ascii-reasoning-shift, 0) * -1.5em);transition:translate 240ms ${c},opacity 200ms ${c}}\n:where(.ascii-reasoning li[data-new]){opacity:0}\n@media (prefers-reduced-motion: reduce){:where(.ascii-reasoning, .ascii-reasoning li){transition:none}}\n`,p=.7,h=e=>[...e.children].filter(e=>"IMG"===e.tagName&&void 0!==e.dataset?.asciiPoster);function u(c,u={}){const m={current:{...l,...u}},g=[...c.childNodes];let f="idle",y="",x=[],w=null,v=0,b=null,k=null,M=null;const S=()=>{const e=getComputedStyle(c),t=parseFloat(e.fontSize)||15,n=parseFloat(e.lineHeight),r=Number.isFinite(n)&&n>0?n:1.5*t;return{size:t,line:r,ch:r/2,cw:Math.max(2,Math.round(.44*t))}},C="roll"===m.current.transition;let A=null,$=null;const E=e=>{f!==e&&(f=e,"done"!==e&&"stopped"!==e||(A?.setAttribute("data-collapsed",""),A?.setAttribute("aria-hidden","true")),"streaming"===e?c.setAttribute("aria-busy","true"):c.removeAttribute("aria-busy"),m.current.onState?.(e))},P=e=>{e.span.style.removeProperty("color"),e.span.style.removeProperty("opacity")},F=()=>{x.forEach(P),x=[],"streaming"===f&&b&&E("done"),b?.(),b=null};if(M=t({host:c,look:()=>{if(C){return{mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:S().size<24?2:3,cellAspect:.66,glyphScale:1,shade:.2,contrast:1.1,...m.current.look}}const{ch:e,cw:t}=S();return{mark:"glyph",charset:" :-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:e,cellAspect:t/e,glyphScale:1,shade:.6,...m.current.look}},ink:()=>m.current.ink??getComputedStyle(c).color,kit:m,reducedMotion:()=>m.current.reducedMotion,onFail:()=>{M=null,F()},resolution:C?2:1,paint:({pen:e,now:t,still:r,box:i,scale:l})=>{if(C)return((e,t,r,i,l)=>{const d=getComputedStyle(c),p=parseFloat(d.fontSize)||15,{line:h}=S(),u=`${d.fontStyle} ${d.fontWeight} ${d.fontSize} ${d.fontFamily}`;e.setTransform(l,0,0,l,0,0),e.textAlign="left",e.textBaseline="alphabetic",e.font=u;const g=e.measureText("x"),y=g.fontBoundingBoxAscent||.8*p,v=g.fontBoundingBoxDescent||.2*p;r&&(x.forEach(P),x=[]);const k=m.current;if(x=x.filter(r=>{if(t>=r.at)return P(r),!1;const l=o((t-r.from)/Math.max(1,r.at-r.from)),c=a(l),d=i(r.span);if(r.span.style.setProperty("opacity",s(.72,1,l).toFixed(3)),l<=0)return!0;const m=d.y+(d.h-h)/2,g=m+(h-y-v)/2+y,f=3+r.seed%3,x=[...Array.from({length:f},(e,t)=>k.glyphs[Math.floor(n(t,r.seed)*k.glyphs.length)]??""),r.span.textContent??""],w=(1-c)*(x.length-1)*h;return e.save(),e.beginPath(),e.rect(d.x-2,m,d.w+4,h),e.clip(),e.globalAlpha=1-s(.72,1,l),x.forEach((t,n)=>{const r=g+(n-(x.length-1))*h+w;if(r<m-h||r>m+2*h)return;const i=n===x.length-1;e.font=i?u:`600 ${.84*p}px "Geist Mono", ui-monospace, monospace`,e.fillStyle=i?"#fff":"#d0d0d0",e.fillText(t,d.x+(i?0:(d.w-e.measureText(t).width)/2),r)}),e.restore(),!0}),e.globalAlpha=1,!x.length&&b&&F(),k.caret&&"idle"!==f&&(w||"streaming"===f)){const n=x.find(e=>e.from>t),r=n?n.span.previousElementSibling:w,o=r?i(r):{x:0,y:0,w:0,h:h},a=o.y+(o.h-h)/2;e.fillStyle="streaming"===f?"#fff":"rgb(178.5 178.5 178.5)",e.fillRect(o.x+o.w+.18*p,a+.2*h,Math.max(2,.5*p),.6*h)}return x.length>0})(e,t,r,i,l);const{line:d,ch:h,cw:u,size:g}=S(),y=Math.floor(t/48),v=d/4,k=(t,n)=>{const r=Math.floor((t.y-v+t.h/2)/d)*d+v+(d-h)/2,i=Math.round(t.x/u),o=Math.round(255*n);e.fillStyle=`rgb(${o} ${o} ${o})`,e.fillRect(i*u,r,Math.max(1,Math.round((t.x+t.w)/u)-i)*u,h)};if(r&&(x.forEach(P),x=[]),x=x.filter(e=>t>=e.at?(P(e),!1):(k(i(e.span),.55+.45*n(y,e.seed)),!0)),!x.length&&b&&F(),m.current.caret&&"idle"!==f&&(w||"streaming"===f)){const e=w?i(w):{x:0,y:v,w:0,h:d},t=Math.round((e.x+e.w+.3*g)/u)*u;k({x:t,y:e.y,w:u,h:e.h},"streaming"===f?1:p)}return x.length>0}}),M){const e=getComputedStyle(c),t=M.canvas.style,n=e=>parseFloat(e??"")||0,{line:r}=S(),i=n(e.paddingTop)-r/4,o=n(e.paddingRight)-r/2,a=n(e.paddingBottom)-r/4,s=n(e.paddingLeft);t.top=`${i}px`,t.left=`${s}px`,t.width=`calc(100% - ${s+o}px)`,t.height=`calc(100% - ${i+a}px)`}return r(()=>M,m,()=>M?.refresh(),{write:e=>{if(!e)return;"streaming"!==f&&("idle"===f&&(c.replaceChildren(...h(c)),M&&c.appendChild(M.canvas)),k=null,E("streaming")),y+=e;const t=e=>c.appendChild(e);if(!M)return void t(document.createTextNode(e));const n=performance.now(),r=m.current,i=M.still();let o=0;for(const a of e.match(/\s+|\S/g)??[]){if(/^\s/.test(a)){t(document.createTextNode(a));continue}const e=document.createElement("span");if(e.textContent=a,!i)if(C){const t=x.length?x[x.length-1].from+r.stagger:n,i=Math.max(n,t);e.style.setProperty("opacity","0"),x.push({span:e,from:i,at:i+r.roll,seed:31*v+o})}else e.style.setProperty("color","transparent"),x.push({span:e,from:n,at:n+r.settle+o*r.stagger,seed:31*v+o});t(e),w=e,o++}v++,M.kick()},done:()=>k||("streaming"!==f?Promise.resolve():(k=new Promise(e=>{b=e}),M&&x.length?M.kick():F(),k)),stop(){if("idle"===f&&A)return k=null,E("stopped"),void M?.kick();"streaming"===f&&(x.forEach(P),x=[],E("stopped"),b?.(),b=null,M?.kick())},reasoning:t=>{if(!t||"undefined"==typeof document)return;if(!A||!$){e("ascii-kit-reasoning",d),A=document.createElement("div"),A.className="ascii-reasoning";const t=document.createElement("div");t.className="ascii-reasoning-in",$=document.createElement("ol"),t.appendChild($),A.appendChild(t),c.parentElement?.insertBefore(A,c)}A.removeAttribute("data-collapsed"),A.removeAttribute("aria-hidden");const n=Math.max(1,Math.round(m.current.reasoningLines));A.style.setProperty("--ascii-reasoning-lines",String(n));const r=document.createElement("li");r.textContent=t;const o=m.current.reducedMotion??i();o||r.setAttribute("data-new",""),$.appendChild(r);const a=A,s=String(Math.max(0,$.children.length-n));o?a.style.setProperty("--ascii-reasoning-shift",s):(getComputedStyle(r).translate,requestAnimationFrame(()=>{r.removeAttribute("data-new"),a.style.setProperty("--ascii-reasoning-shift",s)}))},reset(){x=[],y="",w=null,v=0,A?.remove(),A=$=null,b?.(),b=null,k=null,c.replaceChildren(...h(c)),M&&c.appendChild(M.canvas),E("idle"),M?.kick()},get state(){return f},get text(){return y}},()=>{b?.(),b=null,A?.remove(),A=$=null,c.removeAttribute("aria-busy"),y?c.textContent=y:c.replaceChildren(...g)})}var m=l;export{m as STREAM_TEXT_DEFAULTS,u as streamText};//# sourceMappingURL=chunk-4NV5APSJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{snapshot as e,drawCover as t,toneOf as n}from"./chunk-
|
|
1
|
+
import{snapshot as e,drawCover as t,toneOf as n}from"./chunk-PB5E3D4E.js";import{styleKeeper as r,srOnly as o,mountSurface as i,clamp as a,smoothstep as s,easeOut as l,handle as h}from"./chunk-GF72XM4C.js";var c={threshold:64},u=.3;function d(e,t,n=300,r=.86,o=.2){const i=2*Math.sqrt(n)*r,a=Math.max(1,Math.ceil(240*t)),s=t/a;for(let t=0;t<a;t++)e.v+=(-n*(e.x-e.to)-i*e.v)*s,e.x+=e.v*s;return!(Math.abs(e.x-e.to)<o&&Math.abs(e.v)<12*o)||(e.x=e.to,e.v=0,!1)}function p(p,f){const m={current:{...c,...f}},v=r(),g=()=>m.current.content??p.children[0]??null,y=o("",!0),w={x:0,v:0,to:0};let M="idle",x=!1,b=!1,k=0,E=-1,L=0,P=0,C=0,A=!0,S=0,I=null,T=[];const F=new WeakSet,R=e=>{y.textContent=e};I=i({host:p,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.94,...m.current.look}),ink:()=>m.current.ink??"--ascii-ink-strong",kit:m,reducedMotion:()=>m.current.reducedMotion,resolution:2,onFail:()=>{I=null},paint:({pen:r,w:o,now:i,still:h,scale:c,box:p})=>{const f=C?Math.min(1/30,(i-C)/1e3):1/60;C=i;let y=x;h?(w.x=w.to,w.v=0):x||(y=d(w,f)||y),"refreshing"===M&&(L+=6.5*f,y=!0),"done"===M&&i-P<320&&(y=!0);const b=g();b&&v.set(b,"translate",`0 ${Math.max(0,w.x).toFixed(2)}px`),r.setTransform(c,0,0,c,0,0);const k=m.current,E=Math.max(0,w.x),F=a(E/k.threshold),R=Math.min(k.threshold,48),q="idle"===M||"pulling"===M?s(.1,.55,F):a(E/R),D=o/2,Y=Math.min(E,R)/2+.25*Math.max(0,E-R);"pulling"===M&&F>=1&&!S&&(S=i),F<1&&(S=0);const H=S&&!h&&i-S<260?.14*Math.sin(Math.PI*((i-S)/260)):0;if(H&&(y=!0),E>.5&&q>.01){if(r.save(),r.beginPath(),r.rect(0,0,o,E),r.clip(),r.translate(D,Y),r.scale(q*(1+H),q*(1+H)),r.lineWidth=4,r.lineCap="round","idle"===M||"pulling"===M){const e=-Math.PI/2+.03*Math.max(0,E-k.threshold);r.strokeStyle=`rgba(255,255,255,${.55+.45*F})`,r.beginPath(),r.arc(0,0,11,e,e+2*Math.PI*Math.max(.02,F)),r.stroke()}else{const e="done"===M&&A?h?1:l((i-P)/300):0,t="refreshing"!==M||h?1:l((i-P)/240),n=24,o=2*Math.PI*(1-.22*t);for(let i=0;i<n;i++){const a=L-Math.PI/2+i/n*o,s=1-.85*t*(1-i/(n-1));r.strokeStyle=`rgba(255,255,255,${s*(1-e)*("done"!==M||A?1:.4)})`,r.beginPath(),r.arc(0,0,11,a,a+o/n+.02),r.stroke()}e>0&&function(e,t,n,r,o){if(o<=0)return;const i=[[-.82,.02],[-.26,.56],[.86,-.6]].map(([e,o])=>[t+e*r,n+o*r]),a=Math.hypot(i[1][0]-i[0][0],i[1][1]-i[0][1])+Math.hypot(i[2][0]-i[1][0],i[2][1]-i[1][1]);e.save(),e.strokeStyle="#fff",e.lineWidth=4.5,e.lineCap="round",e.lineJoin="round",e.setLineDash([a*o,a]),e.beginPath(),e.moveTo(i[0][0],i[0][1]),e.lineTo(i[1][0],i[1][1]),e.lineTo(i[2][0],i[2][1]),e.stroke(),e.restore()}(r,0,0,11,e)}r.restore()}return T=T.filter(o=>{if(!o.row.isConnected)return W(o,!0),!1;const a=h?1:(i-o.start)/760;if(a<0||!Number.isFinite(a))return y=y||Number.isFinite(a),!0;if(a>=u&&W(o),a>=1)return W(o,!0),!1;const s=p(o.row);(!o.snap||Math.abs(o.snap.width/2-s.w)>.5||Math.abs(o.snap.height/2-s.h)>.5)&&(o.snap=e(o.row,s.w,s.h,e=>{const t=p(e);return{x:t.x-s.x,y:t.y-s.y,w:t.w,h:t.h}}).canvas,o.photos=[...o.row.querySelectorAll("img")]);const c=o.snap;return o.photos.length&&function(e,r,o){const i=r.getContext("2d"),a=o(e.row);e.photos=e.photos.filter(e=>{if(!e.complete)return!0;if(!i||!e.naturalWidth)return!1;const r=o(e),s=r.x-a.x,l=r.y-a.y,h=Math.min(parseFloat(getComputedStyle(e).borderTopLeftRadius)||0,r.w/2,r.h/2);return i.save(),i.setTransform(2,0,0,2,0,0),i.beginPath(),i.roundRect(s,l,r.w,r.h,h),i.clip(),i.fillStyle="#000",i.fillRect(s,l,r.w,r.h),t(i,n({image:e,width:e.naturalWidth,height:e.naturalHeight},!I?.dark()),s,l,r.w,r.h),i.restore(),!1})}(o,c,p),r.globalAlpha=a<u?l(a/u,3):1-l((a-u)/.7,3),r.drawImage(c,s.x,s.y,s.w,s.h),r.globalAlpha=1,y=!0,!0}),y||(C=0),y}});const q=()=>I?.kick();function W(e,t=!1){const n=e.row.style;e.shown||(e.shown=!0,n.transition="opacity 280ms cubic-bezier(.16, 1, .3, 1)",n.opacity=e.opacity),t&&(n.transition=e.transition)}const D=(e,t)=>{if(I&&!I.still()){for(const n of e)n instanceof HTMLElement&&!F.has(n)&&(F.add(n),T.push({row:n,snap:null,start:t,opacity:n.style.opacity,transition:n.style.transition,shown:!1,photos:[...n.querySelectorAll("img")]}),n.style.transition="none",n.style.opacity="0");q()}},Y=()=>{const e=performance.now();T.forEach(t=>{t.start===1/0&&(t.start=e)}),q()},H=e=>new Promise(t=>setTimeout(t,e)),$=async()=>{if("refreshing"===M||"done"===M)return;const e=m.current,t=!I||I.still();M="refreshing",x=b=!1,w.to=Math.min(e.threshold,48),P=performance.now(),p.setAttribute("aria-busy","true"),R(e.messages?.refreshing??"Refreshing."),q(),A=!0;try{await Promise.all([e.onRefresh(),H(t?0:600)])}catch{A=!1}if("refreshing"===M){if(A&&e.reveal&&!t){await new Promise(e=>"function"==typeof requestAnimationFrame?requestAnimationFrame(()=>e()):e());const t=g();t&&D(t.querySelectorAll(e.reveal),1/0)}M="done",P=performance.now(),R(A?e.messages?.done??"Updated.":e.messages?.failed??"Couldn’t refresh."),q(),await H(t?0:620),"done"===M?(M="idle",w.to=0,Y(),p.removeAttribute("aria-busy"),q()):Y()}},j=e=>{0!==e.button||"idle"!==M||p.scrollTop>0||(x=!0,b=!1,k=e.clientY,E=e.pointerId)},z=e=>{if(!x||e.pointerId!==E)return;e.clientY<k&&(k=e.clientY);const t=(e.clientY-k)/(p.getBoundingClientRect().height/(p.clientHeight||1)||1);if(!b){if(t<6)return;b=!0,M="pulling";try{p.setPointerCapture?.(e.pointerId)}catch{}}w.x=w.to=(e=>128*(1-Math.exp(-Math.max(0,e)/128)))(t-6),w.v=0,q()},B=()=>{if(x&&(x=!1,b)){if(b=!1,w.x>=m.current.threshold)return M="idle",void $();M="idle",w.to=0,q()}},G=e=>{b&&e.preventDefault()},N=e=>{x&&e.preventDefault()};return I?(v.set(p,"overscroll-behavior-y","contain"),p.appendChild(y),p.addEventListener("pointerdown",j),p.addEventListener("pointermove",z),p.addEventListener("pointerup",B),p.addEventListener("pointercancel",B),p.addEventListener("touchmove",G,{passive:!1}),p.addEventListener("dragstart",N),p.addEventListener("selectstart",N)):p.appendChild(y),h(()=>I,m,()=>I?.refresh(),{refresh:$,revealRows:e=>D(e,performance.now()),get state(){return M}},()=>{M="idle",T.forEach(e=>{e.row.style.opacity=e.opacity,e.row.style.transition=e.transition}),T=[],p.removeEventListener("pointerdown",j),p.removeEventListener("pointermove",z),p.removeEventListener("pointerup",B),p.removeEventListener("pointercancel",B),p.removeEventListener("touchmove",G),p.removeEventListener("dragstart",N),p.removeEventListener("selectstart",N),p.removeAttribute("aria-busy"),y.remove(),v.restore()})}var f=c;export{f as PULL_REFRESH_DEFAULTS,p as pullRefresh,d as stepSpring};//# sourceMappingURL=chunk-4U72YE65.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{imageFor as e,drawCover as t,injectStyle as a,imageReady as n,toneOf as r}from"./chunk-
|
|
1
|
+
import{imageFor as e,drawCover as t,injectStyle as a,imageReady as n,toneOf as r}from"./chunk-PB5E3D4E.js";import{styleKeeper as i,clamp as o,mountSurface as c,smoothstep as s,handle as l,prefersReduced as p}from"./chunk-GF72XM4C.js";var d=e=>"string"==typeof e?{src:e}:e;function u(u,h){const m={current:{open:0,duration:420,label:"Images",...h}},f=i(),v=m.current.images.map(d);let x=o(Math.round(m.current.open),0,Math.max(0,v.length-1)),b=0,g=0;const w=v.map((e,t)=>({x:t===x?1:0,v:0})),y=v.map(()=>null),k=v.map(()=>null);let E=null;const A=v.map(t=>{const a=document.createElement("button");a.type="button",a.className="ascii-acc-panel",a.setAttribute("aria-label",[t.title??t.alt,t.meta].filter(Boolean).join(", ")||t.src);const n=e(t.src);if(n.className="ascii-acc-photo",n.alt="",n.draggable=!1,t.focus&&n.style.setProperty("object-position",`${100*t.focus.x}% ${100*t.focus.y}%`),a.appendChild(n),t.title||t.meta){const e=document.createElement("span");e.className="ascii-acc-caption",e.setAttribute("aria-hidden","true");for(const[a,n]of[["ascii-acc-title",t.title],["ascii-acc-meta",t.meta]]){if(!n)continue;const t=document.createElement("span");t.className=a,t.textContent=n,e.appendChild(t)}a.appendChild(e)}return a});function M(e,t){const a=b?Math.min(.064,(e-b)/1e3):1/60;b=e;const n=5/(Math.max(1,m.current.duration)/1e3),r=Math.max(1,Math.ceil(240*a)),i=a/r;let o=!1;return w.forEach((e,a)=>{const c=a===x?1:0;t&&(e.x=c,e.v=0);for(let t=0;t<r&&(e.x!==c||e.v);t++)e.v+=(-n*n*(e.x-c)-2*n*e.v)*i,e.x+=e.v*i;Math.abs(e.x-c)<.001&&Math.abs(e.v)<.01?(e.x=c,e.v=0):o=!0,L(A[a],e.x)}),o||(b=0),o}function L(e,t){const a=e.style;a.setProperty("--ascii-acc-open",t.toFixed(4)),a.setProperty("--ascii-acc-photo",(E?s(.15,.75,t):.45+.55*t).toFixed(3)),a.setProperty("--ascii-acc-caption",s(.6,1,t).toFixed(3))}E=c({host:u,layer:"under",look:()=>({blend:"coarse",mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.94,hover:"trail",trail:{strength:.5,radius:.25},...m.current.look}),ink:()=>m.current.ink??"--ascii-ink-strong",kit:m,reducedMotion:()=>m.current.reducedMotion,onFail:()=>{E=null,delete u.dataset.asciiField},onTheme:()=>{y.forEach((e,t)=>{k[t]=e&&E?r(e,!E.dark()):null}),E?.kick()},paint:({pen:e,still:a,now:n,box:r})=>{const i=M(n,a);return A.forEach((a,n)=>{const i=k[n],o=w[n].x,c=1-s(.45,.95,o);if(!i||c<=0)return;const l=r(a),p=parseFloat(getComputedStyle(a).borderTopLeftRadius)||0,d=1.04-.04*o;e.save(),e.beginPath(),e.roundRect(l.x,l.y,l.w,l.h,p),e.clip(),e.globalAlpha=c,t(e,i,l.x-l.w*(d-1)/2,l.y-l.h*(d-1)/2,l.w*d,l.h*d,v[n].focus?.x,v[n].focus?.y),e.restore()}),i}});const F=()=>{A.forEach((e,t)=>{e.setAttribute("aria-expanded",String(t===x)),e.tabIndex=t===x?0:-1})},C=(e,t=!1)=>{e=o(Math.round(e),0,A.length-1),t&&A[e]?.focus(),e!==x&&(x=e,F(),m.current.onChange?.(e),(()=>{if(E)return void E.kick();if(g||"function"!=typeof requestAnimationFrame)return void(g||M(performance.now(),!0));const e=t=>{g=M(t,!!(m.current.reducedMotion??p()))?requestAnimationFrame(e):0};g=requestAnimationFrame(e)})())};let P=0,S=0,j=0,T=0,q=0;const N=()=>{P&&clearTimeout(P),P=0},z=A.map((e,t)=>{const a=e=>{if("mouse"!==e.pointerType)return;const a=e.timeStamp||performance.now(),n=Math.max(1,a-j);if(T=j&&n<100?.5*T+Math.abs(e.clientX-S)/n*.5:0,S=e.clientX,j=a,q!==t&&N(),q=t,t!==x)return T<.3?(N(),void C(t)):void(P||(P=setTimeout(()=>{P=0,C(q)},90)));N()},n=()=>{N(),C(t)},r=()=>{e.matches(":focus-visible")&&C(t)},i=e=>{const a={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key],n="Home"===e.key?0:"End"===e.key?A.length-1:void 0!==a?(t+a+A.length)%A.length:null;null!==n&&(e.preventDefault(),C(n,!0))};return e.addEventListener("pointermove",a),e.addEventListener("pointerdown",n),e.addEventListener("click",n),e.addEventListener("focus",r),e.addEventListener("keydown",i),()=>{e.removeEventListener("pointermove",a),e.removeEventListener("pointerdown",n),e.removeEventListener("click",n),e.removeEventListener("focus",r),e.removeEventListener("keydown",i)}}),D=()=>{N(),j=0};u.addEventListener("pointerleave",D),a("ascii-kit-accordion",'\n:where([data-ascii-accordion]){display:flex;gap:6px}\n:where(.ascii-acc-panel){position:relative;flex:calc(1 + 3.2 * var(--ascii-acc-open, 0)) 1 0;min-width:0;margin:0;padding:0;border:0;border-radius:12px;overflow:hidden;background:transparent;color:#fff;font:inherit;text-align:left;cursor:pointer;-webkit-tap-highlight-color:transparent}\n:where(.ascii-acc-panel[aria-expanded="true"]){cursor:default}\n:where(.ascii-acc-photo){position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:var(--ascii-acc-photo, 0);scale:calc(1.04 - .04 * var(--ascii-acc-open, 0))}\n:where(.ascii-acc-caption){position:absolute;inset:auto 0 0;display:flex;color:#fff;flex-direction:column;gap:2px;padding:28px 12px 11px;background:linear-gradient(to top, rgb(0 0 0 / .62), transparent);white-space:nowrap;opacity:var(--ascii-acc-caption, 0);translate:0 calc(6px - 6px * var(--ascii-acc-caption, 0))}\n:where(.ascii-acc-title){font-size:15px;font-weight:500}\n:where(.ascii-acc-meta){font-size:14px;opacity:.8}\n'),u.dataset.asciiAccordion="",E&&(u.dataset.asciiField="");const R=u.getAttribute("role"),X=u.getAttribute("aria-label");return R||u.setAttribute("role","group"),X||u.setAttribute("aria-label",m.current.label),A.forEach((e,t)=>{L(e,w[t].x),u.appendChild(e)}),F(),A.forEach((e,t)=>{const a=e.querySelector("img");a&&n(a).then(e=>{y[t]=e,k[t]=E?r(e,!E.dark()):null,E?.kick()},()=>{})}),l(()=>E,m,e=>{X||u.setAttribute("aria-label",e.label),E?.refresh()},{select:C,get open(){return x}},()=>{z.forEach(e=>e()),N(),g&&cancelAnimationFrame(g),u.removeEventListener("pointerleave",D),A.forEach(e=>e.remove()),delete u.dataset.asciiAccordion,delete u.dataset.asciiField,R||u.removeAttribute("role"),X||u.removeAttribute("aria-label"),f.restore()})}export{u as accordion};//# sourceMappingURL=chunk-G4ZSMTFN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{injectStyle as e,imageReady as t,imageFor as n,drawCover as a}from"./chunk-
|
|
1
|
+
import{injectStyle as e,imageReady as t,imageFor as n,drawCover as a}from"./chunk-PB5E3D4E.js";import{srOnly as o,mountSurface as r,handle as i,isDark as l,clamp as s}from"./chunk-GF72XM4C.js";var c={maxBytes:10485760,develop:900};function d(e,t,n=Math.min(2,"number"==typeof devicePixelRatio&&devicePixelRatio>0?devicePixelRatio:1)){const a=Math.max(2,Math.round(6*n)),o=Math.max(2,Math.round(1*a)),r=(e,t)=>{const a=Math.floor(e*n/t);for(let e=a;e>1;e--){const o=e*t/n;if(Math.abs(o-Math.round(o))<.01||e<a-8)return{n:e,css:Math.round(o)}}return{n:1,css:Math.round(t/n)}},i=r(e,o),l=r(t,a);return{cols:i.n,rows:l.n,w:i.css,h:l.css,cw:o/n,ch:a/n}}function p(e,t,n,a){const{cols:o,rows:r}=t,i=e.createImageData(2*o,2*r),l=i.data,{tone:s,glow:c=0,phase:d=0,near:p=null}=a,h=Math.max(1,n/t.cw),u=Math.max(1,n/t.ch),m=o-2,f=r-2,g=Math.max(0,m-1-2*h),x=Math.max(0,f-1-2*u),v=Math.PI/4*(h+u),y=.45*Math.hypot(o,r);for(let e=0;e<r;e++)for(let t=0;t<o;t++){const n=Math.max(1+h-t,0,t-(m-h)),a=Math.max(1+u-e,0,e-(f-u));let r;if(n>0&&a>0){const e=Math.hypot(n/h,a/u);r=Math.hypot(n,a)*(1-1/e)}else r=-Math.min(t-1,m-t,e-1,f-e);let i=0;if(Math.abs(r)<.5){if(i=s,c>0){const o=t>m-h,r=e>f-u,l=t<1+h,p=e<1+u,y=(e,t)=>Math.atan2(e,t)/(Math.PI/2);let M;M=!p||l||o?p&&o?g+v*y(n/h,a/u):!o||p||r?r&&o?g+v+x+v*y(a/u,n/h):r&&!l?g+2*v+x+(m-h-t):r&&l?2*g+2*v+x+v*y(n/h,a/u):l&&!p?2*g+3*v+x+(f-u-e):2*g+3*v+2*x+v*y(a/u,n/h):g+v+(e-(1+u)):t-(1+h);const b=((M-d)%9+9)%9;i=s+c*(.2+.32*Math.max(0,1-Math.abs(b-4.5)/2.2))}}else if(c>0&&r<-.5&&r>-3.5){i=c*(1-(-r-.5)/3)**1.6*(.1+.32*(p?Math.max(0,1-Math.hypot(t-p.x,e-p.y)/y):.4))}const M=Math.round(255*Math.min(1,i));for(let n=0;n<4;n++){const a=4*((2*e+(n>>1))*o*2+2*t+(1&n));l[a]=l[a+1]=l[a+2]=M,l[a+3]=255}}e.putImageData(i,0,0)}function h(h,u={}){const m={current:{...c,...u}};let f="empty",g=null,x="",v="",y="image",M=0,b=0,w=!1,k=0,C=0,E=0,L=0,R=null,S=null,z=null,$=null,U=null;const j=o("",!0),O=["left","top","width","height"],P=()=>{const e=$?.canvas;if(!e||!h.offsetWidth)return null;const t="empty"===f?d(h.offsetWidth,h.offsetHeight):null,n=t?[`${Math.round((h.offsetWidth-t.w)/2)}px`,`${Math.round((h.offsetHeight-t.h)/2)}px`,`${t.w}px`,`${t.h}px`]:["0px","0px","100%","100%"];let a=!1;return O.forEach((t,o)=>{e.style[t]!==n[o]&&(e.style[t]=n[o],a=!0)}),U=t,a?($?.field.resize(),$?.kick(),null):t},D=document.createElement("input"),B=[j,D];let I=null;const G=!h.children.length;$=r({host:h,layer:"under",look:()=>"empty"===f?{mark:"glyph",charset:" .:+*#",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:1,glyphScale:.9,...m.current.look}:{blend:"coarse",mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,background:l(h)?"transparent":"#0b0b0a",color:"source",saturation:1.15,contrast:1.15,levels:"auto",brightness:.08,hover:"trail",trail:{strength:.6,radius:.3},...m.current.look},ink:e=>m.current.ink??`var(--ascii-ink, ${e?"#7a7872":"#76746e"})`,kit:m,reducedMotion:()=>m.current.reducedMotion,resolution:(e,t)=>"empty"===f&&U?[2*U.cols,2*U.rows]:[Math.max(1,Math.round(e)),Math.max(1,Math.round(t))],onFail:()=>{$=null,x&&A(x)},paint:({pen:e,w:t,h:n,now:o,still:r})=>{if("empty"!==f){if(!g)return!1;const i=r?1:s((o-M)/m.current.develop),l=1-(1-i)**2;return a(e,g,0,0,t,n),"developing"===f&&l<1&&function(e,t,n,a,o){const r=Math.max(Math.hypot(a.x,a.y),Math.hypot(t-a.x,a.y),Math.hypot(a.x,n-a.y),Math.hypot(t-a.x,n-a.y)),i=Math.max(24,.22*Math.min(t,n)),l=o*(r+i),s=Math.max(0,l-i),c=e.createRadialGradient(a.x,a.y,s,a.x,a.y,Math.max(s+1,l));c.addColorStop(0,"rgb(0 0 0 / 0)"),c.addColorStop(1,"rgb(0 0 0 / 1)"),e.globalCompositeOperation="source-over",e.fillStyle=c,e.fillRect(0,0,t,n);const d=e.createRadialGradient(a.x,a.y,s,a.x,a.y,Math.max(s+1,l)),p=1-o*o;d.addColorStop(0,"rgb(255 255 255 / 0)"),d.addColorStop(.55,`rgb(255 255 255 / ${.5*p})`),d.addColorStop(1,"rgb(255 255 255 / 0)"),e.globalCompositeOperation="lighter",e.fillStyle=d,e.fillRect(0,0,t,n),e.globalCompositeOperation="source-over"}(e,t,n,z??{x:t/2,y:n/2},l),i>=1&&"developing"===f&&N(),i<1}const i=E?Math.min(64,o-E):16;E=o;const l=w?1:0;C=r?l:C+(l-C)*(1-Math.exp(-i/90)),!r&&C>.004&&(L+=i/1e3*14);const c=Math.max(4,(parseFloat(getComputedStyle(h).borderTopLeftRadius)||16)-6),d=P();if(d){const t=$.canvas.getBoundingClientRect(),n=S&&t.width?{x:(S.x-t.left)/t.width*d.cols,y:(S.y-t.top)/t.height*d.rows}:null;p(e,d,c,{tone:.3,glow:C,phase:L,near:n})}const u=!r&&(w||Math.abs(l-C)>.004);return u||(E=0),u}});const W=e=>{const t=f;f=e,h.dataset.state=e,"empty"===t!=("empty"===e)&&(P(),$?.refresh()),t!==e&&m.current.onState?.(e,"empty"===e?"":y)},N=()=>{W("done"),j.textContent=`${y} ready`,g&&m.current.onImage?.({file:R,src:x,width:g.width,height:g.height})};function A(e){I??(I=Object.assign(document.createElement("img"),{className:"ascii-drop-img",alt:""})),I.src=e,I.parentElement!==h&&(h.prepend(I),B.push(I))}const F=async(e,a=null,o=null)=>{const r=++b;let i;z=o,v&&URL.revokeObjectURL(v),v="string"==typeof e?"":URL.createObjectURL(e),x=v||e,R=a??("undefined"!=typeof File&&e instanceof File?e:null),y=R?.name??("string"==typeof e&&e.split("/").pop()?.split("?")[0]||"image"),j.textContent=`Converting ${y}`;try{i=await t(n(x))}catch{return void(r===b&&(j.textContent=`Could not load ${y}`))}if(r===b){if(g=i,!$)return A(x),W("done"),void N();M=performance.now(),W($.still()?"done":"developing"),$.field.pulse({strength:1}),$.kick(),"done"===f&&N()}},T=(e,t=null)=>{const n=t=>{j.textContent=t,m.current.onError?.(t,e)};return e.type.startsWith("image/")?e.size>m.current.maxBytes?n(`${e.name} is over ${Math.round(m.current.maxBytes/1024/1024)} MB.`):void F(e,e,t):n(`${e.name} isn’t an image.`)},X=()=>{b++,g=null,x="",R=null,v&&URL.revokeObjectURL(v),v="",I?.remove(),W("empty"),j.textContent="",$?.kick()},Y=()=>D.click(),H=e=>new Promise(t=>{const n=$?.field;if(!n||!g||"done"!==f)return void t(null);const a=document.createElement("canvas");a.width=n.canvas.width,a.height=n.canvas.height;const o=a.getContext("2d");o?(o.fillStyle=getComputedStyle(h).backgroundColor||"#000",o.fillRect(0,0,a.width,a.height),n.redraw(),o.drawImage(n.canvas,0,0),a.toBlob(n=>{if(n){const t=document.createElement("a");t.href=URL.createObjectURL(n),t.download=e??m.current.filename??`${y.replace(/\.[^.]+$/,"")}-ascii.png`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),1e3)}t(n)},"image/png")):t(null)}),J=()=>{E=0,$?.kick()},q=e=>{e.preventDefault(),k++,S={x:e.clientX,y:e.clientY},w||(w=!0,h.dataset.over="",J())},K=e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),S={x:e.clientX,y:e.clientY}},Q=()=>{k=Math.max(0,k-1),!k&&w&&(w=!1,S=null,delete h.dataset.over,J())},V=e=>{e.preventDefault(),k=0,w=!1,S=null,delete h.dataset.over;const t=h.getBoundingClientRect(),n={x:e.clientX-t.left,y:e.clientY-t.top};$?.field.pulse({...n,strength:1});const a=e.dataTransfer?.files?.[0];a?T(a,n):J()},Z=e=>{const t=e.target?.closest?.("[data-dropzone]")?.getAttribute("data-dropzone");"pick"===t?Y():"clear"===t?X():"download"===t&&H()},_=()=>{const e=D.files?.[0];D.value="",e&&T(e)};e("ascii-kit-dropzone",'\n:where(.ascii-drop-empty){position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;height:100%;min-height:inherit;padding:24px;box-sizing:border-box;text-align:center}\n:where([data-ascii-dropzone]:not([data-state="empty"])) :where(.ascii-drop-empty){display:none}\n:where(.ascii-drop-title){margin:0;font-weight:500}\n:where(.ascii-drop-hint){margin:0;font-size:14px;opacity:.65}\n:where(.ascii-drop-pick){margin-top:8px;height:34px;padding:0 14px;border:0;border-radius:999px;background:currentColor;font:inherit;font-size:14px;cursor:pointer}\n:where(.ascii-drop-pick) > span{color:Canvas}\n:where(.ascii-drop-img){position:absolute;inset:0;width:100%;height:100%;object-fit:cover}\n'),h.dataset.asciiDropzone="",D.type="file",D.accept="image/*",D.tabIndex=-1,D.hidden=!0,D.setAttribute("aria-hidden","true"),G&&B.push(function(){const e=document.createElement("div"),t=document.createElement("p"),n=document.createElement("p"),a=document.createElement("button"),o=document.createElement("span");return e.className="ascii-drop-empty",t.className="ascii-drop-title",t.textContent="Drop an image",n.className="ascii-drop-hint",n.textContent="PNG, JPG or WebP",a.type="button",a.className="ascii-drop-pick",a.dataset.dropzone="pick",o.textContent="Choose file",a.appendChild(o),e.append(t,n,a),e}());for(const e of B)h.appendChild(e);return W("empty"),h.addEventListener("dragenter",q),h.addEventListener("dragover",K),h.addEventListener("dragleave",Q),h.addEventListener("drop",V),h.addEventListener("click",Z),D.addEventListener("change",_),i(()=>$,m,()=>$?.refresh(),{setImage:e=>F(e),clear:X,pick:Y,download:H,get state(){return f}},()=>{b++,v&&URL.revokeObjectURL(v),h.removeEventListener("dragenter",q),h.removeEventListener("dragover",K),h.removeEventListener("dragleave",Q),h.removeEventListener("drop",V),h.removeEventListener("click",Z),D.removeEventListener("change",_),B.forEach(e=>e.remove()),delete h.dataset.asciiDropzone,delete h.dataset.state,delete h.dataset.over})}var u=c;export{u as DROPZONE_DEFAULTS,h as dropzone,p as paintRing,d as ringGrid};//# sourceMappingURL=chunk-HYVTFKWX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{injectStyle as t,drawBlocks as e,snapshot as n,blocksOf as o}from"./chunk-LE53AVKR.js";import{clamp as i,styleKeeper as a,srOnly as r,mountSurface as s,house as c,hash as d,handle as l,hexRgb as p,resolveColor as m,isDark as h}from"./chunk-GF72XM4C.js";var u={max:3,duration:6e3,label:"Notifications",swipe:!0},f="cubic-bezier(.16, 1, .3, 1)",x=`\n:where(.ascii-toasts){position:relative;margin:0;padding:0;list-style:none;min-height:52px}\n:where(.ascii-toast){position:absolute;left:0;right:0;bottom:0;box-sizing:border-box;display:flex;align-items:center;gap:10px;min-height:52px;padding:8px 8px 8px 10px;border-radius:14px;background:var(--ascii-toast-bg,Canvas);color:var(--ascii-toast-ink,CanvasText);box-shadow:var(--ascii-toast-shadow,0 1px 2px rgb(0 0 0 / .06),0 10px 28px -10px rgb(0 0 0 / .22));z-index:calc(10 - var(--d,0));transform-origin:50% 0;translate:0 calc(var(--d,0) * -12px);scale:calc(1 - var(--d,0) * .05);touch-action:pan-y;transition:translate 380ms ${f},scale 380ms ${f},opacity 220ms ${f},transform 300ms ${f},filter 380ms ${f}}\n:where(.ascii-toast)::after{content:"";position:absolute;left:0;right:0;top:100%;height:10px}\n:where(.ascii-toast) > *{transition:opacity 200ms ${f}}\n:where(.ascii-toast[data-back]) > *{opacity:0}\n:where(.ascii-toasts:not([data-open])) :where(.ascii-toast[data-back]){filter:brightness(calc(1 - var(--d,0) * .04))}\n:where(.ascii-toasts:not([data-open])) :where(.ascii-toast[data-back]) > *{pointer-events:none}\n:where(.ascii-toasts[data-open]) :where(.ascii-toast){translate:0 calc(var(--d,0) * (-100% - 8px));scale:1}\n:where(.ascii-toasts[data-open]) :where(.ascii-toast[data-back]) > *{opacity:1}\n:where(.ascii-toast[data-forming]){animation:ascii-toast-in 420ms ${f} both}\n:where(.ascii-toast[data-forming],.ascii-toast[data-gone]) > *{opacity:0;transition:none}\n:where(.ascii-toast[data-gone]){opacity:0;scale:.97;pointer-events:none}\n:where(.ascii-toast[data-swiping]){transition:translate 380ms ${f},scale 380ms ${f},opacity 220ms ${f}}\n@keyframes ascii-toast-in{from{opacity:0;translate:0 14px}}\n:where(.ascii-toast-icon){display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:9px;background:rgb(128 128 128 / .14)}\n:where(.ascii-toast-text){display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}\n:where(.ascii-toast-title){overflow:hidden;font-size:14px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}\n:where(.ascii-toast-body){overflow:hidden;font-size:13px;opacity:.68;text-overflow:ellipsis;white-space:nowrap}\n:where(.ascii-toast-action,.ascii-toast-close){flex:none;border:0;background:rgb(128 128 128 / .14);color:inherit;font:inherit;cursor:pointer}\n:where(.ascii-toast-action){height:32px;padding:0 12px;border-radius:999px;font-size:14px;font-weight:500}\n:where(.ascii-toast-close){display:grid;place-items:center;width:28px;height:28px;border-radius:999px;background:transparent;font-size:18px;line-height:1;opacity:.6}\n@media (prefers-reduced-motion:reduce){:where(.ascii-toast){transition:none}:where(.ascii-toast[data-forming]){animation:none}}\n`,g=t=>{const[e,n,o]=p(t).map(t=>{const e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4});return.2126*e+.7152*n+.0722*o};function b(t,e){const n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?/i.exec(t.trim());if(!n)return!1;if(!((void 0===n[4]?1:n[4].endsWith("%")?parseFloat(n[4])/100:parseFloat(n[4]))>=.5))return!1;const o=`#${[n[1],n[2],n[3]].map(t=>Math.round(i(+t,0,255)).toString(16).padStart(2,"0")).join("")}`,[a,r]=[g(o),g(e)].sort((t,e)=>e-t);return(a+.05)/(r+.05)<3}function v(p,f={}){const g={current:{...u,...f}},v=a(),w=document.createElement("ol"),y=r("",!1);y.setAttribute("role","status");let k=[],E=[],C=0,L=!1,$=!1,M=!1,P=!1,T=null;const z=[];t("ascii-kit-toast",x),w.className="ascii-toasts",w.setAttribute("aria-label",g.current.label),p.append(w,y);const S=new WeakSet,A=t=>{delete t.dataset.forming,S.delete(t)&&(t.style.removeProperty("transition"),t.style.removeProperty("background-color"),t.style.removeProperty("box-shadow"))};T=s({host:p,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...g.current.look}),outset:24,resolution:2,ink:()=>g.current.ink??"--ascii-ink-strong",kit:g,reducedMotion:()=>g.current.reducedMotion,onFail:()=>{T=null,E=[];for(const t of k)A(t.node)},paint:({pen:t,now:n,scale:o,still:a,box:r})=>(t.setTransform(o,0,0,o,0,0),E=E.filter(o=>{const a=(n-o.start)/o.ms;if(o.form&&a>=.62&&A(o.node),a>=1)return!1;if(o.form)e(t,o.snap,o.blocks,o.order,1.04*c(a),(t,e)=>[70*(t.seed-.5)*e,(14+26*d(t.x,t.y))*e],1-i((a-.62)/.28));else{const n=o.dir;e(t,o.snap,o.blocks,o.order,1-1.04*(1-(1-a)**3),(t,e)=>[n*(14+34*t.seed+.5*Math.abs(o.throw))*e,14*(d(t.y,t.x)-.35)*e],1-i((a-.75)/.25))}return!0}),E.length>0)}),T&&(T.canvas.style.zIndex="11");const F=()=>!!T&&T.live&&!T.still(),I=()=>{const t=k.filter(t=>void 0===t.node.dataset.gone);t.forEach((e,n)=>{const o=t.length-1-n;v.set(e.node,"--d",String(o)),0===o?(e.node.dataset.front="",delete e.node.dataset.back):(e.node.dataset.back="",delete e.node.dataset.front)})},W=(t,e,i=0)=>{if(!T)return;const a=T.canvas.clientWidth||p.clientWidth+48,r=T.canvas.clientHeight||p.clientHeight+48,s=n(t,a,r,T.box),c=o(s.rects),d=Math.max(1,...c.map(t=>t.x)),l=i<0?-1:1,m=l>0?t=>t.x/d:t=>1-t.x/d,h=Float32Array.from(c,t=>e?t.x/d*.3+.7*t.seed:.62*m(t)+.38*t.seed);E.push({start:performance.now(),ms:e?340:440,snap:s.canvas,blocks:c,order:h,form:e,node:t,dir:l,throw:i}),T.kick()},X=t=>{t.timer&&clearTimeout(t.timer),t.timer=0,L||t.left<=0||(t.since=performance.now(),t.timer=setTimeout(()=>K(t.id),t.left))},j=()=>(t=>{if(t!==L){L=t,t?w.dataset.open="":delete w.dataset.open;for(const e of k)t&&e.timer&&(clearTimeout(e.timer),e.timer=0,e.left=Math.max(400,e.left-(performance.now()-e.since))),t||X(e)}})($||M),N=()=>{$=!0,j()},G=()=>{$=!1,j()},H=()=>{M=!0,j()},D=t=>{w.contains(t.relatedTarget)||(M=!1,j())};function K(t,e=0){const n=k.find(e=>e.id===t);if(!n||void 0!==n.node.dataset.gone)return;n.timer&&clearTimeout(n.timer);const o=()=>{k=k.filter(t=>t!==n),E=E.filter(t=>t.node!==n.node),n.node.remove(),I(),T?.kick(),k.some(t=>void 0===t.node.dataset.gone)||($=M=!1,j())},i=k[k.length-1]===n;F()&&(i||L||e)?(A(n.node),W(n.node,!1,e),n.node.dataset.gone="",I(),z.push(setTimeout(o,220))):o()}w.addEventListener("pointerenter",N),w.addEventListener("pointerleave",G),w.addEventListener("focusin",H),w.addEventListener("focusout",D);let R=null;const V=t=>{if(!g.current.swipe||0!==t.button||R)return;const e=t.target;if(e?.closest?.('button, a, input, textarea, select, [role="button"]'))return;const n=e?.closest?.("[data-toast]"),o=n&&k.find(t=>t.node===n);o&&void 0===n.dataset.gone&&void 0===n.dataset.forming&&(R={item:o,id:t.pointerId,x0:t.clientX,dx:0,t:performance.now(),v:0},n.dataset.swiping="",n.setPointerCapture?.(t.pointerId))},q=t=>{if(!R||t.pointerId!==R.id)return;const e=performance.now(),n=t.clientX-R.x0;R.v=(n-R.dx)/Math.max(1,e-R.t),R.dx=n,R.t=e,R.item.node.style.setProperty("transform",`translateX(${n}px)`),R.item.node.style.setProperty("opacity",String(i(1-Math.abs(n)/260,.2)))},B=t=>{if(!R||t.pointerId!==R.id)return;const{item:e,dx:n}=R,o=e.node,i=performance.now()-R.t>90?0:R.v;R=null,delete o.dataset.swiping;const a=Math.abs(n)>64||Math.abs(i)>.45&&Math.abs(n)>8;o.style.removeProperty("opacity"),a?(K(e.id,n||i),o.style.setProperty("transform",`translateX(${n+48*Math.sign(n||i)}px)`)):o.style.removeProperty("transform")};w.addEventListener("pointerdown",V),w.addEventListener("pointermove",q),w.addEventListener("pointerup",B),w.addEventListener("pointercancel",B);return l(()=>T,g,t=>{w.setAttribute("aria-label",t.label),T?.refresh()},{push:t=>{if(P)return-1;const e=++C,n=k.filter(t=>void 0===t.node.dataset.gone),o=n.length+1-Math.max(1,g.current.max);o>0&&n.slice(0,o).forEach(t=>K(t.id));const i=g.current.render?g.current.render(t,e):function(t,e){const n=(t,e,n)=>{const o=document.createElement(t);return o.className=e,n&&(o.dataset.paint=n),o},o=n("li","ascii-toast");if(void 0!==t.icon){const e=n("span","ascii-toast-icon","tile");e.setAttribute("aria-hidden","true"),"string"==typeof t.icon?e.textContent=t.icon:e.appendChild(t.icon),o.appendChild(e)}const i=n("span","ascii-toast-text"),a=n("b","ascii-toast-title","strong");if(a.textContent=t.title,i.appendChild(a),t.body){const e=n("span","ascii-toast-body","meta");e.textContent=t.body,i.appendChild(e)}if(o.appendChild(i),t.action){const{label:i,onClick:a}=t.action,r=n("button","ascii-toast-action","text");r.type="button",r.textContent=i,r.addEventListener("click",()=>{a(),e()}),o.appendChild(r)}const r=n("button","ascii-toast-close","none");return r.type="button",r.setAttribute("aria-label",`Dismiss ${t.title}`),r.textContent="×",r.addEventListener("click",e),o.appendChild(r),o}(t,()=>K(e));i.dataset.toast=String(e);const a={id:e,node:i,timer:0,left:t.duration??g.current.duration,since:0,born:performance.now()};return k.push(a),w.appendChild(i),I(),y.textContent=t.body?`${t.title}. ${t.body}`:t.title,F()?(i.dataset.forming="",(t=>{const e=m(g.current.ink??"--ascii-ink-strong",p,h(p)?"#d8d6cf":"#1d1d1b");e&&b(getComputedStyle(t).backgroundColor,e)&&(S.add(t),t.style.setProperty("transition","none","important"),t.style.setProperty("background-color","transparent","important"),t.style.setProperty("box-shadow","none","important"))})(i),W(i,!0)):T?.kick(),X(a),e},dismiss:t=>K(t),clear(){[...k].forEach(t=>K(t.id))},get toasts(){return k.filter(t=>void 0===t.node.dataset.gone).map(t=>t.id)}},()=>{P=!0;for(const t of k)t.timer&&clearTimeout(t.timer);z.forEach(clearTimeout),w.removeEventListener("pointerenter",N),w.removeEventListener("pointerleave",G),w.removeEventListener("focusin",H),w.removeEventListener("focusout",D),w.removeEventListener("pointerdown",V),w.removeEventListener("pointermove",q),w.removeEventListener("pointerup",B),w.removeEventListener("pointercancel",B),k=[],E=[],w.remove(),y.remove(),v.restore()})}var w=u;export{w as TOAST_DEFAULTS,b as hidesInk,v as toastStack};//# sourceMappingURL=chunk-DCLJHSWM.js.map
|
|
1
|
+
import{injectStyle as t,drawBlocks as e,snapshot as n,blocksOf as o}from"./chunk-PB5E3D4E.js";import{clamp as i,styleKeeper as a,srOnly as r,mountSurface as s,house as c,hash as d,handle as l,hexRgb as p,resolveColor as m,isDark as h}from"./chunk-GF72XM4C.js";var u={max:3,duration:6e3,label:"Notifications",swipe:!0},f="cubic-bezier(.16, 1, .3, 1)",x=`\n:where(.ascii-toasts){position:relative;margin:0;padding:0;list-style:none;min-height:52px}\n:where(.ascii-toast){position:absolute;left:0;right:0;bottom:0;box-sizing:border-box;display:flex;align-items:center;gap:10px;min-height:52px;padding:8px 8px 8px 10px;border-radius:14px;background:var(--ascii-toast-bg,Canvas);color:var(--ascii-toast-ink,CanvasText);box-shadow:var(--ascii-toast-shadow,0 1px 2px rgb(0 0 0 / .06),0 10px 28px -10px rgb(0 0 0 / .22));z-index:calc(10 - var(--d,0));transform-origin:50% 0;translate:0 calc(var(--d,0) * -12px);scale:calc(1 - var(--d,0) * .05);touch-action:pan-y;transition:translate 380ms ${f},scale 380ms ${f},opacity 220ms ${f},transform 300ms ${f},filter 380ms ${f}}\n:where(.ascii-toast)::after{content:"";position:absolute;left:0;right:0;top:100%;height:10px}\n:where(.ascii-toast) > *{transition:opacity 200ms ${f}}\n:where(.ascii-toast[data-back]) > *{opacity:0}\n:where(.ascii-toasts:not([data-open])) :where(.ascii-toast[data-back]){filter:brightness(calc(1 - var(--d,0) * .04))}\n:where(.ascii-toasts:not([data-open])) :where(.ascii-toast[data-back]) > *{pointer-events:none}\n:where(.ascii-toasts[data-open]) :where(.ascii-toast){translate:0 calc(var(--d,0) * (-100% - 8px));scale:1}\n:where(.ascii-toasts[data-open]) :where(.ascii-toast[data-back]) > *{opacity:1}\n:where(.ascii-toast[data-forming]){animation:ascii-toast-in 420ms ${f} both}\n:where(.ascii-toast[data-forming],.ascii-toast[data-gone]) > *{opacity:0;transition:none}\n:where(.ascii-toast[data-gone]){opacity:0;scale:.97;pointer-events:none}\n:where(.ascii-toast[data-swiping]){transition:translate 380ms ${f},scale 380ms ${f},opacity 220ms ${f}}\n@keyframes ascii-toast-in{from{opacity:0;translate:0 14px}}\n:where(.ascii-toast-icon){display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:9px;background:rgb(128 128 128 / .14)}\n:where(.ascii-toast-text){display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}\n:where(.ascii-toast-title){overflow:hidden;font-size:14px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}\n:where(.ascii-toast-body){overflow:hidden;font-size:13px;opacity:.68;text-overflow:ellipsis;white-space:nowrap}\n:where(.ascii-toast-action,.ascii-toast-close){flex:none;border:0;background:rgb(128 128 128 / .14);color:inherit;font:inherit;cursor:pointer}\n:where(.ascii-toast-action){height:32px;padding:0 12px;border-radius:999px;font-size:14px;font-weight:500}\n:where(.ascii-toast-close){display:grid;place-items:center;width:28px;height:28px;border-radius:999px;background:transparent;font-size:18px;line-height:1;opacity:.6}\n@media (prefers-reduced-motion:reduce){:where(.ascii-toast){transition:none}:where(.ascii-toast[data-forming]){animation:none}}\n`,g=t=>{const[e,n,o]=p(t).map(t=>{const e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4});return.2126*e+.7152*n+.0722*o};function b(t,e){const n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?/i.exec(t.trim());if(!n)return!1;if(!((void 0===n[4]?1:n[4].endsWith("%")?parseFloat(n[4])/100:parseFloat(n[4]))>=.5))return!1;const o=`#${[n[1],n[2],n[3]].map(t=>Math.round(i(+t,0,255)).toString(16).padStart(2,"0")).join("")}`,[a,r]=[g(o),g(e)].sort((t,e)=>e-t);return(a+.05)/(r+.05)<3}function v(p,f={}){const g={current:{...u,...f}},v=a(),w=document.createElement("ol"),y=r("",!1);y.setAttribute("role","status");let k=[],E=[],C=0,L=!1,$=!1,M=!1,P=!1,T=null;const z=[];t("ascii-kit-toast",x),w.className="ascii-toasts",w.setAttribute("aria-label",g.current.label),p.append(w,y);const S=new WeakSet,A=t=>{delete t.dataset.forming,S.delete(t)&&(t.style.removeProperty("transition"),t.style.removeProperty("background-color"),t.style.removeProperty("box-shadow"))};T=s({host:p,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...g.current.look}),outset:24,resolution:2,ink:()=>g.current.ink??"--ascii-ink-strong",kit:g,reducedMotion:()=>g.current.reducedMotion,onFail:()=>{T=null,E=[];for(const t of k)A(t.node)},paint:({pen:t,now:n,scale:o,still:a,box:r})=>(t.setTransform(o,0,0,o,0,0),E=E.filter(o=>{const a=(n-o.start)/o.ms;if(o.form&&a>=.62&&A(o.node),a>=1)return!1;if(o.form)e(t,o.snap,o.blocks,o.order,1.04*c(a),(t,e)=>[70*(t.seed-.5)*e,(14+26*d(t.x,t.y))*e],1-i((a-.62)/.28));else{const n=o.dir;e(t,o.snap,o.blocks,o.order,1-1.04*(1-(1-a)**3),(t,e)=>[n*(14+34*t.seed+.5*Math.abs(o.throw))*e,14*(d(t.y,t.x)-.35)*e],1-i((a-.75)/.25))}return!0}),E.length>0)}),T&&(T.canvas.style.zIndex="11");const F=()=>!!T&&T.live&&!T.still(),I=()=>{const t=k.filter(t=>void 0===t.node.dataset.gone);t.forEach((e,n)=>{const o=t.length-1-n;v.set(e.node,"--d",String(o)),0===o?(e.node.dataset.front="",delete e.node.dataset.back):(e.node.dataset.back="",delete e.node.dataset.front)})},W=(t,e,i=0)=>{if(!T)return;const a=T.canvas.clientWidth||p.clientWidth+48,r=T.canvas.clientHeight||p.clientHeight+48,s=n(t,a,r,T.box),c=o(s.rects),d=Math.max(1,...c.map(t=>t.x)),l=i<0?-1:1,m=l>0?t=>t.x/d:t=>1-t.x/d,h=Float32Array.from(c,t=>e?t.x/d*.3+.7*t.seed:.62*m(t)+.38*t.seed);E.push({start:performance.now(),ms:e?340:440,snap:s.canvas,blocks:c,order:h,form:e,node:t,dir:l,throw:i}),T.kick()},X=t=>{t.timer&&clearTimeout(t.timer),t.timer=0,L||t.left<=0||(t.since=performance.now(),t.timer=setTimeout(()=>B(t.id),t.left))},j=()=>(t=>{if(t!==L){L=t,t?w.dataset.open="":delete w.dataset.open;for(const e of k)t&&e.timer&&(clearTimeout(e.timer),e.timer=0,e.left=Math.max(400,e.left-(performance.now()-e.since))),t||X(e)}})($||M),N=()=>{$=!0,j()},D=()=>{$=!1,j()},G=()=>{M=!0,j()},H=t=>{w.contains(t.relatedTarget)||(M=!1,j())};function B(t,e=0){const n=k.find(e=>e.id===t);if(!n||void 0!==n.node.dataset.gone)return;n.timer&&clearTimeout(n.timer);const o=()=>{k=k.filter(t=>t!==n),E=E.filter(t=>t.node!==n.node),n.node.remove(),I(),T?.kick(),k.some(t=>void 0===t.node.dataset.gone)||($=M=!1,j())},i=k[k.length-1]===n;F()&&(i||L||e)?(A(n.node),W(n.node,!1,e),n.node.dataset.gone="",I(),z.push(setTimeout(o,220))):o()}w.addEventListener("pointerenter",N),w.addEventListener("pointerleave",D),w.addEventListener("focusin",G),w.addEventListener("focusout",H);let q=null;const J=t=>{if(!g.current.swipe||0!==t.button||q)return;const e=t.target;if(e?.closest?.('button, a, input, textarea, select, [role="button"]'))return;const n=e?.closest?.("[data-toast]"),o=n&&k.find(t=>t.node===n);o&&void 0===n.dataset.gone&&void 0===n.dataset.forming&&(q={item:o,id:t.pointerId,x0:t.clientX,dx:0,t:performance.now(),v:0},n.dataset.swiping="",n.setPointerCapture?.(t.pointerId))},K=t=>{if(!q||t.pointerId!==q.id)return;const e=performance.now(),n=t.clientX-q.x0;q.v=(n-q.dx)/Math.max(1,e-q.t),q.dx=n,q.t=e,q.item.node.style.setProperty("transform",`translateX(${n}px)`),q.item.node.style.setProperty("opacity",String(i(1-Math.abs(n)/260,.2)))},O=t=>{if(!q||t.pointerId!==q.id)return;const{item:e,dx:n}=q,o=e.node,i=performance.now()-q.t>90?0:q.v;q=null,delete o.dataset.swiping;const a=Math.abs(n)>64||Math.abs(i)>.45&&Math.abs(n)>8;o.style.removeProperty("opacity"),a?(B(e.id,n||i),o.style.setProperty("transform",`translateX(${n+48*Math.sign(n||i)}px)`)):o.style.removeProperty("transform")};w.addEventListener("pointerdown",J),w.addEventListener("pointermove",K),w.addEventListener("pointerup",O),w.addEventListener("pointercancel",O);return l(()=>T,g,t=>{w.setAttribute("aria-label",t.label),T?.refresh()},{push:t=>{if(P)return-1;const e=++C,n=k.filter(t=>void 0===t.node.dataset.gone),o=n.length+1-Math.max(1,g.current.max);o>0&&n.slice(0,o).forEach(t=>B(t.id));const i=g.current.render?g.current.render(t,e):function(t,e){const n=(t,e,n)=>{const o=document.createElement(t);return o.className=e,n&&(o.dataset.paint=n),o},o=n("li","ascii-toast");if(void 0!==t.icon){const e=n("span","ascii-toast-icon","tile");e.setAttribute("aria-hidden","true"),"string"==typeof t.icon?e.textContent=t.icon:e.appendChild(t.icon),o.appendChild(e)}const i=n("span","ascii-toast-text"),a=n("b","ascii-toast-title","strong");if(a.textContent=t.title,i.appendChild(a),t.body){const e=n("span","ascii-toast-body","meta");e.textContent=t.body,i.appendChild(e)}if(o.appendChild(i),t.action){const{label:i,onClick:a}=t.action,r=n("button","ascii-toast-action","text");r.type="button",r.textContent=i,r.addEventListener("click",()=>{a(),e()}),o.appendChild(r)}const r=n("button","ascii-toast-close","none");return r.type="button",r.setAttribute("aria-label",`Dismiss ${t.title}`),r.textContent="×",r.addEventListener("click",e),o.appendChild(r),o}(t,()=>B(e));i.dataset.toast=String(e);const a={id:e,node:i,timer:0,left:t.duration??g.current.duration,since:0,born:performance.now()};return k.push(a),w.appendChild(i),I(),y.textContent=t.body?`${t.title}. ${t.body}`:t.title,F()?(i.dataset.forming="",(t=>{const e=m(g.current.ink??"--ascii-ink-strong",p,h(p)?"#d8d6cf":"#1d1d1b");e&&b(getComputedStyle(t).backgroundColor,e)&&(S.add(t),t.style.setProperty("transition","none","important"),t.style.setProperty("background-color","transparent","important"),t.style.setProperty("box-shadow","none","important"))})(i),W(i,!0)):T?.kick(),X(a),e},dismiss:t=>B(t),clear(){[...k].forEach(t=>B(t.id))},get toasts(){return k.filter(t=>void 0===t.node.dataset.gone).map(t=>t.id)}},()=>{P=!0;for(const t of k)t.timer&&clearTimeout(t.timer);z.forEach(clearTimeout),w.removeEventListener("pointerenter",N),w.removeEventListener("pointerleave",D),w.removeEventListener("focusin",G),w.removeEventListener("focusout",H),w.removeEventListener("pointerdown",J),w.removeEventListener("pointermove",K),w.removeEventListener("pointerup",O),w.removeEventListener("pointercancel",O),k=[],E=[],w.remove(),y.remove(),v.restore()})}var w=u;export{w as TOAST_DEFAULTS,b as hidesInk,v as toastStack};//# sourceMappingURL=chunk-OZFSNW5N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{clamp as t,hash as e}from"./chunk-GF72XM4C.js";function n(t){const e=()=>({image:t,width:t.naturalWidth,height:t.naturalHeight});return t.complete&&t.naturalWidth?Promise.resolve(e()):new Promise((n,o)=>{const a=()=>{i(),n(e())},r=()=>{i(),o(new Error(`Could not load ${t.src}`))},i=()=>{t.removeEventListener("load",a),t.removeEventListener("error",r)};t.addEventListener("load",a),t.addEventListener("error",r)})}function o(t,e=document.createElement("img")){return(t=>{try{return"undefined"!=typeof location&&new URL(t,location.href).origin!==location.origin}catch{return!1}})(t)&&!e.crossOrigin&&(e.crossOrigin="anonymous"),e.decoding="async",e.src=t,e}function a(t,e,n,o,a,r,i=.5,h=.5){if(a<=0||r<=0||!e.width||!e.height)return;const l=Math.max(a/e.width,r/e.height),c=e.width*l,d=e.height*l;t.save(),t.beginPath(),t.rect(n,o,a,r),t.clip(),t.drawImage(e.image,n+(a-c)*i,o+(r-d)*h,c,d),t.restore()}function r(e,n,o=.08){const a=Math.min(1,420/Math.max(1,e.width,e.height)),r=document.createElement("canvas");r.width=Math.max(1,Math.round(e.width*a)),r.height=Math.max(1,Math.round(e.height*a));const i=r.getContext("2d",{willReadFrequently:!0});if(!i)return e;let h;i.drawImage(e.image,0,0,r.width,r.height);try{h=i.getImageData(0,0,r.width,r.height)}catch{return e}const l=h.data,c=new Uint32Array(256),d=l.length/4,s=t=>.2126*l[t]+.7152*l[t+1]+.0722*l[t+2];for(let t=0;t<l.length;t+=4)c[Math.round(s(t))]++;let u=0,f=255,g=0;for(let t=0;t<256;t++)if(g+=c[t],g>=.02*d){u=t;break}g=0;for(let t=255;t>=0;t--)if(g+=c[t],g>=.02*d){f=t;break}const m=Math.max(1,f-u);for(let e=0;e<l.length;e+=4){let a=t((s(e)-u)/m);n&&(a=1-a),l[e]=l[e+1]=l[e+2]=Math.round(255*(o+(1-o)*a)),l[e+3]=255}return i.putImageData(h,0,0),{image:r,width:r.width,height:r.height}}var i={strong:1,text:.82,meta:.55,tile:.42,icon:.62},h=new Set(["IMG","SVG","svg","VIDEO","PICTURE"]),l=t=>[...t.children].flatMap(t=>h.has(t.tagName)?[t]:[t,...l(t)]);function c(e,n,o,a){const r=document.createElement("canvas");r.width=Math.max(2,Math.round(2*n)),r.height=Math.max(2,Math.round(2*o));const c=[],d=r.getContext("2d");if(!d)return{canvas:r,rects:c};d.scale(2,2),d.fillStyle="#000",d.fillRect(0,0,n,o);const s=a(e),u=e.getBoundingClientRect(),f=u.width/(e.offsetWidth||u.width||1)||1,g=t=>{for(let n=t;n&&n!==e.parentElement;n=n.parentElement){const t=n.dataset?.paint;if(t&&void 0!==i[t])return i[t]}return parseFloat(t?getComputedStyle(t).fontWeight:"400")>=500?1:.7},m=e=>{const n=Math.round(255*t(e));return`rgb(${n} ${n} ${n})`},w=l(e),p=[e,...w].filter(t=>{const e=t.dataset?.paint;return"tile"===e||"icon"===e||!e&&h.has(t.tagName)&&!t.closest("[data-paint]")});for(const t of p){const e=a(t);if(e.w<=0||e.h<=0)continue;const n=t.dataset?.paint;d.fillStyle=m("icon"===n?i.icon:i.tile),d.beginPath(),"icon"===n||"svg"===t.tagName.toLowerCase()?d.arc(e.x+e.w/2,e.y+e.h/2,.4*Math.min(e.w,e.h),0,2*Math.PI):d.roundRect(e.x,e.y,e.w,e.h,Math.min(parseFloat(getComputedStyle(t).borderTopLeftRadius)||0,e.h/2)),d.fill(),c.push(e)}const y=document.createTreeWalker(e,4),x=document.createRange();d.textBaseline="middle";for(let t=y.nextNode();t;t=y.nextNode()){const e=t.parentElement;if(!e||e.closest('[data-paint="none"]'))continue;const n=getComputedStyle(e);d.font=`${n.fontStyle} ${n.fontWeight} ${n.fontSize} ${n.fontFamily}`,d.fillStyle=m(g(e)),d.shadowColor=d.fillStyle,d.shadowBlur=4;for(const e of t.data.matchAll(/\S+/g)){x.setStart(t,e.index),x.setEnd(t,e.index+e[0].length);const n=x.getClientRects()[0];if(!n)continue;const o={x:s.x+(n.left-u.left)/f,y:s.y+(n.top-u.top)/f,w:n.width/f,h:n.height/f};d.fillText(e[0],o.x,o.y+o.h/2),c.push(o)}}return d.shadowBlur=0,x.detach?.(),{canvas:r,rects:c}}function d(t){const n=new Set,o=[];for(const a of t)for(let t=6*Math.floor((a.y-2)/6);t<a.y+a.h+2;t+=6)for(let r=4*Math.floor((a.x-2)/4);r<a.x+a.w+2;r+=4){const a=`${r},${t}`;n.has(a)||(n.add(a),o.push({x:r,y:t,seed:e(r,t)}))}return o}function s(t,e,n,o,a,r,i=1,h=.32){for(let l=0;l<n.length;l++){const c=n[l],d=(a-o[l]*(1-h))/h;if(d<=0)continue;const s=d>=1?0:1-d;let u=c.x,f=c.y;if(s>0){const[t,e]=r(c,s);u+=t,f+=e}t.globalAlpha=i*(1-s*s),t.drawImage(e,2*c.x,2*c.y,8,12,u,f,4,6)}t.globalAlpha=1}function u(t,e){if("undefined"==typeof document||document.getElementById(t))return;const n=document.createElement("style");n.setAttribute("id",t),n.textContent=e,(document.head??document.documentElement).appendChild(n)}export{d as blocksOf,s as drawBlocks,a as drawCover,o as imageFor,n as imageReady,u as injectStyle,c as snapshot,r as toneOf};//# sourceMappingURL=chunk-PB5E3D4E.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{injectStyle as e}from"./chunk-
|
|
1
|
+
import{injectStyle as e}from"./chunk-PB5E3D4E.js";import{drawBlocks as t,snapshot as n,blocksOf as r,BLOCK_W as o,BLOCK_H as s}from"./chunk-Z2FRNFMB.js";import{styleKeeper as i,mountSurface as a,house as c,clamp as l,handle as u,hash as d,boxIn as f,prefersReduced as p}from"./chunk-GF72XM4C.js";var h={input:"input",rows:'[role="option"]',hotkey:"k",manage:!0,closeOnRun:!0,highlight:!0,ai:"[data-ai]"},m=200,g=3600,y=40,v="cubic-bezier(.16, 1, .3, 1)",x=`\n:where([data-ascii-cmd-highlight]){position:absolute;left:0;top:0;z-index:-1;pointer-events:none;opacity:0;background:var(--ascii-cmd-highlight,color-mix(in oklab,currentColor 7%,transparent));transition:translate 240ms ${v},width 240ms ${v},height 240ms ${v},opacity 160ms ${v}}\n:where([data-ascii-cmd-highlight][data-on]){opacity:1}\n@media (prefers-reduced-motion:reduce){:where([data-ascii-cmd-highlight]){transition:none}}\n`;function k(k,w={}){const b={current:{...h,...w}},E=i(),$=()=>[...k.querySelectorAll(b.current.rows)],M=()=>k.querySelector(b.current.input),A=i();let L=b.current.open??!k.hasAttribute("hidden"),C=0,S=null,T=!1,O=0,W=null,H=[],R=null,D=0,F=0;const P=new WeakMap,z=()=>!!(b.current.reducedMotion??p());e("ascii-kit-command",x),"static"===getComputedStyle(k).position&&A.set(k,"position","relative"),A.set(k,"isolation","isolate");const j=document.createElement("div");j.setAttribute("aria-hidden","true"),j.dataset.asciiCmdHighlight="",b.current.highlight&&k.insertBefore(j,k.firstElementChild);const B=e=>{if(void 0===e.offsetParent)return f(k,e);let t=0,n=0;for(let r=e;r&&r!==k;r=r.offsetParent)t+=r.offsetLeft,n+=r.offsetTop;for(let r=e.parentElement;r&&r!==k;r=r.parentElement)t-=r.scrollLeft,n-=r.scrollTop;return{x:t,y:n,w:e.offsetWidth,h:e.offsetHeight}},K=e=>{const t=$()[C];if(!j.parentElement)return;if(!t||!L)return void delete j.dataset.on;const n=B(t),r=!e||void 0===j.dataset.on||z();r&&(j.style.transition="none"),j.style.translate=`${n.x}px ${n.y}px`,j.style.width=`${n.w}px`,j.style.height=`${n.h}px`,j.style.borderRadius=getComputedStyle(t).borderTopLeftRadius,j.dataset.on="",r&&(j.offsetWidth,j.style.removeProperty("transition"))};let N=null;const q=i();W=a({host:k,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...b.current.look}),ink:()=>b.current.ink??"--ascii-ink-strong",kit:b,reducedMotion:()=>b.current.reducedMotion,resolution:2,onFail:()=>{W=null},paint:({pen:e,now:i,still:a,box:u})=>{if(e.setTransform(2,0,0,2,0,0),S){const n=S,r=(i-n.start)/(n.closing?m:260);if(!(r>=1||a)){const o=n.closing?1-1.02*c(r):1.04*c(r);return t(e,n.snap,n.blocks,n.order,o,(e,t)=>[(n.ox-e.x)*t*.9,(n.oy-e.y)*t*.9],n.closing?1:1-l((r-.72)/.28),.4),!0}S=null}if(!L||T)return!1;let f=!1;H=H.filter(n=>{const r=(i-n.start)/280;return(r>=.7||a)&&n.styles.restore(),r>=1||a||!k.contains(n.row)?(n.styles.restore(),!1):(f=!0,r>0&&t(e,n.snap,n.blocks,n.order,1.04*c(r),(e,t)=>[14*t,0],1-l((r-.7)/.3),.42),!0)});const p=$()[C];if(p&&!a&&p.matches(b.current.ai)){p!==R&&(R=p,D=i+160);const t=i-D,a=t>=0?t%g/1100:-1;if(a>=0&&a<1&&!H.some(e=>e.row===p))((e,t,i,a,c)=>{const l=W,u=`${t.textContent}|${i.x}|${i.y}|${i.w}`;if(N?.row!==t||N.key!==u){const e=n(t,l.box,l.canvas.clientWidth||k.offsetWidth,l.canvas.clientHeight||k.offsetHeight,2);N={row:t,key:u,snap:e,blocks:r(e,2)}}const f=i.x-y+(i.w+80)*(e=>e<.5?4*e**3:1-(-2*e+2)**3/2)(a),p=Math.floor(c/70);for(const t of N.blocks){const n=(t.x+2-f)/y;if(n<=-1||n>=1)continue;const r=1-n*n;d(t.x+p,t.y)>.35+.65*r||(e.globalAlpha=Math.min(1,1.6*r),e.drawImage(N.snap,2*t.x,2*t.y,2*o,2*s,t.x,t.y,o,s))}e.globalAlpha=1;const h=f-i.x;q.set(t,"mask-image",`linear-gradient(90deg, #000 ${h-y}px, transparent ${h-14}px, transparent ${h+14}px, #000 ${h+y}px)`)})(e,p,u(p),a,i),f=!0;else{if(q.restore(),f)return!0;F&&clearTimeout(F);const e=t>=0?g-t%g:-t;F=setTimeout(()=>{F=0,W?.kick()},Math.max(16,e))}}else R=null,q.restore();return f}}),W&&(k.dataset.gpu="");const G=(e=!0)=>{const t=$();if(C=t.length?Math.min(Math.max(0,C),t.length-1):0,K(e),!b.current.manage)return;t.forEach((e,t)=>e.setAttribute("aria-selected",String(t===C)));const n=M(),r=t[C]?.id;n&&r&&n.setAttribute("aria-activedescendant",r)},I=()=>`inset(0 round ${getComputedStyle(k).borderTopLeftRadius||"0px"})`,U=()=>{const e=b.current.trigger,t=k.offsetWidth,n=k.offsetHeight;if(!e)return`inset(0 ${Math.max(0,t/2-40)}px ${Math.max(0,n-36)}px round 18px)`;const r=f(k,e);return`inset(${r.y}px ${t-r.x-r.w}px ${n-r.y-r.h}px ${r.x}px round ${r.h/2}px)`},V=e=>{const t=W;if(!t)return;const o=k.offsetWidth,s=k.offsetHeight,i=n(k,t.box,o,s,2),a=r(i,2),c=b.current.trigger,l=c?t.box(c):{x:o/2,y:0,w:0,h:0},u=l.x+l.w/2,d=l.y+l.h/2,f=Math.hypot(o,s)||1;S={snap:i,blocks:a,order:Float32Array.from(a,e=>Math.hypot(e.x-u,e.y-d)/f*.7+.3*e.seed),ox:u,oy:d,start:performance.now(),closing:e},t.kick()},X=e=>{if(e)for(const e of[...k.children])"CANVAS"===e.tagName&&void 0!==e.dataset.asciiKit||E.set(e,"opacity","0");else E.restore()},Z=(e,t,n="none")=>"function"!=typeof k.animate?null:k.animate(e.map(e=>({clipPath:e})),{duration:t,easing:v,fill:n}),J=()=>{O&&clearTimeout(O),O=0},Q=(e=!0)=>{!L||T?(J(),L=!0,T=!1,C=0,k.removeAttribute("hidden"),k.dataset.open="",b.current.trigger?.setAttribute("aria-expanded","true"),G(!1),(()=>{for(const e of $())P.set(e,B(e).y)})(),e&&M()?.focus({preventScroll:!0}),b.current.onOpenChange?.(!0),z()?W?.kick():(k.dataset.state="opening",Z([U(),I()],260),W&&(T=!0,X(!0),V(!1)),O=setTimeout(()=>{O=0,delete k.dataset.state,T=!1,X(!1),W?.kick()},143))):e&&M()?.focus({preventScroll:!0})},Y=()=>{if(!L)return;J();const e=k.contains(document.activeElement),t=()=>{O=0,T=!1,L=!1,S=null,delete k.dataset.state,delete k.dataset.open,X(!1),K(!1);for(const e of H)e.styles.restore();H=[],q.restore(),N=null,k.setAttribute("hidden",""),b.current.trigger?.setAttribute("aria-expanded","false"),e&&b.current.trigger?.focus({preventScroll:!0}),W?.kick(),b.current.onOpenChange?.(!1)};if(z())return void t();T=!0,k.dataset.state="closing",W&&(V(!0),X(!0));const n=Z([I(),U()],m,"forwards"),r="function"==typeof k.animate?k.animate([{opacity:1},{opacity:1,offset:.4},{opacity:0}],{duration:m,fill:"forwards"}):null;O=setTimeout(()=>{t(),n?.cancel(),r?.cancel()},m)},_=e=>{const t=$().length;t&&(C=(Math.round(e)%t+t)%t,G(),W?.kick())},ee=(e=C)=>{const t=$()[e];if(!t||T)return;_(e),W?.field.pulse({element:t,strength:.6}),t.matches(b.current.ai)&&(R=t,D=performance.now()),t.dataset.run="",b.current.onRun?.(e,t);const n=()=>{delete t.dataset.run,b.current.closeOnRun&&Y()};z()?n():setTimeout(n,240)},te=e=>{if(!b.current.manage)return;const t=$().length;if("Escape"===e.key&&L)return e.preventDefault(),e.stopPropagation(),void Y();if(e.target!==M()&&!$().includes(e.target))return;const n="ArrowDown"===e.key?C+1:"ArrowUp"===e.key?C-1:"Home"===e.key?0:"End"===e.key?t-1:null;if(null!==n)return e.preventDefault(),void _(n);"Enter"===e.key&&(e.preventDefault(),ee())},ne=e=>{const t=e.target?.closest?.(b.current.rows);return t?$().indexOf(t):-1},re=e=>{if(!b.current.manage)return;const t=ne(e);t<0||t!==C&&_(t)},oe=e=>{if(!b.current.manage)return;const t=ne(e);t>=0&&ee(t)},se=()=>{b.current.manage&&(C=0,G(!1))},ie="function"==typeof MutationObserver?new MutationObserver(()=>{L&&(G(!1),(()=>{const e=W,t=$(),o=t.filter(e=>{const t=B(e).y,n=P.get(e);return P.set(e,t),void 0===n||Math.abs(n-t)>1});for(const e of H)t.includes(e.row)&&!o.includes(e.row)||e.styles.restore();if(H=H.filter(e=>t.includes(e.row)&&!o.includes(e.row)),!e||!e.live||e.still()||T||!L)return;const s=e.canvas.clientWidth||k.offsetWidth,a=e.canvas.clientHeight||k.offsetHeight,c=performance.now();o.forEach((t,o)=>{const l=n(t,e.box,s,a,2),u=r(l,2);if(!u.length)return;const d=Math.min(...u.map(e=>e.x)),f=Math.max(1,Math.max(...u.map(e=>e.x))-d),p=i();for(const e of[...t.children])p.set(e,"opacity","0");H.push({row:t,snap:l,blocks:u,order:Float32Array.from(u,e=>(e.x-d)/f*.72+.28*e.seed),start:c+28*o,styles:p})}),e.kick()})())}):null;ie?.observe(k,{childList:!0,subtree:!0});const ae="function"==typeof ResizeObserver?new ResizeObserver(()=>K(!1)):null;ae?.observe(k);const ce=()=>{L?Y():Q(!0)},le=e=>{const t=b.current.hotkey;t&&e.key?.toLowerCase()===t.toLowerCase()&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),L?document.activeElement===M()?Y():M()?.focus():Q(!0))},ue=e=>{if(!b.current.manage||!L||T)return;const t=e.target;k.contains(t)||b.current.trigger?.contains(t)||Y()};k.addEventListener("keydown",te),k.addEventListener("pointermove",re),k.addEventListener("click",oe),k.addEventListener("input",se);const de=b.current.trigger;return de?.addEventListener("click",ce),de?.setAttribute("aria-expanded",String(L)),de?.setAttribute("aria-haspopup","dialog"),document.addEventListener("keydown",le),document.addEventListener("pointerdown",ue),L?k.dataset.open="":k.setAttribute("hidden",""),G(),u(()=>W,b,()=>{G(),W?.refresh()},{open:Q,close:Y,select:_,run:ee,toggle(){L?Y():Q(!0)},get isOpen(){return L},get selected(){return C}},()=>{J(),F&&clearTimeout(F),X(!1);for(const e of H)e.styles.restore();q.restore(),ie?.disconnect(),ae?.disconnect(),j.remove(),A.restore(),k.removeEventListener("keydown",te),k.removeEventListener("pointermove",re),k.removeEventListener("click",oe),k.removeEventListener("input",se),de?.removeEventListener("click",ce),document.removeEventListener("keydown",le),document.removeEventListener("pointerdown",ue),delete k.dataset.gpu,delete k.dataset.state})}var w=h;export{w as COMMAND_PALETTE_DEFAULTS,k as commandPalette};//# sourceMappingURL=chunk-PGFBIU7R.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{imageFor as e,injectStyle as t,imageReady as r,drawCover as i}from"./chunk-
|
|
1
|
+
import{imageFor as e,injectStyle as t,imageReady as r,drawCover as i}from"./chunk-PB5E3D4E.js";import{styleKeeper as n,clamp as o,mountSurface as a,handle as s,house as l}from"./chunk-GF72XM4C.js";function c(c,d){const u={current:{position:50,...d}},p=n();let h=o(u.current.position,0,100),m=null,g=null,v={from:h,to:h,at:-1e9},b=0,f=!1;const w=[];let A=u.current.position;g=a({host:c,layer:"under",look:()=>({blend:"coarse",mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:600,cellSize:6,cellAspect:.8,glyphScale:.96,color:"source",levels:"auto",saturation:1.3,contrast:1.45,gamma:.85,brightness:.14,hover:"trail",trail:{strength:.7,radius:.3},...u.current.look}),ink:()=>u.current.ink??"--ascii-ink-strong",kit:u,reducedMotion:()=>u.current.reducedMotion,resolution:(e,t)=>{const r=Math.min(1600,Math.max(2,Math.round(2*e)));return[r,Math.max(2,Math.round(r*t/Math.max(1,e)))]},onFail:()=>{g=null},paint:({pen:e,width:t,height:r})=>(e.imageSmoothingQuality="high",m&&i(e,m,0,0,t,r),!1)});const k="string"==typeof u.current.image?e(u.current.image):u.current.image,x=c.querySelector('[role="slider"]'),y=c.querySelector("[data-compare-line]"),E=x??document.createElement("div"),M=y??document.createElement("span"),L=e=>{void 0===e&&E.hasAttribute("aria-label")||E.setAttribute("aria-label",e??"Photo and ASCII split")},C=()=>{const e=Math.round(h);p.set(c,"--ascii-pos",`${h}%`),E.setAttribute("aria-valuenow",String(e)),E.setAttribute("aria-valuetext",`${e}% photo, ${100-e}% ASCII`)},S=(e,t=!1)=>{if(e=o(e,0,100),!g)return void(h=e);if(b&&(cancelAnimationFrame(b),b=0),!t||g.still()||Math.abs(e-h)<.5)return h=e,C(),void u.current.onChange?.(h);v={from:h,to:e,at:performance.now()};const r=e=>{const t=o((e-v.at)/280);h=v.from+(v.to-v.from)*l(t),C(),u.current.onChange?.(h),b=t<1?requestAnimationFrame(r):0};b=requestAnimationFrame(r)},N=e=>{const t=c.getBoundingClientRect();return t.width?(e-t.left)/t.width*100:h},F=e=>{if(0!==e.button)return;c.setPointerCapture?.(e.pointerId),f=!0,c.dataset.dragging="";const t=N(e.clientX);S(t,Math.abs(t-h)>3),E.focus({preventScroll:!0})},I=e=>{f&&S(N(e.clientX))},j=()=>{f=!1,delete c.dataset.dragging},P=e=>{const t={ArrowLeft:-5,ArrowDown:-5,ArrowRight:5,ArrowUp:5,PageDown:-20,PageUp:20}[e.key],r="Home"===e.key?0:"End"===e.key?100:void 0!==t?5*Math.round(h/5)+t:null;null!==r&&(e.preventDefault(),S(r,!0))};let q=()=>{};if(g){t("ascii-kit-compare","\n:where(.ascii-compare-photo){position:absolute;inset:0;width:100%;height:100%;object-fit:cover;pointer-events:none;clip-path:inset(0 calc(100% - var(--ascii-pos, 50%)) 0 0)}\n:where(.ascii-compare-line){position:absolute;top:0;bottom:0;left:var(--ascii-pos, 50%);width:2px;translate:-50% 0;background:#fff;box-shadow:0 0 0 .5px rgb(0 0 0 / .25),0 0 12px rgb(0 0 0 / .45);pointer-events:none}\n:where(.ascii-compare-handle){position:absolute;top:50%;left:var(--ascii-pos, 50%);display:grid;place-items:center;width:40px;height:40px;translate:-50% -50%;border-radius:50%;background:#fff;color:#111;box-shadow:0 0 0 1px rgb(0 0 0 / .08),0 4px 14px rgb(0 0 0 / .4);cursor:grab;touch-action:none}\n:where(.ascii-compare-handle:focus-visible){outline:2px solid #fff;outline-offset:3px}\n"),p.set(c,"overflow","hidden"),p.set(c,"touch-action","pan-y"),p.set(c,"user-select","none"),p.set(c,"cursor","ew-resize");const e={className:k.className,hidden:k.getAttribute("aria-hidden")};q=()=>{k.className=e.className,null===e.hidden?k.removeAttribute("aria-hidden"):k.setAttribute("aria-hidden",e.hidden)},k.className=(e.className?`${e.className} `:"")+"ascii-compare-photo",k.setAttribute("aria-hidden","true"),k.draggable=!1,y||(M.className="ascii-compare-line",M.setAttribute("aria-hidden","true")),x||(E.className="ascii-compare-handle",E.innerHTML='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 7-5 5 5 5M15 7l5 5-5 5"/></svg>',E.setAttribute("role","slider"),E.tabIndex=0),L(u.current.label),E.setAttribute("aria-valuemin","0"),E.setAttribute("aria-valuemax","100"),E.setAttribute("aria-orientation","horizontal");for(const e of[k,M,E])c.contains(e)||(c.appendChild(e),w.push(e));C(),c.addEventListener("pointerdown",F),c.addEventListener("pointermove",I),c.addEventListener("pointerup",j),c.addEventListener("pointercancel",j),E.addEventListener("keydown",P),r(k).then(e=>{m=e,g?.kick()},()=>{})}else c.contains(k)||("static"===getComputedStyle(c).position&&p.set(c,"position","relative"),k.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit"),c.appendChild(k),w.push(k));return s(()=>g,u,e=>{L(e.label),e.position!==A&&(A=e.position,S(e.position,!0)),g?.refresh()},{set:S,get position(){return h}},()=>{b&&cancelAnimationFrame(b),c.removeEventListener("pointerdown",F),c.removeEventListener("pointermove",I),c.removeEventListener("pointerup",j),c.removeEventListener("pointercancel",j),E.removeEventListener("keydown",P),delete c.dataset.dragging,w.forEach(e=>e.remove()),q(),p.restore()})}export{c as compare};//# sourceMappingURL=chunk-YSN7EHSH.js.map
|