@stacksjs/stx 0.2.665 → 0.2.668
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-028ee6q5.js +2 -0
- package/dist/{chunk-tx6p6jnk.js → chunk-02gn092e.js} +1 -1
- package/dist/chunk-02ymqwmj.js +2 -0
- package/dist/{chunk-2q50h7zv.js → chunk-060298px.js} +5 -5
- package/dist/{chunk-zpc06ysq.js → chunk-0hemydnd.js} +1 -1
- package/dist/chunk-1e79xcc8.js +2 -0
- package/dist/chunk-1pnp91wx.js +2 -0
- package/dist/{chunk-2h8ea0we.js → chunk-1sr6c0nk.js} +2 -2
- package/dist/chunk-280p4q7a.js +2 -0
- package/dist/{chunk-hb08vrbb.js → chunk-2dp7hyv7.js} +21 -21
- package/dist/chunk-2ecgyqam.js +2 -0
- package/dist/{chunk-38b3w1y4.js → chunk-2hxwds8c.js} +1 -1
- package/dist/{chunk-x34scshq.js → chunk-2zzc7006.js} +2 -2
- package/dist/{chunk-wpm58d6p.js → chunk-30nes8ne.js} +2 -2
- package/dist/{chunk-d3vgtr0t.js → chunk-3641xvaw.js} +1 -1
- package/dist/{chunk-zaaeneq6.js → chunk-365vg0eg.js} +2 -2
- package/dist/{chunk-2qbvsvwc.js → chunk-3850m7ab.js} +6 -6
- package/dist/{chunk-ewcrsyr7.js → chunk-3hxd5td3.js} +2 -2
- package/dist/chunk-3n9vaxnt.js +2 -0
- package/dist/{chunk-pxqh758g.js → chunk-3y41efsf.js} +64 -15
- package/dist/chunk-41cvkdcm.js +3 -0
- package/dist/{chunk-s3dyzxwx.js → chunk-493x6e71.js} +4 -4
- package/dist/{chunk-jrf01hfv.js → chunk-4c183zem.js} +1 -1
- package/dist/{chunk-nm8yr8a9.js → chunk-4m1hye28.js} +1 -1
- package/dist/{chunk-v5916r3j.js → chunk-4teqcbw0.js} +5 -5
- package/dist/chunk-5zgrvj4b.js +2 -0
- package/dist/{chunk-cg3mvq4h.js → chunk-61n06wra.js} +6 -6
- package/dist/{chunk-pmwb5kaf.js → chunk-65b6cy92.js} +2 -2
- package/dist/{chunk-zjsyw63k.js → chunk-6by8f7n9.js} +9 -9
- package/dist/{chunk-vjw3qrqj.js → chunk-6tngeb4b.js} +1 -1
- package/dist/{chunk-bgra36az.js → chunk-6z2sdfac.js} +1 -1
- package/dist/{chunk-yq021b3r.js → chunk-7d4z944r.js} +3 -3
- package/dist/{chunk-rjh2jwxx.js → chunk-7met6yva.js} +8 -8
- package/dist/{chunk-2jh21f1n.js → chunk-89jbdtgw.js} +1 -1
- package/dist/chunk-8kskjg62.js +2 -0
- package/dist/{chunk-q1svy1nf.js → chunk-9edksf8x.js} +1 -1
- package/dist/{chunk-1z1632np.js → chunk-9k2wz3k1.js} +41 -41
- package/dist/{chunk-577ntqeg.js → chunk-9vaz5f9j.js} +1 -1
- package/dist/chunk-avph47dc.js +2 -0
- package/dist/{chunk-mrrrngzd.js → chunk-b4pcw34n.js} +1 -1
- package/dist/chunk-b7e07ybq.js +3 -0
- package/dist/{chunk-0jhdrgpr.js → chunk-b823zxq6.js} +2 -2
- package/dist/{chunk-c9k40352.js → chunk-bdg0fydw.js} +1 -1
- package/dist/{chunk-szyqxcfj.js → chunk-bnn7pd62.js} +2 -2
- package/dist/chunk-c3dk9pkf.js +2 -0
- package/dist/chunk-c4qebqmk.js +2 -0
- package/dist/chunk-ca6vx6vg.js +2 -0
- package/dist/{chunk-dra341c0.js → chunk-cba7953e.js} +15 -15
- package/dist/{chunk-p2mrba1n.js → chunk-cyq1jcg2.js} +107 -107
- package/dist/{chunk-w2zceynt.js → chunk-dpvxe52r.js} +1 -1
- package/dist/{chunk-pc48mjkc.js → chunk-dtjybwtz.js} +4 -4
- package/dist/{chunk-nf9bykvg.js → chunk-dy5j389v.js} +5 -5
- package/dist/{chunk-np1k9vsr.js → chunk-e1fetwbr.js} +1 -1
- package/dist/chunk-e4vpr36s.js +2 -0
- package/dist/{chunk-11zp67ds.js → chunk-e8gcqp8w.js} +4 -4
- package/dist/{chunk-yh0wb4n1.js → chunk-ecqrkyg8.js} +2 -2
- package/dist/chunk-fb93n9ts.js +2 -0
- package/dist/chunk-fmkcc7g1.js +2 -0
- package/dist/{chunk-edvmtk21.js → chunk-fpz59dhz.js} +5 -5
- package/dist/{chunk-een2wqah.js → chunk-fvtwec1r.js} +1 -1
- package/dist/{chunk-t9mfztcs.js → chunk-fzqj1mjz.js} +3 -3
- package/dist/chunk-gkmpr64n.js +2 -0
- package/dist/chunk-heh151bn.js +2 -0
- package/dist/chunk-hj0raner.js +2 -0
- package/dist/chunk-hkqhpckf.js +2 -0
- package/dist/{chunk-0g4pr7ww.js → chunk-hm9jt1p9.js} +9 -9
- package/dist/{chunk-5w2jy5r9.js → chunk-hvf2e7pr.js} +2 -2
- package/dist/chunk-hx9cn2s4.js +2 -0
- package/dist/{chunk-2f1bk3bg.js → chunk-k5mez1vx.js} +1 -1
- package/dist/{chunk-r7kmsq3n.js → chunk-ka8befem.js} +1 -1
- package/dist/{chunk-b6xv8jh9.js → chunk-kpeep7gq.js} +1 -1
- package/dist/{chunk-v2x9vzgw.js → chunk-md2jn67b.js} +2 -2
- package/dist/chunk-n7a33e3v.js +2 -0
- package/dist/{chunk-d3bsfd10.js → chunk-npa7gze7.js} +2 -2
- package/dist/{chunk-8nryyqb5.js → chunk-p472crv1.js} +1 -1
- package/dist/{chunk-4yf1w261.js → chunk-pn1ehs6a.js} +2 -2
- package/dist/{chunk-7rta163c.js → chunk-pxdww4rb.js} +2 -2
- package/dist/{chunk-eqrkhc18.js → chunk-qjtpxsyx.js} +2 -2
- package/dist/{chunk-gf3bxnpq.js → chunk-qxmyaajq.js} +1 -1
- package/dist/chunk-r7cenpxp.js +2 -0
- package/dist/{chunk-fzxyq6k5.js → chunk-rcefnd1g.js} +61 -61
- package/dist/chunk-s5w3t7xw.js +2 -0
- package/dist/{chunk-43gr8ggc.js → chunk-sme31jbj.js} +2 -2
- package/dist/chunk-sz6xdz4h.js +2 -0
- package/dist/{chunk-f2z8s2h9.js → chunk-t01c62y5.js} +2 -2
- package/dist/{chunk-jh3r0qp7.js → chunk-t7jxkrbx.js} +1 -1
- package/dist/{chunk-jkvr7e91.js → chunk-tp4eqfxq.js} +2 -2
- package/dist/{chunk-7ae140wv.js → chunk-tq0bgaae.js} +1 -1
- package/dist/chunk-tw0wc95k.js +2 -0
- package/dist/chunk-v0091n1g.js +2 -0
- package/dist/{chunk-qzy8ypk4.js → chunk-vdjj4vrp.js} +40 -40
- package/dist/{chunk-gf4e5xtr.js → chunk-vfba7nz5.js} +27 -27
- package/dist/{chunk-awe50wee.js → chunk-vg9bz5zs.js} +1 -1
- package/dist/chunk-vryzt0p0.js +2 -0
- package/dist/{chunk-8dcemd4a.js → chunk-w6x8m0tz.js} +1 -1
- package/dist/chunk-wesafj4a.js +2 -0
- package/dist/chunk-x986xz7h.js +2 -0
- package/dist/{chunk-xv43szx0.js → chunk-xqp4hstk.js} +1 -1
- package/dist/{chunk-c1dkh0es.js → chunk-yfvm7q6t.js} +3 -3
- package/dist/chunk-ynh1ppa6.js +2 -0
- package/dist/{chunk-eecgcj41.js → chunk-yscr04dv.js} +1 -1
- package/dist/{chunk-a1p327a7.js → chunk-zcz97ber.js} +9 -9
- package/dist/chunk-zdgsj39g.js +2 -0
- package/dist/{chunk-5z1n02nd.js → chunk-zwkc8yge.js} +37 -37
- package/dist/cli.js +36 -36
- package/dist/client/signals-for-runtime.js +51 -2
- package/dist/client/signals-process-element-runtime.js +1 -1
- package/dist/component-renderer.js +4 -2
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/compiler/headwind-to-style.js +24 -1
- package/dist/native/compiler/html-to-ir.js +25 -5
- package/dist/native/runtime/binding-tree.d.ts +1 -0
- package/dist/native/runtime/binding-tree.js +5 -0
- package/dist/native/runtime/craft-bridge.js +1 -0
- package/dist/native/runtime/craft.d.ts +1 -0
- package/dist/native/runtime/jsc-globals.d.ts +20 -0
- package/dist/native/runtime/jsc-globals.js +52 -0
- package/dist/native/testing.d.ts +0 -1
- package/dist/native/testing.js +31 -4
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.js +1 -2
- package/dist/slot-scopes.js +10 -2
- package/dist/slots.d.ts +2 -2
- package/dist/slots.js +21 -5
- package/dist/ssg.js +5 -5
- package/dist/utils.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-0eepx077.js +0 -2
- package/dist/chunk-0fhntp63.js +0 -2
- package/dist/chunk-2a4szpje.js +0 -3
- package/dist/chunk-3d39yer3.js +0 -2
- package/dist/chunk-4v9x7zz5.js +0 -2
- package/dist/chunk-5etmsv9z.js +0 -2
- package/dist/chunk-773frt6c.js +0 -2
- package/dist/chunk-8d2f2e42.js +0 -2
- package/dist/chunk-a2bw46t9.js +0 -2
- package/dist/chunk-d5pt75tp.js +0 -2
- package/dist/chunk-em3aepxz.js +0 -2
- package/dist/chunk-g53sg7e0.js +0 -2
- package/dist/chunk-gsw8g2ev.js +0 -2
- package/dist/chunk-gz90fqn8.js +0 -2
- package/dist/chunk-gzd7bmp5.js +0 -2
- package/dist/chunk-hcqyf26s.js +0 -2
- package/dist/chunk-hhmj9gpk.js +0 -2
- package/dist/chunk-k2byvram.js +0 -2
- package/dist/chunk-kph7cenp.js +0 -2
- package/dist/chunk-papqmch6.js +0 -2
- package/dist/chunk-qambfx8c.js +0 -2
- package/dist/chunk-stfqkgfv.js +0 -2
- package/dist/chunk-t34ds1e3.js +0 -2
- package/dist/chunk-t4cbrm81.js +0 -2
- package/dist/chunk-t60pt4gv.js +0 -2
- package/dist/chunk-t6yjxhn8.js +0 -2
- package/dist/chunk-w89mazpv.js +0 -2
- package/dist/chunk-wq2fq6b7.js +0 -2
- package/dist/chunk-wsp8sj9v.js +0 -3
- package/dist/chunk-x8knte1j.js +0 -2
- package/dist/chunk-y7xshkqn.js +0 -2
- package/dist/chunk-ypsym37h.js +0 -2
- package/dist/chunk-z58ybwsv.js +0 -2
- package/dist/chunk-zteaygxc.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{kc,wi,_c,Cc,xi,Ec,Tc,$c,Rc,Si,Ac,Pu}from"./chunk-
|
|
2
|
+
import{kc,wi,_c,Cc,xi,Ec,Tc,$c,Rc,Si,Ac,Pu}from"./chunk-7d4z944r.js";import{Ii,Mc}from"./chunk-89jbdtgw.js";import{X,J,Y,Cn,pe,_e,Rr,dt,Ut,En,Tn,$n,Z,Rn,An,Ar}from"./chunk-b823zxq6.js";import{ol}from"./chunk-tre98h62.js";import"./chunk-yfvm7q6t.js";export{J as DEFAULT_FORMATS,Y as DEFAULT_QUALITY,X as DEFAULT_WIDTHS,Ar as ImageProcessingError,Cc as clearImageCache,xi as createImageDirective,Mc as createImageHandler,Tc as createImagePlugin,Pu as defaultImageConfig,An as formatSize,Si as generateImageManifest,Ut as generateSizes,dt as generateSrcSet,En as getFallbackVariant,Rr as getImageMetadata,Z as getMimeType,Rn as getTotalSize,Tn as groupVariantsByFormat,Ii as handleImageRequest,Ec as imageDirective,pe as isImageBackendAvailable,$n as isImageFile,Cn as isSharpAvailable,Rc as optimizeDirectory,$c as optimizeImage,wi as parseImageComponent,_e as processImage,_c as processImageComponents,kc as renderImageComponent,ol as rewriteImagesWithSiblings,Ac as writeImageManifest};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fo,vs,l,
|
|
2
|
+
import{Fo,vs,l,p,E,tt,u,ws,t,a,w}from"./chunk-2dp7hyv7.js";import{he,Tt,It,K,k}from"./chunk-vdjj4vrp.js";import{ee}from"./chunk-ka8befem.js";import{Ur}from"./chunk-p472crv1.js";var ae=1000,ue=!1;function fe(n,r){let o=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",s=0,i;while((i=o.exec(n))!==null){let d=i.index+i[0].length,y=i.index+i[0].indexOf("("),m=w(n,"(",")",y);if(m===-1)continue;let c=n.slice(d,m).trim();if(!c)continue;if(!Object.keys(r).some((b)=>new RegExp(`(?:^|[^\\w$.])${b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(c)))continue;let g;try{let b=E(c,r);if(!b||typeof b!=="object")continue;g=JSON.stringify(b)}catch{continue}e+=n.slice(s,d)+g,s=m,o.lastIndex=m}return s===0?n:e+n.slice(s)}function ge(n,r){let o=/@component\s*\(/g,e=n,s,i=[];while((s=o.exec(e))!==null){let d=s.index,y=d+s[0].length-1,m=1,c=y+1;while(c<e.length&&m>0){if(e[c]==="(")m++;else if(e[c]===")"){if(m--,m===0)break}c++}if(m!==0)continue;let f=e.substring(y+1,c),g=c+1,b=f.match(/^\s*['"]([^'"]+)['"]/);if(!b)continue;let x=b[1],h=f.slice(b[0].length),_=h.match(/^\s*,\s*/);if(!_)continue;let S=h.slice(_[0].length).trim();if(!S)continue;try{let P=E(S,r),F=JSON.stringify(P),R=`@component('${x}', ${F})`;i.push({start:d,end:g,replacement:R})}catch{continue}}for(let d=i.length-1;d>=0;d--){let{start:y,end:m,replacement:c}=i[d];e=e.substring(0,y)+c+e.substring(m)}return e}function te(n,r,o){let e=n,s=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=s.exec(e))!==null){let d=i.index,y=d+i[0].length-1,m=1,c=y+1,f=null,g=!1;while(c<e.length&&m>0){let h=e[c];if(g){g=!1,c++;continue}if(h==="\\"&&f){g=!0,c++;continue}if(f){if(h===f)f=null;c++;continue}if(h==='"'||h==="'"||h==="`"){f=h,c++;continue}if(h==="(")m++;else if(h===")"){if(m--,m===0)break}c++}if(m!==0)break;let b=e.substring(y+1,c),x=o(b);e=e.substring(0,d)+x+e.substring(c+1)}return e}function pe(n,r){let o=n;return o=o.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,s)=>{if(s in r)return`:${s}="${s}"`;return e}),o=o.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,s,i)=>{try{let d=Object.keys(r),y=Object.values(r);Fo(i);let c=u(i,d)(...y),f=JSON.stringify(c);if(f===void 0){if(!tt(i).some((x)=>!(x in r)))return"";return e}let g=Buffer.from(f,"utf8").toString("base64");return`__stx_${s}="${g}"`}catch(d){return e}}),o}var Y="<!--__STX_BREAK__-->",G="<!--__STX_CONTINUE__-->";function se(n,r){let o=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",s=0;for(let i=o.exec(n);i;i=o.exec(n)){if(!i[1]){let c=i[0].length===3&&i[0]==="{{{"?3:2,f=i[0]==="{!!"?n.indexOf("!!}",o.lastIndex):he(n,i.index,c);if(f<0)break;o.lastIndex=f+(i[0]==="{!!"?3:c);continue}let d=o.lastIndex,y=!0,m=/^\s*\(/.exec(n.slice(d));if(m){let c=d+m[0].length-1,f=w(n,"(",")",c);if(f<0)break;d=f+1;try{let g=`!!(${n.slice(c+1,f).trim()})`;y=p(g)?Boolean(u(g,Object.keys(r))(...Object.values(r))):Boolean(l(g,r))}catch{y=!1}}if(e+=n.slice(s,i.index),y)return e+(i[1]==="break"?Y:G);s=d,o.lastIndex=d}return e+n.slice(s)}function oe(n){let r=(s)=>s.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),o="",e=0;return It(n,(s,i,d)=>(o+=ne(r(n.slice(e,d))),o+=`\${__stxRenderLoopValue(${d}, (${i}), ${s.length})}`,e=d+s.length,s)),o+ne(r(n.slice(e)))}function ie(n,r,o,e){return K(n,r,o==null?"":String(o),!1,e)}function ne(n){let r=n;return r=te(r,"@break",(o)=>{let e=o.trim();if(!ws(e))return"";return`\`; if (${e}) { break; } result += \``}),r=te(r,"@continue",(o)=>{let e=o.trim();if(!ws(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function de(n){let r=/@forelse\s*\(/g,o,e=[],s=/@foreach\s*\(/g,i=/@endforeach/g,d;while((d=s.exec(n))!==null)e.push({pos:d.index,delta:1});while((d=i.exec(n))!==null)e.push({pos:d.index,delta:-1});e.sort((f,g)=>f.pos-g.pos);let y=[],m=0;for(let f of e)m+=f.delta,y.push({pos:f.pos,depth:m});function c(f){let g=0,b=y.length-1,x=0;while(g<=b){let h=g+b>>1;if(y[h].pos<=f)x=y[h].depth,g=h+1;else b=h-1}return x}while((o=r.exec(n))!==null){if(c(o.index)>0)continue;let f=o.index,g=o.index+o[0].length-1,b=1,x=g+1,h=-1;while(x<n.length&&b>0){if(n[x]==="(")b++;else if(n[x]===")"){if(b--,b===0){h=x;break}}x++}if(h===-1)continue;let _=n.substring(g+1,h),S=Tt(_);if(!S)continue;let{arrayExpr:P,itemVar:F}=S,R=h+1,N=1,U=R,v=/@forelse\s*\(/g,V=/@endforelse/g,I=-1;while(N>0&&U<n.length){v.lastIndex=U,V.lastIndex=U;let A=v.exec(n),T=V.exec(n);if(!T)break;if(A&&A.index<T.index)N++,U=A.index+A[0].length;else{if(N--,N===0){I=T.index;break}U=T.index+11}}if(I===-1)continue;let j=n.substring(R,I),z=I+11,M=-1,W=0,O=0;while(O<j.length){let A=j.indexOf("@",O);if(A===-1)break;let T=j.substring(A);if(/^@forelse\s*\(/.test(T))W++,O=A+1;else if(T.startsWith("@endforelse"))W--,O=A+11;else if(W===0&&T.startsWith("@empty")){if(j.length<=A+6||!/[a-z]/i.test(j[A+6])){M=A;break}O=A+1}else O=A+1}if(M===-1)continue;return{start:f,end:z,arrayExpr:P,itemVar:F,foreachContent:j.substring(0,M),emptyContent:j.substring(M+6)}}return null}function re(n,r){let o=n;while(!0){let e=de(o);if(!e)break;let{start:s,end:i,arrayExpr:d,itemVar:y,foreachContent:m,emptyContent:c}=e;try{let f;if(p(d))f=u(d,Object.keys(r))(...Object.values(r));else f=l(d,r);let g;if(!Array.isArray(f)||f.length===0)g=c;else g=`@foreach (${d} as ${y})${m}@endforeach`;o=o.substring(0,s)+g+o.substring(i)}catch(f){let g=f instanceof Error?f.message:String(f),b=a("Forelse",`Error in @forelse(${d} as ${y}): ${g}`,t.EVALUATION_ERROR);o=o.substring(0,s)+b+o.substring(i)}}return o}var ce="<!--stx:foreach-not-iterable:",me=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function be(n,r){return`${ce}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function xe(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} 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 Nr(n){if(!n.includes(ce))return n;return n.replace(me,(r,o,e)=>(xe(decodeURIComponent(o),decodeURIComponent(e)),""))}function qn(n,r,o,e,s=!1){let i=n;i=re(i,r);function d(c){let f=/@foreach\s*\(/g,g;while((g=f.exec(c))!==null){let b=g.index,x=g.index+g[0].length-1,h=1,_=x+1,S=-1;while(_<c.length&&h>0){if(c[_]==="(")h++;else if(c[_]===")"){if(h--,h===0){S=_;break}}_++}if(S===-1)continue;let P=c.substring(x+1,S),F=Tt(P);if(!F)continue;let R=b,{arrayExpr:N,itemVar:U}=F,v=S+1,V=1,I=v,j=/@foreach\s*\(/g,z=/@endforeach/g;while(V>0&&I<c.length){j.lastIndex=I,z.lastIndex=I;let M=j.exec(c),W=z.exec(c);if(!W)break;if(M&&M.index<W.index)V++,I=M.index+M[0].length;else{if(V--,V===0){let O=c.substring(v,W.index),A=W.index+11;return{start:R,end:A,arrayExpr:N,itemVar:U,content:O}}I=W.index+11}}}return null}function y(c,f){let g=c;while(!0){let b=d(g);if(!b)break;let{start:x,end:h,arrayExpr:_,itemVar:S,content:P}=b;try{let F=_.trim(),R;if(p(F))R=u(F,Object.keys(f))(...Object.values(f));else R=l(F,f);let N=!1;if(!Array.isArray(R))if(R instanceof Map)R=Array.from(R),N=!0;else if(R instanceof Set)R=Array.from(R);else if(typeof R==="string")R=Array.from(R);else if(R&&typeof R==="object"&&!(R instanceof Date)&&!(R instanceof RegExp))R=Object.entries(R),N=!0;else{let O=be(F,o)+a("Foreach",`Error in @foreach: ${F} is not iterable`,t.TYPE_ERROR);g=g.substring(0,x)+O+g.substring(h);continue}let U=e?.loops?.useAltLoopVariable??ue,v=S.trim(),V=null,I,j=!1;if(v.includes("=>")){let O=v.split("=>").map((A)=>A.trim());if(O.length===2&&O[0]&&O[1])V=O[0],I=O[1];else I=v}else if(!v.startsWith("[")&&!v.startsWith("{")&&v.includes(",")){let O=v.split(",").map((A)=>A.trim());if(O.length===2&&O[0]&&O[1])I=O[0],V=O[1],j=!0;else I=v}else I=v;let z="",M=R,W=f[vs]??new WeakMap;for(let O=0;O<M.length;O++){let A=M[O],T={index:O,iteration:O+1,first:O===0,last:O===M.length-1,count:M.length},L={...f,loop:T,$loop:T,[vs]:W};if(I.startsWith("[")&&I.endsWith("]")){let J=I.slice(1,-1).split(",").map((B)=>B.trim());if(Array.isArray(A))J.forEach((B,D)=>{if(B)L[B]=A[D]});else L[I]=A}else if(I.startsWith("{")&&I.endsWith("}")){let J=I.slice(1,-1).split(",").map((B)=>B.trim()).filter(Boolean);if(A!==null&&typeof A==="object")J.forEach((B)=>{let D=B.indexOf(":"),q=(D===-1?B:B.slice(0,D)).trim(),Q=D===-1?q:B.slice(D+1).trim();if(q&&Q)L[Q]=A[q]});else L[I]=A}else L[I]=A;if(V)if(!j&&N&&Array.isArray(A)&&A.length===2)L[V]=A[0],L[I]=A[1];else L[V]=O;let C=re(P,L);C=qn(C,L,o,e,!0),C=ee(C,L,o),C=se(C,L);let Z=C.indexOf(Y),H=C.indexOf(G),X=Z<0?H:H<0?Z:Math.min(Z,H);if(X>=0)C=C.slice(0,X);if(C=k(C,L,o),C=pe(C,L),C=ge(C,L),C=fe(C,L),z+=C,X>=0&&X===Z)break}g=g.substring(0,x)+z+g.substring(h)}catch(F){let R=a("Foreach",`Error in @foreach(${_.trim()} as ${S.trim()}): ${F instanceof Error?F.message:String(F)}`,t.EVALUATION_ERROR);g=g.substring(0,x)+R+g.substring(h)}}return g}i=y(i,r),i=ye(i,r,o,e);let m=e?.loops?.maxWhileIterations??ae;return i=Re(i,r,m),s?i:Nr(i)}function xl(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function le(n){return ws(n)}function ye(n,r,o,e){let s=n,i=!0;while(i){i=!1;let d=s.match(/@for\s*\(/);if(!d||d.index===void 0)break;let y=d.index,m=y+d[0].length-1,c=w(s,"(",")",m);if(c===-1)break;let f=xl(s.slice(m+1,c)),g=c+1,b=Ur(s.slice(y),"for","endfor");if(b.length===0)break;let x=b[0].content,h=y+b[0].end;if(!le(f)){let _=a("For",`Unsafe expression in @for: ${f}`,t.UNSAFE_EXPRESSION);s=s.substring(0,y)+_+s.substring(h),i=!0;continue}try{let _=Ee(f),S=/@(?:for|foreach|if|unless)\s*\(/.test(x);if(_.length>0&&S){let v=$e({forExpr:f,content:x,iterVarNames:_,context:r,filePath:o,options:e});s=s.substring(0,y)+v+s.substring(h),i=!0;continue}let P=Object.keys(r),F=Object.values(r),R=oe(x),U=Function(...P,"__stxRenderLoopValue",`
|
|
3
3
|
let result = '';
|
|
4
4
|
for (${f}) {
|
|
5
5
|
result += \`${R}\`;
|
|
6
6
|
}
|
|
7
7
|
return result;
|
|
8
|
-
`)(...F,(v,V,I)=>ie(x,v,V,I));s=s.substring(0,y)+U+s.substring(h),i=!0}catch(_){let S=a("For",`Error in @for(${f}): ${_ instanceof Error?_.message:String(_)}`,t.EVALUATION_ERROR);s=s.substring(0,y)+S+s.substring(h),i=!0}}return s}function Ee(n){let r=n.trim(),o=r.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(o){let i=o[1];return i.slice(1,-1).split(",").map((y)=>{let m=y.trim();if(!m)return"";let c=m.indexOf(":");if(c>=0&&i.startsWith("{")){let b=m.slice(c+1).trim(),x=b.indexOf("=");return(x>=0?b.slice(0,x):b).trim()}let f=m.indexOf("="),g=(f>=0?m.slice(0,f):m).trim();return/^[A-Za-z_$][\w$]*$/.test(g)?g:""}).filter(Boolean)}let e=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(e)return[e[1]];let s=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(s)return[s[1]];return[]}function $e(n){let{forExpr:r,content:o,iterVarNames:e,context:s,filePath:i,options:
|
|
8
|
+
`)(...F,(v,V,I)=>ie(x,v,V,I));s=s.substring(0,y)+U+s.substring(h),i=!0}catch(_){let S=a("For",`Error in @for(${f}): ${_ instanceof Error?_.message:String(_)}`,t.EVALUATION_ERROR);s=s.substring(0,y)+S+s.substring(h),i=!0}}return s}function Ee(n){let r=n.trim(),o=r.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(o){let i=o[1];return i.slice(1,-1).split(",").map((y)=>{let m=y.trim();if(!m)return"";let c=m.indexOf(":");if(c>=0&&i.startsWith("{")){let b=m.slice(c+1).trim(),x=b.indexOf("=");return(x>=0?b.slice(0,x):b).trim()}let f=m.indexOf("="),g=(f>=0?m.slice(0,f):m).trim();return/^[A-Za-z_$][\w$]*$/.test(g)?g:""}).filter(Boolean)}let e=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(e)return[e[1]];let s=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(s)return[s[1]];return[]}function $e(n){let{forExpr:r,content:o,iterVarNames:e,context:s,filePath:i,options:d}=n,y=Object.keys(s),m=Object.values(s),c=i??"inline.stx",f="";return Function(...y,"__renderIteration",`
|
|
9
9
|
for (${r}) {
|
|
10
10
|
if (!__renderIteration([${e.join(", ")}])) break;
|
|
11
11
|
}
|
|
12
|
-
`)(...m,(b)=>{let x={...s};e.forEach((F,R)=>{x[F]=b[R]});let h=qn(o,x,c,
|
|
12
|
+
`)(...m,(b)=>{let x={...s};e.forEach((F,R)=>{x[F]=b[R]});let h=qn(o,x,c,d,!0);h=ee(h,x,c),h=se(h,x);let _=h.indexOf(Y),S=h.indexOf(G),P=_<0?S:S<0?_:Math.min(_,S);if(P>=0)h=h.slice(0,P);return f+=k(h,x,c),P<0||P!==_}),f}function Re(n,r,o){let e=n,s=!0;while(s){s=!1;let i=e.match(/@while\s*\(/);if(!i||i.index===void 0)break;let d=i.index,y=d+i[0].length-1,m=w(e,"(",")",y);if(m===-1)break;let c=e.slice(y+1,m),f=Ur(e.slice(d),"while","endwhile");if(f.length===0)break;let g=f[0].content,b=d+f[0].end;if(!le(c)){let x=a("While",`Unsafe expression in @while: ${c}`,t.UNSAFE_EXPRESSION);e=e.substring(0,d)+x+e.substring(b),s=!0;continue}try{let x=Object.keys(r),h=Object.values(r),_=oe(g),P=Function(...x,"__stxRenderLoopValue",`
|
|
13
13
|
let result = '';
|
|
14
14
|
let maxIterations = ${o}; // Configurable safety limit
|
|
15
15
|
let counter = 0;
|
|
@@ -21,5 +21,5 @@ import{Fo,vs,l,d,E,et,u,ws,t,a,w}from"./chunk-hb08vrbb.js";import{he,Et,It,K,k}f
|
|
|
21
21
|
result += '<!-- [While Error [1104]]: Maximum iterations (${o}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
22
22
|
}
|
|
23
23
|
return result;
|
|
24
|
-
`)(...h,(F,R,N)=>ie(g,F,R,N));e=e.substring(0,
|
|
24
|
+
`)(...h,(F,R,N)=>ie(g,F,R,N));e=e.substring(0,d)+P+e.substring(b),s=!0}catch(x){let h=a("While",`Error in @while(${c}): ${x instanceof Error?x.message:String(x)}`,t.EVALUATION_ERROR);e=e.substring(0,d)+h+e.substring(b),s=!0}}return e}
|
|
25
25
|
export{Nr,qn,xl};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{y,b,Ro,an}from"./chunk-
|
|
2
|
+
import{y,b,Ro,an}from"./chunk-vdjj4vrp.js";import{uo}from"./chunk-6z2sdfac.js";import{c}from"./chunk-zhf01af3.js";import M from"fs";import d from"path";import{hasLocalConfig as le}from"bunfig";var mt={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function Ue(n){return`--stx-${n}`}function F(n,t){let s=t.lastIndexOf("-");if(s===-1)return typeof n[t]==="string"?n[t]:void 0;let r=n[t.slice(0,s)];if(!r||typeof r!=="object")return;let i=r[t.slice(s+1)];return typeof i==="string"?i:void 0}var xe=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function X(n,t){let s=t.trim();return F(n,s)??(xe.test(s)?s:void 0)}function Z(n={}){return[...Object.keys(n.roles??{}).filter((t)=>!mt[t]).map((t)=>`roles.${t}`),...Object.keys(n.shapes??{}).filter((t)=>!fe[t]).map((t)=>`shapes.${t}`),...Object.keys(n.density??{}).filter((t)=>!$e[t]).map((t)=>`density.${t}`)]}function q(n){let t={};for(let[s,r]of Object.entries(mt)){let i=F(n,r.light);if(i===void 0)continue;t[s]=`var(${Ue(s)}, ${i})`}return t}function ee(n,t={}){let s=[],r=[];for(let[i,o]of Object.entries(mt)){let l=t[i],g=typeof l==="string"?l:l?.light,a=typeof l==="string"?l:l?.dark,u=g&&X(n,g)||F(n,o.light),x=a&&X(n,a)||F(n,o.dark);if(u===void 0)continue;if(s.push(` ${Ue(i)}: ${u};`),x!==void 0)r.push(` ${Ue(i)}: ${x};`)}if(s.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...s,"}",".dark {",...r,"}",""].join(`
|
|
3
3
|
`)}var fe={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function Qt(n){return`--stx-radius-${n}`}function te(){let n={};for(let[t,s]of Object.entries(fe))n[t]=`var(${Qt(t)}, ${s.value})`;return n}function ne(n={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(fe).map(([t,s])=>` ${Qt(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
4
|
-
`)}var
|
|
4
|
+
`)}var $e={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},Vn={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},Un={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function We(n){return`--stx-${n}`}function V(n){let t=$e[n];if(!t)throw Error(`[stx] unknown density token "${n}"`);return`var(${We(n)}, ${t.value})`}function se(){let n={};for(let[t,s]of Object.entries(Vn))n[t]=V(s);return n}function re(){let n={};for(let[t,{size:s,leading:r}]of Object.entries(Un))n[t]=[V(s),{lineHeight:V(r)}];return n}function ie(n={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries($e).map(([t,s])=>` ${We(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
5
5
|
`)}function oe(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}function U(n,t){let s={...n};for(let[r,i]of Object.entries(t))s[r]=oe(i)&&oe(s[r])?U(s[r],i):i;return s}function ce(n,t){if(!t.fonts)return"";let s=new n({...t.config,fonts:t.fonts,cssVariables:!1}).toCSS(!1,t.minify);return s&&!t.minify?`${s}
|
|
6
|
-
`:s}function ae(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...o}=r,{extend:l,...g}=s,a=g.colors||{};g.colors={...a,...q(a)};let u=g.borderRadius||{};g.borderRadius={...u,...te()};let x=g.spacing||{};g.spacing={...x,...se()};let H=g.fontSize||{};g.fontSize={...H,...re()};let R=U(g,o),k=U(l||{},i||{});if(Object.keys(k).length>0)R.extend=k;let E=[...n.safelist||[],...t.safelist||[]],_={...n.shortcuts||{},...t.shortcuts||{}},P=[...n.preflights||[],...t.preflights||[]],{fonts:K,...D}=n,{fonts:O,roles:T,shapes:N,density:C,...w}=t,f={roles:T,shapes:N,density:C},j=O??K;return{config:{...D,...w,theme:R,safelist:E,shortcuts:_,...P.length>0?{preflights:P}:{},content:[],output:""},safelist:E,shortcuts:_,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:ee({...a,...R.colors},T)+ne(N)+ie(C),unknownRoles:Z(f),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var p=null,A="";function de(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;A=`${t}@${Math.trunc(M.statSync(t).mtimeMs)}`}catch{A=n}}var Q=!1,v=null,I="",B=!1,he=256,S=new Map,m=new Map,z=null,me=null,G=new Map,ge=new Set;function L(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function W(n,t){if(S.has(n))S.delete(n);else if(S.size>=he)S.delete(S.keys().next().value);S.set(n,t)}function ke(n){let t=L(n);if(m.has(t))m.delete(t);else if(m.size>=he)m.delete(m.keys().next().value);return m.set(t,n),t}function op(n){let t=m.get(n);if(t===void 0)return;return m.delete(n),m.set(n,t),t}async function Ce(n,t=z){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${L(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function Se(n,t,s=z){if(!s)return;try{if(!M.existsSync(s))M.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${L(n)}.css`),t)}catch{}}async function ue(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var we=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],be=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function ve(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of we)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Re(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function na(){if(Q)return p;Q=!0;try{let n=async(i)=>{for(let o of i){if(!await Bun.file(o).exists())continue;let l=await ue(o);if(l){if(de(o),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(o))}`);return l}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),o=await n([i]);if(!o)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return p=o,p}let t=await n(ve());if(t)return p=t,p;let s=be;for(let i of s){let o=await ue(i);if(o){p=o;try{de(import.meta.resolve(i))}catch{A=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return p}}let r=await n(Re());if(r)return p=r,p;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function ip(){Y.clear(),p=null,Q=!1,v=null,I="",S.clear(),m.clear(),me=null,G.clear()}var pe=!1;async function ra(n){try{let t=le({name:"css",cwd:n})?"css":le({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!pe)pe=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function yl(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-
|
|
7
|
-
`)}async function
|
|
6
|
+
`:s}function ae(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...o}=r,{extend:l,...g}=s,a=g.colors||{};g.colors={...a,...q(a)};let u=g.borderRadius||{};g.borderRadius={...u,...te()};let x=g.spacing||{};g.spacing={...x,...se()};let H=g.fontSize||{};g.fontSize={...H,...re()};let R=U(g,o),k=U(l||{},i||{});if(Object.keys(k).length>0)R.extend=k;let E=[...n.safelist||[],...t.safelist||[]],_={...n.shortcuts||{},...t.shortcuts||{}},P=[...n.preflights||[],...t.preflights||[]],{fonts:K,...D}=n,{fonts:O,roles:T,shapes:N,density:C,...w}=t,f={roles:T,shapes:N,density:C},j=O??K;return{config:{...D,...w,theme:R,safelist:E,shortcuts:_,...P.length>0?{preflights:P}:{},content:[],output:""},safelist:E,shortcuts:_,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:ee({...a,...R.colors},T)+ne(N)+ie(C),unknownRoles:Z(f),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var p=null,A="";function de(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;A=`${t}@${Math.trunc(M.statSync(t).mtimeMs)}`}catch{A=n}}var Q=!1,v=null,I="",B=!1,he=256,S=new Map,m=new Map,z=null,me=null,G=new Map,ge=new Set;function L(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function W(n,t){if(S.has(n))S.delete(n);else if(S.size>=he)S.delete(S.keys().next().value);S.set(n,t)}function ke(n){let t=L(n);if(m.has(t))m.delete(t);else if(m.size>=he)m.delete(m.keys().next().value);return m.set(t,n),t}function op(n){let t=m.get(n);if(t===void 0)return;return m.delete(n),m.set(n,t),t}async function Ce(n,t=z){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${L(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function Se(n,t,s=z){if(!s)return;try{if(!M.existsSync(s))M.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${L(n)}.css`),t)}catch{}}async function ue(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var we=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],be=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function ve(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of we)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Re(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function na(){if(Q)return p;Q=!0;try{let n=async(i)=>{for(let o of i){if(!await Bun.file(o).exists())continue;let l=await ue(o);if(l){if(de(o),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(o))}`);return l}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),o=await n([i]);if(!o)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return p=o,p}let t=await n(ve());if(t)return p=t,p;let s=be;for(let i of s){let o=await ue(i);if(o){p=o;try{de(import.meta.resolve(i))}catch{A=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return p}}let r=await n(Re());if(r)return p=r,p;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function ip(){Y.clear(),p=null,Q=!1,v=null,I="",S.clear(),m.clear(),me=null,G.clear()}var pe=!1;async function ra(n){try{let t=le({name:"css",cwd:n})?"css":le({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!pe)pe=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function yl(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-heh151bn.js"),r=await s(n);if(r.css)if(typeof r.css==="string"){let i=d.isAbsolute(r.css)?r.css:d.resolve(n,r.css);if(await Bun.file(i).exists()){let o=await import(i);t=o.default||o,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${r.css}`)}}else{if(t={...r.css,content:r.css.content||[],preflight:r.css.preflight??!0,minify:r.css.minify??!1},r.css.config){let i=d.isAbsolute(r.css.config)?r.css.config:d.resolve(n,r.css.config);if(await Bun.file(i).exists()){let o=await import(i);t={...o.default||o,...t}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return t||await ra(n)}function bl(n){try{let t=new WeakSet;return L(JSON.stringify(n??{},(s,r)=>{if(typeof r==="function")return`[fn]${String(r)}`;if(typeof r==="object"&&r!==null){if(t.has(r))return"[circular]";t.add(r)}return r})??"")}catch{return"unhashable"}}async function en(n){if(B)return I;B=!0;try{let t=await na();if(!t||!t.build)return B=!1,"";if(!v)v=await ra(n);if(!v)return B=!1,"";let s=t.defaultConfig?.theme||{},r=v.theme||{},i={...t.defaultConfig,...v,theme:{...s,...r,extend:{...s.extend||{},...r.extend||{}}}},o=performance.now(),l=await t.build(i),g=performance.now()-o;if(I=l.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${l.classes.size} classes in ${g.toFixed(1)}ms`),i.output){let a=d.isAbsolute(i.output)?i.output:d.join(n,i.output),u=d.dirname(a);if(!M.existsSync(u))M.mkdirSync(u,{recursive:!0});await Bun.write(a,l.css)}return B=!1,l.css}catch(t){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,t),B=!1,I}}async function Wn(n){v=null,await en(n)}function ap(){return I}function vl(n){let t=new Set,s=/class\s*=\s*["']([^"']+)["']/gi,r=s.exec(n);while(r!==null){for(let l of r[1].split(/\s+/))if(l.trim())t.add(l.trim());r=s.exec(n)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,o=i.exec(n);while(o!==null){let l=o[1].match(/'([^']+)'/g);if(l){for(let g of l)for(let a of g.slice(1,-1).split(/\s+/))if(a.trim())t.add(a.trim())}o=i.exec(n)}return t}var Y=y(64);async function wl(n,t){let s=()=>G.get(t?d.resolve(t):process.cwd())?.fingerprint??null,r=Y.get(b(n,t,s()));if(r!==void 0)return r;let i=await Te(n,t);if(i)Y.set(b(n,t,s()),i);return i}function*ye(n){yield n;let t=new Set;for(let s of n.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let r=s[1];if(t.has(r))continue;t.add(r);let i=uo(r);if(i)yield i}}function cp(n){return[...ye(n)].join(`
|
|
7
|
+
`)}async function Te(n,t){try{let s=await na();if(!s)return"";let r=new Set;for(let f of ye(n)){let j=typeof s.extractClasses==="function"?s.extractClasses(f):vl(f);for(let J of j)r.add(J)}if(r.size===0)return"";let i=t?d.resolve(t):process.cwd(),o=c(i,"cache");if(!z)z=o;let l=G.get(i);if(!l){let f=await yl(i);l={config:f,fingerprint:bl(f)},G.set(i,l),me=l.fingerprint}let g=[...r].sort().join(" "),a=`${A}::${l.fingerprint||"default"}::${g}`,u=S.get(a);if(u!==void 0)return W(a,u),u;let x=await Ce(a,o);if(x!==null)return W(a,x),x;let H=s.defaultConfig||s.config,R=l.config||{},k=ae(H,R),{safelist:E,includePreflight:_,minify:P,tokenCSS:K}=k;if(k.unknownRoles.length>0&&!ge.has(i))ge.add(i),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${k.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let D=k.config,O=new s.CSSGenerator(D),T=D.shortcuts||R.shortcuts||{},N=Object.keys(T).filter((f)=>r.has(f)||E.includes(f));for(let f of E)if(!T[f])O.generate(f);for(let f of r)if(!T[f])O.generate(f);let C="";if(N.length>0){let f=new s.CSSGenerator(D);for(let j of N)f.generate(j);if(C=f.toCSS(!1,P),C&&!C.endsWith(`
|
|
8
8
|
`))C+=`
|
|
9
9
|
`}let w=C+O.toCSS(_,P);return w=ce(s.CSSGenerator,k)+K+w,W(a,w),Se(a,w,o),w}catch(s){return console.warn("Failed to generate Css CSS:",s),""}}async function h(n,t,s=!1,r=!1){let i=await wl(n,t);if(!i)return r?an(n):n;let o=s?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${ke(i)}.css">`:`<style data-css="generated">
|
|
10
10
|
${i}
|
|
@@ -15,4 +15,4 @@ ${o}`);return o+n}function je(n,t){let s=Ro(n).map((a)=>({...a,replacement:""}))
|
|
|
15
15
|
${t}`});else s.push({start:0,end:0,replacement:t})}}s.sort((a,u)=>a.start-u.start||a.end-u.end);for(let a=1;a<s.length;a++)if(s[a].start<s[a-1].end)return Be(an(n),t);let o=Array(s.length*2+1),l=0,g=0;for(let a of s)o[g++]=n.slice(l,a.start),o[g++]=a.replacement,l=a.end;return o[g]=n.slice(l),o.join("")}function Be(n,t){let s=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(s.test(n)){let r=!1;return n.replace(s,()=>{if(r)return"";return r=!0,t})}if(n.includes("</head>"))return n.replace("</head>",`${t}
|
|
16
16
|
</head>`);if(n.includes("<body"))return n.replace(/<body([^>]*)>/,`<body$1>
|
|
17
17
|
${t}`);return t+n}
|
|
18
|
-
export{
|
|
18
|
+
export{mt,Ue,fe,Qt,$e,Vn,Un,We,e,op,na,ip,ra,yl,bl,en,Wn,ap,vl,wl,cp,h};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Wo,Dp,Mp,oc,
|
|
2
|
+
import{Wo,Dp,Mp,oc,Fe,cu,ks,Lp,jp,Bp,Fp,zp,Hp,Vp,Up,Wp}from"./chunk-2dp7hyv7.js";export{Hp as applyHead,Lp as definePageMeta,Wo as getHead,Dp as getPageMeta,Fe as mergeHeadConfigs,Vp as processHeadDirective,Wp as processMetaDirective,Up as processTitleDirective,zp as renderBodyAttrs,Bp as renderHead,Fp as renderHtmlAttrs,Mp as resetHead,ks as seoMetaToHeadConfig,oc as useHead,jp as usePageTitle,cu as useSeoMeta,jp as useTitle};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{X,J,Y,Cn,pe,_e,Rr,Fc,dt,Ut,En,Tn,$n,Z,Rn,An,Ar}from"./chunk-b823zxq6.js";import"./chunk-yfvm7q6t.js";export{J as DEFAULT_FORMATS,Y as DEFAULT_QUALITY,X as DEFAULT_WIDTHS,Ar as ImageProcessingError,An as formatSize,Ut as generateSizes,dt as generateSrcSet,En as getFallbackVariant,Rr as getImageMetadata,Z as getMimeType,Rn as getTotalSize,Tn as groupVariantsByFormat,pe as isImageBackendAvailable,$n as isImageFile,Cn as isSharpAvailable,_e as processImage,Fc as resizeAndConvert};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{it,at,ct}from"./chunk-tp4eqfxq.js";import"./chunk-pxdww4rb.js";import"./chunk-ce6zddpf.js";import{g}from"./chunk-vdjj4vrp.js";import"./chunk-2dp7hyv7.js";import"./chunk-1sr6c0nk.js";import"./chunk-kpeep7gq.js";import{Bt,$s,Ft,ai,ot,ci,Rs,zt,ui,Ht}from"./chunk-pn1ehs6a.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{ci("Config file changed, restarting...");try{await e.onChange()}catch(p){ot(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var st=".stx/story/analytics.json",dt=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,st),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:dt,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:pt(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),u=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:u}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function pt(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var lt=".stx/story/bookmarks.json",mt=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,lt),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:mt,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:ut(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function ut(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
const ws = new WebSocket('${t}');
|
|
@@ -556,9 +556,9 @@ window.__stxPerformance = {
|
|
|
556
556
|
|
|
557
557
|
window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
|
|
558
558
|
</script>
|
|
559
|
-
`}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-
|
|
559
|
+
`}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-r7cenpxp.js"),p={},u=h(n);if(u)try{await g(u,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),m=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:m,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await g(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-r7cenpxp.js"),c={...r},n=h(e);if(n)try{await g(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
|
|
560
560
|
`)}function Q(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function h(t){let e=[],r=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
|
|
561
|
-
`)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}async function rt(t,e){let r=await zt(t);
|
|
561
|
+
`)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}async function rt(t,e){let r=await zt(t);at(t,r);let s=Ht(t.config,r);ct(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let f=new URL(i.url).pathname;if(f==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(f.startsWith("/api/"))return xt(t,f,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return wt(t,f,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),u=`http://${o}:${e.port}`,y=ui(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let m=await zt(t);at(t,m);let f=Ht(t.config,m);if(ct(t,f),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=u;try{let{exec:l}=await import("child_process"),m=process.platform;l(`${m==="darwin"?"open":m==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:u,close:async()=>{y(),p.stop()}}}async function xt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],u=d[1]||"default",y,i=n.searchParams.get("props");if(i)try{y=JSON.parse(i)}catch{}let l=t.storyFiles.find((m)=>m.id===p);if(!l)return new Response("Story not found",{status:404});try{let m=await Y(t,l,u,y);return Response.json({html:m.html,css:m.css,js:m.js,errors:m.errors,duration:m.duration})}catch(m){return Response.json({html:"",css:"",js:"",errors:[m instanceof Error?m.message:String(m)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((u)=>u.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function wt(t,e,r){let s=kt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function kt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
|
|
562
562
|
<html lang="en" class="${r.darkClass||"dark"}">
|
|
563
563
|
<head>
|
|
564
564
|
<meta charset="UTF-8">
|
|
@@ -1276,5 +1276,5 @@ else {
|
|
|
1276
1276
|
<style>${W()}</style>
|
|
1277
1277
|
${D()}
|
|
1278
1278
|
</body>
|
|
1279
|
-
</html>`}import St from"fs";import Pt from"path";var Ct=new Map,Tt=[],Rt=[],It=new Map;async function nt(t){let e=t.config.setupFile;if(!e)return;let r=Pt.resolve(t.root,e);try{await St.promises.access(r)}catch{return}let s={storyContext:t,registerComponent:(o,a)=>{Ct.set(o,a)},addCSS:(o)=>{Tt.push(o)},addScript:(o)=>{Rt.push(o)},setState:(o,a)=>{It.set(o,a)}};try{let o=await import(r);if(typeof o.default==="function")await o.default(s);else if(typeof o.setupStory==="function")await o.setupStory(s)}catch(o){console.warn(`Warning: Failed to load setup file: ${o}`)}}async function we(t={}){Bt();let e=await
|
|
1279
|
+
</html>`}import St from"fs";import Pt from"path";var Ct=new Map,Tt=[],Rt=[],It=new Map;async function nt(t){let e=t.config.setupFile;if(!e)return;let r=Pt.resolve(t.root,e);try{await St.promises.access(r)}catch{return}let s={storyContext:t,registerComponent:(o,a)=>{Ct.set(o,a)},addCSS:(o)=>{Tt.push(o)},addScript:(o)=>{Rt.push(o)},setState:(o,a)=>{It.set(o,a)}};try{let o=await import(r);if(typeof o.default==="function")await o.default(s);else if(typeof o.setupStory==="function")await o.setupStory(s)}catch(o){console.warn(`Warning: Failed to load setup file: ${o}`)}}async function we(t={}){Bt();let e=await it({mode:"dev"});if(!e.config.enabled){ot("Story feature is disabled in config.");return}await nt(e);let r=t.port??e.config.port,s,o=async()=>{s=await rt(e,{port:r,open:t.open,host:t.host}),Ft(e.storyFiles.length),$s(s.url),Rs()};await o();let a=E(e,{onChange:async()=>{await s.close();let n=await it({mode:"dev"});Object.assign(e,n),await o()}}),c=async()=>{console.log(`
|
|
1280
1280
|
`),a.stop(),await s.close(),process.exit(0)};if(process.on("SIGINT",c),process.on("SIGTERM",c),process.stdin.isTTY)process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on("data",async(n)=>{switch(n.toString()){case"h":Rs();break;case"o":try{let{exec:p}=await import("child_process"),u=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";p(`${u} ${s.url}`)}catch{ai("Failed to open browser")}break;case"r":await s.close(),await o();break;case"c":console.clear(),Bt(),Ft(e.storyFiles.length),$s(s.url);break;case"q":case"\x03":await c();break}});await new Promise(()=>{})}export{we as devCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ze,wn,Jo}from"./chunk-30nes8ne.js";function Es(e,a){let t=e.pwa;if(!t?.enabled)return"";let c=t.serviceWorker||{},d=t.routes||[],i=c.cacheVersion||"1.0.0",o=t.offline,l=o?.page?"/offline.html":"/offline.html",{push:r,backgroundSync:s,cacheStorage:n}=t,u=a?ze(a,e):null,h=u?wn(u):"[]",f=["/","/manifest.json",...o?.enabled?[l]:[],...o?.precacheAssets||[]];return`/**
|
|
3
3
|
* Service Worker - Auto-generated by stx
|
|
4
4
|
* Cache Version: ${i}
|
|
5
5
|
*
|
|
@@ -825,5 +825,5 @@ self.addEventListener('message', (event) => {
|
|
|
825
825
|
event.waitUntil(registerFormSync(event.data.payload));
|
|
826
826
|
}
|
|
827
827
|
});
|
|
828
|
-
`}function jt(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}function bc(e){return e.pwa?.enabled===!0&&e.pwa?.serviceWorker?.useWorkbox===!0}function gu(e,a){if(!e.pwa?.enabled)return"";if(bc(e)){let{generateWorkboxServiceWorker:t}=import.meta.require("./chunk-
|
|
828
|
+
`}function jt(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}function bc(e){return e.pwa?.enabled===!0&&e.pwa?.serviceWorker?.useWorkbox===!0}function gu(e,a){if(!e.pwa?.enabled)return"";if(bc(e)){let{generateWorkboxServiceWorker:t}=import.meta.require("./chunk-hvf2e7pr.js");return t(e,a)}return Es(e,a)}
|
|
829
829
|
export{Es,jt,bc,gu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{lp,Sl,qe,sa,up,Dr,Mr,Lr}from"./chunk-6by8f7n9.js";import"./chunk-hm9jt1p9.js";import"./chunk-ka8befem.js";import"./chunk-p472crv1.js";import"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{up as clearOnceStore,sa as onceStore,qe as partialsCache,Dr as processIncludes,Mr as processStackPushDirectives,Lr as processStackReplacements,lp as resetUnscopedSignalWarnings,Sl as topLevelElements};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Nr,qn,xl}from"./chunk-dtjybwtz.js";import"./chunk-ka8befem.js";import"./chunk-p472crv1.js";import{Tt}from"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{xl as declareBareLoopHead,Tt as parseLoopBinding,qn as processLoops,Nr as reportDeferredLoopWarnings};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Qn}from"./chunk-
|
|
2
|
+
import{Qn}from"./chunk-365vg0eg.js";import{dr}from"./chunk-2dp7hyv7.js";import{o}from"./chunk-9k2wz3k1.js";import{U,Ge}from"./chunk-bnn7pd62.js";import{la}from"./chunk-g8r0km7g.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function Gn(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 d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let u=p.exec(e);if(u){x.lastIndex=n+u[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let c=b.exec(e);if(c){if(t===0)s=n;t++,r=n+c[0].length;continue}S.lastIndex=n;let a=S.exec(e);if(a){if(t>0)t--;r=n+a[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function V(e,r={}){return new Qn(e,r).routes}import w from"path";var T=new Map;async function y(e,r){let t=e,s=r;if(!t||!s)try{let a=await o();t||=a?.pagesDir||"pages",s||=a?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),u=T.get(n);if(u)return u;let c=[];try{c=V(".",{pagesDir:n,emit:!1}).map((a)=>a.regex.source).filter(Boolean)}catch{c=[]}return T.set(n,c),c}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return O(JSON.stringify(e))}function ge(e){return e.includes("data-stx-runtime")}function aa(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 f(e,r){let t=Gn(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
|
|
3
3
|
`+e.slice(t);let n=dr(e);if(n!==null)return`${e.slice(0,n)}
|
|
4
4
|
${r}${e.slice(n)}`;if(e.includes("</head>")){let c=e.indexOf("</head>");return e.slice(0,c)+r+`
|
|
5
|
-
`+e.slice(c)}if(U(e))return
|
|
5
|
+
`+e.slice(c)}if(U(e))return Ge(e,(c)=>`${c}
|
|
6
6
|
${r}`);return`${r}
|
|
7
|
-
${e}`}async function Kn(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-
|
|
7
|
+
${e}`}async function Kn(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-c3dk9pkf.js"),{url:u}=await n("runtime",r.debug===!0);return f(e,`<script data-stx-runtime src="${u}"></script>`)}if(r.buildMode==="compile")return f(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-c3dk9pkf.js"),s=await t(r.debug);return f(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function ca(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${la()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
|
|
8
8
|
${r}`;return`${e.slice(0,t)}${r}
|
|
9
|
-
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function me(e,r){if(!e.includes("</body>"))return e;if(C(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.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-
|
|
9
|
+
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function me(e,r){if(!e.includes("</body>"))return e;if(C(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.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-c3dk9pkf.js");n=`<script data-stx-owned-routes src="${h(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(g)};
|
|
10
10
|
`)}"></script>
|
|
11
11
|
`}else i.ownedRoutes=g}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${l(i)};</script>
|
|
12
|
-
`}let{getCachedRouterScript:u,getServeClientAsset:c}=await import("./chunk-
|
|
12
|
+
`}let{getCachedRouterScript:u,getServeClientAsset:c}=await import("./chunk-c3dk9pkf.js"),a=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await c("router")).url}"></script>`:`<script data-stx-router>${await u()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+a+`
|
|
13
13
|
</body>`+e.slice(d+7)}
|
|
14
14
|
export{Gn,V,ge,aa,Kn,ca,me};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{i}from"./chunk-
|
|
2
|
+
import{i}from"./chunk-qjtpxsyx.js";function y(e,n,s=240){return e.slice(n,n+s)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,n)=>{let s=e.indexOf("(",n);if(s===-1)return!0;let o=e.slice(s+1,e.indexOf(")",s)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(e,n)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,n,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(e,n)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,n))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(e)=>/setTimeout\s*\(/.test(e)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,n){let s=1;for(let o=0;o<n;o++)if(e[o]===`
|
|
3
3
|
`)s++;return s}function b(e,n){let s=e.lastIndexOf(`
|
|
4
4
|
`,n)+1,o=e.indexOf(`
|
|
5
5
|
`,n);return e.slice(s,o===-1?e.length:o).trim().slice(0,120)}function S(e,n){let s=e.slice(0,n),o=s.lastIndexOf("function"),l=s.lastIndexOf("=>"),r=Math.max(o,l);if(r===-1)return!1;let t=e.slice(Math.max(0,r-120),r);return/\basync\b[^;{}]*$/.test(t)}function k(e){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(e)||/\b(?:const|let|var)\s+confirm\s*=/.test(e)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(e)}function A(e,n,s){if(k(e))return e;let o=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,l=m(e),r="",t=0,a;while((a=o.exec(l))!==null){let c=a.index+a[1].length,u=g(e,c),d=b(e,c);if(/stxConfirm\s*\($/.test(e.slice(0,c+8)))continue;let p=S(e,c);if(s.push({file:n,line:u,rule:"confirm",applied:p,snippet:d,reason:p?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),p)r+=e.slice(t,c)+"await stxConfirm(",t=c+(a[0].length-a[1].length)}return r+e.slice(t)}function E(e,n,s){let o=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,l=R(e),r="",t=0,a;while((a=o.exec(l))!==null){let[c,u,d,p]=a,h=g(e,a.index),f=b(e,a.index),w=u.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(w)){s.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:`\`title\` on <${w}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test(u)||p.trim()===""){s.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:/\bx-tooltip[=\s]/.test(u)?"already has x-tooltip":"empty title"});continue}s.push({file:n,line:h,rule:"tooltip",applied:!0,snippet:f}),r+=e.slice(t,a.index)+`${u} x-tooltip=${d}${p}${d} title=${d}${p}${d}`,t=a.index+c.length}return r+e.slice(t)}function R(e){return e.replace(/<!--[\s\S]*?-->/g,(n)=>n.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(n)=>n.replace(/[^\n]/g," "))}function F(e){let n=(s)=>s.replace(/[^\n]/g," ");return e.replace(/\/\*[\s\S]*?\*\//g,n).replace(/\/\/[^\n]*/g,n)}function m(e,n=!1){let s=R(e);return(n?F(s):i(s)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(l,r)=>/\bclient\b/i.test(r)?l:l.replace(/[^\n]/g," "))}function O(e,n,s,o){let l=m(e),r=m(e,!0);for(let t of v){if(!s.includes(t.rule))continue;if(t.requires&&!t.requires(e))continue;t.pattern.lastIndex=0;let a,c=/['"]/.test(t.pattern.source)?r:l;t.pattern.lastIndex=0;while((a=t.pattern.exec(c))!==null){if(t.reject?.(e,a.index))continue;o.push({file:n,line:g(e,a.index),rule:t.rule,applied:!1,snippet:b(e,a.index),reason:`${t.primitive} \u2014 ${t.why}`})}}}function q(e,n={}){let s=n.rules??C,o=n.file??"<source>",l=[];O(e,o,s,l);let r=e;if(s.includes("confirm"))r=A(r,o,l);if(s.includes("tooltip"))r=E(r,o,l);l.sort((c,u)=>c.line-u.line);let t=new Set,a=l.filter((c)=>{let u=`${c.rule}:${c.line}`;if(t.has(u))return!1;return t.add(u),!0});return{code:r,findings:a}}var x=new Set(["confirm","tooltip"]);function I(e,n){if(e.length===0)return"No hand-rolled equivalents found.";let s=e.filter((t)=>t.applied),o=e.filter((t)=>!t.applied&&x.has(t.rule)),l=e.filter((t)=>!t.applied&&!x.has(t.rule)),r=[];if(s.length>0){r.push(n?`Rewrote ${s.length} site(s):`:`Would rewrite ${s.length} site(s) (pass --fix):`);for(let t of s)r.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}`)}if(o.length>0){r.push("",`Needs a human \u2014 ${o.length} site(s):`);for(let t of o)r.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,a,Dt,Mt,Lt,
|
|
2
|
+
import{t,a,Dt,Mt,Lt,Be,nt,P,xs,mr,Fe}from"./chunk-2dp7hyv7.js";var O=/(?<![\w$@])@meta\s*\(/g,I=/(?<![\w$@])@metaTag\s*\(/g,C=/(?<![\w$@])@structuredData\s*\(/g,k=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>P(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function N(e){return"property"in e?`<meta property="${l(e.property)}" content="${l(e.content)}">`:`<meta name="${l(e.name)}" content="${l(e.content)}">`}function mo(e,r,n,g){if(!e.includes("@meta"))return e;let i=Dt(e,O,(s,c)=>{let o=mr(Mt(s),r);if(o.kind==="tag")return N(o.tag);if(o.kind==="empty")return"";return P("Meta",c,o.message,n,o.code)},_("Meta",n));return i=Dt(i,I,(s,c)=>{let o=Lt(s,r);if(!o.ok)return P("MetaTag",c,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!nt(o.value))return P("MetaTag",c,`expected an object such as { name, content }, got ${Be(o.value)}`,n,t.TYPE_ERROR);let u=o.value;if(!u.name&&!u.property&&!u.httpEquiv)return P("MetaTag",c,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${l(u.name)}"`;if(u.property)p+=` property="${l(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${l(u.httpEquiv)}"`;return p+=` content="${l(u.content)}">`,p},_("MetaTag",n)),i}function b(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(nt(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(nt))return e.map(r);return null}function E(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function ho(e,r,n){if(!e.includes("@structuredData"))return e;return Dt(e,C,(g,i)=>{let s=Lt(g,r);if(!s.ok)return P("StructuredData",i,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";let c=b(s.value);if(!c)return P("StructuredData",i,`expected an object or an array of objects, got ${Be(s.value)}`,n,t.TYPE_ERROR);try{return E(c)}catch(o){let u=o instanceof Error?o.message:String(o);return P("StructuredData",i,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var j=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),A={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function yo(e,r,n,g){if(!e.includes("@seo"))return e;return Dt(e,k,(i,s)=>{if(!i.trim())return P("SEO",s,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let c=Lt(i,r);if(!c.ok)return P("SEO",s,c.message,n,c.code);if(c.value===void 0||c.value===null)return"";if(!nt(c.value))return P("SEO",s,`expected an object such as { title, description }, got ${Be(c.value)}`,n,t.TYPE_ERROR);try{return L(c.value,s,n)}catch(o){let u=o instanceof Error?o.message:String(o);return P("SEO",s,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function R(e,r,n,g){let i=e[r];if(i===void 0||i===null||i===!1)return;if(nt(i))return i;xs(n,`${r} must be an object, got ${Be(i)}; its tags were left out`,g);return}function L(e,r,n){let g=Object.keys(e).filter((o)=>!j.has(o));if(g.length>0){let o=g.map((u)=>A[u]?`${u} (use ${A[u]})`:u).join(", ");xs(r,`@seo does not read ${o}; ${g.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${l(e.title)}</title>
|
|
3
3
|
`,i+=`<meta name="title" content="${l(e.title)}">
|
|
4
4
|
`;if(e.description)i+=`<meta name="description" content="${l(e.description)}">
|
|
5
5
|
`;if(e.keywords){let o=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;i+=`<meta name="keywords" content="${l(o)}">
|
|
@@ -25,7 +25,7 @@ import{t,a,Dt,Mt,Lt,je,tt,P,xs,mr,Be}from"./chunk-hb08vrbb.js";var O=/(?<![\w$@]
|
|
|
25
25
|
`}if(c.site)i+=`<meta name="twitter:site" content="${l(c.site)}">
|
|
26
26
|
`;if(c.creator)i+=`<meta name="twitter:creator" content="${l(c.creator)}">
|
|
27
27
|
`}if(e.structuredData!==void 0&&e.structuredData!==null){let o=b(e.structuredData);if(o)i+=`${E(o)}
|
|
28
|
-
`;else xs(r,`structuredData must be an object or an array of objects, got ${
|
|
28
|
+
`;else xs(r,`structuredData must be an object or an array of objects, got ${Be(e.structuredData)}; it was left out`,n)}return i.trim()}function bo(e,r,n){if(n.seo?.enabled===!1)return e;if(e.includes("<!-- stx SEO Tags -->")||r.__stx_seo_staged===!0||n.skipDefaultSeoTags===!0)return e;let g=r.__stx_runtime_head;if(!!(g?.title||g?.meta?.some((S)=>S.property==="og:title"||S.name==="og:title"||S.name==="twitter:title"||S.name==="description")))return e;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(e))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let s=e.includes("<title>")||e.includes("</title>"),c=q(e),o=M(c),u=G(c),p="";if(r.title)p=r.title;else if(r.meta&&r.meta.title)p=r.meta.title;else if(o)p=o;else if(n.seo?.defaultConfig?.title)p=n.seo.defaultConfig.title;else p=n.defaultTitle||"stx Project";let m="";if(r.description)m=r.description;else if(r.meta&&r.meta.description)m=r.meta.description;else if(u)m=u;else if(n.seo?.defaultConfig?.description)m=n.seo.defaultConfig.description;else m=n.defaultDescription||"A website built with stx templating engine";let d="";if(r.image)d=r.image;else if(r.meta&&r.meta.image)d=r.meta.image;else if(r.openGraph&&r.openGraph.image)d=r.openGraph.image;else if(n.seo?.defaultImage)d=n.seo.defaultImage;else if(n.defaultImage)d=n.defaultImage;let f=s?"":`
|
|
29
29
|
<meta name="title" content="${l(p)}">`,D=V(c)?"":`
|
|
30
30
|
<meta name="description" content="${l(m)}">`,y=`
|
|
31
31
|
<!-- stx SEO Tags -->${f}${D}
|
|
@@ -43,7 +43,7 @@ import{t,a,Dt,Mt,Lt,je,tt,P,xs,mr,Be}from"./chunk-hb08vrbb.js";var O=/(?<![\w$@]
|
|
|
43
43
|
${y}
|
|
44
44
|
`),h;return h.replace(/<head[^>]*>/,`$&
|
|
45
45
|
${y}
|
|
46
|
-
`)}function q(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function v(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function M(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?v(r[1].trim()):""}function x(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function V(e){return x(e).length>0}function G(e){for(let r of x(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return v(g)}return""}function l(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Xr={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let i=mr(r,n??{});if(i.kind==="error")return P("Meta",`@meta(${r.join(", ")})`,i.message,g,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=
|
|
46
|
+
`)}function q(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function v(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function M(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?v(r[1].trim()):""}function x(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function V(e){return x(e).length>0}function G(e){for(let r of x(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return v(g)}return""}function l(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Xr={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let i=mr(r,n??{});if(i.kind==="error")return P("Meta",`@meta(${r.join(", ")})`,i.message,g,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=Fe(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},Jr={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return a("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return a("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return E(i)}catch(i){let s=i instanceof Error?i.message:String(i);return a("StructuredData",s,t.EVALUATION_ERROR)}},hasEndTag:!0};function kp(){return[Xr,Jr]}function _p(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:i=0.5,includeLastmod:s=!0}=r,c=n.replace(/\/$/,""),o=(m)=>m.startsWith("http")?m:`${c}${m.startsWith("/")?"":"/"}${m}`,u=e.map((m)=>{let d=o(m.loc),f=m.lastmod||(s?new Date().toISOString().split("T")[0]:void 0),D=m.changefreq||g,y=m.priority??i,h=` <url>
|
|
47
47
|
<loc>${T(d)}</loc>`;for(let w of m.alternates??[])h+=`
|
|
48
48
|
<xhtml:link rel="alternate" hreflang="${T(w.hreflang)}" href="${T(o(w.href))}"/>`;if(f)h+=`
|
|
49
49
|
<lastmod>${f}</lastmod>`;return h+=`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Pc,ki,Iu,Ic,Oc,Ou,Nu}from"./chunk-3641xvaw.js";import"./chunk-65b6cy92.js";import"./chunk-zcz97ber.js";import"./chunk-sme31jbj.js";import"./chunk-md2jn67b.js";import"./chunk-060298px.js";import"./chunk-fpz59dhz.js";import"./chunk-p472crv1.js";import"./chunk-9k2wz3k1.js";import"./chunk-9edksf8x.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import{$t,Fl}from"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{Pc as buildVirtualSource,$t as extractScriptBlocks,Fl as extractTemplateExpressions,Ic as findRuntimeTypeDeclarations,Oc as findStxModuleDeclarations,Nu as formatTypecheckDiagnostics,Iu as sourcePathFor,Ou as typecheckStxFiles,ki as virtualPathFor};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{N,Rl,po,o,R,xp,Sp}from"./chunk-9k2wz3k1.js";import"./chunk-9edksf8x.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{R as config,N as defaultConfig,xp as defineStxConfig,po as discoverConfig,o as loadStxConfig,Rl as resolveStxDirectories,Sp as validateConfig};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Bd,Fd}from"./chunk-t01c62y5.js";import"./chunk-zcz97ber.js";import"./chunk-sme31jbj.js";import"./chunk-md2jn67b.js";import"./chunk-060298px.js";import"./chunk-fpz59dhz.js";import"./chunk-p472crv1.js";import"./chunk-9k2wz3k1.js";import"./chunk-9edksf8x.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{Fd as clearStoreCache,Bd as getStoreScript};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Mi,tl,Pn,td,nl,rl,sl,nd}from"./chunk-k5mez1vx.js";import"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{Pn as Validator,tl as defineForm,nl as processErrorDirective,rl as processErrorsDirective,nd as processFormValidationDirectives,sl as processHasErrorsDirective,Mi as useForm,td as v};
|