@stacksjs/stx 0.2.887 → 0.2.889
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-c0g30cjs.js → chunk-05x1rd86.js} +2 -2
- package/dist/chunk-0g9cceht.js +2 -0
- package/dist/chunk-0k437z3q.js +2 -0
- package/dist/{chunk-69ezjc8k.js → chunk-0ncafcs2.js} +4 -4
- package/dist/chunk-0rpj5t80.js +2 -0
- package/dist/{chunk-sc1gmts0.js → chunk-1gyxxfdf.js} +2 -2
- package/dist/{chunk-aaea157p.js → chunk-1knk403z.js} +2 -2
- package/dist/{chunk-q74affc4.js → chunk-1n33yrar.js} +2 -2
- package/dist/chunk-1p4q6t48.js +2 -0
- package/dist/chunk-1z6pqvmf.js +2 -0
- package/dist/{chunk-s29hp1qw.js → chunk-2a5g80mq.js} +3 -3
- package/dist/chunk-2ba4zfa0.js +2 -0
- package/dist/chunk-2gn2nc2j.js +2 -0
- package/dist/chunk-2nqmw4dv.js +2 -0
- package/dist/chunk-2wkpksg1.js +2 -0
- package/dist/chunk-3dqfjpz4.js +68 -0
- package/dist/{chunk-zpj6ggee.js → chunk-3hsv6ejp.js} +4 -4
- package/dist/{chunk-8e1cv1hh.js → chunk-3qk8vf9m.js} +3 -3
- package/dist/chunk-3yjyjq0m.js +2 -0
- package/dist/chunk-444haxxa.js +2 -0
- package/dist/{chunk-azf6tdq6.js → chunk-446tb2th.js} +28 -28
- package/dist/{chunk-4251fy7d.js → chunk-48rwqchc.js} +11 -11
- package/dist/chunk-4akw3bym.js +2 -0
- package/dist/{chunk-twmkz0xs.js → chunk-4kmg6g5n.js} +9 -9
- package/dist/chunk-4rvfeee5.js +2 -0
- package/dist/{chunk-4n45qa0b.js → chunk-51720m79.js} +5 -5
- package/dist/chunk-53kcqdjj.js +2 -0
- package/dist/{chunk-02qmvcmv.js → chunk-55tc5w32.js} +3 -3
- package/dist/{chunk-0mx7rg07.js → chunk-58qzyyyv.js} +3 -3
- package/dist/chunk-5aa83bpm.js +2 -0
- package/dist/{chunk-d2pexm3z.js → chunk-5kqezrjt.js} +2 -2
- package/dist/chunk-5ssv10ep.js +2 -0
- package/dist/chunk-67rppc5v.js +2 -0
- package/dist/{chunk-care745q.js → chunk-6gtecbe7.js} +2 -2
- package/dist/{chunk-km14pdrt.js → chunk-6kyqejnq.js} +22 -22
- package/dist/{chunk-32twt3wx.js → chunk-6pdy7ajr.js} +3 -3
- package/dist/{chunk-fg67643b.js → chunk-6pz5gq6v.js} +9 -9
- package/dist/{chunk-rsxxajv6.js → chunk-700m927w.js} +2 -2
- package/dist/{chunk-gvd8nb8z.js → chunk-7212fwzz.js} +2 -2
- package/dist/chunk-732gb689.js +2 -0
- package/dist/chunk-77c89d23.js +2 -0
- package/dist/chunk-79vbkez0.js +2 -0
- package/dist/{chunk-88tshy2f.js → chunk-7hpca9c7.js} +6 -6
- package/dist/chunk-80xzjxah.js +2 -0
- package/dist/chunk-8354mzpd.js +2 -0
- package/dist/{chunk-2v7v6jcs.js → chunk-87g5xmmr.js} +12 -12
- package/dist/{chunk-sv7fdqmc.js → chunk-8hwfdwgn.js} +6 -6
- package/dist/chunk-8ygf6jnt.js +2 -0
- package/dist/{chunk-0rdh8bw3.js → chunk-95sd8h5g.js} +7 -7
- package/dist/{chunk-50cnypys.js → chunk-967ydrq4.js} +6 -6
- package/dist/chunk-9afkttvz.js +2 -0
- package/dist/{chunk-7wqz32ay.js → chunk-9d91h636.js} +2 -2
- package/dist/{chunk-kwf3kfr0.js → chunk-9n5h4sqc.js} +2 -2
- package/dist/chunk-9ztn7w4y.js +2 -0
- package/dist/chunk-ah8az9vv.js +2 -0
- package/dist/chunk-ankap9pc.js +2 -0
- package/dist/chunk-asnd03sr.js +2 -0
- package/dist/chunk-b0b5yr97.js +2 -0
- package/dist/chunk-b0e7dgv8.js +3 -0
- package/dist/{chunk-zj5eq4b6.js → chunk-b15c4g3e.js} +5 -5
- package/dist/{chunk-czcx3nbx.js → chunk-b6bf0t02.js} +6 -6
- package/dist/chunk-b7jj45bz.js +2 -0
- package/dist/{chunk-ybjgnnyf.js → chunk-bgfs3mbg.js} +5 -5
- package/dist/{chunk-f2twg7ze.js → chunk-bqtj62ys.js} +8 -8
- package/dist/{chunk-a0q0kb0s.js → chunk-bw2m1e7g.js} +5 -5
- package/dist/chunk-bwx6w87c.js +2 -0
- package/dist/{chunk-ef9m5fjb.js → chunk-cgfjrgfw.js} +14 -14
- package/dist/{chunk-463weehv.js → chunk-ch9028z3.js} +1 -1
- package/dist/{chunk-57q4nvs9.js → chunk-cmg9x1ka.js} +3 -3
- package/dist/{chunk-9f31gs4m.js → chunk-cz1sdes5.js} +2 -2
- package/dist/{chunk-satrf398.js → chunk-dvjv4c3a.js} +1 -1
- package/dist/{chunk-dz7amds0.js → chunk-dymck524.js} +5 -5
- package/dist/chunk-dzqfv801.js +3 -0
- package/dist/{chunk-agd2b928.js → chunk-eceeqy74.js} +4 -4
- package/dist/{chunk-c47stwqj.js → chunk-eqffvse2.js} +1 -1
- package/dist/chunk-ery4tty7.js +20 -0
- package/dist/chunk-evwrxsxd.js +3 -0
- package/dist/{chunk-6t04tqvh.js → chunk-eyx92t9n.js} +2 -2
- package/dist/{chunk-6mfpns00.js → chunk-f3cyghnb.js} +5 -5
- package/dist/chunk-f60k8j9m.js +2 -0
- package/dist/chunk-fdqdz018.js +2 -0
- package/dist/chunk-g6ap4085.js +2 -0
- package/dist/chunk-gz9pknbw.js +1204 -0
- package/dist/{chunk-pgrm1vet.js → chunk-hgf7bc50.js} +7 -7
- package/dist/chunk-hjb4c8g2.js +2 -0
- package/dist/chunk-hk241gt2.js +2 -0
- package/dist/{chunk-yasdj4ve.js → chunk-hm9d40yf.js} +2 -2
- package/dist/{chunk-6df3j3qq.js → chunk-hpzje67q.js} +2 -2
- package/dist/{chunk-qt39mb2a.js → chunk-htx5yezj.js} +2 -2
- package/dist/{chunk-xpbakn6t.js → chunk-hxws025y.js} +3 -3
- package/dist/chunk-jhbj9ja2.js +2 -0
- package/dist/chunk-k4x680e3.js +2 -0
- package/dist/chunk-k9abxnpa.js +2 -0
- package/dist/{chunk-c73c0wf9.js → chunk-kbbbpae2.js} +2 -2
- package/dist/chunk-kfdmm240.js +2 -0
- package/dist/{chunk-xcsgpf83.js → chunk-kj43fbzm.js} +1 -1
- package/dist/{chunk-59er0fc7.js → chunk-kk2p2tgv.js} +3 -3
- package/dist/{chunk-dwyhpbpx.js → chunk-ksmn19qw.js} +2 -2
- package/dist/{chunk-16aqrwmk.js → chunk-kx09v9ya.js} +7 -7
- package/dist/{chunk-3bfheqe3.js → chunk-m95sygv4.js} +3 -3
- package/dist/{chunk-nzpzyz22.js → chunk-mctzpw0w.js} +1 -1
- package/dist/{chunk-y6eaqs8v.js → chunk-me4yq8c2.js} +3 -3
- package/dist/{chunk-n22xtagg.js → chunk-mgh5rst1.js} +2 -2
- package/dist/{chunk-zch65qrd.js → chunk-mhxg6j6s.js} +1 -1
- package/dist/{chunk-pc8dt8xs.js → chunk-mjp1z9kz.js} +1 -1
- package/dist/{chunk-gtv9jd68.js → chunk-mt8edb75.js} +49 -49
- package/dist/chunk-mvavjydq.js +2 -0
- package/dist/{chunk-e362e615.js → chunk-mw7hacm3.js} +30 -30
- package/dist/{chunk-cv4bfhn1.js → chunk-nbdscgvj.js} +6 -6
- package/dist/{chunk-qx1nbryq.js → chunk-njpva3zq.js} +2 -2
- package/dist/{chunk-6qpe4f8e.js → chunk-nkyff7v6.js} +11 -11
- package/dist/{chunk-mxvgft6p.js → chunk-p8shtje2.js} +32 -32
- package/dist/{chunk-cb0c6959.js → chunk-pctf14yw.js} +1 -1
- package/dist/{chunk-3cq4a4x7.js → chunk-pjj54ddk.js} +3 -3
- package/dist/{chunk-pdprhg5k.js → chunk-pnmafbv5.js} +1 -1
- package/dist/{chunk-kee5a3ce.js → chunk-pz554g43.js} +3 -3
- package/dist/{chunk-h63ma36g.js → chunk-q0y8gv18.js} +2 -2
- package/dist/{chunk-ws2h92mm.js → chunk-q9tc9rdv.js} +2 -2
- package/dist/chunk-qqng9545.js +2 -0
- package/dist/{chunk-8va3fs07.js → chunk-r5ecgcx2.js} +5 -5
- package/dist/{chunk-q1mb0fbt.js → chunk-ranjkpc8.js} +2 -2
- package/dist/{chunk-ssg6ne5b.js → chunk-rb2zbdqd.js} +4 -4
- package/dist/{chunk-e41pgmgk.js → chunk-rf0smj4c.js} +2 -2
- package/dist/chunk-rjm515e2.js +2 -0
- package/dist/chunk-rye4b2x3.js +2 -0
- package/dist/chunk-ryj8139z.js +2 -0
- package/dist/{chunk-q3epnfp4.js → chunk-s0mf56y1.js} +5 -5
- package/dist/{chunk-kaem8q20.js → chunk-s93yh7ed.js} +2 -2
- package/dist/chunk-s9b809n2.js +2 -0
- package/dist/chunk-sb67wg5x.js +2 -0
- package/dist/{chunk-rv0a3stz.js → chunk-sjjw6y49.js} +6 -6
- package/dist/chunk-snkbn5y8.js +2 -0
- package/dist/{chunk-7mcs59pr.js → chunk-snv80b1b.js} +2 -2
- package/dist/chunk-sqwx2g02.js +2 -0
- package/dist/{chunk-2r0nrvqe.js → chunk-t0ttxayz.js} +2 -2
- package/dist/chunk-tbh7r1wh.js +2 -0
- package/dist/chunk-tpyekw0q.js +2 -0
- package/dist/chunk-v2627s75.js +2 -0
- package/dist/chunk-v3jyb8k6.js +2 -0
- package/dist/chunk-v98n53nk.js +2 -0
- package/dist/{chunk-sfyyn0mg.js → chunk-vc432a0w.js} +9 -9
- package/dist/{chunk-a7ryj8z8.js → chunk-vf4ejngv.js} +6 -6
- package/dist/{chunk-hxhmhw23.js → chunk-vk2jy6mn.js} +3 -3
- package/dist/chunk-w34vvhm7.js +2 -0
- package/dist/chunk-w82nk19t.js +2 -0
- package/dist/{chunk-ezna4dhj.js → chunk-x5bn2svk.js} +2 -2
- package/dist/chunk-x6565mhk.js +2 -0
- package/dist/{chunk-gbncp2gp.js → chunk-xvncq3m5.js} +2 -2
- package/dist/chunk-xwgdcc7w.js +2 -0
- package/dist/{chunk-ram5944w.js → chunk-xy8smv5e.js} +2 -2
- package/dist/{chunk-yp4tn4zn.js → chunk-y1d3j2j7.js} +4 -4
- package/dist/chunk-yjwa7ktk.js +2 -0
- package/dist/{chunk-94ctmp0j.js → chunk-ytjn0gq2.js} +2 -2
- package/dist/chunk-z47p2gx8.js +2 -0
- package/dist/chunk-z4tdnfxd.js +2 -0
- package/dist/chunk-z6kw6sct.js +4 -0
- package/dist/{chunk-shcnt6aa.js → chunk-zf68afyh.js} +3 -3
- package/dist/chunk-zhywjwdr.js +2 -0
- package/dist/{chunk-g2xy0z0e.js → chunk-zwwhpxp7.js} +2 -2
- package/dist/cli.js +21 -21
- package/dist/component-library.d.ts +2 -1
- package/dist/component-library.js +126 -308
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/directive-arguments.js +39 -6
- package/dist/parser/tokenizer.d.ts +2 -1
- package/dist/parser/tokenizer.js +7 -5
- package/dist/props-declaration.d.ts +64 -0
- package/dist/props-declaration.js +354 -0
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +7 -7
- package/dist/utils.js +20 -109
- package/package.json +5 -5
- package/dist/chunk-08cb7cyw.js +0 -2
- package/dist/chunk-0gkxqcpj.js +0 -2
- package/dist/chunk-0h1dyd38.js +0 -2
- package/dist/chunk-0sew66hf.js +0 -2
- package/dist/chunk-13dgqekj.js +0 -2
- package/dist/chunk-15n20xwe.js +0 -2
- package/dist/chunk-1ta1pj1t.js +0 -2
- package/dist/chunk-1z3r2jjp.js +0 -2
- package/dist/chunk-1z6rrqvm.js +0 -2
- package/dist/chunk-295bykzd.js +0 -61
- package/dist/chunk-41353gyc.js +0 -2
- package/dist/chunk-4j50hrgq.js +0 -20
- package/dist/chunk-4pjqj54a.js +0 -2
- package/dist/chunk-53cc06w7.js +0 -2
- package/dist/chunk-5m02cbxg.js +0 -2
- package/dist/chunk-5rd0an89.js +0 -2
- package/dist/chunk-5s0w910j.js +0 -2
- package/dist/chunk-6fy11vfb.js +0 -2
- package/dist/chunk-6mjk28s3.js +0 -2
- package/dist/chunk-8h5nje66.js +0 -2
- package/dist/chunk-97kgrevs.js +0 -4
- package/dist/chunk-9h3qq2d2.js +0 -2
- package/dist/chunk-9kza7gxd.js +0 -2
- package/dist/chunk-a02gt4tz.js +0 -1199
- package/dist/chunk-a30zpnqp.js +0 -2
- package/dist/chunk-aq0fz4mr.js +0 -2
- package/dist/chunk-aqxh80vh.js +0 -2
- package/dist/chunk-axra1yas.js +0 -2
- package/dist/chunk-b2vhsyf9.js +0 -2
- package/dist/chunk-c42b1y7z.js +0 -2
- package/dist/chunk-c89wryyz.js +0 -2
- package/dist/chunk-cev5z6gj.js +0 -2
- package/dist/chunk-ch57kgb6.js +0 -2
- package/dist/chunk-cv1vm1w0.js +0 -2
- package/dist/chunk-d7b30bg6.js +0 -2
- package/dist/chunk-f3j1h3ch.js +0 -2
- package/dist/chunk-fz4c5e9m.js +0 -2
- package/dist/chunk-gd04nvj3.js +0 -2
- package/dist/chunk-gmp10259.js +0 -2
- package/dist/chunk-gr956aar.js +0 -2
- package/dist/chunk-h3fv0q25.js +0 -2
- package/dist/chunk-jghpzx5m.js +0 -2
- package/dist/chunk-kcqfrw10.js +0 -2
- package/dist/chunk-kfzvtzsz.js +0 -2
- package/dist/chunk-kqgspa3s.js +0 -2
- package/dist/chunk-mast9wb2.js +0 -2
- package/dist/chunk-mqy1wz09.js +0 -3
- package/dist/chunk-mv21mc9p.js +0 -2
- package/dist/chunk-n9bw9bsn.js +0 -2
- package/dist/chunk-ngzyzcrp.js +0 -2
- package/dist/chunk-nnqyn7db.js +0 -2
- package/dist/chunk-p5qac909.js +0 -2
- package/dist/chunk-p6hcrg3r.js +0 -3
- package/dist/chunk-pa2vt2ej.js +0 -2
- package/dist/chunk-pa6kgbmw.js +0 -2
- package/dist/chunk-pd089tq0.js +0 -2
- package/dist/chunk-pjjrx9pk.js +0 -2
- package/dist/chunk-pt3rp3zg.js +0 -2
- package/dist/chunk-qg1kw5yf.js +0 -2
- package/dist/chunk-s7xywsqd.js +0 -3
- package/dist/chunk-t8r40wgf.js +0 -2
- package/dist/chunk-w5zzwe2f.js +0 -2
- package/dist/chunk-wjafpvjv.js +0 -2
- package/dist/chunk-x44f0eq1.js +0 -2
- package/dist/chunk-xhr35ctb.js +0 -2
- package/dist/chunk-xk15vzb6.js +0 -2
- package/dist/chunk-xmmr0916.js +0 -2
- package/dist/chunk-ywnqjqns.js +0 -2
- package/dist/chunk-z7k1xn6k.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{le,ue,de,Gn,Ce,Be,Et,an,Xn,Jn,Yn,pe,Zn,Qn}from"./chunk-1n33yrar.js";import{Ot}from"./chunk-ymqm898x.js";function su(s,r={}){let{src:e,alt:t,width:n,height:a,sizes:i="100vw",loading:m="lazy",priority:o=!1,quality:u=de,placeholder:l="none",formats:f=ue,widths:y=le,decoding:c="async",fetchpriority:h,objectFit:d,objectPosition:g}=s,{class:p,style:v}=s,{processedImage:w,variants:I,optimize:b=!0,isDev:A=!1}=r;if(I&&I.length>0)return J(s,I,w);if(A||!b)return K(s);return Z(s)}function J(s,r,e){let{src:t,alt:n,width:a,height:i,sizes:m="100vw",loading:o="lazy",priority:u=!1,decoding:l="async",fetchpriority:f,objectFit:y,objectPosition:c,placeholder:h="none"}=s,{class:d,style:g}=s,p=Jn(r),v=Xn(r),w=typeof m==="object"?an(m):m,I=e?e.aspectRatio:a&&i?Number(a)/Number(i):void 0,b=[];if(I)b.push(`aspect-ratio: ${I}`);if(y)b.push(`object-fit: ${y}`);if(c)b.push(`object-position: ${c}`);if(g)b.push(g);let A=b.length>0?` style="${b.join("; ")}"`:"",S=d?` class="${d}"`:"",F=u?"":` loading="${o}"`,R=` decoding="${l}"`,C=f?` fetchpriority="${f}"`:u?' fetchpriority="high"':"",E=["avif","webp","jpeg","png"],M=[];for(let k of E){let z=p.get(k);if(z&&z.length>0){let O=Et(z),Y=pe(k);M.push(` <source type="${Y}" srcset="${O}" sizes="${w}" />`)}}let U="",L="",T;if(h!=="none"&&e?.placeholder){let k=`img-${Math.random().toString(36).slice(2,8)}`;if(U=`<div class="stx-image-wrapper" id="${k}">`,L="</div>",h==="blur")T=`
|
|
3
3
|
#${k} {
|
|
4
4
|
position: relative;
|
|
5
5
|
background-image: url('${e.placeholder}');
|
|
@@ -23,14 +23,14 @@ ${M.join(`
|
|
|
23
23
|
src="${v?.url||t}"
|
|
24
24
|
alt="${B(n)}"${_}${H}${S}${A}${F}${R}${C}
|
|
25
25
|
/>
|
|
26
|
-
</picture>${L}`,V;if(u&&v){let k=p.get("webp"),z=k?.[Math.floor(k.length/2)]||v,O=
|
|
26
|
+
</picture>${L}`,V;if(u&&v){let k=p.get("webp"),z=k?.[Math.floor(k.length/2)]||v,O=pe(z.format);V=`<link rel="preload" as="image" href="${z.url}" type="${O}" />`}return{html:Q,preloadLink:V,placeholderCss:T}}function K(s){let{src:r,alt:e,width:t,height:n,loading:a="lazy",decoding:i="async",priority:m=!1,fetchpriority:o,objectFit:u,objectPosition:l}=s,{class:f,style:y}=s,c=[];if(u)c.push(`object-fit: ${u}`);if(l)c.push(`object-position: ${l}`);if(y)c.push(y);let h=c.length>0?` style="${c.join("; ")}"`:"",d=f?` class="${f}"`:"",g=t?` width="${t}"`:"",p=n?` height="${n}"`:"",v=m?"":` loading="${a}"`,w=` decoding="${i}"`,I=o?` fetchpriority="${o}"`:m?' fetchpriority="high"':"";return{html:`<img src="${r}" alt="${B(e)}"${g}${p}${d}${h}${v}${w}${I} />`}}function Z(s){let{src:r,alt:e,width:t,height:n,sizes:a="100vw",loading:i="lazy",priority:m=!1,quality:o=de,formats:u=ue,widths:l=le,decoding:f="async",fetchpriority:y,objectFit:c,objectPosition:h}=s,{class:d,style:g}=s,p=[];if(c)p.push(`object-fit: ${c}`);if(h)p.push(`object-position: ${h}`);if(g)p.push(g);let v=p.length>0?` style="${p.join("; ")}"`:"",w=d?` class="${d}"`:"",I=t?` width="${t}"`:"",b=n?` height="${n}"`:"",A=m?"":` loading="${i}"`,S=` decoding="${f}"`,F=y?` fetchpriority="${y}"`:m?' fetchpriority="high"':"",R=typeof a==="object"?an(a):a,C=`
|
|
27
27
|
data-stx-image
|
|
28
28
|
data-src="${r}"
|
|
29
29
|
data-sizes="${R}"
|
|
30
30
|
data-quality="${o}"
|
|
31
31
|
data-formats="${u.join(",")}"
|
|
32
32
|
data-widths="${l.join(",")}"
|
|
33
|
-
`.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${B(e)}"${I}${b}${w}${v}${A}${S}${F} ${C} />`}}function
|
|
33
|
+
`.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${B(e)}"${I}${b}${w}${v}${A}${S}${F} ${C} />`}}function $a(s){let r=s.match(/<Image\s+([^>]*?)\/?>/);if(!r)return null;let e=r[1],t={},n=/(\w+)(?:=(?:"([^"]*)"|'([^']*)'|(\{[^}]+\})))?/g,a;while((a=n.exec(e))!==null){let[,i,m,o,u]=a,l=m??o??u??!0;switch(i){case"src":t.src=String(l);break;case"alt":t.alt=String(l);break;case"width":t.width=Number(l)||l;break;case"height":t.height=Number(l)||l;break;case"sizes":t.sizes=String(l);break;case"loading":t.loading=l;break;case"priority":t.priority=l===!0||l==="true";break;case"quality":t.quality=Number(l);break;case"placeholder":t.placeholder=l;break;case"class":t.class=String(l);break;case"style":t.style=String(l);break;case"decoding":t.decoding=l;break;case"fetchpriority":t.fetchpriority=l;break;case"objectFit":t.objectFit=l;break;case"objectPosition":t.objectPosition=String(l);break}}if(!t.src||!t.alt)return null;return t}async function ou(s,r){let e=/<Image\s+[^>]*?\/?>/g,t=[],n=[],a=s,i,m=[];while((i=e.exec(s))!==null)m.push({match:i[0],index:i.index});for(let o=m.length-1;o>=0;o--){let{match:u}=m[o],l=$a(u);if(l){let f=await r(l);if(a=a.replace(u,f.html),f.preloadLink)t.push(f.preloadLink);if(f.placeholderCss)n.push(f.placeholderCss)}}return{html:a,preloadLinks:t,styles:n}}function B(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var D=new Map;function iu(){D.clear()}async function G(s,r){let e=`${s}:${JSON.stringify(r)}`;if(D.has(e))return D.get(e);try{let t=await Be(s,r);return D.set(e,t),t}catch{return null}}function Ra(){return Ot({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async(s,r,e)=>{let{src:t,alt:n,options:a}=X(s,r,e);if(!t)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let i={widths:a.widths||(a.width?[a.width]:le),formats:a.formats||ue,quality:a.quality||de,placeholder:(a.placeholder==="color"?"dominant-color":a.placeholder)||"none"};if(!await Ce())return q(t,n||"",a);let o=await G(t,i);if(!o)return q(t,n||"",a);return te(o,n||"",a)}})}function X(s,r,e){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let n=s.trim();if(n.startsWith("@image(")||n.startsWith("("))n=n.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let a=ee(n),i=a[0]||"",m=a[1]||"",o={};if(i&&!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")){let u=e[i];if(typeof u==="string")i=u}if(a[2])try{if(typeof a[2]==="string")o=JSON.parse(a[2]);else o=a[2]}catch{}return{src:i,alt:m,options:o}}function ee(s){let r=[],e="",t=!1,n="",a=0,i=0;for(let m=0;m<s.length;m++){let o=s[m],u=m>0?s[m-1]:"";if((o==='"'||o==="'")&&u!=="\\"){if(!t)t=!0,n=o;else if(o===n)t=!1,n="";else e+=o;continue}if(!t){if(o==="{")a++;if(o==="}")a--;if(o==="[")i++;if(o==="]")i--;if(o===","&&a===0&&i===0){r.push(e.trim()),e="";continue}}e+=o}if(e.trim())r.push(e.trim());return r}function q(s,r,e){let t=[`src="${x(s)}"`];if(r)t.push(`alt="${x(r)}"`);if(e.width)t.push(`width="${e.width}"`);if(e.height)t.push(`height="${e.height}"`);if(e.class)t.push(`class="${x(e.class)}"`);if(e.style)t.push(`style="${x(e.style)}"`);if(e.lazy!==!1)t.push('loading="lazy"');return t.push('decoding="async"'),`<img ${t.join(" ")} />`}function te(s,r,e){let{variants:t,placeholder:n,width:a,height:i,aspectRatio:m}=s,o=new Map;for(let g of t){let p=o.get(g.format)||[];p.push(g),o.set(g.format,p)}let u=["avif","webp","jpeg","png"],l=[];for(let g of u){let p=o.get(g);if(p&&p.length>0){let v=Et(p),w=pe(g),I=e.sizes||"100vw";l.push(` <source type="${w}" srcset="${x(v)}" sizes="${x(I)}" />`)}}let f=o.get("jpeg")||[],y=f.length>0?f[Math.floor(f.length/2)]:t[Math.floor(t.length/2)],c=[`src="${y?.url||s.src}"`,`alt="${x(r)}"`];if(e.width||a)c.push(`width="${e.width||a}"`);if(e.height||i)c.push(`height="${e.height||i}"`);if(e.class)c.push(`class="${x(e.class)}"`);let h=[];if(m)h.push(`aspect-ratio: ${m.toFixed(4)}`);if(e.style)h.push(e.style);if(h.length>0)c.push(`style="${h.join("; ")}"`);if(e.lazy!==!1&&!e.priority)c.push('loading="lazy"');if(c.push('decoding="async"'),e.priority)c.push('fetchpriority="high"');let d=`<picture>
|
|
34
34
|
`;if(d+=l.join(`
|
|
35
35
|
`)+`
|
|
36
36
|
`,d+=` <img ${c.join(" ")} />
|
|
@@ -38,6 +38,6 @@ ${M.join(`
|
|
|
38
38
|
${d}
|
|
39
39
|
</div>`}else if(e.placeholder==="color"){let p=n.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");d=`<div id="${g}" class="stx-image-placeholder" style="background-color: ${p};">
|
|
40
40
|
${d}
|
|
41
|
-
</div>`}}if(e.priority&&y){let g=
|
|
42
|
-
`+d}return d}function x(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var
|
|
43
|
-
export{
|
|
41
|
+
</div>`}}if(e.priority&&y){let g=pe(y.format);d=`<link rel="preload" as="image" href="${x(y.url)}" type="${g}" />
|
|
42
|
+
`+d}return d}function x(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var au=Ra();import P from"fs";import j from"path";function cu(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=ue,widths:a=le,quality:i=de,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await Ce()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await Gn();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=se(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ae(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await Ce())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>re(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await Be(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=Zn(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${Qn(c.stats.savedBytes)}`)}}}function se(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function re(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ae(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&Yn(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function lu(s,r,e={}){if(!await Ce())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return Be(s,{...e,outputDir:r})}async function uu(s,r,e={}){let{formats:t=ue,widths:n=le,quality:a=de,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await Ce())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await Be(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function Aa(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function du(s,r){let e=Aa(s);await Bun.write(r,JSON.stringify(e,null,2))}var $m={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
|
|
43
|
+
export{su,$a,ou,iu,Ra,au,cu,lu,uu,Aa,du,$m};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Mh,Bo,Dh,Lh,jh,Bh}from"./chunk-nbdscgvj.js";import"./chunk-ery4tty7.js";import"./chunk-s0mf56y1.js";import"./chunk-cz1sdes5.js";import"./chunk-4kmg6g5n.js";import"./chunk-bqtj62ys.js";import"./chunk-pctf14yw.js";import"./chunk-eqffvse2.js";import"./chunk-p8shtje2.js";import"./chunk-58qzyyyv.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-95sd8h5g.js";import"./chunk-eceeqy74.js";import"./chunk-gz9pknbw.js";import"./chunk-s93yh7ed.js";import"./chunk-eyx92t9n.js";import"./chunk-3dqfjpz4.js";import"./chunk-vk2jy6mn.js";import"./chunk-9n5h4sqc.js";import"./chunk-2a5g80mq.js";import"./chunk-mgh5rst1.js";export{Bh as clearStoreCache,Mh as getStoreScript,jh as getStoreScriptFor,Lh as pageStoresAll,Bo as storesRead,Dh as storesReadInFiles};
|
|
@@ -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 _h(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 Ch(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 Eh(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 Th(){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 $h(){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 Rh(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{_h,Ch,Eh,Th,$h,Rh};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`+e.slice(t);let n=
|
|
4
|
-
${r}${e.slice(n)}`;if(e.includes("</head>")){let o=
|
|
5
|
-
`+e.slice(o)}if(
|
|
2
|
+
import{Tr}from"./chunk-eceeqy74.js";import{Hr}from"./chunk-3dqfjpz4.js";import{a}from"./chunk-p8shtje2.js";import{W,ct}from"./chunk-6gtecbe7.js";import{Lc}from"./chunk-x5bn2svk.js";import{L,c}from"./chunk-hxws025y.js";var x=/<style\b[^>]*>/iy,R=/<\/style>/gi,b=/<script\b[^>]*>/iy,S=/<template(?=[\s>/])[^>]*>/iy,w=/<\/template\s*>/iy;function xr(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let g=e.indexOf("-->",n+4);r=g===-1?e.length:g+3;continue}x.lastIndex=n;let u=x.exec(e);if(u){R.lastIndex=n+u[0].length;let g=R.exec(e);r=g===null?e.length:g.index+8;continue}S.lastIndex=n;let o=S.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}w.lastIndex=n;let d=w.exec(e);if(d){if(t>0)t--;r=n+d[0].length;continue}if(b.lastIndex=n,b.test(e))return t>0?s:n;r=n+1}return-1}function ne(e,r={}){return new Tr(e,r).routes}import y from"path";var T=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let d=await a();t||=d?.pagesDir||"pages",s||=d?.root||"."}catch{t||="pages",s||="."}let n=y.isAbsolute(t)?t:y.join(s,t),u=T.get(n);if(u)return u;let o=[];try{o=ne(".",{pagesDir:n,emit:!1}).map((d)=>d.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function E(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return E(JSON.stringify(e))}function $e(e){return e.includes("data-stx-runtime")}function Mc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function p(e,r){let t=xr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
|
|
3
|
+
`+e.slice(t);let n=Hr(e);if(n!==null)return`${e.slice(0,n)}
|
|
4
|
+
${r}${e.slice(n)}`;if(e.includes("</head>")){let o=L(e);return e.slice(0,o)+r+`
|
|
5
|
+
`+e.slice(o)}if(W(e))return ct(e,(o)=>`${o}
|
|
6
6
|
${r}`);return`${r}
|
|
7
|
-
${e}`}async function
|
|
7
|
+
${e}`}async function Sr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-yjwa7ktk.js"),{url:u}=await n("runtime",r.debug===!0);return p(e,`<script data-stx-runtime src="${u}"></script>`)}if(r.buildMode==="compile")return p(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-yjwa7ktk.js"),s=await t(r.debug);return p(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function O(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Dc(e){if(e.includes("data-stx-tooltip-runtime")||!O(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${Lc()}</script>`,t=c(e);if(t===-1)return`${e}
|
|
8
8
|
${r}`;return`${e.slice(0,t)}${r}
|
|
9
|
-
${e.slice(t)}`}var C=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function M(e){return C.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function
|
|
9
|
+
${e.slice(t)}`}var C=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function M(e){return C.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function Re(e,r){if(!e.includes("</body>"))return e;if(M(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:_}=await import("./chunk-yjwa7ktk.js");n=`<script data-stx-owned-routes src="${_(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(f)};
|
|
10
10
|
`)}"></script>
|
|
11
11
|
`}else i.ownedRoutes=f}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${l(i)};</script>
|
|
12
|
-
`}let{getCachedRouterScript:u,getServeClientAsset:o}=await import("./chunk-
|
|
12
|
+
`}let{getCachedRouterScript:u,getServeClientAsset:o}=await import("./chunk-yjwa7ktk.js"),d=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await u()}</script>`,g=c(e);return e.slice(0,g)+s+n+d+`
|
|
13
13
|
</body>`+e.slice(g+7)}
|
|
14
|
-
export{
|
|
14
|
+
export{xr,ne,$e,Mc,Sr,Dc,Re};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var c=0;function l(){return`suspense-${++c}-${Date.now().toString(36)}`}function
|
|
2
|
+
var c=0;function l(){return`suspense-${++c}-${Date.now().toString(36)}`}function Ah(s,n={},t){let e=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return s.replace(e,(r,i,o,d)=>{let u=l(),a=p(i||"");return f(u,o.trim(),d.trim(),a)})}function p(s){let n={},t=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,e;while((e=t.exec(s))!==null){let r=e[1],i=e[2]||e[3],o=e[4];switch(r){case"id":n.id=i;break;case"timeout":n.timeout=o?parseInt(o,10):void 0;break}}return n}function f(s,n,t,e){let r=e.timeout||30000,i=e.id||s;return`
|
|
3
3
|
<div class="stx-suspense" data-suspense-id="${s}" data-custom-id="${i}" data-status="pending">
|
|
4
4
|
<div class="stx-suspense-fallback" data-suspense-fallback="${s}">
|
|
5
5
|
${t}
|
|
@@ -189,7 +189,7 @@ else {
|
|
|
189
189
|
}, 0);
|
|
190
190
|
})();
|
|
191
191
|
</script>
|
|
192
|
-
`}function
|
|
192
|
+
`}function Ph(s,n,t){return{id:s,fallback:t,content:n}}async function Ih(s){let n=s.map((e)=>`
|
|
193
193
|
<div id="stx-ssr-suspense-${e.id}" class="stx-ssr-suspense">
|
|
194
194
|
${e.fallback}
|
|
195
195
|
</div>
|
|
@@ -214,7 +214,7 @@ else {
|
|
|
214
214
|
}
|
|
215
215
|
})();
|
|
216
216
|
</script>
|
|
217
|
-
`}}return{initial:n,streaming:t()}}function
|
|
217
|
+
`}}return{initial:n,streaming:t()}}function Oh(){return`
|
|
218
218
|
/* STX Suspense Styles */
|
|
219
219
|
.stx-suspense {
|
|
220
220
|
position: relative;
|
|
@@ -270,7 +270,7 @@ else {
|
|
|
270
270
|
background-size: 200% 100%;
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
`}function
|
|
273
|
+
`}function Nh(){return`
|
|
274
274
|
// STX Suspense Runtime
|
|
275
275
|
(function() {
|
|
276
276
|
if (typeof window === 'undefined') return;
|
|
@@ -338,4 +338,4 @@ else {
|
|
|
338
338
|
console.log('[stx] Suspense runtime initialized');
|
|
339
339
|
})();
|
|
340
340
|
`}
|
|
341
|
-
export{
|
|
341
|
+
export{Ah,Ph,Ih,Oh,Nh};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Pe,mt,Ut,eo,to,ke,Pi,_n,ol,il,Ii,al,cl,ro,Ni,Mi,ll,Di}from"./chunk-gz9pknbw.js";import{_}from"./chunk-mgh5rst1.js";import{a}from"./chunk-p8shtje2.js";import{Fo}from"./chunk-87g5xmmr.js";import{l}from"./chunk-dzqfv801.js";import{existsSync as G,readFileSync as U}from"fs";import h from"path";var we=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),oe=mt.filter((e)=>!we.has(e)).sort(),ce=[..._].sort(),ve=[...new Set([...oe,...ce])].sort(),$e=new Set(oe),De=new Set(ce),Te=new Set(ve),re=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Ce(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ae(e,t){let o=[];for(let d of t){if(d.offset===void 0)continue;let i=d.kind==="server"?$e:De;re.lastIndex=0;for(let c of d.code.matchAll(re)){let m=c.index+c[0].indexOf("{")+1;for(let f of c[1].matchAll(/[^,]+/g)){let k=f[0];if(/^\s*type\s/.test(k))continue;let S=/^\s*([A-Za-z_$][\w$]*)/.exec(k);if(!S)continue;let s=S[1];if(!Te.has(s)||i.has(s))continue;let u=d.offset+m+f.index+S[0].length-s.length,g=e.slice(0,u),v=g.split(`
|
|
3
3
|
`).length;o.push({line:v,column:u-(g.lastIndexOf(`
|
|
4
|
-
`)+1)+1,offset:u,length:s.length,name:s,kind:d.kind,message:Ce(s,d.kind)})}}}return o}import M from"path";var Ee="@stacksjs/stx-typescript-plugin";function Oe(e,t){let o=M.resolve(e);for(;;){let d=M.join(o,"tsconfig.json");if(t(d))return d;let i=M.dirname(o);if(i===o)return;o=i}}function le(e,t,o){let d=Oe(e,o);if(!d)return;let i=new Set,c=(m)=>{if(i.has(m))return;i.add(m);let f=t(m);if(!f)return;let k=f.compilerOptions?.plugins;if(Array.isArray(k)){let s=k.find((g)=>g?.name===Ee),u=Array.isArray(s?.libs)?s.libs.filter((g)=>typeof g==="string"):[];return s?{configPath:m,libs:u.map((g)=>M.resolve(M.dirname(m),g))}:null}let S=typeof f.extends==="string"?[f.extends]:Array.isArray(f.extends)?f.extends:[];for(let s of[...S].reverse()){if(typeof s!=="string"||!s.startsWith("."))continue;let u=M.resolve(M.dirname(m),s.endsWith(".json")?s:`${s}.json`),g=c(u);if(g!==void 0)return g}return};return c(d)??void 0}function
|
|
5
|
-
`.repeat(e.startLine-1):"",m
|
|
4
|
+
`)+1)+1,offset:u,length:s.length,name:s,kind:d.kind,message:Ce(s,d.kind)})}}}return o}import M from"path";var Ee="@stacksjs/stx-typescript-plugin";function Oe(e,t){let o=M.resolve(e);for(;;){let d=M.join(o,"tsconfig.json");if(t(d))return d;let i=M.dirname(o);if(i===o)return;o=i}}function le(e,t,o){let d=Oe(e,o);if(!d)return;let i=new Set,c=(m)=>{if(i.has(m))return;i.add(m);let f=t(m);if(!f)return;let k=f.compilerOptions?.plugins;if(Array.isArray(k)){let s=k.find((g)=>g?.name===Ee),u=Array.isArray(s?.libs)?s.libs.filter((g)=>typeof g==="string"):[];return s?{configPath:m,libs:u.map((g)=>M.resolve(M.dirname(m),g))}:null}let S=typeof f.extends==="string"?[f.extends]:Array.isArray(f.extends)?f.extends:[];for(let s of[...S].reverse()){if(typeof s!=="string"||!s.startsWith("."))continue;let u=M.resolve(M.dirname(m),s.endsWith(".json")?s:`${s}.json`),g=c(u);if(g!==void 0)return g}return};return c(d)??void 0}function Pa(e,t="",o="",d=t,i){let c=e.startLine>1?`
|
|
5
|
+
`.repeat(e.startLine-1):"",m=Pi(Ni(e)+e.code,d),f=e.kind==="client"&&i?i.project(m.code):void 0,k=_n(f?.code??m.code),S=e.kind==="client"||e.kind==="plain"?al(t,e.code):"",s=(c+k).split(`
|
|
6
6
|
`),u=s.length,g=new Map;for(let y of m.declarations)for(let[w,D]of y.text.split(`
|
|
7
7
|
`).entries())if(s.push(D),y.origin)g.set(s.length,{...y.origin,line:e.startLine+y.origin.line-1+w,column:w===0?y.origin.column:1});s.push(...S.split(`
|
|
8
8
|
`),...(i?.declarations??"").split(`
|
|
9
|
-
`),...(e.kind==="server"?
|
|
9
|
+
`),...(e.kind==="server"?eo(e.code):"").split(`
|
|
10
10
|
`));let v=e.kind==="server"?Ut(e.code):void 0;if(v?.unsupported){let y=e.code.slice(0,v.offset),w=e.startLine+y.split(`
|
|
11
11
|
`).length-1,D=v.offset-e.code.lastIndexOf(`
|
|
12
|
-
`,v.offset-1)+(w===e.startLine?(e.startColumn??1)-1:0);s.push(`;({})[${JSON.stringify(v.unsupported)}];`),g.set(s.length,{line:w,column:D,anchor:!0})}s.push("export {}","");let R=
|
|
13
|
-
`),o);return{text:R.code,sourceLineCount:u,lineMap:g,scriptColumns:new Map([...m.columns].map(([y,w])=>[y+e.startLine-1,w])),importColumns:R.columns,componentColumns:f?new Map([...f.columns].map(([y,w])=>[y+e.startLine-1,w])):void 0}}function
|
|
14
|
-
`)}function
|
|
12
|
+
`,v.offset-1)+(w===e.startLine?(e.startColumn??1)-1:0);s.push(`;({})[${JSON.stringify(v.unsupported)}];`),g.set(s.length,{line:w,column:D,anchor:!0})}s.push("export {}","");let R=ro(s.join(`
|
|
13
|
+
`),o);return{text:R.code,sourceLineCount:u,lineMap:g,scriptColumns:new Map([...m.columns].map(([y,w])=>[y+e.startLine-1,w])),importColumns:R.columns,componentColumns:f?new Map([...f.columns].map(([y,w])=>[y+e.startLine-1,w])):void 0}}function Rm(e,t="",o=""){return Pa(e,t,o).text}var Ne=new Set(["name","status","length","location","history","origin","closed","close","open","focus","blur","print","scroll","scrollTo","scrollBy","stop","top","parent","self","frames","event","external","menubar","toolbar"]);function _e(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],o=new Set(_),d=[];for(let{file:i,names:c}of e){let m=JSON.stringify(i.replace(/\\/g,"/").replace(/\.ts$/,""));d.push(` export * from ${m}`);for(let f of c){if(o.has(f)||Ne.has(f))continue;o.add(f),t.push(`declare const ${f}: typeof import(${m})[${JSON.stringify(f)}]`)}}return t.push("declare module '@composables' {",...d,"}"),t.join(`
|
|
14
|
+
`)}function Mo(e,t,o){return`${e}.__stx_${t}${o}.ts`}function Am(e){return e.replace(/\.__stx_(?:server|client|plain|template)\d+\.ts$/,"")}function pu(){return ue("stx.d.ts")}function fu(){return ue("stx-module.d.ts")}function ue(e){for(let t of[h.resolve(import.meta.dir,"..",e),h.resolve(import.meta.dir,"..","..",e)])if(G(t))return t;return null}var Me=/^(.*?)\((\d+),(\d+)\):\s+(error|warning)\s+TS(\d+):\s+(.*)$/;function pe(e){return e>=1000&&e<2000}function de(e){let t="",o=!1,d=!1;for(let i=0;i<e.length;i++){let c=e[i];if(o){if(t+=c,d)d=!1;else if(c==="\\")d=!0;else if(c==='"')o=!1;continue}if(c==='"'){o=!0,t+=c;continue}if(c==="/"&&e[i+1]==="/"){while(i<e.length&&e[i]!==`
|
|
15
15
|
`)i++;t+=`
|
|
16
|
-
`;continue}if(c==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=c}return t.replace(/,(\s*[}\]])/g,"$1")}function Re(e){try{return JSON.parse(de(U(e,"utf8")))}catch{return}}function je(e){let t=h.resolve(e),o;for(;;){let s=h.join(t,"tsconfig.json");if(G(s)){o=s;break}let u=h.dirname(t);if(u===t)break;t=u}if(!o)return{};let d=new Set,i=o,c,m,f=o;while(i&&!d.has(i)){d.add(i);let s;try{s=JSON.parse(de(U(i,"utf8")))}catch{break}let u=s?.compilerOptions??{};if(!c&&u.paths&&typeof u.paths==="object")c=u.paths,f=i;if(!m&&typeof u.baseUrl==="string")m=h.resolve(h.dirname(i),u.baseUrl);if(c&&m)break;i=typeof s?.extends==="string"?h.resolve(h.dirname(i),s.extends.endsWith(".json")?s.extends:`${s.extends}.json`):void 0}if(!c)return{};let k=m??h.dirname(f),S={};for(let[s,u]of Object.entries(c)){if(!Array.isArray(u))continue;S[s]=u.map((g)=>typeof g==="string"&&!h.isAbsolute(g)?h.resolve(k,g):g)}return{paths:S}}async function
|
|
17
|
-
`))),u=new Map,g=new Map,v=[],R=[],y=0,w=0,D=
|
|
18
|
-
`),B=
|
|
19
|
-
`),_e(await
|
|
16
|
+
`;continue}if(c==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=c}return t.replace(/,(\s*[}\]])/g,"$1")}function Re(e){try{return JSON.parse(de(U(e,"utf8")))}catch{return}}function je(e){let t=h.resolve(e),o;for(;;){let s=h.join(t,"tsconfig.json");if(G(s)){o=s;break}let u=h.dirname(t);if(u===t)break;t=u}if(!o)return{};let d=new Set,i=o,c,m,f=o;while(i&&!d.has(i)){d.add(i);let s;try{s=JSON.parse(de(U(i,"utf8")))}catch{break}let u=s?.compilerOptions??{};if(!c&&u.paths&&typeof u.paths==="object")c=u.paths,f=i;if(!m&&typeof u.baseUrl==="string")m=h.resolve(h.dirname(i),u.baseUrl);if(c&&m)break;i=typeof s?.extends==="string"?h.resolve(h.dirname(i),s.extends.endsWith(".json")?s.extends:`${s.extends}.json`):void 0}if(!c)return{};let k=m??h.dirname(f),S={};for(let[s,u]of Object.entries(c)){if(!Array.isArray(u))continue;S[s]=u.map((g)=>typeof g==="string"&&!h.isAbsolute(g)?h.resolve(k,g):g)}return{paths:S}}async function Pm(e,t={}){let o=t.client!==!1,d=t.server!==!1,i=t.templates!==!1,c=i?await a():void 0,m=t.componentsDir??c?.componentsDir,f=t.partialsDir??c?.partialsDir,k=t.layoutsDir??c?.layoutsDir,S=new Map(await Promise.all(e.map(async(n)=>[n,await Bun.file(n).text()]))),s=[...S.values()].some((n)=>Ut(ke(n).filter((r)=>r.kind==="server").map((r)=>r.code).join(`
|
|
17
|
+
`))),u=new Map,g=new Map,v=[],R=[],y=0,w=0,D=pu();for(let n of e){let r=S.get(n),x=ke(r).filter((p)=>{if(p.kind==="server")return d;return o}),E=ke(r).filter((p)=>p.kind==="server").map((p)=>p.code).join(`
|
|
18
|
+
`),B=Ii(ke(r)),N=to(r);for(let p of ae(r,x))v.push({file:n,line:p.line,column:p.column,code:0,message:p.message,category:"error",blockKind:p.kind});if(o&&E){let p=x.filter((C)=>C.kind!=="server"),b=[...new Set(p.flatMap((C)=>cl(E,C.code)))];if(b.length>0)g.set(n,{names:b,line:p[0].startLine,kind:p[0].kind})}let I=h.dirname(h.resolve(n)),T=i?Mi(r,{runtimeGlobals:!D,originDir:I,filePath:h.resolve(n),componentsDir:m,partialsDir:f,layoutsDir:k,inheritedContractsKnown:s}):null,A=T?[...T.lineMap.values()].filter((p)=>p.expression).length:0;if(x.length===0&&A===0&&!N?.checks.length)continue;if(R.push(n),y+=x.length,w+=A,N&&o&&(x.some((p)=>p.kind!=="server")||!i&&N.checks.length)){let p=Mi(r,{runtimeGlobals:!1,globals:!1,originDir:I,templateExpressions:!1,scriptKinds:["client","plain"],nativeChecks:!i});u.set(Mo(n,"client",0),{virtual:p,source:p.text,origin:n,kind:"client"})}if(x.forEach((p,b)=>{if(N&&p.kind!=="server")return;let C=Pa(p,E,I,B);u.set(Mo(n,p.kind,b),{virtual:C,source:C.text,origin:n,kind:p.kind})}),T&&(A>0||N?.checks.length))u.set(Mo(n,"template",0),{source:T.text,origin:n,kind:"template",virtual:T})}if(u.size===0)return{diagnostics:v,checkedFiles:R,blockCount:0,expressionCount:0};let j=(t.extraLibs??[]).map((n)=>h.resolve(n)),fe=le(e.length>0?h.dirname(h.resolve(e[0])):process.cwd(),Re,G);for(let n of fe?.libs??[])if(!j.includes(n)&&G(n))j.push(n);if(D)j.push(D);let W=D?fu():null;if(W)j.push(W);let z=`${l()}/typecheck/__stx_globals.d.ts`,me=["// Generated \u2014 the context serve.ts injects into <script server> blocks.",ol(D?il(U(D,"utf8")):void 0),...D?[]:["declare const window: any",..._.map((n)=>`declare const ${n}: any`)],["// Generated \u2014 the names stx auto-imports from @stacksjs/browser.",...Pe.map((n)=>`declare const ${n}: any`)].join(`
|
|
19
|
+
`),_e(await Fo())].filter(Boolean).join(`
|
|
20
20
|
`),L=`${l()}/typecheck`;await Bun.$`rm -rf ${L}`.quiet().nothrow(),await Bun.$`mkdir -p ${L}`.quiet().nothrow(),await Bun.write(z,me);let P=new Map,ge=0;for(let[n,r]of u){let x=`${ge++}_${n.replace(/[^\w.-]+/g,"_")}`;await Bun.write(`${L}/${x}`,r.source),P.set(x,r)}let he={target:"ESNext",module:"ESNext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,allowJs:!0,esModuleInterop:!0,resolveJsonModule:!0,lib:["ESNext","DOM","DOM.Iterable"],types:[],...je(e.length>0?h.dirname(h.resolve(e[0])):process.cwd()),...t.compilerOptions??{}},q=async(n,r)=>{let x=`${L}/tsconfig${r===1?"":`.${r}`}.json`;await Bun.write(x,JSON.stringify({compilerOptions:he,files:n.map((B)=>`${L}/${B}`).concat(z,...j)},null,2));let E=Bun.spawnSync(["bun","x","tsc","-p",x,"--pretty","false"],{stdout:"pipe",stderr:"pipe"});return{output:new TextDecoder().decode(E.stdout)+new TextDecoder().decode(E.stderr),exitCode:E.exitCode??0}},H=await q([...P.keys()],1),Z=H.output,K=[],Q=H.exitCode,Y=0,xe=new Set(j.map((n)=>n.split("/").pop())),ee=0,F=new Set,te=(n)=>{for(let r of n.replace(/\n[\t ]+([^\n]*)/g," $1").split(`
|
|
21
|
-
`)){let x=r.match(Me);if(!x)continue;if(Y++,xe.has(x[1].split("/").pop()))ee++;let[,E,B,N,I,T,A]=x,p=E.split("/").pop(),b=P.get(p);if(!b)continue;if(pe(Number(T)))F.add(p);let C=Number(B),X=Number(N),se,J=b.kind;if(b.virtual){let O=
|
|
21
|
+
`)){let x=r.match(Me);if(!x)continue;if(Y++,xe.has(x[1].split("/").pop()))ee++;let[,E,B,N,I,T,A]=x,p=E.split("/").pop(),b=P.get(p);if(!b)continue;if(pe(Number(T)))F.add(p);let C=Number(B),X=Number(N),se,J=b.kind;if(b.virtual){let O=Di(b.virtual,C,X)??(b.kind!=="template"&&pe(Number(T))?Di(b.virtual,b.virtual.sourceLineCount,1):null);if(!O||b.kind==="template"&&!O.expression&&!O.diagnosticOrigin)continue;if(ll(O,Number(T)))continue;C=O.line,X=O.column,se=O.expression?.code.trim(),J=O.diagnosticOrigin??J}K.push({file:b.origin,line:C,column:X,code:Number(T),message:A,category:I==="error"?"error":"warning",blockKind:J,expression:se})}};te(Z);let ye=Y,be=ee;if(F.size>0&&F.size<P.size){let n=[...P.keys()].filter((r)=>!F.has(r));te((await q(n,2)).output)}if(o)for(let[n,r]of g){if(r.names.length===0)continue;K.push({file:n,line:r.line,column:1,code:0,message:`${r.names.length===1?"1 value reaches":`${r.names.length} values reach`} this block on the implicit bridge and ${r.names.length===1?"is":"are"} untyped: ${r.names.join(", ")}. Declare them with defineClientPayload({ ${r.names.join(", ")} }) in the server block to have them checked.`,category:"warning",blockKind:r.kind})}K.push(...v);let ne=new Set,V=K.filter((n)=>{let r=`${n.file}:${n.line}:${n.column}:${n.code}:${n.message}`;if(ne.has(r))return!1;return ne.add(r),!0});V.sort((n,r)=>n.file.localeCompare(r.file)||n.line-r.line||n.column-r.column);let ie=be>0&&V.length===0,Se=ie||Q!==0&&ye===0?`${ie?"a file passed with --lib has errors of its own, so nothing in your code was checked":`tsc exited ${Q} without reporting any diagnostic, so nothing was checked`}. `+"A syntax error in an ambient declaration file does this \u2014 skipLibCheck suppresses "+`SEMANTIC diagnostics only. tsc said:
|
|
22
22
|
${Z.trim().split(`
|
|
23
23
|
`).slice(0,12).join(`
|
|
24
|
-
`)||"(no output)"}`:void 0;return{diagnostics:V,checkedFiles:R,blockCount:y,expressionCount:w,failure:
|
|
24
|
+
`)||"(no output)"}`:void 0;return{diagnostics:V,checkedFiles:R,blockCount:y,expressionCount:w,failure:Se}}function Im(e){return e.map((t)=>{let o=t.blockKind==="template"?`[template: ${t.expression??""}]`:`[${t.blockKind==="plain"?"<script>":`<script ${t.blockKind}>`}]`;return`${t.file}:${t.line}:${t.column} ${t.category} TS${t.code} ${t.message} ${o}`}).join(`
|
|
25
25
|
`)}
|
|
26
|
-
export{
|
|
26
|
+
export{Pa,Rm,Mo,Am,pu,fu,Pm,Im};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{G,V,Yr,Zr,Qr}from"./chunk-xy8smv5e.js";import{resolve as S,basename as z,extname as j,join as T}from"path";import{mkdir as q}from"fs/promises";var F={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class ia{config;constructor(e={}){this.config={...F,...e}}async get(e,s){return Yr(e,s,"image",this.config)}async set(e,s,r){return Zr(e,s,r,"image",this.config)}async clear(){return Qr("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function v(e){if(!w)w=new ia(e);else if(e)w.updateConfig(e);return w}async function aa(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return v(t).get(e,s)}async function ca(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return v(a).set(e,s,r)}async function cm(){return v().clear()}async function x(){try{return await import("ts-images")}catch{return null}}function R(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function k(e,s){let r=s?R(s):R("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function lm(e,s,r){let t=await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await aa(e,s,r);if(a)return a;try{let c=S(e);if(!await V(c))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=k(r,s.preset),p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await q(p,{recursive:!0});let d=await G(c),P=z(e,j(e)),b=s.outputFormat?[s.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:d},u=null;if(s.transformations&&s.transformations.length>0)u=await Zl(c,s.transformations,t);for(let i of b){let l=n[i]||{},g=`${P}-${d}.${i}`,h=T(p,g);try{let m=await t.optimizeImage({input:u||c,output:h,format:i,quality:l.quality,progressive:l.progressive});if(m){if(o.variants.push({path:h,url:`${I}/${g}`,width:m.width||0,height:m.height||0,format:i,size:m.outputSize||0}),!o.originalWidth&&m.width)o.originalWidth=m.width,o.originalHeight=m.height}}catch(m){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${i}: ${m}`)}}if(s.embedThumbhash||s.placeholder==="thumbhash")try{let i=await t.generateThumbHash(c);o.placeholder=i.dataUrl}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${i}`)}if(s.useDominantColor)try{let i=await t.generatePlaceholder(c,{strategy:"dominant-color"});o.dominantColor=i.dominantColor}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${i}`)}return await ca(e,s,o,r),o}catch(c){return{src:e,processed:!1,errors:[`Processing failed: ${c}`]}}}async function um(e,s,r,t){let a=await x();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:s,quality:r}))?.outputSize}}catch(c){return{success:!1,error:String(c)}}}async function Zl(e,s,r){let t=r||await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let c of s){let n=c.options||{};switch(c.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as E,basename as D,extname as Q,join as U}from"path";import{mkdir as L}from"fs/promises";async function H(){try{return await import("ts-images")}catch{return null}}var O=[320,480,640,768,1024,1280,1536,1920];async function dm(e,s,r){let t=await H();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=E(e);if(!await V(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let c=s.responsiveWidths||r.breakpoints||O,n=s.formats||r.defaultFormats||["avif","webp","jpeg"],p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await L(p,{recursive:!0});let d=await G(a),P=D(e,Q(e)),b=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let i of n){o.byFormat[i]=[];let l=[];for(let g of c){let h=`${P}-${g}w-${d}.${i}`,m=U(p,h),y=`${I}/${h}`;try{let C=b[i]?.quality||80;if(await V(m)){o.byFormat[i].push({path:m,url:y,width:g,height:0,format:i,size:0}),l.push(`${y} ${g}w`);continue}let f=await t.processImage({input:a,output:m,format:i,quality:C,resize:{width:g}});if(f)o.byFormat[i].push({path:m,url:y,width:g,height:f.height||Math.round(g*(f.height||1)/(f.width||1)),format:i,size:f.outputSize||0}),l.push(`${y} ${g}w`)}catch(C){console.warn(`[stx-media] Failed to generate ${i} at ${g}w: ${C}`)}}o.srcsets[i]=l.join(", ")}let u=s.placeholder||r.placeholderStrategy||"thumbhash";if(u!=="none")try{if(u==="thumbhash"){let i=await t.generateThumbHash(a);o.placeholder={dataURL:i.dataUrl,width:i.width||32,height:i.height||32,strategy:"thumbhash"}}else{let i=await t.generatePlaceholder(a,{strategy:u,width:20});o.placeholder={dataURL:i.dataURL,width:i.width,height:i.height,strategy:u}}}catch(i){console.warn(`[stx-media] Failed to generate placeholder: ${i}`)}return o.sizes=s.sizes||A(c),o}catch(c){return console.error(`[stx-media] Responsive generation failed: ${c}`),null}}function A(e){let s=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<s.length-1;t++){let a=s[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${s[s.length-1]}px`),r.join(", ")}function pm(e,s="width"){if(!e||e.length===0)return"";if(s==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{ia,aa,ca,cm,lm,um,Zl,dm,pm};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var Fo=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function Ha(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||Fo},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
|
|
2
|
+
var Vo=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function Ua(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||Vo},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
|
|
3
3
|
`)}function N(e,t,r){let n=" ".repeat(r);if(r===0)t.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let i=`node_${r}`;t.push(`${n} var ${i} = try ${e.zigType}.init(allocator);`);for(let[o,s]of Object.entries(e.props))if(s.type==="literal"){let a=typeof s.value==="string"?`"${s.value}"`:String(s.value);t.push(`${n} ${i}.set${J(o)}(${a});`)}for(let o=0;o<e.children.length;o++){let s=e.children[o];if(s.type==="text"){let a=s.props.text?.type==="literal"?String(s.props.text.value):"";t.push(`${n} try ${i}.addChild(try craft.Text.init(allocator, "${a}"));`)}else N(s,t,r+1),t.push(`${n} try ${i}.addChild(node_${r+1});`)}if(r===0)t.push(` return ${i}.element();`),t.push("}")}function E(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('import { Craft } from "@stacksjs/craft";'),r.push(""),r.push("export function render(): Craft.Element {"),r.push(" return "+v(e,1)+";"),r.push("}"),r.join(`
|
|
4
4
|
`)}function v(e,t){let r=" ".repeat(t),n=[];for(let[a,l]of Object.entries(e.props))if(l.type==="literal"){let p=typeof l.value==="string"?`"${l.value}"`:String(l.value);n.push(`${a}: ${p}`)}let i=n.length>0?`{ ${n.join(", ")} }`:"{}",o=e.children.map((a)=>a.type==="text"?`"${a.props.text?.type==="literal"?a.props.text.value:""}"`:v(a,t+1)),s=o.length>0?`,
|
|
5
5
|
${r} [${o.join(`,
|
|
6
6
|
${r} `)}]`:"";return`Craft.create("${e.zigType}", ${i}${s})`}function H(e,t,r){if(t.target==="universal"){let n=[];n.push("// Universal entry point"),n.push("");for(let[i,o]of r)n.push(`// --- ${i.toUpperCase()} ---`),n.push(`#if ${i.toUpperCase()}`),n.push(o),n.push("#endif"),n.push("");return n.join(`
|
|
7
|
-
`)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function
|
|
8
|
-
export{
|
|
7
|
+
`)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function Wa(e){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(t)=>{console.log(`[craft-compiler] File changed: ${t}`)}}}var K={compileToNative:Ua,createHotReloadServer:Wa,NATIVE_COMPONENTS:Vo},Gh=K;
|
|
8
|
+
export{Vo,Ua,Wa,Gh};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function t(n){if(!n||typeof n!=="object")return!1;let i=n;return typeof i.message==="string"&&(i.name==="BuildMessage"||i.name==="ResolveMessage"||("position"in i))}function o(n){if(n&&typeof n==="object"&&Array.isArray(n.errors))return n.errors;return[n]}function
|
|
2
|
+
function t(n){if(!n||typeof n!=="object")return!1;let i=n;return typeof i.message==="string"&&(i.name==="BuildMessage"||i.name==="ResolveMessage"||("position"in i))}function o(n){if(n&&typeof n==="object"&&Array.isArray(n.errors))return n.errors;return[n]}function gr(n,i){let e=[];for(let r of o(n)){if(t(r)){let s=r.position||void 0;e.push({file:i||s?.file,line:s?.line,column:s?.column,message:r.message??"",lineText:s?.lineText});continue}e.push({file:i,message:r instanceof Error?r.message:String(r)})}return e}function Fe(n,i){return gr(n,i).map((e)=>{let r=e.file?`${e.file}${e.line?`:${e.line}${e.column?`:${e.column}`:""}`:""}`:"",s=e.lineText?`
|
|
3
3
|
${e.lineText.trim()}`:"";return r?`${r}: ${e.message}${s}`:`${e.message}${s}`}).join(`
|
|
4
|
-
`)}export{
|
|
4
|
+
`)}export{gr,Fe};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{c}from"./chunk-
|
|
2
|
+
import{c}from"./chunk-hxws025y.js";function r(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
|
|
3
3
|
(function() {
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{R}from"./chunk-s29hp1qw.js";import{Re,Vt,se,B,Pn,ie,P}from"./chunk-a02gt4tz.js";import{Wi,lo,d,m,N,ht,p,uo,n,u,k}from"./chunk-295bykzd.js";import{wr}from"./chunk-twmkz0xs.js";import{fe}from"./chunk-d2pexm3z.js";import{Is}from"./chunk-cb0c6959.js";var he=1000,me=!1;function xe(t,r){let i=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,s;while((s=i.exec(t))!==null){let l=s.index+s[0].length,b=s.index+s[0].indexOf("("),x=k(t,"(",")",b);if(x===-1)continue;let f=t.slice(l,x).trim();if(!f)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(f)))continue;let h;try{let a=N(f,r);if(!a||typeof a!=="object")continue;h=JSON.stringify(a)}catch{continue}e+=t.slice(o,l)+h,o=x,i.lastIndex=x}return o===0?t:e+t.slice(o)}function be(t,r){let i=/@component\s*\(/g,e=t,o,s=[];while((o=i.exec(e))!==null){let l=o.index,b=l+o[0].length-1,x=1,f=b+1;while(f<e.length&&x>0){if(e[f]==="(")x++;else if(e[f]===")"){if(x--,x===0)break}f++}if(x!==0)continue;let c=e.substring(b+1,f),h=f+1,a=c.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let y=a[1],g=c.slice(a[0].length),A=g.match(/^\s*,\s*/);if(!A)continue;let O=g.slice(A[0].length).trim();if(!O)continue;try{let S=N(O,r),W=JSON.stringify(S),I=`@component('${y}', ${W})`;s.push({start:l,end:h,replacement:I})}catch{continue}}for(let l=s.length-1;l>=0;l--){let{start:b,end:x,replacement:f}=s[l];e=e.substring(0,b)+f+e.substring(x)}return e}function oe(t,r,i){let e=t,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),s;while((s=o.exec(e))!==null){let l=s.index,b=l+s[0].length-1,x=1,f=b+1,c=null,h=!1;while(f<e.length&&x>0){let g=e[f];if(h){h=!1,f++;continue}if(g==="\\"&&c){h=!0,f++;continue}if(c){if(g===c)c=null;f++;continue}if(g==='"'||g==="'"||g==="`"){c=g,f++;continue}if(g==="(")x++;else if(g===")"){if(x--,x===0)break}f++}if(x!==0)break;let a=e.substring(b+1,f),y=i(a);e=e.substring(0,l)+y+e.substring(f+1)}return e}function ye(t,r){let i=t;return i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,s)=>{try{if(B(s,r.__stx_client_signal_names||[]))return e;let l=Object.keys(r),b=Object.values(r);Wi(s);let x=!1,c=p(s,l,()=>{x=!0})(...b);if(x)return e;let h=JSON.stringify(c);if(h===void 0){if(!ht(s).some((g)=>!(g in r)))return"";return e}let a=Buffer.from(h,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(l){return e}}),i}var Q="<!--__STX_BREAK__-->",ee="<!--__STX_CONTINUE__-->";function ae(t,r){let i=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let s=i.exec(t);s;s=i.exec(t)){if(!s[1]){let f=s[0].length===3&&s[0]==="{{{"?3:2,c=s[0]==="{!!"?t.indexOf("!!}",i.lastIndex):Re(t,s.index,f);if(c<0)break;i.lastIndex=c+(s[0]==="{!!"?3:f);continue}let l=i.lastIndex,b=!0,x=/^\s*\(/.exec(t.slice(l));if(x){let f=l+x[0].length-1,c=k(t,"(",")",f);if(c<0)break;l=c+1;try{let h=`!!(${t.slice(f+1,c).trim()})`;b=m(h)?Boolean(p(h,Object.keys(r))(...Object.values(r))):Boolean(d(h,r))}catch{b=!1}}if(e+=t.slice(o,s.index),b)return e+(s[1]==="break"?Q:ee);o=l,i.lastIndex=l}return e+t.slice(o)}function ue(t){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),i="",e=0;return Pn(t,(o,s,l)=>(i+=ce(r(t.slice(e,l))),i+=`\${__stxRenderLoopValue(${l}, (${s}), ${o.length})}`,e=l+o.length,o)),i+ce(r(t.slice(e)))}function ge(t,r,i,e){return ie(t,r,i==null?"":String(i),!1,e)}function ce(t){let r=t;return r=oe(r,"@break",(i)=>{let e=i.trim();if(!uo(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(i)=>{let e=i.trim();if(!uo(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function Ee(t){let r=/@forelse\s*\(/g,i,e=[],o=/@foreach\s*\(/g,s=/@endforeach/g,l;while((l=o.exec(t))!==null)e.push({pos:l.index,delta:1});while((l=s.exec(t))!==null)e.push({pos:l.index,delta:-1});e.sort((c,h)=>c.pos-h.pos);let b=[],x=0;for(let c of e)x+=c.delta,b.push({pos:c.pos,depth:x});function f(c){let h=0,a=b.length-1,y=0;while(h<=a){let g=h+a>>1;if(b[g].pos<=c)y=b[g].depth,h=g+1;else a=g-1}return y}while((i=r.exec(t))!==null){if(f(i.index)>0)continue;let c=i.index,h=i.index+i[0].length-1,a=1,y=h+1,g=-1;while(y<t.length&&a>0){if(t[y]==="(")a++;else if(t[y]===")"){if(a--,a===0){g=y;break}}y++}if(g===-1)continue;let A=t.substring(h+1,g),O=Vt(A);if(!O)continue;let{arrayExpr:S,itemVar:W}=O,I=g+1,_=1,T=I,K=/@forelse\s*\(/g,C=/@endforelse/g,L=-1;while(_>0&&T<t.length){K.lastIndex=T,C.lastIndex=T;let F=K.exec(t),E=C.exec(t);if(!E)break;if(F&&F.index<E.index)_++,T=F.index+F[0].length;else{if(_--,_===0){L=E.index;break}T=E.index+11}}if(L===-1)continue;let w=t.substring(I,L),Z=L+11,z=-1,D=0,V=0;while(V<w.length){let F=w.indexOf("@",V);if(F===-1)break;let E=w.substring(F);if(/^@forelse\s*\(/.test(E))D++,V=F+1;else if(E.startsWith("@endforelse"))D--,V=F+11;else if(D===0&&E.startsWith("@empty")){if(w.length<=F+6||!/[a-z]/i.test(w[F+6])){z=F;break}V=F+1}else V=F+1}if(z===-1)continue;return{start:c,end:Z,arrayExpr:S,itemVar:W,foreachContent:w.substring(0,z),emptyContent:w.substring(z+6)}}return null}function le(t,r){let i=t;while(!0){let e=Ee(i);if(!e)break;let{start:o,end:s,arrayExpr:l,itemVar:b,foreachContent:x,emptyContent:f}=e;try{let c;if(m(l))c=p(l,Object.keys(r))(...Object.values(r));else c=d(l,r);let h;if(!Array.isArray(c)||c.length===0)h=f;else h=`@foreach (${l} as ${b})${x}@endforeach`;i=i.substring(0,o)+h+i.substring(s)}catch(c){let h=c instanceof Error?c.message:String(c),a=u("Forelse",`Error in @forelse(${l} as ${b}): ${h}`,n.EVALUATION_ERROR);i=i.substring(0,o)+a+i.substring(s)}}return i}var de="<!--stx:foreach-not-iterable:",_e=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function $e(t,r){return`${de}${encodeURIComponent(t)}|${encodeURIComponent(r)}-->`}function Ae(t,r){console.warn(`[stx] @foreach(${t}) in ${r}: ${t} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Es(t){if(!t.includes(de))return t;return t.replace(_e,(r,i,e)=>(Ae(decodeURIComponent(i),decodeURIComponent(e)),""))}function lg(t,r,i,e,o=!1){let s=ne(t,r,i,e,o),l=s.next();while(!l.done)l=s.next();return l.value}async function si(t,r,i,e,o=!1){let s=ne(t,r,i,e,o),l=s.next();while(!l.done)await R(),l=s.next();return l.value}function*ne(t,r,i,e,o=!1){let s=t,l=new Set(r.__stx_client_signal_names||[]);for(let c of wr(t))l.add(c);if(l.size)r={...r,__stx_client_signal_names:[...l]};s=le(s,r);function b(c){let h=/@foreach\s*\(/g,a;while((a=h.exec(c))!==null){let y=a.index,g=a.index+a[0].length-1,A=1,O=g+1,S=-1;while(O<c.length&&A>0){if(c[O]==="(")A++;else if(c[O]===")"){if(A--,A===0){S=O;break}}O++}if(S===-1)continue;let W=c.substring(g+1,S),I=Vt(W);if(!I)continue;let _=y,{arrayExpr:T,itemVar:K}=I,C=S+1,L=1,w=C,Z=/@foreach\s*\(/g,z=/@endforeach/g;while(L>0&&w<c.length){Z.lastIndex=w,z.lastIndex=w;let D=Z.exec(c),V=z.exec(c);if(!V)break;if(D&&D.index<V.index)L++,w=D.index+D[0].length;else{if(L--,L===0){let F=c.substring(C,V.index),E=V.index+11;return{start:_,end:E,arrayExpr:T,itemVar:K,content:F}}w=V.index+11}}}return null}function*x(c,h){let a=c;while(!0){let y=b(a);if(!y)break;let{start:g,end:A,arrayExpr:O,itemVar:S,content:W}=y;try{let I=O.trim(),_;if(m(I))_=p(I,Object.keys(h))(...Object.values(h));else _=d(I,h);let T=!1;if(!Array.isArray(_))if(_ instanceof Map)_=Array.from(_),T=!0;else if(_ instanceof Set)_=Array.from(_);else if(typeof _==="string")_=Array.from(_);else if(_&&typeof _==="object"&&!(_ instanceof Date)&&!(_ instanceof RegExp))_=Object.entries(_),T=!0;else{let E=$e(I,i)+u("Foreach",`Error in @foreach: ${I} is not iterable`,n.TYPE_ERROR);a=a.substring(0,g)+E+a.substring(A);continue}let K=e?.loops?.useAltLoopVariable??me,C=S.trim(),L=null,w,Z=!1;if(C.includes("=>")){let E=C.split("=>").map((j)=>j.trim());if(E.length===2&&E[0]&&E[1])L=E[0],w=E[1];else w=C}else if(!C.startsWith("[")&&!C.startsWith("{")&&C.includes(",")){let E=C.split(",").map((j)=>j.trim());if(E.length===2&&E[0]&&E[1])w=E[0],L=E[1],Z=!0;else w=C}else w=C;let z="",D=new Set(se(`${O} as ${S}`)),V=_,F=h[lo]??new WeakMap;for(let E=0;E<V.length;E++){if(E%16===0)yield;let j=V[E],te={index:E,iteration:E+1,first:E===0,last:E===V.length-1,count:V.length},M={...h,loop:te,$loop:te,[lo]:F};if(Array.isArray(h.__stx_client_signal_names))M.__stx_client_signal_names=h.__stx_client_signal_names.filter((H)=>!D.has(H));if(w.startsWith("[")&&w.endsWith("]")){let H=w.slice(1,-1).split(",").map((U)=>U.trim());if(Array.isArray(j))H.forEach((U,X)=>{if(U)M[U]=j[X]});else M[w]=j}else if(w.startsWith("{")&&w.endsWith("}")){let H=w.slice(1,-1).split(",").map((U)=>U.trim()).filter(Boolean);if(j!==null&&typeof j==="object")H.forEach((U)=>{let X=U.indexOf(":"),Y=(X===-1?U:U.slice(0,X)).trim(),re=X===-1?Y:U.slice(X+1).trim();if(Y&&re)M[re]=j[Y]});else M[w]=j}else M[w]=j;if(L)if(!Z&&T&&Array.isArray(j)&&j.length===2)M[L]=j[0],M[w]=j[1];else M[L]=E;let v=le(W,M);v=yield*ne(v,M,i,e,!0),v=fe(v,M,i),v=ae(v,M);let J=v.indexOf(Q),G=v.indexOf(ee),q=J<0?G:G<0?J:Math.min(J,G);if(q>=0)v=v.slice(0,q);if(v=P(v,M,i),v=ye(v,M),v=be(v,M),v=xe(v,M),z+=v,q>=0&&q===J)break}a=a.substring(0,g)+z+a.substring(A)}catch(I){let _=u("Foreach",`Error in @foreach(${O.trim()} as ${S.trim()}): ${I instanceof Error?I.message:String(I)}`,n.EVALUATION_ERROR);a=a.substring(0,g)+_+a.substring(A)}}return a}s=yield*x(s,r),s=we(s,r,i,e);let f=e?.loops?.maxWhileIterations??he;return s=Ie(s,r,f),o?s:Es(s)}function ug(t){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(t);if(!r||/^(?:const|let|var)$/.test(r[2]))return t;return`${r[1]}let ${t.slice(r[1].length)}`}function pe(t){return uo(t)}function we(t,r,i,e){let o=t,s=!0;while(s){s=!1;let l=o.match(/@for\s*\(/);if(!l||l.index===void 0)break;let b=l.index,x=b+l[0].length-1,f=k(o,"(",")",x);if(f===-1)break;let c=ug(o.slice(x+1,f)),h=f+1,a=Is(o.slice(b),"for","endfor");if(a.length===0)break;let y=a[0].content,g=b+a[0].end;if(!pe(c)){let A=u("For",`Unsafe expression in @for: ${c}`,n.UNSAFE_EXPRESSION);o=o.substring(0,b)+A+o.substring(g),s=!0;continue}try{let A=Oe(c),O=/@(?:for|foreach|if|unless)\s*\(/.test(y);if(A.length>0&&O){let K=ke({forExpr:c,content:y,iterVarNames:A,context:r,filePath:i,options:e});o=o.substring(0,b)+K+o.substring(g),s=!0;continue}let S=Object.keys(r),W=Object.values(r),I=ue(y),T=Function(...S,"__stxRenderLoopValue",`
|
|
2
|
+
import{R}from"./chunk-2a5g80mq.js";import{Ae,Vt,oe,F,An,ae,P}from"./chunk-gz9pknbw.js";import{Gi,fo,d,m,M,ht,p,go,n,u,k}from"./chunk-3dqfjpz4.js";import{vr}from"./chunk-4kmg6g5n.js";import{ge}from"./chunk-5kqezrjt.js";import{Ms}from"./chunk-pctf14yw.js";var he=1000,me=!1;function xe(t,r){let i=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,s;while((s=i.exec(t))!==null){let l=s.index+s[0].length,b=s.index+s[0].indexOf("("),x=k(t,"(",")",b);if(x===-1)continue;let f=t.slice(l,x).trim();if(!f)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(f)))continue;let h;try{let a=M(f,r);if(!a||typeof a!=="object")continue;h=JSON.stringify(a)}catch{continue}e+=t.slice(o,l)+h,o=x,i.lastIndex=x}return o===0?t:e+t.slice(o)}function be(t,r){let i=/@component\s*\(/g,e=t,o,s=[];while((o=i.exec(e))!==null){let l=o.index,b=l+o[0].length-1,x=1,f=b+1;while(f<e.length&&x>0){if(e[f]==="(")x++;else if(e[f]===")"){if(x--,x===0)break}f++}if(x!==0)continue;let c=e.substring(b+1,f),h=f+1,a=c.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let y=a[1],g=c.slice(a[0].length),A=g.match(/^\s*,\s*/);if(!A)continue;let O=g.slice(A[0].length).trim();if(!O)continue;try{let S=M(O,r),B=JSON.stringify(S),I=`@component('${y}', ${B})`;s.push({start:l,end:h,replacement:I})}catch{continue}}for(let l=s.length-1;l>=0;l--){let{start:b,end:x,replacement:f}=s[l];e=e.substring(0,b)+f+e.substring(x)}return e}function se(t,r,i){let e=t,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),s;while((s=o.exec(e))!==null){let l=s.index,b=l+s[0].length-1,x=1,f=b+1,c=null,h=!1;while(f<e.length&&x>0){let g=e[f];if(h){h=!1,f++;continue}if(g==="\\"&&c){h=!0,f++;continue}if(c){if(g===c)c=null;f++;continue}if(g==='"'||g==="'"||g==="`"){c=g,f++;continue}if(g==="(")x++;else if(g===")"){if(x--,x===0)break}f++}if(x!==0)break;let a=e.substring(b+1,f),y=i(a);e=e.substring(0,l)+y+e.substring(f+1)}return e}function ye(t,r){let i=t;return i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,s)=>{try{if(F(s,r.__stx_client_signal_names||[]))return e;let l=Object.keys(r),b=Object.values(r);Gi(s);let x=!1,c=p(s,l,()=>{x=!0})(...b);if(x)return e;let h=JSON.stringify(c);if(h===void 0){if(!ht(s).some((g)=>!(g in r)))return"";return e}let a=Buffer.from(h,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(l){return e}}),i}var Q="<!--__STX_BREAK__-->",ee="<!--__STX_CONTINUE__-->";function le(t,r){let i=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let s=i.exec(t);s;s=i.exec(t)){if(!s[1]){let f=s[0].length===3&&s[0]==="{{{"?3:2,c=s[0]==="{!!"?t.indexOf("!!}",i.lastIndex):Ae(t,s.index,f);if(c<0)break;i.lastIndex=c+(s[0]==="{!!"?3:f);continue}let l=i.lastIndex,b=!0,x=/^\s*\(/.exec(t.slice(l));if(x){let f=l+x[0].length-1,c=k(t,"(",")",f);if(c<0)break;l=c+1;try{let h=`!!(${t.slice(f+1,c).trim()})`;b=m(h)?Boolean(p(h,Object.keys(r))(...Object.values(r))):Boolean(d(h,r))}catch{b=!1}}if(e+=t.slice(o,s.index),b)return e+(s[1]==="break"?Q:ee);o=l,i.lastIndex=l}return e+t.slice(o)}function ue(t){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),i="",e=0;return An(t,(o,s,l)=>(i+=ie(r(t.slice(e,l))),i+=`\${__stxRenderLoopValue(${l}, (${s}), ${o.length})}`,e=l+o.length,o)),i+ie(r(t.slice(e)))}function fe(t,r,i,e){return ae(t,r,i==null?"":String(i),!1,e)}function ie(t){let r=t;return r=se(r,"@break",(i)=>{let e=i.trim();if(!go(e))return"";return`\`; if (${e}) { break; } result += \``}),r=se(r,"@continue",(i)=>{let e=i.trim();if(!go(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function Ee(t){let r=/@forelse\s*\(/g,i,e=[],o=/@foreach\s*\(/g,s=/@endforeach/g,l;while((l=o.exec(t))!==null)e.push({pos:l.index,delta:1});while((l=s.exec(t))!==null)e.push({pos:l.index,delta:-1});e.sort((c,h)=>c.pos-h.pos);let b=[],x=0;for(let c of e)x+=c.delta,b.push({pos:c.pos,depth:x});function f(c){let h=0,a=b.length-1,y=0;while(h<=a){let g=h+a>>1;if(b[g].pos<=c)y=b[g].depth,h=g+1;else a=g-1}return y}while((i=r.exec(t))!==null){if(f(i.index)>0)continue;let c=i.index,h=i.index+i[0].length-1,a=1,y=h+1,g=-1;while(y<t.length&&a>0){if(t[y]==="(")a++;else if(t[y]===")"){if(a--,a===0){g=y;break}}y++}if(g===-1)continue;let A=t.substring(h+1,g),O=Vt(A);if(!O)continue;let{arrayExpr:S,itemVar:B}=O,I=g+1,_=1,T=I,K=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(_>0&&T<t.length){K.lastIndex=T,L.lastIndex=T;let C=K.exec(t),E=L.exec(t);if(!E)break;if(C&&C.index<E.index)_++,T=C.index+C[0].length;else{if(_--,_===0){V=E.index;break}T=E.index+11}}if(V===-1)continue;let w=t.substring(I,V),Z=V+11,z=-1,D=0,N=0;while(N<w.length){let C=w.indexOf("@",N);if(C===-1)break;let E=w.substring(C);if(/^@forelse\s*\(/.test(E))D++,N=C+1;else if(E.startsWith("@endforelse"))D--,N=C+11;else if(D===0&&E.startsWith("@empty")){if(w.length<=C+6||!/[a-z]/i.test(w[C+6])){z=C;break}N=C+1}else N=C+1}if(z===-1)continue;return{start:c,end:Z,arrayExpr:S,itemVar:B,foreachContent:w.substring(0,z),emptyContent:w.substring(z+6)}}return null}function ce(t,r){let i=t;while(!0){let e=Ee(i);if(!e)break;let{start:o,end:s,arrayExpr:l,itemVar:b,foreachContent:x,emptyContent:f}=e;try{let c;if(m(l))c=p(l,Object.keys(r))(...Object.values(r));else c=d(l,r);let h;if(!Array.isArray(c)||c.length===0)h=f;else h=`@foreach (${l} as ${b})${x}@endforeach`;i=i.substring(0,o)+h+i.substring(s)}catch(c){let h=c instanceof Error?c.message:String(c),a=u("Forelse",`Error in @forelse(${l} as ${b}): ${h}`,n.EVALUATION_ERROR);i=i.substring(0,o)+a+i.substring(s)}}return i}var de="<!--stx:foreach-not-iterable:",_e=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function $e(t,r){return`${de}${encodeURIComponent(t)}|${encodeURIComponent(r)}-->`}function Re(t,r){console.warn(`[stx] @foreach(${t}) in ${r}: ${t} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Rs(t){if(!t.includes(de))return t;return t.replace(_e,(r,i,e)=>(Re(decodeURIComponent(i),decodeURIComponent(e)),""))}function dg(t,r,i,e,o=!1){let s=ne(t,r,i,e,o),l=s.next();while(!l.done)l=s.next();return l.value}async function ai(t,r,i,e,o=!1){let s=ne(t,r,i,e,o),l=s.next();while(!l.done)await R(),l=s.next();return l.value}function*ne(t,r,i,e,o=!1){let s=t,l=new Set(r.__stx_client_signal_names||[]);for(let c of vr(t))l.add(c);if(l.size)r={...r,__stx_client_signal_names:[...l]};s=ce(s,r);function b(c){let h=/@foreach\s*\(/g,a;while((a=h.exec(c))!==null){let y=a.index,g=a.index+a[0].length-1,A=1,O=g+1,S=-1;while(O<c.length&&A>0){if(c[O]==="(")A++;else if(c[O]===")"){if(A--,A===0){S=O;break}}O++}if(S===-1)continue;let B=c.substring(g+1,S),I=Vt(B);if(!I)continue;let _=y,{arrayExpr:T,itemVar:K}=I,L=S+1,V=1,w=L,Z=/@foreach\s*\(/g,z=/@endforeach/g;while(V>0&&w<c.length){Z.lastIndex=w,z.lastIndex=w;let D=Z.exec(c),N=z.exec(c);if(!N)break;if(D&&D.index<N.index)V++,w=D.index+D[0].length;else{if(V--,V===0){let C=c.substring(L,N.index),E=N.index+11;return{start:_,end:E,arrayExpr:T,itemVar:K,content:C}}w=N.index+11}}}return null}function*x(c,h){let a=c;while(!0){let y=b(a);if(!y)break;let{start:g,end:A,arrayExpr:O,itemVar:S,content:B}=y;try{let I=O.trim(),_;if(m(I))_=p(I,Object.keys(h))(...Object.values(h));else _=d(I,h);let T=!1;if(!Array.isArray(_))if(_ instanceof Map)_=Array.from(_),T=!0;else if(_ instanceof Set)_=Array.from(_);else if(typeof _==="string")_=Array.from(_);else if(_&&typeof _==="object"&&!(_ instanceof Date)&&!(_ instanceof RegExp))_=Object.entries(_),T=!0;else{let E=$e(I,i)+u("Foreach",`Error in @foreach: ${I} is not iterable`,n.TYPE_ERROR);a=a.substring(0,g)+E+a.substring(A);continue}let K=e?.loops?.useAltLoopVariable??me,L=S.trim(),V=null,w,Z=!1;if(L.includes("=>")){let E=L.split("=>").map((W)=>W.trim());if(E.length===2&&E[0]&&E[1])V=E[0],w=E[1];else w=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let E=L.split(",").map((W)=>W.trim());if(E.length===2&&E[0]&&E[1])w=E[0],V=E[1],Z=!0;else w=L}else w=L;let z="",D=new Set(oe(`${O} as ${S}`)),N=_,C=h[fo]??new WeakMap;for(let E=0;E<N.length;E++){if(E%16===0)yield;let W=N[E],te={index:E,iteration:E+1,first:E===0,last:E===N.length-1,count:N.length},j={...h,loop:te,$loop:te,[fo]:C};if(Array.isArray(h.__stx_client_signal_names))j.__stx_client_signal_names=h.__stx_client_signal_names.filter((H)=>!D.has(H));if(w.startsWith("[")&&w.endsWith("]")){let H=w.slice(1,-1).split(",").map((U)=>U.trim());if(Array.isArray(W))H.forEach((U,X)=>{if(U)j[U]=W[X]});else j[w]=W}else if(w.startsWith("{")&&w.endsWith("}")){let H=w.slice(1,-1).split(",").map((U)=>U.trim()).filter(Boolean);if(W!==null&&typeof W==="object")H.forEach((U)=>{let X=U.indexOf(":"),Y=(X===-1?U:U.slice(0,X)).trim(),re=X===-1?Y:U.slice(X+1).trim();if(Y&&re)j[re]=W[Y]});else j[w]=W}else j[w]=W;if(V)if(!Z&&T&&Array.isArray(W)&&W.length===2)j[V]=W[0],j[w]=W[1];else j[V]=E;let v=ce(B,j);v=yield*ne(v,j,i,e,!0),v=ge(v,j,i),v=le(v,j);let J=v.indexOf(Q),G=v.indexOf(ee),q=J<0?G:G<0?J:Math.min(J,G);if(q>=0)v=v.slice(0,q);if(v=P(v,j,i),v=ye(v,j),v=be(v,j),v=xe(v,j),z+=v,q>=0&&q===J)break}a=a.substring(0,g)+z+a.substring(A)}catch(I){let _=u("Foreach",`Error in @foreach(${O.trim()} as ${S.trim()}): ${I instanceof Error?I.message:String(I)}`,n.EVALUATION_ERROR);a=a.substring(0,g)+_+a.substring(A)}}return a}s=yield*x(s,r),s=we(s,r,i,e);let f=e?.loops?.maxWhileIterations??he;return s=Ie(s,r,f),o?s:Rs(s)}function pg(t){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(t);if(!r||/^(?:const|let|var)$/.test(r[2]))return t;return`${r[1]}let ${t.slice(r[1].length)}`}function pe(t){return go(t)}function we(t,r,i,e){let o=t,s=!0;while(s){s=!1;let l=o.match(/@for\s*\(/);if(!l||l.index===void 0)break;let b=l.index,x=b+l[0].length-1,f=k(o,"(",")",x);if(f===-1)break;let c=pg(o.slice(x+1,f)),h=f+1,a=Ms(o.slice(b),"for","endfor");if(a.length===0)break;let y=a[0].content,g=b+a[0].end;if(!pe(c)){let A=u("For",`Unsafe expression in @for: ${c}`,n.UNSAFE_EXPRESSION);o=o.substring(0,b)+A+o.substring(g),s=!0;continue}try{let A=Oe(c),O=/@(?:for|foreach|if|unless)\s*\(/.test(y);if(A.length>0&&O){let K=ke({forExpr:c,content:y,iterVarNames:A,context:r,filePath:i,options:e});o=o.substring(0,b)+K+o.substring(g),s=!0;continue}let S=Object.keys(r),B=Object.values(r),I=ue(y),T=Function(...S,"__stxRenderLoopValue",`
|
|
3
3
|
let result = '';
|
|
4
4
|
for (${c}) {
|
|
5
5
|
result += \`${I}\`;
|
|
6
6
|
}
|
|
7
7
|
return result;
|
|
8
|
-
`)(...
|
|
8
|
+
`)(...B,(K,L,V)=>fe(y,K,L,V));o=o.substring(0,b)+T+o.substring(g),s=!0}catch(A){let O=u("For",`Error in @for(${c}): ${A instanceof Error?A.message:String(A)}`,n.EVALUATION_ERROR);o=o.substring(0,b)+O+o.substring(g),s=!0}}return o}function Oe(t){let r=t.trim(),i=r.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(i){let s=i[1];return s.slice(1,-1).split(",").map((b)=>{let x=b.trim();if(!x)return"";let f=x.indexOf(":");if(f>=0&&s.startsWith("{")){let a=x.slice(f+1).trim(),y=a.indexOf("=");return(y>=0?a.slice(0,y):a).trim()}let c=x.indexOf("="),h=(c>=0?x.slice(0,c):x).trim();return/^[A-Za-z_$][\w$]*$/.test(h)?h:""}).filter(Boolean)}let e=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(e)return[e[1]];let o=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(o)return[o[1]];return[]}function ke(t){let{forExpr:r,content:i,iterVarNames:e,context:o,filePath:s,options:l}=t,b=Object.keys(o),x=Object.values(o),f=s??"inline.stx",c="";return Function(...b,"__renderIteration",`
|
|
9
9
|
for (${r}) {
|
|
10
10
|
if (!__renderIteration([${e.join(", ")}])) break;
|
|
11
11
|
}
|
|
12
|
-
`)(...x,(a)=>{let y={...o};e.forEach((
|
|
12
|
+
`)(...x,(a)=>{let y={...o};e.forEach((B,I)=>{y[B]=a[I]});let g=dg(i,y,f,l,!0);g=ge(g,y,f),g=le(g,y);let A=g.indexOf(Q),O=g.indexOf(ee),S=A<0?O:O<0?A:Math.min(A,O);if(S>=0)g=g.slice(0,S);return c+=P(g,y,f),S<0||S!==A}),c}function Ie(t,r,i){let e=t,o=!0;while(o){o=!1;let s=e.match(/@while\s*\(/);if(!s||s.index===void 0)break;let l=s.index,b=l+s[0].length-1,x=k(e,"(",")",b);if(x===-1)break;let f=e.slice(b+1,x),c=Ms(e.slice(l),"while","endwhile");if(c.length===0)break;let h=c[0].content,a=l+c[0].end;if(!pe(f)){let y=u("While",`Unsafe expression in @while: ${f}`,n.UNSAFE_EXPRESSION);e=e.substring(0,l)+y+e.substring(a),o=!0;continue}try{let y=Object.keys(r),g=Object.values(r),A=ue(h),S=Function(...y,"__stxRenderLoopValue",`
|
|
13
13
|
let result = '';
|
|
14
14
|
let maxIterations = ${i}; // Configurable safety limit
|
|
15
15
|
let counter = 0;
|
|
@@ -21,5 +21,5 @@ import{R}from"./chunk-s29hp1qw.js";import{Re,Vt,se,B,Pn,ie,P}from"./chunk-a02gt4
|
|
|
21
21
|
result += '<!-- [While Error [1104]]: Maximum iterations (${i}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
22
22
|
}
|
|
23
23
|
return result;
|
|
24
|
-
`)(...g,(
|
|
25
|
-
export{
|
|
24
|
+
`)(...g,(B,I,_)=>fe(h,B,I,_));e=e.substring(0,l)+S+e.substring(a),o=!0}catch(y){let g=u("While",`Error in @while(${f}): ${y instanceof Error?y.message:String(y)}`,n.EVALUATION_ERROR);e=e.substring(0,l)+g+e.substring(a),o=!0}}return e}
|
|
25
|
+
export{Rs,dg,ai,pg};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import i from"path";var Sn=".stx",o="STX_DIR",e=null;function el(t){e=t?.trim()||null}function Rr(){return process.env[o]?.trim()||e||Sn}function l(t=process.cwd(),...n){let r=Rr();return i.isAbsolute(r)?i.join(r,...n):i.join(t,r,...n)}function Ar(t){if(!t||i.isAbsolute(t))return t;let n=t.replace(/\\/g,"/");if(n!==Sn&&!n.startsWith(`${Sn}/`))return t;let r=n.slice(Sn.length+1);return r?i.join(Rr(),r):Rr()}
|
|
3
|
+
export{Sn,el,Rr,l,Ar};
|