@stacksjs/stx 0.2.863 → 0.2.865
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-gp8hgpt9.js → chunk-01mwbg1r.js} +3 -3
- package/dist/{chunk-k7dxm48r.js → chunk-0dyec13e.js} +1 -1
- package/dist/{chunk-fnv94wc6.js → chunk-0v2yj490.js} +1 -1
- package/dist/chunk-16qzr5ga.js +2 -0
- package/dist/chunk-2hq6mq6r.js +2 -0
- package/dist/chunk-2qjyzekc.js +3 -0
- package/dist/{chunk-czca8yds.js → chunk-46x7a1cj.js} +1 -1
- package/dist/chunk-49r1z20v.js +2 -0
- package/dist/chunk-4b0mjyn7.js +2 -0
- package/dist/{chunk-y190sh29.js → chunk-4q0rgnw0.js} +9 -9
- package/dist/{chunk-5zzrrxns.js → chunk-4sfrfag1.js} +4 -4
- package/dist/{chunk-zsnmk5me.js → chunk-5dvkphbe.js} +1 -1
- package/dist/{chunk-qxw9h564.js → chunk-5ep1qbjt.js} +1 -1
- package/dist/{chunk-v408qsze.js → chunk-5kkq2eqr.js} +1 -1
- package/dist/{chunk-85zmxbt0.js → chunk-67xreg70.js} +4 -4
- package/dist/{chunk-gjngg182.js → chunk-6pqfar3p.js} +8 -8
- package/dist/{chunk-wk4wg6sn.js → chunk-764f1sf1.js} +2 -2
- package/dist/chunk-77km1je8.js +2 -0
- package/dist/{chunk-prrvggcy.js → chunk-78eyz4ch.js} +1 -1
- package/dist/{chunk-8502xb4n.js → chunk-79y9amt1.js} +7 -7
- package/dist/{chunk-8v1zpdef.js → chunk-7chzhef2.js} +1 -1
- package/dist/{chunk-sj3ry5ck.js → chunk-7xhwqc0c.js} +7 -1
- package/dist/chunk-822gnnpd.js +2 -0
- package/dist/{chunk-mfa07erx.js → chunk-83tvkw4y.js} +1 -1
- package/dist/{chunk-gw7t6a3t.js → chunk-86xt8cs8.js} +1 -1
- package/dist/{chunk-ntbe5q5x.js → chunk-8efn9agz.js} +2 -2
- package/dist/{chunk-58sh82aj.js → chunk-97cyjqa5.js} +1 -1
- package/dist/{chunk-jfmj0wsy.js → chunk-98v8smzf.js} +1 -1
- package/dist/chunk-9cwag0tk.js +2 -0
- package/dist/{chunk-32ty2zx6.js → chunk-9tsp5ytb.js} +1 -1
- package/dist/{chunk-xfd3yqgj.js → chunk-a2yk8sw0.js} +12 -12
- package/dist/chunk-aef82ns3.js +2 -0
- package/dist/{chunk-reeaknf2.js → chunk-ajkqbjbp.js} +1 -1
- package/dist/chunk-angv3d3s.js +2 -0
- package/dist/{chunk-z383x16t.js → chunk-aqn8y42n.js} +1 -1
- package/dist/{chunk-46ddesnf.js → chunk-b666d8m6.js} +1 -1
- package/dist/{chunk-vwwpbhd2.js → chunk-bzt73fj0.js} +1 -1
- package/dist/chunk-c2bhc5wg.js +2 -0
- package/dist/{chunk-ztbexx3h.js → chunk-c57g2mtw.js} +1 -1
- package/dist/{chunk-yakdcak2.js → chunk-c60qda5c.js} +1 -1
- package/dist/{chunk-az5xw3w8.js → chunk-cjy9cdm0.js} +1 -1
- package/dist/{chunk-nttsc0aw.js → chunk-dx2t73jn.js} +5 -5
- package/dist/{chunk-5p1k2h5q.js → chunk-dy1d7ep7.js} +1 -1
- package/dist/{chunk-yr1zx78b.js → chunk-e8y2c1sq.js} +2 -2
- package/dist/{chunk-1grdbpsk.js → chunk-efjmpq6r.js} +2 -2
- package/dist/{chunk-g4gcf4jn.js → chunk-et9pa7gr.js} +1 -1
- package/dist/chunk-f52b9hjv.js +2 -0
- package/dist/{chunk-021tjkd6.js → chunk-f57t1bcs.js} +1 -1
- package/dist/{chunk-qmkaqjba.js → chunk-f5vdse5a.js} +1 -1
- package/dist/{chunk-bx5d87xx.js → chunk-f6ypmk8x.js} +1 -1
- package/dist/{chunk-y036cwc7.js → chunk-fbtm3frc.js} +2 -2
- package/dist/{chunk-s9df8srx.js → chunk-fd1bpv35.js} +3 -3
- package/dist/{chunk-5s1fb8z4.js → chunk-fm9kas0a.js} +1 -1
- package/dist/{chunk-0xtda6aw.js → chunk-fmzyrg2e.js} +1 -1
- package/dist/{chunk-h816ta81.js → chunk-fnha6bbj.js} +2 -2
- package/dist/{chunk-qa5y30sy.js → chunk-g0xn80gz.js} +7 -7
- package/dist/{chunk-pyckafsb.js → chunk-g8zgfmk3.js} +1 -1
- package/dist/chunk-gp7derwj.js +2 -0
- package/dist/{chunk-wtfamngc.js → chunk-gwa31y9x.js} +4 -4
- package/dist/{chunk-x3p4emdp.js → chunk-hdyacfen.js} +1 -1
- package/dist/{chunk-jgra00m8.js → chunk-hwqrejq3.js} +1 -1
- package/dist/{chunk-w468n41y.js → chunk-j4mtcbvz.js} +18 -18
- package/dist/{chunk-xymr4ys9.js → chunk-jbgj2hph.js} +1 -1
- package/dist/{chunk-x512h2gv.js → chunk-kh6njq2r.js} +2 -2
- package/dist/{chunk-2n932qtv.js → chunk-mkyn95mf.js} +1 -1
- package/dist/{chunk-dtarm8x9.js → chunk-nack2xs5.js} +4 -4
- package/dist/{chunk-xcjvx6zt.js → chunk-p2f308sq.js} +1 -1
- package/dist/{chunk-zr22gtpf.js → chunk-p8apfhg9.js} +1 -1
- package/dist/{chunk-dpmayc2w.js → chunk-r0v2chpn.js} +2 -2
- package/dist/chunk-razx95wk.js +2 -0
- package/dist/{chunk-2c18y094.js → chunk-rb41t77f.js} +1 -1
- package/dist/{chunk-b6w0f610.js → chunk-rkd27m4m.js} +19 -19
- package/dist/{chunk-669b2bya.js → chunk-rw5492e2.js} +3 -3
- package/dist/chunk-tx6t331f.js +2 -0
- package/dist/chunk-v4pswhj1.js +2 -0
- package/dist/{chunk-15m7jnc0.js → chunk-w19myass.js} +1 -1
- package/dist/{chunk-r4v4vswq.js → chunk-w1vk83kx.js} +1 -1
- package/dist/{chunk-p0tkhd12.js → chunk-w8qr5414.js} +1 -1
- package/dist/chunk-x1zzy6c7.js +2 -0
- package/dist/{chunk-qbghf76y.js → chunk-x64afx6z.js} +2 -2
- package/dist/chunk-x95031qg.js +2 -0
- package/dist/{chunk-ks5p5w6z.js → chunk-xempkjvd.js} +1 -1
- package/dist/{chunk-yhc1c4tr.js → chunk-xt1cxmkx.js} +52 -52
- package/dist/chunk-yq0kcw7h.js +2 -0
- package/dist/chunk-z4yzk0d4.js +2 -0
- package/dist/chunk-z6c4c951.js +2 -0
- package/dist/chunk-z98qxjne.js +2 -0
- package/dist/{chunk-d0afg5f7.js → chunk-zacjg4p1.js} +1 -1
- package/dist/{chunk-hc6111md.js → chunk-zfd9dmsn.js} +4 -4
- package/dist/cli.js +13 -13
- package/dist/client/signals-component-props-runtime.js +7 -1
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/floating-actions-web.d.ts +20 -0
- package/dist/native/floating-actions-web.js +177 -0
- package/dist/native/floating-actions.d.ts +8 -1
- package/dist/native/floating-actions.js +1 -1
- package/dist/native/primitives/FloatingActions.stx +22 -2
- package/dist/pwa.js +3 -3
- package/dist/site-builder/build.d.ts +6 -0
- package/dist/site-builder/build.js +13 -3
- package/dist/site-builder/types.d.ts +3 -0
- package/dist/ssg.js +4 -4
- package/package.json +5 -5
- package/dist/chunk-0bfgsv31.js +0 -2
- package/dist/chunk-36j129p1.js +0 -2
- package/dist/chunk-7mjf144y.js +0 -2
- package/dist/chunk-a4cn8rf4.js +0 -2
- package/dist/chunk-ap84eenm.js +0 -2
- package/dist/chunk-as2ffje6.js +0 -2
- package/dist/chunk-c0t2tdfk.js +0 -2
- package/dist/chunk-caxqwrnc.js +0 -2
- package/dist/chunk-d9vzfbdp.js +0 -2
- package/dist/chunk-e634vffz.js +0 -3
- package/dist/chunk-g65dptx2.js +0 -2
- package/dist/chunk-kw11yydy.js +0 -2
- package/dist/chunk-ns04v3am.js +0 -2
- package/dist/chunk-p2etn78y.js +0 -2
- package/dist/chunk-r23zq8yk.js +0 -2
- package/dist/chunk-rqmb09ss.js +0 -2
- package/dist/chunk-sz6d3v6b.js +0 -2
- package/dist/chunk-va07zs9v.js +0 -2
- package/dist/chunk-vc42mvjn.js +0 -2
- package/dist/chunk-xzdkjkyp.js +0 -2
- package/dist/chunk-ybkwnscv.js +0 -2
- package/dist/chunk-z3gz5fy4.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function
|
|
2
|
+
var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function Dm(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,a,d)=>{let l=p(),y=u(s);return m(l,y,a.trim(),d.trim())}),n=n.replace(i,(r,s,a)=>{let d=p(),l=u(s);return m(d,l,a.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let i=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(i){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:i,timeout:n,delay:r,suspensible:s,retries:a}=t;return`
|
|
3
3
|
<div class="stx-async-component" data-async-id="${e}" data-component="${i}" data-status="pending">
|
|
4
4
|
<div class="stx-async-loading" data-async-loading="${e}">
|
|
5
5
|
${c}
|
|
@@ -226,7 +226,7 @@ catch (error) {
|
|
|
226
226
|
loadComponent();
|
|
227
227
|
})();
|
|
228
228
|
</script>
|
|
229
|
-
`}function
|
|
229
|
+
`}function Mm(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function Lm(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function jm(){return`
|
|
230
230
|
/* STX Async Component Styles */
|
|
231
231
|
.stx-async-component {
|
|
232
232
|
position: relative;
|
|
@@ -355,4 +355,4 @@ catch (error) {
|
|
|
355
355
|
console.log('[stx] Async component runtime initialized');
|
|
356
356
|
})();
|
|
357
357
|
`}
|
|
358
|
-
export{Mm,
|
|
358
|
+
export{Dm,Mm,Lm,jm,Bm};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$n,j}from"./chunk-k32q90b2.js";import m from"fs";import e from"path";async function Tn(r,o,i){if(r.__stx_runtime_config)return;let n=$n();if(n||i){r.__stx_runtime_config=n??j(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-
|
|
2
|
+
import{$n,j}from"./chunk-k32q90b2.js";import m from"fs";import e from"path";async function Tn(r,o,i){if(r.__stx_runtime_config)return;let n=$n();if(n||i){r.__stx_runtime_config=n??j(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-angv3d3s.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=j(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Pi(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
|
|
3
3
|
declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
|
|
4
4
|
`),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
|
|
5
5
|
declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{St,Xn,$h}from"./chunk-
|
|
2
|
+
import{St,Xn,$h}from"./chunk-7xhwqc0c.js";import{ge,Jn,Rh,Yn,To,ns,rs,Ah,Ph,Ih,Zn,Qn,$o,ss,Oh}from"./chunk-67dgp45w.js";import"./chunk-qjey0jk6.js";export{To as batch,$h as default,Jn as derived,Yn as effect,St as generateSignalsRuntime,Xn as generateSignalsRuntimeDev,Qn as isDerived,Zn as isSignal,Rh as memo,rs as onDestroy,ns as onMount,ss as peek,Ih as pendingLifecycleCounts,Ph as runDestroyCallbacks,Ah as runMountCallbacks,ge as state,$o as untrack,Oh as useOptimistic};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qh,Gf,tt,wc,Kh,gs,ms,hs}from"./chunk-zfd9dmsn.js";import"./chunk-46x7a1cj.js";import"./chunk-2qjyzekc.js";import"./chunk-jbgj2hph.js";import"./chunk-5dvkphbe.js";import"./chunk-rkd27m4m.js";import"./chunk-0dyec13e.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{Kh as clearOnceStore,wc as onceStore,tt as partialsCache,gs as processIncludes,ms as processStackPushDirectives,hs as processStackReplacements,qh as resetUnscopedSignalWarnings,Gf as topLevelElements};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ya,mm,ba,hm,Yl,Zl,ym,bm}from"./chunk-mkyn95mf.js";import"./chunk-w19myass.js";import"./chunk-gwa31y9x.js";import"./chunk-764f1sf1.js";import"./chunk-9zrvh3pz.js";import"./chunk-fbtm3frc.js";import"./chunk-dx2t73jn.js";import"./chunk-5dvkphbe.js";import"./chunk-xt1cxmkx.js";import"./chunk-w1vk83kx.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-83tvkw4y.js";import"./chunk-kh6njq2r.js";import{lt,gg}from"./chunk-rkd27m4m.js";import"./chunk-0dyec13e.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{ya as buildScriptVirtualFile,mm as buildVirtualSource,lt as extractScriptBlocks,gg as extractTemplateExpressions,Yl as findRuntimeTypeDeclarations,Zl as findStxModuleDeclarations,bm as formatTypecheckDiagnostics,hm as sourcePathFor,ym as typecheckStxFiles,ba as virtualPathFor};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Tl,$l}from"./chunk-qjey0jk6.js";import{m,O,ut,p}from"./chunk-qa5y30sy.js";import{K,_r,Fs,zs,fi,mi,Hs,Lt,Be,ye,Q,Tr,$r,de,ee,L,ct,Rr,wi,Ir,We,s,g,G,En}from"./chunk-b6w0f610.js";import{n}from"./chunk-e634vffz.js";import{le}from"./chunk-xymr4ys9.js";import{pr}from"./chunk-01c16zw4.js";import{r}from"./chunk-x7redxyd.js";import{b}from"./chunk-94mpe1ny.js";import{createHash as kt}from"crypto";import Y from"fs";import Z from"path";import Le from"fs";function Ae(e,i,t){let o=Buffer.alloc(t),a=Le.readSync(e,o,0,t,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let t=i(12,16);if(t==="VP8X")return(e[20]&16)!==0;if(t==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let t=Ae(i,0,33);if(t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255)return"none";if(t.length>=26&&t[0]===137&&t.toString("latin1",1,4)==="PNG"){let o=t[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(t.length>=25&&t.toString("latin1",0,4)==="RIFF"&&t.toString("latin1",8,12)==="WEBP"){if(ze(t))return"possible";let o=t.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import rn from"fs";import Fe from"os";import{fileURLToPath as yt}from"url";var _e=Symbol("stx.image-worker.unavailable");function sn(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,xt=[];async function on(){if(Pe<sn()){Pe++;return}await new Promise((e)=>xt.push(e)),Pe++}function an(){Pe--,xt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let t=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(t.protocol==="file:"&&rn.existsSync(yt(t)))return yt(t)}catch{}return pr(cn,e)}var bt=!1;function fe(e){if(!bt)bt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return _e}function Ie(e){return e instanceof Error?e.message:String(e)}async function He(e,i){let t;try{t=(await import("worker_threads")).Worker}catch(a){return fe(`could not load node:worker_threads: ${Ie(a)}`)}if(typeof t!=="function")return fe("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return fe("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new t(o)}catch(h){a(fe(`could not start ${o}: ${Ie(h)}`));return}let u=!1,f=!1,x=(h)=>{if(f)return;f=!0,h(),l.terminate()};l.on("message",(h)=>{if(h.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(h.type==="result"){x(()=>a(h.value));return}let d=Error(h.error?.message??"image worker failed");if(h.error?.name)d.name=h.error.name;if(h.error?.stack)d.stack=h.error.stack;x(()=>c(d))}),l.on("error",(h)=>{x(()=>u?c(h instanceof Error?h:Error(Ie(h)||"image worker crashed")):a(fe(`the worker failed before it was ready: ${Ie(h)}`)))}),l.on("exit",(h)=>{x(()=>u?c(Error("image worker exited before it finished")):a(fe(`the worker exited with code ${h} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],ve="/_stx/images",dn=`stx:${ve}:alpha-1`,gn=`stx:${ve}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function mn(e,i){let t=Z.dirname(Bun.resolveSync(e,i));while(t!==Z.dirname(t)){let o=Z.join(t,"package.json");if(Y.existsSync(o)){let a=JSON.parse(Y.readFileSync(o,"utf8"));if(a.name===e)return a.version}t=Z.dirname(t)}return}function vt(){if(Ee!==void 0)return Ee;let e;try{e=Z.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=pn.map((i)=>{let t;try{t=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${t??"unknown"}`}).join("+"),Ee}var wt=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[wt]??={catalog:new Map,transparent:new Set},e[wt]}var $t=new Set;function hn(e){return`/${e.split(Z.sep).map(encodeURIComponent).join("/")}`}function yn(e){let i=Z.extname(e),t=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=kt("sha256").update(e).digest("hex").slice(0,8);return`${t||"image"}-${o}`}function St(e,i=`stx:${ve}`){let t=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=Z.join(e,o);try{let c=await Y.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:t(o)}:null}catch{return null}},async write(o,a){let c=Z.join(e,o);await Y.promises.mkdir(Z.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Y.promises.writeFile(l,a),await Y.promises.rename(l,c),{bytes:a.byteLength,path:c,url:t(o)}},url:t}}async function At(e,i=e){let t=await Y.promises.readdir(i,{withFileTypes:!0});t.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of t){let c=Z.join(i,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!un.has(Z.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Z.relative(e,c)})}return o}function Ct(e,i){return e.map((t)=>({key:hn(t.relativePath),input:t.absolutePath,name:yn(t.relativePath),...bn(t.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Ue(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),t=new Set,o=8;if(i.length===0)return t;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((x)=>x.format==="png").sort((x,h)=>x.width-h.width)[0];try{let x=await a(new Uint8Array(await Y.promises.readFile(f?.path??u.fallback.path)));if(xn(x.data))t.add(l)}catch{t.add(l)}}));return t}function wn(e,i){let t=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=Y.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)Y.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,t.push(o),!$t.has(o))$t.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return t}async function $n(e){let i=[],t=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function qe(e){return Z.join(e,"undecodable.json")}function Sn(e){try{let i=Y.readFileSync(qe(e),"utf-8"),t=JSON.parse(i);return t&&typeof t==="object"?t:{}}catch{return{}}}function Cn(e,i){try{Y.mkdirSync(Z.dirname(qe(e)),{recursive:!0}),Y.writeFileSync(qe(e),JSON.stringify(i))}catch{}}function Rt(e){try{let i=Y.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function It(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Uo(e){let i=It(e);return i?we().catalog.get(i):void 0}function Wo(e){let i=It(e);return i?we().transparent.has(i):!1}function qo(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),t=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<t).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function Gh(e){let i=Uo(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:qo(i).map(({format:t,srcset:o})=>({type:`image/${t}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:Wo(e)?void 0:i.placeholder?.dataUrl}}function ys(){let e=we();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function Xh(e,i,t={}){if(!e||!Y.existsSync(e))return ys(),{count:0,fingerprint:""};if(t.offThread){let y=await He("delivery",{publicDir:e,outputDir:i});if(y!==_e)return Rn(y.state),y.result}let o=await At(e);if(o.length===0)return ys(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((y)=>{let w=a[y.relativePath];if(!w)return!0;let A=Rt(y.absolutePath);return!A||A.mtimeMs!==w.mtimeMs||A.size!==w.size});if(c.length===0)return ys(),{count:0,fingerprint:""};let l=St(Z.join(i,"_stx","images"),`${dn}:${vt()}`),u={outDir:Z.join(i,"_stx","images"),storage:St(Z.join(i,"_stx","images"),`${gn}:${vt()}`),baseUrl:ve,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),x=c,h;try{h=await f({...u,entries:Ct(c,l)})}catch(y){if(x=await $n(c),x.length===c.length)throw y;let w=new Set(x.map((k)=>k.relativePath)),A=!1;for(let k of c){if(w.has(k.relativePath))continue;let R=Rt(k.absolutePath);if(!R)continue;a[k.relativePath]=R,A=!0}if(A)Cn(i,a);if(x.length===0)return ys(),{count:0,fingerprint:""};h=await f({...u,entries:Ct(x,l)})}let d=await vn(h.entries),C=wn(h.entries,d),v=we();v.catalog=new Map(Object.entries(h.entries)),v.transparent=d;let S=d.size===0&&C.length===0?h.fingerprint:kt("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...d].sort(),droppedWebp:C.sort()})).digest("hex");return{count:x.length,fingerprint:S}}class Pt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,t,o){let a=fi(e,o);if(a!==void 0)return a;for(let c of mi(e,i,t,o))if(await s(c))return c;return null}}var ge=new Pt;var se="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var kn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||kn.has(i)}function ie(e,i){let t=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)t.push(g(c));continue}if(a===se){t.push(g(c));continue}t.push(`${g(c)}="${En(c,Xe(String(a)))}"`)}return t}function oe(e,i){let t=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){t.push(g(c));continue}if(typeof a==="object")continue;t.push(`${g(c)}="${En(c,Xe(String(a)))}"`)}return t}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var Ze={name:"StxLink",aliases:["stx-link"],render(e,i,t){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${n(o.value)}"`);else f.push(`href="${n(Tr(o.value,"navigable"))}"`);if(a)f.push(`class="${n(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${n(c)}"`),f.push(`data-stx-exact-active-class="${n(l)}"`),u)f.push("data-stx-prefetch");let x=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(x)f.push(`data-stx-active-match="${n(x)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...ie(e,h)),f.push(...oe(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var In=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return In.get(i)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}function Ne(e,i,t=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return t}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),t=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)t.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))t.push(`(max-width: ${u}px) ${c}`)}}else t.push(o);return t.join(", ")}function Ye(e,i,t,o){return i.map((a)=>`${$e(e,a,void 0,t,o)} ${a}w`).join(", ")}function _n(e,i,t,o,a){return i.map((c)=>{let l=t?t*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,t,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(t)c.push(`h_${t}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(t)c.set("h",String(t));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(t)c.set("height",String(t));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Nn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function On(e,i,t="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${t}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Qe={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,t){let o=H(e,"src")||"",a=Uo(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),x=H(e,"srcset"),h=H(e,"densities"),d=H(e,"format"),C=Wo(o)||Ge(o)?.transparent===!0,v=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),S=H(e,"placeholderColor")||"#e5e7eb",y=H(e,"provider"),w=H(e,"class")||H(e,"className")||"",A=H(e,"style")||"",k=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),J=Ne(e,"lazy",!0),M=Ne(e,"preload",!1),U=Ne(e,"priority",!1),z=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Ne(e,"picture",!1)||!!d,I=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=x||"",F="";if(a)T=a.sources[a.fallback.format]||"",F=f?Je(f):"100vw";else if(!T&&f&&y&&y!=="local"&&y!=="static")T=Ye(o,Ke,y,d),F=Je(f);else if(!T&&h){let V=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));T=_n(o,V,I,y,d)}else if(f)F=Je(f);let D=[];if(A)D.push(A);if(k)D.push(`object-fit:${k}`);if(R)D.push(`object-position:${R}`);if(I&&_)D.push(`aspect-ratio:${I}/${_}`);let re=[],ae=v==="blur"||v==="color"||v==="thumbhash";if(ae&&!C){let V=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:S}:Ge(o);if(V&&v==="color")D.push(`background-color:${V.color}`),re.push("backgroundColor");else if(V)D.push(`background-color:${V.color}`),D.push(`background-image:url(${V.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundColor","backgroundImage");else{let P=On(I||16,_||9,S);D.push(`background-image:url(${P})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundImage")}}else if(!ae&&v&&v!=="empty"&&v!=="none")D.push(`background-image:url(${n(v)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundImage");let j=a?.fallback.url||$e(o,I,_,y,d),X=[];if(X.push(`src="${n(Tr(j,"fetched"))}"`),X.push(`alt="${n(c)}"`),l)X.push(`width="${n(l)}"`);if(u)X.push(`height="${n(u)}"`);let Re=z||(U||M?"eager":J?"lazy":"");if(Re)X.push(`loading="${n(Re)}"`);if(U)X.push('fetchpriority="high"');if(X.push(`decoding="${n(N)}"`),w)X.push(`class="${n(w)}"`);if(D.length>0)X.push(`style="${n(D.join(";"))}"`);if(T)X.push(`srcset="${n(Tr(T,"fetched"))}"`);if(F)X.push(`sizes="${n(F)}"`);let xe=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(re.length>0){let V=typeof e.static.onload==="string"?e.static.onload:"",P=Nn(re)+(V?`;${V}`:"");X.push(`onload="${n(P)}"`),xe.add("onload")}X.push(...ie(e,xe)),X.push(...oe(e,xe));let ue=`<img ${X.join(" ")} />`,te="";if(M){let P=d==="webp"?"image/webp":d==="avif"?"image/avif":"";te=`<link rel="preload" as="image" href="${n(j)}"${P?` type="${P}"`:""}${T?` imagesrcset="${n(T)}"`:""}${F?` imagesizes="${n(F)}"`:""} />
|
|
2
|
+
import{Tl,$l}from"./chunk-qjey0jk6.js";import{m,O,ut,p}from"./chunk-g0xn80gz.js";import{K,_r,Fs,zs,fi,mi,Hs,Lt,Be,ye,Q,Tr,$r,de,ee,L,ct,Rr,wi,Ir,We,s,g,G,En}from"./chunk-rkd27m4m.js";import{n}from"./chunk-2qjyzekc.js";import{le}from"./chunk-jbgj2hph.js";import{pr}from"./chunk-01c16zw4.js";import{r}from"./chunk-x7redxyd.js";import{b}from"./chunk-94mpe1ny.js";import{createHash as kt}from"crypto";import Y from"fs";import Z from"path";import Le from"fs";function Ae(e,i,t){let o=Buffer.alloc(t),a=Le.readSync(e,o,0,t,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let t=i(12,16);if(t==="VP8X")return(e[20]&16)!==0;if(t==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let t=Ae(i,0,33);if(t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255)return"none";if(t.length>=26&&t[0]===137&&t.toString("latin1",1,4)==="PNG"){let o=t[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(t.length>=25&&t.toString("latin1",0,4)==="RIFF"&&t.toString("latin1",8,12)==="WEBP"){if(ze(t))return"possible";let o=t.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import rn from"fs";import Fe from"os";import{fileURLToPath as yt}from"url";var _e=Symbol("stx.image-worker.unavailable");function sn(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,xt=[];async function on(){if(Pe<sn()){Pe++;return}await new Promise((e)=>xt.push(e)),Pe++}function an(){Pe--,xt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let t=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(t.protocol==="file:"&&rn.existsSync(yt(t)))return yt(t)}catch{}return pr(cn,e)}var bt=!1;function fe(e){if(!bt)bt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return _e}function Ie(e){return e instanceof Error?e.message:String(e)}async function He(e,i){let t;try{t=(await import("worker_threads")).Worker}catch(a){return fe(`could not load node:worker_threads: ${Ie(a)}`)}if(typeof t!=="function")return fe("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return fe("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new t(o)}catch(h){a(fe(`could not start ${o}: ${Ie(h)}`));return}let u=!1,f=!1,x=(h)=>{if(f)return;f=!0,h(),l.terminate()};l.on("message",(h)=>{if(h.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(h.type==="result"){x(()=>a(h.value));return}let d=Error(h.error?.message??"image worker failed");if(h.error?.name)d.name=h.error.name;if(h.error?.stack)d.stack=h.error.stack;x(()=>c(d))}),l.on("error",(h)=>{x(()=>u?c(h instanceof Error?h:Error(Ie(h)||"image worker crashed")):a(fe(`the worker failed before it was ready: ${Ie(h)}`)))}),l.on("exit",(h)=>{x(()=>u?c(Error("image worker exited before it finished")):a(fe(`the worker exited with code ${h} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],ve="/_stx/images",dn=`stx:${ve}:alpha-1`,gn=`stx:${ve}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function mn(e,i){let t=Z.dirname(Bun.resolveSync(e,i));while(t!==Z.dirname(t)){let o=Z.join(t,"package.json");if(Y.existsSync(o)){let a=JSON.parse(Y.readFileSync(o,"utf8"));if(a.name===e)return a.version}t=Z.dirname(t)}return}function vt(){if(Ee!==void 0)return Ee;let e;try{e=Z.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=pn.map((i)=>{let t;try{t=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${t??"unknown"}`}).join("+"),Ee}var wt=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[wt]??={catalog:new Map,transparent:new Set},e[wt]}var $t=new Set;function hn(e){return`/${e.split(Z.sep).map(encodeURIComponent).join("/")}`}function yn(e){let i=Z.extname(e),t=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=kt("sha256").update(e).digest("hex").slice(0,8);return`${t||"image"}-${o}`}function St(e,i=`stx:${ve}`){let t=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=Z.join(e,o);try{let c=await Y.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:t(o)}:null}catch{return null}},async write(o,a){let c=Z.join(e,o);await Y.promises.mkdir(Z.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Y.promises.writeFile(l,a),await Y.promises.rename(l,c),{bytes:a.byteLength,path:c,url:t(o)}},url:t}}async function At(e,i=e){let t=await Y.promises.readdir(i,{withFileTypes:!0});t.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of t){let c=Z.join(i,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!un.has(Z.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Z.relative(e,c)})}return o}function Ct(e,i){return e.map((t)=>({key:hn(t.relativePath),input:t.absolutePath,name:yn(t.relativePath),...bn(t.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Ue(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),t=new Set,o=8;if(i.length===0)return t;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((x)=>x.format==="png").sort((x,h)=>x.width-h.width)[0];try{let x=await a(new Uint8Array(await Y.promises.readFile(f?.path??u.fallback.path)));if(xn(x.data))t.add(l)}catch{t.add(l)}}));return t}function wn(e,i){let t=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=Y.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)Y.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,t.push(o),!$t.has(o))$t.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return t}async function $n(e){let i=[],t=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function qe(e){return Z.join(e,"undecodable.json")}function Sn(e){try{let i=Y.readFileSync(qe(e),"utf-8"),t=JSON.parse(i);return t&&typeof t==="object"?t:{}}catch{return{}}}function Cn(e,i){try{Y.mkdirSync(Z.dirname(qe(e)),{recursive:!0}),Y.writeFileSync(qe(e),JSON.stringify(i))}catch{}}function Rt(e){try{let i=Y.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function It(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Uo(e){let i=It(e);return i?we().catalog.get(i):void 0}function Wo(e){let i=It(e);return i?we().transparent.has(i):!1}function qo(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),t=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<t).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function Gh(e){let i=Uo(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:qo(i).map(({format:t,srcset:o})=>({type:`image/${t}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:Wo(e)?void 0:i.placeholder?.dataUrl}}function ys(){let e=we();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function Xh(e,i,t={}){if(!e||!Y.existsSync(e))return ys(),{count:0,fingerprint:""};if(t.offThread){let y=await He("delivery",{publicDir:e,outputDir:i});if(y!==_e)return Rn(y.state),y.result}let o=await At(e);if(o.length===0)return ys(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((y)=>{let w=a[y.relativePath];if(!w)return!0;let A=Rt(y.absolutePath);return!A||A.mtimeMs!==w.mtimeMs||A.size!==w.size});if(c.length===0)return ys(),{count:0,fingerprint:""};let l=St(Z.join(i,"_stx","images"),`${dn}:${vt()}`),u={outDir:Z.join(i,"_stx","images"),storage:St(Z.join(i,"_stx","images"),`${gn}:${vt()}`),baseUrl:ve,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),x=c,h;try{h=await f({...u,entries:Ct(c,l)})}catch(y){if(x=await $n(c),x.length===c.length)throw y;let w=new Set(x.map((k)=>k.relativePath)),A=!1;for(let k of c){if(w.has(k.relativePath))continue;let R=Rt(k.absolutePath);if(!R)continue;a[k.relativePath]=R,A=!0}if(A)Cn(i,a);if(x.length===0)return ys(),{count:0,fingerprint:""};h=await f({...u,entries:Ct(x,l)})}let d=await vn(h.entries),C=wn(h.entries,d),v=we();v.catalog=new Map(Object.entries(h.entries)),v.transparent=d;let S=d.size===0&&C.length===0?h.fingerprint:kt("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...d].sort(),droppedWebp:C.sort()})).digest("hex");return{count:x.length,fingerprint:S}}class Pt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,t,o){let a=fi(e,o);if(a!==void 0)return a;for(let c of mi(e,i,t,o))if(await s(c))return c;return null}}var ge=new Pt;var se="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var kn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||kn.has(i)}function ie(e,i){let t=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)t.push(g(c));continue}if(a===se){t.push(g(c));continue}t.push(`${g(c)}="${En(c,Xe(String(a)))}"`)}return t}function oe(e,i){let t=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){t.push(g(c));continue}if(typeof a==="object")continue;t.push(`${g(c)}="${En(c,Xe(String(a)))}"`)}return t}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var Ze={name:"StxLink",aliases:["stx-link"],render(e,i,t){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${n(o.value)}"`);else f.push(`href="${n(Tr(o.value,"navigable"))}"`);if(a)f.push(`class="${n(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${n(c)}"`),f.push(`data-stx-exact-active-class="${n(l)}"`),u)f.push("data-stx-prefetch");let x=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(x)f.push(`data-stx-active-match="${n(x)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...ie(e,h)),f.push(...oe(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var In=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return In.get(i)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}function Ne(e,i,t=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return t}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),t=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)t.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))t.push(`(max-width: ${u}px) ${c}`)}}else t.push(o);return t.join(", ")}function Ye(e,i,t,o){return i.map((a)=>`${$e(e,a,void 0,t,o)} ${a}w`).join(", ")}function _n(e,i,t,o,a){return i.map((c)=>{let l=t?t*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,t,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(t)c.push(`h_${t}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(t)c.set("h",String(t));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(t)c.set("height",String(t));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Nn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function On(e,i,t="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${t}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Qe={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,t){let o=H(e,"src")||"",a=Uo(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),x=H(e,"srcset"),h=H(e,"densities"),d=H(e,"format"),C=Wo(o)||Ge(o)?.transparent===!0,v=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),S=H(e,"placeholderColor")||"#e5e7eb",y=H(e,"provider"),w=H(e,"class")||H(e,"className")||"",A=H(e,"style")||"",k=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),J=Ne(e,"lazy",!0),M=Ne(e,"preload",!1),U=Ne(e,"priority",!1),z=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Ne(e,"picture",!1)||!!d,I=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=x||"",F="";if(a)T=a.sources[a.fallback.format]||"",F=f?Je(f):"100vw";else if(!T&&f&&y&&y!=="local"&&y!=="static")T=Ye(o,Ke,y,d),F=Je(f);else if(!T&&h){let V=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));T=_n(o,V,I,y,d)}else if(f)F=Je(f);let D=[];if(A)D.push(A);if(k)D.push(`object-fit:${k}`);if(R)D.push(`object-position:${R}`);if(I&&_)D.push(`aspect-ratio:${I}/${_}`);let re=[],ae=v==="blur"||v==="color"||v==="thumbhash";if(ae&&!C){let V=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:S}:Ge(o);if(V&&v==="color")D.push(`background-color:${V.color}`),re.push("backgroundColor");else if(V)D.push(`background-color:${V.color}`),D.push(`background-image:url(${V.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundColor","backgroundImage");else{let P=On(I||16,_||9,S);D.push(`background-image:url(${P})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundImage")}}else if(!ae&&v&&v!=="empty"&&v!=="none")D.push(`background-image:url(${n(v)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundImage");let j=a?.fallback.url||$e(o,I,_,y,d),X=[];if(X.push(`src="${n(Tr(j,"fetched"))}"`),X.push(`alt="${n(c)}"`),l)X.push(`width="${n(l)}"`);if(u)X.push(`height="${n(u)}"`);let Re=z||(U||M?"eager":J?"lazy":"");if(Re)X.push(`loading="${n(Re)}"`);if(U)X.push('fetchpriority="high"');if(X.push(`decoding="${n(N)}"`),w)X.push(`class="${n(w)}"`);if(D.length>0)X.push(`style="${n(D.join(";"))}"`);if(T)X.push(`srcset="${n(Tr(T,"fetched"))}"`);if(F)X.push(`sizes="${n(F)}"`);let xe=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(re.length>0){let V=typeof e.static.onload==="string"?e.static.onload:"",P=Nn(re)+(V?`;${V}`:"");X.push(`onload="${n(P)}"`),xe.add("onload")}X.push(...ie(e,xe)),X.push(...oe(e,xe));let ue=`<img ${X.join(" ")} />`,te="";if(M){let P=d==="webp"?"image/webp":d==="avif"?"image/avif":"";te=`<link rel="preload" as="image" href="${n(j)}"${P?` type="${P}"`:""}${T?` imagesrcset="${n(T)}"`:""}${F?` imagesizes="${n(F)}"`:""} />
|
|
3
3
|
`}if(q){let V=[];if(a)for(let P of qo(a))V.push(`<source type="image/${P.format}" srcset="${n(P.srcset)}"${F?` sizes="${n(F)}"`:""} />`);if(!a&&(d==="avif"||d==="auto")){let P=$e(o,I,_,y,"avif"),B=T?Ye(o,Ke,y,"avif"):`${P}`;V.push(`<source type="image/avif" srcset="${n(B)}"${F?` sizes="${n(F)}"`:""} />`)}if(!a&&(d==="webp"||d==="auto")){let P=$e(o,I,_,y,"webp"),B=T?Ye(o,Ke,y,"webp"):`${P}`;V.push(`<source type="image/webp" srcset="${n(B)}"${F?` sizes="${n(F)}"`:""} />`)}return`${te}<picture>
|
|
4
4
|
${V.join(`
|
|
5
5
|
`)}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Eo,Eh,Th}from"./chunk-w19myass.js";import"./chunk-gwa31y9x.js";import"./chunk-764f1sf1.js";import"./chunk-9zrvh3pz.js";import"./chunk-fbtm3frc.js";import"./chunk-dx2t73jn.js";import"./chunk-5dvkphbe.js";import"./chunk-xt1cxmkx.js";import"./chunk-w1vk83kx.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-83tvkw4y.js";import"./chunk-kh6njq2r.js";import"./chunk-rkd27m4m.js";import"./chunk-0dyec13e.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{Th as clearComposableCache,Eh as getComposableScript,Eo as listComposableModules};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{wm}from"./chunk-fm9kas0a.js";import"./chunk-67xreg70.js";import"./chunk-7xhwqc0c.js";import"./chunk-97cyjqa5.js";import"./chunk-764f1sf1.js";import"./chunk-a2yk8sw0.js";import"./chunk-4q0rgnw0.js";import"./chunk-zfd9dmsn.js";import"./chunk-q1wxgw5s.js";import"./chunk-46x7a1cj.js";import"./chunk-2qjyzekc.js";import"./chunk-xempkjvd.js";import"./chunk-jbgj2hph.js";import"./chunk-fbtm3frc.js";import"./chunk-dx2t73jn.js";import"./chunk-5dvkphbe.js";import"./chunk-f57t1bcs.js";import"./chunk-xt1cxmkx.js";import"./chunk-w1vk83kx.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-83tvkw4y.js";import"./chunk-kh6njq2r.js";import"./chunk-rkd27m4m.js";import"./chunk-0dyec13e.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{wm as buildForProduction};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{S,_,Si,wn}from"./chunk-
|
|
2
|
+
import{S,_,Si,wn}from"./chunk-rkd27m4m.js";import{ni}from"./chunk-f57t1bcs.js";import{l}from"./chunk-46pxmpeb.js";import{D,f}from"./chunk-fd1bpv35.js";import M from"fs";import d from"path";import{hasLocalConfig as ye}from"bunfig";var _t={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function Qe(n){return`--stx-${n}`}function G(n,t){let s=t.lastIndexOf("-");if(s===-1)return typeof n[t]==="string"?n[t]:void 0;let r=n[t.slice(0,s)];if(!r||typeof r!=="object")return;let i=r[t.slice(s+1)];return typeof i==="string"?i:void 0}var $e=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function te(n,t){let s=t.trim();return G(n,s)??($e.test(s)?s:void 0)}function ne(n={}){return[...Object.keys(n.roles??{}).filter((t)=>!_t[t]).map((t)=>`roles.${t}`),...Object.keys(n.shapes??{}).filter((t)=>!Se[t]).map((t)=>`shapes.${t}`),...Object.keys(n.density??{}).filter((t)=>!De[t]).map((t)=>`density.${t}`)]}function se(n){let t={};for(let[s,r]of Object.entries(_t)){let i=G(n,r.light);if(i===void 0)continue;t[s]=`var(${Qe(s)}, ${i})`}return t}function re(n,t={}){let s=[],r=[];for(let[i,a]of Object.entries(_t)){let c=t[i],g=typeof c==="string"?c:c?.light,o=typeof c==="string"?c:c?.dark,u=g&&te(n,g)||G(n,a.light),m=o&&te(n,o)||G(n,a.dark);if(u===void 0)continue;if(s.push(` ${Qe(i)}: ${u};`),m!==void 0)r.push(` ${Qe(i)}: ${m};`)}if(s.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...s,"}",".dark {",...r,"}",""].join(`
|
|
3
3
|
`)}var Se={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function gn(n){return`--stx-radius-${n}`}function ie(){let n={};for(let[t,s]of Object.entries(Se))n[t]=`var(${gn(t)}, ${s.value})`;return n}function oe(n={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(Se).map(([t,s])=>` ${gn(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
4
|
-
`)}var
|
|
4
|
+
`)}var De={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},lr={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},ur={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function et(n){return`--stx-${n}`}function Q(n){let t=De[n];if(!t)throw Error(`[stx] unknown density token "${n}"`);return`var(${et(n)}, ${t.value})`}function ce(){let n={};for(let[t,s]of Object.entries(lr))n[t]=Q(s);return n}function ae(){let n={};for(let[t,{size:s,leading:r}]of Object.entries(ur))n[t]=[Q(s),{lineHeight:Q(r)}];return n}function le(n={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(De).map(([t,s])=>` ${et(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
5
5
|
`)}function de(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}function Y(n,t){let s={...n};for(let[r,i]of Object.entries(t))s[r]=de(i)&&de(s[r])?Y(s[r],i):i;return s}function ge(n,t){if(!t.fonts)return"";let s=new n({...t.config,fonts:t.fonts,cssVariables:!1}).toCSS(!1,t.minify);return s&&!t.minify?`${s}
|
|
6
|
-
`:s}function fe(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...a}=r,{extend:c,...g}=s,o=g.colors||{};g.colors={...o,...se(o)};let u=g.borderRadius||{};g.borderRadius={...u,...ie()};let m=g.spacing||{};g.spacing={...m,...ce()};let V=g.fontSize||{};g.fontSize={...V,...ae()};let R=Y(g,a),y=Y(c||{},i||{});if(Object.keys(y).length>0)R.extend=y;let P=[...n.safelist||[],...t.safelist||[]],z={...n.shortcuts||{},...t.shortcuts||{}},
|
|
7
|
-
`)}async function
|
|
6
|
+
`:s}function fe(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...a}=r,{extend:c,...g}=s,o=g.colors||{};g.colors={...o,...se(o)};let u=g.borderRadius||{};g.borderRadius={...u,...ie()};let m=g.spacing||{};g.spacing={...m,...ce()};let V=g.fontSize||{};g.fontSize={...V,...ae()};let R=Y(g,a),y=Y(c||{},i||{});if(Object.keys(y).length>0)R.extend=y;let P=[...n.safelist||[],...t.safelist||[]],z={...n.shortcuts||{},...t.shortcuts||{}},O=[...n.preflights||[],...t.preflights||[]],{fonts:W,...I}=n,{fonts:N,roles:T,shapes:A,density:k,...b}=t,p={roles:T,shapes:A,density:k},j=N??W;return{config:{...I,...b,theme:R,safelist:P,shortcuts:z,...O.length>0?{preflights:O}:{},content:[],output:""},safelist:P,shortcuts:z,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:re({...o,...R.colors},T)+oe(A)+le(k),unknownRoles:ne(p),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};import B from"fs";import Re from"path";var Te=256,C=new Map,ue=(n)=>Bun.hash(n).toString(16).padStart(16,"0").slice(0,16),pe=(n)=>l(process.cwd(),"css-assets",`${n}.css`);function L(n,t){if(C.delete(n),C.set(n,t),C.size>Te)C.delete(C.keys().next().value)}function he(n){let t=ue(n),s=pe(t);if(C.has(s))return L(s,n),t;let r;try{let i;try{i=B.readFileSync(s,"utf8")}catch{}if(i!==n)B.mkdirSync(Re.dirname(s),{recursive:!0}),r=`${s}.${process.pid}.${crypto.randomUUID()}.tmp`,B.writeFileSync(r,n,{flag:"wx"}),B.renameSync(r,s);return L(s,n),t}catch{return}finally{if(r)try{B.unlinkSync(r)}catch{}}}function Vf(n){if(!/^[a-f0-9]{16}$/.test(n))return;let t=pe(n),s=C.get(t);if(s!==void 0)return L(t,s),s;try{let r=B.readFileSync(t,"utf8");if(ue(r)!==n)return;return L(t,r),r}catch{return}}function me(){C.clear()}var h=null,H="";function xe(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;H=`${t}@${Math.trunc(M.statSync(t).mtimeMs)}`}catch{H=n}}var X=!1,v=null,F="",E=!1,je=256,w=new Map,K=null,be=null,U=new Map,ke=new Set;function q(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function J(n,t){if(w.has(n))w.delete(n);else if(w.size>=je)w.delete(w.keys().next().value);w.set(n,t)}async function Be(n,t=K){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${q(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function Ee(n,t,s=K){if(!s)return;try{if(!M.existsSync(s))M.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${q(n)}.css`),t)}catch{}}async function Ce(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var Pe=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Oe=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Ie(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of Pe)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Ne(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function yc(){if(X)return h;X=!0;try{let n=async(i)=>{for(let a of i){if(!await Bun.file(a).exists())continue;let c=await Ce(a);if(c){if(xe(a),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(a))}`);return c}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),a=await n([i]);if(!a)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return h=a,h}let t=await n(Ie());if(t)return h=t,h;let s=Oe;for(let i of s){let a=await Ce(i);if(a){h=a;try{xe(import.meta.resolve(i))}catch{H=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return h}}let r=await n(Ne());if(r)return h=r,h;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Vh(){Z.clear(),h=null,X=!1,v=null,F="",w.clear(),me(),be=null,U.clear()}var we=!1;async function bc(n){try{let t=ye({name:"css",cwd:n})?"css":ye({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!we)we=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function Uf(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-angv3d3s.js"),r=await s(n);if(r.css)if(typeof r.css==="string"){let i=d.isAbsolute(r.css)?r.css:d.resolve(n,r.css);if(await Bun.file(i).exists()){let a=await import(i);t=a.default||a,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${r.css}`)}}else{if(t={...r.css,content:r.css.content||[],preflight:r.css.preflight??!0,minify:r.css.minify??!1},r.css.config){let i=d.isAbsolute(r.css.config)?r.css.config:d.resolve(n,r.css.config);if(await Bun.file(i).exists()){let a=await import(i);t={...a.default||a,...t}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return t||await bc(n)}function Wf(n){try{let t=new WeakSet;return q(JSON.stringify(n??{},(s,r)=>{if(typeof r==="function")return`[fn]${String(r)}`;if(typeof r==="object"&&r!==null){if(t.has(r))return"[circular]";t.add(r)}return r})??"")}catch{return"unhashable"}}async function mn(n){if(E)return F;E=!0;try{let t=await yc();if(!t||!t.build)return E=!1,"";if(!v)v=await bc(n);if(!v)return E=!1,"";let s=t.defaultConfig?.theme||{},r=v.theme||{},i={...t.defaultConfig,...v,theme:{...s,...r,extend:{...s.extend||{},...r.extend||{}}}},a=performance.now(),c=await t.build(i),g=performance.now()-a;if(F=c.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${c.classes.size} classes in ${g.toFixed(1)}ms`),i.output){let o=d.isAbsolute(i.output)?i.output:d.join(n,i.output),u=d.dirname(o);if(!M.existsSync(u))M.mkdirSync(u,{recursive:!0});await Bun.write(o,c.css)}return E=!1,c.css}catch(t){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,t),E=!1,F}}async function dr(n){v=null,await mn(n)}function Uh(){return F}function qf(n){let t=new Set,s=/class\s*=\s*["']([^"']+)["']/gi,r=s.exec(n);while(r!==null){for(let c of r[1].split(/\s+/))if(c.trim())t.add(c.trim());r=s.exec(n)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,a=i.exec(n);while(a!==null){let c=a[1].match(/'([^']+)'/g);if(c){for(let g of c)for(let o of g.slice(1,-1).split(/\s+/))if(o.trim())t.add(o.trim())}a=i.exec(n)}return t}var Z=S(64);async function Kf(n,t){let s=()=>U.get(t?d.resolve(t):process.cwd())?.fingerprint??null,r=Z.get(_(n,t,s()));if(r!==void 0)return r;let i=await Ae(n,t);if(i)Z.set(_(n,t,s()),i);return i}function*ve(n){yield n;let t=new Set;for(let s of n.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let r=s[1];if(t.has(r))continue;t.add(r);let i=ni(r);if(i)yield i}}function Wh(n){return[...ve(n)].join(`
|
|
7
|
+
`)}async function Ae(n,t){try{let s=await yc();if(!s)return"";let r=new Set;for(let p of ve(n)){let j=typeof s.extractClasses==="function"?s.extractClasses(p):qf(p);for(let ee of j)r.add(ee)}if(r.size===0)return"";let i=t?d.resolve(t):process.cwd(),a=l(i,"cache");if(!K)K=a;let c=U.get(i);if(!c){let p=await Uf(i);c={config:p,fingerprint:Wf(p)},U.set(i,c),be=c.fingerprint}let g=[...r].sort().join(" "),o=`${H}::${c.fingerprint||"default"}::${g}`,u=w.get(o);if(u!==void 0)return J(o,u),u;let m=await Be(o,a);if(m!==null)return J(o,m),m;let V=s.defaultConfig||s.config,R=c.config||{},y=fe(V,R),{safelist:P,includePreflight:z,minify:O,tokenCSS:W}=y;if(y.unknownRoles.length>0&&!ke.has(i))ke.add(i),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${y.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let I=y.config,N=new s.CSSGenerator(I),T=I.shortcuts||R.shortcuts||{},A=Object.keys(T).filter((p)=>r.has(p)||P.includes(p));for(let p of P)if(!T[p])N.generate(p);for(let p of r)if(!T[p])N.generate(p);let k="";if(A.length>0){let p=new s.CSSGenerator(I);for(let j of A)p.generate(j);if(k=p.toCSS(!1,O),k&&!k.endsWith(`
|
|
8
8
|
`))k+=`
|
|
9
|
-
`}let b=k+
|
|
9
|
+
`}let b=k+N.toCSS(z,O);return b=ge(s.CSSGenerator,y)+W+b,J(o,b),Ee(o,b,a),b}catch(s){return console.warn("Failed to generate Css CSS:",s),""}}async function x(n,t,s=!1,r=!1){let i=await Kf(n,t);if(!i)return r?wn(n):n;let a=s?he(i):void 0,c=a?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${a}.css">`:`<style data-css="generated">
|
|
10
10
|
${i}
|
|
11
|
-
</style>`;if(r)return
|
|
12
|
-
${c}`);return c+n}function
|
|
11
|
+
</style>`;if(r)return Fe(n,c);let g=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(g.test(n)){let o=!1;return n.replace(g,()=>{if(o)return"";return o=!0,c})}if(n.includes("</head>"))return f(n,c);if(n.includes("<body"))return n.replace(/<body([^>]*)>/,`<body$1>
|
|
12
|
+
${c}`);return c+n}function Fe(n,t){let s=Si(n).map((o)=>({...o,replacement:""})),r=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,i=r.exec(n);if(i!==null){let o=!0;while(i!==null)s.push({start:i.index,end:i.index+i[0].length,replacement:o?t:""}),o=!1,i=r.exec(n)}else{let o=D(n);if(o!==-1)s.push({start:o,end:o,replacement:`${t}
|
|
13
13
|
`});else{let u=n.match(/<body([^>]*)>/);if(u?.index!==void 0)s.push({start:u.index,end:u.index+u[0].length,replacement:`${u[0]}
|
|
14
|
-
${t}`});else s.push({start:0,end:0,replacement:t})}}s.sort((o,u)=>o.start-u.start||o.end-u.end);for(let o=1;o<s.length;o++)if(s[o].start<s[o-1].end)return
|
|
14
|
+
${t}`});else s.push({start:0,end:0,replacement:t})}}s.sort((o,u)=>o.start-u.start||o.end-u.end);for(let o=1;o<s.length;o++)if(s[o].start<s[o-1].end)return Me(wn(n),t);let a=Array(s.length*2+1),c=0,g=0;for(let o of s)a[g++]=n.slice(c,o.start),a[g++]=o.replacement,c=o.end;return a[g]=n.slice(c),a.join("")}function Me(n,t){let s=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(s.test(n)){let r=!1;return n.replace(s,()=>{if(r)return"";return r=!0,t})}if(n.includes("</head>"))return f(n,t);if(n.includes("<body"))return n.replace(/<body([^>]*)>/,`<body$1>
|
|
15
15
|
${t}`);return t+n}
|
|
16
|
-
export{_t,Qe,Se,gn,
|
|
16
|
+
export{_t,Qe,Se,gn,De,lr,ur,et,e,Vf,yc,Vh,bc,Uf,Wf,mn,dr,Uh,qf,Kf,Wh,x};
|