@stacksjs/stx 0.2.664 → 0.2.667
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-028ee6q5.js +2 -0
- package/dist/chunk-02ymqwmj.js +2 -0
- package/dist/chunk-0syr525r.js +2 -0
- package/dist/chunk-1e79xcc8.js +2 -0
- package/dist/{chunk-tgm4mnn4.js → chunk-1ffjj2c6.js} +5 -5
- package/dist/chunk-1pnp91wx.js +2 -0
- package/dist/{chunk-2h8ea0we.js → chunk-1sr6c0nk.js} +2 -2
- package/dist/chunk-1y5ampxc.js +2 -0
- package/dist/chunk-2265dwpm.js +2 -0
- package/dist/chunk-280p4q7a.js +2 -0
- package/dist/{chunk-hb08vrbb.js → chunk-2dp7hyv7.js} +21 -21
- package/dist/{chunk-x34scshq.js → chunk-2zzc7006.js} +2 -2
- package/dist/{chunk-wpm58d6p.js → chunk-30nes8ne.js} +2 -2
- package/dist/{chunk-zaaeneq6.js → chunk-365vg0eg.js} +2 -2
- package/dist/{chunk-2qbvsvwc.js → chunk-3850m7ab.js} +6 -6
- package/dist/{chunk-ewcrsyr7.js → chunk-3hxd5td3.js} +2 -2
- package/dist/{chunk-pxqh758g.js → chunk-3y41efsf.js} +64 -15
- package/dist/{chunk-8hmds6dt.js → chunk-4701f9eh.js} +6 -6
- package/dist/{chunk-jrf01hfv.js → chunk-4c183zem.js} +1 -1
- package/dist/{chunk-vmht7yf9.js → chunk-4htp92hr.js} +15 -15
- package/dist/{chunk-etpjy429.js → chunk-4qh789bq.js} +4 -4
- package/dist/chunk-4s284y6c.js +2 -0
- package/dist/chunk-5zgrvj4b.js +2 -0
- package/dist/{chunk-f0mrs38w.js → chunk-6h06rqmj.js} +1 -1
- package/dist/{chunk-08fpcex5.js → chunk-6jwey47v.js} +4 -4
- package/dist/{chunk-yq021b3r.js → chunk-7d4z944r.js} +3 -3
- package/dist/{chunk-rjh2jwxx.js → chunk-7met6yva.js} +8 -8
- package/dist/chunk-7y2htsr8.js +2 -0
- package/dist/{chunk-zk537c7a.js → chunk-85sa9q09.js} +1 -1
- package/dist/{chunk-2jh21f1n.js → chunk-89jbdtgw.js} +1 -1
- package/dist/{chunk-yeb4yc8a.js → chunk-8gy90n5q.js} +1 -1
- package/dist/chunk-an6y1v5h.js +2 -0
- package/dist/chunk-b42p0kvz.js +2 -0
- package/dist/{chunk-mrrrngzd.js → chunk-b4pcw34n.js} +1 -1
- package/dist/chunk-b54s3qde.js +2 -0
- package/dist/chunk-b7e07ybq.js +3 -0
- package/dist/{chunk-0jhdrgpr.js → chunk-b823zxq6.js} +2 -2
- package/dist/{chunk-c9k40352.js → chunk-bdg0fydw.js} +1 -1
- package/dist/{chunk-32rg1d9j.js → chunk-bexp6dsp.js} +4 -4
- package/dist/chunk-bey0cjrp.js +2 -0
- package/dist/chunk-bheh3z8r.js +2 -0
- package/dist/chunk-bj2xzkv6.js +2 -0
- package/dist/{chunk-szyqxcfj.js → chunk-bnn7pd62.js} +2 -2
- package/dist/chunk-bs7hq5a3.js +2 -0
- package/dist/{chunk-39nvwdn6.js → chunk-c7d09931.js} +40 -40
- package/dist/chunk-crcypbbq.js +2 -0
- package/dist/{chunk-w2zceynt.js → chunk-dpvxe52r.js} +1 -1
- package/dist/chunk-dq42tzg1.js +2 -0
- package/dist/chunk-dvrndj0q.js +2 -0
- package/dist/{chunk-np1k9vsr.js → chunk-e1fetwbr.js} +1 -1
- package/dist/chunk-e4vpr36s.js +2 -0
- package/dist/{chunk-g4qz56km.js → chunk-ec9ztgxx.js} +2 -2
- package/dist/{chunk-yh0wb4n1.js → chunk-ecqrkyg8.js} +2 -2
- package/dist/{chunk-gd14j4h8.js → chunk-f62hpbw8.js} +1 -1
- package/dist/{chunk-1mf9658r.js → chunk-fbcp9hm4.js} +1 -1
- package/dist/chunk-fmzhrwt1.js +2 -0
- package/dist/{chunk-scea207h.js → chunk-fqhmee37.js} +27 -27
- package/dist/{chunk-y4crq495.js → chunk-fsef9nvs.js} +41 -41
- package/dist/{chunk-een2wqah.js → chunk-fvtwec1r.js} +1 -1
- package/dist/{chunk-fnm6bb59.js → chunk-fwwt7nrc.js} +1 -1
- package/dist/{chunk-t9mfztcs.js → chunk-fzqj1mjz.js} +3 -3
- package/dist/chunk-gfmw85vw.js +2 -0
- package/dist/{chunk-mmwg485j.js → chunk-ghsmfkq9.js} +1 -1
- package/dist/{chunk-tpyhs3rq.js → chunk-gjck0t32.js} +107 -107
- package/dist/chunk-hc70e121.js +2 -0
- package/dist/{chunk-hm4fzr68.js → chunk-hjn7qqrq.js} +9 -9
- package/dist/chunk-hqwr25qg.js +2 -0
- package/dist/{chunk-5w2jy5r9.js → chunk-hvf2e7pr.js} +2 -2
- package/dist/{chunk-0y05x1ef.js → chunk-j045bcpb.js} +2 -2
- package/dist/{chunk-yyfcg26x.js → chunk-j7mr8h2w.js} +5 -5
- package/dist/{chunk-v6zdb66z.js → chunk-jzy0pqez.js} +5 -5
- package/dist/{chunk-r7kmsq3n.js → chunk-ka8befem.js} +1 -1
- package/dist/chunk-m72b5043.js +2 -0
- package/dist/{chunk-v2x9vzgw.js → chunk-md2jn67b.js} +2 -2
- package/dist/{chunk-ze3p2wf6.js → chunk-mekhzhes.js} +9 -9
- package/dist/{chunk-rjekha6p.js → chunk-mn3mc6ax.js} +1 -1
- package/dist/chunk-n5r1xek6.js +2 -0
- package/dist/{chunk-ckmgf9x1.js → chunk-ndffc344.js} +1 -1
- package/dist/{chunk-d3bsfd10.js → chunk-npa7gze7.js} +2 -2
- package/dist/{chunk-8nryyqb5.js → chunk-p472crv1.js} +1 -1
- package/dist/{chunk-4yf1w261.js → chunk-pn1ehs6a.js} +2 -2
- package/dist/{chunk-7rta163c.js → chunk-pxdww4rb.js} +2 -2
- package/dist/{chunk-eqrkhc18.js → chunk-qjtpxsyx.js} +2 -2
- package/dist/{chunk-1kn1at1y.js → chunk-qrq88ng0.js} +1 -1
- package/dist/{chunk-gf3bxnpq.js → chunk-qxmyaajq.js} +1 -1
- package/dist/{chunk-pq5qr44q.js → chunk-qxsvd26z.js} +2 -2
- package/dist/chunk-r883qzmx.js +2 -0
- package/dist/{chunk-8x8ndh72.js → chunk-rns1e0c5.js} +1 -1
- package/dist/{chunk-gm026tmh.js → chunk-sgj6dt85.js} +1 -1
- package/dist/{chunk-3bpts69r.js → chunk-t226hswj.js} +1 -1
- package/dist/{chunk-djkjc1hj.js → chunk-t886718q.js} +9 -9
- package/dist/{chunk-jkvr7e91.js → chunk-tp4eqfxq.js} +2 -2
- package/dist/chunk-w1qvq9jf.js +2 -0
- package/dist/{chunk-rcwqm2qq.js → chunk-w51q85zg.js} +61 -61
- package/dist/chunk-wfjq9ww1.js +2 -0
- package/dist/chunk-wpsm2p9x.js +2 -0
- package/dist/{chunk-xv43szx0.js → chunk-xqp4hstk.js} +1 -1
- package/dist/chunk-ydf4fmr6.js +3 -0
- package/dist/{chunk-c1dkh0es.js → chunk-yfvm7q6t.js} +3 -3
- package/dist/{chunk-m040f3x9.js → chunk-yphmswg3.js} +1 -1
- package/dist/{chunk-eecgcj41.js → chunk-yscr04dv.js} +1 -1
- package/dist/{chunk-2xxmhmmj.js → chunk-znb4y12p.js} +5 -5
- package/dist/{chunk-5z1n02nd.js → chunk-zwkc8yge.js} +37 -37
- package/dist/{chunk-g90jymnr.js → chunk-zx2vhrps.js} +1 -1
- package/dist/cli.js +36 -36
- package/dist/client/signals-for-runtime.js +51 -2
- package/dist/client/signals-process-element-runtime.js +1 -1
- package/dist/component-renderer.js +4 -2
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/compiler/html-to-ir.js +14 -4
- package/dist/native/runtime/binding-tree.d.ts +1 -0
- package/dist/native/runtime/binding-tree.js +5 -0
- package/dist/native/runtime/craft-bridge.js +1 -0
- package/dist/native/runtime/craft.d.ts +1 -0
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.js +1 -2
- package/dist/slot-scopes.js +10 -2
- package/dist/slots.d.ts +2 -2
- package/dist/slots.js +21 -5
- package/dist/ssg.js +5 -5
- package/dist/types/config-types.d.ts +2 -0
- package/dist/utils.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-02e1s1k9.js +0 -2
- package/dist/chunk-2a4szpje.js +0 -3
- package/dist/chunk-2jkq8n45.js +0 -2
- package/dist/chunk-2kqdaehp.js +0 -2
- package/dist/chunk-43m1rvh3.js +0 -2
- package/dist/chunk-4q9g7893.js +0 -2
- package/dist/chunk-6cd5jwvt.js +0 -2
- package/dist/chunk-76j40sff.js +0 -2
- package/dist/chunk-8d2f2e42.js +0 -2
- package/dist/chunk-a2bw46t9.js +0 -2
- package/dist/chunk-aq3mpxrm.js +0 -2
- package/dist/chunk-c3qd0dk8.js +0 -3
- package/dist/chunk-ehy44811.js +0 -2
- package/dist/chunk-f4nrk8sv.js +0 -2
- package/dist/chunk-f85dmqn3.js +0 -2
- package/dist/chunk-gz90fqn8.js +0 -2
- package/dist/chunk-gzd7bmp5.js +0 -2
- package/dist/chunk-hhmj9gpk.js +0 -2
- package/dist/chunk-hj6fjqn8.js +0 -2
- package/dist/chunk-mhhg2sfa.js +0 -2
- package/dist/chunk-nz5t3kt9.js +0 -2
- package/dist/chunk-p69f9sdh.js +0 -2
- package/dist/chunk-paedp1tc.js +0 -2
- package/dist/chunk-pazbwfkm.js +0 -2
- package/dist/chunk-qdvv7h6r.js +0 -2
- package/dist/chunk-qfdy33jq.js +0 -2
- package/dist/chunk-qhx8htx2.js +0 -2
- package/dist/chunk-t6yjxhn8.js +0 -2
- package/dist/chunk-w0hby6q6.js +0 -2
- package/dist/chunk-wtfjk49r.js +0 -2
- package/dist/chunk-xn51xrjd.js +0 -2
- package/dist/chunk-xr3nknmb.js +0 -2
- package/dist/chunk-ypsym37h.js +0 -2
- package/dist/chunk-zv2v281j.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{f}from"./chunk-b7e07ybq.js";import{mkdir as w,writeFile as m}from"fs/promises";import{join as l}from"path";var g="https://api.iconify.design";async function D(){let e=await fetch(`${g}/collections`);if(!e.ok)throw Error(`Failed to fetch collections: ${e.statusText}`);return await e.json()}async function P(e,t){try{let c=f.resolve("@iconify/json"),r=`${`${c.substring(0,c.lastIndexOf("/node_modules/@iconify/json/"))}/node_modules/@iconify/json`}/json/${e}.json`,s=Bun.file(r);if(await s.exists()){let a=await s.json();if(t&&t.length>0){let d={};for(let u of t)if(a.icons[u])d[u]=a.icons[u];return{...a,icons:d}}return a}}catch{}let n=t&&t.length>0?`${g}/${e}.json?icons=${t.join(",")}`:`${g}/${e}.json`,i=await fetch(n);if(!i.ok)throw Error(`Failed to fetch icons for ${e}: ${i.statusText}`);return await i.json()}function F(e,t=24,n=24){return{body:e.body,width:e.width||t,height:e.height||n,viewBox:`0 0 ${e.width||t} ${e.height||n}`}}function T(e,t){let n=h(e);return`import type { IconData } from '@stacksjs/iconify-core'
|
|
3
3
|
|
|
4
4
|
export const ${n}: IconData = ${JSON.stringify(t,null,2)}
|
|
5
5
|
|
|
@@ -44,7 +44,7 @@ const svg = \`<svg xmlns="http://www.w3.org/2000/svg" width="\${iconWidth}" heig
|
|
|
44
44
|
|
|
45
45
|
{!! svg !!}
|
|
46
46
|
`}function _(e){let t=new Set;return`// Icon data exports
|
|
47
|
-
${e.map((i)=>{let o=
|
|
47
|
+
${e.map((i)=>{let o=h(i);if(t.has(o)){let r=i.replace(/[^a-zA-Z0-9]/g,"_");if(/^[0-9]/.test(r))r=`_${r}`;o=r;let s=2;while(t.has(o))o=`${r}_${s}`,s++}return t.add(o),`export { default as ${o} } from './${i}.js'`}).join(`
|
|
48
48
|
`)}
|
|
49
49
|
|
|
50
50
|
export * from './types.js'
|
|
@@ -155,7 +155,7 @@ ${t.license?.url?`License: ${t.license.url}`:""}
|
|
|
155
155
|
|
|
156
156
|
- Icons: ${t.author?.name||"Iconify"}${t.author?.url?` (${t.author.url})`:""}
|
|
157
157
|
- Iconify: https://iconify.design/
|
|
158
|
-
`}function M(e,t,n){let i=n.length,c=n.slice(0,5).map(
|
|
158
|
+
`}function M(e,t,n){let i=n.length,c=n.slice(0,5).map(h),o=c.map((s)=>`${s.charAt(0).toUpperCase()}${s.slice(1)}Icon`),r=n.map((s)=>`- \`${h(s)}\``).join(`
|
|
159
159
|
`);return`# ${t.name}
|
|
160
160
|
|
|
161
161
|
> ${t.name} icons for stx from Iconify
|
|
@@ -338,14 +338,14 @@ You can also use the \`size\` property as a shorthand for setting both width and
|
|
|
338
338
|
You can also control icon size via CSS:
|
|
339
339
|
|
|
340
340
|
\`\`\`css
|
|
341
|
-
.${
|
|
341
|
+
.${h(e)}-icon {
|
|
342
342
|
width: 1em;
|
|
343
343
|
height: 1em;
|
|
344
344
|
}
|
|
345
345
|
\`\`\`
|
|
346
346
|
|
|
347
347
|
\`\`\`html
|
|
348
|
-
<${o[0]||"DraftsIcon"} class="${
|
|
348
|
+
<${o[0]||"DraftsIcon"} class="${h(e)}-icon" />
|
|
349
349
|
\`\`\`
|
|
350
350
|
|
|
351
351
|
## Available Icons
|
|
@@ -502,4 +502,4 @@ ${t.license?.url?`See [license details](${t.license.url}) for more information.`
|
|
|
502
502
|
- [Iconify documentation](https://iconify.design/docs/)
|
|
503
503
|
- [stx iconify integration guide](../../docs/iconify.md)
|
|
504
504
|
`}async function G(e,t,n,i){console.log(`
|
|
505
|
-
\uD83D\uDCE6 Generating package for ${e}...`);let o=(await D())[e];if(!o)throw Error(`Collection ${e} not found`);console.log(` Collection: ${o.name}`),console.log(` Total icons: ${o.total}`);let r=await P(e,n),s=Object.keys(r.icons);console.log(` Generating ${s.length} icons...`);let a=l(t,`iconify-${e}`),d=l(a,"src");await w(d,{recursive:!0});let
|
|
505
|
+
\uD83D\uDCE6 Generating package for ${e}...`);let o=(await D())[e];if(!o)throw Error(`Collection ${e} not found`);console.log(` Collection: ${o.name}`),console.log(` Total icons: ${o.total}`);let r=await P(e,n),s=Object.keys(r.icons);console.log(` Generating ${s.length} icons...`);let a=l(t,`iconify-${e}`),d=l(a,"src");await w(d,{recursive:!0});let u=r.width||24,b=r.height||24;for(let p of s){let y=r.icons[p],I=F(y,u,b),z=T(p,I);await m(l(d,`${p}.ts`),z);let k=A(p,I);await m(l(d,`${p}-icon.stx`),k)}let v=_(s);await m(l(d,"index.ts"),v);let C=E(e);await m(l(d,"types.ts"),C);let S=N(e,o,s.length);await m(l(a,"package.json"),S);let x=U(e);await m(l(a,"build.ts"),x);let j=R(e,o,s.length);if(await m(l(a,"README.md"),j),i){let p=l(i,`iconify-${e}.md`),y=M(e,o,s);await w(i,{recursive:!0}),await m(p,y),console.log(` \u2713 Generated documentation in ${p}`)}console.log(` \u2713 Generated ${s.length} icons in ${a}`)}var B=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","let","static","yield","implements","interface","package","private","protected","public","await","eval","arguments"]);function h(e){let t=e.replace(/-([a-z0-9])/g,(n)=>n[1].toUpperCase());if(t=t.replace(/[^a-zA-Z0-9_$]/g,"_"),/^[0-9]/.test(t))t=`_${t}`;if(B.has(t))t=`${t}_`;return t}function W(e){let t=h(e);return t.charAt(0).toUpperCase()+t.slice(1)}export{D as fetchCollections,G as generatePackage};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var l=new Map,u=new Map;function m(t){if(l.set(t.name,t),t.client)u.set(t.name,t.client)}function
|
|
3
|
-
export{
|
|
2
|
+
var l=new Map,u=new Map;function m(t){if(l.set(t.name,t),t.client)u.set(t.name,t.client)}function bt(t){return m(t),{name:t.name,hasEndTag:t.hasEndTag??!0,description:t.description,handler:async(r,o,a,s)=>{let n=f(o,t.defaults);if(t.validate){let e=t.validate(n);if(e!==!0){let d=typeof e==="string"?e:`Invalid parameters for @${t.name}`;throw Error(d)}}let i=r;if(t.transform)i=await t.transform(r,n,a,s);if(t.clientScript){let e=t.clientScript(n);i+=`<script>${e}</script>`}if(t.css){let e=t.css(n);i+=`<style>${e}</style>`}return i}}}function f(t,c){let r={...c};for(let o of t){let a=o.indexOf(":"),s=o.indexOf("="),n=a>=0&&(s<0||a<s)?a:s;if(n>=0){let i=o.slice(0,n).trim(),e=o.slice(n+1).trim();if(e==="true")e=!0;else if(e==="false")e=!1;else if(e==="null")e=null;else if(!Number.isNaN(Number(e)))e=Number(e);else if(typeof e==="string"&&e.startsWith("{"))try{e=JSON.parse(e)}catch{}r[i]=e}else{let i=Object.keys(r).filter((e)=>!c||!(e in c)).length;r[i===0?"value":`arg${i}`]=o}}return r}
|
|
3
|
+
export{bt};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{dc,pc,fc}from"./chunk-
|
|
2
|
+
import{dc,pc,fc}from"./chunk-pxdww4rb.js";import{oe,Nn,Dn,Hs,Pr,Ir,Mn,Ln,Vs,Or}from"./chunk-wbzmr6a4.js";function z(t,a,i,r,d,y){let o=!0,u=new Set,h=(p)=>r.get?r.get(p):p,l=()=>h(t());return Object.defineProperty(l,"_isSignal",{value:!0}),Object.defineProperty(l,"modifiers",{get:a}),l.set=(p)=>{if(!o)return;let f=a(),e=r.set?r.set(p,f):p;if(f.trim&&typeof e==="string")e=e.trim();if(f.number&&typeof e==="string"&&e!==""){let s=Number(e);if(!Number.isNaN(s))e=s}if(Object.is(t(),e))return;t.set(e),i(e)},l.update=(p)=>l.set(p(l())),l.input=(p)=>{if(!a().lazy)l.set(p)},l.change=(p)=>{if(a().lazy)l.set(p)},l.subscribe=(p)=>{if(!o)return()=>{};let f=t.subscribe((e,s)=>p(h(e),h(s)));return u.add(f),()=>{f(),u.delete(f)}},Object.defineProperty(l,"value",{get:l,set:l.set}),d(()=>{o=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{o=!0}),l}function X(t,a=!0,i){if(!a||!t||typeof window>"u")return;let r=window;if(!r.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let o=JSON.parse(y?.textContent||"{}");r.__STX_DATA__=o&&typeof o==="object"&&!Array.isArray(o)?o:{}}catch{r.__STX_DATA__={}}}let d=r.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,t))try{return{data:i?i(d[t]):d[t]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(t){if(typeof window>"u")return;let a=window;if(t===void 0)a.__STX_DATA__={};else{if(!a.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");a.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{a.__STX_DATA__={}}if(a.__STX_DATA__)delete a.__STX_DATA__[t]}}function Y(t){let a=null;try{a=typeof indexedDB<"u"?indexedDB:null}catch{a=null}if(!a)return null;let i=a,r=t||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,h)=>{let l=i.open(r,1);l.onupgradeneeded=()=>{l.result.createObjectStore("kv")},l.onsuccess=()=>u(l.result),l.onerror=()=>h(l.error),l.onblocked=()=>h(Error("blocked"))}),d.catch(()=>{d=null});return d},o=(u,h)=>y().then((l)=>new Promise((p,f)=>{let e=l.transaction("kv",u),s=h(e.objectStore("kv"));e.oncomplete=()=>p(s?s.result:void 0),e.onerror=()=>f(e.error),e.onabort=()=>f(e.error)}));return{get:(u)=>o("readonly",(h)=>h.get(u)),set:(u,h)=>o("readwrite",(l)=>{l.put(h,u)}),remove:(u)=>o("readwrite",(h)=>{h.delete(u)}),removePrefix:(u)=>o("readwrite",(h)=>{h.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(t,a){let i=t||{},r=null;if(i.storage!==void 0)r=i.storage;else try{r=typeof localStorage<"u"?localStorage:null}catch{r=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let o=()=>{if(y)return d;y=!0;try{d=a?a():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,h=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),l=new Map,p=new Set,f=new Map,e=!1,s=Promise.resolve(),v=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!r)return!1;try{return r.setItem(n,c),!0}catch{return!1}},E=(n)=>{try{if(r)r.removeItem(n)}catch{}},S=()=>{if(e=!1,!f.size)return s;let n=Array.from(f.entries());return f.clear(),s=s.then(()=>Promise.all(n.map(([c,g])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(g===void 0?null:g))}catch{}return}let _;try{return _={v:g},d.set(c,_).catch(()=>{let x;try{x=JSON.stringify(g)}catch{return}return d?d.set(c,{j:x}).catch(()=>{m(c,x)}):void 0})}catch{return}}))).then(()=>{}),s},N=(n,c)=>{if(f.set(n,c),p.add(n),e)return;e=!0,h(()=>{S()})},D=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:v(c.j)};return},k={peek(n){if(l.has(n))return{value:l.get(n)};let c=null;try{c=r?r.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let g=v(c);return l.set(n,g),{value:g}},load(n){let c=k.peek(n),g=c?null:o();if(c||!g)return Promise.resolve(c);return g.get(n).then((_)=>{if(l.has(n))return{value:l.get(n)};let x=D(_);if(x)l.set(n,x.value),p.add(n);return x},()=>{return})},set(n,c){if(l.set(n,c),d&&p.has(n)){N(n,c);return}let g;try{g=JSON.stringify(c===void 0?null:c)}catch{return}if(g.length<=u&&m(n,g))return;if(!o()){if(g.length>u)m(n,g);return}E(n),N(n,c)},forget(n){for(let g of Array.from(l.keys()))if(g.indexOf(n)===0)l.delete(g);for(let g of Array.from(f.keys()))if(g.indexOf(n)===0)f.delete(g);for(let g of Array.from(p))if(g.indexOf(n)===0)p.delete(g);try{if(r)for(let g=r.length-1;g>=0;g--){let _=r.key(g);if(_&&_.indexOf(n)===0)r.removeItem(_)}}catch{}let c=o();if(!c)return s;return s=s.then(()=>c.removePrefix(n)).catch(()=>{}),s},flush(){return S()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")S()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{S()})}catch{}return k}function Z(t,a){if(!t)return!1;if(t===a.key)return!0;if(!a.url)return!1;if(t===a.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",r=new URL(t,i),d=new URL(a.url,i);if(r.origin!==d.origin||r.pathname!==d.pathname)return!1;return!r.search||r.search===d.search}catch{return!1}}function ee(t){let a=t.prefix||"stx:kept:",i=t.matches||((e,s)=>e===s.key||e===s.url),r=new Set,d=new Map,y,o=(e)=>e===void 0?y:e,u=(e,s)=>{let v=o(s);if(v===!1||v===null||v==="")return null;return`${a}${v===void 0?"":`${v}:`}query:${e}`},h=(e)=>{let s=e&&e.value;if(!s||typeof s!=="object"||!("d"in s))return;return{data:s.d,at:Number(s.at)||0}},l=()=>{let e=globalThis;return e.__stx_outboxes instanceof Map?e.__stx_outboxes:null},p={setScope(e){y=e},scope:()=>y,keyFor:u,seed(e,s){let v=u(e,s);return v?h(t.kept.peek(v)):void 0},restore(e,s){let v=u(e,s);return v?t.kept.load(v).then(h):Promise.resolve(void 0)},persist(e,s,v){let m=u(e,v);if(m)t.kept.set(m,{d:s,at:Date.now()})},overlay(e,s,v){let m=l();if(!m||!m.size)return s;let E=s;return m.forEach((S)=>{try{E=S.overlay(e,E,v)}catch{}}),E},watch(e){return r.add(e),()=>{r.delete(e)}},cachedQuery(e,s){let v=d.get(e);if(v){if(s&&v.__options)v.__options(s);return v}let m=s||{},E=m.initial===void 0?null:m.initial,S=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,D=()=>({key:e,url:N()}),k=S(),n=E,c=0,g=t.sharedRequest(),_=0,x=p.seed(e,k);if(x)n=x.data;let I=t.state(p.overlay(D(),n)),U=t.state(!1),q=t.state(!1),K=t.state(null),P=t.state(x?x.at:0),R=0,F=()=>{I.set(p.overlay(D(),n))},W=(b)=>{let w=R;p.restore(e,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!x)W(k);let wt=()=>{let b=S();if(b===k)return;k=b,R++,_=0,q.set(!1),U.set(!1),c=0;let w=p.seed(e,k);if(n=w?w.data:E,P.set(w?w.at:0),F(),!w)W(k)},_t=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,j=new Promise((M,V)=>{O=setTimeout(()=>{if(C)C.abort();V(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let M=m.fetch||((L,H)=>fetch(L,H)),V={method:"GET",headers:{Accept:"application/json"}};if(b)V.cache="no-cache";if(C)V.signal=C.signal;A=M(w,V).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,j]).then((M)=>{if(O)clearTimeout(O);return m.transform?m.transform(M):M},(M)=>{if(O)clearTimeout(O);throw M})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(_++,q.set(!0),c===0&&!P())U.set(!0);let j=()=>{if(w!==R)return;if(_=Math.max(0,_-1),!_)q.set(!1),U.set(!1)};return _t(b,T).then((A)=>{if(w!==R||T!==N())return j(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(e,A,k),F(),j(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return j(),I()})},O=`${w} ${T||""}`;return b?g.fresh(O,C):g.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return e},load(b){if(wt(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(e,n,k),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(r.add({target:D,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(D(),n,b.id),c=0,G(!0);F()}}),d.set(e,B),m.immediate)B.load();return B}},f=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(t.listen!==!1&&f&&typeof f.addEventListener==="function")f.addEventListener("stx:updated",(e)=>{let s=e.detail||{};if(s.kind!=="api"||typeof s.url!=="string")return;r.forEach((v)=>{if(i(s.url,v.target()))v.updated()})}),f.addEventListener("stx:outbox",(e)=>{let s=e.detail||{},v=s.sent&&typeof s.sent.id==="string"?s.sent:null;r.forEach((m)=>{if(v){let E=Array.isArray(v.affects)?v.affects:[],S=m.target();if(!E.some((N)=>i(N,S)))return}m.outbox(v)})});return p}function te(t){let a=t&&t.covers||((o,u)=>Object.is(o,u)),i=[],r=[],d=0,y=(o,u)=>{let h;try{h=Promise.resolve(u())}catch(f){h=Promise.reject(f)}let l={key:o,promise:h};i.push(l);let p=()=>{let f=i.indexOf(l);if(f!==-1)i.splice(f,1)};return h.then(p,p),h};return{run(o,u){for(let h of i)if(a(h.key,o))return h.promise;for(let h of r)if(a(h.key,o))return h.promise;return y(o,u)},fresh(o,u){for(let f of r)if(a(f.key,o))return f.promise;let h=i.filter((f)=>a(f.key,o)).map((f)=>f.promise);if(!h.length)return y(o,u);let l={key:o,promise:null},p=()=>{};return l.promise=Promise.all(h.map((f)=>f.then(p,p))).then(()=>{let f=r.indexOf(l);if(f!==-1)r.splice(f,1);return y(o,u)}),r.push(l),l.promise},latest(){let o=++d;return()=>o===d},get busy(){return i.length>0||r.length>0}}}var ne=` 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
|
|
@@ -1273,7 +1273,7 @@ else {
|
|
|
1273
1273
|
// implementation behind it (#1804).
|
|
1274
1274
|
useSlots: function() {
|
|
1275
1275
|
return window.__STX_CURRENT_SLOTS__ || {};
|
|
1276
|
-
},`;var
|
|
1276
|
+
},`;var fe=` var __bindIfCounter = 0;
|
|
1277
1277
|
// \u2500\u2500 x-else / x-else-if chain support (stacksjs/stx#1734) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
1278
1278
|
// Returns { name, terminal } for an else/else-if attribute present on el,
|
|
1279
1279
|
// or null. terminal=true for the catch-all x-else (no further siblings
|
|
@@ -1311,7 +1311,7 @@ else {
|
|
|
1311
1311
|
}
|
|
1312
1312
|
return chain;
|
|
1313
1313
|
}
|
|
1314
|
-
`;var
|
|
1314
|
+
`;var he=` // A false :if detaches its subtree before the DOMContentLoaded scope walk
|
|
1315
1315
|
// reaches nested components. Capture and bind their caller-owned props while
|
|
1316
1316
|
// the ancestor chain is still connected, otherwise resolveComponentCallerScope
|
|
1317
1317
|
// can no longer see the component that declared expressions such as
|
|
@@ -2945,6 +2945,30 @@ else if (immediate) {
|
|
|
2945
2945
|
}
|
|
2946
2946
|
|
|
2947
2947
|
const [, itemName, indexName, listExpr] = match;
|
|
2948
|
+
const slotMetadata = el.getAttribute('data-stx-slot-scope');
|
|
2949
|
+
let slotScopeInfo = null;
|
|
2950
|
+
let slotCallerScope = null;
|
|
2951
|
+
let readSlotBindings = null;
|
|
2952
|
+
if (slotMetadata) {
|
|
2953
|
+
try {
|
|
2954
|
+
slotScopeInfo = JSON.parse(slotMetadata);
|
|
2955
|
+
let receiver = el.parentElement;
|
|
2956
|
+
while (receiver) {
|
|
2957
|
+
if (slotScopeInfo.owner && receiver.getAttribute
|
|
2958
|
+
&& (receiver.getAttribute('data-stx-template-scope') || receiver.getAttribute('data-stx-scope')) === slotScopeInfo.owner) break;
|
|
2959
|
+
receiver = receiver.parentElement;
|
|
2960
|
+
}
|
|
2961
|
+
slotCallerScope = receiver && receiver.__stx_parent_scope
|
|
2962
|
+
|| findElementScope(el) || passedScope;
|
|
2963
|
+
const bindingScope = mergeTemplateScopes(slotCallerScope);
|
|
2964
|
+
slotScopeInfo.names.concat(['__stx_slot_value']).forEach(function(name) { delete bindingScope[name]; });
|
|
2965
|
+
readSlotBindings = __stxCompileScoped(bindingScope, ['__stx_slot_value'],
|
|
2966
|
+
'const ' + slotScopeInfo.binding + ' = __stx_slot_value; return {' + slotScopeInfo.names.join(',') + '};');
|
|
2967
|
+
} catch (error) {
|
|
2968
|
+
console.error('[stx] Invalid scoped slot binding:', error);
|
|
2969
|
+
return;
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2948
2972
|
let parent = el.parentNode;
|
|
2949
2973
|
|
|
2950
2974
|
// Guard: if element has no parent, it's detached - skip processing
|
|
@@ -3208,19 +3232,34 @@ catch (e) {
|
|
|
3208
3232
|
itemSignal._isStxLoopItem = true;
|
|
3209
3233
|
const indexSignal = state(index);
|
|
3210
3234
|
|
|
3211
|
-
const itemScope =
|
|
3235
|
+
const itemScope = slotScopeInfo
|
|
3236
|
+
? mergeTemplateScopes(globalHelpers, slotCallerScope)
|
|
3237
|
+
: mergeTemplateScopes(globalHelpers, passedScope, (capturedScope || {}));
|
|
3212
3238
|
Object.defineProperty(itemScope, itemName, { value: itemSignal, writable: true, enumerable: true, configurable: true });
|
|
3213
|
-
if (
|
|
3239
|
+
if (slotScopeInfo) {
|
|
3240
|
+
slotScopeInfo.names.forEach(function(name) {
|
|
3241
|
+
Object.defineProperty(itemScope, name, { enumerable: true, configurable: true, get: function() {
|
|
3242
|
+
return readSlotBindings(...__stxArgs(readSlotBindings, slotCallerScope), itemSignal())[name];
|
|
3243
|
+
} });
|
|
3244
|
+
});
|
|
3245
|
+
} else {
|
|
3246
|
+
if (indexName) Object.defineProperty(itemScope, indexName, { value: indexSignal, writable: true, enumerable: true, configurable: true });
|
|
3247
|
+
}
|
|
3214
3248
|
|
|
3215
3249
|
const elements = [];
|
|
3216
3250
|
if (isTemplate) {
|
|
3217
3251
|
elements.push(stxHost.anchor('stx-for-item-start'));
|
|
3218
3252
|
Array.from(templateContent.childNodes).forEach(node => {
|
|
3219
3253
|
const clone = stxHost.clone(node);
|
|
3254
|
+
if (slotScopeInfo) {
|
|
3255
|
+
clone.__stx_for_scope = itemScope;
|
|
3256
|
+
clone.__stx_slot_scope = itemScope;
|
|
3257
|
+
}
|
|
3220
3258
|
if (clone.nodeType === 1) {
|
|
3221
3259
|
// Structural directives need a live parent. Keep the iteration
|
|
3222
3260
|
// scope on the clone until the keyed diff inserts it, then bind.
|
|
3223
3261
|
clone.__stx_for_scope = itemScope;
|
|
3262
|
+
if (slotScopeInfo && !clone.hasAttribute('data-stx-scope')) clone.__stx_scope = itemScope;
|
|
3224
3263
|
markLoopRow(clone, itemName, itemSignal);
|
|
3225
3264
|
}
|
|
3226
3265
|
elements.push(clone);
|
|
@@ -3229,6 +3268,7 @@ catch (e) {
|
|
|
3229
3268
|
} else {
|
|
3230
3269
|
const clone = stxHost.clone(templateContent);
|
|
3231
3270
|
clone.__stx_for_scope = itemScope;
|
|
3271
|
+
if (slotScopeInfo && !clone.hasAttribute('data-stx-scope')) clone.__stx_scope = itemScope;
|
|
3232
3272
|
markLoopRow(clone, itemName, itemSignal);
|
|
3233
3273
|
elements.push(clone);
|
|
3234
3274
|
componentSetupTemplates.forEach(function(setupTemplate) {
|
|
@@ -3522,6 +3562,15 @@ catch (e) {
|
|
|
3522
3562
|
el.__stx_effect_disposers = trackEffects(function() { processElement(el, itemScope); });
|
|
3523
3563
|
el.removeAttribute('x-cloak');
|
|
3524
3564
|
el.querySelectorAll('[x-cloak]').forEach(c => c.removeAttribute('x-cloak'));
|
|
3565
|
+
} else if (slotScopeInfo && el.nodeType === Node.TEXT_NODE && (el.textContent || '').includes('{{')) {
|
|
3566
|
+
const itemScope = el.__stx_for_scope;
|
|
3567
|
+
delete el.__stx_for_scope;
|
|
3568
|
+
// Interpolation replaces the original text node. Its effects
|
|
3569
|
+
// therefore belong to the range anchor that survives removal.
|
|
3570
|
+
const release = trackEffects(function() { processElement(el, itemScope); });
|
|
3571
|
+
const anchor = elements[0];
|
|
3572
|
+
const previous = anchor.__stx_effect_disposers;
|
|
3573
|
+
anchor.__stx_effect_disposers = function() { if (previous) previous(); release(); };
|
|
3525
3574
|
}
|
|
3526
3575
|
});
|
|
3527
3576
|
newElements.push(...elements);
|
|
@@ -7342,7 +7391,7 @@ else {
|
|
|
7342
7391
|
// Capture scope NOW before effects run asynchronously
|
|
7343
7392
|
// Use the passed scope parameter (not global componentScope) to preserve context
|
|
7344
7393
|
// through nested @if/@for processing where componentScope may be restored
|
|
7345
|
-
const capturedScope = mergeTemplateScopes(globalHelpers, scope, (findElementScope(parentEl) || {}));
|
|
7394
|
+
const capturedScope = el.__stx_slot_scope || mergeTemplateScopes(globalHelpers, scope, (findElementScope(parentEl) || {}));
|
|
7346
7395
|
parts.forEach(part => {
|
|
7347
7396
|
const match = part.match(/^\\{\\{\\s*([\\s\\S]+?)\\s*\\}\\}$/);
|
|
7348
7397
|
if (match) {
|
|
@@ -9430,7 +9479,7 @@ finally {
|
|
|
9430
9479
|
window.addEventListener('storage', handler);
|
|
9431
9480
|
onDestroy(function() { window.removeEventListener('storage', handler); });
|
|
9432
9481
|
return s;
|
|
9433
|
-
}`;var
|
|
9482
|
+
}`;var pt=` function bindStyle(el, expr, passedScope = componentScope, isVisible) {
|
|
9434
9483
|
// Capture scope at setup time - use passed scope to preserve context
|
|
9435
9484
|
const capturedScope = mergeTemplateScopes(globalHelpers, passedScope, (findElementScope(el) || {}));
|
|
9436
9485
|
|
|
@@ -9464,7 +9513,7 @@ catch (e2) {
|
|
|
9464
9513
|
stxHost.setStyle(el, value, true);
|
|
9465
9514
|
});
|
|
9466
9515
|
}
|
|
9467
|
-
`;var
|
|
9516
|
+
`;var ht=` // <Suspense> boundary (#1742). Aggregates the loading/error state of every
|
|
9468
9517
|
// descendant suspense query (useQuery/useFetch with { suspense: true }) for
|
|
9469
9518
|
// which this is the nearest [data-stx-suspense] ancestor, and toggles three
|
|
9470
9519
|
// regions accordingly: [data-stx-suspense-fallback] while any query is loading,
|
|
@@ -10395,7 +10444,7 @@ else if (timer === null) {
|
|
|
10395
10444
|
subscribe: subscribe
|
|
10396
10445
|
};
|
|
10397
10446
|
}
|
|
10398
|
-
`;function
|
|
10447
|
+
`;function ft(){let t=xt(On());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 xt(t){let a=[],i=0,r="console.log(";while(i<t.length){let d=t.indexOf(r,i);if(d===-1){a.push(t.slice(i));break}a.push(t.slice(i,d));let y=1,o=d+r.length;while(o<t.length&&y>0){let u=t[o];if(u==='"'||u==="'"||u==="`"){let h=u;o++;while(o<t.length&&t[o]!==h){if(t[o]==="\\")o++;o++}o++;continue}if(u==="(")y++;else if(u===")")y--;o++}a.push("0"),i=o}return a.join("")}function On(){return`${ae}${Oe}
|
|
10399
10448
|
${Ye(ie,Se,Ee)}
|
|
10400
10449
|
|
|
10401
10450
|
${Re}
|
|
@@ -10420,22 +10469,22 @@ ${Ce}
|
|
|
10420
10469
|
${je}
|
|
10421
10470
|
${se}
|
|
10422
10471
|
${de}
|
|
10423
|
-
${
|
|
10472
|
+
${he}
|
|
10424
10473
|
${Be}
|
|
10425
10474
|
${et(pc(),fc(),dc())}
|
|
10426
10475
|
|
|
10427
|
-
${
|
|
10476
|
+
${ht}
|
|
10428
10477
|
${at}
|
|
10429
10478
|
${Ke}
|
|
10430
10479
|
${le}
|
|
10431
|
-
${
|
|
10480
|
+
${pt}
|
|
10432
10481
|
${yt}
|
|
10433
10482
|
${He}
|
|
10434
10483
|
${ue}
|
|
10435
10484
|
${qe}
|
|
10436
10485
|
${Ae}
|
|
10437
10486
|
${Ue}
|
|
10438
|
-
${
|
|
10487
|
+
${fe}
|
|
10439
10488
|
${Pe}
|
|
10440
10489
|
${Le}
|
|
10441
10490
|
${ce}
|
|
@@ -10473,5 +10522,5 @@ ${it}
|
|
|
10473
10522
|
${lt}
|
|
10474
10523
|
${st}
|
|
10475
10524
|
})();
|
|
10476
|
-
`}var Vd={state:oe,derived:Nn,effect:Dn,batch:Hs,onMount:Pr,onDestroy:Ir,isSignal:Mn,isDerived:Ln,untrack:Vs,peek:Or,generateSignalsRuntime:
|
|
10477
|
-
export{
|
|
10525
|
+
`}var Vd={state:oe,derived:Nn,effect:Dn,batch:Hs,onMount:Pr,onDestroy:Ir,isSignal:Mn,isDerived:Ln,untrack:Vs,peek:Or,generateSignalsRuntime:ft,generateSignalsRuntimeDev:On};
|
|
10526
|
+
export{ft,On,Vd};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{g,m,d}from"./chunk-c7d09931.js";import{N}from"./chunk-fsef9nvs.js";import{s}from"./chunk-w51q85zg.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let r=n[1],i=n[2];t.push({type:"suspense",name:r,content:i}),o=n.index+n[0].length}if(o<e.length){let r=e.slice(o);if(r.trim())t.push({type:t.length===0?"shell":"content",content:r})}if(t.length===0)t.push({type:"shell",content:e});return t}async function rd(e,t={},o={}){let n={...N,...o,streaming:{...q,...o.streaming}},r=n.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),f=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(f.trim())await g(f,h,e);let E=H(c),u=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let p=await s(c,h,e,n,u);for(let b=0;b<p.length;b+=r)i.enqueue(p.slice(b,b+r)),await new Promise((y)=>setTimeout(y,0))}else{let p=[],b=new RegExp(T.source,"g"),y;while((y=b.exec(c))!==null)p.push({name:y[1],content:y[2],start:y.index,end:y.index+y[0].length});let v=0;for(let _ of p){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await s(I,h,e,n,u);i.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await s(_.content,h,e,n,u);i.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await s(_,h,e,n,u);i.enqueue(C)}}}}else{let w=new Map;for(let l of E)if(l.type==="shell"||l.type==="content"){let p=await s(l.content,h,e,n,u);i.enqueue(p)}else if(l.type==="suspense"&&l.name){let p=`stx-suspense-${l.name}`;i.enqueue(`<div id="${p}" data-suspense="${l.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
|
-
</div>`),w.set(
|
|
4
|
+
</div>`),w.set(l.name,s(l.content,h,e,n,u))}i.enqueue(`
|
|
5
5
|
<script>
|
|
6
6
|
(function() {
|
|
7
7
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -17,12 +17,12 @@ import{f,g,m}from"./chunk-39nvwdn6.js";import{N}from"./chunk-y4crq495.js";import
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
})();
|
|
20
|
-
</script>`);let x=Array.from(w.entries()).map(async([
|
|
20
|
+
</script>`);let x=Array.from(w.entries()).map(async([l,p])=>{i.enqueue(await Li(l,p))});await Promise.all(x)}i.close()}catch(a){i.error(a)}}})}async function Li(e,t){try{let n=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
|
|
21
21
|
<script>
|
|
22
22
|
window.__stxSuspense.resolve('${e}', \`${n}\`);
|
|
23
23
|
</script>`}catch(o){let n=o instanceof Error?o.message:String(o);return`
|
|
24
24
|
<script>
|
|
25
|
-
window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${
|
|
25
|
+
window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${d(n)}</div>');
|
|
26
26
|
</script>`}}var il=`
|
|
27
27
|
<script>
|
|
28
28
|
(function(){
|
|
@@ -43,10 +43,10 @@ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading conte
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
})();
|
|
46
|
-
</script>`;function z(e,t,o){if(!t||t<=0)return e;let n,r=new Promise((i,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,r]).finally(()=>clearTimeout(n))}function sd(e,t=[],o={}){let n=o.timeoutMs??0;return new ReadableStream({async start(r){try{if(r.enqueue(e),t.length>0)r.enqueue(il),await Promise.all(t.map(async(i)=>{let a=z(i.render(),n,i.id);r.enqueue(await Li(i.id,a))}));r.close()}catch(i){r.error(i)}}})}var A=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function od(e,t){return e.replace(A,(o,n,r)=>{let i=n.trim(),a=r.split(/@fallback/i),S=a[0].trim(),
|
|
46
|
+
</script>`;function z(e,t,o){if(!t||t<=0)return e;let n,r=new Promise((i,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,r]).finally(()=>clearTimeout(n))}function sd(e,t=[],o={}){let n=o.timeoutMs??0;return new ReadableStream({async start(r){try{if(r.enqueue(e),t.length>0)r.enqueue(il),await Promise.all(t.map(async(i)=>{let a=z(i.render(),n,i.id);r.enqueue(await Li(i.id,a))}));r.close()}catch(i){r.error(i)}}})}var A=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function od(e,t){return e.replace(A,(o,n,r)=>{let i=n.trim(),a=r.split(/@fallback/i),S=a[0].trim(),f=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[i]=S,`<div data-suspense="${i}">${f}</div>`})}function id(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,n])=>typeof n==="function");return o.length>0?o.map(([n,r])=>({id:n,render:r})):void 0}async function ad(e,t={},o={}){let n={...N,...o,streaming:{...q,...o.streaming}},r=n.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),f=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(f.trim())await g(f,h,e);let E=new Set,u=n.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(u!=="manual"&&R.test(c))){let x=await s(c,h,e,n,E);for(let l=0;l<x.length;l+=r)i.enqueue(x.slice(l,l+r))}else{let x=[],l=new RegExp(T.source,"g"),p;while((p=l.exec(c))!==null)x.push({name:p[1],content:p[2],start:p.index,end:p.index+p[0].length});let b=0;for(let y of x){if(y.start>b){let _=c.slice(b,y.start);if(_.trim()){let C=await s(_,h,e,n,E);i.enqueue(C)}}let v=await s(y.content,h,e,n,E);i.enqueue(v),b=y.end}if(b<c.length){let y=c.slice(b);if(y.trim()){let v=await s(y,h,e,n,E);i.enqueue(v)}}}i.close()}catch(a){i.error(a)}}})}async function cd(e,t={}){let o={...N,...t,streaming:{...q,...t.streaming}},n=await Bun.file(e).text(),r=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),i=r?r[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S=a,f={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let u=c[1],R=c[2];f[u]=R}let h=a.replace(T,"");return{renderShell:async(u={})=>{let R={...u,__filename:e,__dirname:k.dirname(e)};return await g(i,R,e),s(h,R,e,o,new Set)},renderSection:async(u,R={})=>{try{if(!f[u])return`<div class="error-message">Section "${d(u)}" not found in template "${d(e)}"</div>`;let w={...R,__filename:e,__dirname:k.dirname(e)};await g(i,w,e);let x=new Set;return await s(f[u],w,e,o,x)}catch(w){let x=w instanceof Error?w.message:String(w);return m("Expression",x,e,f[u]||"",0,f[u]||"")}},getSections:()=>Object.keys(f),getTemplate:()=>S}}var al={name:"suspense",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let r=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${r} -->${e}<!-- @endsuspense:${r} -->`}},cl={name:"island",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let r=t[0].replace(/['"`]/g,""),i=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${r}-${Math.random().toString(36).substring(2,9)}`,S=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),f=S?S[1].trim():"",c=S?e.replace(S[0],""):e;return`<div data-island="${r}" data-island-id="${a}" data-priority="${i}">
|
|
47
47
|
${c}
|
|
48
48
|
<script type="application/json" data-island-props="${a}">
|
|
49
|
-
${
|
|
49
|
+
${f?`{${f}}`:"{}"}
|
|
50
50
|
</script>
|
|
51
51
|
</div>`}};function ld(e={}){let t=[];if(e.streaming?.enabled)t.push(al);if(e.hydration?.enabled)t.push(cl);return t}async function ud(e,t,o,n={}){return e}function dd(e,t={}){let o=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(i,a){a.enqueue(o.encode(i))}})),r=new Headers(t.headers);if(!r.has("Content-Type"))r.set("Content-Type","text/html; charset=utf-8");if(!r.has("Transfer-Encoding"))r.set("Transfer-Encoding","chunked");if(!r.has("X-Content-Type-Options"))r.set("X-Content-Type-Options","nosniff");if(!r.has("X-Accel-Buffering"))r.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:r})}function pd(e={mode:"full"}){let{mode:t,components:o={},dynamicImports:n=!0}=e,r=Object.entries(o).map(([i,a])=>`'${i}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
|
|
52
52
|
`);if(t==="loader")return`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Es,jt,bc,gu}from"./chunk-
|
|
2
|
+
import{Es,jt,bc,gu}from"./chunk-ecqrkyg8.js";export{Es as generateServiceWorker,gu as generateServiceWorkerAuto,jt as getServiceWorkerFileName,bc as isWorkboxEnabled};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{o}from"./chunk-
|
|
2
|
+
import{o}from"./chunk-fsef9nvs.js";import{Ve,Q}from"./chunk-yfvm7q6t.js";import{Ki}from"./chunk-6jwey47v.js";import{f}from"./chunk-b7e07ybq.js";import{existsSync as A,mkdirSync as x,copyFileSync as T,chmodSync as P,rmSync as ue}from"fs";import{join as c,basename as be,resolve as H}from"path";import{spawn as q}from"child_process";import{platform as ge}from"os";var Xd=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -2940,7 +2940,7 @@ ${a}`);return a+e}var Us={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
2940
2940
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
2941
2941
|
})();
|
|
2942
2942
|
</script>
|
|
2943
|
-
`;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,n,t)=>O("sidebar",n,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,n)=>O("sidebar",n,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,n,t)=>O(n,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,n,t,s)=>O(n,t,s.trim(),r,a)),e}function O(e,r,a,i,n){let t=i.components?.[e]||Us[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${n}-unknown" data-component="${e}">${a}</div>`;let s=N(r),d=[t.fallbackClasses||`${n}-${e}`];if(s.class)d.push(s.class),delete s.class;if(t.render)return s.__fallbackClasses=d.join(" "),t.render(s,a);let l=se(s,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${l}>`;return`<${t.fallbackTag} ${l}>${a}</${t.fallbackTag}>`}function N(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=a.exec(e))!==null){let[n,t,s,d]=i,l=s??d;if(n.startsWith(":"))r[t]=l;else if(n.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=l;else if(l===void 0)r[t]=!0;else r[t]=l}return r}function Y(e,r){let a=I(String(e.id||`craft-sidebar-${ie(r||JSON.stringify(e))}`)),i=te(e.spaces)||ee(r),n=i.length?[]:ae(e.sections)||z(r),t=String(e.selectedSpace||i[0]?.id||""),s=i.find((w)=>w.id===t)||i[0],d=String(e.selectedItem||e.selected||(i.length?s?.sections[0]?.items[0]?.id:n[0]?.items[0]?.id)||""),l={id:a,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:n,spaces:i,selectedSpace:t||void 0},u=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),
|
|
2943
|
+
`;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,n,t)=>O("sidebar",n,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,n)=>O("sidebar",n,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,n,t)=>O(n,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,n,t,s)=>O(n,t,s.trim(),r,a)),e}function O(e,r,a,i,n){let t=i.components?.[e]||Us[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${n}-unknown" data-component="${e}">${a}</div>`;let s=N(r),d=[t.fallbackClasses||`${n}-${e}`];if(s.class)d.push(s.class),delete s.class;if(t.render)return s.__fallbackClasses=d.join(" "),t.render(s,a);let l=se(s,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${l}>`;return`<${t.fallbackTag} ${l}>${a}</${t.fallbackTag}>`}function N(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=a.exec(e))!==null){let[n,t,s,d]=i,l=s??d;if(n.startsWith(":"))r[t]=l;else if(n.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=l;else if(l===void 0)r[t]=!0;else r[t]=l}return r}function Y(e,r){let a=I(String(e.id||`craft-sidebar-${ie(r||JSON.stringify(e))}`)),i=te(e.spaces)||ee(r),n=i.length?[]:ae(e.sections)||z(r),t=String(e.selectedSpace||i[0]?.id||""),s=i.find((w)=>w.id===t)||i[0],d=String(e.selectedItem||e.selected||(i.length?s?.sections[0]?.items[0]?.id:n[0]?.items[0]?.id)||""),l={id:a,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:n,spaces:i,selectedSpace:t||void 0},u=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),p=Number(e.width||e.sidebarWidth||286),b=e.native===!1||e.native==="false"?"false":"true",y=l.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${k(l.searchPlaceholder)}"></div>`:"",g;if(i.length)g=re(i,t,d);else if(n.length)g=n.map((w)=>M(w,d)).join("");else g=r;return`<aside class="${v(u)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${v(a)}" data-native="${b}" style="--craft-sidebar-width:${p}px">
|
|
2944
2944
|
${y}
|
|
2945
2945
|
${g}
|
|
2946
2946
|
</aside>
|
|
@@ -2961,21 +2961,21 @@ ${a}`);return a+e}var Us={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
2961
2961
|
${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${v(e.icon)}"${a}></span>`:""}
|
|
2962
2962
|
<span class="craft-sidebar-item-label">${k(e.label)}</span>
|
|
2963
2963
|
${e.badge?`<span class="craft-sidebar-item-badge">${k(e.badge)}</span>`:""}
|
|
2964
|
-
</button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function ie(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>0).toString(36)}function k(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function v(e){return k(e).replace(/`/g,"`")}function ne(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function se(e,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.nativeType}"`);for(let[n,t]of Object.entries(e))if(t===!0)i.push(n);else if(t!==!1&&t!==void 0&&t!==null){let s=String(t).replace(/"/g,""");i.push(`${n}="${s}"`)}return i.join(" ")}function Qd(e,r){Us[e]=r}function ep(){return{...Us}}import{copyFileSync as oe,mkdtempSync as ce,rmSync as de,writeFileSync as le}from"fs";import{tmpdir as fe}from"os";import{join as F}from"path";function pe(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let a=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(a.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${a.stderr.toString().trim()||a.stdout.toString().trim()}`);let i=JSON.parse(a.stdout.toString());if(!i||typeof i!=="object"||Array.isArray(i))throw Error("The macOS profile entitlements must be a dictionary.");return i}async function L(e,r=[],a={}){if(process.platform!=="darwin")return;let i=a.entitlements,n;try{if(a.provisioningProfile){if(!a.identity||a.identity==="-")throw Error("A provisioning profile requires a signing identity.");let l=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",a.provisioningProfile]);if(l.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let u=pe(l.stdout),
|
|
2965
|
-
</head>`)}let d=e.name||be(e.input,".stx"),l=e.version||"1.0.0",u=e.craftPath||await Vi();if(!u)return{success:!1,target:a,format:i,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${a}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${n}`),console.log(` Craft: ${u}`);let
|
|
2964
|
+
</button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function ie(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>0).toString(36)}function k(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function v(e){return k(e).replace(/`/g,"`")}function ne(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function se(e,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.nativeType}"`);for(let[n,t]of Object.entries(e))if(t===!0)i.push(n);else if(t!==!1&&t!==void 0&&t!==null){let s=String(t).replace(/"/g,""");i.push(`${n}="${s}"`)}return i.join(" ")}function Qd(e,r){Us[e]=r}function ep(){return{...Us}}import{copyFileSync as oe,mkdtempSync as ce,rmSync as de,writeFileSync as le}from"fs";import{tmpdir as fe}from"os";import{join as F}from"path";function pe(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let a=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(a.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${a.stderr.toString().trim()||a.stdout.toString().trim()}`);let i=JSON.parse(a.stdout.toString());if(!i||typeof i!=="object"||Array.isArray(i))throw Error("The macOS profile entitlements must be a dictionary.");return i}async function L(e,r=[],a={}){if(process.platform!=="darwin")return;let i=a.entitlements,n;try{if(a.provisioningProfile){if(!a.identity||a.identity==="-")throw Error("A provisioning profile requires a signing identity.");let l=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",a.provisioningProfile]);if(l.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let u=pe(l.stdout),p={};if(a.entitlements){let b=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",a.entitlements]);if(b.exitCode!==0)throw Error("Could not read the app entitlements plist.");p=JSON.parse(b.stdout.toString())}for(let b of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(u[b])p[b]=u[b];if(n=ce(F(fe(),"stx-entitlements-")),i=F(n,"entitlements.plist"),le(i,JSON.stringify(p)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",i]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");oe(a.provisioningProfile,F(e,"Contents","embedded.provisionprofile"))}for(let l of[...r,e]){let u=a.hardenedRuntime?["--options","runtime"]:[];if(l===e&&i)u.push("--entitlements",i);let p=a.identity&&a.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",a.identity||"-",p,...u,l],{stdout:"pipe",stderr:"pipe"}),[y,g]=await Promise.all([new Response(b.stderr).text(),b.exited]);if(g!==0)throw Error(`Could not sign native bundle ${l}: ${y.trim()}`)}let t=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[s,d]=await Promise.all([new Response(t.stderr).text(),t.exited]);if(d!==0)throw Error(`Invalid native bundle signature: ${s.trim()}`)}finally{if(n)de(n,{recursive:!0,force:!0})}}async function Hi(e){let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||R(),format:e.format||"app",error:`Input file not found: ${e.input}`};let a=e.target||R(),i=e.format||ke(a);if(e.backend&&a!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!A(H(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let n=e.output||c(process.cwd(),"dist","native");if(!A(n))x(n,{recursive:!0});let t=await o(process.cwd()),s=await Ki(e.input,{context:e.context,options:{...t,isDev:!1}});if(s=Bi(s,{debug:e.verbose}),s=zi(s),!s.includes("craft-component-styles")){if(s.includes("</head>"))s=s.replace("</head>",`${Fi}
|
|
2965
|
+
</head>`)}let d=e.name||be(e.input,".stx"),l=e.version||"1.0.0",u=e.craftPath||await Vi();if(!u)return{success:!1,target:a,format:i,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${a}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${n}`),console.log(` Craft: ${u}`);let p;switch(a){case"macos":p=await me(s,d,l,n,i,e,u);break;case"windows":p=await xe(s,d,l,n,i,e,u);break;case"linux":p=await ye(s,d,l,n,i,e,u);break;case"ios":p=await Se(s,d,l,n,e,u);break;case"android":p=await Ce(s,d,l,n,e,u);break;default:p={success:!1,target:a,format:i,error:`Unsupported target: ${a}`}}return p.duration=Date.now()-r,p}catch(a){return{success:!1,target:e.target||R(),format:e.format||"app",error:a.message,duration:Date.now()-r}}}async function me(e,r,a,i,n,t,s){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,l=c(i,`${r}.app`),u=c(l,"Contents"),p=c(u,"MacOS"),b=c(u,"Resources");ue(l,{recursive:!0,force:!0}),x(p,{recursive:!0}),x(b,{recursive:!0});let y=c(b,"index.html");await Bun.write(y,e);let g="";if(t.sidebar?.enabled&&t.sidebar?.config)g=c(b,"sidebar-config.json"),await Bun.write(g,JSON.stringify(t.sidebar.config));let w=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",C=t.menubarOnly??t.systemTray,m=t.bundleStyle||(await we(s)?"executable":"launcher");if(t.backend){if(!await he(s))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");T(s,c(p,r)),P(c(p,r),493);let S=Ve("native-backend");try{let h=c(S,"launcher.ts"),_=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(h,`import { runNativeBackend } from ${JSON.stringify(_)}
|
|
2966
2966
|
import handler from ${JSON.stringify(H(t.backend.entry))}
|
|
2967
2967
|
await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: handler,
|
|
2968
2968
|
maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
|
|
2969
|
-
`);let B=Bun.spawn([process.execPath,"build",h,"--compile","--minify","--no-compile-autoload-bunfig","--no-compile-autoload-dotenv","--outfile",c(
|
|
2969
|
+
`);let B=Bun.spawn([process.execPath,"build",h,"--compile","--minify","--no-compile-autoload-bunfig","--no-compile-autoload-dotenv","--outfile",c(p,"stx-backend")],{stdout:"pipe",stderr:"pipe"}),[E,W,J]=await Promise.all([new Response(B.stdout).text(),new Response(B.stderr).text(),B.exited]);if(J!==0)throw Error(`Native backend compilation failed: ${E}
|
|
2970
2970
|
${W}`)}finally{Q(S)}await Bun.write(c(b,"craft.json"),`${JSON.stringify({backend:{executable:"stx-backend"},title:t.window?.title||r,appName:r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools),frameless:Boolean(t.window?.frameless),transparent:Boolean(t.window?.transparent),alwaysOnTop:Boolean(t.window?.alwaysOnTop),resizable:t.window?.resizable!==!1,...t.trayPopover?{trayPopover:!0}:C?{menubarOnly:!0}:t.systemTray?{systemTray:!0}:{}},null,2)}
|
|
2971
|
-
`)}else if(m==="executable"){let S=c(
|
|
2972
|
-
`)}else{let S=c(
|
|
2971
|
+
`)}else if(m==="executable"){let S=c(p,r);T(s,S),P(S,493);let h={html:"index.html",title:t.window?.title||r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(t.trayPopover)h.trayPopover=!0;else if(C)h.menubarOnly=!0;else if(t.systemTray)h.systemTray=!0;if(t.window?.frameless)h.frameless=!0;if(t.window?.transparent)h.transparent=!0;if(t.window?.alwaysOnTop)h.alwaysOnTop=!0;if(t.window?.resizable===!1)h.resizable=!1;await Bun.write(c(b,"craft.json"),`${JSON.stringify(h,null,2)}
|
|
2972
|
+
`)}else{let S=c(p,"craft");T(s,S),P(S,493);let h=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",B=`#!/bin/bash
|
|
2973
2973
|
set -euo pipefail
|
|
2974
2974
|
DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
|
2975
2975
|
RESOURCES="$DIR/../Resources"
|
|
2976
2976
|
exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
|
|
2977
2977
|
${[`--title "${t.window?.title||r}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,t.trayPopover?"--tray-popover":C?"--menubar-only":t.systemTray?"--system-tray":"",t.devTools?"":"--no-devtools",t.window?.frameless?"--frameless":"",t.window?.transparent?"--transparent":"",t.window?.alwaysOnTop?"--always-on-top":"",t.window?.resizable===!1?"--no-resize":"",h].filter(Boolean).join(" \\\n ")}
|
|
2978
|
-
`,E=c(
|
|
2978
|
+
`,E=c(p,r);await Bun.write(E,B),P(E,493)}let D=Boolean(t.icon&&await Bun.file(t.icon).exists());if(D)T(t.icon,c(b,"AppIcon.icns"));let V={CFBundleInfoDictionaryVersion:"6.0",CFBundleExecutable:r,CFBundleIdentifier:d,CFBundleName:r,CFBundleDisplayName:r,CFBundleShortVersionString:a,CFBundleVersion:a,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.trayPopover||(t.menubarOnly??Boolean(t.systemTray)),...D?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(c(u,"Info.plist"),ve(V)),await L(l,t.backend?[c(p,"stx-backend")]:m==="launcher"?[c(p,"craft")]:[],t.macosSigning),n==="dmg"){let S=c(i,`${r}-${a}.dmg`),h=await $e(l,S,r);if(!h.success)return{success:!1,target:"macos",format:"dmg",error:h.error};return{success:!0,target:"macos",format:"dmg",outputPath:S}}return{success:!0,target:"macos",format:"app",outputPath:l}}async function he(e){let r=Bun.spawn([e,"--capabilities"],{stdout:"pipe",stderr:"pipe"}),a=setTimeout(()=>r.kill(),5000);try{let[i,n,t]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text(),r.exited]);if(t!==0)return!1;return JSON.parse(`${i}${n}`.trim()).bundleBackend===!0}catch{return!1}finally{clearTimeout(a)}}async function we(e){try{let r=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[a,i]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]);await r.exited;let t=`${a}
|
|
2979
2979
|
${i}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[s,d,l]=t.slice(1).map(Number);if(s>0||d>0)return!0;return l>=57}catch{return!1}}function j(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ve(e){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
2980
2980
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
2981
2981
|
<plist version="1.0">
|
|
@@ -2993,7 +2993,7 @@ set DIR=%~dp0
|
|
|
2993
2993
|
--height ${t.window?.height||800} ^
|
|
2994
2994
|
${t.systemTray?"--system-tray":""} ^
|
|
2995
2995
|
${t.devTools?"":"--no-devtools"}
|
|
2996
|
-
`;if(await Bun.write(c(d,`${r}.bat`),u),n==="zip"){let
|
|
2996
|
+
`;if(await Bun.write(c(d,`${r}.bat`),u),n==="zip"){let p=c(i,`${r}-${a}-windows.zip`),b=await Te(d,p);if(!b.success)return{success:!1,target:"windows",format:"zip",error:b.error};return{success:!0,target:"windows",format:"zip",outputPath:p}}return{success:!0,target:"windows",format:"app",outputPath:d}}async function ye(e,r,a,i,n,t,s){let d=c(i,r);x(d,{recursive:!0});let l=c(d,"index.html");await Bun.write(l,e);let u=c(d,"craft");T(s,u),P(u,493);let p=`#!/bin/bash
|
|
2997
2997
|
set -euo pipefail
|
|
2998
2998
|
DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
|
2999
2999
|
exec "$DIR/craft" --html-file "$DIR/index.html" \\
|
|
@@ -3002,14 +3002,14 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
|
|
|
3002
3002
|
--height ${t.window?.height||800} \\
|
|
3003
3003
|
${t.systemTray?"--system-tray":""} \\
|
|
3004
3004
|
${t.devTools?"":"--no-devtools"}
|
|
3005
|
-
`,b=c(d,r.toLowerCase());await Bun.write(b,
|
|
3005
|
+
`,b=c(d,r.toLowerCase());await Bun.write(b,p),P(b,493);let y=`[Desktop Entry]
|
|
3006
3006
|
Type=Application
|
|
3007
3007
|
Name=${r}
|
|
3008
3008
|
Exec=${b}
|
|
3009
3009
|
Terminal=false
|
|
3010
3010
|
Categories=Utility;
|
|
3011
|
-
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),y),n==="deb"){let g=c(i,`${r.toLowerCase()}_${a}_amd64.deb`),w=await Pe(d,g,r,a,t);if(!w.success)return{success:!1,target:"linux",format:"deb",error:w.error};return{success:!0,target:"linux",format:"deb",outputPath:g}}if(n==="appimage"){let g=c(i,`${r}-${a}-x86_64.AppImage`),w=await Ie(d,g,r,t);if(!w.success)return{success:!1,target:"linux",format:"appimage",error:w.error};return{success:!0,target:"linux",format:"appimage",outputPath:g}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Se(e,r,a,i,n,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ce(e,r,a,i,n,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function Vi(){let e=process.env.CRAFT_BIN;if(e){if(!A(e))throw Error(`CRAFT_BIN points to a missing file: ${e}`);return e}return Bun.which("craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function R(){switch(ge()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function ke(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function $e(e,r,a){return new Promise((i)=>{let n=q("hdiutil",["create","-volname",a,"-srcfolder",e,"-ov","-format","UDZO",r]);n.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),n.on("error",(t)=>{i({success:!1,error:t.message})})})}async function Te(e,r){return new Promise((a)=>{let i=q("zip",["-r",r,"."],{cwd:e});i.on("close",(n)=>{if(n===0)a({success:!0});else a({success:!1,error:`zip exited with code ${n}`})}),i.on("error",(n)=>{a({success:!1,error:n.message})})})}async function Pe(e,r,a,i,n){return new Promise((t)=>{let s=
|
|
3012
|
-
exec /usr/share/${a.toLowerCase()}/${a.toLowerCase()} "$@"`;
|
|
3011
|
+
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),y),n==="deb"){let g=c(i,`${r.toLowerCase()}_${a}_amd64.deb`),w=await Pe(d,g,r,a,t);if(!w.success)return{success:!1,target:"linux",format:"deb",error:w.error};return{success:!0,target:"linux",format:"deb",outputPath:g}}if(n==="appimage"){let g=c(i,`${r}-${a}-x86_64.AppImage`),w=await Ie(d,g,r,t);if(!w.success)return{success:!1,target:"linux",format:"appimage",error:w.error};return{success:!0,target:"linux",format:"appimage",outputPath:g}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Se(e,r,a,i,n,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ce(e,r,a,i,n,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function Vi(){let e=process.env.CRAFT_BIN;if(e){if(!A(e))throw Error(`CRAFT_BIN points to a missing file: ${e}`);return e}return Bun.which("craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function R(){switch(ge()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function ke(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function $e(e,r,a){return new Promise((i)=>{let n=q("hdiutil",["create","-volname",a,"-srcfolder",e,"-ov","-format","UDZO",r]);n.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),n.on("error",(t)=>{i({success:!1,error:t.message})})})}async function Te(e,r){return new Promise((a)=>{let i=q("zip",["-r",r,"."],{cwd:e});i.on("close",(n)=>{if(n===0)a({success:!0});else a({success:!1,error:`zip exited with code ${n}`})}),i.on("error",(n)=>{a({success:!1,error:n.message})})})}async function Pe(e,r,a,i,n){return new Promise((t)=>{let s=Ve("deb");try{let d=c(s,"pkg"),l=c(d,"DEBIAN"),u=c(d,"usr","bin"),p=c(d,"usr","share","applications"),b=c(d,"usr","share",a.toLowerCase());x(l,{recursive:!0}),x(u,{recursive:!0}),x(p,{recursive:!0}),x(b,{recursive:!0});let y=f("fs").readdirSync(e);for(let m of y)T(c(e,m),c(b,m));let g=`#!/bin/bash
|
|
3012
|
+
exec /usr/share/${a.toLowerCase()}/${a.toLowerCase()} "$@"`;f("fs").writeFileSync(c(u,a.toLowerCase()),g),P(c(u,a.toLowerCase()),493);let w=`Package: ${a.toLowerCase()}
|
|
3013
3013
|
Version: ${i}
|
|
3014
3014
|
Section: utils
|
|
3015
3015
|
Priority: optional
|
|
@@ -3017,17 +3017,17 @@ Architecture: amd64
|
|
|
3017
3017
|
Depends: libgtk-3-0, libwebkit2gtk-4.0-37
|
|
3018
3018
|
Maintainer: ${n.author||"Unknown"}
|
|
3019
3019
|
Description: ${n.description||a}
|
|
3020
|
-
`;
|
|
3020
|
+
`;f("fs").writeFileSync(c(l,"control"),w);let C=q("dpkg-deb",["--build",d,r]);C.on("close",(m)=>{if(Q(s),m===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${m}`})}),C.on("error",(m)=>{Q(s),t({success:!1,error:m.message})})}catch(d){Q(s),t({success:!1,error:d.message})}})}async function Ie(e,r,a,i){return new Promise((n)=>{let t=Ve("appimage");try{let s=c(t,`${a}.AppDir`),d=c(s,"usr"),l=c(d,"bin"),u=c(d,"share");x(l,{recursive:!0}),x(u,{recursive:!0});let p=c(u,a.toLowerCase());x(p,{recursive:!0});let b=f("fs").readdirSync(e);for(let m of b)T(c(e,m),c(p,m));let y=`#!/bin/bash
|
|
3021
3021
|
SELF=$(readlink -f "$0")
|
|
3022
3022
|
HERE=\${SELF%/*}
|
|
3023
3023
|
export PATH="\${HERE}/usr/bin:\${PATH}"
|
|
3024
3024
|
exec "\${HERE}/usr/share/${a.toLowerCase()}/${a.toLowerCase()}" "$@"
|
|
3025
|
-
`;
|
|
3025
|
+
`;f("fs").writeFileSync(c(s,"AppRun"),y),P(c(s,"AppRun"),493);let g=`[Desktop Entry]
|
|
3026
3026
|
Type=Application
|
|
3027
3027
|
Name=${a}
|
|
3028
3028
|
Exec=${a.toLowerCase()}
|
|
3029
3029
|
Terminal=false
|
|
3030
3030
|
Categories=Utility;
|
|
3031
3031
|
Icon=${a.toLowerCase()}
|
|
3032
|
-
`;
|
|
3032
|
+
`;f("fs").writeFileSync(c(s,`${a.toLowerCase()}.desktop`),g);let w=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(f("fs").writeFileSync(c(s,`${a.toLowerCase()}.png`),w),i.icon&&A(i.icon))T(i.icon,c(s,`${a.toLowerCase()}.png`));let C=q("appimagetool",[s,r],{env:{...process.env,ARCH:"x86_64"}});C.on("close",(m)=>{if(Q(t),m===0)P(r,493),n({success:!0});else n({success:!1,error:`appimagetool exited with code ${m}. Install from https://appimage.github.io/appimagetool/`})}),C.on("error",(m)=>{Q(t),n({success:!1,error:`appimagetool not found: ${m.message}`})})}catch(s){Q(t),n({success:!1,error:s.message})}})}function Ui(){return[R()]}function Wi(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var Be={buildNative:Hi,getAvailableTargets:Ui,getAvailableFormats:Wi,detectPlatform:R},tp=Be;
|
|
3033
3033
|
export{Xd,ji,Jd,Yd,Bi,Us,Fi,Zd,zi,Qd,ep,Hi,Vi,Ui,Wi,tp};
|