@stacksjs/stx 0.2.636 → 0.2.637
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-0tbsqnq3.js +2 -0
- package/dist/{chunk-mek121wh.js → chunk-1qt006mx.js} +46 -32
- package/dist/{chunk-104xw4ps.js → chunk-1t0m4pwg.js} +2 -2
- package/dist/chunk-2t5qqn27.js +2 -0
- package/dist/chunk-2xzttttk.js +2 -0
- package/dist/{chunk-c06b0akz.js → chunk-47shfmkf.js} +1 -1
- package/dist/chunk-499wgv9j.js +2 -0
- package/dist/{chunk-vvseb46a.js → chunk-4dpq1bnh.js} +1 -1
- package/dist/{chunk-cwvd8dc3.js → chunk-4w5rkk9d.js} +1 -1
- package/dist/{chunk-5pyv9gjh.js → chunk-55pjhpdq.js} +1 -1
- package/dist/chunk-5jk2nqk5.js +2 -0
- package/dist/{chunk-1s02ff6n.js → chunk-5kbkx0np.js} +2 -2
- package/dist/{chunk-mwqas1qk.js → chunk-5wyp57g3.js} +1 -1
- package/dist/{chunk-bx3ar1wz.js → chunk-639ngkgb.js} +1 -1
- package/dist/{chunk-gcj5jfbv.js → chunk-6mnwvn9v.js} +2 -2
- package/dist/{chunk-s15nte19.js → chunk-6tp66rf3.js} +1 -1
- package/dist/{chunk-arrvcn7c.js → chunk-6vmvra0f.js} +1 -1
- package/dist/{chunk-4a4zc8yd.js → chunk-6vtq0atz.js} +1 -1
- package/dist/{chunk-26g3m2mg.js → chunk-6w3nph4g.js} +2 -2
- package/dist/{chunk-7p8kyf4z.js → chunk-70et0fbw.js} +2 -2
- package/dist/chunk-72sev9mm.js +2 -0
- package/dist/chunk-8s1dkcwk.js +2 -0
- package/dist/chunk-8xqh5kjp.js +2 -0
- package/dist/{chunk-2kppq4pg.js → chunk-8xx631c2.js} +3 -3
- package/dist/{chunk-zsq0754x.js → chunk-972hgzxv.js} +8 -8
- package/dist/{chunk-0j9f54wv.js → chunk-9939fjh4.js} +2 -2
- package/dist/{chunk-mcs3wbs4.js → chunk-9f79c8pv.js} +22 -22
- package/dist/{chunk-215fsx0k.js → chunk-9gvq1spk.js} +1 -1
- package/dist/{chunk-4p4qp5ka.js → chunk-9jetjy0s.js} +1 -1
- package/dist/chunk-9nvrkpee.js +2 -0
- package/dist/{chunk-1071avjd.js → chunk-9xaztqhw.js} +1 -1
- package/dist/chunk-adxq3fkh.js +2 -0
- package/dist/{chunk-69n2ty1n.js → chunk-b56p8vqw.js} +3 -3
- package/dist/chunk-byrmpd9m.js +2 -0
- package/dist/{chunk-jdx4za9p.js → chunk-cq331w4g.js} +1 -1
- package/dist/{chunk-xgd6xgvz.js → chunk-dcwhp21g.js} +17 -17
- package/dist/{chunk-kztnn301.js → chunk-degxqdbb.js} +1 -1
- package/dist/chunk-dmmpezc0.js +2 -0
- package/dist/{chunk-dtg82vm2.js → chunk-dyg6sadv.js} +1 -1
- package/dist/chunk-evwbat9f.js +2 -0
- package/dist/{chunk-krchxt50.js → chunk-f2pk3qgg.js} +1 -1
- package/dist/{chunk-nxn7gnpq.js → chunk-f9wse4zx.js} +1 -1
- package/dist/chunk-g67016zr.js +2 -0
- package/dist/{chunk-mn97jhaq.js → chunk-g6s0xdgb.js} +3 -3
- package/dist/{chunk-7ftn9ber.js → chunk-gmxrckgj.js} +3 -3
- package/dist/{chunk-fk79x8ns.js → chunk-gsp3627d.js} +2 -2
- package/dist/chunk-h4fteh7w.js +2 -0
- package/dist/chunk-hf340t26.js +2 -0
- package/dist/{chunk-26gr5d4w.js → chunk-j00v4m56.js} +8 -8
- package/dist/{chunk-g1mp4e7h.js → chunk-j6fxzkn5.js} +1 -1
- package/dist/chunk-ky043mkv.js +2 -0
- package/dist/{chunk-0bptz1km.js → chunk-m690cqee.js} +251 -251
- package/dist/{chunk-hjtym7d9.js → chunk-m92q2jyt.js} +5 -5
- package/dist/{chunk-eeqw8jkw.js → chunk-mmt0mv1z.js} +5 -5
- package/dist/{chunk-xekmvpha.js → chunk-mqmxhggf.js} +1 -1
- package/dist/{chunk-51ea655x.js → chunk-myayey15.js} +1 -1
- package/dist/{chunk-z5ewms99.js → chunk-n7jc6gn3.js} +1 -1
- package/dist/chunk-nf8r47j1.js +2 -0
- package/dist/chunk-nfhd1gct.js +2 -0
- package/dist/{chunk-7jp0w5j8.js → chunk-nh812wcz.js} +1 -1
- package/dist/{chunk-e2p8ytdd.js → chunk-nkgzwyad.js} +1 -1
- package/dist/{chunk-phqtp1b4.js → chunk-nn1mncgw.js} +1 -1
- package/dist/chunk-ns4pc13z.js +2 -0
- package/dist/{chunk-b2v6v7w8.js → chunk-phdfw45x.js} +1 -1
- package/dist/{chunk-xdqwq7a6.js → chunk-pmyqj6yq.js} +1 -1
- package/dist/chunk-pnjwynpc.js +2 -0
- package/dist/{chunk-kmzc09w6.js → chunk-pv6yw985.js} +4 -4
- package/dist/{chunk-tw10tgz8.js → chunk-qmh6f1bt.js} +7 -7
- package/dist/{chunk-95ygdn0n.js → chunk-r00nn2qs.js} +1 -1
- package/dist/{chunk-k5pm9bex.js → chunk-re2mry1d.js} +1 -1
- package/dist/{chunk-9hqjezhx.js → chunk-s775b8ra.js} +2 -2
- package/dist/{chunk-z8ftsz64.js → chunk-vd63xejx.js} +1 -1
- package/dist/{chunk-77pj0xem.js → chunk-vq4sh8aq.js} +1 -1
- package/dist/{chunk-ryj2m6fk.js → chunk-xqr58cxk.js} +1 -1
- package/dist/{chunk-jtvrfwd8.js → chunk-y19k3vt3.js} +1 -1
- package/dist/chunk-y6z9qwtn.js +2 -0
- package/dist/chunk-ypgsyh5k.js +2 -0
- package/dist/{chunk-tvs9a3vk.js → chunk-z5wnd2qa.js} +1 -1
- package/dist/{chunk-k4xytaq3.js → chunk-zt7b6vwa.js} +4 -4
- package/dist/cli.js +11 -11
- package/dist/craft-bridge.js +4 -1
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native-backend.d.ts +11 -0
- package/dist/native-backend.js +65 -0
- package/dist/native-build.d.ts +1 -0
- package/dist/native-build.js +45 -4
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-1ejpz9gv.js +0 -2
- package/dist/chunk-2yvdnffe.js +0 -2
- package/dist/chunk-6g4kd71m.js +0 -2
- package/dist/chunk-6pewcgfq.js +0 -2
- package/dist/chunk-6vjg5xf3.js +0 -2
- package/dist/chunk-6vqk6yfm.js +0 -2
- package/dist/chunk-7z6ryf20.js +0 -2
- package/dist/chunk-8scndwf6.js +0 -2
- package/dist/chunk-e21q08vs.js +0 -2
- package/dist/chunk-ffjvqjyh.js +0 -2
- package/dist/chunk-ft6gfbr5.js +0 -2
- package/dist/chunk-h0d5vg33.js +0 -2
- package/dist/chunk-jp3vgscy.js +0 -2
- package/dist/chunk-ms4121x1.js +0 -2
- package/dist/chunk-n708h31w.js +0 -2
- package/dist/chunk-pwn2keqq.js +0 -2
- package/dist/chunk-r0s7vdha.js +0 -2
- package/dist/chunk-rwjr5bmd.js +0 -2
- package/dist/chunk-spz80xnc.js +0 -2
- package/dist/chunk-vj5fghnv.js +0 -2
- package/dist/chunk-wywkr0rt.js +0 -2
- package/dist/chunk-xj5rk4pj.js +0 -2
- package/dist/chunk-y1j13dha.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{zt,Uc,Wc,qc,Gc,Kc,u,Xc,Ds,Jc,Oi,Ni}from"./chunk-m690cqee.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-cq331w4g.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{zt as STX_ENGINE_BINDING_NAMES,Ds as convertToCommonJS,Oi as extractScriptFromTemplate,u as extractVariables,Ni as hasVariables,Xc as isCompleteImport,Kc as isMissingBindingFailure,qc as isModuleResolutionFailure,Gc as isSyntaxFailure,Jc as splitDeclaration,Uc as stripTypeScript,Wc as withoutStxReferrer};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ce,U}from"./chunk-gmxrckgj.js";import{ni}from"./chunk-8xx631c2.js";import{d}from"./chunk-yn2d8x8m.js";import{existsSync as O,mkdirSync as v,copyFileSync as S,chmodSync as k,rmSync as se}from"fs";import{join as n,basename as ne,resolve as j}from"path";import{spawn as A,execSync as oe}from"child_process";import{homedir as q,platform as ce}from"os";var Wu=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
7
|
-
//
|
|
7
|
+
// The host owns its wire protocol and full API. Replacing it with this
|
|
8
|
+
// legacy facade removes showOpenDialog/onFileDrop and posts incompatible
|
|
9
|
+
// method/params messages to a host that expects t/a/d.
|
|
10
|
+
if (window.craft && window.craft.__craft_bridge_loaded) return;
|
|
8
11
|
if (window.__craftBridgeInitialized) return;
|
|
9
12
|
window.__craftBridgeInitialized = true;
|
|
10
13
|
|
|
@@ -470,7 +473,10 @@ else if (data.type === 'event' && data.method) {
|
|
|
470
473
|
(function() {
|
|
471
474
|
'use strict';
|
|
472
475
|
|
|
473
|
-
//
|
|
476
|
+
// The host owns its wire protocol and full API. Replacing it with this
|
|
477
|
+
// legacy facade removes showOpenDialog/onFileDrop and posts incompatible
|
|
478
|
+
// method/params messages to a host that expects t/a/d.
|
|
479
|
+
if (window.craft && window.craft.__craft_bridge_loaded) return;
|
|
474
480
|
if (window.__craftBridgeInitialized) return;
|
|
475
481
|
window.__craftBridgeInitialized = true;
|
|
476
482
|
|
|
@@ -936,7 +942,7 @@ else if (data.type === 'event' && data.method) {
|
|
|
936
942
|
${r}`);return r+e}var ls={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,a)=>{let r=e.checked?"checked":"",i=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
|
|
937
943
|
<input type="checkbox" class="craft-checkbox" ${r} ${i}>
|
|
938
944
|
<span class="craft-checkbox-label">${a||e.label||""}</span>
|
|
939
|
-
</label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(e,a)=>{let r=e.min??0,i=e.max??100,s=e.step??1,t=e.value??50,
|
|
945
|
+
</label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(e,a)=>{let r=e.min??0,i=e.max??100,s=e.step??1,t=e.value??50,o=e.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${r}" max="${i}" step="${s}" value="${t}" ${o}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:(e,a)=>{let r=e.size||40,i=e.src,s=String(e.alt||""),t=e.fallback||(s?s.charAt(0).toUpperCase():"?");if(i)return`<img class="craft-avatar" src="${i}" alt="${s}" style="width:${r}px;height:${r}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${r}px;height:${r}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${t}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(e,a)=>{let r=Number(e.value)||0,i=Number(e.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,r/i*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(e,a)=>{let r=e.size||24;return`<div class="craft-spinner" style="width:${r}px;height:${r}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:(e,a)=>{let r=e.open?"open":"",i=e.title||"";return`<dialog class="craft-modal" ${r}>
|
|
940
946
|
<div class="craft-modal-content">
|
|
941
947
|
${i?`<div class="craft-modal-header"><h2>${i}</h2></div>`:""}
|
|
942
948
|
<div class="craft-modal-body">${a}</div>
|
|
@@ -947,7 +953,7 @@ ${r}`);return r+e}var ls={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
947
953
|
</details>`}},divider:{nativeType:"craft-divider",fallbackTag:"hr",fallbackClasses:"craft-divider",nativeProps:["orientation","variant"]},table:{nativeType:"craft-table",fallbackTag:"table",fallbackClasses:"craft-table",nativeProps:["columns","rows","sortable","selectable"]},list:{nativeType:"craft-list",fallbackTag:"ul",fallbackClasses:"craft-list",nativeProps:["items","selectable"]},tree:{nativeType:"craft-tree",fallbackTag:"div",fallbackClasses:"craft-tree",nativeProps:["nodes","expandable","selectable"]},alert:{nativeType:"craft-alert",fallbackTag:"div",fallbackClasses:"craft-alert",nativeProps:["variant","title","dismissible"],render:(e,a)=>{let r=e.variant||"info",i=e.title||"";return`<div class="craft-alert craft-alert-${r}" role="alert">
|
|
948
954
|
${i?`<div class="craft-alert-title">${i}</div>`:""}
|
|
949
955
|
<div class="craft-alert-content">${a}</div>
|
|
950
|
-
</div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,a)=>{let r=e.content||"",i=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${r}" data-position="${i}">${a}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:
|
|
956
|
+
</div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,a)=>{let r=e.content||"",i=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${r}" data-position="${i}">${a}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:J},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:Y},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:Q},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:G},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,a)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,a)=>{let r=e.value||"",i=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${r}" min="${i}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,a)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},Xo=`
|
|
951
957
|
<style id="craft-component-styles">
|
|
952
958
|
/* Craft Component Base Styles */
|
|
953
959
|
.craft-button {
|
|
@@ -2934,46 +2940,54 @@ ${r}`);return r+e}var ls={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
2934
2940
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
2935
2941
|
})();
|
|
2936
2942
|
</script>
|
|
2937
|
-
`;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,s,t)=>
|
|
2938
|
-
${
|
|
2939
|
-
${
|
|
2943
|
+
`;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,s,t)=>E("sidebar",s,t.trim(),a,r)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,s)=>E("sidebar",s,"",a,r)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,s,t)=>E(s,t,"",a,r)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,s,t,o)=>E(s,t,o.trim(),a,r)),e}function E(e,a,r,i,s){let t=i.components?.[e]||ls[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${r}</div>`;let o=N(a),c=[t.fallbackClasses||`${s}-${e}`];if(o.class)c.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=c.join(" "),t.render(o,r);let l=ie(o,t,c);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${l}>`;return`<${t.fallbackTag} ${l}>${r}</${t.fallbackTag}>`}function N(e){let a={},r=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=r.exec(e))!==null){let[s,t,o,c]=i,l=o??c;if(s.startsWith(":"))a[t]=l;else if(s.startsWith("@"))a[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=l;else if(l===void 0)a[t]=!0;else a[t]=l}return a}function J(e,a){let r=I(String(e.id||`craft-sidebar-${ae(a||JSON.stringify(e))}`)),i=Z(e.spaces)||K(a),s=i.length?[]:te(e.sections)||_(a),t=String(e.selectedSpace||i[0]?.id||""),o=i.find((h)=>h.id===t)||i[0],c=String(e.selectedItem||e.selected||(i.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),l={id:r,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:c,sections:s,spaces:i,selectedSpace:t||void 0},f=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),p=Number(e.width||e.sidebarWidth||286),u=e.native===!1||e.native==="false"?"false":"true",y=l.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${C(l.searchPlaceholder)}"></div>`:"",b;if(i.length)b=ee(i,t,c);else if(s.length)b=s.map((h)=>z(h,c)).join("");else b=a;return`<aside class="${w(f)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${w(r)}" data-native="${u}" style="--craft-sidebar-width:${p}px">
|
|
2944
|
+
${y}
|
|
2945
|
+
${b}
|
|
2940
2946
|
</aside>
|
|
2941
|
-
<script type="application/json" data-craft-sidebar-config="${w(r)}">${
|
|
2947
|
+
<script type="application/json" data-craft-sidebar-config="${w(r)}">${re(l)}</script>`}function Y(e,a){let r=I(String(e.id||e.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${w(r)}">
|
|
2942
2948
|
${e.label?`<div class="craft-sidebar-space-title">${C(String(e.label))}</div>`:""}
|
|
2943
2949
|
${a}
|
|
2944
|
-
</section>`}function
|
|
2950
|
+
</section>`}function Q(e,a){let r=String(e.header||e.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${w(String(e.id||"section"))}">
|
|
2945
2951
|
${r?`<div class="craft-sidebar-section-title">${C(r)}</div>`:""}
|
|
2946
2952
|
${a}
|
|
2947
|
-
</section>`}function
|
|
2953
|
+
</section>`}function G(e,a){let r={id:String(e.id||I(String(e.label||a||"item"))),label:String(e.label||a||""),icon:e.icon?String(e.icon):void 0,badge:e.badge?String(e.badge):void 0,tintColor:e.tintColor?String(e.tintColor):void 0};return M(r,String(e.selected||"")==="true")}function _(e){let a=[],r=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,i;while((i=r.exec(e))!==null){let s=N(i[1]||""),t=i[2]||"",o=String(s.id||I(String(s.header||s.title||`section-${a.length+1}`))),c=String(s.header||s.title||o),l=X(t);a.push({id:o,header:c,title:c,items:l})}return a}function X(e){let a=[],r=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,i;while((i=r.exec(e))!==null){let s=N(i[1]||""),t=String(s.label||(i[2]||"").replace(/<[^>]*>/g,"").trim()),o=String(s.id||I(t||`item-${a.length+1}`));a.push({id:o,label:t,icon:s.icon?String(s.icon):void 0,badge:s.badge?String(s.badge):void 0,tintColor:s.tintColor?String(s.tintColor):void 0})}return a}function K(e){let a=[],r=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,i;while((i=r.exec(e))!==null){let s=N(i[1]||""),t=i[2]||"",o=String(s.label||s.title||`Space ${a.length+1}`);a.push({id:String(s.id||I(o)),label:o,icon:s.icon?String(s.icon):void 0,tint:s.tint?String(s.tint):void 0,sections:_(t)})}return a}function Z(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let a=JSON.parse(e);return Array.isArray(a)?a:void 0}catch{return}}function ee(e,a,r){let i=e.map((t)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${w(t.id)}" data-selected="${t.id===a?"true":"false"}" title="${w(t.label||t.id)}">${t.icon?`<span class="craft-sidebar-item-icon" data-icon="${w(t.icon)}"></span>`:C((t.label||t.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${e.map((t)=>`<section class="craft-sidebar-space" data-space-id="${w(t.id)}" data-selected="${t.id===a?"true":"false"}">
|
|
2948
2954
|
${t.label?`<div class="craft-sidebar-space-title">${C(t.label)}</div>`:""}
|
|
2949
|
-
${t.sections.map((
|
|
2955
|
+
${t.sections.map((o)=>z(o,r)).join("")}
|
|
2950
2956
|
</section>`).join("")}</div>
|
|
2951
|
-
<div class="craft-sidebar-space-switcher">${i}</div>`}function
|
|
2957
|
+
<div class="craft-sidebar-space-switcher">${i}</div>`}function te(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let a=JSON.parse(e);return Array.isArray(a)?a:void 0}catch{return}}function z(e,a){let r=e.header||e.title||e.id;return`<section class="craft-sidebar-section" data-section-id="${w(e.id)}">
|
|
2952
2958
|
<div class="craft-sidebar-section-title">${C(r)}</div>
|
|
2953
|
-
${e.items.map((i)=>
|
|
2954
|
-
</section>`}function
|
|
2959
|
+
${e.items.map((i)=>M(i,i.id===a)).join("")}
|
|
2960
|
+
</section>`}function M(e,a){let r=e.tintColor?` style="--craft-sidebar-icon-color:${w(e.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${w(e.id)}" data-selected="${a?"true":"false"}">
|
|
2955
2961
|
${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${w(e.icon)}"${r}></span>`:""}
|
|
2956
2962
|
<span class="craft-sidebar-item-label">${C(e.label)}</span>
|
|
2957
2963
|
${e.badge?`<span class="craft-sidebar-item-badge">${C(e.badge)}</span>`:""}
|
|
2958
|
-
</button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function
|
|
2959
|
-
</head>`)}let
|
|
2960
|
-
|
|
2964
|
+
</button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function ae(e){let a=5381;for(let r=0;r<e.length;r++)a=a*33^e.charCodeAt(r);return(a>>>0).toString(36)}function C(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function w(e){return C(e).replace(/`/g,"`")}function re(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ie(e,a,r){let i=[];i.push(`class="${r.join(" ")}"`),i.push(`data-craft="${a.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)i.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,""");i.push(`${s}="${o}"`)}return i.join(" ")}function Xu(e,a){ls[e]=a}function Ju(){return{...ls}}async function Yo(e){let a=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 r=e.target||R(),i=e.format||he(r);if(e.backend&&r!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!O(j(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||n(process.cwd(),"dist","native");if(!O(s))v(s,{recursive:!0});let t=await ni(e.input,{context:e.context,options:{isDev:!1}});if(t=Ko(t,{debug:e.verbose}),t=Jo(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${Xo}
|
|
2965
|
+
</head>`)}let o=e.name||ne(e.input,".stx"),c=e.version||"1.0.0",l=e.craftPath||await me();if(!l)return{success:!1,target:r,format:i,error:"Craft binary not found. Please install Craft or specify craftPath."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${r}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${l}`);let f;switch(r){case"macos":f=await de(t,o,c,s,i,e,l);break;case"windows":f=await pe(t,o,c,s,i,e,l);break;case"linux":f=await ue(t,o,c,s,i,e,l);break;case"ios":f=await be(t,o,c,s,e,l);break;case"android":f=await ge(t,o,c,s,e,l);break;default:f={success:!1,target:r,format:i,error:`Unsupported target: ${r}`}}return f.duration=Date.now()-a,f}catch(r){return{success:!1,target:e.target||R(),format:e.format||"app",error:r.message,duration:Date.now()-a}}}async function de(e,a,r,i,s,t,o){let c=t.bundleId||`com.stx.${a.toLowerCase().replace(/[^a-z0-9]/g,"")}`,l=n(i,`${a}.app`),f=n(l,"Contents"),p=n(f,"MacOS"),u=n(f,"Resources");se(l,{recursive:!0,force:!0}),v(p,{recursive:!0}),v(u,{recursive:!0});let y=n(u,"index.html");await Bun.write(y,e);let b="";if(t.sidebar?.enabled&&t.sidebar?.config)b=n(u,"sidebar-config.json"),await Bun.write(b,JSON.stringify(t.sidebar.config));let h=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",T=t.menubarOnly??t.systemTray,g=t.bundleStyle||(await le(o)?"executable":"launcher");if(t.backend){S(o,n(p,"craft-runtime")),k(n(p,"craft-runtime"),493);let x=Ce("native-backend");try{let m=n(x,"launcher.ts"),D=n(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(m,`import { runNativeBackend } from ${JSON.stringify(D)}
|
|
2966
|
+
import handler from ${JSON.stringify(j(t.backend.entry))}
|
|
2967
|
+
await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: handler,
|
|
2968
|
+
title: ${JSON.stringify(t.window?.title||a)},
|
|
2969
|
+
width: ${t.window?.width||1200}, height: ${t.window?.height||800},
|
|
2970
|
+
maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432},
|
|
2971
|
+
devTools: ${Boolean(t.devTools)} })
|
|
2972
|
+
`);let P=Bun.spawn([process.execPath,"build",m,"--compile","--minify","--no-compile-autoload-bunfig","--no-compile-autoload-dotenv","--outfile",n(p,a)],{stdout:"pipe",stderr:"pipe"}),[B,V,W]=await Promise.all([new Response(P.stdout).text(),new Response(P.stderr).text(),P.exited]);if(W!==0)throw Error(`Native backend compilation failed: ${B}
|
|
2973
|
+
${V}`)}finally{U(x)}}else if(g==="executable"){let x=n(p,a);S(o,x),k(x,493);let m={html:"index.html",title:t.window?.title||a,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(t.trayPopover)m.trayPopover=!0;else if(T)m.menubarOnly=!0;else if(t.systemTray)m.systemTray=!0;if(t.window?.frameless)m.frameless=!0;if(t.window?.transparent)m.transparent=!0;if(t.window?.alwaysOnTop)m.alwaysOnTop=!0;if(t.window?.resizable===!1)m.resizable=!1;await Bun.write(n(u,"craft.json"),`${JSON.stringify(m,null,2)}
|
|
2974
|
+
`)}else{let x=n(p,"craft");S(o,x),k(x,493);let m=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",P=`#!/bin/bash
|
|
2961
2975
|
set -euo pipefail
|
|
2962
2976
|
DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
|
2963
2977
|
RESOURCES="$DIR/../Resources"
|
|
2964
2978
|
exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
|
|
2965
|
-
${[`--title "${t.window?.title||a}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,t.trayPopover?"--tray-popover":
|
|
2966
|
-
`,
|
|
2967
|
-
${i}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[
|
|
2979
|
+
${[`--title "${t.window?.title||a}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,t.trayPopover?"--tray-popover":T?"--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":"",m].filter(Boolean).join(" \\\n ")}
|
|
2980
|
+
`,B=n(p,a);await Bun.write(B,P),k(B,493)}let F=Boolean(t.icon&&await Bun.file(t.icon).exists());if(F)S(t.icon,n(u,"AppIcon.icns"));let H={CFBundleExecutable:a,CFBundleIdentifier:c,CFBundleName:a,CFBundleDisplayName:a,CFBundleShortVersionString:r,CFBundleVersion:r,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.trayPopover||(t.menubarOnly??Boolean(t.systemTray)),...F?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(n(f,"Info.plist"),fe(H)),s==="dmg"){let x=n(i,`${a}-${r}.dmg`),m=await we(l,x,a);if(!m.success)return{success:!1,target:"macos",format:"dmg",error:m.error};return{success:!0,target:"macos",format:"dmg",outputPath:x}}return{success:!0,target:"macos",format:"app",outputPath:l}}async function le(e){try{let a=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[r,i]=await Promise.all([new Response(a.stdout).text(),new Response(a.stderr).text()]);await a.exited;let t=`${r}
|
|
2981
|
+
${i}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[o,c,l]=t.slice(1).map(Number);if(o>0||c>0)return!0;return l>=57}catch{return!1}}function L(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function fe(e){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
2968
2982
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
2969
2983
|
<plist version="1.0">
|
|
2970
2984
|
<dict>
|
|
2971
|
-
${Object.entries(e).map(([r,i])=>{let s=typeof i==="boolean"?`<${i}/>`:typeof i==="number"?`<integer>${i}</integer>`:`<string>${
|
|
2985
|
+
${Object.entries(e).map(([r,i])=>{let s=typeof i==="boolean"?`<${i}/>`:typeof i==="number"?`<integer>${i}</integer>`:`<string>${L(String(i))}</string>`;return` <key>${L(r)}</key>
|
|
2972
2986
|
${s}`}).join(`
|
|
2973
2987
|
`)}
|
|
2974
2988
|
</dict>
|
|
2975
2989
|
</plist>
|
|
2976
|
-
`}async function
|
|
2990
|
+
`}async function pe(e,a,r,i,s,t,o){let c=n(i,a);v(c,{recursive:!0});let l=n(c,"index.html");await Bun.write(l,e),S(o,n(c,"craft.exe"));let f=`@echo off
|
|
2977
2991
|
set DIR=%~dp0
|
|
2978
2992
|
"%DIR%craft.exe" --html-file "%DIR%index.html" ^
|
|
2979
2993
|
--title "${t.window?.title||a}" ^
|
|
@@ -2981,7 +2995,7 @@ set DIR=%~dp0
|
|
|
2981
2995
|
--height ${t.window?.height||800} ^
|
|
2982
2996
|
${t.systemTray?"--system-tray":""} ^
|
|
2983
2997
|
${t.devTools?"":"--no-devtools"}
|
|
2984
|
-
`;if(await Bun.write(
|
|
2998
|
+
`;if(await Bun.write(n(c,`${a}.bat`),f),s==="zip"){let p=n(i,`${a}-${r}-windows.zip`),u=await ve(c,p);if(!u.success)return{success:!1,target:"windows",format:"zip",error:u.error};return{success:!0,target:"windows",format:"zip",outputPath:p}}return{success:!0,target:"windows",format:"app",outputPath:c}}async function ue(e,a,r,i,s,t,o){let c=n(i,a);v(c,{recursive:!0});let l=n(c,"index.html");await Bun.write(l,e);let f=n(c,"craft");S(o,f),k(f,493);let p=`#!/bin/bash
|
|
2985
2999
|
set -euo pipefail
|
|
2986
3000
|
DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
|
2987
3001
|
exec "$DIR/craft" --html-file "$DIR/index.html" \\
|
|
@@ -2990,15 +3004,15 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
|
|
|
2990
3004
|
--height ${t.window?.height||800} \\
|
|
2991
3005
|
${t.systemTray?"--system-tray":""} \\
|
|
2992
3006
|
${t.devTools?"":"--no-devtools"}
|
|
2993
|
-
`,
|
|
3007
|
+
`,u=n(c,a.toLowerCase());await Bun.write(u,p),k(u,493);let y=`[Desktop Entry]
|
|
2994
3008
|
Type=Application
|
|
2995
3009
|
Name=${a}
|
|
2996
|
-
Exec=${
|
|
3010
|
+
Exec=${u}
|
|
2997
3011
|
Terminal=false
|
|
2998
3012
|
Categories=Utility;
|
|
2999
|
-
`;if(await Bun.write(
|
|
3000
|
-
`)[0];if(r&&await Bun.file(r).exists())return r}catch{}return null}function
|
|
3001
|
-
exec /usr/share/${r.toLowerCase()}/${r.toLowerCase()} "$@"`;d("fs").writeFileSync(
|
|
3013
|
+
`;if(await Bun.write(n(c,`${a.toLowerCase()}.desktop`),y),s==="deb"){let b=n(i,`${a.toLowerCase()}_${r}_amd64.deb`),h=await xe(c,b,a,r,t);if(!h.success)return{success:!1,target:"linux",format:"deb",error:h.error};return{success:!0,target:"linux",format:"deb",outputPath:b}}if(s==="appimage"){let b=n(i,`${a}-${r}-x86_64.AppImage`),h=await ye(c,b,a,t);if(!h.success)return{success:!1,target:"linux",format:"appimage",error:h.error};return{success:!0,target:"linux",format:"appimage",outputPath:b}}return{success:!0,target:"linux",format:"app",outputPath:c}}async function be(e,a,r,i,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${a}' to create an iOS project.`}}async function ge(e,a,r,i,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${a}' to create an Android project.`}}async function me(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let e=[n(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),n(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),n(q(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),n(q(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",n(q(),".local/bin/craft"),n(process.env.LOCALAPPDATA||"","craft","craft.exe"),n(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let a of e)if(await Bun.file(a).exists())return a;try{let r=oe("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
|
|
3014
|
+
`)[0];if(r&&await Bun.file(r).exists())return r}catch{}return null}function R(){switch(ce()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function he(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 we(e,a,r){return new Promise((i)=>{let s=A("hdiutil",["create","-volname",r,"-srcfolder",e,"-ov","-format","UDZO",a]);s.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{i({success:!1,error:t.message})})})}async function ve(e,a){return new Promise((r)=>{let i=A("zip",["-r",a,"."],{cwd:e});i.on("close",(s)=>{if(s===0)r({success:!0});else r({success:!1,error:`zip exited with code ${s}`})}),i.on("error",(s)=>{r({success:!1,error:s.message})})})}async function xe(e,a,r,i,s){return new Promise((t)=>{let o=Ce("deb");try{let c=n(o,"pkg"),l=n(c,"DEBIAN"),f=n(c,"usr","bin"),p=n(c,"usr","share","applications"),u=n(c,"usr","share",r.toLowerCase());v(l,{recursive:!0}),v(f,{recursive:!0}),v(p,{recursive:!0}),v(u,{recursive:!0});let y=d("fs").readdirSync(e);for(let g of y)S(n(e,g),n(u,g));let b=`#!/bin/bash
|
|
3015
|
+
exec /usr/share/${r.toLowerCase()}/${r.toLowerCase()} "$@"`;d("fs").writeFileSync(n(f,r.toLowerCase()),b),k(n(f,r.toLowerCase()),493);let h=`Package: ${r.toLowerCase()}
|
|
3002
3016
|
Version: ${i}
|
|
3003
3017
|
Section: utils
|
|
3004
3018
|
Priority: optional
|
|
@@ -3006,17 +3020,17 @@ Architecture: amd64
|
|
|
3006
3020
|
Depends: libgtk-3-0, libwebkit2gtk-4.0-37
|
|
3007
3021
|
Maintainer: ${s.author||"Unknown"}
|
|
3008
3022
|
Description: ${s.description||r}
|
|
3009
|
-
`;d("fs").writeFileSync(
|
|
3023
|
+
`;d("fs").writeFileSync(n(l,"control"),h);let T=A("dpkg-deb",["--build",c,a]);T.on("close",(g)=>{if(U(o),g===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${g}`})}),T.on("error",(g)=>{U(o),t({success:!1,error:g.message})})}catch(c){U(o),t({success:!1,error:c.message})}})}async function ye(e,a,r,i){return new Promise((s)=>{let t=Ce("appimage");try{let o=n(t,`${r}.AppDir`),c=n(o,"usr"),l=n(c,"bin"),f=n(c,"share");v(l,{recursive:!0}),v(f,{recursive:!0});let p=n(f,r.toLowerCase());v(p,{recursive:!0});let u=d("fs").readdirSync(e);for(let g of u)S(n(e,g),n(p,g));let y=`#!/bin/bash
|
|
3010
3024
|
SELF=$(readlink -f "$0")
|
|
3011
3025
|
HERE=\${SELF%/*}
|
|
3012
3026
|
export PATH="\${HERE}/usr/bin:\${PATH}"
|
|
3013
3027
|
exec "\${HERE}/usr/share/${r.toLowerCase()}/${r.toLowerCase()}" "$@"
|
|
3014
|
-
`;d("fs").writeFileSync(o
|
|
3028
|
+
`;d("fs").writeFileSync(n(o,"AppRun"),y),k(n(o,"AppRun"),493);let b=`[Desktop Entry]
|
|
3015
3029
|
Type=Application
|
|
3016
3030
|
Name=${r}
|
|
3017
3031
|
Exec=${r.toLowerCase()}
|
|
3018
3032
|
Terminal=false
|
|
3019
3033
|
Categories=Utility;
|
|
3020
3034
|
Icon=${r.toLowerCase()}
|
|
3021
|
-
`;d("fs").writeFileSync(o
|
|
3035
|
+
`;d("fs").writeFileSync(n(o,`${r.toLowerCase()}.desktop`),b);let h=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(d("fs").writeFileSync(n(o,`${r.toLowerCase()}.png`),h),i.icon&&O(i.icon))S(i.icon,n(o,`${r.toLowerCase()}.png`));let T=A("appimagetool",[o,a],{env:{...process.env,ARCH:"x86_64"}});T.on("close",(g)=>{if(U(t),g===0)k(a,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${g}. Install from https://appimage.github.io/appimagetool/`})}),T.on("error",(g)=>{U(t),s({success:!1,error:`appimagetool not found: ${g.message}`})})}catch(o){U(t),s({success:!1,error:o.message})}})}function Zo(){return[R()]}function Qo(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 Se={buildNative:Yo,getAvailableTargets:Zo,getAvailableFormats:Qo,detectPlatform:R},Yu=Se;
|
|
3022
3036
|
export{Wu,Go,qu,Gu,Ko,ls,Xo,Ku,Jo,Xu,Ju,Yo,Zo,Qo,Yu};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var w={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",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function vt(){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" \uD83D\uDCD6 STX Story ")+c("\u2551")),console.log(c(" \u2551")+m(" Component Showcase & Testing ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function Lr(e,t){if(console.log(a(" Server running at:")),console.log(""),console.log(` ${m("\u279C")} ${a("Local:")} ${c(e)}`),t)console.log(` ${m("\u279C")} ${a("Network:")} ${c(t)}`);console.log("")}function wt(e){let t=e>0?"\u2713":"\u25CB",r=e>0?S:y;console.log(` ${r(t)} Found ${a(String(e))} story ${e===1?"file":"files"}`)}function go(e,t){if(console.log(""),console.log(` ${b("\u2717")} ${a(b("Error:"))} ${e}`),t)console.log(` ${m(t)}`);console.log("")}function
|
|
3
|
-
export{vt,Lr,wt,go,
|
|
2
|
+
var w={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",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function vt(){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" \uD83D\uDCD6 STX Story ")+c("\u2551")),console.log(c(" \u2551")+m(" Component Showcase & Testing ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function Lr(e,t){if(console.log(a(" Server running at:")),console.log(""),console.log(` ${m("\u279C")} ${a("Local:")} ${c(e)}`),t)console.log(` ${m("\u279C")} ${a("Network:")} ${c(t)}`);console.log("")}function wt(e){let t=e>0?"\u2713":"\u25CB",r=e>0?S:y;console.log(` ${r(t)} Found ${a(String(e))} story ${e===1?"file":"files"}`)}function go(e,t){if(console.log(""),console.log(` ${b("\u2717")} ${a(b("Error:"))} ${e}`),t)console.log(` ${m(t)}`);console.log("")}function Le(e){console.log(` ${y("\u26A0")} ${y("Warning:")} ${e}`)}function mo(e){console.log(` ${O("\u2139")} ${e}`)}function ho(e,t,r){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" Build Complete ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(""),console.log(` ${S("\u2713")} Stories: ${a(String(e))}`),console.log(` ${S("\u2713")} Output: ${a(t)}`),console.log(` ${S("\u2713")} Time: ${a(`${r}ms`)}`),console.log("")}function jr(){console.log(""),console.log(a(" Keyboard Shortcuts:")),console.log(""),console.log(` ${c("h")} Show this help`),console.log(` ${c("o")} Open in browser`),console.log(` ${c("r")} Restart server`),console.log(` ${c("c")} Clear console`),console.log(` ${c("q")} Quit`),console.log("")}import h from"fs";import d from"path";async function xt(e){let{root:t,config:r}=e,o=[],i=await P(t,r.storyMatch,r.storyIgnored);for(let s of i){let n=d.resolve(t,s),l=v(s,n);o.push(l)}return o}async function P(e,t,r){let o=[];async function i(s,n){let l=await h.promises.readdir(s,{withFileTypes:!0});for(let g of l){let f=d.join(s,g.name),u=d.relative(n,f);if(T(u,r))continue;if(g.isDirectory())await i(f,n);else if(g.isFile()){if(F(u,t))o.push(u)}}}return await i(e,e),o}function T(e,t){for(let r of t)if(E(e,r))return!0;return!1}function F(e,t){for(let r of t)if(E(e,r))return!0;return!1}function E(e,t){let r=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"{{GLOBSTAR}}").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\{\{GLOBSTAR\}\}/g,".*");return i=`^${i}$`,new RegExp(i).test(r)}function v(e,t){let r=d.basename(e,".story.stx");return{id:e.toLowerCase().replace(/\.story\.stx$/,"").replace(/[/\\]/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),path:t,relativePath:e,fileName:r,treeFile:{title:r,path:e}}}function yo(e,t){let{root:r,config:o}=e,i=[],s=h.watch(r,{recursive:!0},async(n,l)=>{if(!l)return;let g=l.replace(/\\/g,"/");if(!F(g,o.storyMatch))return;if(T(g,o.storyIgnored))return;let f=d.resolve(r,g);try{await h.promises.access(f);let u=v(g,f);t(n==="rename"?"add":"change",u)}catch{let u=v(g,f);t("unlink",u)}});return i.push(s),()=>{for(let n of i)n.close()}}function N(e,t){let r=t.treeFile||{title:t.fileName,path:t.relativePath};if(e.tree.file==="title")return r.title.split("/");if(e.tree.file==="path")return[...t.relativePath.split("/").slice(0,-1),r.title];if(typeof e.tree.file==="function")return e.tree.file(r);return[r.title]}function St(e,t){for(let n of t)n.treePath=N(e,n);let r=(e.tree.groups||[]).map((n)=>({groupConfig:{id:n.id||n.title,title:n.title,include:n.include},treeObject:{}})),o={treeObject:{}};r.push(o);for(let n=0;n<t.length;n++){let l=t[n],g=j(l,r,o);k(l.treePath,n,g.treeObject)}let i=e.tree.order==="asc"?(n,l)=>n.localeCompare(l):e.tree.order,s=[];for(let n of r)if(n===o)s.push(...x(n.treeObject,i));else if(n.groupConfig&&Object.keys(n.treeObject).length>0)s.push({group:!0,id:n.groupConfig.id,title:n.groupConfig.title,children:x(n.treeObject,i)});return s}function j(e,t,r){let o=e.treeFile||{title:e.fileName,path:e.relativePath};for(let i of t)if(i.groupConfig?.include&&i.groupConfig.include(o))return i;return r}function k(e,t,r){let o=r;for(let i=0;i<e.length;i++){let s=e[i];if(i===e.length-1)if(o[s]!==void 0){let l=1;while(o[`${s}-${l}`]!==void 0)l++;o[`${s}-${l}`]=t}else o[s]=t;else{if(o[s]===void 0)o[s]={};else if(typeof o[s]==="number"){let l=o[s];o[s]={"":l}}o=o[s]}}}function x(e,t){let r=[];for(let[o,i]of Object.entries(e))if(typeof i==="number")r.push({title:o,index:i});else r.push({title:o,children:x(i,t)});return r.sort((o,i)=>t(o.title,i.title)),r}
|
|
3
|
+
export{vt,Lr,wt,go,Le,mo,ho,jr,xt,yo,St};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ha,ya}from"./chunk-9f79c8pv.js";import"./chunk-nh812wcz.js";import"./chunk-55pjhpdq.js";import"./chunk-j00v4m56.js";import"./chunk-9939fjh4.js";import"./chunk-nn1mncgw.js";import"./chunk-6avpd901.js";import"./chunk-f9wse4zx.js";import{Po}from"./chunk-zt7b6vwa.js";import"./chunk-fztvkacg.js";import"./chunk-639ngkgb.js";import"./chunk-pmyqj6yq.js";import"./chunk-45xhjrha.js";import"./chunk-s775b8ra.js";import"./chunk-4w5rkk9d.js";import"./chunk-5e063mgs.js";import"./chunk-48yja477.js";import"./chunk-aztp8r80.js";import"./chunk-drrczm0b.js";import"./chunk-fwdptew6.js";import"./chunk-5wyp57g3.js";import"./chunk-b4j5bpec.js";import"./chunk-972hgzxv.js";import"./chunk-wjq1wqn6.js";import"./chunk-60azcvwr.js";import"./chunk-88p10v0w.js";import"./chunk-c858mepd.js";import"./chunk-qy11cp1v.js";import"./chunk-b56p8vqw.js";import"./chunk-dcwhp21g.js";import"./chunk-vd63xejx.js";import"./chunk-8xx631c2.js";import"./chunk-gmxrckgj.js";import"./chunk-gqz26wza.js";import"./chunk-9gvq1spk.js";import"./chunk-6w3nph4g.js";import"./chunk-bsts9pr5.js";import{Ee,xn,Sn,Q,u,n,br,A,o,be}from"./chunk-m690cqee.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-cq331w4g.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{br as buildWebComponents,Sn as cacheTemplate,xn as checkCache,Po as classifyAllScripts,ha as createMiddleware,ya as createRoute,A as defaultConfig,u as extractVariables,Q as injectRouterScript,o as loadStxConfig,Ee as processClientScript,n as processDirectives,be as readMarkdownFile};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{A,al,Ws,o,P,Cd,_d}from"./chunk-m690cqee.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-cq331w4g.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{P as config,A as defaultConfig,Cd as defineStxConfig,Ws as discoverConfig,o as loadStxConfig,al as resolveStxDirectories,_d as validateConfig};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-m92q2jyt.js";import"./chunk-y255yybn.js";import"./chunk-r00nn2qs.js";import{a}from"./chunk-8cqx63aw.js";import f from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},o=t.snapshotDir||a(e.root,"story","snapshots");await f.promises.mkdir(o,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((i)=>t.filter.some((p)=>i.fileName.toLowerCase().includes(p.toLowerCase())));for(let i of r)await h(i,o,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let o=e.story;if(!o)return;for(let r of o.variants){n.total++;let i=l.join(t,`${e.id}-${r.id}.snap`),p=g(r.source||""),c=await w(i);if(s.update||!c){let u={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:p};if(await f.promises.writeFile(i,JSON.stringify(u,null,2)),!c)n.new++;n.passed++}else try{let u=await f.promises.readFile(i,"utf-8"),m=JSON.parse(u);if(m.hash===p)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,p)})}catch(u){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${u}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await f.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
|
|
3
3
|
`)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Tu,$u}from"./chunk-b56p8vqw.js";import"./chunk-9gvq1spk.js";import"./chunk-6w3nph4g.js";import"./chunk-bsts9pr5.js";import"./chunk-m690cqee.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-cq331w4g.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{$u as clearStoreCache,Tu as getStoreScript};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Js,Ys,Zs,Qs,Sr,kr,Ed,Td,$d,Rd,Cr,Ad}from"./chunk-
|
|
2
|
+
import{Js,Ys,Zs,Qs,Sr,kr,Ed,Td,$d,Rd,Cr,Ad}from"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";export{Ad as generateDefaultRobotsTxt,Cr as generateRobotsTxt,Td as generateSitemap,$d as generateSitemapIndex,Qs as injectSeoTags,Sr as metaDirective,Js as processMetaDirectives,Zs as processSeoDirective,Ys as processStructuredData,Ed as registerSeoDirectives,Rd as scanForSitemapEntries,kr as structuredDataDirective};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{p,c}from"./chunk-
|
|
2
|
+
import{p,c}from"./chunk-m92q2jyt.js";import{re,b}from"./chunk-m690cqee.js";function A(t,o){let i=1,r=o,n="<template",e="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(n,r)&&(r+n.length>=t.length||/[\s>\/]/.test(t[r+n.length]))){i++,r+=n.length;continue}if(t.startsWith(e,r)){let a=t.indexOf(">",r+e.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let n=t[r];if(i){if(n==="\\"){r++;continue}if(n===i)i=null;continue}if(n==='"'||n==="'"){i=n;continue}if(n===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),n=1,e=i;while(e<t.length){let s=t.indexOf("<",e);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);e=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(n--,n===0)return a}else if(!/\/\s*>$/.test(f))n++}e=a}return-1}function R(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=x(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let l=i.lastIndexOf(u);if(l!==-1)i.splice(l);n=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],d=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:e,end:s,slotName:l,element:d}),n=s;else o.push({start:e,end:h,slotName:l,element:d+t.slice(s,h)}),n=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let l=t.toLowerCase().indexOf(`</${u}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=x(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);n=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let d=A(t,s);if(d!==-1){let h=l[1]||l[2]||l[3];o.push({start:e,end:d,slotName:h,content:t.slice(s,d-11).trim(),propsBinding:l[4]||void 0}),n=d;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function Oa(t){let o={default:"",named:new Map},i=t,r=O(t);for(let e of r)o.named.set(e.slotName,{name:e.slotName,content:e.content,propsBinding:e.propsBinding});r.sort((e,s)=>s.start-e.start);for(let e of r)i=i.slice(0,e.start)+i.slice(e.end);let n=R(i);for(let e of n){let s=o.named.get(e.slotName);if(s)s.content+=e.element;else o.named.set(e.slotName,{name:e.slotName,content:e.element})}for(let e=n.length-1;e>=0;e--){let s=n[e];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function ql(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},n=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,e;while((e=n.exec(t))!==null)r[e[1]]=e[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function Na(t,o,i,r){if(!t)return i;let n=t.content;if(t.propsBinding&&Object.keys(o).length>0){let e=t.propsBinding.trim(),s={...r},a=new Set,f=new Set;if(e.startsWith("{")&&e.endsWith("}")){let u=e.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of u){let[m,l]=g.split(":").map((h)=>h.trim()),d=l||m;if(s[d]=o[m],o[m]!==void 0)f.add(d);else a.add(d)}}else if(s[e]=o,Object.values(o).some((u)=>u===void 0))a.add(e);else f.add(e);n=C(n,s,a,f)}return n}function C(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(n,e)=>{try{let s=e.trim();if(re(s,i))return n;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!re(s,r))return n;let a=k(s,o);if(a===void 0)return n;return b(String(a??""))}catch{return`{{ ${e} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),n=o;for(let e of r)if(n&&typeof n==="object"&&e in n)n=n[e];else return;return n}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,n,e]=i,s=o[r],a=parseInt(e,10);if(typeof s==="number")switch(n){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return c(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Da(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),m=u?.trim()||"",l=f||"",d={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(l))!==null){let y=S[1],E=S[2];d[y]=k(E,i)}return await Na(g,d,m,i)});let e=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(e,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],n=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return n.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let e=await Promise.all(r),s=t;for(let a=n.length-1;a>=0;a--){let{match:f,index:u}=n[a];s=s.slice(0,u)+e[a]+s.slice(u+f.length)}return s}function Gl(t){let o=Oa(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Kl(t,o,i,r){return await Da(t,{default:o,named:i},r)}
|
|
3
3
|
export{Oa,ql,Na,Da,Gl,Kl};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{L,ye}from"./chunk-
|
|
2
|
+
import{L,ye}from"./chunk-m690cqee.js";import{ve,C,at}from"./chunk-a0ygyftk.js";import{pt,ee,De}from"./chunk-gsp3627d.js";import{He,ce,T,le,Lo,Kr,jo,Jt}from"./chunk-zt7b6vwa.js";import{ys}from"./chunk-6w3nph4g.js";import{Yt}from"./chunk-fqg0espy.js";import Z from"fs";import A from"path";var{serve:ue}=globalThis.Bun;import F from"zlib";import{promisify as Q}from"util";var K=Q(F.brotliCompress),te=Q(F.gzip),ne=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],re=["text/event-stream","multipart/x-mixed-replace"],se=1024;function oe(t){if(!t)return!1;let e=t.toLowerCase();if(re.some((o)=>e.startsWith(o)))return!1;return ne.some((o)=>e.startsWith(o))}function ae(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ie(t){if(!t)return null;let e=ae(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function pe(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=Y)break;H.delete(o),U-=r.length}}async function Kt(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!oe(e.headers.get("content-type")))return e;let r=ie(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??se))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await K(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await te(a),pe(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new L(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",T(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${ce(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let S=new Headers(s.headers);return S.set("Cache-Control","private, no-store"),S.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:S})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let b=this.generation,k=async()=>{let s=await o();r=s;let S=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||S.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let B=await s.clone().arrayBuffer();if(B.byteLength>1048576)return null;s.headers.set("Vary",T(s.headers.get("Vary")).Vary);let n={body:B,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===b)this.entries.set(h,n);return n},v=this.pending.get(h);if(!v){if(this.pending.size>=1000)return a();v=k().finally(()=>{if(this.pending.get(h)===v)this.pending.delete(h)}),this.pending.set(h,v)}if(g&&m<e.maxAge+(e.swr??0))return v.catch(()=>{}),l(g);let E=await v;return E?l(E):a()}}var me={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Cl(t={}){let e=A.resolve(t.outputDir||".output"),o=t.port??3000,r=Lo(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=Yt(r.routeRules),f=new G,h=ys(e,r.apiRoutes??[]),g=Bun.file(A.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?C(l):void 0,b=new Map,k=new Map,v=new Map,E=new Map;for(let n of r.routes)try{let y=A.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=at(i.html,m);b.set(n.pattern,i),v.set(n.pattern,De(i.html)),E.set(n.pattern,ye(i.html));let _=A.join(e,n.fragmentPath);if(await Bun.file(_).exists()){let M=await Bun.file(_).text();k.set(n.pattern,m?at(M,m):M)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,S=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=ee(n.pattern,{page:!0});S.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let B=ue({port:o,async fetch(n){return Kt(n,await ve(m??C(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let _=await h(n);if(_)return _;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=A.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=A.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${A.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=A.extname(u).toLowerCase(),j=me[R]||"application/octet-stream",N=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":j,"Cache-Control":N?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let M=ce(n),w=null,q={};if(w=s.get(i)||null,!w)for(let{regex:p,route:d,paramNames:u}of S){let c=i.match(p);if(c){w=d,u.forEach((R,j)=>{q[R]=c[j+1]});break}}if(!w){let p=pt(i)?null:s.get("/404")||null;if(p){let d=b.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=a(i),W=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=b.get(w.pattern);if(M&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=k.get(w.pattern);if(c){let R=v.get(w.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...E.has(w.pattern)?{"X-STX-Runtime":E.get(w.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...T(),...O.cache?{}:{"Cache-Control":He}}})}}let d=Kr(n.method),u=b.get(w.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=b.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(w.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...T(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:j,cookies:N,status:I,headers:D}=await Jt(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(j)return jo(j,N,D);if(R&&R.length>0){let{renderStreamingPage:P,streamToResponse:z}=await import("./chunk-n7jc6gn3.js"),X=new Headers({...T(),...D,"Cache-Control":"private, no-store"});for(let V of N??[])X.append("Set-Cookie",V);if(M&&!d){let V=De(c);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",ye(c)?"true":"false"),X.set("X-STX-Layout",V.layout),X.set("X-STX-Layout-Group",V.group)}return z(P(M&&!d?le(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:X})}let x=new Headers({"Content-Type":"text/html",...T(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let P of N??[])x.append("Set-Cookie",P);for(let[P,z]of Object.entries(D??{}))x.set(P,z);if(x.set("Vary",T(x.get("Vary")).Vary),M&&!d){let P=De(c);return x.set("X-STX-Fragment","true"),x.set("X-STX-Runtime",ye(c)?"true":"false"),x.set("X-STX-Layout",P.layout),x.set("X-STX-Layout-Group",P.group),new Response(le(c,r.routerContainer||"main"),{status:I??u.status??200,headers:x})}return new Response(c,{status:I??u.status??200,headers:x})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${B.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:B.port,stop:()=>{f.invalidate(),B.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
3
|
export{Kt,Cl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{kl}from"./chunk-nh812wcz.js";import"./chunk-m690cqee.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-cq331w4g.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{kl as startInteractive};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function
|
|
3
|
-
export{
|
|
2
|
+
var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function X(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function dn(e,n={}){let r,i=!0,o=!1,t=new Set,c=typeof n.equals==="function"?n.equals:null,u=()=>{let s=S(d);try{r=e(),o=!0}finally{h(s)}i=!1},l=()=>{let s=r,y=o;try{u()}catch{return i=!0,!0}return!y||!c(s,r)},d=()=>{if(i)return;if(c&&t.size){if(l())b(t);return}i=!0,b(t)};w(d,(s)=>{if(i)return;if(c&&t.size){if(l())p(t,s);return}i=!0,p(t,s)});let a=()=>{let s=x();if(s)t.add(s);if(i)u();return r};return Object.defineProperty(a,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(a,"value",{get:()=>a(),configurable:!0}),a}function Au(e,n=Object.is){return dn(e,{equals:n})}function pn(e,n={}){let r,i=!1,o=()=>{if(i)return;if(r){let c=r;r=void 0;try{c()}catch(u){console.error("[stx] effect cleanup error:",u)}}let t=S(o);try{let c=e();r=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{h(t)}};if(n.immediate!==!1)o();return()=>{if(i=!0,r){let t=r;r=void 0,t()}}}function as(e){C(e)}function tr(e){k.push(e)}function nr(e){T.push(e)}function Pu(){O(k,"onMount",T)}function Iu(){O(T,"onDestroy")}function O(e,n,r){let i=e.splice(0,e.length);for(let o of i)try{let t=o();if(r&&typeof t==="function")r.push(t)}catch(t){console.error(`[stx] ${n} callback threw:`,t)}}function Ou(){return{mount:k.length,destroy:T.length}}function fn(e){return typeof e==="function"&&e._isSignal===!0}function gn(e){return typeof e==="function"&&e._isDerived===!0}function cs(e){if(fn(e)||gn(e))return m(()=>e());return e}function rr(e){return m(e)}function Nu(e,n){let r=typeof e==="function"?e:()=>e,i=X([]),o=dn(()=>i().reduce((u,l)=>n(u,l.action),r())),t=!1;return pn(()=>{if(r(),!t){t=!0;return}if(rr(()=>i().length))i.set([])}),[o,(u,l)=>{let d={action:u};i.set([...i(),d]);let a=()=>{let s=i().filter((y)=>y!==d);if(s.length!==i().length)i.set(s)};if(l&&typeof l.then==="function")Promise.resolve(l).then(a,a);return a}]}
|
|
3
|
+
export{X,dn,Au,pn,as,tr,nr,Pu,Iu,Ou,fn,gn,cs,rr,Nu};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{X}from"./chunk-5kbkx0np.js";function g(e,t){let r={};for(let n of e)r[n]=X(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=X(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function Wo(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=X(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var sc=Wo;class cn{rules=[];defaultValue="";addRule(e){let t=new cn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new cn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new cn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var su=new cn;function oc(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>c.replace(/\{\{\s*message\s*\}\}/g,l)).join(`
|
|
3
3
|
`)}catch{return""}})}function ic(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>c.replace(/\{\{\s*message\s*\}\}/g,l)).join(`
|
|
4
4
|
`)}catch{return""}})}function ac(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function ou(e,t,r){let n=e;return n=oc(n,t,r),n=ic(n,t,r),n=ac(n,t,r),n}export{Wo,sc,cn,su,oc,ic,ac,ou};
|