@stacksjs/stx 0.2.635 → 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-3td99hnc.js → chunk-0ergsswn.js} +3 -3
- package/dist/chunk-0tbsqnq3.js +2 -0
- package/dist/{chunk-6gwrmn3w.js → chunk-17x6e5mm.js} +6 -6
- package/dist/{chunk-j79f6syh.js → chunk-1m5cjrpw.js} +4 -4
- package/dist/chunk-1p6yd17s.js +2 -0
- package/dist/{chunk-kjtvdqb9.js → chunk-1qt006mx.js} +57 -43
- package/dist/{chunk-6w1ngwsd.js → chunk-1t0m4pwg.js} +2 -2
- package/dist/chunk-2t5qqn27.js +2 -0
- package/dist/chunk-2xzttttk.js +2 -0
- package/dist/chunk-3hkp5hym.js +2 -0
- package/dist/chunk-444pz8yk.js +2 -0
- package/dist/{chunk-ymntav9f.js → chunk-45xhjrha.js} +1 -1
- package/dist/{chunk-jtr30kkz.js → chunk-47shfmkf.js} +1 -1
- package/dist/{chunk-camd8j1q.js → chunk-48yja477.js} +3 -3
- package/dist/chunk-499wgv9j.js +2 -0
- package/dist/chunk-4b5f28te.js +2 -0
- package/dist/chunk-4dpq1bnh.js +2 -0
- package/dist/chunk-4mm9ttc7.js +2 -0
- package/dist/{chunk-psranzfr.js → chunk-4w5rkk9d.js} +2 -2
- package/dist/{chunk-npn3h566.js → chunk-55pjhpdq.js} +2 -2
- package/dist/{chunk-e0nq8g9j.js → chunk-5e063mgs.js} +1 -1
- package/dist/chunk-5jk2nqk5.js +2 -0
- package/dist/{chunk-qa58qdz8.js → chunk-5kbkx0np.js} +2 -2
- package/dist/{chunk-emcbmr0r.js → chunk-5wyp57g3.js} +3 -3
- package/dist/{chunk-cjr8cpb7.js → chunk-60azcvwr.js} +3 -3
- package/dist/{chunk-cdab66xt.js → chunk-639ngkgb.js} +2 -2
- package/dist/{chunk-0tm9ep8b.js → chunk-6avpd901.js} +2 -2
- package/dist/{chunk-gcj5jfbv.js → chunk-6mnwvn9v.js} +2 -2
- package/dist/chunk-6tp66rf3.js +2 -0
- package/dist/{chunk-1wb98s7b.js → chunk-6vmvra0f.js} +7 -7
- package/dist/chunk-6vtq0atz.js +2 -0
- package/dist/{chunk-yp8tk3v3.js → chunk-6w3nph4g.js} +5 -5
- package/dist/{chunk-3e2v2fdh.js → chunk-70et0fbw.js} +4 -4
- package/dist/chunk-72sev9mm.js +2 -0
- package/dist/{chunk-shcn4wve.js → chunk-7mkw98cr.js} +2 -2
- package/dist/chunk-87kza2ez.js +2 -0
- package/dist/{chunk-g9sdjgfw.js → chunk-88p10v0w.js} +5 -5
- package/dist/chunk-8cqx63aw.js +3 -0
- package/dist/chunk-8s1dkcwk.js +2 -0
- package/dist/chunk-8xqh5kjp.js +2 -0
- package/dist/chunk-8xx631c2.js +18 -0
- package/dist/{chunk-f3agc1a3.js → chunk-972hgzxv.js} +9 -9
- package/dist/{chunk-y5b25eks.js → chunk-9939fjh4.js} +4 -4
- package/dist/{chunk-qczse5w4.js → chunk-9f79c8pv.js} +37 -37
- package/dist/{chunk-fm80xpxn.js → chunk-9gvq1spk.js} +4 -4
- package/dist/chunk-9jetjy0s.js +2 -0
- package/dist/chunk-9nvrkpee.js +2 -0
- package/dist/chunk-9ny6xzw0.js +2 -0
- package/dist/chunk-9r538d93.js +2 -0
- package/dist/chunk-9xaztqhw.js +2 -0
- package/dist/{chunk-kr14jt4m.js → chunk-9yk5rasj.js} +2 -2
- package/dist/{chunk-fwawm5r3.js → chunk-a0ygyftk.js} +2 -2
- package/dist/chunk-adxq3fkh.js +2 -0
- package/dist/{chunk-sn0a8cjd.js → chunk-aztp8r80.js} +5 -5
- package/dist/chunk-b2teprjf.js +2 -0
- package/dist/{chunk-b7hv69ty.js → chunk-b4j5bpec.js} +2 -2
- package/dist/{chunk-hbzk179w.js → chunk-b56p8vqw.js} +4 -4
- package/dist/chunk-byrmpd9m.js +2 -0
- package/dist/{chunk-q0kbn64j.js → chunk-c858mepd.js} +5 -5
- package/dist/chunk-cd76dwdn.js +2 -0
- package/dist/{chunk-bk9bx2ns.js → chunk-cq331w4g.js} +2 -2
- package/dist/{chunk-xdwpbqzz.js → chunk-dcwhp21g.js} +18 -18
- package/dist/chunk-degxqdbb.js +2 -0
- package/dist/chunk-dmmpezc0.js +2 -0
- package/dist/{chunk-baw176ay.js → chunk-drrczm0b.js} +6 -6
- package/dist/{chunk-mvt5n2q4.js → chunk-dyg6sadv.js} +1 -1
- package/dist/chunk-e7bd4vxb.js +2 -0
- package/dist/chunk-evwbat9f.js +2 -0
- package/dist/{chunk-8y3mff5c.js → chunk-eyy6zmdk.js} +2 -2
- package/dist/chunk-f2pk3qgg.js +2 -0
- package/dist/{chunk-954tcahb.js → chunk-f9wse4zx.js} +2 -2
- package/dist/chunk-fdxyj3pk.js +2 -0
- package/dist/{chunk-kwwrrasa.js → chunk-fqg0espy.js} +2 -2
- package/dist/{chunk-pak6ngv0.js → chunk-fwdptew6.js} +6 -6
- package/dist/{chunk-7vdcsr14.js → chunk-fztvkacg.js} +2 -2
- package/dist/chunk-g14mwhqz.js +2 -0
- package/dist/{chunk-kk6tq07c.js → chunk-g1ae3haw.js} +2 -2
- package/dist/chunk-g67016zr.js +2 -0
- package/dist/{chunk-mn97jhaq.js → chunk-g6s0xdgb.js} +3 -3
- package/dist/{chunk-1d25z8q2.js → chunk-gmxrckgj.js} +3 -3
- package/dist/{chunk-mpb0ezee.js → chunk-gqz26wza.js} +3 -3
- package/dist/{chunk-c4ysk7x2.js → chunk-gsp3627d.js} +4 -4
- package/dist/chunk-h4fteh7w.js +2 -0
- package/dist/chunk-hf340t26.js +2 -0
- package/dist/{chunk-4vkpgz28.js → chunk-j00v4m56.js} +9 -9
- package/dist/chunk-j0jz4mfm.js +2 -0
- package/dist/chunk-j37720vw.js +2 -0
- package/dist/chunk-j6fxzkn5.js +2 -0
- package/dist/chunk-jmdrhpy7.js +2 -0
- package/dist/chunk-jshv1ye7.js +2 -0
- package/dist/{chunk-vyjdzpb8.js → chunk-kjspmegt.js} +2 -2
- package/dist/chunk-ky043mkv.js +2 -0
- package/dist/{chunk-7m5xrqnj.js → chunk-m690cqee.js} +285 -285
- package/dist/{chunk-ptv5f34x.js → chunk-m92q2jyt.js} +7 -7
- package/dist/chunk-mbqqc20a.js +2 -0
- package/dist/{chunk-a7s1j320.js → chunk-mmt0mv1z.js} +5 -5
- package/dist/chunk-mqmxhggf.js +2 -0
- package/dist/{chunk-cw9pc5yx.js → chunk-myayey15.js} +13 -13
- package/dist/chunk-n7jc6gn3.js +2 -0
- package/dist/chunk-nf8r47j1.js +2 -0
- package/dist/chunk-nfhd1gct.js +2 -0
- package/dist/{chunk-a6hv03yw.js → chunk-nh812wcz.js} +3 -3
- package/dist/chunk-nkgzwyad.js +2 -0
- package/dist/{chunk-ytv0k9gy.js → chunk-nn1mncgw.js} +10 -10
- package/dist/chunk-ns4pc13z.js +2 -0
- package/dist/{chunk-ycz5th6b.js → chunk-pf5s5gjp.js} +1 -1
- package/dist/{chunk-ry1w4ghk.js → chunk-phdfw45x.js} +1 -1
- package/dist/{chunk-2efrxnnt.js → chunk-pmyqj6yq.js} +2 -2
- package/dist/chunk-pn719qwa.js +2 -0
- package/dist/chunk-pnjwynpc.js +2 -0
- package/dist/{chunk-m56ee2tw.js → chunk-pv6yw985.js} +5 -5
- package/dist/{chunk-ym0e374a.js → chunk-pvfx0dgz.js} +2 -2
- package/dist/{chunk-zpzk4wd2.js → chunk-qmh6f1bt.js} +10 -10
- package/dist/{chunk-14yjt309.js → chunk-qy11cp1v.js} +4 -4
- package/dist/{chunk-bysyrwfa.js → chunk-r00nn2qs.js} +3 -3
- package/dist/chunk-re2mry1d.js +2 -0
- package/dist/{chunk-g9dz0mx9.js → chunk-s775b8ra.js} +2 -2
- package/dist/{chunk-3f4xy76k.js → chunk-vd63xejx.js} +6 -6
- package/dist/{chunk-839m1t8t.js → chunk-vq4sh8aq.js} +1 -1
- package/dist/chunk-vvgs62za.js +2 -0
- package/dist/{chunk-zfrpss8y.js → chunk-w41kp60h.js} +4 -4
- package/dist/{chunk-9gx5p7zh.js → chunk-wjq1wqn6.js} +2 -2
- package/dist/chunk-xqr58cxk.js +2 -0
- package/dist/chunk-xqtzk9wr.js +2 -0
- package/dist/chunk-y19k3vt3.js +2 -0
- package/dist/{chunk-f30t1g74.js → chunk-y255yybn.js} +2 -2
- package/dist/chunk-y6z9qwtn.js +2 -0
- package/dist/chunk-ypgsyh5k.js +2 -0
- package/dist/{chunk-x7g0946r.js → chunk-z5wnd2qa.js} +1 -1
- package/dist/{chunk-qjfgdcck.js → chunk-zt7b6vwa.js} +4 -4
- package/dist/cli.js +19 -19
- package/dist/craft-bridge.js +6 -3
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native-backend.d.ts +11 -0
- package/dist/native-backend.js +65 -0
- package/dist/native-build.d.ts +2 -0
- package/dist/native-build.js +50 -7
- package/dist/process.d.ts +1 -0
- package/dist/process.js +1 -1
- package/dist/pwa.js +3 -3
- package/dist/render.js +3 -3
- package/dist/ssg.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-0d7dqt4d.js +0 -2
- package/dist/chunk-0grt24vd.js +0 -2
- package/dist/chunk-2vzfn6vy.js +0 -2
- package/dist/chunk-3bsz101e.js +0 -2
- package/dist/chunk-3jwjesb5.js +0 -2
- package/dist/chunk-4b4es5wg.js +0 -2
- package/dist/chunk-4xeafdr6.js +0 -2
- package/dist/chunk-4xkqdfqd.js +0 -2
- package/dist/chunk-5k989nr4.js +0 -2
- package/dist/chunk-5v95x083.js +0 -3
- package/dist/chunk-5yf9yzkp.js +0 -2
- package/dist/chunk-7mtdjjbt.js +0 -2
- package/dist/chunk-88dxeynx.js +0 -2
- package/dist/chunk-8er7jc3c.js +0 -2
- package/dist/chunk-8phbb8wj.js +0 -2
- package/dist/chunk-97zrn4wb.js +0 -18
- package/dist/chunk-a83r1xx9.js +0 -2
- package/dist/chunk-abpeac2d.js +0 -2
- package/dist/chunk-adzsqsjt.js +0 -2
- package/dist/chunk-b1ndskw9.js +0 -2
- package/dist/chunk-b7fp3zta.js +0 -2
- package/dist/chunk-bgfkbesj.js +0 -2
- package/dist/chunk-cy83yfy9.js +0 -2
- package/dist/chunk-dbqb1a51.js +0 -2
- package/dist/chunk-e8t64hxk.js +0 -2
- package/dist/chunk-e943xk88.js +0 -2
- package/dist/chunk-g039c67x.js +0 -2
- package/dist/chunk-ghfxfcr9.js +0 -2
- package/dist/chunk-gvyq9xt6.js +0 -2
- package/dist/chunk-h30y9k44.js +0 -2
- package/dist/chunk-hwp3m8a8.js +0 -2
- package/dist/chunk-jarptkbv.js +0 -2
- package/dist/chunk-km4xp898.js +0 -2
- package/dist/chunk-meze7k8v.js +0 -2
- package/dist/chunk-mfwrxz9z.js +0 -2
- package/dist/chunk-mmpm1awz.js +0 -2
- package/dist/chunk-n7vetrt4.js +0 -2
- package/dist/chunk-nd716zha.js +0 -2
- package/dist/chunk-ptjz4f2e.js +0 -2
- package/dist/chunk-q4hmgj72.js +0 -2
- package/dist/chunk-q841b6x4.js +0 -2
- package/dist/chunk-qnh5x7vv.js +0 -2
- package/dist/chunk-qxjfvkjt.js +0 -2
- package/dist/chunk-rhhwz7e9.js +0 -2
- package/dist/chunk-rpbe5h6v.js +0 -2
- package/dist/chunk-rrdn4qnn.js +0 -2
- package/dist/chunk-s7c9kb53.js +0 -2
- package/dist/chunk-sfj84n72.js +0 -2
- package/dist/chunk-sgr2hhsc.js +0 -2
- package/dist/chunk-taztcvv3.js +0 -2
- package/dist/chunk-vczt5k2j.js +0 -2
- package/dist/chunk-vj5fghnv.js +0 -2
- package/dist/chunk-wn1s8af8.js +0 -2
- package/dist/chunk-y3jyk5bj.js +0 -2
- package/dist/chunk-ytxzy6eg.js +0 -2
- package/dist/chunk-ywf319rp.js +0 -2
- package/dist/chunk-yww6c9we.js +0 -2
- package/dist/chunk-yy43hxb7.js +0 -2
- package/dist/chunk-z42jb949.js +0 -2
- package/dist/chunk-zw20a7q4.js +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var ls=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function Qo(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||ls},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
|
|
2
|
+
var us=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function ei(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||us},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
|
|
3
3
|
`)}function N(e,t,r){let n=" ".repeat(r);if(r===0)t.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let i=`node_${r}`;t.push(`${n} var ${i} = try ${e.zigType}.init(allocator);`);for(let[o,s]of Object.entries(e.props))if(s.type==="literal"){let a=typeof s.value==="string"?`"${s.value}"`:String(s.value);t.push(`${n} ${i}.set${J(o)}(${a});`)}for(let o=0;o<e.children.length;o++){let s=e.children[o];if(s.type==="text"){let a=s.props.text?.type==="literal"?String(s.props.text.value):"";t.push(`${n} try ${i}.addChild(try craft.Text.init(allocator, "${a}"));`)}else N(s,t,r+1),t.push(`${n} try ${i}.addChild(node_${r+1});`)}if(r===0)t.push(` return ${i}.element();`),t.push("}")}function E(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('import { Craft } from "@stacksjs/craft";'),r.push(""),r.push("export function render(): Craft.Element {"),r.push(" return "+v(e,1)+";"),r.push("}"),r.join(`
|
|
4
4
|
`)}function v(e,t){let r=" ".repeat(t),n=[];for(let[a,l]of Object.entries(e.props))if(l.type==="literal"){let p=typeof l.value==="string"?`"${l.value}"`:String(l.value);n.push(`${a}: ${p}`)}let i=n.length>0?`{ ${n.join(", ")} }`:"{}",o=e.children.map((a)=>a.type==="text"?`"${a.props.text?.type==="literal"?a.props.text.value:""}"`:v(a,t+1)),s=o.length>0?`,
|
|
5
5
|
${r} [${o.join(`,
|
|
6
6
|
${r} `)}]`:"";return`Craft.create("${e.zigType}", ${i}${s})`}function H(e,t,r){if(t.target==="universal"){let n=[];n.push("// Universal entry point"),n.push("");for(let[i,o]of r)n.push(`// --- ${i.toUpperCase()} ---`),n.push(`#if ${i.toUpperCase()}`),n.push(o),n.push("#endif"),n.push("");return n.join(`
|
|
7
|
-
`)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function
|
|
8
|
-
export{
|
|
7
|
+
`)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function ti(e){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(t)=>{console.log(`[craft-compiler] File changed: ${t}`)}}}var K={compileToNative:ei,createHotReloadServer:ti,NATIVE_COMPONENTS:us},Zu=K;
|
|
8
|
+
export{us,ei,ti,Zu};
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{qe}from"./chunk-
|
|
2
|
+
import{qe}from"./chunk-w41kp60h.js";function sr(e){let n=e.pwa;if(!n?.enabled)return"";let r=n.manifest,t=n.icons?.outputDir?`/${n.icons.outputDir}`:"/pwa-icons",o=qe(e),i=`
|
|
3
3
|
<!-- stx PWA Meta Tags -->
|
|
4
4
|
<link rel="manifest" href="/manifest.json">
|
|
5
5
|
<meta name="theme-color" content="${a(r?.themeColor||"#000000")}">
|
|
@@ -43,9 +43,9 @@ if ('serviceWorker' in navigator) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
</script>
|
|
46
|
-
<!-- End stx PWA -->`,i}function
|
|
47
|
-
`+e.slice(o)}return e+
|
|
48
|
-
</head>`)}function
|
|
46
|
+
<!-- End stx PWA -->`,i}function ds(e,n){let r=n.pwa;if(!r?.enabled||r.autoInject===!1)return e;if(e.includes("<!-- stx PWA Meta Tags -->"))return e;if(!e.includes("</head>")){let o=e.lastIndexOf("</body>");if(o!==-1){let i=sr(n);return e.slice(0,o)+i+`
|
|
47
|
+
`+e.slice(o)}return e+sr(n)}let t=sr(n);return e.replace("</head>",`${t}
|
|
48
|
+
</head>`)}function gc(e){if(!e.pwa?.enabled)return"";return`<script>
|
|
49
49
|
if ('serviceWorker' in navigator) {
|
|
50
50
|
window.addEventListener('load', function() {
|
|
51
51
|
navigator.serviceWorker.register('/${qe(e)}')
|
|
@@ -57,5 +57,5 @@ if ('serviceWorker' in navigator) {
|
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
</script>`}function
|
|
61
|
-
export{
|
|
60
|
+
</script>`}function mc(){return'<link rel="manifest" href="/manifest.json">'}function hc(e){return`<meta name="theme-color" content="${a(e)}">`}function a(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
61
|
+
export{sr,ds,gc,mc,hc};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function
|
|
3
|
-
`)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function
|
|
4
|
-
`)}function
|
|
5
|
-
export{
|
|
2
|
+
import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function qi(e){try{return w.has(c.realpathSync(e))}catch{return w.has(i.resolve(e))}}var _=new Set(["extends","root",...j.map((e)=>`${e}Dir`),"publicDir","stateDir","cachePath"]),x=(e)=>e!==null&&typeof e==="object"&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null);function b(e,n,r=""){if(Array.isArray(n))return["middleware","plugins"].includes(r)?[...Array.isArray(e)?e:[],...n]:[...n];if(!x(n))return n;let o={...x(e)?e:{}};for(let[s,a]of Object.entries(n)){if(["__proto__","constructor","prototype"].includes(s))throw Error(`Invalid layer config key: ${s}`);o[s]=b(o[s],a,s)}return o}function v(e){for(let n of["stx.config.ts","stx.config.js","stx.config.mjs",".config/stx.config.ts",".config/stx.ts","ui.config.ts"]){let r=i.join(e,n);if(c.existsSync(r))return c.realpathSync(r)}throw Error(`Application layer has no stx.config.ts: ${e}`)}function E(e,n,r){if(typeof e!=="string"||!e||/^(?:https?:|git[+:])/.test(e))throw Error(`Invalid application layer ${JSON.stringify(e)} in ${n}; use a local path or installed package`);if(e.startsWith(".")||i.isAbsolute(e)){let s=i.resolve(n,e);return c.statSync(s).isDirectory()?v(s):c.realpathSync(s)}let o=n;while(!0){let s=i.join(o,"node_modules",e),a=i.join(s,"package.json");if(c.existsSync(a)){r.add(c.realpathSync(a));let g=JSON.parse(c.readFileSync(a,"utf8"));return g.stx?.layer?c.realpathSync(i.resolve(s,g.stx.layer)):v(s)}let p=i.dirname(o);if(p===o)break;o=p}throw Error(`Cannot resolve application layer ${JSON.stringify(e)} from ${n}`)}async function C(e,n){let r=await Bun.build({entrypoints:[e],target:"bun",format:"esm",splitting:!1,plugins:[{name:"stx-layer-config",setup(a){a.onResolve({filter:/^[^./]/},(p)=>{if(p.path.startsWith("node:"))return{path:p.path,external:!0};return{path:Bun.resolveSync(p.path,p.resolveDir),external:!0}}),a.onLoad({filter:/./},(p)=>{let g=c.realpathSync(p.path);n.add(g),w.add(g);return})}}]});if(!r.success)throw Error(`Cannot load layer ${e}: ${r.logs.join(`
|
|
3
|
+
`)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function Gi(e,n){let r=new Set,o=[],s=[],a=new Set,p=[];async function g(t,l){if(t=c.realpathSync(t),p.includes(t))throw Error(`Application layer cycle: ${[...p,t].join(" -> ")}`);if(a.has(t))return;a.add(t),p.push(t);let d=await C(t,r);l??=i.basename(i.dirname(t))===".config"?i.dirname(i.dirname(t)):i.dirname(t),l=c.realpathSync(l);let D=i.resolve(l,d.root??"."),L=Object.fromEntries(j.map((y)=>[y,i.resolve(D,d[`${y}Dir`]??(y==="composables"?"functions":y))]));o.push({root:l,configFile:t,resources:L});let u={...d};if(u.plugins)u.plugins=u.plugins.map((y)=>{let h=typeof y==="string"?y:y[0],S=h.startsWith(".")?i.resolve(l,h):i.isAbsolute(h)?h:Bun.resolveSync(h,l);return r.add(c.realpathSync(S)),typeof y==="string"?S:[S,y[1]]});if(typeof u.css==="string")u.css=i.resolve(l,u.css);if(u.serverApi)u.serverApi={...typeof u.serverApi==="object"?u.serverApi:{},dir:i.resolve(l,typeof u.serverApi==="object"?u.serverApi.dir??"server/api":"server/api")};if(s.push(u),d.extends!==void 0&&!Array.isArray(d.extends))throw Error(`extends in ${t} must be an array`);for(let y of d.extends??[])await g(E(y,l,r));p.pop()}await g(v(e),e);for(let t of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let l=i.join(e,t);if(c.existsSync(l))r.add(c.realpathSync(l))}let f=b({},n);for(let t=s.length-1;t>=0;t--){let l=t===0?s[t]:Object.fromEntries(Object.entries(s[t]).filter(([d])=>!_.has(d)));f=b(f,l)}let m={layers:o,configDependencies:[...r].sort()};return f._layerGraph=m,f._layerPageDirs=o.map((t)=>t.resources.pages),f._layerComponentDirs=o.map((t)=>t.resources.components),f._layerLayoutDirs=o.map((t)=>t.resources.layouts),f._layerPartialDirs=o.map((t)=>t.resources.partials),f._layerComposableDirs=o.map((t)=>t.resources.composables),await Gs(m,e),{config:f,graph:m}}async function Gs(e,n){let r=new Map,o=[];for(let s of e.layers)for(let[a,p]of Object.entries(s.resources)){if(!c.existsSync(p))continue;let g=new Bun.Glob(a==="composables"?"**/*.ts":"**/*.stx");for(let f of[...g.scanSync({cwd:p})].sort()){let m=`${a}/${f}`,t=i.join(p,f),l=r.get(m);if(l)o.push({resource:m,winner:l,shadowed:t});else r.set(m,t)}}Object.assign(e,{overrides:o}),await Bun.write(i.join(n,".stx/layers.json"),JSON.stringify(e,null,2))}function A(e){let n=new Set(e.configDependencies);function r(o){if(!c.existsSync(o))return;n.add(o);for(let s of c.readdirSync(o,{withFileTypes:!0}).sort((a,p)=>a.name.localeCompare(p.name))){if(s.name.startsWith(".")||s.name==="node_modules")continue;let a=i.join(o,s.name);if(s.isDirectory())r(a);else if(s.isFile())n.add(a)}}for(let o of e.layers)for(let s of Object.values(o.resources))r(s);return[...n].sort()}function vr(e){return O(A(e))}function wr(e){return O(e.configDependencies)}function O(e){return e.map((n)=>{try{let r=c.statSync(n);return`${n}:${r.mtimeMs}:${r.size}`}catch{return`${n}:missing`}}).join(`
|
|
4
|
+
`)}function Ki(e){return e.layers.map((n)=>({config:i.relative(n.root,n.configFile),files:A({layers:[n],configDependencies:e.configDependencies.filter((r)=>r.startsWith(`${n.root}${i.sep}`))}).filter((r)=>c.statSync(r).isFile()).map((r)=>({path:i.relative(n.root,r).replaceAll(i.sep,"/"),sha256:k("sha256").update(c.readFileSync(r)).digest("hex")}))}))}
|
|
5
|
+
export{qi,Gi,Gs,vr,wr,Ki};
|
|
@@ -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
|
|
|
@@ -323,7 +326,7 @@ else if (data.type === 'event' && data.method) {
|
|
|
323
326
|
});
|
|
324
327
|
|
|
325
328
|
// Build the craft API object
|
|
326
|
-
window.craft = Object.assign({},
|
|
329
|
+
window.craft = Object.assign({}, {
|
|
327
330
|
// Meta
|
|
328
331
|
isCraft,
|
|
329
332
|
on,
|
|
@@ -455,7 +458,7 @@ else if (data.type === 'event' && data.method) {
|
|
|
455
458
|
// Native component helpers
|
|
456
459
|
nativeUI,
|
|
457
460
|
components: componentAPI
|
|
458
|
-
});
|
|
461
|
+
}, existingCraft, { nativeUI, components: componentAPI });
|
|
459
462
|
|
|
460
463
|
// Dispatch ready event
|
|
461
464
|
window.dispatchEvent(new CustomEvent('craft:ready', { detail: { isCraft: isCraft() } }));
|
|
@@ -465,12 +468,15 @@ else if (data.type === 'event' && data.method) {
|
|
|
465
468
|
}
|
|
466
469
|
})();
|
|
467
470
|
</script>
|
|
468
|
-
`;function
|
|
471
|
+
`;function Go(e={}){let{debug:a=!1,timeout:r=30000}=e;return`
|
|
469
472
|
<script>
|
|
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
|
|
|
@@ -789,7 +795,7 @@ else if (data.type === 'event' && data.method) {
|
|
|
789
795
|
});
|
|
790
796
|
|
|
791
797
|
// Build the craft API object
|
|
792
|
-
window.craft = Object.assign({},
|
|
798
|
+
window.craft = Object.assign({}, {
|
|
793
799
|
// Meta
|
|
794
800
|
isCraft,
|
|
795
801
|
on,
|
|
@@ -921,7 +927,7 @@ else if (data.type === 'event' && data.method) {
|
|
|
921
927
|
// Native component helpers
|
|
922
928
|
nativeUI,
|
|
923
929
|
components: componentAPI
|
|
924
|
-
});
|
|
930
|
+
}, existingCraft, { nativeUI, components: componentAPI });
|
|
925
931
|
|
|
926
932
|
// Dispatch ready event
|
|
927
933
|
window.dispatchEvent(new CustomEvent('craft:ready', { detail: { isCraft: isCraft() } }));
|
|
@@ -931,12 +937,12 @@ else if (data.type === 'event' && data.method) {
|
|
|
931
937
|
}
|
|
932
938
|
})();
|
|
933
939
|
</script>
|
|
934
|
-
`.replace("debug: false,",`debug: ${a},`).replace("timeout: 30000",`timeout: ${r}`)}function
|
|
940
|
+
`.replace("debug: false,",`debug: ${a},`).replace("timeout: 30000",`timeout: ${r}`)}function qu(){return!1}function Gu(e,a={}){let r=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(r,(i,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return Go(t)})}function Ko(e,a={}){if(e.includes("__craftBridgeInitialized"))return e;let r=Go(a);if(e.includes("</head>"))return e.replace("</head>",`${r}
|
|
935
941
|
</head>`);if(e.includes("<body"))return e.replace(/(<body[^>]*>)/,`$1
|
|
936
|
-
${r}`);return r+e}var
|
|
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 cs={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 {
|
|
@@ -1365,7 +1371,7 @@ ${r}`);return r+e}var cs={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
1365
1371
|
}
|
|
1366
1372
|
}
|
|
1367
1373
|
</style>
|
|
1368
|
-
`,
|
|
1374
|
+
`,Ku=`
|
|
1369
1375
|
<script id="craft-component-runtime">
|
|
1370
1376
|
(function() {
|
|
1371
1377
|
if (window.__stxCraftComponentRuntime) return;
|
|
@@ -1469,7 +1475,7 @@ ${r}`);return r+e}var cs={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
1469
1475
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
1470
1476
|
})();
|
|
1471
1477
|
</script>
|
|
1472
|
-
`;function
|
|
1478
|
+
`;function Jo(e,a={}){let{classPrefix:r="craft"}=a;if(!e.includes("craft-component-styles"))if(e.includes("</head>"))e=e.replace("</head>",`${`
|
|
1473
1479
|
<style id="craft-component-styles">
|
|
1474
1480
|
/* Craft Component Base Styles */
|
|
1475
1481
|
.craft-button {
|
|
@@ -2934,46 +2940,54 @@ ${r}`);return r+e}var cs={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="${
|
|
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
|
|
2955
|
-
${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${
|
|
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"}">
|
|
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}`,
|
|
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
|
|
3022
|
-
export{
|
|
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;
|
|
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
|
|
3
|
-
export{vt,
|
|
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};
|