@stacksjs/stx 0.2.573 → 0.2.574
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-a6jq7hex.js → chunk-06hx32h4.js} +3 -3
- package/dist/{chunk-zz7tw07b.js → chunk-0gt7e1ns.js} +1 -1
- package/dist/{chunk-15g5sc0p.js → chunk-0ppzstqj.js} +2 -2
- package/dist/{chunk-qcymqscj.js → chunk-0px2ab3m.js} +9 -9
- package/dist/chunk-0q5s55km.js +2 -0
- package/dist/{chunk-7t3ykgsm.js → chunk-1c8sdf9a.js} +3 -3
- package/dist/chunk-1m5pagp3.js +2 -0
- package/dist/{chunk-cf97xdqa.js → chunk-1n9bxdnh.js} +3 -3
- package/dist/{chunk-58tz7tmf.js → chunk-1swmxkdt.js} +2 -2
- package/dist/{chunk-4easd8da.js → chunk-1x2x3xgc.js} +4 -4
- package/dist/chunk-27ja2rpd.js +2 -0
- package/dist/chunk-2b0p7am3.js +2 -0
- package/dist/{chunk-qj4j547f.js → chunk-30acme5g.js} +2 -2
- package/dist/{chunk-74ew8ajw.js → chunk-32pxa1r0.js} +1 -1
- package/dist/{chunk-g66m3g2r.js → chunk-37d52q0d.js} +1 -1
- package/dist/{chunk-sfwprq8q.js → chunk-3dr757vb.js} +9 -9
- package/dist/chunk-3k6q1481.js +2 -0
- package/dist/{chunk-2z0trbbm.js → chunk-3kc7af8c.js} +2 -2
- package/dist/chunk-3pr388w5.js +2 -0
- package/dist/chunk-42h0kvng.js +2 -0
- package/dist/chunk-4eff1v2p.js +2 -0
- package/dist/{chunk-g8757f97.js → chunk-4k6cb5fg.js} +5 -5
- package/dist/{chunk-s12b57m9.js → chunk-4xvbc0mb.js} +2 -2
- package/dist/{chunk-824cnbac.js → chunk-501h1mer.js} +4 -4
- package/dist/{chunk-tv784gv0.js → chunk-550q827h.js} +2 -2
- package/dist/chunk-5n2v9g2c.js +2 -0
- package/dist/{chunk-q79kmad5.js → chunk-5xwmkxkk.js} +1 -1
- package/dist/chunk-68ygpbta.js +2 -0
- package/dist/{chunk-j9qy9t3t.js → chunk-69k5t6pj.js} +52 -52
- package/dist/{chunk-232jswfm.js → chunk-6c2y9h5h.js} +1 -1
- package/dist/chunk-6gjfres0.js +2 -0
- package/dist/chunk-6z57saf5.js +2 -0
- package/dist/chunk-71zwgxws.js +2 -0
- package/dist/{chunk-b9r88ysg.js → chunk-76437eb4.js} +2 -2
- package/dist/{chunk-beqkrwt1.js → chunk-7a0ewpz0.js} +2 -2
- package/dist/chunk-7debnvz9.js +2 -0
- package/dist/{chunk-t3dnak1j.js → chunk-7gxn7mvd.js} +2 -2
- package/dist/{chunk-vp31ff54.js → chunk-7hr63cp5.js} +2 -2
- package/dist/{chunk-5t1whxxt.js → chunk-825m59jr.js} +5 -5
- package/dist/{chunk-74xwzxwz.js → chunk-8efe5vpm.js} +2 -2
- package/dist/{chunk-78d6yyxz.js → chunk-8hp6722y.js} +5 -5
- package/dist/{chunk-kgj852hx.js → chunk-9yht5n7g.js} +2 -2
- package/dist/{chunk-a3gvw1q2.js → chunk-a3w3jc0t.js} +6 -6
- package/dist/chunk-a77gbp9x.js +2 -0
- package/dist/chunk-ampr3fpv.js +2 -0
- package/dist/{chunk-2ads8rw5.js → chunk-b10n7cpe.js} +2 -2
- package/dist/{chunk-0q6n3by0.js → chunk-bb5a8adb.js} +3 -3
- package/dist/chunk-bgbz0wzq.js +2 -0
- package/dist/chunk-bgr7fqhs.js +2 -0
- package/dist/chunk-bjfrwcfh.js +2 -0
- package/dist/{chunk-9k7bq97t.js → chunk-byhsfnkc.js} +1 -1
- package/dist/{chunk-zyk12484.js → chunk-c0ewddb3.js} +2 -2
- package/dist/{chunk-b2q8bk8p.js → chunk-c6jyp7ss.js} +2 -2
- package/dist/chunk-cdt5pg28.js +2 -0
- package/dist/chunk-cfh798k7.js +2 -0
- package/dist/{chunk-pnag11c4.js → chunk-cp5903cg.js} +2 -2
- package/dist/{chunk-ev8t5cxk.js → chunk-crj0yqc6.js} +1 -1
- package/dist/chunk-dax3zkmm.js +2 -0
- package/dist/chunk-dn676tdp.js +2 -0
- package/dist/chunk-dtbj816p.js +2 -0
- package/dist/chunk-e23cg45k.js +2 -0
- package/dist/{chunk-6tsnz28m.js → chunk-e27njk86.js} +12 -12
- package/dist/{chunk-58vrf6kh.js → chunk-e40qpeg5.js} +2 -2
- package/dist/{chunk-q83w8edy.js → chunk-e7pjsrfc.js} +2 -2
- package/dist/chunk-ecwpsjpd.js +2 -0
- package/dist/{chunk-amtrg7pn.js → chunk-f0mbj8w9.js} +1 -1
- package/dist/chunk-f1zyc84x.js +2 -0
- package/dist/{chunk-0s647d0b.js → chunk-g8dx2jew.js} +244 -241
- package/dist/{chunk-phzs239m.js → chunk-gdxhe7ae.js} +4 -4
- package/dist/{chunk-5dmkkvs7.js → chunk-gh0q6jrm.js} +2 -2
- package/dist/chunk-h8vk3q9n.js +2 -0
- package/dist/{chunk-k7ht6tqe.js → chunk-hq8vxds5.js} +2 -2
- package/dist/{chunk-zd01r00t.js → chunk-hqda3vcw.js} +1 -1
- package/dist/chunk-j8pamkbh.js +2 -0
- package/dist/{chunk-nj488tj2.js → chunk-jwe7yq8m.js} +5 -5
- package/dist/chunk-k5rrp1bt.js +2 -0
- package/dist/{chunk-yk3wh2xv.js → chunk-kcq2ed1d.js} +2 -2
- package/dist/{chunk-9yar9rfq.js → chunk-ktc1ecsm.js} +1 -1
- package/dist/chunk-mfm7ezh6.js +2 -0
- package/dist/chunk-mp16jxcg.js +2 -0
- package/dist/chunk-myhh1zsm.js +2 -0
- package/dist/chunk-n1c9j5qv.js +2 -0
- package/dist/{chunk-q9chv68c.js → chunk-n8hnrgen.js} +6 -6
- package/dist/{chunk-36agnyhe.js → chunk-nc0ba89b.js} +6 -6
- package/dist/chunk-nf63pk4s.js +2 -0
- package/dist/{chunk-1edvsndv.js → chunk-nxw03sy9.js} +2 -2
- package/dist/{chunk-jze68d0z.js → chunk-p3xkj7pm.js} +2 -2
- package/dist/chunk-p5cry5s7.js +2 -0
- package/dist/{chunk-0dz1b6a1.js → chunk-pxk0tpw2.js} +3 -3
- package/dist/chunk-qd4snptd.js +2 -0
- package/dist/{chunk-h4k3hyny.js → chunk-r5ce7mkg.js} +2 -2
- package/dist/chunk-r8qhex33.js +2 -0
- package/dist/chunk-rqvn1s52.js +2 -0
- package/dist/{chunk-kns5m52j.js → chunk-sej3ng5k.js} +5 -5
- package/dist/chunk-sjsant53.js +2 -0
- package/dist/chunk-snzh9z3g.js +3 -0
- package/dist/{chunk-sjcstv33.js → chunk-ss4h5ch3.js} +1 -1
- package/dist/{chunk-2crxkm7j.js → chunk-svvavwp2.js} +4 -4
- package/dist/{chunk-qt3x1sh3.js → chunk-t79xnvzr.js} +3 -3
- package/dist/{chunk-2hg2bqtj.js → chunk-ta50ym5j.js} +2 -2
- package/dist/chunk-ty8g61y9.js +2 -0
- package/dist/chunk-v1k6w4z5.js +2 -0
- package/dist/{chunk-rfnr4xz6.js → chunk-vde4mtfr.js} +2 -2
- package/dist/chunk-vm7zv0gc.js +2 -0
- package/dist/{chunk-4f0fh2a9.js → chunk-vnh550b5.js} +1 -1
- package/dist/chunk-vnxc48en.js +2 -0
- package/dist/chunk-y7vbwhh7.js +2 -0
- package/dist/{chunk-ydx3mfpp.js → chunk-yf90vn5t.js} +6 -6
- package/dist/{chunk-6wc2t6cd.js → chunk-yhqhv8mp.js} +13 -13
- package/dist/{chunk-fynh3bkq.js → chunk-ytf3qkaw.js} +3 -3
- package/dist/chunk-yvyypd92.js +2 -0
- package/dist/{chunk-c4zpzxex.js → chunk-z33z3rr4.js} +4 -4
- package/dist/chunk-zfw39q56.js +2 -0
- package/dist/chunk-zpm02e15.js +2 -0
- package/dist/chunk-zzr0p4bb.js +2 -0
- package/dist/cli.js +18 -18
- package/dist/client-parameter-bindings.d.ts +3 -5
- package/dist/client-parameter-bindings.js +30 -10
- package/dist/client-script.js +4 -7
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +4 -4
- package/dist/stx-virtual-ts.js +5 -4
- package/dist/utils.js +6 -2
- package/package.json +5 -5
- package/dist/chunk-0g2ybnht.js +0 -3
- package/dist/chunk-15erabm6.js +0 -2
- package/dist/chunk-1bsafdnt.js +0 -2
- package/dist/chunk-1btr5tme.js +0 -2
- package/dist/chunk-1z6c6dyk.js +0 -2
- package/dist/chunk-1zfg1kd5.js +0 -2
- package/dist/chunk-279jv0yf.js +0 -2
- package/dist/chunk-2g6wcnna.js +0 -2
- package/dist/chunk-557wtdps.js +0 -2
- package/dist/chunk-5fv4g4et.js +0 -2
- package/dist/chunk-604rs9sq.js +0 -2
- package/dist/chunk-636sfxyj.js +0 -2
- package/dist/chunk-6x8cwscv.js +0 -2
- package/dist/chunk-864xm0jy.js +0 -2
- package/dist/chunk-8k61b4ae.js +0 -2
- package/dist/chunk-9fbkdrm8.js +0 -2
- package/dist/chunk-asbq9cgs.js +0 -2
- package/dist/chunk-b5fpsp5n.js +0 -2
- package/dist/chunk-b7t8jejd.js +0 -2
- package/dist/chunk-b894fxfc.js +0 -2
- package/dist/chunk-bcjr3fw7.js +0 -2
- package/dist/chunk-bkj0j5se.js +0 -2
- package/dist/chunk-cr67dpx4.js +0 -2
- package/dist/chunk-d8206zbp.js +0 -2
- package/dist/chunk-dpqvacd1.js +0 -2
- package/dist/chunk-et8726at.js +0 -2
- package/dist/chunk-f10299sf.js +0 -2
- package/dist/chunk-g6zeqvvb.js +0 -2
- package/dist/chunk-hm4j4d8q.js +0 -2
- package/dist/chunk-jhc47xzj.js +0 -2
- package/dist/chunk-jw33eys8.js +0 -2
- package/dist/chunk-k6wgh598.js +0 -2
- package/dist/chunk-mjpewk4r.js +0 -2
- package/dist/chunk-nw4axkpx.js +0 -2
- package/dist/chunk-p5chk3s9.js +0 -2
- package/dist/chunk-qm280dp3.js +0 -2
- package/dist/chunk-t0zdz8kd.js +0 -2
- package/dist/chunk-t64nnmmj.js +0 -2
- package/dist/chunk-ts80ktq7.js +0 -2
- package/dist/chunk-tvb8p7c0.js +0 -2
- package/dist/chunk-tyhgq6rw.js +0 -2
- package/dist/chunk-vn7tc8hm.js +0 -2
- package/dist/chunk-vyg8bvkt.js +0 -2
- package/dist/chunk-xy6g8zb9.js +0 -2
- package/dist/chunk-ya7xks9t.js +0 -2
- package/dist/chunk-zgxj1q7w.js +0 -2
- package/dist/chunk-zpz6q2fh.js +0 -2
- package/dist/chunk-zs7qhh40.js +0 -2
- package/dist/chunk-zxt94g45.js +0 -2
- package/dist/chunk-zzcxacjf.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{B,F,z,
|
|
2
|
+
import{Le,q,Fo}from"./chunk-t79xnvzr.js";import L from"fs";import g from"path";import D from"crypto";import{generatePlaceholder as R,processImage as k}from"ts-images";var B=[320,640,768,1024,1280,1536,1920],F=["webp","jpeg"],z=80,C=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],A={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,j=!1;async function d(){if(j)return I;j=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function Ft(){return await d()!==null}async function Q(){return!0}async function ie(t,e={}){let{widths:a=B,formats:r=F,quality:n=z,fit:c="cover",placeholder:i="none",outputDir:m=".stx/images",baseUrl:s="/images"}=e,h,l;if(typeof t==="string"){if(l=t,!await Bun.file(t).exists())throw new jn(`Image not found: ${t}`,"NOT_FOUND");h=await Bun.file(t).arrayBuffer().then((o)=>Buffer.from(o))}else l="buffer-input",h=t;let b=D.createHash("sha256").update(h).digest("hex").slice(0,12),v=await Ln(h),{width:u,height:x}=v,y=u/x;await L.promises.mkdir(m,{recursive:!0});let S=[],V=g.basename(l,g.extname(l)),f=a.filter((o)=>o<=u);if(!f.includes(u)&&u<=Math.max(...a))f.push(u);f.sort((o,p)=>o-p);for(let o of f){let p=Math.round(o/y);for(let w of r){let E=`${V}-${o}w-${b}.${w}`,M=g.join(m,E),T=`${s}/${E}`,U=await ma(h,{width:o,height:p,format:w,quality:n,fit:c});await Bun.write(M,U),S.push({path:M,url:T,width:o,height:p,format:w,size:U.length})}}let P;if(i!=="none")P=await N(h,i);return{src:l,variants:S,placeholder:P,width:u,height:x,aspectRatio:y,hash:b}}async function Ln(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await d();if(a){let n=await a(e).metadata();return{width:n.width||0,height:n.height||0,format:n.format||"unknown",hasAlpha:n.hasAlpha}}return O(e)}function O(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let n=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:n,format:"jpeg",hasAlpha:!1}}let r=t.readUInt16BE(e+2);e+=2+r}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,r=t.readUInt16LE(28)&16383;return{width:a,height:r,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),r=(a&16383)+1,n=(a>>14&16383)+1;return{width:r,height:n,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new jn("Unable to parse image dimensions","PARSE_ERROR")}async function ma(t,e){let a=await d();if(a){let r=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":r=r.webp({quality:e.quality});break;case"avif":r=r.avif({quality:e.quality});break;case"jpeg":r=r.jpeg({quality:e.quality});break;case"png":r=r.png({quality:e.quality});break}return r.toBuffer()}return await Fo("img",async(r)=>{let n=g.join(r,`out.${e.format}`);return await k({input:t,output:n,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(n).arrayBuffer())})}async function N(t,e){let a=await d();if(e==="blur"&&a){let m=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),s=await Ln(t);return`data:${A[s.format]||"image/jpeg"};base64,${m}`}if(e==="dominant-color"&&a){let{dominant:i}=await a(t).resize(1,1).toBuffer().then(async(m)=>{let s=await a(m).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${i.r}, ${i.g}, ${i.b})`}let r=await Ln(t),n=Le("ph"),c=g.join(n,`in.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(c,t);let i=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",s=await R(c,{strategy:i,width:i==="thumbhash"?void 0:32});if(e==="dominant-color"&&s.dominantColor)return s.dominantColor;if(s.dataURL)return s.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{q(n)}}function De(t,e){return(e?t.filter((r)=>r.format===e):t).sort((r,n)=>r.width-n.width).map((r)=>`${r.url} ${r.width}w`).join(", ")}function gt(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,r)=>{let n=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(r[0].replace(/\D/g,""))||0)-n}).map(([a,r])=>`(max-width: ${a}) ${r}`).join(", ")+", 100vw"}function zt(t){let e=t.filter((r)=>r.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((r,n)=>r.width-n.width);return a[Math.floor(a.length/2)]}function Ht(t){let e=new Map;for(let a of t){let r=e.get(a.format)||[];r.push(a),e.set(a.format,r)}return e}function Ut(t){let e=g.extname(t).toLowerCase();return C.includes(e)}function H(t){return A[t]||"application/octet-stream"}function Vt(t){return t.reduce((e,a)=>e+a.size,0)}function Wt(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class jn extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
|
|
3
|
+
export{B,F,z,Ft,Q,ie,Ln,ma,De,gt,zt,Ht,Ut,H,Vt,Wt,jn};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var l=null,k=[],a=0,v=new Set;function b(){return l}function y(e){let n=l;return k.push(e),l=e,n}function T(e){k.pop(),l=e}var m=new WeakMap;function A(e,n){m.set(e,n)}function f(e,n){for(let t of e){let i=m.get(t);if(i)i(n);else n.add(t)}}function g(e){if(a>0){f(e,v);return}let n=new Set;f(e,n);for(let t of n)t()}function D(e){a++;try{e()}finally{if(a--,a===0){let n=[...v];v.clear();for(let t of n)t()}}}function C(e){let n=l;l=null;try{return e()}finally{l=n}}var S=[],d=[];function W(e){let n=e,t=new Set,i=new Set,o=()=>{let r=b();if(r)i.add(r);return n};return o.set=(r)=>{if(!Object.is(r,n)){let c=n;n=r,t.forEach((s)=>{try{s(n,c)}catch(u){console.error("[stx] subscriber error:",u)}}),g(i)}},o.update=(r)=>{o.set(r(n))},o.subscribe=(r)=>(t.add(r),()=>t.delete(r)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(r)=>o.set(r),configurable:!0}),o}function
|
|
3
|
-
export{W,
|
|
2
|
+
var l=null,k=[],a=0,v=new Set;function b(){return l}function y(e){let n=l;return k.push(e),l=e,n}function T(e){k.pop(),l=e}var m=new WeakMap;function A(e,n){m.set(e,n)}function f(e,n){for(let t of e){let i=m.get(t);if(i)i(n);else n.add(t)}}function g(e){if(a>0){f(e,v);return}let n=new Set;f(e,n);for(let t of n)t()}function D(e){a++;try{e()}finally{if(a--,a===0){let n=[...v];v.clear();for(let t of n)t()}}}function C(e){let n=l;l=null;try{return e()}finally{l=n}}var S=[],d=[];function W(e){let n=e,t=new Set,i=new Set,o=()=>{let r=b();if(r)i.add(r);return n};return o.set=(r)=>{if(!Object.is(r,n)){let c=n;n=r,t.forEach((s)=>{try{s(n,c)}catch(u){console.error("[stx] subscriber error:",u)}}),g(i)}},o.update=(r)=>{o.set(r(n))},o.subscribe=(r)=>(t.add(r),()=>t.delete(r)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(r)=>o.set(r),configurable:!0}),o}function Bn(e){let n,t=!0,i=new Set,o=()=>{if(!t)t=!0,g(i)};A(o,(c)=>{if(!t)t=!0,f(i,c)});let r=()=>{let c=b();if(c)i.add(c);if(t){let s=y(o);try{n=e()}finally{T(s)}t=!1}return n};return Object.defineProperty(r,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(r,"value",{get:()=>r(),configurable:!0}),r}function Zt(e,n={}){let t,i=!1,o=()=>{if(i)return;if(t){let c=t;t=void 0;try{c()}catch(s){console.error("[stx] effect cleanup error:",s)}}let r=y(o);try{let c=e();t=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{T(r)}};if(n.immediate!==!1)o();return()=>{if(i=!0,t){let r=t;t=void 0,r()}}}function Wr(e){D(e)}function qr(e){S.push(e)}function Fn(e){d.push(e)}function fd(){w(S,"onMount",d)}function gd(){w(d,"onDestroy")}function w(e,n,t){let i=e.splice(0,e.length);for(let o of i)try{let r=o();if(t&&typeof r==="function")t.push(r)}catch(r){console.error(`[stx] ${n} callback threw:`,r)}}function md(){return{mount:S.length,destroy:d.length}}function Qt(e){return typeof e==="function"&&e._isSignal===!0}function en(e){return typeof e==="function"&&e._isDerived===!0}function Gr(e){if(Qt(e)||en(e))return e();return e}function zn(e){return C(e)}function hd(e,n){let t=typeof e==="function"?e:()=>e,i=W([]),o=Bn(()=>i().reduce((s,u)=>n(s,u.action),t())),r=!1;return Zt(()=>{if(t(),!r){r=!0;return}if(zn(()=>i().length))i.set([])}),[o,(s,u)=>{let x={action:s};i.set([...i(),x]);let p=()=>{let h=i().filter((O)=>O!==x);if(h.length!==i().length)i.set(h)};if(u&&typeof u.then==="function")Promise.resolve(u).then(p,p);return p}]}
|
|
3
|
+
export{W,Bn,Zt,Wr,qr,Fn,fd,gd,md,Qt,en,Gr,zn,hd};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{nu,kc,ms,hs,pi,fi,ys,bs,Zn,Cc,gi,mi,_c,qe}from"./chunk-g8dx2jew.js";import"./chunk-cp5903cg.js";import"./chunk-7hr63cp5.js";import"./chunk-550q827h.js";import"./chunk-ta50ym5j.js";import"./chunk-vde4mtfr.js";import"./chunk-nc0ba89b.js";import"./chunk-3dr757vb.js";import"./chunk-yf90vn5t.js";import"./chunk-4xvbc0mb.js";import"./chunk-hq8vxds5.js";import"./chunk-gdxhe7ae.js";import"./chunk-nxw03sy9.js";export{nu as clearScriptScanCache,ys as convertServerLoopAttributesToDirectives,pi as convertSignalDirectivesToAttributes,bs as convertSignalLoopsToAttributes,Cc as extractExports,mi as findMarkupIndexOutsideScripts,hs as hasSignalsSyntax,ms as parseLoopExpression,fi as preEvalLiteralReactiveIfs,Zn as processScriptSetup,gi as processSignals,_c as rewriteStxImportSpecifiers,kc as scanScriptTags,qe as stripStxRuntimeImports};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,i,D}from"./chunk-
|
|
3
|
-
`),n=[{obj:a,indent:-1}];for(let r of s){let l=r.replace(/#.*$/,"").trimEnd();if(!l.trim())continue;let c=l.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,o=l.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(o){let[,,g,f]=o,p=g.trim(),m=f.trim();if(m==="")u[p]={},n.push({obj:u[p],indent:c});else u[p]=X(m)}}return a}function X(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let a=e.toLowerCase();if(a==="true"||a==="yes")return!0;if(a==="false"||a==="no")return!1;if(a==="null"||a==="~")return null;let s=Number(e);if(!Number.isNaN(s)&&e!=="")return s;return e}function ee(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function te(e,a){return G(e,a)}function re(e,a){for(let s of e){let n=s.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(a===c)return r[2];continue}let l=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(l){let c=Number.parseInt(l[1],10),u=l[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(l[2],10);if(a>=c&&a<=u)return l[3];continue}}if(e.length===2)return a===1?e[0].trim():e[1].trim();if(a<e.length)return e[a].trim();return e[e.length-1].trim()}function ne(e,a={}){return j(e,a)}function j(e,a){let s="",n=0;while(n<e.length)if(e[n]==="{"){let r=ie(e,n);if(r===-1){s+=e[n],n++;continue}let l=e.slice(n+1,r);s+=se(l,a),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")s+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")s+=e[n+1],n+=2;else s+=e[n],n++;else s+=e[n],n++;return s}function ie(e,a){let s=0;for(let n=a;n<e.length;n++)if(e[n]==="{")s++;else if(e[n]==="}"){if(s--,s===0)return n}return-1}function se(e,a){let s=ae(e);if(s.length===0)return`{${e}}`;let n=s[0].trim(),r=a[n];if(s.length===1)return r!==void 0?String(r):`{${n}}`;switch(s[1].trim().toLowerCase()){case"plural":return oe(r,s.slice(2).join(","),a);case"select":return ce(r,s.slice(2).join(","));case"selectordinal":return ue(r,s.slice(2).join(","));case"number":return ge(r,s[2]?.trim());case"date":return pe(r,s[2]?.trim());case"time":return fe(r,s[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function ae(e){let a=[],s="",n=0;for(let r=0;r<e.length;r++){let l=e[r];if(l==="{")n++,s+=l;else if(l==="}")n--,s+=l;else if(l===","&&n===0)a.push(s),s="";else s+=l}if(s)a.push(s);return a}function oe(e,a,s){let n=Number(e)||0,r=P(a),l=`=${n}`;if(r[l])return R(r[l],n,s);let c=le(n);if(r[c])return R(r[c],n,s);if(r.other)return R(r.other,n,s);return String(n)}function R(e,a,s){let n=e.replace(/#/g,String(a));return j(n,s)}function le(e){let a=Math.abs(e),s=Math.floor(a),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(s===1&&n===0)return"one";return"other"}function ce(e,a){let s=String(e||""),n=P(a);if(n[s])return n[s];return n.other||String(e)}function ue(e,a){let s=Number(e)||0,n=P(a),r=de(s);if(n[r])return n[r].replace(/#/g,String(s));if(n.other)return n.other.replace(/#/g,String(s));return String(s)}function de(e){let a=Math.abs(e),s=a%10,n=a%100;if(s===1&&n!==11)return"one";if(s===2&&n!==12)return"two";if(s===3&&n!==13)return"few";return"other"}function P(e){let a={},s=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=s.exec(e);while(n!==null)a[n[1]]=n[2],n=s.exec(e);return a}function ge(e,a){let s=Number(e);if(Number.isNaN(s))return String(e);switch(a){case"integer":return Math.floor(s).toLocaleString();case"percent":return`${(s*100).toFixed(0)}%`;case"currency":return s.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return s.toLocaleString()}}function pe(e,a){let s=e instanceof Date?e:new Date(String(e));if(Number.isNaN(s.getTime()))return String(e);let n={};switch(a){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return s.toLocaleDateString(void 0,n)}function fe(e,a){let s=e instanceof Date?e:new Date(String(e));if(Number.isNaN(s.getTime()))return String(e);let n={};switch(a){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return s.toLocaleTimeString(void 0,n)}function me(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function N(e,a,s=!0,n={}){let r=e.split("."),l=a;for(let u of r){if(l===void 0||l===null)break;l=l[u]}if(l===void 0||l===null)return s?e:"";let c=String(l);if(me(c))return ne(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),o=c.split("|");c=re(o,u)}for(let[u,o]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),String(o))}return c}var O=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),be=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function _(e){if(!e)return"ltr";let a=e.trim().toLowerCase().replace(/_/g,"-").split("-"),s=a[0];if(!s)return"ltr";let n=a[1]?.length===4?a[1]:void 0;if(n)return be.has(n)?"rtl":"ltr";if(a.length>1&&O.has(`${s}-${a[1]}`))return"rtl";return O.has(s)?"rtl":"ltr"}async function ki(e,a,s,n){let r=e,l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...T,...n.i18n},u=await te(c.locale,n);a.__translations=u,a.__locale=c.locale,a.__i18nConfig=c,r=await F(r,l,async(f,p,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>D(m,a)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}return N(p,u,c.fallbackToKey,b)||w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return i("Translate",`Error in @translate('${p}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let f=[...r.matchAll(o)];console.warn(`Found ${f.length} @translate matches`),f.forEach((p,m)=>console.warn(`Match ${m}: ${p[0]}, Key: ${p[1]}, Params: ${p[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(f,p,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>D(m,a)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return N(p,u,c.fallbackToKey,h)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return i("Translate",`Error in @translate('${p}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,a,s){let n=[];return e.replace(a,(l,...c)=>{let u=s(l,...c).then((o)=>({match:l,replacement:o}));return n.push(u),l}),(await Promise.all(n)).reduce((l,{match:c,replacement:u})=>l.replace(c,u),e)}function q(e,a){if(!e||_(e)!=="rtl")return!1;return!a||a.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function I(e,a){let s=new RegExp(`\\b${a}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!s)return null;return s[2]??s[3]??s[4]??null}function Ci(e,a,s,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,o)=>{let f={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${o||f} -->`});let l=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(l,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,o)=>`<span id="${`desc-${u}`}" class="sr-only">${o}</span>`),r}function he(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function ye(e){let a=new Map,s=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,l,c)=>{let u=a.get(c);if(!u)u=`stx-a11y-component-${a.size}`,a.set(c,u);return`<${l}${u}`}),n=new Map([...a.entries()].map(([r,l])=>[l,r]));return{protectedSource:s,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(l,c,u)=>{let o=n.get(u);return o?`<${c}${o}`:l})}}function xe(e,a){let s=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))s.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let l=/<button([^>]*)>\s*<\/button>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))s.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=l.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))s.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),U=r.index,M=e.substring(0,U),Ae=e.substring(U),H=(M.match(/<label\b/gi)||[]).length,z=(M.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)s.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let o=/<h([1-6])[^>]*>/gi,g=[];r=o.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=o.exec(e);let f=0;for(let d of g){if(f>0&&d>f+1)s.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${f} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});f=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))s.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let p=e.match(/<html\b([^>]*)>/i);if(p&&q(I(p[1],"lang"),I(p[1],"dir")))s.push({type:"missing-dir",element:p[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(I(r[1],"role"))&&!/<th\b/i.test(d))s.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))s.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)s.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))s.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))s.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return s}async function we(e,a){let{protectedSource:s}=ye(e);if(!he())return xe(s,a);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=s,r.querySelectorAll("img").forEach((o)=>{if(!o.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${o.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((o)=>{if(!(o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby")||o.textContent&&o.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${o.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((o)=>{let g=o.getAttribute("id"),f=g&&r.querySelector(`label[for="${g}"]`),p=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),m=o.closest("label")!==null;if(!f&&!p&&!m)n.push({type:"input-missing-label",element:`<${o.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let l=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let o of l){let g=Number.parseInt(o.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${o.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(s.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&q(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((o)=>{let g=o.textContent&&o.textContent.trim().length>0,f=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),p=o.hasAttribute("title"),m=o.querySelector("img[alt]");if(!g&&!f&&!p&&!m)n.push({type:"link-missing-text",element:`<${o.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),s.includes("<nav")||s.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((o)=>{if(V(o.getAttribute("role")))return;let g=o.querySelector("caption");if(!o.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!o.hasAttribute("aria-label")&&!o.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((o)=>{let g=o.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${o.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((o)=>{if(!o.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${o.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((o)=>{if(Number.parseInt(o.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${o.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((o)=>{if(!o.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${o.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),s.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((o)=>{if(!o.hasAttribute("title")&&!o.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${a}:`,r)}return n}async function _i(e,a={}){let s={},{recursive:n=!0,ignorePaths:r=[]}=a,l=Array.isArray(e)?e:[e],c=await $s(l,{recursive:n,ignorePaths:r}),u=[];for(let o of c)try{let g=await Bun.file(o).text();if(o.endsWith("good-a11y.stx"))continue;let f=await we(g,o);if(u.push(o),f.length>0)s[o]=f}catch(g){console.error(`Error scanning ${o}:`,g)}return{results:s,scannedFiles:u}}var Ei={name:"a11y",handler:(e,a,s,n)=>{if(!a.length)return e;let r=a[0].replace(/['"]/g,""),l=a.length>1?a[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${l||u} -->${e}`},hasEndTag:!1},Ti={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
2
|
+
import{t,i,D}from"./chunk-yf90vn5t.js";import{Rs}from"./chunk-7hr63cp5.js";import E from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var T={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,a=0){if(a<=0)return!1;return Date.now()-e.loadedAt>a}async function G(e,a){if({...T,...a.i18n}.cache&&v[e]){let r=v[e],l=a.i18n?.cacheMaxAge??0;if(!J(r,l))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=C(e,a).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function C(e,a){let s={...T,...a.i18n},n=E.isAbsolute(s.translationsDir)?s.translationsDir:E.resolve(a.root||process.cwd(),s.translationsDir);try{let r=await W(),l=r?await r(e,{translationsDir:n,defaultLocale:s.defaultLocale,sources:ee(s.format)}):await Y(e,s,n);if(l===void 0){let u=e!==s.defaultLocale?await C(s.defaultLocale,a):{};if(s.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=l;if(s.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(a.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==s.defaultLocale)return C(s.defaultLocale,a);return{}}}async function Y(e,a,s){let n=E.join(s,`${e}${Z(a.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let l=await Bun.file(n).text();if(a.format==="yaml"||a.format==="yml")return Q(l);if(a.format==="json")return JSON.parse(l);throw r}catch{return}}}function Z(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Q(e){let a={},s=e.split(`
|
|
3
|
+
`),n=[{obj:a,indent:-1}];for(let r of s){let l=r.replace(/#.*$/,"").trimEnd();if(!l.trim())continue;let c=l.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,o=l.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(o){let[,,g,f]=o,p=g.trim(),m=f.trim();if(m==="")u[p]={},n.push({obj:u[p],indent:c});else u[p]=X(m)}}return a}function X(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let a=e.toLowerCase();if(a==="true"||a==="yes")return!0;if(a==="false"||a==="no")return!1;if(a==="null"||a==="~")return null;let s=Number(e);if(!Number.isNaN(s)&&e!=="")return s;return e}function ee(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function te(e,a){return G(e,a)}function re(e,a){for(let s of e){let n=s.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(a===c)return r[2];continue}let l=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(l){let c=Number.parseInt(l[1],10),u=l[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(l[2],10);if(a>=c&&a<=u)return l[3];continue}}if(e.length===2)return a===1?e[0].trim():e[1].trim();if(a<e.length)return e[a].trim();return e[e.length-1].trim()}function ne(e,a={}){return j(e,a)}function j(e,a){let s="",n=0;while(n<e.length)if(e[n]==="{"){let r=ie(e,n);if(r===-1){s+=e[n],n++;continue}let l=e.slice(n+1,r);s+=se(l,a),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")s+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")s+=e[n+1],n+=2;else s+=e[n],n++;else s+=e[n],n++;return s}function ie(e,a){let s=0;for(let n=a;n<e.length;n++)if(e[n]==="{")s++;else if(e[n]==="}"){if(s--,s===0)return n}return-1}function se(e,a){let s=ae(e);if(s.length===0)return`{${e}}`;let n=s[0].trim(),r=a[n];if(s.length===1)return r!==void 0?String(r):`{${n}}`;switch(s[1].trim().toLowerCase()){case"plural":return oe(r,s.slice(2).join(","),a);case"select":return ce(r,s.slice(2).join(","));case"selectordinal":return ue(r,s.slice(2).join(","));case"number":return ge(r,s[2]?.trim());case"date":return pe(r,s[2]?.trim());case"time":return fe(r,s[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function ae(e){let a=[],s="",n=0;for(let r=0;r<e.length;r++){let l=e[r];if(l==="{")n++,s+=l;else if(l==="}")n--,s+=l;else if(l===","&&n===0)a.push(s),s="";else s+=l}if(s)a.push(s);return a}function oe(e,a,s){let n=Number(e)||0,r=P(a),l=`=${n}`;if(r[l])return R(r[l],n,s);let c=le(n);if(r[c])return R(r[c],n,s);if(r.other)return R(r.other,n,s);return String(n)}function R(e,a,s){let n=e.replace(/#/g,String(a));return j(n,s)}function le(e){let a=Math.abs(e),s=Math.floor(a),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(s===1&&n===0)return"one";return"other"}function ce(e,a){let s=String(e||""),n=P(a);if(n[s])return n[s];return n.other||String(e)}function ue(e,a){let s=Number(e)||0,n=P(a),r=de(s);if(n[r])return n[r].replace(/#/g,String(s));if(n.other)return n.other.replace(/#/g,String(s));return String(s)}function de(e){let a=Math.abs(e),s=a%10,n=a%100;if(s===1&&n!==11)return"one";if(s===2&&n!==12)return"two";if(s===3&&n!==13)return"few";return"other"}function P(e){let a={},s=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=s.exec(e);while(n!==null)a[n[1]]=n[2],n=s.exec(e);return a}function ge(e,a){let s=Number(e);if(Number.isNaN(s))return String(e);switch(a){case"integer":return Math.floor(s).toLocaleString();case"percent":return`${(s*100).toFixed(0)}%`;case"currency":return s.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return s.toLocaleString()}}function pe(e,a){let s=e instanceof Date?e:new Date(String(e));if(Number.isNaN(s.getTime()))return String(e);let n={};switch(a){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return s.toLocaleDateString(void 0,n)}function fe(e,a){let s=e instanceof Date?e:new Date(String(e));if(Number.isNaN(s.getTime()))return String(e);let n={};switch(a){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return s.toLocaleTimeString(void 0,n)}function me(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function N(e,a,s=!0,n={}){let r=e.split("."),l=a;for(let u of r){if(l===void 0||l===null)break;l=l[u]}if(l===void 0||l===null)return s?e:"";let c=String(l);if(me(c))return ne(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),o=c.split("|");c=re(o,u)}for(let[u,o]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),String(o))}return c}var O=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),be=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function _(e){if(!e)return"ltr";let a=e.trim().toLowerCase().replace(/_/g,"-").split("-"),s=a[0];if(!s)return"ltr";let n=a[1]?.length===4?a[1]:void 0;if(n)return be.has(n)?"rtl":"ltr";if(a.length>1&&O.has(`${s}-${a[1]}`))return"rtl";return O.has(s)?"rtl":"ltr"}async function ki(e,a,s,n){let r=e,l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...T,...n.i18n},u=await te(c.locale,n);a.__translations=u,a.__locale=c.locale,a.__i18nConfig=c,r=await F(r,l,async(f,p,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>D(m,a)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}return N(p,u,c.fallbackToKey,b)||w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return i("Translate",`Error in @translate('${p}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let f=[...r.matchAll(o)];console.warn(`Found ${f.length} @translate matches`),f.forEach((p,m)=>console.warn(`Match ${m}: ${p[0]}, Key: ${p[1]}, Params: ${p[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(f,p,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>D(m,a)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return N(p,u,c.fallbackToKey,h)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return i("Translate",`Error in @translate('${p}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,a,s){let n=[];return e.replace(a,(l,...c)=>{let u=s(l,...c).then((o)=>({match:l,replacement:o}));return n.push(u),l}),(await Promise.all(n)).reduce((l,{match:c,replacement:u})=>l.replace(c,u),e)}function q(e,a){if(!e||_(e)!=="rtl")return!1;return!a||a.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function I(e,a){let s=new RegExp(`\\b${a}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!s)return null;return s[2]??s[3]??s[4]??null}function Ci(e,a,s,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,o)=>{let f={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${o||f} -->`});let l=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(l,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,o)=>`<span id="${`desc-${u}`}" class="sr-only">${o}</span>`),r}function he(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function ye(e){let a=new Map,s=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,l,c)=>{let u=a.get(c);if(!u)u=`stx-a11y-component-${a.size}`,a.set(c,u);return`<${l}${u}`}),n=new Map([...a.entries()].map(([r,l])=>[l,r]));return{protectedSource:s,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(l,c,u)=>{let o=n.get(u);return o?`<${c}${o}`:l})}}function xe(e,a){let s=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))s.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let l=/<button([^>]*)>\s*<\/button>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))s.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=l.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))s.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),U=r.index,M=e.substring(0,U),Ae=e.substring(U),H=(M.match(/<label\b/gi)||[]).length,z=(M.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)s.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let o=/<h([1-6])[^>]*>/gi,g=[];r=o.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=o.exec(e);let f=0;for(let d of g){if(f>0&&d>f+1)s.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${f} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});f=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))s.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let p=e.match(/<html\b([^>]*)>/i);if(p&&q(I(p[1],"lang"),I(p[1],"dir")))s.push({type:"missing-dir",element:p[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(I(r[1],"role"))&&!/<th\b/i.test(d))s.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))s.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)s.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))s.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))s.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return s}async function we(e,a){let{protectedSource:s}=ye(e);if(!he())return xe(s,a);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=s,r.querySelectorAll("img").forEach((o)=>{if(!o.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${o.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((o)=>{if(!(o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby")||o.textContent&&o.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${o.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((o)=>{let g=o.getAttribute("id"),f=g&&r.querySelector(`label[for="${g}"]`),p=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),m=o.closest("label")!==null;if(!f&&!p&&!m)n.push({type:"input-missing-label",element:`<${o.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let l=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let o of l){let g=Number.parseInt(o.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${o.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(s.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&q(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((o)=>{let g=o.textContent&&o.textContent.trim().length>0,f=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),p=o.hasAttribute("title"),m=o.querySelector("img[alt]");if(!g&&!f&&!p&&!m)n.push({type:"link-missing-text",element:`<${o.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),s.includes("<nav")||s.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((o)=>{if(V(o.getAttribute("role")))return;let g=o.querySelector("caption");if(!o.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!o.hasAttribute("aria-label")&&!o.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((o)=>{let g=o.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${o.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((o)=>{if(!o.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${o.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((o)=>{if(Number.parseInt(o.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${o.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((o)=>{if(!o.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${o.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),s.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((o)=>{if(!o.hasAttribute("title")&&!o.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${a}:`,r)}return n}async function _i(e,a={}){let s={},{recursive:n=!0,ignorePaths:r=[]}=a,l=Array.isArray(e)?e:[e],c=await Rs(l,{recursive:n,ignorePaths:r}),u=[];for(let o of c)try{let g=await Bun.file(o).text();if(o.endsWith("good-a11y.stx"))continue;let f=await we(g,o);if(u.push(o),f.length>0)s[o]=f}catch(g){console.error(`Error scanning ${o}:`,g)}return{results:s,scannedFiles:u}}var Ei={name:"a11y",handler:(e,a,s,n)=>{if(!a.length)return e;let r=a[0].replace(/['"]/g,""),l=a.length>1?a[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${l||u} -->${e}`},hasEndTag:!1},Ti={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
4
|
export{ki,Ci,_i,Ei,Ti};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Te}from"./chunk-gdxhe7ae.js";import{Ne,Yt}from"./chunk-yhqhv8mp.js";import{Zo,Qo,f,$t,de,L,n,A,o}from"./chunk-g8dx2jew.js";import{C}from"./chunk-vde4mtfr.js";import{Ps}from"./chunk-ta50ym5j.js";import{yn,bn,wn,xn,me}from"./chunk-3dr757vb.js";import{Pi}from"./chunk-550q827h.js";import{ye,oe,bo,wo,jt}from"./chunk-8hp6722y.js";import{St,Qr}from"./chunk-sej3ng5k.js";import{Bt}from"./chunk-p3xkj7pm.js";import{ht,tn,nn}from"./chunk-0ppzstqj.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(i){return Q("sha256").update(i).digest("hex").slice(0,8)}function U(i=!1){let l=i?Yt():Ne(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let i=Te(),l=J(i);return{content:i,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(i={}){let l=new Set;return{context:new Proxy(i,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(i,l,a={}){let r=q.resolve(i),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Zo();let _={};try{_=await o(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>de(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,P={...A,..._,...a,buildMode:"compile",strict:!1},b=await n(e,D,r,P,w),T=ye(b),B=Qo();return{route:l,sourceFile:i,html:b,fragment:T,placeholders:B,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:$t(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(i,l){let a=0,r=0;if(!m.existsSync(i))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),a++,r+=m.statSync(u).size}}}return e(i,l),{copied:a,bytes:r}}async function ml(i={}){let l=Date.now(),a=c.resolve(i.root||process.cwd()),r=c.resolve(a,i.outputDir||".output");console.log("[stx build] Starting production build...");let e=await o(a),S=c.resolve(a,i.componentsDir??e.componentsDir??"components"),_=c.resolve(a,i.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,i.layoutsDir??e.layoutsDir??"layouts"),d=i.publicDir??e.publicDir??"public",g=me(e.app?.head,{known:xn,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",w=i.routeRules??e.routeRules??{},P=Bt(w),b=i.serverApi??e.serverApi,T=typeof b==="object"?b:{};if(b)St(a,T);if(e.runtimeConfig)C(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let B=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of B)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=L(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],M=R.filter((s)=>!Y.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${M.length} page routes (${R.length-M.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(i.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],E=[];for(let s of M){let h=P(s.pattern),k=h.rendering==="prerender";if(k&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:i.debug});if(O.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=wn(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=yn(t.html,u);if(g.htmlAttrs)t.html=bn(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await f(t.html),k){let p=await jt(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=oe(t.html,D);let z=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),G=c.join("server","pages",`${z}.compiled.json`),I=c.join("server","fragments",`${z}.html`);await Bun.write(c.join(r,G),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),E.push({pattern:s.pattern,compiledPath:G,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:k}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(a,d);if(m.existsSync(H)){let{copied:s,bytes:h}=Z(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let F=nn(a);if(F){let{copied:s,bytes:h}=Z(F,c.join(r,"public",tn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${ht}/`)}let N={runtime:v.filename,router:x.filename},j=bo(E,N,r);if(j.routeRules=w,j.routerContainer=D,b)j.apiRoutes=await Qr(a,r,T);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Ps(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Pi(e._layerGraph),null,2));wo(j,r);let K=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${K}ms \u2014 ${O.length} pages compiled`),{pageCount:O.length,assets:N,outputDir:r,duration:K}}
|
|
4
4
|
export{ml};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Wn,cc,jd,lc,Bd,dc,qn,b,Et,ve,uc,is,pc,Fd,K,fc,zd,x,Hd}from"./chunk-g8dx2jew.js";import"./chunk-cp5903cg.js";import"./chunk-7hr63cp5.js";import"./chunk-550q827h.js";import"./chunk-ta50ym5j.js";import"./chunk-vde4mtfr.js";import"./chunk-nc0ba89b.js";import"./chunk-3dr757vb.js";import"./chunk-yf90vn5t.js";import"./chunk-4xvbc0mb.js";import"./chunk-hq8vxds5.js";import"./chunk-gdxhe7ae.js";import"./chunk-nxw03sy9.js";export{fc as applyFilters,Bd as clearCustomFilters,uc as clientLoopScopes,Wn as defaultFilters,b as escapeHtml,Et as escapeHtmlValue,x as evaluateExpression,dc as findMustacheEnd,lc as getAllFilters,pc as interpolateScriptAttributes,is as interpolateScriptExpressions,Fd as interpolateScriptsInTemplate,K as processExpressions,cc as registerFilter,jd as registerFilters,qn as replaceInterpolations,zd as resetRejectedExpressionWarnings,Hd as unescapeHtml,ve as usesSignalsInScript};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ne,Yt,pd}from"./chunk-yhqhv8mp.js";import{W,Bn,Zt,Wr,qr,Fn,fd,gd,md,Qt,en,Gr,zn,hd}from"./chunk-c6jyp7ss.js";import"./chunk-hq8vxds5.js";export{Wr as batch,pd as default,Bn as derived,Zt as effect,Ne as generateSignalsRuntime,Yt as generateSignalsRuntimeDev,en as isDerived,Qt as isSignal,Fn as onDestroy,qr as onMount,zn as peek,md as pendingLifecycleCounts,gd as runDestroyCallbacks,fd as runMountCallbacks,W as state,Gr as untrack,hd as useOptimistic};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ru,Dc,xe,wi,su,xs,Ss,ks}from"./chunk-g8dx2jew.js";import"./chunk-cp5903cg.js";import"./chunk-7hr63cp5.js";import"./chunk-550q827h.js";import"./chunk-ta50ym5j.js";import"./chunk-vde4mtfr.js";import"./chunk-nc0ba89b.js";import"./chunk-3dr757vb.js";import"./chunk-yf90vn5t.js";import"./chunk-4xvbc0mb.js";import"./chunk-hq8vxds5.js";import"./chunk-gdxhe7ae.js";import"./chunk-nxw03sy9.js";export{su as clearOnceStore,wi as onceStore,xe as partialsCache,xs as processIncludes,Ss as processStackPushDirectives,ks as processStackReplacements,ru as resetUnscopedSignalWarnings,Dc as topLevelElements};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ce,tc,Xo,bt,wt,Md,Ko,vt,rn,nc,rc,sc,oc,xt,ic}from"./chunk-n8hnrgen.js";import"./chunk-sej3ng5k.js";import"./chunk-3kc7af8c.js";import"./chunk-g8dx2jew.js";import"./chunk-cp5903cg.js";import"./chunk-7hr63cp5.js";import"./chunk-550q827h.js";import"./chunk-ta50ym5j.js";import"./chunk-vde4mtfr.js";import"./chunk-nc0ba89b.js";import"./chunk-3dr757vb.js";import"./chunk-yf90vn5t.js";import"./chunk-4xvbc0mb.js";import"./chunk-hq8vxds5.js";import"./chunk-gdxhe7ae.js";import"./chunk-nxw03sy9.js";export{rn as MODULE_SPECIFIER_PREFIX,xt as bundleClientScript,wt as clearBundleFailures,ce as clientBundleDependencies,bt as getBundleFailures,vt as hasUserImports,rc as normalizeRegistrySpecifiers,oc as queueClientBundleBuild,Xo as recordBundleFailure,nc as registryIdForPath,Ko as resolveBundlerFallback,sc as rewriteRegistryImports,Md as setBundlerFallbackMode,tc as shouldLogBundlerDiagnostics,ic as tempBuildName};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Le,q}from"./chunk-t79xnvzr.js";import{Bo}from"./chunk-4k6cb5fg.js";import{u}from"./chunk-cg8hg6cs.js";import{existsSync as M,mkdirSync as v,copyFileSync as k,chmodSync as T}from"fs";import{join as o,basename as te}from"path";import{spawn as E,execSync as ae}from"child_process";import{homedir as B,platform as re}from"os";var Td=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -465,7 +465,7 @@ else if (data.type === 'event' && data.method) {
|
|
|
465
465
|
}
|
|
466
466
|
})();
|
|
467
467
|
</script>
|
|
468
|
-
`;function
|
|
468
|
+
`;function Ao(e={}){let{debug:a=!1,timeout:r=30000}=e;return`
|
|
469
469
|
<script>
|
|
470
470
|
(function() {
|
|
471
471
|
'use strict';
|
|
@@ -931,9 +931,9 @@ else if (data.type === 'event' && data.method) {
|
|
|
931
931
|
}
|
|
932
932
|
})();
|
|
933
933
|
</script>
|
|
934
|
-
`.replace("debug: false,",`debug: ${a},`).replace("timeout: 30000",`timeout: ${r}`)}function $d(){return!1}function Rd(e,a={}){let r=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(r,(i,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return
|
|
934
|
+
`.replace("debug: false,",`debug: ${a},`).replace("timeout: 30000",`timeout: ${r}`)}function $d(){return!1}function Rd(e,a={}){let r=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(r,(i,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return Ao(t)})}function Po(e,a={}){if(e.includes("__craftBridgeInitialized"))return e;let r=Ao(a);if(e.includes("</head>"))return e.replace("</head>",`${r}
|
|
935
935
|
</head>`);if(e.includes("<body"))return e.replace(/(<body[^>]*>)/,`$1
|
|
936
|
-
${r}`);return r+e}var
|
|
936
|
+
${r}`);return r+e}var Xr={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,a)=>{let r=e.checked?"checked":"",i=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
|
|
937
937
|
<input type="checkbox" class="craft-checkbox" ${r} ${i}>
|
|
938
938
|
<span class="craft-checkbox-label">${a||e.label||""}</span>
|
|
939
939
|
</label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(e,a)=>{let r=e.min??0,i=e.max??100,s=e.step??1,t=e.value??50,n=e.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${r}" max="${i}" step="${s}" value="${t}" ${n}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:(e,a)=>{let r=e.size||40,i=e.src,s=String(e.alt||""),t=e.fallback||(s?s.charAt(0).toUpperCase():"?");if(i)return`<img class="craft-avatar" src="${i}" alt="${s}" style="width:${r}px;height:${r}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${r}px;height:${r}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${t}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(e,a)=>{let r=Number(e.value)||0,i=Number(e.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,r/i*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(e,a)=>{let r=e.size||24;return`<div class="craft-spinner" style="width:${r}px;height:${r}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:(e,a)=>{let r=e.open?"open":"",i=e.title||"";return`<dialog class="craft-modal" ${r}>
|
|
@@ -947,7 +947,7 @@ ${r}`);return r+e}var qr={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
947
947
|
</details>`}},divider:{nativeType:"craft-divider",fallbackTag:"hr",fallbackClasses:"craft-divider",nativeProps:["orientation","variant"]},table:{nativeType:"craft-table",fallbackTag:"table",fallbackClasses:"craft-table",nativeProps:["columns","rows","sortable","selectable"]},list:{nativeType:"craft-list",fallbackTag:"ul",fallbackClasses:"craft-list",nativeProps:["items","selectable"]},tree:{nativeType:"craft-tree",fallbackTag:"div",fallbackClasses:"craft-tree",nativeProps:["nodes","expandable","selectable"]},alert:{nativeType:"craft-alert",fallbackTag:"div",fallbackClasses:"craft-alert",nativeProps:["variant","title","dismissible"],render:(e,a)=>{let r=e.variant||"info",i=e.title||"";return`<div class="craft-alert craft-alert-${r}" role="alert">
|
|
948
948
|
${i?`<div class="craft-alert-title">${i}</div>`:""}
|
|
949
949
|
<div class="craft-alert-content">${a}</div>
|
|
950
|
-
</div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,a)=>{let r=e.content||"",i=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${r}" data-position="${i}">${a}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:j},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:H},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:V},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:W},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,a)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,a)=>{let r=e.value||"",i=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${r}" min="${i}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,a)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},
|
|
950
|
+
</div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,a)=>{let r=e.content||"",i=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${r}" data-position="${i}">${a}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:j},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:H},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:V},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:W},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,a)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,a)=>{let r=e.value||"",i=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${r}" min="${i}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,a)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},Io=`
|
|
951
951
|
<style id="craft-component-styles">
|
|
952
952
|
/* Craft Component Base Styles */
|
|
953
953
|
.craft-button {
|
|
@@ -1469,7 +1469,7 @@ ${r}`);return r+e}var qr={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
1469
1469
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
1470
1470
|
})();
|
|
1471
1471
|
</script>
|
|
1472
|
-
`;function
|
|
1472
|
+
`;function Oo(e,a={}){let{classPrefix:r="craft"}=a;if(!e.includes("craft-component-styles"))if(e.includes("</head>"))e=e.replace("</head>",`${`
|
|
1473
1473
|
<style id="craft-component-styles">
|
|
1474
1474
|
/* Craft Component Base Styles */
|
|
1475
1475
|
.craft-button {
|
|
@@ -2934,7 +2934,7 @@ ${r}`);return r+e}var qr={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
2934
2934
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
2935
2935
|
})();
|
|
2936
2936
|
</script>
|
|
2937
|
-
`;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,s,t)=>R("sidebar",s,t.trim(),a,r)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,s)=>R("sidebar",s,"",a,r)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,s,t)=>R(s,t,"",a,r)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,s,t,n)=>R(s,t,n.trim(),a,r)),e}function R(e,a,r,i,s){let t=i.components?.[e]||
|
|
2937
|
+
`;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,s,t)=>R("sidebar",s,t.trim(),a,r)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,s)=>R("sidebar",s,"",a,r)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,s,t)=>R(s,t,"",a,r)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,s,t,n)=>R(s,t,n.trim(),a,r)),e}function R(e,a,r,i,s){let t=i.components?.[e]||Xr[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${r}</div>`;let n=A(a),c=[t.fallbackClasses||`${s}-${e}`];if(n.class)c.push(n.class),delete n.class;if(t.render)return n.__fallbackClasses=c.join(" "),t.render(n,r);let d=ee(n,t,c);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${d}>`;return`<${t.fallbackTag} ${d}>${r}</${t.fallbackTag}>`}function A(e){let a={},r=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=r.exec(e))!==null){let[s,t,n,c]=i,d=n??c;if(s.startsWith(":"))a[t]=d;else if(s.startsWith("@"))a[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=d;else if(d===void 0)a[t]=!0;else a[t]=d}return a}function j(e,a){let r=I(String(e.id||`craft-sidebar-${K(a||JSON.stringify(e))}`)),i=Q(e.spaces)||Y(a),s=i.length?[]:X(e.sections)||D(a),t=String(e.selectedSpace||i[0]?.id||""),n=i.find((m)=>m.id===t)||i[0],c=String(e.selectedItem||e.selected||(i.length?n?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),d={id:r,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:c,sections:s,spaces:i,selectedSpace:t||void 0},l=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),b=Number(e.width||e.sidebarWidth||286),f=e.native===!1||e.native==="false"?"false":"true",x=d.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${C(d.searchPlaceholder)}"></div>`:"",p;if(i.length)p=G(i,t,c);else if(s.length)p=s.map((m)=>O(m,c)).join("");else p=a;return`<aside class="${h(l)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${h(r)}" data-native="${f}" style="--craft-sidebar-width:${b}px">
|
|
2938
2938
|
${x}
|
|
2939
2939
|
${p}
|
|
2940
2940
|
</aside>
|
|
@@ -2955,7 +2955,7 @@ ${r}`);return r+e}var qr={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
2955
2955
|
${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${h(e.icon)}"${r}></span>`:""}
|
|
2956
2956
|
<span class="craft-sidebar-item-label">${C(e.label)}</span>
|
|
2957
2957
|
${e.badge?`<span class="craft-sidebar-item-badge">${C(e.badge)}</span>`:""}
|
|
2958
|
-
</button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function K(e){let a=5381;for(let r=0;r<e.length;r++)a=a*33^e.charCodeAt(r);return(a>>>0).toString(36)}function C(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function h(e){return C(e).replace(/`/g,"`")}function Z(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ee(e,a,r){let i=[];i.push(`class="${r.join(" ")}"`),i.push(`data-craft="${a.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)i.push(s);else if(t!==!1&&t!==void 0&&t!==null){let n=String(t).replace(/"/g,""");i.push(`${s}="${n}"`)}return i.join(" ")}function Pd(e,a){
|
|
2958
|
+
</button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function K(e){let a=5381;for(let r=0;r<e.length;r++)a=a*33^e.charCodeAt(r);return(a>>>0).toString(36)}function C(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function h(e){return C(e).replace(/`/g,"`")}function Z(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ee(e,a,r){let i=[];i.push(`class="${r.join(" ")}"`),i.push(`data-craft="${a.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)i.push(s);else if(t!==!1&&t!==void 0&&t!==null){let n=String(t).replace(/"/g,""");i.push(`${s}="${n}"`)}return i.join(" ")}function Pd(e,a){Xr[e]=a}function Id(){return{...Xr}}async function Do(e){let a=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||P(),format:e.format||"app",error:`Input file not found: ${e.input}`};let r=e.target||P(),i=e.format||pe(r),s=e.output||o(process.cwd(),"dist","native");if(!M(s))v(s,{recursive:!0});let t=await Bo(e.input,{context:e.context,options:{isDev:!1}});if(t=Po(t,{debug:e.verbose}),t=Oo(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${Io}
|
|
2959
2959
|
</head>`)}let n=e.name||te(e.input,".stx"),c=e.version||"1.0.0",d=e.craftPath||await fe();if(!d)return{success:!1,target:r,format:i,error:"Craft binary not found. Please install Craft or specify craftPath."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${r}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${d}`);let l;switch(r){case"macos":l=await ie(t,n,c,s,i,e,d);break;case"windows":l=await oe(t,n,c,s,i,e,d);break;case"linux":l=await ce(t,n,c,s,i,e,d);break;case"ios":l=await de(t,n,c,s,e,d);break;case"android":l=await le(t,n,c,s,e,d);break;default:l={success:!1,target:r,format:i,error:`Unsupported target: ${r}`}}return l.duration=Date.now()-a,l}catch(r){return{success:!1,target:e.target||P(),format:e.format||"app",error:r.message,duration:Date.now()-a}}}async function ie(e,a,r,i,s,t,n){let c=t.bundleId||`com.stx.${a.toLowerCase().replace(/[^a-z0-9]/g,"")}`,d=o(i,`${a}.app`),l=o(d,"Contents"),b=o(l,"MacOS"),f=o(l,"Resources");v(b,{recursive:!0}),v(f,{recursive:!0});let x=o(f,"index.html");await Bun.write(x,e);let p="";if(t.sidebar?.enabled&&t.sidebar?.config)p=o(f,"sidebar-config.json"),await Bun.write(p,JSON.stringify(t.sidebar.config));let m=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",y=t.menubarOnly??t.systemTray;if((t.bundleStyle||(await se(n)?"executable":"launcher"))==="executable"){let S=o(b,a);k(n,S),T(S,493);let w={html:"index.html",title:t.window?.title||a,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(y)w.menubarOnly=!0;else if(t.systemTray)w.systemTray=!0;if(t.window?.frameless)w.frameless=!0;if(t.window?.transparent)w.transparent=!0;if(t.window?.alwaysOnTop)w.alwaysOnTop=!0;if(t.window?.resizable===!1)w.resizable=!1;await Bun.write(o(f,"craft.json"),`${JSON.stringify(w,null,2)}
|
|
2960
2960
|
`)}else{let S=o(b,"craft");k(n,S),T(S,493);let w=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",U=`#!/bin/bash
|
|
2961
2961
|
set -euo pipefail
|
|
@@ -2997,7 +2997,7 @@ Exec=${f}
|
|
|
2997
2997
|
Terminal=false
|
|
2998
2998
|
Categories=Utility;
|
|
2999
2999
|
`;if(await Bun.write(o(c,`${a.toLowerCase()}.desktop`),x),s==="deb"){let p=o(i,`${a.toLowerCase()}_${r}_amd64.deb`),m=await ge(c,p,a,r,t);if(!m.success)return{success:!1,target:"linux",format:"deb",error:m.error};return{success:!0,target:"linux",format:"deb",outputPath:p}}if(s==="appimage"){let p=o(i,`${a}-${r}-x86_64.AppImage`),m=await me(c,p,a,t);if(!m.success)return{success:!1,target:"linux",format:"appimage",error:m.error};return{success:!0,target:"linux",format:"appimage",outputPath:p}}return{success:!0,target:"linux",format:"app",outputPath:c}}async function de(e,a,r,i,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${a}' to create an iOS project.`}}async function le(e,a,r,i,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${a}' to create an Android project.`}}async function fe(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let e=[o(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),o(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),o(B(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),o(B(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",o(B(),".local/bin/craft"),o(process.env.LOCALAPPDATA||"","craft","craft.exe"),o(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let a of e)if(await Bun.file(a).exists())return a;try{let r=ae("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
|
|
3000
|
-
`)[0];if(r&&await Bun.file(r).exists())return r}catch{}return null}function P(){switch(re()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function pe(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function ue(e,a,r){return new Promise((i)=>{let s=E("hdiutil",["create","-volname",r,"-srcfolder",e,"-ov","-format","UDZO",a]);s.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{i({success:!1,error:t.message})})})}async function be(e,a){return new Promise((r)=>{let i=E("zip",["-r",a,"."],{cwd:e});i.on("close",(s)=>{if(s===0)r({success:!0});else r({success:!1,error:`zip exited with code ${s}`})}),i.on("error",(s)=>{r({success:!1,error:s.message})})})}async function ge(e,a,r,i,s){return new Promise((t)=>{let n=
|
|
3000
|
+
`)[0];if(r&&await Bun.file(r).exists())return r}catch{}return null}function P(){switch(re()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function pe(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function ue(e,a,r){return new Promise((i)=>{let s=E("hdiutil",["create","-volname",r,"-srcfolder",e,"-ov","-format","UDZO",a]);s.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{i({success:!1,error:t.message})})})}async function be(e,a){return new Promise((r)=>{let i=E("zip",["-r",a,"."],{cwd:e});i.on("close",(s)=>{if(s===0)r({success:!0});else r({success:!1,error:`zip exited with code ${s}`})}),i.on("error",(s)=>{r({success:!1,error:s.message})})})}async function ge(e,a,r,i,s){return new Promise((t)=>{let n=Le("deb");try{let c=o(n,"pkg"),d=o(c,"DEBIAN"),l=o(c,"usr","bin"),b=o(c,"usr","share","applications"),f=o(c,"usr","share",r.toLowerCase());v(d,{recursive:!0}),v(l,{recursive:!0}),v(b,{recursive:!0}),v(f,{recursive:!0});let x=u("fs").readdirSync(e);for(let g of x)k(o(e,g),o(f,g));let p=`#!/bin/bash
|
|
3001
3001
|
exec /usr/share/${r.toLowerCase()}/${r.toLowerCase()} "$@"`;u("fs").writeFileSync(o(l,r.toLowerCase()),p),T(o(l,r.toLowerCase()),493);let m=`Package: ${r.toLowerCase()}
|
|
3002
3002
|
Version: ${i}
|
|
3003
3003
|
Section: utils
|
|
@@ -3006,7 +3006,7 @@ Architecture: amd64
|
|
|
3006
3006
|
Depends: libgtk-3-0, libwebkit2gtk-4.0-37
|
|
3007
3007
|
Maintainer: ${s.author||"Unknown"}
|
|
3008
3008
|
Description: ${s.description||r}
|
|
3009
|
-
`;u("fs").writeFileSync(o(d,"control"),m);let y=E("dpkg-deb",["--build",c,a]);y.on("close",(g)=>{if(q(n),g===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${g}`})}),y.on("error",(g)=>{q(n),t({success:!1,error:g.message})})}catch(c){q(n),t({success:!1,error:c.message})}})}async function me(e,a,r,i){return new Promise((s)=>{let t=
|
|
3009
|
+
`;u("fs").writeFileSync(o(d,"control"),m);let y=E("dpkg-deb",["--build",c,a]);y.on("close",(g)=>{if(q(n),g===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${g}`})}),y.on("error",(g)=>{q(n),t({success:!1,error:g.message})})}catch(c){q(n),t({success:!1,error:c.message})}})}async function me(e,a,r,i){return new Promise((s)=>{let t=Le("appimage");try{let n=o(t,`${r}.AppDir`),c=o(n,"usr"),d=o(c,"bin"),l=o(c,"share");v(d,{recursive:!0}),v(l,{recursive:!0});let b=o(l,r.toLowerCase());v(b,{recursive:!0});let f=u("fs").readdirSync(e);for(let g of f)k(o(e,g),o(b,g));let x=`#!/bin/bash
|
|
3010
3010
|
SELF=$(readlink -f "$0")
|
|
3011
3011
|
HERE=\${SELF%/*}
|
|
3012
3012
|
export PATH="\${HERE}/usr/bin:\${PATH}"
|
|
@@ -3018,5 +3018,5 @@ Exec=${r.toLowerCase()}
|
|
|
3018
3018
|
Terminal=false
|
|
3019
3019
|
Categories=Utility;
|
|
3020
3020
|
Icon=${r.toLowerCase()}
|
|
3021
|
-
`;u("fs").writeFileSync(o(n,`${r.toLowerCase()}.desktop`),p);let m=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(u("fs").writeFileSync(o(n,`${r.toLowerCase()}.png`),m),i.icon&&M(i.icon))k(i.icon,o(n,`${r.toLowerCase()}.png`));let y=E("appimagetool",[n,a],{env:{...process.env,ARCH:"x86_64"}});y.on("close",(g)=>{if(q(t),g===0)T(a,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${g}. Install from https://appimage.github.io/appimagetool/`})}),y.on("error",(g)=>{q(t),s({success:!1,error:`appimagetool not found: ${g.message}`})})}catch(n){q(t),s({success:!1,error:n.message})}})}function
|
|
3022
|
-
export{Td,
|
|
3021
|
+
`;u("fs").writeFileSync(o(n,`${r.toLowerCase()}.desktop`),p);let m=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(u("fs").writeFileSync(o(n,`${r.toLowerCase()}.png`),m),i.icon&&M(i.icon))k(i.icon,o(n,`${r.toLowerCase()}.png`));let y=E("appimagetool",[n,a],{env:{...process.env,ARCH:"x86_64"}});y.on("close",(g)=>{if(q(t),g===0)T(a,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${g}. Install from https://appimage.github.io/appimagetool/`})}),y.on("error",(g)=>{q(t),s({success:!1,error:`appimagetool not found: ${g.message}`})})}catch(n){q(t),s({success:!1,error:n.message})}})}function Mo(){return[P()]}function No(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var he={buildNative:Do,getAvailableTargets:Mo,getAvailableFormats:No,detectPlatform:P},Od=he;
|
|
3022
|
+
export{Td,Ao,$d,Rd,Po,Xr,Io,Ad,Oo,Pd,Id,Do,Mo,No,Od};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{N,ue}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{N,ue}from"./chunk-g8dx2jew.js";import{fe,C,Ye}from"./chunk-vde4mtfr.js";import{nt,Z,Ee}from"./chunk-gdxhe7ae.js";import{Oe,se,T,oe,vo,Ir,xo,jt}from"./chunk-8hp6722y.js";import{es}from"./chunk-sej3ng5k.js";import{Bt}from"./chunk-p3xkj7pm.js";import K from"fs";import A from"path";var{serve:me}=globalThis.Bun;import F from"zlib";import{promisify as Q}from"util";var ee=Q(F.brotliCompress),te=Q(F.gzip),ne=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],re=["text/event-stream","multipart/x-mixed-replace"],ae=1024;function ie(t){if(!t)return!1;let e=t.toLowerCase();if(re.some((o)=>e.startsWith(o)))return!1;return ne.some((o)=>e.startsWith(o))}function ce(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function pe(t){if(!t)return null;let e=ce(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function le(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=Y)break;H.delete(o),U-=r.length}}async function Nt(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ie(e.headers.get("content-type")))return e;let r=pe(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??ae))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await ee(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await te(a),le(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new N(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",T(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${se(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let S=new Headers(s.headers);return S.set("Cache-Control","private, no-store"),S.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:S})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let b=this.generation,k=async()=>{let s=await o();r=s;let S=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||S.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let B=await s.clone().arrayBuffer();if(B.byteLength>1048576)return null;s.headers.set("Vary",T(s.headers.get("Vary")).Vary);let n={body:B,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===b)this.entries.set(h,n);return n},v=this.pending.get(h);if(!v){if(this.pending.size>=1000)return a();v=k().finally(()=>{if(this.pending.get(h)===v)this.pending.delete(h)}),this.pending.set(h,v)}if(g&&m<e.maxAge+(e.swr??0))return v.catch(()=>{}),l(g);let E=await v;return E?l(E):a()}}var de={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function al(t={}){let e=A.resolve(t.outputDir||".output"),o=t.port??3000,r=vo(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=Bt(r.routeRules),f=new G,h=es(e,r.apiRoutes??[]),g=Bun.file(A.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?C(l):void 0,b=new Map,k=new Map,v=new Map,E=new Map;for(let n of r.routes)try{let y=A.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Ye(i.html,m);b.set(n.pattern,i),v.set(n.pattern,Ee(i.html)),E.set(n.pattern,ue(i.html));let X=A.join(e,n.fragmentPath);if(await Bun.file(X).exists()){let M=await Bun.file(X).text();k.set(n.pattern,m?Ye(M,m):M)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,S=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=Z(n.pattern,{page:!0});S.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let B=me({port:o,async fetch(n){return Nt(n,await fe(m??C(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=A.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=A.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${A.sep}`))try{if(K.existsSync(u)&&K.statSync(u).isFile()){let R=A.extname(u).toLowerCase(),L=de[R]||"application/octet-stream",_=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let M=se(n),w=null,q={};if(w=s.get(i)||null,!w)for(let{regex:p,route:d,paramNames:u}of S){let c=i.match(p);if(c){w=d,u.forEach((R,L)=>{q[R]=c[L+1]});break}}if(!w){let p=nt(i)?null:s.get("/404")||null;if(p){let d=b.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=a(i),W=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=b.get(w.pattern);if(M&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=k.get(w.pattern);if(c){let R=v.get(w.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...E.has(w.pattern)?{"X-STX-Runtime":E.get(w.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...T(),...O.cache?{}:{"Cache-Control":Oe}}})}}let d=Ir(n.method),u=b.get(w.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=b.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(w.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...T(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:L,cookies:_,status:I,headers:D}=await jt(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return xo(L,_,D);if(R&&R.length>0){let{renderStreamingPage:P,streamToResponse:z}=await import("./chunk-y7vbwhh7.js"),j=new Headers({...T(),...D,"Cache-Control":"private, no-store"});for(let V of _??[])j.append("Set-Cookie",V);if(M&&!d){let V=Ee(c);j.set("X-STX-Fragment","true"),j.set("X-STX-Runtime",ue(c)?"true":"false"),j.set("X-STX-Layout",V.layout),j.set("X-STX-Layout-Group",V.group)}return z(P(M&&!d?oe(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:j})}let x=new Headers({"Content-Type":"text/html",...T(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let P of _??[])x.append("Set-Cookie",P);for(let[P,z]of Object.entries(D??{}))x.set(P,z);if(x.set("Vary",T(x.get("Vary")).Vary),M&&!d){let P=Ee(c);return x.set("X-STX-Fragment","true"),x.set("X-STX-Runtime",ue(c)?"true":"false"),x.set("X-STX-Layout",P.layout),x.set("X-STX-Layout-Group",P.group),new Response(oe(c,r.routerContainer||"main"),{status:I??u.status??200,headers:x})}return new Response(c,{status:I??u.status??200,headers:x})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${B.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:B.port,stop:()=>{f.invalidate(),B.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
|
+
export{Nt,al};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function E(){let{NODE_ENV:n}=process.env;return n==="production"}function M(){let{STX_DEBUG:n}=process.env;return!E()||n==="true"}function
|
|
3
|
-
export{E,M,
|
|
2
|
+
function E(){let{NODE_ENV:n}=process.env;return n==="production"}function M(){let{STX_DEBUG:n}=process.env;return!E()||n==="true"}function Cn(){let{NODE_ENV:n}=process.env;return n==="test"}function Us(n){return n==="compile"||E()}function _n(n){if(!n)return n;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(n).trim()}catch{return n}}
|
|
3
|
+
export{E,M,Cn,Us,_n};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Vr,Ul,Vl}from"./chunk-1n9bxdnh.js";import"./chunk-n8hnrgen.js";import"./chunk-sej3ng5k.js";import"./chunk-3kc7af8c.js";import"./chunk-g8dx2jew.js";import"./chunk-cp5903cg.js";import"./chunk-7hr63cp5.js";import"./chunk-550q827h.js";import"./chunk-ta50ym5j.js";import"./chunk-vde4mtfr.js";import"./chunk-nc0ba89b.js";import"./chunk-3dr757vb.js";import"./chunk-yf90vn5t.js";import"./chunk-4xvbc0mb.js";import"./chunk-hq8vxds5.js";import"./chunk-gdxhe7ae.js";import"./chunk-nxw03sy9.js";export{Vl as clearComposableCache,Ul as getComposableScript,Vr as listComposableModules};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import m from"path";var y=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function I(...o){let r=new Set;for(let s of o){if(!s||!s.includes("__stxModules["))continue;for(let e of s.matchAll(y))try{r.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...r].sort()}async function w(o,r={}){if(o.length===0)return null;let s=process.cwd(),e=[],a=[];o.forEach((t,c)=>{let i=t.startsWith("npm:")?t.slice(4):m.resolve(s,t),l=`__stxRegistered${c}`,p=JSON.stringify(t);e.push(`import * as ${l} from ${JSON.stringify(i)};`),a.push(`if (!globalThis.__stxModules[${p}]) globalThis.__stxModules[${p}] = ${l};`)});let d=[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...a].join(`
|
|
3
|
-
`),n;try{let{bundleClientScript:t}=await import("./chunk-
|
|
3
|
+
`),n;try{let{bundleClientScript:t}=await import("./chunk-e23cg45k.js");n=await t(d,m.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:r.minify,externalizeUserModules:!1,collectInputs:r.collectInputs,throwOnFailure:!0})}catch(t){let{formatBuildFailure:c}=await import("./chunk-5n2v9g2c.js"),i=c(t);console.warn(`[stx] could not build the page module registry (#1957): ${i}`);let l=`[stx] the page module registry did not build, so ${o.join(", ")} cannot load (#1957): ${i}`;return`;console.error(${JSON.stringify(l)});`}let{transformAutoImports:f,generateAutoImportDestructuring:_}=await import("./chunk-r8qhex33.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-f1zyc84x.js");n=x(u.code);let g=JSON.stringify(new Bun.CryptoHasher("md5").update(d).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${g}]) return;`,` __stxBundles[${g}] = true;`,h,n,"})();"].join(`
|
|
4
4
|
`)}export{w as buildModuleRegistryScript,I as registeredModuleIdsIn};
|