@stacksjs/stx 0.2.563 → 0.2.565
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/app-shell.d.ts +3 -0
- package/dist/app-shell.js +27 -3
- package/dist/{chunk-2tm3vzm7.js → chunk-01s01ten.js} +5 -5
- package/dist/chunk-04qvjcsr.js +2 -0
- package/dist/chunk-125rc958.js +3 -0
- package/dist/chunk-15g5sc0p.js +3 -0
- package/dist/{chunk-171xv81z.js → chunk-18270qgd.js} +2 -2
- package/dist/{chunk-g6cwhsb4.js → chunk-1hrj0t0j.js} +11 -11
- package/dist/chunk-1zfg1kd5.js +2 -0
- package/dist/chunk-203rr1c8.js +3 -0
- package/dist/{chunk-xb739v4r.js → chunk-2ernwctg.js} +6 -6
- package/dist/chunk-2xbrrc5a.js +2 -0
- package/dist/chunk-2yypassp.js +2 -0
- package/dist/{chunk-fgmv8f14.js → chunk-325p135t.js} +12 -12
- package/dist/{chunk-v1m9nrn9.js → chunk-36aj0yzt.js} +1 -1
- package/dist/chunk-375skn32.js +2 -0
- package/dist/{chunk-qmza4327.js → chunk-39tkfkp7.js} +3 -3
- package/dist/{chunk-jjwg83xv.js → chunk-3hkv4e7t.js} +1 -1
- package/dist/chunk-3wyxe996.js +2 -0
- package/dist/chunk-4mmdpb46.js +2 -0
- package/dist/chunk-4q5d5r7s.js +2 -0
- package/dist/{chunk-mtdx75j5.js → chunk-4zb2ga7p.js} +2 -2
- package/dist/{chunk-vb1w9wy4.js → chunk-55hfvmvv.js} +13 -13
- package/dist/{chunk-7t05bpf7.js → chunk-5grx48s2.js} +2 -2
- package/dist/{chunk-7wfh2hqy.js → chunk-5s555c1r.js} +4 -4
- package/dist/chunk-5ytg0wbc.js +2 -0
- package/dist/{chunk-8227vfw0.js → chunk-68b64sj4.js} +1 -1
- package/dist/chunk-6qyters0.js +2 -0
- package/dist/{chunk-6bxy1b9q.js → chunk-6sf4v894.js} +5 -5
- package/dist/{chunk-yp00nht2.js → chunk-6vnnx536.js} +2 -2
- package/dist/chunk-6yn90mq9.js +2 -0
- package/dist/chunk-7d2vyre0.js +2 -0
- package/dist/{chunk-r4199q6x.js → chunk-7m0r2qs2.js} +2 -2
- package/dist/chunk-7pewegtw.js +2 -0
- package/dist/chunk-7w0qa3n0.js +2 -0
- package/dist/{chunk-5fx8m234.js → chunk-7wyyjdks.js} +2 -2
- package/dist/{chunk-nd8v4xgb.js → chunk-7ze47qgv.js} +5 -5
- package/dist/{chunk-x8rx0s3h.js → chunk-8afnq4qx.js} +3 -3
- package/dist/{chunk-gxtk4fbm.js → chunk-8cpqy9ea.js} +1726 -1726
- package/dist/{chunk-97vj2cqz.js → chunk-8cs45k3f.js} +3 -3
- package/dist/chunk-8d788kvt.js +2 -0
- package/dist/{chunk-s040j1bv.js → chunk-8nr1kras.js} +6 -6
- package/dist/{chunk-912cj8pq.js → chunk-8txqk9nq.js} +2 -2
- package/dist/chunk-90qywh24.js +31 -0
- package/dist/{chunk-nda4xq79.js → chunk-9tcvkbb5.js} +2 -2
- package/dist/{chunk-vpmb8gcc.js → chunk-9ya4tdpz.js} +4 -4
- package/dist/{chunk-n1cqg89v.js → chunk-b76jbdtk.js} +2 -2
- package/dist/chunk-bdhtq3vs.js +2 -0
- package/dist/chunk-brnapchc.js +2 -0
- package/dist/chunk-c765y72x.js +18 -0
- package/dist/chunk-c78327kx.js +2 -0
- package/dist/chunk-cbyh8fhn.js +4 -0
- package/dist/chunk-d19w3e4x.js +2 -0
- package/dist/{chunk-jen9yg68.js → chunk-d1mqedk0.js} +7 -7
- package/dist/{chunk-6v1gwdbv.js → chunk-d4ybwtqt.js} +2 -2
- package/dist/chunk-da649d3k.js +2 -0
- package/dist/chunk-da9avgd9.js +2 -0
- package/dist/chunk-dkyjw3hc.js +3 -0
- package/dist/{chunk-ff61d2wr.js → chunk-dmf1jmge.js} +3 -3
- package/dist/chunk-e3njkecx.js +2 -0
- package/dist/chunk-efzc1nw8.js +2 -0
- package/dist/{chunk-h23bjqn1.js → chunk-ev3qnr9q.js} +31 -31
- package/dist/{chunk-y0pbnxjg.js → chunk-f46a7pvn.js} +2 -2
- package/dist/{chunk-azb58ven.js → chunk-ffxwsa94.js} +2 -2
- package/dist/chunk-fm4w1r9e.js +2 -0
- package/dist/{chunk-8jc86h7n.js → chunk-fpa1nq88.js} +2 -2
- package/dist/{chunk-tc2z8t2q.js → chunk-g1epk002.js} +5 -5
- package/dist/{chunk-8a4g0mex.js → chunk-g8tx0yf8.js} +7 -7
- package/dist/chunk-gan95hj0.js +2 -0
- package/dist/{chunk-e124cgb6.js → chunk-ghnkphy4.js} +2 -2
- package/dist/{chunk-m5fw8jq1.js → chunk-gjx5256r.js} +5 -5
- package/dist/chunk-hg7amzgz.js +2 -0
- package/dist/chunk-hmk7z0z6.js +2 -0
- package/dist/chunk-hn105xy3.js +2 -0
- package/dist/{chunk-8nwzd6eg.js → chunk-jbmhdyzz.js} +3 -3
- package/dist/chunk-jq079mrx.js +2 -0
- package/dist/chunk-jr149mmp.js +2 -0
- package/dist/{chunk-v79qs0qh.js → chunk-jra9r8fq.js} +1 -1
- package/dist/{chunk-zmq9hwta.js → chunk-k2dgwy05.js} +2 -2
- package/dist/chunk-k50k9zbw.js +2 -0
- package/dist/{chunk-xab6b4mt.js → chunk-kch9a9v1.js} +2 -2
- package/dist/chunk-kwxy0e3r.js +2 -0
- package/dist/chunk-kza3nxr0.js +2 -0
- package/dist/{chunk-g12j8ahm.js → chunk-m6m19hwd.js} +4 -4
- package/dist/{chunk-a5kaw8sc.js → chunk-m8qgr307.js} +8 -8
- package/dist/chunk-m9cmc6np.js +2 -0
- package/dist/chunk-m9r4x7e6.js +2 -0
- package/dist/chunk-mahv855w.js +2 -0
- package/dist/{chunk-27t55gtk.js → chunk-mb59b499.js} +6 -6
- package/dist/chunk-mbwdn96z.js +2 -0
- package/dist/chunk-mdxg95mq.js +2 -0
- package/dist/{chunk-2m91qmby.js → chunk-mm1vvk49.js} +5 -5
- package/dist/chunk-mqje968d.js +2 -0
- package/dist/{chunk-pp9jgyb6.js → chunk-mt8sew7a.js} +10 -10
- package/dist/{chunk-7gdvp6py.js → chunk-n1xcmhjw.js} +3 -3
- package/dist/chunk-n2g9mj2h.js +2 -0
- package/dist/chunk-n2nha538.js +2 -0
- package/dist/{chunk-f92hq39b.js → chunk-n6va14bt.js} +2 -2
- package/dist/chunk-nebw444s.js +2 -0
- package/dist/{chunk-gbx3gx8a.js → chunk-nm0y4qjg.js} +4 -4
- package/dist/chunk-nmt7kw0e.js +2 -0
- package/dist/chunk-pq8mz4ma.js +2 -0
- package/dist/chunk-pxcmv1xz.js +2 -0
- package/dist/chunk-pxes1ft6.js +2 -0
- package/dist/{chunk-v09hk0j6.js → chunk-pzasxhwz.js} +1 -1
- package/dist/{chunk-v2b8pa86.js → chunk-q94wdmdp.js} +3 -3
- package/dist/chunk-qajc13zq.js +2 -0
- package/dist/{chunk-1c4t7ncb.js → chunk-qj4j547f.js} +2 -2
- package/dist/chunk-qtnqmw1n.js +2 -0
- package/dist/chunk-r3zdgeah.js +2 -0
- package/dist/{chunk-4r7s3862.js → chunk-r47cs92n.js} +2 -2
- package/dist/chunk-r5htacg5.js +2 -0
- package/dist/chunk-rf2rwddd.js +2 -0
- package/dist/{chunk-1xgs9gd5.js → chunk-rgage0vm.js} +2 -2
- package/dist/{chunk-1zeqghsw.js → chunk-s1xxkzc9.js} +9 -9
- package/dist/chunk-s833fbvf.js +2 -0
- package/dist/{chunk-tqnh98j7.js → chunk-saf7kypg.js} +3 -3
- package/dist/chunk-sgvszh9s.js +2 -0
- package/dist/{chunk-emta09j6.js → chunk-ss78553t.js} +1 -1
- package/dist/chunk-t5r3s1wj.js +2 -0
- package/dist/{chunk-bqdsc6rm.js → chunk-tc01jkfc.js} +1 -1
- package/dist/{chunk-p2mxsjv1.js → chunk-tfeenp4h.js} +10 -10
- package/dist/chunk-tjprg6kq.js +2 -0
- package/dist/{chunk-hj67a88k.js → chunk-tsmbstj6.js} +7 -7
- package/dist/chunk-v0dzrwg8.js +2 -0
- package/dist/chunk-vtz9empe.js +2 -0
- package/dist/chunk-wa6nzq5b.js +2 -0
- package/dist/{chunk-3nc2fr4q.js → chunk-wm11csdm.js} +2 -2
- package/dist/{chunk-xj45mw7v.js → chunk-wsdn5fxe.js} +3 -3
- package/dist/{chunk-ah7h9q0x.js → chunk-wwn9dh6p.js} +2 -2
- package/dist/{chunk-yn3kp3qy.js → chunk-wy4hfmjs.js} +5 -5
- package/dist/{chunk-qfc912e5.js → chunk-xfpfs9zq.js} +2 -2
- package/dist/chunk-xw8kzm6b.js +2834 -0
- package/dist/chunk-xyhg70x9.js +63 -0
- package/dist/{chunk-w8q1xp9e.js → chunk-ymdy7b8z.js} +2 -2
- package/dist/chunk-ytdzgctp.js +2 -0
- package/dist/{chunk-wk85dz07.js → chunk-z06npyzn.js} +3 -3
- package/dist/chunk-z2n1rtj5.js +2 -0
- package/dist/cli.js +22 -22
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/database.js +2 -2
- package/dist/native/components/primitives.d.ts +20 -4
- package/dist/native/index.d.ts +3 -0
- package/dist/native/primitives/Map.stx +2 -1
- package/dist/native/prop-names.js +3 -0
- package/dist/native/runtime/craft-bridge.js +24 -11
- package/dist/native/runtime/craft.d.ts +6 -5
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +11 -11
- package/dist/stx.d.ts +1 -1028
- package/dist/variable-extractor.js +2 -2
- package/package.json +5 -5
- package/stx.d.ts +2 -0
- package/dist/chunk-00dp53cx.js +0 -2
- package/dist/chunk-0pvn63x7.js +0 -2
- package/dist/chunk-0vpmdhfm.js +0 -2
- package/dist/chunk-10jwyvm0.js +0 -2
- package/dist/chunk-1ena03xn.js +0 -2
- package/dist/chunk-2bpj2dsh.js +0 -2
- package/dist/chunk-31ez1sq0.js +0 -2
- package/dist/chunk-3m2h76cz.js +0 -2
- package/dist/chunk-3n26hf93.js +0 -2
- package/dist/chunk-3nk8cnrm.js +0 -3
- package/dist/chunk-3tccqahy.js +0 -2
- package/dist/chunk-40fqmb3q.js +0 -2
- package/dist/chunk-45tq56qf.js +0 -2
- package/dist/chunk-46wykvrs.js +0 -2
- package/dist/chunk-4cmqjmqr.js +0 -3
- package/dist/chunk-56mkcxvb.js +0 -2
- package/dist/chunk-56wcmck6.js +0 -2
- package/dist/chunk-5eyf2zeg.js +0 -2
- package/dist/chunk-68ph8r20.js +0 -2
- package/dist/chunk-6bcvd3pg.js +0 -2
- package/dist/chunk-6n8jzdnm.js +0 -18
- package/dist/chunk-6va8wt88.js +0 -2
- package/dist/chunk-7acxdp9r.js +0 -2
- package/dist/chunk-7h324n17.js +0 -2
- package/dist/chunk-8fpz04kx.js +0 -2
- package/dist/chunk-8fwczr4s.js +0 -63
- package/dist/chunk-9skdekv5.js +0 -2
- package/dist/chunk-c3v5zmnq.js +0 -2
- package/dist/chunk-ce7zwt4v.js +0 -2
- package/dist/chunk-cp4dr9ch.js +0 -2
- package/dist/chunk-d7mfkc61.js +0 -2
- package/dist/chunk-d8fhthyf.js +0 -2
- package/dist/chunk-dekpf1ry.js +0 -2
- package/dist/chunk-dyavx9a1.js +0 -2
- package/dist/chunk-dz7v901d.js +0 -2
- package/dist/chunk-e099d50m.js +0 -2
- package/dist/chunk-e473tm1d.js +0 -2
- package/dist/chunk-eeadhr78.js +0 -2
- package/dist/chunk-evwj0k99.js +0 -2834
- package/dist/chunk-f11sx09b.js +0 -3
- package/dist/chunk-fdkyvr7y.js +0 -2
- package/dist/chunk-fqge0zn8.js +0 -2
- package/dist/chunk-fz7dxc1q.js +0 -2
- package/dist/chunk-hp8g2q2n.js +0 -2
- package/dist/chunk-hpeg9erh.js +0 -3
- package/dist/chunk-hv2kxb94.js +0 -2
- package/dist/chunk-j9c0yam7.js +0 -2
- package/dist/chunk-k9nd7z8j.js +0 -2
- package/dist/chunk-m7jmpech.js +0 -2
- package/dist/chunk-m7ktr4xn.js +0 -2
- package/dist/chunk-mjdyyekx.js +0 -4
- package/dist/chunk-njrakvz7.js +0 -2
- package/dist/chunk-nr5jf1hp.js +0 -2
- package/dist/chunk-qd7bqhm3.js +0 -2
- package/dist/chunk-qprkb5qe.js +0 -2
- package/dist/chunk-schxd5k5.js +0 -2
- package/dist/chunk-sn5c0x7q.js +0 -2
- package/dist/chunk-sx4wmprc.js +0 -2
- package/dist/chunk-t94z65ry.js +0 -2
- package/dist/chunk-vakryadj.js +0 -2
- package/dist/chunk-vgge9rf4.js +0 -2
- package/dist/chunk-w36w5jgs.js +0 -30
- package/dist/chunk-wzymzex7.js +0 -2
- package/dist/chunk-x07x8hzs.js +0 -2
- package/dist/chunk-z9q5p39g.js +0 -2
- package/dist/chunk-zfypzka2.js +0 -2
- package/dist/chunk-zh0jbzvk.js +0 -2
- package/dist/chunk-zpf9he2x.js +0 -2
- package/dist/chunk-zpftj8s8.js +0 -2
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import S from"fs";import _ from"path";function
|
|
2
|
+
import S from"fs";import _ from"path";function kr(e){let{token:t,baseUrl:i="https://api.netlify.com/api/v1"}=e;async function s(n,r,l={}){let p=`${i}${r}`,f={Authorization:`Bearer ${t}`,"User-Agent":"stx-deploy/1.0"},u;if(l.rawBody)f["Content-Type"]=l.contentType||"application/octet-stream",u=l.rawBody;else if(l.body)f["Content-Type"]="application/json",u=JSON.stringify(l.body);let o=await fetch(p,{method:n,headers:f,body:u});if(!o.ok){let g=Error(`Netlify API error: ${o.status} ${o.statusText}`);g.status=o.status;try{let b=await o.json();g.message=b.message||g.message,g.code=b.code,g.details=b}catch{}throw g}let a=await o.text();if(!a)return{};return JSON.parse(a)}return{async getSite(n){return s("GET",`/sites/${n}`)},async listSites(){return s("GET","/sites")},async createSite(n){let r={};if(n)r.name=n;return s("POST","/sites",{body:r})},async createDeploy(n,r){let l={files:r.files,draft:r.draft??!0,async:r.async??!0};if(r.title)l.title=r.title;if(r.branch)l.branch=r.branch;if(r.functions)l.functions=r.functions;return s("POST",`/sites/${n}/deploys`,{body:l})},async uploadFile(n,r,l){let p=r.startsWith("/")?r.slice(1):r;await s("PUT",`/deploys/${n}/files/${p}`,{rawBody:l,contentType:"application/octet-stream"})},async uploadFiles(n,r){let p=[...r],f=async()=>{while(p.length>0){let o=p.shift();if(o)await this.uploadFile(n,o.path,o.content)}},u=Array.from({length:Math.min(5,r.length)},()=>f());await Promise.all(u)},async getDeploy(n){return s("GET",`/deploys/${n}`)},async waitForDeploy(n,r={}){let{timeout:l=300000,pollInterval:p=2000,onProgress:f}=r,u=Date.now();while(!0){let o=await this.getDeploy(n);if(f)f(o);if(o.state==="ready")return o;if(o.state==="error"){let a=Error(`Deploy failed: ${o.error_message||"Unknown error"}`);throw a.status=500,a.details=o,a}if(Date.now()-u>l){let a=Error(`Deploy timed out after ${l}ms`);throw a.status=408,a.details=o,a}await new Promise((a)=>setTimeout(a,p))}},async lockDeploy(n){return s("POST",`/deploys/${n}/lock`)},async unlockDeploy(n){return s("POST",`/deploys/${n}/unlock`)}}}async function ro(e){let t=await crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(t)).map((s)=>s.toString(16).padStart(2,"0")).join("")}async function An(e,t={}){let{ignore:i=["node_modules",".git",".env*","*.map"]}=t,s=[],n=new Bun.Glob("**/*");for await(let r of n.scan({cwd:e,onlyFiles:!0,dot:!1})){if(i.some((a)=>{if(a.includes("*"))return new RegExp(`^${a.replace(/\*/g,".*")}$`).test(r);return r.includes(a)}))continue;let p=`${e}/${r}`,u=await Bun.file(p).arrayBuffer(),o=await ro(u);s.push({path:r,content:new Uint8Array(u),sha1:o})}return s}function Cr(e){let t={};for(let i of e)t[`/${i.path}`]=i.sha1;return t}function Er(e,t){let i=new Set(t.map((s)=>s.startsWith("/")?s.slice(1):s));return e.filter((s)=>i.has(s.path))}function Nt(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;if(e<1073741824)return`${(e/1048576).toFixed(1)} MB`;return`${(e/1073741824).toFixed(1)} GB`}function ft(e){return e.reduce((t,i)=>t+i.content.byteLength,0)}import m from"fs";import y from"path";function so(e){let t=[];if(t.push("[build]"),t.push(` command = "${d(e.build.command)}"`),t.push(` publish = "${d(e.build.publish)}"`),e.build.functions)t.push(` functions = "${d(e.build.functions)}"`);if(e.build.edge_functions)t.push(` edge_functions = "${d(e.build.edge_functions)}"`);if(e.build.environment&&Object.keys(e.build.environment).length>0){t.push(""),t.push("[build.environment]");for(let[i,s]of Object.entries(e.build.environment))t.push(` ${i} = "${d(s)}"`)}if(e.functions){if(t.push(""),t.push("[functions]"),e.functions.directory)t.push(` directory = "${d(e.functions.directory)}"`);if(e.functions.node_bundler)t.push(` node_bundler = "${e.functions.node_bundler}"`);if(e.functions.external_node_modules&&e.functions.external_node_modules.length>0)t.push(` external_node_modules = [${e.functions.external_node_modules.map((i)=>`"${i}"`).join(", ")}]`)}if(e.edge_functions&&e.edge_functions.length>0){t.push("");for(let i of e.edge_functions)t.push("[[edge_functions]]"),t.push(` function = "${d(i.function)}"`),t.push(` path = "${d(i.path)}"`)}if(e.redirects&&e.redirects.length>0){t.push("");for(let i of e.redirects){if(t.push("[[redirects]]"),t.push(` from = "${d(i.from)}"`),t.push(` to = "${d(i.to)}"`),i.status!==void 0)t.push(` status = ${i.status}`);if(i.force!==void 0)t.push(` force = ${i.force}`);if(i.conditions&&Object.keys(i.conditions).length>0){t.push(" [redirects.conditions]");for(let[s,n]of Object.entries(i.conditions))t.push(` ${s} = "${d(n)}"`)}}}if(e.headers&&e.headers.length>0){t.push("");for(let i of e.headers){t.push("[[headers]]"),t.push(` for = "${d(i.for)}"`),t.push(" [headers.values]");for(let[s,n]of Object.entries(i.values))t.push(` ${s} = "${d(n)}"`)}}if(e.plugins&&e.plugins.length>0){t.push("");for(let i of e.plugins)if(t.push("[[plugins]]"),t.push(` package = "${d(i.package)}"`),i.inputs&&Object.keys(i.inputs).length>0){t.push(" [plugins.inputs]");for(let[s,n]of Object.entries(i.inputs))if(typeof n==="string")t.push(` ${s} = "${d(n)}"`);else if(typeof n==="boolean"||typeof n==="number")t.push(` ${s} = ${n}`)}}if(e.context&&Object.keys(e.context).length>0)for(let[i,s]of Object.entries(e.context)){if(t.push(""),t.push(`[context.${i}]`),s.command)t.push(` command = "${d(s.command)}"`);if(s.publish)t.push(` publish = "${d(s.publish)}"`);if(s.environment&&Object.keys(s.environment).length>0){t.push(` [context.${i}.environment]`);for(let[n,r]of Object.entries(s.environment))t.push(` ${n} = "${d(r)}"`)}}return t.join(`
|
|
3
3
|
`)+`
|
|
4
|
-
`}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function
|
|
4
|
+
`}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function Pn(e){let t={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},i=y.join(e,"package.json");if(await Bun.file(i).exists())try{let u=JSON.parse(await Bun.file(i).text());if(u.scripts?.build)t.buildCommand="bun run build";let o={...u.dependencies,...u.devDependencies};if(o["@stacksjs/stx"]||o.stx)t.framework="stx"}catch{}let s=y.join(e,"stx.config.ts"),n=y.join(e,".config","stx.config.ts");if(await Bun.file(s).exists()||await Bun.file(n).exists())t.framework="stx";let r=["dist","build","out","public",".output"];for(let u of r){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.outputDir=u;break}}let l=["functions","netlify/functions","api"];for(let u of l){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.functionsDir=u;break}}let p=y.join(e,"netlify","edge-functions");if(m.existsSync(p))t.edgeFunctionsDir="netlify/edge-functions";let f=y.join(e,t.outputDir||"dist");if(m.existsSync(f)){let u=m.existsSync(y.join(f,"index.html")),o=m.readdirSync(f).filter((a)=>a.endsWith(".html"));t.isSPA=u&&o.length===1}return t}function In(e={}){let t={build:{command:e.buildCommand||"bun run build",publish:e.outputDir||"dist"}};if(e.functionsDir)t.build.functions=e.functionsDir,t.functions={directory:e.functionsDir,node_bundler:"esbuild"};if(e.edgeFunctionsDir)t.build.edge_functions=e.edgeFunctionsDir;if(t.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],e.isSPA!==!1)t.redirects=[{from:"/*",to:"/index.html",status:200}];return t.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},t}async function _r(e,t){let i=await Pn(e),s=t||In(i),n=so(s),r=y.join(e,"netlify.toml");return await Bun.write(r,n),r}function Tr(e){return m.existsSync(y.join(e,"netlify.toml"))}async function ol(e={}){let t=Date.now(),i=[],s=e.cwd||process.cwd(),n=(c)=>{i.push(c)},r=(c)=>{if(e.onProgress)e.onProgress(c)},l=_.resolve(s,e.directory||"dist"),p=e.token||process.env.NETLIFY_AUTH_TOKEN,f=e.siteId||process.env.NETLIFY_SITE_ID;if(!p)throw new Pe(`No Netlify auth token found.
|
|
5
5
|
|
|
6
6
|
To deploy to Netlify:
|
|
7
7
|
1. Create account at https://app.netlify.com
|
|
8
8
|
2. Get token at https://app.netlify.com/user/applications#personal-access-tokens
|
|
9
9
|
3. Set NETLIFY_AUTH_TOKEN environment variable
|
|
10
10
|
|
|
11
|
-
export NETLIFY_AUTH_TOKEN=your_token_here`,"NO_TOKEN");if(!f)throw new
|
|
11
|
+
export NETLIFY_AUTH_TOKEN=your_token_here`,"NO_TOKEN");if(!f)throw new Pe(`No Netlify site ID found.
|
|
12
12
|
|
|
13
13
|
Either:
|
|
14
14
|
1. Set NETLIFY_SITE_ID environment variable
|
|
15
15
|
2. Pass --site-id option
|
|
16
16
|
3. Run \`stx deploy --init\` to set up
|
|
17
17
|
|
|
18
|
-
Find your site ID at: https://app.netlify.com/sites/YOUR_SITE/settings/general`,"NO_SITE_ID");if(!S.existsSync(l))throw new
|
|
18
|
+
Find your site ID at: https://app.netlify.com/sites/YOUR_SITE/settings/general`,"NO_SITE_ID");if(!S.existsSync(l))throw new Pe(`Build directory not found: ${l}
|
|
19
19
|
|
|
20
|
-
Run \`stx build\` first or specify a different directory with --directory`,"NO_BUILD_DIR");if(!(S.readdirSync(l).length>0))throw new
|
|
20
|
+
Run \`stx build\` first or specify a different directory with --directory`,"NO_BUILD_DIR");if(!(S.readdirSync(l).length>0))throw new Pe(`Build directory is empty: ${l}
|
|
21
21
|
|
|
22
|
-
Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if(e.dryRun){r({stage:"collect",message:"Collecting files..."});let c=await
|
|
22
|
+
Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if(e.dryRun){r({stage:"collect",message:"Collecting files..."});let c=await An(l),w=ft(c);return n(`Would deploy ${c.length} files (${Nt(w)})`),n(`From: ${l}`),n(`To: Site ${f}`),n(`Mode: ${e.production?"production":"draft"}`),{success:!0,url:`https://${f}.netlify.app (dry-run)`,deployId:"dry-run",logs:i,duration:Date.now()-t,filesUploaded:c.length,totalSize:w}}let o=kr({token:p});r({stage:"collect",message:"Verifying site..."});try{let c=await o.getSite(f);n(`Deploying to: ${c.name} (${c.url})`)}catch(c){if(c.status===404)throw new Pe(`Site not found: ${f}
|
|
23
23
|
|
|
24
|
-
Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await
|
|
24
|
+
Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await An(l),g=ft(a);if(n(`Found ${a.length} files (${Nt(g)})`),a.length===0)throw new Pe(`No files found in ${l}`,"NO_FILES");let b=Cr(a);r({stage:"upload",message:"Creating deploy...",percent:0});let D=await o.createDeploy(f,{title:e.message||"Deploy from stx CLI",draft:!e.production,files:b});n(`Created deploy: ${D.id}`);let h=Er(a,D.required||[]);if(n(`Uploading ${h.length} files...`),h.length>0){let c=0,w=ft(h);for(let x of h){await o.uploadFile(D.id,x.path,x.content),c++;let C=Math.round(c/h.length*100);r({stage:"upload",message:`Uploading: ${x.path}`,percent:C,details:{uploaded:c,total:h.length}})}n(`Uploaded ${Nt(w)}`)}else n("All files already on CDN (no upload needed)");r({stage:"process",message:"Processing deploy..."});let N=await o.waitForDeploy(D.id,{onProgress:(c)=>{r({stage:"process",message:`Status: ${c.state}`,details:c})}}),P=Date.now()-t;if(r({stage:"done",message:"Deploy complete!"}),n(`Deploy complete in ${(P/1000).toFixed(1)}s`),n(`URL: ${N.deploy_ssl_url}`),e.production)n(`Site: ${N.ssl_url}`);if(e.open){let c=e.production?N.ssl_url:N.deploy_ssl_url;I(c)}return{success:!0,url:N.deploy_ssl_url,siteUrl:e.production?N.ssl_url:void 0,deployId:N.id,logs:i,duration:P,filesUploaded:h.length,totalSize:ft(h)}}async function il(e={}){let t=e.directory||process.cwd(),i;if(Tr(t))i=_.join(t,"netlify.toml");else{let s=await Pn(t);i=await _r(t,In(s))}if(e.siteId){let s=_.join(t,".env.local"),n="";if(await Bun.file(s).exists()){if(n=await Bun.file(s).text(),n=n.split(`
|
|
25
25
|
`).filter((r)=>!r.startsWith("NETLIFY_SITE_ID=")).join(`
|
|
26
26
|
`),n&&!n.endsWith(`
|
|
27
27
|
`))n+=`
|
|
28
28
|
`}n+=`NETLIFY_SITE_ID=${e.siteId}
|
|
29
|
-
`,await Bun.write(s,n)}return{configPath:i,siteId:e.siteId}}class
|
|
30
|
-
export{
|
|
29
|
+
`,await Bun.write(s,n)}return{configPath:i,siteId:e.siteId}}class Pe extends Error{code;constructor(e,t){super(e);this.name="DeployError",this.code=t}}function I(e){let t=process.platform,i=t==="darwin"?"open":t==="win32"?"start":"xdg-open";Bun.spawn([i,e],{stdio:["ignore","ignore","ignore"]})}
|
|
30
|
+
export{kr,ro,An,Cr,Er,Nt,ft,so,Pn,In,_r,Tr,ol,il,Pe};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Hn,oc,Md,ic,Nd,ac,Un,b,Et,we,cc,ss,lc,Ld,K,dc,jd,x,Bd}from"./chunk-xw8kzm6b.js";import"./chunk-8afnq4qx.js";import"./chunk-4zb2ga7p.js";import"./chunk-dmf1jmge.js";import"./chunk-8txqk9nq.js";import"./chunk-ghnkphy4.js";import"./chunk-mt8sew7a.js";import"./chunk-1hrj0t0j.js";import"./chunk-m8qgr307.js";import"./chunk-d4ybwtqt.js";import"./chunk-7m0r2qs2.js";import"./chunk-ev3qnr9q.js";import"./chunk-rgage0vm.js";export{dc as applyFilters,Nd as clearCustomFilters,cc as clientLoopScopes,Hn as defaultFilters,b as escapeHtml,Et as escapeHtmlValue,x as evaluateExpression,ac as findMustacheEnd,ic as getAllFilters,lc as interpolateScriptAttributes,ss as interpolateScriptExpressions,Ld as interpolateScriptsInTemplate,K as processExpressions,oc as registerFilter,Md as registerFilters,Un as replaceInterpolations,jd as resetRejectedExpressionWarnings,Bd as unescapeHtml,we as usesSignalsInScript};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{existsSync as A,mkdtempSync as D,readdirSync as M,rmSync as b,statSync as g,writeFileSync as k}from"fs";import{constants as P,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var _=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",I=60000,N=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{b(e,{recursive:!0,force:!0})}catch{}}function R(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function C(e){if(R(),t.listenerCount(e)===0)t.exit(128+(P.signals[e]??1))}var h=new Map(N.map((e)=>[e,()=>C(e)]));function G(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function K(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function O(e={}){let n=e.root??x(),r=e.isAlive??K,w=e.minAgeMs??I,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let d of u){let l=_.exec(d);if(!l)continue;let m=Number(l[1]);if(m===t.pid||r(m))continue;let o=s(n,d);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function L(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function z(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function
|
|
3
|
-
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function
|
|
4
|
-
export{
|
|
2
|
+
import{existsSync as A,mkdtempSync as D,readdirSync as M,rmSync as b,statSync as g,writeFileSync as k}from"fs";import{constants as P,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var _=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",I=60000,N=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{b(e,{recursive:!0,force:!0})}catch{}}function R(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function C(e){if(R(),t.listenerCount(e)===0)t.exit(128+(P.signals[e]??1))}var h=new Map(N.map((e)=>[e,()=>C(e)]));function G(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function K(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function O(e={}){let n=e.root??x(),r=e.isAlive??K,w=e.minAgeMs??I,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let d of u){let l=_.exec(d);if(!l)continue;let m=Number(l[1]);if(m===t.pid||r(m))continue;let o=s(n,d);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function L(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function z(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function Ne(e="stx",n=x()){if(!S.has(n))S.add(n),O({root:n});let r=D(s(n,L(e)));if(z())return H(r),console.warn(`[stx] STX_KEEP_TEMP: keeping ${r}`),r;return G(),i.add(r),r}function W(e){if(y.has(e))return;if(p(e),i.delete(e),i.size===0)f()}function H(e){try{k(s(e,v),`kept by pid ${t.pid}
|
|
3
|
+
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function No(e,n){let r=Ne(e);try{return await n(r)}finally{W(r)}}
|
|
4
|
+
export{Ne,W,No};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{kr,ro,An,Cr,Er,Nt,ft,so,Pn,In,_r,Tr,ol,il,Pe}from"./chunk-s1xxkzc9.js";export{Pe as DeployError,ro as calculateSha1,An as collectDeployFiles,In as createDefaultNetlifyConfig,Cr as createFileManifest,kr as createNetlifyClient,ol as deploy,Pn as detectProjectConfig,Er as filterRequiredFiles,Nt as formatSize,so as generateNetlifyToml,ft as getTotalSize,Tr as hasNetlifyConfig,il as initNetlify,_r as writeNetlifyConfig};
|
|
@@ -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-n2nha538.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-k50k9zbw.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-jq079mrx.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-pxcmv1xz.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Gd,Qo,Kd,ei,gc,mc,_t,cn,Xd,hc,yc,Jd,f}from"./chunk-xw8kzm6b.js";import"./chunk-8afnq4qx.js";import"./chunk-4zb2ga7p.js";import"./chunk-dmf1jmge.js";import"./chunk-8txqk9nq.js";import"./chunk-ghnkphy4.js";import"./chunk-mt8sew7a.js";import"./chunk-1hrj0t0j.js";import"./chunk-m8qgr307.js";import"./chunk-d4ybwtqt.js";import"./chunk-7m0r2qs2.js";import"./chunk-ev3qnr9q.js";import"./chunk-rgage0vm.js";export{_t as buildCss,hc as extractClassNames,mc as fingerprintConfig,yc as generateCss,Xd as getCachedCSS,Gd as getCssServeAsset,f as injectCss,Qo as loadCssEngine,ei as loadCssEngineConfig,cn as rebuildCss,Kd as resetCssCache,gc as resolveUserCssConfig,Jd as withLinkedModuleBundles};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-m8qgr307.js";import"./chunk-4zb2ga7p.js";import"./chunk-8afnq4qx.js";import{a}from"./chunk-203rr1c8.js";import f from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},o=t.snapshotDir||a(e.root,"story","snapshots");await f.promises.mkdir(o,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((i)=>t.filter.some((p)=>i.fileName.toLowerCase().includes(p.toLowerCase())));for(let i of r)await h(i,o,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let o=e.story;if(!o)return;for(let r of o.variants){n.total++;let i=l.join(t,`${e.id}-${r.id}.snap`),p=g(r.source||""),c=await w(i);if(s.update||!c){let u={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:p};if(await f.promises.writeFile(i,JSON.stringify(u,null,2)),!c)n.new++;n.passed++}else try{let u=await f.promises.readFile(i,"utf-8"),m=JSON.parse(u);if(m.hash===p)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,p)})}catch(u){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${u}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await f.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
|
|
3
3
|
`)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Hi,Ui,Vi}from"./chunk-7m0r2qs2.js";import{V,Nn,Yt,Hr,Ur,Ln,Zt,Qt,Vr,jn}from"./chunk-ymdy7b8z.js";function z(t,s,i,a,c){let y=!0,h=new Set,f=(l)=>a.get?a.get(l):l,d=()=>f(t());return Object.defineProperty(d,"_isSignal",{value:!0}),Object.defineProperty(d,"modifiers",{get:s}),d.set=(l)=>{if(!y)return;let v=s(),g=a.set?a.set(l,v):l;if(v.trim&&typeof g==="string")g=g.trim();if(v.number&&typeof g==="string"&&g!==""){let n=Number(g);if(!Number.isNaN(n))g=n}if(Object.is(t(),g))return;t.set(g),i(g)},d.update=(l)=>d.set(l(d())),d.input=(l)=>{if(!s().lazy)d.set(l)},d.change=(l)=>{if(s().lazy)d.set(l)},d.subscribe=(l)=>{if(!y)return()=>{};let v=t.subscribe((g,n)=>l(f(g),f(n)));return h.add(v),()=>{v(),h.delete(v)}},Object.defineProperty(d,"value",{get:d,set:d.set}),c(()=>{y=!1,h.forEach((l)=>l()),h.clear()}),d}function W(t,s=!0,i){if(!s||!t||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let h=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=h&&typeof h==="object"&&!Array.isArray(h)?h:{}}catch{a.__STX_DATA__={}}}let c=a.__STX_DATA__;if(c&&Object.prototype.hasOwnProperty.call(c,t))try{return{data:i?i(c[t]):c[t]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function X(t){if(typeof window>"u")return;let s=window;if(t===void 0)s.__STX_DATA__={};else{if(!s.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");s.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{s.__STX_DATA__={}}if(s.__STX_DATA__)delete s.__STX_DATA__[t]}}function Q(t){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=t||"stx-kept",c=null,y=()=>{if(!c)c=new Promise((f,d)=>{let l=i.open(a,1);l.onupgradeneeded=()=>{l.result.createObjectStore("kv")},l.onsuccess=()=>f(l.result),l.onerror=()=>d(l.error),l.onblocked=()=>d(Error("blocked"))}),c.catch(()=>{c=null});return c},h=(f,d)=>y().then((l)=>new Promise((v,g)=>{let n=l.transaction("kv",f),o=d(n.objectStore("kv"));n.oncomplete=()=>v(o?o.result:void 0),n.onerror=()=>g(n.error),n.onabort=()=>g(n.error)}));return{get:(f)=>h("readonly",(d)=>d.get(f)),set:(f,d)=>h("readwrite",(l)=>{l.put(d,f)}),remove:(f)=>h("readwrite",(d)=>{d.delete(f)}),removePrefix:(f)=>h("readwrite",(d)=>{d.delete(IDBKeyRange.bound(f,`${f}\uFFFF`))})}}function Y(t,s){let i=t||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let c=null,y=i.backend!==void 0;if(y)c=i.backend||null;let h=()=>{if(y)return c;y=!0;try{c=s?s():null}catch{c=null}if(c){let e=c;e.get("__stx_probe__").catch(()=>{if(c===e)c=null})}return c},f=i.limit||32768,d=i.defer||((e)=>{let r=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(r)r(e,{timeout:200});else setTimeout(e,16)}),l=new Map,v=new Set,g=new Map,n=!1,o=Promise.resolve(),m=(e)=>{try{return JSON.parse(e)}catch{return e}},p=(e,r)=>{if(!a)return!1;try{return a.setItem(e,r),!0}catch{return!1}},T=(e)=>{try{if(a)a.removeItem(e)}catch{}},k=()=>{if(n=!1,!g.size)return o;let e=Array.from(g.entries());return g.clear(),o=o.then(()=>Promise.all(e.map(([r,u])=>{if(!c){v.delete(r);try{p(r,JSON.stringify(u===void 0?null:u))}catch{}return}let x;try{return x={v:u},c.set(r,x).catch(()=>{let w;try{w=JSON.stringify(u)}catch{return}return c?c.set(r,{j:w}).catch(()=>{p(r,w)}):void 0})}catch{return}}))).then(()=>{}),o},C=(e,r)=>{if(g.set(e,r),v.add(e),n)return;n=!0,d(()=>{k()})},O=(e)=>{if(!e||typeof e!=="object")return;let r=e;if("v"in r)return{value:r.v};if(typeof r.j==="string")return{value:m(r.j)};return},E={peek(e){if(l.has(e))return{value:l.get(e)};let r=null;try{r=a?a.getItem(e):null}catch{r=null}if(r===null||r===void 0)return;let u=m(r);return l.set(e,u),{value:u}},load(e){let r=E.peek(e),u=r?null:h();if(r||!u)return Promise.resolve(r);return u.get(e).then((x)=>{if(l.has(e))return{value:l.get(e)};let w=O(x);if(w)l.set(e,w.value),v.add(e);return w},()=>{return})},set(e,r){if(l.set(e,r),c&&v.has(e)){C(e,r);return}let u;try{u=JSON.stringify(r===void 0?null:r)}catch{return}if(u.length<=f&&p(e,u))return;if(!h()){if(u.length>f)p(e,u);return}T(e),C(e,r)},forget(e){for(let u of Array.from(l.keys()))if(u.indexOf(e)===0)l.delete(u);for(let u of Array.from(g.keys()))if(u.indexOf(e)===0)g.delete(u);for(let u of Array.from(v))if(u.indexOf(e)===0)v.delete(u);try{if(a)for(let u=a.length-1;u>=0;u--){let x=a.key(u);if(x&&x.indexOf(e)===0)a.removeItem(x)}}catch{}let r=h();if(!r)return o;return o=o.then(()=>r.removePrefix(e)).catch(()=>{}),o},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function J(t,s){if(!t)return!1;if(t===s.key)return!0;if(!s.url)return!1;if(t===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(t,i),c=new URL(s.url,i);if(a.origin!==c.origin||a.pathname!==c.pathname)return!1;return!a.search||a.search===c.search}catch{return!1}}function Z(t){let s=t.prefix||"stx:kept:",i=t.matches||((n,o)=>n===o.key||n===o.url),a=new Set,c=new Map,y,h=(n)=>n===void 0?y:n,f=(n,o)=>{let m=h(o);if(m===!1||m===null||m==="")return null;return`${s}${m===void 0?"":`${m}:`}query:${n}`},d=(n)=>{let o=n&&n.value;if(!o||typeof o!=="object"||!("d"in o))return;return{data:o.d,at:Number(o.at)||0}},l=()=>{let n=globalThis;return n.__stx_outboxes instanceof Map?n.__stx_outboxes:null},v={setScope(n){y=n},scope:()=>y,keyFor:f,seed(n,o){let m=f(n,o);return m?d(t.kept.peek(m)):void 0},restore(n,o){let m=f(n,o);return m?t.kept.load(m).then(d):Promise.resolve(void 0)},persist(n,o,m){let p=f(n,m);if(p)t.kept.set(p,{d:o,at:Date.now()})},overlay(n,o,m){let p=l();if(!p||!p.size)return o;let T=o;return p.forEach((k)=>{try{T=k.overlay(n,T,m)}catch{}}),T},watch(n){return a.add(n),()=>{a.delete(n)}},cachedQuery(n,o){let m=c.get(n);if(m){if(o&&m.__options)m.__options(o);return m}let p=o||{},T=p.initial===void 0?null:p.initial,k=()=>typeof p.scope==="function"?p.scope():p.scope,C=()=>(typeof p.url==="function"?p.url():p.url)||null,O=()=>({key:n,url:C()}),E=k(),e=T,r=0,u=null,x=v.seed(n,E);if(x)e=x.data;let w=t.state(v.overlay(O(),e)),U=t.state(!1),j=t.state(!1),q=t.state(null),M=t.state(x?x.at:0),I=0,P=()=>{w.set(v.overlay(O(),e))},K=(b)=>{let _=I;v.restore(n,b).then((N)=>{if(!N||_!==I||r)return;e=N.data,M.set(N.at),P()})};if(!x)K(E);let gt=()=>{let b=k();if(b===E)return;E=b,I++,u=null,r=0;let _=v.seed(n,E);if(e=_?_.data:T,M.set(_?_.at:0),P(),!_)K(E)},vt=(b)=>{let _=C(),N=p.timeoutMs||15000,A=typeof AbortController<"u"?new AbortController:null,S=null,yt=new Promise((R,L)=>{S=setTimeout(()=>{if(A)A.abort();L(Error("The request took too long."))},N)}),G;if(p.load)G=p.load({force:b,url:_,signal:A?A.signal:void 0});else if(_){let R=p.fetch||((D,F)=>fetch(D,F)),L={method:"GET",headers:{Accept:"application/json"}};if(b)L.cache="no-cache";if(A)L.signal=A.signal;G=R(_,L).then((D)=>{if(!D.ok)return D.json().catch(()=>null).then((F)=>{throw Error(F&&(F.error||F.message)||`Request failed (${D.status})`)});return D.json()})}else return Promise.resolve(w());return Promise.race([G,yt]).then((R)=>{if(S)clearTimeout(S);return p.transform?p.transform(R):R},(R)=>{if(S)clearTimeout(S);throw R})},B=(b)=>{if(u)return u;let _=I;if(j.set(!0),r===0&&!M())U.set(!0);let N=()=>{if(_!==I)return;u=null,j.set(!1),U.set(!1)},A=vt(b).then((S)=>{if(_!==I)return w();return e=S,r=Date.now(),M.set(r),q.set(null),v.persist(n,S,E),P(),N(),w()},(S)=>{if(_===I)q.set(S&&S.message?S.message:"Could not load.");return N(),w()});return u=A,A},H={data:w,loading:U,isFetching:j,error:q,updatedAt:M,get key(){return n},load(b){if(gt(),!b&&r&&Date.now()-r<(p.staleTime||0))return Promise.resolve(w());return B(!!b)},refresh(){return H.load(!0)},set(b){e=typeof b==="function"?b(e):b,v.persist(n,e,E),P()},invalidate(){r=0},__options(b){p={...p,...b}}};if(a.add({target:O,updated:()=>{if(r||M())B(!1)},outbox:(b)=>{if(b)e=v.overlay(O(),e,b.id),r=0,B(!0);P()}}),c.set(n,H),p.immediate)H.load();return H}},g=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(t.listen!==!1&&g&&typeof g.addEventListener==="function")g.addEventListener("stx:updated",(n)=>{let o=n.detail||{};if(o.kind!=="api"||typeof o.url!=="string")return;a.forEach((m)=>{if(i(o.url,m.target()))m.updated()})}),g.addEventListener("stx:outbox",(n)=>{let o=n.detail||{},m=o.sent&&typeof o.sent.id==="string"?o.sent:null;a.forEach((p)=>{if(m){let T=Array.isArray(m.affects)?m.affects:[],k=p.target();if(!T.some((C)=>i(C,k)))return}p.outbox(m)})});return v}var ee=` function useColorMode(options) {
|
|
3
3
|
options = options || {};
|
|
4
4
|
// The pre-paint boot script (stacksjs/stx#1794) publishes the app's
|
|
5
5
|
// configured options here. Reading them makes a bare useColorMode() agree
|
|
@@ -4328,7 +4328,7 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
4328
4328
|
// Shown branches whose deferred bind found them off the page: an enclosing
|
|
4329
4329
|
// :if, bound later in the same pass, hid them between the queue and the run.
|
|
4330
4330
|
// Their own condition has not changed, so their effect never runs again to
|
|
4331
|
-
// retry; each resumes here when an enclosing branch puts it back.`;var
|
|
4331
|
+
// retry; each resumes here when an enclosing branch puts it back.`;var De=` const detachedBranches = new Set();
|
|
4332
4332
|
function resumeDetachedBranches() {
|
|
4333
4333
|
if (!detachedBranches.size) return;
|
|
4334
4334
|
Array.from(detachedBranches).forEach(function(resume) {
|
|
@@ -9832,7 +9832,7 @@ else if (timer === null) {
|
|
|
9832
9832
|
subscribe: subscribe
|
|
9833
9833
|
};
|
|
9834
9834
|
}
|
|
9835
|
-
`;function
|
|
9835
|
+
`;function Me(){let t=bt(Jt());try{let i=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t);return i=i.replace(/\}(var |let |const |function )/g,"};$1"),i}catch{return t}}function bt(t){let s=[],i=0,a="console.log(";while(i<t.length){let c=t.indexOf(a,i);if(c===-1){s.push(t.slice(i));break}s.push(t.slice(i,c));let y=1,h=c+a.length;while(h<t.length&&y>0){let f=t[h];if(f==='"'||f==="'"||f==="`"){let d=f;h++;while(h<t.length&&t[h]!==d){if(t[h]==="\\")h++;h++}h++;continue}if(f==="(")y++;else if(f===")")y--;h++}s.push("0"),i=h}return s.join("")}function Jt(){return`${re}${Ce}
|
|
9836
9836
|
${We(oe,we,xe)}
|
|
9837
9837
|
|
|
9838
9838
|
${Ne}
|
|
@@ -9842,7 +9842,7 @@ ${at}
|
|
|
9842
9842
|
${ye}
|
|
9843
9843
|
${Fe}
|
|
9844
9844
|
${mt}
|
|
9845
|
-
${Se(
|
|
9845
|
+
${Se(W.toString(),X.toString())}
|
|
9846
9846
|
${et}
|
|
9847
9847
|
${Ge}
|
|
9848
9848
|
${ze}
|
|
@@ -9859,7 +9859,7 @@ ${ne}
|
|
|
9859
9859
|
${ie}
|
|
9860
9860
|
${ue}
|
|
9861
9861
|
${je}
|
|
9862
|
-
${Ye(
|
|
9862
|
+
${Ye(Ui(),Vi(),Hi())}
|
|
9863
9863
|
|
|
9864
9864
|
${dt}
|
|
9865
9865
|
${rt}
|
|
@@ -9874,7 +9874,7 @@ ${ke}
|
|
|
9874
9874
|
${Ve}
|
|
9875
9875
|
${de}
|
|
9876
9876
|
${Oe}
|
|
9877
|
-
${
|
|
9877
|
+
${De}
|
|
9878
9878
|
${ae}
|
|
9879
9879
|
${ut}
|
|
9880
9880
|
${ee}
|
|
@@ -9882,9 +9882,9 @@ ${Xe}
|
|
|
9882
9882
|
|
|
9883
9883
|
${lt}
|
|
9884
9884
|
|
|
9885
|
-
${Pe(
|
|
9885
|
+
${Pe(Y.toString(),Q.toString(),Z.toString(),J.toString())}
|
|
9886
9886
|
${he}
|
|
9887
|
-
${te(
|
|
9887
|
+
${te(z.toString())}
|
|
9888
9888
|
${Ae}
|
|
9889
9889
|
${ht}
|
|
9890
9890
|
|
|
@@ -9910,5 +9910,5 @@ ${ot}
|
|
|
9910
9910
|
${st}
|
|
9911
9911
|
${nt}
|
|
9912
9912
|
})();
|
|
9913
|
-
`}var
|
|
9914
|
-
export{
|
|
9913
|
+
`}var ld={state:V,derived:Nn,effect:Yt,batch:Hr,onMount:Ur,onDestroy:Ln,isSignal:Zt,isDerived:Qt,untrack:Vr,peek:jn,generateSignalsRuntime:Me,generateSignalsRuntimeDev:Jt};
|
|
9914
|
+
export{Me,Jt,ld};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Cl}from"./chunk-n6va14bt.js";import"./chunk-xw8kzm6b.js";import"./chunk-8afnq4qx.js";import"./chunk-4zb2ga7p.js";import"./chunk-dmf1jmge.js";import"./chunk-8txqk9nq.js";import"./chunk-ghnkphy4.js";import"./chunk-mt8sew7a.js";import"./chunk-1hrj0t0j.js";import"./chunk-m8qgr307.js";import"./chunk-d4ybwtqt.js";import"./chunk-7m0r2qs2.js";import"./chunk-ev3qnr9q.js";import"./chunk-rgage0vm.js";export{Cl as buildApp};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{j,B,F,
|
|
2
|
+
import{j,B,F,Bt,Z,ie,Oe,gt,Ft,zt,Ht,z,Ut,Vt}from"./chunk-wm11csdm.js";import{Je}from"./chunk-r47cs92n.js";function Zi(s,r={}){let{src:e,alt:t,width:n,height:a,sizes:i="100vw",loading:m="lazy",priority:o=!1,quality:u=F,placeholder:l="none",formats:f=B,widths:y=j,decoding:c="async",fetchpriority:h,objectFit:d,objectPosition:g}=s,{class:p,style:v}=s,{processedImage:w,variants:I,optimize:b=!0,isDev:A=!1}=r;if(I&&I.length>0)return ee(s,I,w);if(A||!b)return te(s);return se(s)}function ee(s,r,e){let{src:t,alt:n,width:a,height:i,sizes:m="100vw",loading:o="lazy",priority:u=!1,decoding:l="async",fetchpriority:f,objectFit:y,objectPosition:c,placeholder:h="none"}=s,{class:d,style:g}=s,p=zt(r),v=Ft(r),w=typeof m==="object"?gt(m):m,I=e?e.aspectRatio:a&&i?Number(a)/Number(i):void 0,b=[];if(I)b.push(`aspect-ratio: ${I}`);if(y)b.push(`object-fit: ${y}`);if(c)b.push(`object-position: ${c}`);if(g)b.push(g);let A=b.length>0?` style="${b.join("; ")}"`:"",D=d?` class="${d}"`:"",T=u?"":` loading="${o}"`,O=` decoding="${l}"`,E=f?` fetchpriority="${f}"`:u?' fetchpriority="high"':"",V=["avif","webp","jpeg","png"],q=[];for(let k of V){let P=p.get(k);if(P&&P.length>0){let U=Oe(P),X=z(k);q.push(` <source type="${X}" srcset="${U}" sizes="${w}" />`)}}let N="",W="",M;if(h!=="none"&&e?.placeholder){let k=`img-${Math.random().toString(36).slice(2,8)}`;if(N=`<div class="stx-image-wrapper" id="${k}">`,W="</div>",h==="blur")M=`
|
|
3
3
|
#${k} {
|
|
4
4
|
position: relative;
|
|
5
5
|
background-image: url('${e.placeholder}');
|
|
@@ -16,21 +16,21 @@ import{j,B,F,jt,Y,oe,Ie,ft,Bt,Ft,zt,z,Ht,Ut}from"./chunk-3nc2fr4q.js";import{Xe}
|
|
|
16
16
|
#${k} {
|
|
17
17
|
background-color: ${e.placeholder};
|
|
18
18
|
}
|
|
19
|
-
`.trim()}let
|
|
19
|
+
`.trim()}let J=a?` width="${a}"`:e?` width="${e.width}"`:"",K=i?` height="${i}"`:e?` height="${e.height}"`:"",G=`${N}<picture>
|
|
20
20
|
${q.join(`
|
|
21
21
|
`)}
|
|
22
22
|
<img
|
|
23
23
|
src="${v?.url||t}"
|
|
24
|
-
alt="${L(n)}"${
|
|
24
|
+
alt="${L(n)}"${J}${K}${D}${A}${T}${O}${E}
|
|
25
25
|
/>
|
|
26
|
-
</picture>${W}`,_;if(u&&v){let k=p.get("webp"),P=k?.[Math.floor(k.length/2)]||v,U=z(P.format);_=`<link rel="preload" as="image" href="${P.url}" type="${U}" />`}return{html:G,preloadLink:_,placeholderCss:M}}function te(s){let{src:r,alt:e,width:t,height:n,loading:a="lazy",decoding:i="async",priority:m=!1,fetchpriority:o,objectFit:u,objectPosition:l}=s,{class:f,style:y}=s,c=[];if(u)c.push(`object-fit: ${u}`);if(l)c.push(`object-position: ${l}`);if(y)c.push(y);let h=c.length>0?` style="${c.join("; ")}"`:"",d=f?` class="${f}"`:"",g=t?` width="${t}"`:"",p=n?` height="${n}"`:"",v=m?"":` loading="${a}"`,w=` decoding="${i}"`,I=o?` fetchpriority="${o}"`:m?' fetchpriority="high"':"";return{html:`<img src="${r}" alt="${L(e)}"${g}${p}${d}${h}${v}${w}${I} />`}}function se(s){let{src:r,alt:e,width:t,height:n,sizes:a="100vw",loading:i="lazy",priority:m=!1,quality:o=F,formats:u=B,widths:l=j,decoding:f="async",fetchpriority:y,objectFit:c,objectPosition:h}=s,{class:d,style:g}=s,p=[];if(c)p.push(`object-fit: ${c}`);if(h)p.push(`object-position: ${h}`);if(g)p.push(g);let v=p.length>0?` style="${p.join("; ")}"`:"",w=d?` class="${d}"`:"",I=t?` width="${t}"`:"",b=n?` height="${n}"`:"",A=m?"":` loading="${i}"`,D=` decoding="${f}"`,T=y?` fetchpriority="${y}"`:m?' fetchpriority="high"':"",O=typeof a==="object"?
|
|
26
|
+
</picture>${W}`,_;if(u&&v){let k=p.get("webp"),P=k?.[Math.floor(k.length/2)]||v,U=z(P.format);_=`<link rel="preload" as="image" href="${P.url}" type="${U}" />`}return{html:G,preloadLink:_,placeholderCss:M}}function te(s){let{src:r,alt:e,width:t,height:n,loading:a="lazy",decoding:i="async",priority:m=!1,fetchpriority:o,objectFit:u,objectPosition:l}=s,{class:f,style:y}=s,c=[];if(u)c.push(`object-fit: ${u}`);if(l)c.push(`object-position: ${l}`);if(y)c.push(y);let h=c.length>0?` style="${c.join("; ")}"`:"",d=f?` class="${f}"`:"",g=t?` width="${t}"`:"",p=n?` height="${n}"`:"",v=m?"":` loading="${a}"`,w=` decoding="${i}"`,I=o?` fetchpriority="${o}"`:m?' fetchpriority="high"':"";return{html:`<img src="${r}" alt="${L(e)}"${g}${p}${d}${h}${v}${w}${I} />`}}function se(s){let{src:r,alt:e,width:t,height:n,sizes:a="100vw",loading:i="lazy",priority:m=!1,quality:o=F,formats:u=B,widths:l=j,decoding:f="async",fetchpriority:y,objectFit:c,objectPosition:h}=s,{class:d,style:g}=s,p=[];if(c)p.push(`object-fit: ${c}`);if(h)p.push(`object-position: ${h}`);if(g)p.push(g);let v=p.length>0?` style="${p.join("; ")}"`:"",w=d?` class="${d}"`:"",I=t?` width="${t}"`:"",b=n?` height="${n}"`:"",A=m?"":` loading="${i}"`,D=` decoding="${f}"`,T=y?` fetchpriority="${y}"`:m?' fetchpriority="high"':"",O=typeof a==="object"?gt(a):a,E=`
|
|
27
27
|
data-stx-image
|
|
28
28
|
data-src="${r}"
|
|
29
29
|
data-sizes="${O}"
|
|
30
30
|
data-quality="${o}"
|
|
31
31
|
data-formats="${u.join(",")}"
|
|
32
32
|
data-widths="${l.join(",")}"
|
|
33
|
-
`.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${L(e)}"${I}${b}${w}${v}${A}${D}${T} ${E} />`}}function
|
|
33
|
+
`.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${L(e)}"${I}${b}${w}${v}${A}${D}${T} ${E} />`}}function oo(s){let r=s.match(/<Image\s+([^>]*?)\/?>/);if(!r)return null;let e=r[1],t={},n=/(\w+)(?:=(?:"([^"]*)"|'([^']*)'|(\{[^}]+\})))?/g,a;while((a=n.exec(e))!==null){let[,i,m,o,u]=a,l=m??o??u??!0;switch(i){case"src":t.src=String(l);break;case"alt":t.alt=String(l);break;case"width":t.width=Number(l)||l;break;case"height":t.height=Number(l)||l;break;case"sizes":t.sizes=String(l);break;case"loading":t.loading=l;break;case"priority":t.priority=l===!0||l==="true";break;case"quality":t.quality=Number(l);break;case"placeholder":t.placeholder=l;break;case"class":t.class=String(l);break;case"style":t.style=String(l);break;case"decoding":t.decoding=l;break;case"fetchpriority":t.fetchpriority=l;break;case"objectFit":t.objectFit=l;break;case"objectPosition":t.objectPosition=String(l);break}}if(!t.src||!t.alt)return null;return t}async function Qi(s,r){let e=/<Image\s+[^>]*?\/?>/g,t=[],n=[],a=s,i,m=[];while((i=e.exec(s))!==null)m.push({match:i[0],index:i.index});for(let o=m.length-1;o>=0;o--){let{match:u}=m[o],l=oo(u);if(l){let f=await r(l);if(a=a.replace(u,f.html),f.preloadLink)t.push(f.preloadLink);if(f.placeholderCss)n.push(f.placeholderCss)}}return{html:a,preloadLinks:t,styles:n}}function L(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var R=new Map;function ea(){R.clear()}async function re(s,r){let e=`${s}:${JSON.stringify(r)}`;if(R.has(e))return R.get(e);try{let t=await ie(s,r);return R.set(e,t),t}catch{return null}}function io(){return Je({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async(s,r,e)=>{let{src:t,alt:n,options:a}=ae(s,r,e);if(!t)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let i={widths:a.widths||(a.width?[a.width]:j),formats:a.formats||B,quality:a.quality||F,placeholder:(a.placeholder==="color"?"dominant-color":a.placeholder)||"none"};if(!await Z())return H(t,n||"",a);let o=await re(t,i);if(!o)return H(t,n||"",a);return oe(o,n||"",a)}})}function ae(s,r,e){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let n=s.trim();if(n.startsWith("@image(")||n.startsWith("("))n=n.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let a=ne(n),i=a[0]||"",m=a[1]||"",o={};if(i&&!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")){let u=e[i];if(typeof u==="string")i=u}if(a[2])try{if(typeof a[2]==="string")o=JSON.parse(a[2]);else o=a[2]}catch{}return{src:i,alt:m,options:o}}function ne(s){let r=[],e="",t=!1,n="",a=0,i=0;for(let m=0;m<s.length;m++){let o=s[m],u=m>0?s[m-1]:"";if((o==='"'||o==="'")&&u!=="\\"){if(!t)t=!0,n=o;else if(o===n)t=!1,n="";else e+=o;continue}if(!t){if(o==="{")a++;if(o==="}")a--;if(o==="[")i++;if(o==="]")i--;if(o===","&&a===0&&i===0){r.push(e.trim()),e="";continue}}e+=o}if(e.trim())r.push(e.trim());return r}function H(s,r,e){let t=[`src="${x(s)}"`];if(r)t.push(`alt="${x(r)}"`);if(e.width)t.push(`width="${e.width}"`);if(e.height)t.push(`height="${e.height}"`);if(e.class)t.push(`class="${x(e.class)}"`);if(e.style)t.push(`style="${x(e.style)}"`);if(e.lazy!==!1)t.push('loading="lazy"');return t.push('decoding="async"'),`<img ${t.join(" ")} />`}function oe(s,r,e){let{variants:t,placeholder:n,width:a,height:i,aspectRatio:m}=s,o=new Map;for(let g of t){let p=o.get(g.format)||[];p.push(g),o.set(g.format,p)}let u=["avif","webp","jpeg","png"],l=[];for(let g of u){let p=o.get(g);if(p&&p.length>0){let v=Oe(p),w=z(g),I=e.sizes||"100vw";l.push(` <source type="${w}" srcset="${x(v)}" sizes="${x(I)}" />`)}}let f=o.get("jpeg")||[],y=f.length>0?f[Math.floor(f.length/2)]:t[Math.floor(t.length/2)],c=[`src="${y?.url||s.src}"`,`alt="${x(r)}"`];if(e.width||a)c.push(`width="${e.width||a}"`);if(e.height||i)c.push(`height="${e.height||i}"`);if(e.class)c.push(`class="${x(e.class)}"`);let h=[];if(m)h.push(`aspect-ratio: ${m.toFixed(4)}`);if(e.style)h.push(e.style);if(h.length>0)c.push(`style="${h.join("; ")}"`);if(e.lazy!==!1&&!e.priority)c.push('loading="lazy"');if(c.push('decoding="async"'),e.priority)c.push('fetchpriority="high"');let d=`<picture>
|
|
34
34
|
`;if(d+=l.join(`
|
|
35
35
|
`)+`
|
|
36
36
|
`,d+=` <img ${c.join(" ")} />
|
|
@@ -39,5 +39,5 @@ ${d}
|
|
|
39
39
|
</div>`}else if(e.placeholder==="color"){let p=n.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");d=`<div id="${g}" class="stx-image-placeholder" style="background-color: ${p};">
|
|
40
40
|
${d}
|
|
41
41
|
</div>`}}if(e.priority&&y){let g=z(y.format);d=`<link rel="preload" as="image" href="${x(y.url)}" type="${g}" />
|
|
42
|
-
`+d}return d}function x(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var
|
|
43
|
-
export{
|
|
42
|
+
`+d}return d}function x(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var ta=io();import S from"fs";import C from"path";function na(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=B,widths:a=j,quality:i=F,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await Z()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await S.promises.mkdir(l,{recursive:!0});if(y){let g=await Bt();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=ce(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ge(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await Z())return;await S.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!S.existsSync(w))continue;let I=await Q(w);g.push(...I)}let p=f?g.filter((w)=>le(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=Y(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await ie(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=S.statSync(I).size,D=Ut(b.variants);if(c.stats.savedBytes+=Math.max(0,A-D/b.variants.length),y)console.log(` \u2713 ${C.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${Vt(c.stats.savedBytes)}`)}}}function ce(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function le(s,r){let e=C.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ge(s,r){return s}async function Q(s){let r=[];async function e(t){let n=await S.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=C.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&Ht(i))r.push(i)}}return await e(s),r}function Y(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function ra(s,r,e={}){if(!await Z())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return ie(s,{...e,outputDir:r})}async function sa(s,r,e={}){let{formats:t=B,widths:n=j,quality:a=F,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await Z())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await S.promises.mkdir(r,{recursive:!0});let l=await Q(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=Y(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await ie(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${C.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function ao(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function oa(s,r){let e=ao(s);await Bun.write(r,JSON.stringify(e,null,2))}var al={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
|
|
43
|
+
export{Zi,oo,Qi,ea,io,ta,na,ra,sa,ao,oa,al};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$a,Ra,Aa,Pa,Ia,Oa,Da,Ma,Na,La,Ll}from"./chunk-8nr1kras.js";export{$a as createIslandRegistry,Ll as default,La as generateIslandManifest,Aa as generatePartialHydrationCSS,Oa as hydrateAll,Ia as hydrateByStrategy,Pa as hydrateIsland,Da as isHydrated,Ma as onHydrated,Ra as processPartialHydrationDirectives,Na as processStaticDirectives};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Me,Jt,ld}from"./chunk-tfeenp4h.js";import{V,Nn,Yt,Hr,Ur,Ln,dd,ud,pd,Zt,Qt,Vr,jn,fd}from"./chunk-ymdy7b8z.js";import"./chunk-7m0r2qs2.js";export{Hr as batch,ld as default,Nn as derived,Yt as effect,Me as generateSignalsRuntime,Jt as generateSignalsRuntimeDev,Qt as isDerived,Zt as isSignal,Ln as onDestroy,Ur as onMount,jn as peek,pd as pendingLifecycleCounts,ud as runDestroyCallbacks,dd as runMountCallbacks,V as state,Vr as untrack,fd as useOptimistic};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{j,B,F,
|
|
2
|
+
import{Ne,W,No}from"./chunk-saf7kypg.js";import L from"fs";import g from"path";import D from"crypto";import{generatePlaceholder as R,processImage as k}from"ts-images";var j=[320,640,768,1024,1280,1536,1920],B=["webp","jpeg"],F=80,C=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],q={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,A=!1;async function d(){if(A)return I;A=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function Bt(){return await d()!==null}async function Z(){return!0}async function ie(t,e={}){let{widths:a=j,formats:r=B,quality:n=F,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 Mn(`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 Dn(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 pa(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 Dn(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 Mn("Unable to parse image dimensions","PARSE_ERROR")}async function pa(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 No("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 Dn(t);return`data:${q[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 Dn(t),n=Ne("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{W(n)}}function Oe(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 Ft(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 zt(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 Ht(t){let e=g.extname(t).toLowerCase();return C.includes(e)}function z(t){return q[t]||"application/octet-stream"}function Ut(t){return t.reduce((e,a)=>e+a.size,0)}function Vt(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class Mn extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
|
|
3
|
+
export{j,B,F,Bt,Z,ie,Dn,pa,Oe,gt,Ft,zt,Ht,z,Ut,Vt,Mn};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var Wr=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function Io(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||Wr},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
|
|
2
|
+
var qr=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function Oo(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||qr},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
|
|
3
3
|
`)}function N(e,t,r){let n=" ".repeat(r);if(r===0)t.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let i=`node_${r}`;t.push(`${n} var ${i} = try ${e.zigType}.init(allocator);`);for(let[o,s]of Object.entries(e.props))if(s.type==="literal"){let a=typeof s.value==="string"?`"${s.value}"`:String(s.value);t.push(`${n} ${i}.set${J(o)}(${a});`)}for(let o=0;o<e.children.length;o++){let s=e.children[o];if(s.type==="text"){let a=s.props.text?.type==="literal"?String(s.props.text.value):"";t.push(`${n} try ${i}.addChild(try craft.Text.init(allocator, "${a}"));`)}else N(s,t,r+1),t.push(`${n} try ${i}.addChild(node_${r+1});`)}if(r===0)t.push(` return ${i}.element();`),t.push("}")}function E(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('import { Craft } from "@stacksjs/craft";'),r.push(""),r.push("export function render(): Craft.Element {"),r.push(" return "+v(e,1)+";"),r.push("}"),r.join(`
|
|
4
4
|
`)}function v(e,t){let r=" ".repeat(t),n=[];for(let[a,l]of Object.entries(e.props))if(l.type==="literal"){let p=typeof l.value==="string"?`"${l.value}"`:String(l.value);n.push(`${a}: ${p}`)}let i=n.length>0?`{ ${n.join(", ")} }`:"{}",o=e.children.map((a)=>a.type==="text"?`"${a.props.text?.type==="literal"?a.props.text.value:""}"`:v(a,t+1)),s=o.length>0?`,
|
|
5
5
|
${r} [${o.join(`,
|
|
6
6
|
${r} `)}]`:"";return`Craft.create("${e.zigType}", ${i}${s})`}function H(e,t,r){if(t.target==="universal"){let n=[];n.push("// Universal entry point"),n.push("");for(let[i,o]of r)n.push(`// --- ${i.toUpperCase()} ---`),n.push(`#if ${i.toUpperCase()}`),n.push(o),n.push("#endif"),n.push("");return n.join(`
|
|
7
|
-
`)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function
|
|
8
|
-
export{
|
|
7
|
+
`)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function Do(e){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(t)=>{console.log(`[craft-compiler] File changed: ${t}`)}}}var K={compileToNative:Oo,createHotReloadServer:Do,NATIVE_COMPONENTS:qr},Pd=K;
|
|
8
|
+
export{qr,Oo,Do,Pd};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{z}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{z}from"./chunk-wm11csdm.js";import R from"fs";import g from"path";import C from"crypto";var S=new Set(["webp","avif","jpeg","png"]),T=new Set(["cover","contain","fill","inside","outside"]),q=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),k=4096,D=80,U="cover";async function bo(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=A(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=R.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await R.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=C.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":z(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await L(),F=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,F),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(F),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function ua(e){return async(t)=>await bo(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function A(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!q.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??k,l=t.maxHeight??k,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!S.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...S].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??D;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||U;if(!T.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...T].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function L(){return await import("./chunk-z2n1rtj5.js")}
|
|
3
|
+
export{bo,ua};
|