@stacksjs/stx 0.2.711 → 0.2.714
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/dist/chunk-00bf81ep.js +2 -0
- package/dist/chunk-04bhg3nn.js +2 -0
- package/dist/{chunk-vstvadc2.js → chunk-05qf3e2p.js} +3 -3
- package/dist/{chunk-nxmrbz95.js → chunk-0babpwqd.js} +22 -22
- package/dist/chunk-0g9a1kks.js +2 -0
- package/dist/{chunk-xt85pfwm.js → chunk-0k1nwbch.js} +9 -9
- package/dist/{chunk-twrkqpfm.js → chunk-142z94rk.js} +4 -4
- package/dist/chunk-19vshytp.js +2 -0
- package/dist/{chunk-qzbvxq1f.js → chunk-1kpfkjy7.js} +18 -18
- package/dist/{chunk-9n0rkv8n.js → chunk-1ncmrzk1.js} +2 -2
- package/dist/chunk-2fmn23mb.js +2 -0
- package/dist/{chunk-3ps07041.js → chunk-2mqzpzy7.js} +4 -4
- package/dist/{chunk-wbfg7p3k.js → chunk-2t00wxz0.js} +1 -1
- package/dist/chunk-336t7zzz.js +2 -0
- package/dist/{chunk-467r9gpt.js → chunk-35br675g.js} +4 -4
- package/dist/chunk-362sjw8c.js +2 -0
- package/dist/{chunk-dxqvv686.js → chunk-39nkd53v.js} +2 -2
- package/dist/{chunk-yw66yks2.js → chunk-3e40sm05.js} +4 -4
- package/dist/{chunk-zjw6j2x0.js → chunk-3fwdxxh1.js} +4 -4
- package/dist/chunk-3j8x8mhx.js +2 -0
- package/dist/chunk-3nbvr34s.js +2 -0
- package/dist/chunk-3r0zha0y.js +2 -0
- package/dist/{chunk-zav8yrtp.js → chunk-3xyvc3g1.js} +5 -5
- package/dist/{chunk-stvw8y3c.js → chunk-4c86wr9a.js} +2 -2
- package/dist/chunk-4ee5msma.js +2 -0
- package/dist/chunk-54a60nh2.js +2 -0
- package/dist/chunk-5d1c504j.js +2 -0
- package/dist/chunk-5wpgbwap.js +2 -0
- package/dist/{chunk-d06q5k8r.js → chunk-5zg56hwd.js} +5 -5
- package/dist/{chunk-qa9t9k6z.js → chunk-62awa752.js} +1 -1
- package/dist/{chunk-mr3r8crk.js → chunk-630yrhzv.js} +2 -2
- package/dist/{chunk-kxf8z7vp.js → chunk-6fx89gvg.js} +2 -2
- package/dist/chunk-6h1qa3hw.js +2 -0
- package/dist/chunk-6jn0p1a9.js +2 -0
- package/dist/chunk-6vj7vx7z.js +2 -0
- package/dist/{chunk-ckrmrdjp.js → chunk-72hfqwvk.js} +5 -5
- package/dist/{chunk-hh7wx4pv.js → chunk-7407ac26.js} +5 -5
- package/dist/{chunk-cwhzk2n3.js → chunk-74fepz6h.js} +2 -2
- package/dist/{chunk-ahjeegyv.js → chunk-77rjnavp.js} +13 -13
- package/dist/{chunk-42w6snem.js → chunk-78x8qfvt.js} +4 -4
- package/dist/chunk-79sjdpfy.js +2 -0
- package/dist/{chunk-8k139g1q.js → chunk-7nmrycrz.js} +4 -4
- package/dist/{chunk-jvbzeeqr.js → chunk-87zvjhp9.js} +10 -10
- package/dist/{chunk-zecgd1wz.js → chunk-88rftjjk.js} +4 -4
- package/dist/chunk-8dfq934n.js +2 -0
- package/dist/{chunk-t6ayy0t5.js → chunk-8fazd6fr.js} +2 -2
- package/dist/chunk-8w1ep4w3.js +2 -0
- package/dist/chunk-918xy0ra.js +2 -0
- package/dist/{chunk-tvcr9sct.js → chunk-9chqvq23.js} +3 -3
- package/dist/chunk-a0r5011d.js +2 -0
- package/dist/chunk-a49at1ah.js +2 -0
- package/dist/{chunk-q82n06dy.js → chunk-a9kxcdkz.js} +2 -2
- package/dist/chunk-agjysd2b.js +2 -0
- package/dist/chunk-ajcb0z8k.js +2 -0
- package/dist/chunk-ak04tgvw.js +2 -0
- package/dist/chunk-anew18ct.js +2 -0
- package/dist/chunk-azatpcm0.js +2 -0
- package/dist/chunk-c1481efw.js +2 -0
- package/dist/chunk-c510b95e.js +2 -0
- package/dist/chunk-c8yrvpr7.js +2 -0
- package/dist/chunk-cbbjepfk.js +2 -0
- package/dist/{chunk-kbc92p7a.js → chunk-cgpf1fva.js} +2 -2
- package/dist/{chunk-6cz1sbb1.js → chunk-d9hw6n2d.js} +3 -3
- package/dist/{chunk-zjaw79zp.js → chunk-dhy6n39n.js} +2 -2
- package/dist/{chunk-edka95zp.js → chunk-dmnncw90.js} +3 -3
- package/dist/chunk-dn8x6c98.js +2 -0
- package/dist/{chunk-b7j48bq9.js → chunk-dnqzrktd.js} +2 -2
- package/dist/chunk-dph9dzzs.js +2 -0
- package/dist/{chunk-hr3emvsh.js → chunk-dxzs589r.js} +3 -3
- package/dist/chunk-ez35607j.js +3 -0
- package/dist/{chunk-768evhvm.js → chunk-f2c3t1ky.js} +2 -2
- package/dist/{chunk-x2gxx8eg.js → chunk-f4gqzg1y.js} +2 -2
- package/dist/chunk-f9smbpkp.js +2 -0
- package/dist/chunk-fb8sw7fc.js +2 -0
- package/dist/{chunk-029qng4p.js → chunk-fsz9k5k0.js} +5 -5
- package/dist/chunk-g8fg3kq8.js +2 -0
- package/dist/{chunk-fnk16531.js → chunk-g8ve8pag.js} +6 -6
- package/dist/{chunk-0b77b7e0.js → chunk-gjfgmhpw.js} +1 -1
- package/dist/chunk-gw4pycg0.js +2 -0
- package/dist/{chunk-an387127.js → chunk-h16qbyjd.js} +2 -2
- package/dist/chunk-h5srt1gz.js +2 -0
- package/dist/{chunk-t63f15yh.js → chunk-hez09ssh.js} +2 -2
- package/dist/{chunk-2aarvd3a.js → chunk-hnqpqtk2.js} +6 -6
- package/dist/chunk-hrb9fmq0.js +2 -0
- package/dist/{chunk-q4t69m06.js → chunk-hx2s1j09.js} +8 -8
- package/dist/{chunk-zcs0nh8b.js → chunk-j0sj81bg.js} +6 -6
- package/dist/{chunk-fcbd7kwj.js → chunk-j28r2d0q.js} +2 -2
- package/dist/chunk-jb5najk3.js +1101 -0
- package/dist/chunk-jc7823qy.js +2 -0
- package/dist/chunk-jresy8fn.js +2 -0
- package/dist/{chunk-pdz9xm5s.js → chunk-jtgb1s62.js} +2 -2
- package/dist/{chunk-netw39rp.js → chunk-k3j8kd19.js} +5 -5
- package/dist/{chunk-34hsn8tn.js → chunk-k93mp66m.js} +144 -136
- package/dist/{chunk-791gt3mj.js → chunk-m1n9re2p.js} +6 -6
- package/dist/{chunk-8v2vbc4y.js → chunk-m5nzpjej.js} +1 -1
- package/dist/chunk-m6d2bq3y.js +2 -0
- package/dist/chunk-m8r7v1js.js +2 -0
- package/dist/{chunk-64hrtvvq.js → chunk-mpphyb4g.js} +1 -1
- package/dist/{chunk-s9b6abkb.js → chunk-mwxbdpb1.js} +2 -2
- package/dist/chunk-mymb85q5.js +3 -0
- package/dist/{chunk-83p5k4eb.js → chunk-narz7105.js} +2 -2
- package/dist/chunk-ngahc72q.js +2 -0
- package/dist/{chunk-khrckvwn.js → chunk-nqfpvejh.js} +1 -1
- package/dist/chunk-nvtp22qp.js +2 -0
- package/dist/{chunk-3y0bmmgq.js → chunk-ny5j5jhm.js} +3 -3
- package/dist/{chunk-4ckxs446.js → chunk-pd89jnqk.js} +3 -3
- package/dist/{chunk-9gdb9a7z.js → chunk-q73xkgn0.js} +76 -76
- package/dist/{chunk-3t3p2c1t.js → chunk-q7fh1xka.js} +6 -6
- package/dist/{chunk-5n4qg8za.js → chunk-qc93ce5h.js} +2 -2
- package/dist/{chunk-3457kk19.js → chunk-qf2aa8qe.js} +6 -6
- package/dist/{chunk-jb5sftzz.js → chunk-r3hden6p.js} +2 -2
- package/dist/{chunk-7dc3n69c.js → chunk-r3j4m04w.js} +2 -2
- package/dist/chunk-r5re2zj0.js +2 -0
- package/dist/{chunk-wp6q0geg.js → chunk-rbmt5w9v.js} +2 -2
- package/dist/chunk-rgv7rjrs.js +2 -0
- package/dist/{chunk-67abad76.js → chunk-rj4j7qcj.js} +1 -1
- package/dist/chunk-s9hw4vcx.js +2 -0
- package/dist/{chunk-g1tq4xdb.js → chunk-serrx31a.js} +2 -2
- package/dist/{chunk-tr33tzts.js → chunk-sfkexejc.js} +2 -2
- package/dist/{chunk-0eym6mhw.js → chunk-snxzvyz3.js} +1 -1
- package/dist/chunk-sx1aer4p.js +2 -0
- package/dist/{chunk-p3dkhz9v.js → chunk-tdrcn1mn.js} +30 -30
- package/dist/chunk-tdvmf3ge.js +2 -0
- package/dist/{chunk-2t85t7zc.js → chunk-tz4wh90e.js} +5 -5
- package/dist/chunk-tzhm09xq.js +2 -0
- package/dist/{chunk-vx14d8zm.js → chunk-tzk4cmvm.js} +5 -5
- package/dist/{chunk-9dg5ja4w.js → chunk-v402swbm.js} +1 -1
- package/dist/chunk-vf9s563f.js +2 -0
- package/dist/chunk-vpmk1w2t.js +2 -0
- package/dist/chunk-wj5j2ekg.js +2 -0
- package/dist/{chunk-b6318vv3.js → chunk-wk50m71x.js} +1 -1
- package/dist/{chunk-nvmdwrz4.js → chunk-wv412s1h.js} +7 -7
- package/dist/{chunk-rb2a1qxb.js → chunk-x5dc06p5.js} +6 -6
- package/dist/chunk-x7z2s532.js +2 -0
- package/dist/{chunk-ap30qs8p.js → chunk-x9wwd2ee.js} +2 -2
- package/dist/{chunk-ncs2j5kc.js → chunk-xaddgvkx.js} +2 -2
- package/dist/{chunk-6n11z33h.js → chunk-y3w2rc1y.js} +5 -5
- package/dist/chunk-ye3yyq6n.js +12 -0
- package/dist/{chunk-d9pxe492.js → chunk-yen9xzzg.js} +6 -6
- package/dist/chunk-yg1wcsbj.js +2 -0
- package/dist/{chunk-hf4hsdep.js → chunk-z4dpz6dh.js} +3 -3
- package/dist/{chunk-9qqzxd5y.js → chunk-z5pm69w1.js} +39 -39
- package/dist/{chunk-xyyt8v1r.js → chunk-zkx2m308.js} +12 -12
- package/dist/cli.js +19 -19
- package/dist/client/signals-public-api-runtime.js +1 -0
- package/dist/composables/use-broadcast-stream.d.ts +1 -1
- package/dist/craft-bridge.d.ts +0 -18
- package/dist/craft-bridge.js +12 -7
- package/dist/craft-components.d.ts +0 -20
- package/dist/craft-components.js +5 -13
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/document-injection.d.ts +2 -0
- package/dist/document-injection.js +8 -0
- package/dist/native-build.js +2 -1
- package/dist/pwa.js +3 -3
- package/dist/runtime-globals.js +1 -0
- package/dist/signals.js +3 -0
- package/dist/ssg.js +15 -15
- package/dist/stx-module.d.ts +1 -0
- package/dist/unresolved-identifiers.js +0 -1
- package/package.json +5 -5
- package/stx-module.d.ts +1 -0
- package/stx.d.ts +1 -0
- package/dist/chunk-12vjp2gr.js +0 -2
- package/dist/chunk-18fr730w.js +0 -2
- package/dist/chunk-29sapda2.js +0 -2
- package/dist/chunk-2qf6kd9r.js +0 -2
- package/dist/chunk-2snfd93r.js +0 -2
- package/dist/chunk-2zd7v9xw.js +0 -2
- package/dist/chunk-48ye65g0.js +0 -2
- package/dist/chunk-4c1fbthr.js +0 -2
- package/dist/chunk-4fxg20je.js +0 -2
- package/dist/chunk-58v34kba.js +0 -2
- package/dist/chunk-5z8bc75p.js +0 -2
- package/dist/chunk-8s4rxgs8.js +0 -2
- package/dist/chunk-8ssryq8y.js +0 -2
- package/dist/chunk-9736003n.js +0 -2
- package/dist/chunk-97r557ws.js +0 -2
- package/dist/chunk-9kxykbg7.js +0 -2
- package/dist/chunk-bcr8sq50.js +0 -2
- package/dist/chunk-cn692w5v.js +0 -2
- package/dist/chunk-d6anxge7.js +0 -2
- package/dist/chunk-dhdt7e54.js +0 -2
- package/dist/chunk-e8n0x8dt.js +0 -2
- package/dist/chunk-ew7sdykm.js +0 -3033
- package/dist/chunk-fn4a8fja.js +0 -2
- package/dist/chunk-fvk1xr5a.js +0 -2
- package/dist/chunk-fxvxkb55.js +0 -2
- package/dist/chunk-g6wd49b5.js +0 -2
- package/dist/chunk-gk0nq2ky.js +0 -2
- package/dist/chunk-h8kbcz9t.js +0 -2
- package/dist/chunk-hj72xfv9.js +0 -2
- package/dist/chunk-hvytbft6.js +0 -2
- package/dist/chunk-hw70h16g.js +0 -2
- package/dist/chunk-j1f39jyb.js +0 -12
- package/dist/chunk-jjwfksv0.js +0 -2
- package/dist/chunk-kk8y8yba.js +0 -2
- package/dist/chunk-mfp4563h.js +0 -2
- package/dist/chunk-mzwa2478.js +0 -2
- package/dist/chunk-nq13s6sd.js +0 -2
- package/dist/chunk-pwaby9gk.js +0 -2
- package/dist/chunk-pxh3x1m6.js +0 -2
- package/dist/chunk-r6bc2q44.js +0 -2
- package/dist/chunk-rdj74dqc.js +0 -2
- package/dist/chunk-rn7s8h5j.js +0 -2
- package/dist/chunk-rtbkjq0y.js +0 -2
- package/dist/chunk-rwjgpmrw.js +0 -2
- package/dist/chunk-rwxtmr96.js +0 -2
- package/dist/chunk-sy1btryy.js +0 -2
- package/dist/chunk-t3m5bkqq.js +0 -2
- package/dist/chunk-t7mbaf69.js +0 -2
- package/dist/chunk-tjstkc0v.js +0 -2
- package/dist/chunk-vcssgx5z.js +0 -2
- package/dist/chunk-w2h6nn70.js +0 -2
- package/dist/chunk-w8b2jt4q.js +0 -2
- package/dist/chunk-wan4x3sg.js +0 -2
- package/dist/chunk-wjvhhy95.js +0 -2
- package/dist/chunk-wt18wv6x.js +0 -3
- package/dist/chunk-x5h95nnq.js +0 -2
- package/dist/chunk-ykmcnk3x.js +0 -2
- package/dist/chunk-z05dbey1.js +0 -2
- package/dist/chunk-z3anq3t4.js +0 -2
- package/dist/chunk-zgnfah3n.js +0 -2
- package/dist/chunk-zqhcdzby.js +0 -3
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ve,Os,Jf,xh,Yf,Sh,Nt,p,V,Z,yn,xe,Zf,ii,Qf,kh,k,eg,_h,E,Ch}from"./chunk-q73xkgn0.js";import"./chunk-jtgb1s62.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{eg as applyFilters,Sh as clearCustomFilters,Zf as clientLoopScopes,Os as defaultFilters,yn as escapeAttributeValue,p as escapeHtml,V as escapeHtmlValue,Z as escapeInterpolatedHtmlValue,E as evaluateExpression,ve as findMustacheEnd,Yf as getAllFilters,Qf as interpolateScriptAttributes,ii as interpolateScriptExpressions,kh as interpolateScriptsInTemplate,k as processExpressions,Jf as registerFilter,xh as registerFilters,Nt as replaceInterpolations,_h as resetRejectedExpressionWarnings,Ch as unescapeHtml,xe as usesSignalsInScript};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function u(e){let t=getComputedStyle(e),o=t.transitionDuration||"0s",n=t.animationDuration||"0s",s=(a)=>{let i=a.match(/^([\d.]+)(s|ms)?$/);if(!i)return 0;let r=parseFloat(i[1]);return(i[2]||"s")==="ms"?r:r*1000};return Math.max(s(o),s(n))}function v(e,t){return new Promise((o)=>{let n=t??u(e);if(n===0){o();return}let s=!1,a=()=>{if(s)return;s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("animationend",i),o()},i=(r)=>{if(r.target===e)a()};e.addEventListener("transitionend",i),e.addEventListener("animationend",i),setTimeout(a,n+50)})}function f(e){e.offsetHeight}async function
|
|
2
|
+
function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function u(e){let t=getComputedStyle(e),o=t.transitionDuration||"0s",n=t.animationDuration||"0s",s=(a)=>{let i=a.match(/^([\d.]+)(s|ms)?$/);if(!i)return 0;let r=parseFloat(i[1]);return(i[2]||"s")==="ms"?r:r*1000};return Math.max(s(o),s(n))}function v(e,t){return new Promise((o)=>{let n=t??u(e);if(n===0){o();return}let s=!1,a=()=>{if(s)return;s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("animationend",i),o()},i=(r)=>{if(r.target===e)a()};e.addEventListener("transitionend",i),e.addEventListener("animationend",i),setTimeout(a,n+50)})}function f(e){e.offsetHeight}async function lm(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.enter:t.duration;if(t.onBeforeEnter?.(e),e.classList.add(n.enterFrom),e.classList.add(n.enterActive),f(e),e.classList.remove(n.enterFrom),e.classList.add(n.enterTo),t.onEnter)await new Promise((a)=>{t.onEnter(e,a)});else await v(e,s);e.classList.remove(n.enterActive),e.classList.remove(n.enterTo),t.onAfterEnter?.(e)}async function um(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.leave:t.duration;if(t.onBeforeLeave?.(e),e.classList.add(n.leaveFrom),e.classList.add(n.leaveActive),f(e),e.classList.remove(n.leaveFrom),e.classList.add(n.leaveTo),t.onLeave)await new Promise((a)=>{t.onLeave(e,a)});else await v(e,s);e.classList.remove(n.leaveActive),e.classList.remove(n.leaveTo),t.onAfterLeave?.(e)}function dm(e,t={},o){let n=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return e.replace(n,(s,a,i)=>{let r=p(a),l=r.name||"stx",c=r.duration||300,d=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
3
3
|
<div
|
|
4
4
|
class="stx-transition-wrapper"
|
|
5
5
|
data-transition="${l}"
|
|
@@ -41,7 +41,7 @@ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:
|
|
|
41
41
|
});
|
|
42
42
|
})();
|
|
43
43
|
</script>
|
|
44
|
-
`})}function p(e){let t={},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let s=n[1],a=n[2]||n[3]||n[4]||n[5];switch(s){case"name":t.name=a;break;case"duration":t.duration=parseInt(a,10);break;case"mode":t.mode=a;break;case"easing":t.easing=a;break}}return t}function
|
|
44
|
+
`})}function p(e){let t={},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let s=n[1],a=n[2]||n[3]||n[4]||n[5];switch(s){case"name":t.name=a;break;case"duration":t.duration=parseInt(a,10);break;case"mode":t.mode=a;break;case"easing":t.easing=a;break}}return t}function pm(){return`
|
|
45
45
|
/* STX Transition Presets */
|
|
46
46
|
|
|
47
47
|
/* Fade */
|
|
@@ -228,7 +228,7 @@ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:
|
|
|
228
228
|
opacity: 1;
|
|
229
229
|
max-height: 1000px;
|
|
230
230
|
}
|
|
231
|
-
`}function
|
|
231
|
+
`}function fm(){return`
|
|
232
232
|
// STX Transition Runtime
|
|
233
233
|
(function() {
|
|
234
234
|
if (typeof window === 'undefined') return;
|
|
@@ -317,5 +317,5 @@ else {
|
|
|
317
317
|
|
|
318
318
|
console.log('[stx] Transition runtime initialized');
|
|
319
319
|
})();
|
|
320
|
-
`}function
|
|
321
|
-
export{
|
|
320
|
+
`}function gm(e){let t=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return e.replace(t,(o,n,s,a)=>{let i=s||"300",r=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${n}" data-stx-transition-duration="${i}" data-stx-transition-condition="${a}" data-stx-transition-id="${r}"`})}
|
|
321
|
+
export{lm,um,dm,pm,fm,gm};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{nn,ho,yo,bo,Xm,vo}from"./chunk-7407ac26.js";import"./chunk-3fwdxxh1.js";import"./chunk-2mqzpzy7.js";import"./chunk-rbmt5w9v.js";export{yo as buildServerApi,Xm as createServerApi,nn as discoverServerApi,ho as generateApiTypes,vo as isServerApiSource,bo as productionApiDispatcher};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{w,x,
|
|
2
|
+
import{w,x,Zo,dn}from"./chunk-q73xkgn0.js";import{No}from"./chunk-a9kxcdkz.js";import{l}from"./chunk-qc93ce5h.js";import M from"fs";import d from"path";import{hasLocalConfig as le}from"bunfig";var ht={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function qe(n){return`--stx-${n}`}function F(n,t){let s=t.lastIndexOf("-");if(s===-1)return typeof n[t]==="string"?n[t]:void 0;let r=n[t.slice(0,s)];if(!r||typeof r!=="object")return;let i=r[t.slice(s+1)];return typeof i==="string"?i:void 0}var xe=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function X(n,t){let s=t.trim();return F(n,s)??(xe.test(s)?s:void 0)}function Z(n={}){return[...Object.keys(n.roles??{}).filter((t)=>!ht[t]).map((t)=>`roles.${t}`),...Object.keys(n.shapes??{}).filter((t)=>!he[t]).map((t)=>`shapes.${t}`),...Object.keys(n.density??{}).filter((t)=>!Ae[t]).map((t)=>`density.${t}`)]}function q(n){let t={};for(let[s,r]of Object.entries(ht)){let i=F(n,r.light);if(i===void 0)continue;t[s]=`var(${qe(s)}, ${i})`}return t}function ee(n,t={}){let s=[],r=[];for(let[i,o]of Object.entries(ht)){let a=t[i],g=typeof a==="string"?a:a?.light,c=typeof a==="string"?a:a?.dark,u=g&&X(n,g)||F(n,o.light),m=c&&X(n,c)||F(n,o.dark);if(u===void 0)continue;if(s.push(` ${qe(i)}: ${u};`),m!==void 0)r.push(` ${qe(i)}: ${m};`)}if(s.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...s,"}",".dark {",...r,"}",""].join(`
|
|
3
3
|
`)}var he={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function rn(n){return`--stx-radius-${n}`}function te(){let n={};for(let[t,s]of Object.entries(he))n[t]=`var(${rn(t)}, ${s.value})`;return n}function ne(n={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(he).map(([t,s])=>` ${rn(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
4
4
|
`)}var Ae={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},Qn={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},er={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function Ke(n){return`--stx-${n}`}function V(n){let t=Ae[n];if(!t)throw Error(`[stx] unknown density token "${n}"`);return`var(${Ke(n)}, ${t.value})`}function se(){let n={};for(let[t,s]of Object.entries(Qn))n[t]=V(s);return n}function re(){let n={};for(let[t,{size:s,leading:r}]of Object.entries(er))n[t]=[V(s),{lineHeight:V(r)}];return n}function ie(n={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(Ae).map(([t,s])=>` ${Ke(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
5
5
|
`)}function oe(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}function U(n,t){let s={...n};for(let[r,i]of Object.entries(t))s[r]=oe(i)&&oe(s[r])?U(s[r],i):i;return s}function ce(n,t){if(!t.fonts)return"";let s=new n({...t.config,fonts:t.fonts,cssVariables:!1}).toCSS(!1,t.minify);return s&&!t.minify?`${s}
|
|
6
|
-
`:s}function ae(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...o}=r,{extend:a,...g}=s,c=g.colors||{};g.colors={...c,...q(c)};let u=g.borderRadius||{};g.borderRadius={...u,...te()};let m=g.spacing||{};g.spacing={...m,...se()};let H=g.fontSize||{};g.fontSize={...H,...re()};let R=U(g,o),k=U(a||{},i||{});if(Object.keys(k).length>0)R.extend=k;let E=[...n.safelist||[],...t.safelist||[]],_={...n.shortcuts||{},...t.shortcuts||{}},P=[...n.preflights||[],...t.preflights||[]],{fonts:K,...D}=n,{fonts:O,roles:T,shapes:N,density:C,...b}=t,f={roles:T,shapes:N,density:C},j=O??K;return{config:{...D,...b,theme:R,safelist:E,shortcuts:_,...P.length>0?{preflights:P}:{},content:[],output:""},safelist:E,shortcuts:_,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:ee({...c,...R.colors},T)+ne(N)+ie(C),unknownRoles:Z(f),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var p=null,A="";function de(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;A=`${t}@${Math.trunc(M.statSync(t).mtimeMs)}`}catch{A=n}}var Q=!1,v=null,I="",B=!1,pe=256,S=new Map,h=new Map,z=null,me=null,G=new Map,ge=new Set;function L(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function W(n,t){if(S.has(n))S.delete(n);else if(S.size>=pe)S.delete(S.keys().next().value);S.set(n,t)}function ke(n){let t=L(n);if(h.has(t))h.delete(t);else if(h.size>=pe)h.delete(h.keys().next().value);return h.set(t,n),t}function Jm(n){let t=h.get(n);if(t===void 0)return;return h.delete(n),h.set(n,t),t}async function Ce(n,t=z){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${L(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function Se(n,t,s=z){if(!s)return;try{if(!M.existsSync(s))M.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${L(n)}.css`),t)}catch{}}async function ue(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var we=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],be=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function ve(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of we)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Re(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function
|
|
7
|
-
`)}async function $e(n,t){try{let s=await
|
|
6
|
+
`:s}function ae(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...o}=r,{extend:a,...g}=s,c=g.colors||{};g.colors={...c,...q(c)};let u=g.borderRadius||{};g.borderRadius={...u,...te()};let m=g.spacing||{};g.spacing={...m,...se()};let H=g.fontSize||{};g.fontSize={...H,...re()};let R=U(g,o),k=U(a||{},i||{});if(Object.keys(k).length>0)R.extend=k;let E=[...n.safelist||[],...t.safelist||[]],_={...n.shortcuts||{},...t.shortcuts||{}},P=[...n.preflights||[],...t.preflights||[]],{fonts:K,...D}=n,{fonts:O,roles:T,shapes:N,density:C,...b}=t,f={roles:T,shapes:N,density:C},j=O??K;return{config:{...D,...b,theme:R,safelist:E,shortcuts:_,...P.length>0?{preflights:P}:{},content:[],output:""},safelist:E,shortcuts:_,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:ee({...c,...R.colors},T)+ne(N)+ie(C),unknownRoles:Z(f),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var p=null,A="";function de(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;A=`${t}@${Math.trunc(M.statSync(t).mtimeMs)}`}catch{A=n}}var Q=!1,v=null,I="",B=!1,pe=256,S=new Map,h=new Map,z=null,me=null,G=new Map,ge=new Set;function L(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function W(n,t){if(S.has(n))S.delete(n);else if(S.size>=pe)S.delete(S.keys().next().value);S.set(n,t)}function ke(n){let t=L(n);if(h.has(t))h.delete(t);else if(h.size>=pe)h.delete(h.keys().next().value);return h.set(t,n),t}function Jm(n){let t=h.get(n);if(t===void 0)return;return h.delete(n),h.set(n,t),t}async function Ce(n,t=z){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${L(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function Se(n,t,s=z){if(!s)return;try{if(!M.existsSync(s))M.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${L(n)}.css`),t)}catch{}}async function ue(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var we=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],be=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function ve(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of we)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Re(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function Ha(){if(Q)return p;Q=!0;try{let n=async(i)=>{for(let o of i){if(!await Bun.file(o).exists())continue;let a=await ue(o);if(a){if(de(o),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(o))}`);return a}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),o=await n([i]);if(!o)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return p=o,p}let t=await n(ve());if(t)return p=t,p;let s=be;for(let i of s){let o=await ue(i);if(o){p=o;try{de(import.meta.resolve(i))}catch{A=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return p}}let r=await n(Re());if(r)return p=r,p;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Ym(){Y.clear(),p=null,Q=!1,v=null,I="",S.clear(),h.clear(),me=null,G.clear()}var fe=!1;async function Va(n){try{let t=le({name:"css",cwd:n})?"css":le({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!fe)fe=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function uf(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-dph9dzzs.js"),r=await s(n);if(r.css)if(typeof r.css==="string"){let i=d.isAbsolute(r.css)?r.css:d.resolve(n,r.css);if(await Bun.file(i).exists()){let o=await import(i);t=o.default||o,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${r.css}`)}}else{if(t={...r.css,content:r.css.content||[],preflight:r.css.preflight??!0,minify:r.css.minify??!1},r.css.config){let i=d.isAbsolute(r.css.config)?r.css.config:d.resolve(n,r.css.config);if(await Bun.file(i).exists()){let o=await import(i);t={...o.default||o,...t}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return t||await Va(n)}function df(n){try{let t=new WeakSet;return L(JSON.stringify(n??{},(s,r)=>{if(typeof r==="function")return`[fn]${String(r)}`;if(typeof r==="object"&&r!==null){if(t.has(r))return"[circular]";t.add(r)}return r})??"")}catch{return"unhashable"}}async function sn(n){if(B)return I;B=!0;try{let t=await Ha();if(!t||!t.build)return B=!1,"";if(!v)v=await Va(n);if(!v)return B=!1,"";let s=t.defaultConfig?.theme||{},r=v.theme||{},i={...t.defaultConfig,...v,theme:{...s,...r,extend:{...s.extend||{},...r.extend||{}}}},o=performance.now(),a=await t.build(i),g=performance.now()-o;if(I=a.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${a.classes.size} classes in ${g.toFixed(1)}ms`),i.output){let c=d.isAbsolute(i.output)?i.output:d.join(n,i.output),u=d.dirname(c);if(!M.existsSync(u))M.mkdirSync(u,{recursive:!0});await Bun.write(c,a.css)}return B=!1,a.css}catch(t){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,t),B=!1,I}}async function tr(n){v=null,await sn(n)}function Zm(){return I}function pf(n){let t=new Set,s=/class\s*=\s*["']([^"']+)["']/gi,r=s.exec(n);while(r!==null){for(let a of r[1].split(/\s+/))if(a.trim())t.add(a.trim());r=s.exec(n)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,o=i.exec(n);while(o!==null){let a=o[1].match(/'([^']+)'/g);if(a){for(let g of a)for(let c of g.slice(1,-1).split(/\s+/))if(c.trim())t.add(c.trim())}o=i.exec(n)}return t}var Y=w(64);async function ff(n,t){let s=()=>G.get(t?d.resolve(t):process.cwd())?.fingerprint??null,r=Y.get(x(n,t,s()));if(r!==void 0)return r;let i=await $e(n,t);if(i)Y.set(x(n,t,s()),i);return i}function*ye(n){yield n;let t=new Set;for(let s of n.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let r=s[1];if(t.has(r))continue;t.add(r);let i=No(r);if(i)yield i}}function Qm(n){return[...ye(n)].join(`
|
|
7
|
+
`)}async function $e(n,t){try{let s=await Ha();if(!s)return"";let r=new Set;for(let f of ye(n)){let j=typeof s.extractClasses==="function"?s.extractClasses(f):pf(f);for(let J of j)r.add(J)}if(r.size===0)return"";let i=t?d.resolve(t):process.cwd(),o=l(i,"cache");if(!z)z=o;let a=G.get(i);if(!a){let f=await uf(i);a={config:f,fingerprint:df(f)},G.set(i,a),me=a.fingerprint}let g=[...r].sort().join(" "),c=`${A}::${a.fingerprint||"default"}::${g}`,u=S.get(c);if(u!==void 0)return W(c,u),u;let m=await Ce(c,o);if(m!==null)return W(c,m),m;let H=s.defaultConfig||s.config,R=a.config||{},k=ae(H,R),{safelist:E,includePreflight:_,minify:P,tokenCSS:K}=k;if(k.unknownRoles.length>0&&!ge.has(i))ge.add(i),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${k.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let D=k.config,O=new s.CSSGenerator(D),T=D.shortcuts||R.shortcuts||{},N=Object.keys(T).filter((f)=>r.has(f)||E.includes(f));for(let f of E)if(!T[f])O.generate(f);for(let f of r)if(!T[f])O.generate(f);let C="";if(N.length>0){let f=new s.CSSGenerator(D);for(let j of N)f.generate(j);if(C=f.toCSS(!1,P),C&&!C.endsWith(`
|
|
8
8
|
`))C+=`
|
|
9
|
-
`}let b=C+O.toCSS(_,P);return b=ce(s.CSSGenerator,k)+K+b,W(c,b),Se(c,b,o),b}catch(s){return console.warn("Failed to generate Css CSS:",s),""}}async function y(n,t,s=!1,r=!1){let i=await
|
|
9
|
+
`}let b=C+O.toCSS(_,P);return b=ce(s.CSSGenerator,k)+K+b,W(c,b),Se(c,b,o),b}catch(s){return console.warn("Failed to generate Css CSS:",s),""}}async function y(n,t,s=!1,r=!1){let i=await ff(n,t);if(!i)return r?dn(n):n;let o=s?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${ke(i)}.css">`:`<style data-css="generated">
|
|
10
10
|
${i}
|
|
11
11
|
</style>`;if(r)return Te(n,o);let a=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(a.test(n)){let g=!1;return n.replace(a,()=>{if(g)return"";return g=!0,o})}if(n.includes("</head>"))return n.replace("</head>",`${o}
|
|
12
12
|
</head>`);if(n.includes("<body"))return n.replace(/<body([^>]*)>/,`<body$1>
|
|
13
|
-
${o}`);return o+n}function Te(n,t){let s=
|
|
13
|
+
${o}`);return o+n}function Te(n,t){let s=Zo(n).map((c)=>({...c,replacement:""})),r=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,i=r.exec(n);if(i!==null){let c=!0;while(i!==null)s.push({start:i.index,end:i.index+i[0].length,replacement:c?t:""}),c=!1,i=r.exec(n)}else{let c=n.indexOf("</head>");if(c!==-1)s.push({start:c,end:c,replacement:`${t}
|
|
14
14
|
`});else{let u=n.match(/<body([^>]*)>/);if(u?.index!==void 0)s.push({start:u.index,end:u.index+u[0].length,replacement:`${u[0]}
|
|
15
15
|
${t}`});else s.push({start:0,end:0,replacement:t})}}s.sort((c,u)=>c.start-u.start||c.end-u.end);for(let c=1;c<s.length;c++)if(s[c].start<s[c-1].end)return je(dn(n),t);let o=Array(s.length*2+1),a=0,g=0;for(let c of s)o[g++]=n.slice(a,c.start),o[g++]=c.replacement,a=c.end;return o[g]=n.slice(a),o.join("")}function je(n,t){let s=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(s.test(n)){let r=!1;return n.replace(s,()=>{if(r)return"";return r=!0,t})}if(n.includes("</head>"))return n.replace("</head>",`${t}
|
|
16
16
|
</head>`);if(n.includes("<body"))return n.replace(/<body([^>]*)>/,`<body$1>
|
|
17
17
|
${t}`);return t+n}
|
|
18
|
-
export{ht,qe,he,rn,Ae,Qn,er,Ke,e,Jm,
|
|
18
|
+
export{ht,qe,he,rn,Ae,Qn,er,Ke,e,Jm,Ha,Ym,Va,uf,df,sn,tr,Zm,pf,ff,Qm,y};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-zkx2m308.js";import"./chunk-ez35607j.js";import"./chunk-zn3c0ew5.js";import"./chunk-q73xkgn0.js";import"./chunk-rbmt5w9v.js";import"./chunk-jtgb1s62.js";import"./chunk-4c86wr9a.js";import"./chunk-dxzs589r.js";import{l}from"./chunk-qc93ce5h.js";import u from"fs";import m from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||l(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=m.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),c=JSON.parse(p);if(c.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(c.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
|
|
3
3
|
`)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{wg}from"./chunk-5zg56hwd.js";import"./chunk-z5pm69w1.js";import"./chunk-g8ve8pag.js";import"./chunk-x9wwd2ee.js";import"./chunk-7nmrycrz.js";import"./chunk-87zvjhp9.js";import"./chunk-m1n9re2p.js";import"./chunk-mymb85q5.js";import"./chunk-r3j4m04w.js";import"./chunk-0k1nwbch.js";import"./chunk-yen9xzzg.js";import"./chunk-m5nzpjej.js";import"./chunk-a9kxcdkz.js";import"./chunk-0babpwqd.js";import"./chunk-dxzs589r.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-q73xkgn0.js";import"./chunk-jtgb1s62.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{wg as startInteractive};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var w={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function zt(){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" \uD83D\uDCD6 STX Story ")+c("\u2551")),console.log(c(" \u2551")+m(" Component Showcase & Testing ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function
|
|
3
|
-
export{zt,
|
|
2
|
+
var w={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function zt(){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" \uD83D\uDCD6 STX Story ")+c("\u2551")),console.log(c(" \u2551")+m(" Component Showcase & Testing ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function Ws(e,t){if(console.log(a(" Server running at:")),console.log(""),console.log(` ${m("\u279C")} ${a("Local:")} ${c(e)}`),t)console.log(` ${m("\u279C")} ${a("Network:")} ${c(t)}`);console.log("")}function Ht(e){let t=e>0?"\u2713":"\u25CB",r=e>0?S:y;console.log(` ${r(t)} Found ${a(String(e))} story ${e===1?"file":"files"}`)}function Ai(e,t){if(console.log(""),console.log(` ${b("\u2717")} ${a(b("Error:"))} ${e}`),t)console.log(` ${m(t)}`);console.log("")}function it(e){console.log(` ${y("\u26A0")} ${y("Warning:")} ${e}`)}function Pi(e){console.log(` ${O("\u2139")} ${e}`)}function Ii(e,t,r){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" Build Complete ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(""),console.log(` ${S("\u2713")} Stories: ${a(String(e))}`),console.log(` ${S("\u2713")} Output: ${a(t)}`),console.log(` ${S("\u2713")} Time: ${a(`${r}ms`)}`),console.log("")}function qs(){console.log(""),console.log(a(" Keyboard Shortcuts:")),console.log(""),console.log(` ${c("h")} Show this help`),console.log(` ${c("o")} Open in browser`),console.log(` ${c("r")} Restart server`),console.log(` ${c("c")} Clear console`),console.log(` ${c("q")} Quit`),console.log("")}import h from"fs";import d from"path";async function Vt(e){let{root:t,config:r}=e,o=[],i=await P(t,r.storyMatch,r.storyIgnored);for(let s of i){let n=d.resolve(t,s),l=v(s,n);o.push(l)}return o}async function P(e,t,r){let o=[];async function i(s,n){let l=await h.promises.readdir(s,{withFileTypes:!0});for(let g of l){let f=d.join(s,g.name),u=d.relative(n,f);if(T(u,r))continue;if(g.isDirectory())await i(f,n);else if(g.isFile()){if(F(u,t))o.push(u)}}}return await i(e,e),o}function T(e,t){for(let r of t)if(E(e,r))return!0;return!1}function F(e,t){for(let r of t)if(E(e,r))return!0;return!1}function E(e,t){let r=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"{{GLOBSTAR}}").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\{\{GLOBSTAR\}\}/g,".*");return i=`^${i}$`,new RegExp(i).test(r)}function v(e,t){let r=d.basename(e,".story.stx");return{id:e.toLowerCase().replace(/\.story\.stx$/,"").replace(/[/\\]/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),path:t,relativePath:e,fileName:r,treeFile:{title:r,path:e}}}function Oi(e,t){let{root:r,config:o}=e,i=[],s=h.watch(r,{recursive:!0},async(n,l)=>{if(!l)return;let g=l.replace(/\\/g,"/");if(!F(g,o.storyMatch))return;if(T(g,o.storyIgnored))return;let f=d.resolve(r,g);try{await h.promises.access(f);let u=v(g,f);t(n==="rename"?"add":"change",u)}catch{let u=v(g,f);t("unlink",u)}});return i.push(s),()=>{for(let n of i)n.close()}}function N(e,t){let r=t.treeFile||{title:t.fileName,path:t.relativePath};if(e.tree.file==="title")return r.title.split("/");if(e.tree.file==="path")return[...t.relativePath.split("/").slice(0,-1),r.title];if(typeof e.tree.file==="function")return e.tree.file(r);return[r.title]}function Ut(e,t){for(let n of t)n.treePath=N(e,n);let r=(e.tree.groups||[]).map((n)=>({groupConfig:{id:n.id||n.title,title:n.title,include:n.include},treeObject:{}})),o={treeObject:{}};r.push(o);for(let n=0;n<t.length;n++){let l=t[n],g=j(l,r,o);k(l.treePath,n,g.treeObject)}let i=e.tree.order==="asc"?(n,l)=>n.localeCompare(l):e.tree.order,s=[];for(let n of r)if(n===o)s.push(...x(n.treeObject,i));else if(n.groupConfig&&Object.keys(n.treeObject).length>0)s.push({group:!0,id:n.groupConfig.id,title:n.groupConfig.title,children:x(n.treeObject,i)});return s}function j(e,t,r){let o=e.treeFile||{title:e.fileName,path:e.relativePath};for(let i of t)if(i.groupConfig?.include&&i.groupConfig.include(o))return i;return r}function k(e,t,r){let o=r;for(let i=0;i<e.length;i++){let s=e[i];if(i===e.length-1)if(o[s]!==void 0){let l=1;while(o[`${s}-${l}`]!==void 0)l++;o[`${s}-${l}`]=t}else o[s]=t;else{if(o[s]===void 0)o[s]={};else if(typeof o[s]==="number"){let l=o[s];o[s]={"":l}}o=o[s]}}}function x(e,t){let r=[];for(let[o,i]of Object.entries(e))if(typeof i==="number")r.push({title:o,index:i});else r.push({title:o,children:x(i,t)});return r.sort((o,i)=>t(o.title,i.title)),r}
|
|
3
|
+
export{zt,Ws,Ht,Ai,it,Pi,Ii,qs,Vt,Oi,Ut};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Jg,sa,Kl,Yg,Zg,Qg,em,tm,Gl,Xl,nm,rm,sm,om}from"./chunk-j0sj81bg.js";import"./chunk-z5pm69w1.js";import"./chunk-g8ve8pag.js";import"./chunk-x9wwd2ee.js";import"./chunk-7nmrycrz.js";import"./chunk-87zvjhp9.js";import"./chunk-m1n9re2p.js";import"./chunk-mymb85q5.js";import"./chunk-r3j4m04w.js";import"./chunk-0k1nwbch.js";import"./chunk-yen9xzzg.js";import"./chunk-m5nzpjej.js";import"./chunk-a9kxcdkz.js";import"./chunk-0babpwqd.js";import"./chunk-dxzs589r.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-q73xkgn0.js";import"./chunk-jtgb1s62.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{Kl as SUSPENSE_RESOLVER_RUNTIME,sa as buildSuspenseResolveScript,tm as createStreamRenderer,Qg as extractStreamBoundaries,om as generateHydrationRuntime,Xl as islandDirective,rm as processSectionDirectives,Zg as processStreamDirectives,nm as registerStreamingDirectives,Yg as renderStreamingPage,Jg as streamTemplate,em as streamTemplateSimple,sm as streamToResponse,Gl as streamingSuspenseDirective};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{existsSync as A,mkdtempSync as D,readdirSync as M,rmSync as b,statSync as g,writeFileSync as k}from"fs";import{constants as P,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var _=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",I=60000,N=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{b(e,{recursive:!0,force:!0})}catch{}}function R(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function C(e){if(R(),t.listenerCount(e)===0)t.exit(128+(P.signals[e]??1))}var h=new Map(N.map((e)=>[e,()=>C(e)]));function G(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function K(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function O(e={}){let n=e.root??x(),r=e.isAlive??K,w=e.minAgeMs??I,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let d of u){let l=_.exec(d);if(!l)continue;let m=Number(l[1]);if(m===t.pid||r(m))continue;let o=s(n,d);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function L(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function z(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function We(e="stx",n=x()){if(!S.has(n))S.add(n),O({root:n});let r=D(s(n,L(e)));if(z())return H(r),console.warn(`[stx] STX_KEEP_TEMP: keeping ${r}`),r;return G(),i.add(r),r}function re(e){if(y.has(e))return;if(p(e),i.delete(e),i.size===0)f()}function H(e){try{k(s(e,v),`kept by pid ${t.pid}
|
|
3
|
-
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function
|
|
4
|
-
export{We,re,
|
|
3
|
+
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function Da(e,n){let r=We(e);try{return await n(r)}finally{re(r)}}
|
|
4
|
+
export{We,re,Da};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
2
|
+
function ta(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="id",dynamicHeight:d=!1,estimatedItemHeight:g=l,direction:x="vertical"}=c,e=[...v],t=0,n=new Map;function f(){if(d)return h();let i=Math.max(0,Math.floor(t/l)-s),r=Math.ceil(u/l),m=Math.min(e.length-1,i+r+s*2);return{startIndex:i,endIndex:m}}function h(){let i=0,r=0,m=e.length-1;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+M>t){r=Math.max(0,p-s);break}i+=M}i=0;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+=M,i>t+u){m=Math.min(e.length-1,p+s);break}}return{startIndex:r,endIndex:m}}function w(){if(d){let i=0;for(let r=0;r<e.length;r++)i+=n.get(r)||g;return i}return e.length*l}function y(i){if(d){let r=0;for(let m=0;m<i;m++)r+=n.get(m)||g;return r}return i*l}function S(){let{startIndex:i,endIndex:r}=f();return{startIndex:i,endIndex:r,scrollTop:t,totalHeight:w(),visibleItems:e.slice(i,r+1),itemHeights:new Map(n)}}function L(i,r="auto"){let m=y(i);a(m,r)}function a(i,r="auto"){t=Math.max(0,Math.min(i,w()-u))}function o(){f()}function H(i){e=[...i],n.clear(),o()}function I(){e=[],n.clear()}return{scrollToIndex:L,scrollToOffset:a,getState:S,refresh:o,setItems:H,destroy:I}}function na(v,c={},l){let u=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualList: items "${x}" not found or not an array -->`;let t={itemHeight:50,containerHeight:400,overscan:3};if(d)try{let a=d.trim(),o=Function(`return ${a}`)();t={...t,...o}}catch{}let n=`vlist-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(t.containerHeight/t.itemHeight),h=t.overscan||3,w=0,y=Math.min(e.length-1,f+h),S="";for(let a=w;a<=y&&a<e.length;a++){let o=e[a],H=g.replace(/\{\{\s*item\s*\}\}/g,typeof o==="object"?JSON.stringify(o):String(o)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,i)=>{if(typeof o==="object"&&o!==null)return String(o[i]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(a));S+=`
|
|
3
3
|
<div class="virtual-item ${t.itemClass||""}"
|
|
4
4
|
style="position: absolute; top: ${a*t.itemHeight}px; height: ${t.itemHeight}px; width: 100%;"
|
|
5
5
|
data-index="${a}">
|
|
@@ -76,7 +76,7 @@ function ea(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
76
76
|
};
|
|
77
77
|
})();
|
|
78
78
|
</script>
|
|
79
|
-
`})}function
|
|
79
|
+
`})}function $l(){return`
|
|
80
80
|
.virtual-list-container {
|
|
81
81
|
position: relative;
|
|
82
82
|
overflow-y: auto;
|
|
@@ -124,7 +124,7 @@ function ea(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
124
124
|
0% { background-position: 200% 0; }
|
|
125
125
|
100% { background-position: -200% 0; }
|
|
126
126
|
}
|
|
127
|
-
`}function
|
|
127
|
+
`}function Rl(v,c){let l=null,u=()=>{if(!l)l=ta(v(),c);return l};return{visibleItems:()=>u().getState().visibleItems,totalHeight:()=>u().getState().totalHeight,containerProps:()=>({style:{height:`${c.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(s)=>{let b=s.target;if(l)l.scrollToOffset(b.scrollTop)}}),itemProps:(s)=>({style:{position:"absolute",top:`${s*c.itemHeight}px`,height:`${c.itemHeight}px`,width:"100%"},"data-index":s}),scrollToIndex:(s)=>{u().scrollToIndex(s)}}}function Al(v,c={},l){let u=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return v.replace(u,(s,b,d,g,x)=>{let e=b.trim(),t=c[e];if(!t||!Array.isArray(t))return`<!-- infiniteList: items "${e}" not found or not an array -->`;let n={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(d)try{let w=Function(`return ${d.trim()}`)();n={...n,...w}}catch{}let f=`ilist-${Math.random().toString(36).substring(2,9)}`,h=na(`@virtualList(${e}, ${JSON.stringify({itemHeight:n.itemHeight,containerHeight:n.containerHeight,overscan:n.overscan,containerClass:n.containerClass})})${g}@endvirtualList`,c);return h=h.replace("</script>",`
|
|
128
128
|
// Infinite scroll detection
|
|
129
129
|
container.addEventListener('scroll', function() {
|
|
130
130
|
const scrollBottom = container.scrollTop + container.clientHeight;
|
|
@@ -142,7 +142,7 @@ function ea(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
142
142
|
${x}
|
|
143
143
|
</div>
|
|
144
144
|
</div>
|
|
145
|
-
`})}function
|
|
145
|
+
`})}function Pl(v,c={},l){let u=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualGrid: items "${x}" not found or not an array -->`;let t={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(d)try{let o=Function(`return ${d.trim()}`)();t={...t,...o}}catch{}let n=`vgrid-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(e.length/t.columns),h=f*(t.rowHeight+(t.gap||0)),w=Math.ceil(t.containerHeight/(t.rowHeight+(t.gap||0))),y=t.overscan||2,S=0,L=Math.min(f-1,w+y),a="";for(let o=S;o<=L;o++)for(let H=0;H<t.columns;H++){let I=o*t.columns+H;if(I>=e.length)break;let i=e[I],r=H*(100/t.columns),m=o*(t.rowHeight+(t.gap||0)),p=g.replace(/\{\{\s*item\s*\}\}/g,typeof i==="object"?JSON.stringify(i):String(i)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,T)=>{if(typeof i==="object"&&i!==null)return String(i[T]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(I));a+=`
|
|
146
146
|
<div class="virtual-grid-item"
|
|
147
147
|
style="position: absolute; top: ${m}px; left: ${r}%; width: calc(${100/t.columns}% - ${t.gap||0}px); height: ${t.rowHeight}px;"
|
|
148
148
|
data-index="${I}">
|
|
@@ -212,5 +212,5 @@ function ea(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
212
212
|
});
|
|
213
213
|
})();
|
|
214
214
|
</script>
|
|
215
|
-
`})}var
|
|
216
|
-
export{
|
|
215
|
+
`})}var qg={createVirtualList:ta,processVirtualListDirectives:na,processInfiniteListDirectives:Al,processVirtualGridDirectives:Pl,generateVirtualListCSS:$l,useVirtualList:Rl};
|
|
216
|
+
export{ta,na,$l,Rl,Al,Pl,qg};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
${r.trim()}`)}catch(r){console.warn(`[stx] Failed to load composable ${o}:`,r)}if(
|
|
4
|
-
`),j=JSON.stringify([...
|
|
2
|
+
import{_}from"./chunk-ez35607j.js";import{A,kn}from"./chunk-zn3c0ew5.js";import{cn,w,x,C,Y}from"./chunk-q73xkgn0.js";import{a}from"./chunk-0babpwqd.js";import{Te,Qt,en,tn}from"./chunk-k3j8kd19.js";import{yt}from"./chunk-0k1nwbch.js";import{ft,jn,Kt,ce}from"./chunk-h6pmg82p.js";import{T,$r}from"./chunk-xaddgvkx.js";import h from"path";var S=new Map,D=new Map,k=w(64),E=new Map,X=["composables","functions"];function z(t){let n=h.basename(t,".ts");return n==="index"||n==="types"||t.endsWith(".d.ts")}async function Z(t){if(t)return h.resolve(t);let n=`<default>:${process.cwd()}`,i=E.get(n);if(i!==void 0)return i;let e=await q();if(e!==null)E.set(n,e);return e}async function q(){let t=await a(),n=t.root||process.cwd(),i=t.composablesDir;if(i)return h.resolve(n,i);for(let e of X){let s=h.resolve(n,e);try{let d=new Bun.Glob("**/*.ts");for await(let c of d.scan({cwd:s,absolute:!0}))if(!z(c))return s}catch{}}return null}async function G(t){let n=Array.isArray(t)?t:t?[h.resolve(t)]:(await a())._layerComposableDirs??[await Z()].filter((e)=>!!e),i=new Map;for(let e of n){let s=new Bun.Glob("**/*.ts");try{for await(let d of s.scan({cwd:e,absolute:!0})){let c=h.relative(e,d);if(!z(d)&&!i.has(c))i.set(c,d)}}catch{}}return{key:n.join("\x00"),files:[...i.values()].sort()}}async function so(t){let{files:n}=await G(t),i=Y({loader:"ts",target:"browser",define:C()}),e=[];for(let s of n)try{let d=await Bun.file(s).text(),c=i.scan(d).exports.filter((m)=>m!=="default");if(c.length>0)e.push({file:s,names:c})}catch{}return e}function Q(t,n){return new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function J(t,n){let i=new Set(t.match(/\w+/g)),e=new Set;for(let s of n)if(/^\w+$/.test(s)?i.has(s):Q(t,s))e.add(s);return e}var U=w(64);function V(t,n){let i=x(t,n.size),e=U.get(i);if(e)return e;let s;try{s=cn(t,n)}catch{s=J(t,n)}let d=[...t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...t.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let c of d)for(let m of c[1].split(",")){let p=m.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(p&&n.has(p))s.add(p)}return U.set(i,s),s}function ee(t,n,i){let e=new Map;for(let{file:u,names:l}of t)for(let f of l)if(!e.has(f))e.set(f,u);let s=(u)=>{let l=[];for(let f of J(u,e.keys()))l.push(e.get(f));return l},d=new Set(e.keys()),c=(u)=>{let l=[];for(let f of V(u,d))l.push(e.get(f));return l},m=new Set,p=i.flatMap((u,l)=>l===0?s(u):c(u));while(p.length>0){let u=[];for(let l of p){if(m.has(l))continue;m.add(l);for(let f of c(n.get(l)??""))if(!m.has(f))u.push(f)}p=u}return m}async function Nm(t,n,i){let{key:e,files:s}=await G(t);if(!e)return null;let d=()=>[...new Set([...s,...s.flatMap((o)=>Te(o))])],c=ft(d());if(s.length===0)return ce(S,e,c,""),null;s.sort();let m=Y({loader:"ts",target:"browser",define:C()}),p=Kt(D,e,c);if(!p){let o=new Map,r=[];for(let g of s)try{let y=await Bun.file(g).text();o.set(g,y);let b=m.scan(y).exports.filter((W)=>W!=="default");if(b.length>0)r.push({file:g,names:b})}catch{o.set(g,"")}p=ce(D,e,c,{codeByFile:o,modules:r})}let{codeByFile:u,modules:l}=p,f;if(n===void 0)f=new Set(s);else{let o=i?[n,...i]:[n],r=x(o.join("\x00"),e,o.length,c),g=k.get(r);if(f=g??ee(l,u,o),!g)k.set(r,f)}if(f.size===0)return null;let I=s.filter((o)=>f.has(o)),B=`${e}\x00${I.join("\x00")}\x00${en()}`,F=Kt(S,B,c);if(F!==void 0)return F||null;let M=[],v=new Set,R=new Set;for(let o of I)try{let r=u.get(o)??await Bun.file(o).text(),g=h.basename(o,".ts");for(let b of r.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(b[1])R.add(b[1]);let y=[];try{for(let b of m.scan(r).exports)if(b!=="default")v.add(b),y.push(b)}catch{}if(r=A(r),Qt(r))r=await tn(r,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:y}),r=yt(r);r=kn(r),r=r.replace(/^export\s+(default\s+)?/gm,""),r=m.transformSync(r),M.push(`// Composable: ${g}
|
|
3
|
+
${r.trim()}`)}catch(r){console.warn(`[stx] Failed to load composable ${o}:`,r)}if(M.length===0||v.size===0)return ce(S,B,c,""),null;let L=[...v].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
|
|
4
|
+
`),j=JSON.stringify([...v]),N=M.join(`
|
|
5
5
|
|
|
6
|
-
`),H=
|
|
7
|
-
`),P=JSON.stringify(new Bun.CryptoHasher("md5").update(`${j}\x00${
|
|
6
|
+
`),H=_.filter((o)=>!R.has(o)&&new RegExp(`\\b${o}\\b`).test(N)).map((o)=>`var ${o} = __stx[${JSON.stringify(o)}];`).join(`
|
|
7
|
+
`),P=JSON.stringify(new Bun.CryptoHasher("md5").update(`${j}\x00${N}`).digest("hex").slice(0,12)),K=`;(function(){
|
|
8
8
|
var __bundles = window.__stxComposableBundles || (window.__stxComposableBundles = {});
|
|
9
9
|
if (__bundles[${P}]) return;
|
|
10
10
|
__bundles[${P}] = true;
|
|
@@ -13,7 +13,7 @@ window.__composables = window.__composables || {};
|
|
|
13
13
|
var __c = window.__composables;
|
|
14
14
|
var __stx = window.stx || {};
|
|
15
15
|
${H}
|
|
16
|
-
${
|
|
16
|
+
${N}
|
|
17
17
|
${L}
|
|
18
18
|
var __names = ${j};
|
|
19
19
|
for (var __i = 0; __i < __names.length; __i++) {
|
|
@@ -29,5 +29,5 @@ ${L}
|
|
|
29
29
|
window[__n] = __c[__n];
|
|
30
30
|
__published[__n] = true;
|
|
31
31
|
}
|
|
32
|
-
})();`,O=T()?$r(K):K;return c=ft(d()),ce(S,
|
|
33
|
-
export{
|
|
32
|
+
})();`,O=T()?$r(K):K;return c=ft(d()),ce(S,B,c,O),O}function Dm(){S.clear(),jn(),D.clear(),k.clear(),E.clear()}
|
|
33
|
+
export{so,Nm,Dm};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{m,h,p}from"./chunk-
|
|
2
|
+
import{m,h,p}from"./chunk-q73xkgn0.js";import{j}from"./chunk-0babpwqd.js";import{i}from"./chunk-z5pm69w1.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function Jg(e,t={},o={}){let n={...j,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,y,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let u=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)u.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,y,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,y,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,y,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,y,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(d.name,i(d.content,y,e,n,l))}r.enqueue(`
|
|
5
5
|
<script>
|
|
@@ -17,13 +17,13 @@ import{m,h,p}from"./chunk-9gdb9a7z.js";import{L}from"./chunk-nxmrbz95.js";import
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
})();
|
|
20
|
-
</script>`);let x=Array.from(w.entries()).map(async([d,u])=>{r.enqueue(await
|
|
20
|
+
</script>`);let x=Array.from(w.entries()).map(async([d,u])=>{r.enqueue(await sa(d,u))});await Promise.all(x)}r.close()}catch(a){r.error(a)}}})}async function sa(e,t){try{let n=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
|
|
21
21
|
<script>
|
|
22
22
|
window.__stxSuspense.resolve('${e}', \`${n}\`);
|
|
23
23
|
</script>`}catch(o){let n=o instanceof Error?o.message:String(o);return`
|
|
24
24
|
<script>
|
|
25
25
|
window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${p(n)}</div>');
|
|
26
|
-
</script>`}}var
|
|
26
|
+
</script>`}}var Kl=`
|
|
27
27
|
<script>
|
|
28
28
|
(function(){
|
|
29
29
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -43,12 +43,12 @@ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading conte
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
})();
|
|
46
|
-
</script>`;function z(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function
|
|
46
|
+
</script>`;function z(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function Yg(e,t=[],o={}){let n=o.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(Kl),await Promise.all(t.map(async(r)=>{let a=z(r.render(),n,r.id);s.enqueue(await sa(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var A=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function Zg(e,t){return e.replace(A,(o,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),S=a[0].trim(),g=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=S,`<div data-suspense="${r}">${g}</div>`})}function Qg(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,n])=>typeof n==="function");return o.length>0?o.map(([n,s])=>({id:n,render:s})):void 0}async function em(e,t={},o={}){let n={...j,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=new Set,l=n.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(l!=="manual"&&R.test(c))){let x=await i(c,y,e,n,E);for(let d=0;d<x.length;d+=s)r.enqueue(x.slice(d,d+s))}else{let x=[],d=new RegExp(T.source,"g"),u;while((u=d.exec(c))!==null)x.push({name:u[1],content:u[2],start:u.index,end:u.index+u[0].length});let b=0;for(let f of x){if(f.start>b){let _=c.slice(b,f.start);if(_.trim()){let C=await i(_,y,e,n,E);r.enqueue(C)}}let v=await i(f.content,y,e,n,E);r.enqueue(v),b=f.end}if(b<c.length){let f=c.slice(b);if(f.trim()){let v=await i(f,y,e,n,E);r.enqueue(v)}}}r.close()}catch(a){r.error(a)}}})}async function tm(e,t={}){let o={...j,...t,streaming:{...q,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S=a,g={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let l=c[1],R=c[2];g[l]=R}let y=a.replace(T,"");return{renderShell:async(l={})=>{let R={...l,__filename:e,__dirname:k.dirname(e)};return await m(r,R,e),i(y,R,e,o,new Set)},renderSection:async(l,R={})=>{try{if(!g[l])return`<div class="error-message">Section "${p(l)}" not found in template "${p(e)}"</div>`;let w={...R,__filename:e,__dirname:k.dirname(e)};await m(r,w,e);let x=new Set;return await i(g[l],w,e,o,x)}catch(w){let x=w instanceof Error?w.message:String(w);return h("Expression",x,e,g[l]||"",0,g[l]||"")}},getSections:()=>Object.keys(g),getTemplate:()=>S}}var Gl={name:"suspense",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},Xl={name:"island",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),r=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,S=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),g=S?S[1].trim():"",c=S?e.replace(S[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
|
|
47
47
|
${c}
|
|
48
48
|
<script type="application/json" data-island-props="${a}">
|
|
49
49
|
${g?`{${g}}`:"{}"}
|
|
50
50
|
</script>
|
|
51
|
-
</div>`}};function
|
|
51
|
+
</div>`}};function nm(e={}){let t=[];if(e.streaming?.enabled)t.push(Gl);if(e.hydration?.enabled)t.push(Xl);return t}async function rm(e,t,o,n={}){return e}function sm(e,t={}){let o=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(r,a){a.enqueue(o.encode(r))}})),s=new Headers(t.headers);if(!s.has("Content-Type"))s.set("Content-Type","text/html; charset=utf-8");if(!s.has("Transfer-Encoding"))s.set("Transfer-Encoding","chunked");if(!s.has("X-Content-Type-Options"))s.set("X-Content-Type-Options","nosniff");if(!s.has("X-Accel-Buffering"))s.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:s})}function om(e={mode:"full"}){let{mode:t,components:o={},dynamicImports:n=!0}=e,s=Object.entries(o).map(([r,a])=>`'${r}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
|
|
52
52
|
`);if(t==="loader")return`
|
|
53
53
|
(function() {
|
|
54
54
|
window.__stx = window.__stx || {};
|
|
@@ -191,4 +191,4 @@ else {
|
|
|
191
191
|
stx.hydrate();
|
|
192
192
|
}
|
|
193
193
|
})();`}
|
|
194
|
-
export{
|
|
194
|
+
export{Jg,sa,Kl,Yg,Zg,Qg,em,tm,Gl,Xl,nm,rm,sm,om};
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
import o from"fs";import u from"path";var h={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"};function p(e){let r=0;for(let t=0;t<e.length;t++){let n=e[t];r=(r<<5)-r+n,r=r&r}return Math.abs(r).toString(16).padStart(8,"0")}function x(e,r){let t=u.basename(e);for(let n of r)if(n.startsWith("*.")){let i=n.slice(1);if(t.endsWith(i))return!0}else if(n.includes("*")){let i=new RegExp(`^${n.replace(/\*/g,".*")}$`);if(i.test(t)||i.test(e))return!0}else if(t===n||e.includes(n))return!0;return!1}function S(e,r,t){let n=u.extname(e).toLowerCase(),i=h[n],c=(t.maxFileSizeKB||500)*1024;if(r>c)return!1;if(t.exclude&&x(e,t.exclude))return!1;if(t.include&&t.include.length>0){for(let s of t.include)if(s.startsWith("*.")){if(e.endsWith(s.slice(1)))return!0}else if(e.includes(s))return!0}if(i&&t[i]===!0)return!0;if(!i)return!1;return!1}function f(e,r,t,n){let i=o.readdirSync(e,{withFileTypes:!0});for(let c of i){let s=u.join(e,c.name);if(c.isDirectory()){if(["node_modules",".git",".stx"].includes(c.name))continue;f(s,r,t,n)}else if(c.isFile()){let a=o.statSync(s),l=u.relative(r,s);if(S(l,a.size,t)){let d=o.readFileSync(s),g=p(d),m=`/${l.replace(/\\/g,"/")}`;n.push({url:m,revision:g,size:a.size})}}}}function Ve(e,r){let t=r.pwa?.precache,n=[];if(!t?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!o.existsSync(e))return{entries:[],totalSize:0,fileCount:0};f(e,e,t,n),n.sort((c,s)=>c.url.localeCompare(s.url));let i=n.reduce((c,s)=>c+s.size,0);return{entries:n,totalSize:i,fileCount:n.length}}function _n(e){if(e.entries.length===0)return"[]";return`[
|
|
3
3
|
${e.entries.map((t)=>` { url: '${t.url}', revision: '${t.revision}' }`).join(`,
|
|
4
4
|
`)}
|
|
5
|
-
]`}function
|
|
6
|
-
export{Ve,_n,
|
|
5
|
+
]`}function vi(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;return`${(e/1048576).toFixed(2)} MB`}
|
|
6
|
+
export{Ve,_n,vi};
|