@stacksjs/stx 0.2.861 → 0.2.862
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/analytics.js +3 -2
- package/dist/animation.js +3 -3
- package/dist/app-shell.js +4 -3
- package/dist/{chunk-14cvwsy1.js → chunk-01c16zw4.js} +2 -2
- package/dist/chunk-0bfgsv31.js +2 -0
- package/dist/chunk-0c9c9v03.js +14 -0
- package/dist/{chunk-naj146zq.js → chunk-0fh47gp0.js} +2 -2
- package/dist/chunk-0fpx3ctt.js +2 -0
- package/dist/chunk-0twkeh31.js +2 -0
- package/dist/chunk-0xtda6aw.js +2 -0
- package/dist/chunk-12sv6b9c.js +2 -0
- package/dist/chunk-194t5qat.js +2 -0
- package/dist/chunk-1crn4fv0.js +2 -0
- package/dist/chunk-1d3swbqw.js +2 -0
- package/dist/{chunk-9syvkm5z.js → chunk-1mqcttg3.js} +6 -6
- package/dist/chunk-1qf07v41.js +2 -0
- package/dist/chunk-24hq8mka.js +3 -0
- package/dist/chunk-2asyyky3.js +2 -0
- package/dist/chunk-2dpessnc.js +54 -0
- package/dist/{chunk-h4aqpf2r.js → chunk-2jgtfjyr.js} +5 -5
- package/dist/chunk-2kfayg4t.js +712 -0
- package/dist/chunk-2rff5mbj.js +4 -0
- package/dist/chunk-2s7rmn9r.js +3 -0
- package/dist/{chunk-avp271q4.js → chunk-2srjavsn.js} +2 -2
- package/dist/chunk-2zqh7xct.js +2 -0
- package/dist/chunk-321fbxnm.js +1327 -0
- package/dist/chunk-3gk1e2b1.js +2 -0
- package/dist/chunk-3ryp43f3.js +2 -0
- package/dist/{chunk-12r22pf0.js → chunk-3z1mmar2.js} +2 -2
- package/dist/{chunk-zhxdpzga.js → chunk-46ddesnf.js} +3 -3
- package/dist/chunk-46pxmpeb.js +3 -0
- package/dist/chunk-4pr29yrx.js +2 -0
- package/dist/{chunk-6nb49h13.js → chunk-4xanjv22.js} +125 -126
- package/dist/chunk-4ykgjewy.js +16 -0
- package/dist/{chunk-tjz3r7rj.js → chunk-55zq2ha8.js} +5 -5
- package/dist/{chunk-gggadrs4.js → chunk-5a0d3048.js} +3 -3
- package/dist/chunk-5ertqfs3.js +2 -0
- package/dist/chunk-627hzzs3.js +2 -0
- package/dist/chunk-64ebysb4.js +2 -0
- package/dist/{chunk-4rrxrxp6.js → chunk-669b2bya.js} +4 -4
- package/dist/{chunk-38qp2pg2.js → chunk-67dgp45w.js} +2 -2
- package/dist/chunk-6fstz73t.js +2 -0
- package/dist/{chunk-5xdkmn39.js → chunk-6ftee542.js} +2 -2
- package/dist/{chunk-5wr1qqz3.js → chunk-6k4ac74t.js} +2 -2
- package/dist/{chunk-121cgm3s.js → chunk-6m63rc7m.js} +8 -8
- package/dist/{chunk-c2w4wc9f.js → chunk-6m6y9bbx.js} +1 -1
- package/dist/chunk-6pczzq5f.js +2 -0
- package/dist/{chunk-6tp0w6hf.js → chunk-7ayvybdy.js} +3 -3
- package/dist/chunk-7mjf144y.js +2 -0
- package/dist/{chunk-5neezkj1.js → chunk-7mpqfg98.js} +21 -21
- package/dist/chunk-7q5h2cve.js +2 -0
- package/dist/chunk-7wqevtks.js +2 -0
- package/dist/chunk-84ztb43k.js +2 -0
- package/dist/{chunk-bag9q4m0.js → chunk-8502xb4n.js} +39 -39
- package/dist/{chunk-5ka3h8dy.js → chunk-85j9qh7v.js} +45 -46
- package/dist/{chunk-cxpq2zna.js → chunk-8arfg8kp.js} +3 -3
- package/dist/{chunk-xmy6g81m.js → chunk-8hhhmscy.js} +2 -2
- package/dist/{chunk-fyfvqd2s.js → chunk-8me8hamk.js} +2 -2
- package/dist/{chunk-pb09xy77.js → chunk-8s6s6nd0.js} +2 -2
- package/dist/chunk-8v1zpdef.js +2 -0
- package/dist/chunk-94mpe1ny.js +3 -0
- package/dist/chunk-94wnfxnd.js +2 -0
- package/dist/chunk-9jxs8sw2.js +2 -0
- package/dist/{chunk-eye156nv.js → chunk-9y9jecky.js} +1 -1
- package/dist/{chunk-mzes9ds7.js → chunk-9zrvh3pz.js} +2 -2
- package/dist/{chunk-68w65mhs.js → chunk-adb045wf.js} +3 -3
- package/dist/{chunk-fpkp0bqf.js → chunk-adqh1gp1.js} +1 -1
- package/dist/chunk-az5xw3w8.js +2 -0
- package/dist/chunk-ba91r7q9.js +2 -0
- package/dist/{chunk-qkcn0exq.js → chunk-brzjass3.js} +6 -6
- package/dist/chunk-bv7g3b3b.js +2 -0
- package/dist/chunk-bwdbj60y.js +3 -0
- package/dist/chunk-bwz2ehq9.js +33 -0
- package/dist/{chunk-3wg9kr5z.js → chunk-bx5d87xx.js} +6 -7
- package/dist/chunk-bz6dg4k8.js +3 -0
- package/dist/chunk-c34qn4k8.js +16 -0
- package/dist/{chunk-37tefp7s.js → chunk-cqhwzd9y.js} +5 -5
- package/dist/chunk-cvgbtmxp.js +2 -0
- package/dist/chunk-czpn3n1p.js +2 -0
- package/dist/chunk-dhnw2qwq.js +25 -0
- package/dist/{chunk-65cbfx5x.js → chunk-dpmayc2w.js} +2 -2
- package/dist/{chunk-d6216bcw.js → chunk-dtarm8x9.js} +9 -9
- package/dist/chunk-dydy9zrq.js +3 -0
- package/dist/chunk-eafqxbr0.js +2 -0
- package/dist/{chunk-hyea17hp.js → chunk-eeq8k81z.js} +155 -157
- package/dist/{chunk-qjm23ma2.js → chunk-ew5cey88.js} +1 -1
- package/dist/chunk-fa97kz5j.js +2 -0
- package/dist/{chunk-xppm4cs4.js → chunk-farh4p7f.js} +3 -3
- package/dist/{chunk-b1tctqn5.js → chunk-fnxg6134.js} +10 -10
- package/dist/chunk-g075cc67.js +2 -0
- package/dist/{chunk-zpkgs5d3.js → chunk-g5xth2yx.js} +6 -6
- package/dist/{chunk-q6w7a1vc.js → chunk-gbtbfg7e.js} +3 -3
- package/dist/{chunk-15jymk6t.js → chunk-gd56arnm.js} +2 -2
- package/dist/chunk-gmm3kffd.js +2 -0
- package/dist/{chunk-8hck9qqm.js → chunk-gp8hgpt9.js} +4 -4
- package/dist/chunk-h2qgqjkn.js +2 -0
- package/dist/chunk-h65shwe9.js +2 -0
- package/dist/chunk-hdjn7nw9.js +20 -0
- package/dist/{chunk-cq2hedwn.js → chunk-hev4t4d5.js} +6 -6
- package/dist/chunk-hf5fj7pr.js +2 -0
- package/dist/{chunk-7yhhwv07.js → chunk-hmdkf6c6.js} +2 -2
- package/dist/chunk-hsp9h3jn.js +2 -0
- package/dist/{chunk-vggtxttf.js → chunk-j1efsjsb.js} +5 -5
- package/dist/chunk-j4zrq17p.js +2 -0
- package/dist/chunk-jx5mss16.js +2 -0
- package/dist/chunk-jz84z19v.js +2 -0
- package/dist/{chunk-5rxks14t.js → chunk-k32q90b2.js} +2 -2
- package/dist/{chunk-x69457q9.js → chunk-kbdz4762.js} +8 -8
- package/dist/chunk-kw11yydy.js +2 -0
- package/dist/{chunk-wrbhq1y2.js → chunk-kwk3kxrx.js} +3 -3
- package/dist/chunk-kyer53x3.js +2 -0
- package/dist/chunk-m9cperj4.js +2 -0
- package/dist/{chunk-zs4s9fcq.js → chunk-mcnwvh06.js} +6 -6
- package/dist/chunk-meqsd5bt.js +2 -0
- package/dist/{chunk-dba4bwkd.js → chunk-mfa07erx.js} +16 -16
- package/dist/chunk-mj4wbrw7.js +2 -0
- package/dist/{chunk-76360zky.js → chunk-mjy98ppb.js} +9 -9
- package/dist/{chunk-jh2v1vvb.js → chunk-mrh08821.js} +3 -3
- package/dist/{chunk-15rkvc0t.js → chunk-n058hznh.js} +5 -5
- package/dist/{chunk-9n8t7v78.js → chunk-n3jw3xpj.js} +2 -2
- package/dist/chunk-nz9z3ct9.js +2 -0
- package/dist/chunk-p0tkhd12.js +2 -0
- package/dist/chunk-p2etn78y.js +2 -0
- package/dist/{chunk-1nankvf6.js → chunk-pbakxcv8.js} +2 -2
- package/dist/{chunk-t5q31st4.js → chunk-q1wxgw5s.js} +2 -2
- package/dist/chunk-qa5y30sy.js +72 -0
- package/dist/{chunk-m3p4hksq.js → chunk-qbghf76y.js} +4 -4
- package/dist/{chunk-a6d92kv6.js → chunk-qcxrcypb.js} +2 -2
- package/dist/{chunk-1jwcp2k0.js → chunk-qjey0jk6.js} +2 -2
- package/dist/chunk-rqa92xm4.js +2 -0
- package/dist/chunk-rvhrtnv3.js +12 -0
- package/dist/{chunk-bg0ywp5w.js → chunk-s0sad753.js} +2 -2
- package/dist/chunk-s92j8k4z.js +2 -0
- package/dist/chunk-s9df8srx.js +6 -0
- package/dist/{chunk-dt73ww6m.js → chunk-sb8n32rn.js} +1 -1
- package/dist/chunk-snz2cxqv.js +2 -0
- package/dist/{chunk-36vksrry.js → chunk-srgnevws.js} +2 -2
- package/dist/chunk-srgpz94e.js +42 -0
- package/dist/{chunk-9pyvc0dc.js → chunk-tnp2ta5q.js} +2 -2
- package/dist/{chunk-gx96hctv.js → chunk-v37zmez0.js} +2 -2
- package/dist/chunk-v408qsze.js +2 -0
- package/dist/{chunk-thdnk1kd.js → chunk-v4xes880.js} +3 -3
- package/dist/chunk-vfx1p83g.js +33 -0
- package/dist/chunk-vk98r75z.js +2 -0
- package/dist/{chunk-yj9nyt93.js → chunk-vvzys1x7.js} +3 -3
- package/dist/{chunk-f1vvhbmw.js → chunk-w6pzkcjp.js} +2 -2
- package/dist/chunk-x0s68p47.js +2 -0
- package/dist/{chunk-3gfd9t8a.js → chunk-x512h2gv.js} +4 -4
- package/dist/{chunk-nwxjh1gv.js → chunk-x7redxyd.js} +4 -4
- package/dist/chunk-xjxcwrqs.js +2 -0
- package/dist/chunk-xsq2jf96.js +2 -0
- package/dist/chunk-xymr4ys9.js +3 -0
- package/dist/{chunk-7bajrfb1.js → chunk-y3qg95wa.js} +8 -8
- package/dist/chunk-y7f2x57s.js +2 -0
- package/dist/chunk-ymdw4fhd.js +3 -0
- package/dist/chunk-ymjjn9pw.js +20 -0
- package/dist/chunk-ynkbv9jq.js +4 -0
- package/dist/{chunk-e8nzbz66.js → chunk-ysfeg3cn.js} +2 -2
- package/dist/chunk-ytzzth34.js +2 -0
- package/dist/chunk-yxpjj003.js +2 -0
- package/dist/chunk-z1rs6b4x.js +2 -0
- package/dist/{chunk-tm201m9x.js → chunk-z512gt4v.js} +3 -3
- package/dist/chunk-z6ntmv5x.js +2 -0
- package/dist/{chunk-5n7m8vqx.js → chunk-zbvfjm4a.js} +2 -2
- package/dist/chunk-zsnmk5me.js +2 -0
- package/dist/cli.js +35 -35
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/serve-app.js +3 -2
- package/dist/dev-server/serve-multi.js +3 -4
- package/dist/dev-server/ts-css.js +4 -5
- package/dist/document-shell.js +4 -3
- package/dist/document-tags.d.ts +8 -0
- package/dist/document-tags.js +37 -0
- package/dist/events.js +2 -1
- package/dist/head-injection.js +2 -1
- package/dist/heatmap.js +2 -1
- package/dist/hot-reload.js +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/native-build.js +3 -3
- package/dist/process.js +5 -6
- package/dist/production-build.js +3 -3
- package/dist/pwa/inject.js +3 -3
- package/dist/pwa.js +3 -3
- package/dist/reactive-bindings.js +2 -1
- package/dist/reactive.js +2 -1
- package/dist/render.js +1 -1
- package/dist/runtime-injection.js +6 -6
- package/dist/serve.js +1 -1
- package/dist/site-builder/build.js +1 -1
- package/dist/site-builder/i18n.js +2 -2
- package/dist/site-builder/router.js +1 -1
- package/dist/site-builder/theme.js +1 -1
- package/dist/ssg.js +30 -31
- package/dist/template-hydrator.js +2 -1
- package/dist/web-components/css-scoping.js +3 -3
- package/dist/x-element.js +2 -1
- package/package.json +5 -5
- package/dist/body-close.d.ts +0 -13
- package/dist/body-close.js +0 -8
- package/dist/chunk-02css3vk.js +0 -14
- package/dist/chunk-0hqr6bff.js +0 -2
- package/dist/chunk-15sgdvyd.js +0 -2
- package/dist/chunk-261t62q4.js +0 -712
- package/dist/chunk-2b4a8tbd.js +0 -3
- package/dist/chunk-2fw36w1x.js +0 -2
- package/dist/chunk-2jcxsw75.js +0 -2
- package/dist/chunk-2pbhdaka.js +0 -2
- package/dist/chunk-2wba5ypm.js +0 -2
- package/dist/chunk-353gnvfe.js +0 -2
- package/dist/chunk-3cr5y8v1.js +0 -2
- package/dist/chunk-3y7yp0ka.js +0 -2
- package/dist/chunk-41wwqw0q.js +0 -2
- package/dist/chunk-4a1y51fs.js +0 -2
- package/dist/chunk-4a751brg.js +0 -2
- package/dist/chunk-4jgcd4d9.js +0 -33
- package/dist/chunk-5awhm4na.js +0 -2
- package/dist/chunk-5fhp9hxd.js +0 -2
- package/dist/chunk-5mg443dw.js +0 -2
- package/dist/chunk-5q4tncfw.js +0 -18
- package/dist/chunk-5x9ajbq0.js +0 -2
- package/dist/chunk-6g7tkmty.js +0 -2
- package/dist/chunk-72bj7ea4.js +0 -2
- package/dist/chunk-74g64pzt.js +0 -20
- package/dist/chunk-7de5y29a.js +0 -54
- package/dist/chunk-7ycmnsh5.js +0 -2
- package/dist/chunk-811hh6vp.js +0 -2
- package/dist/chunk-830ej8d2.js +0 -72
- package/dist/chunk-8fkmxrat.js +0 -2
- package/dist/chunk-8p9npc8y.js +0 -2
- package/dist/chunk-9fz3h6sx.js +0 -2
- package/dist/chunk-9jr30fns.js +0 -2
- package/dist/chunk-9xr628ew.js +0 -3
- package/dist/chunk-a9m6ajd7.js +0 -2
- package/dist/chunk-aj6vqdf7.js +0 -25
- package/dist/chunk-asr5v51s.js +0 -2
- package/dist/chunk-b7nmgkwa.js +0 -42
- package/dist/chunk-bv14vry8.js +0 -3
- package/dist/chunk-byx82s10.js +0 -2
- package/dist/chunk-c9y1g61m.js +0 -2
- package/dist/chunk-ck5nzbbv.js +0 -2
- package/dist/chunk-cvdm0hgq.js +0 -2
- package/dist/chunk-e0fxgbcc.js +0 -2
- package/dist/chunk-ed2m6pjf.js +0 -2
- package/dist/chunk-ednwdhv0.js +0 -2
- package/dist/chunk-egtphftq.js +0 -2
- package/dist/chunk-f18rxz70.js +0 -2
- package/dist/chunk-fahqq7c4.js +0 -2
- package/dist/chunk-fcbpzdyz.js +0 -2
- package/dist/chunk-gc79s0wh.js +0 -20
- package/dist/chunk-gjnrmz2q.js +0 -4
- package/dist/chunk-gp1dt8b8.js +0 -33
- package/dist/chunk-h0dsxxz4.js +0 -2
- package/dist/chunk-h2cvfp9y.js +0 -2
- package/dist/chunk-jhm1228j.js +0 -4
- package/dist/chunk-k3yym9zg.js +0 -2
- package/dist/chunk-k9fsd6t3.js +0 -2
- package/dist/chunk-kepxsjfx.js +0 -2
- package/dist/chunk-kgrvvtcy.js +0 -3
- package/dist/chunk-kh01rvag.js +0 -2
- package/dist/chunk-kv40xq53.js +0 -1329
- package/dist/chunk-mad172af.js +0 -2
- package/dist/chunk-mjkdskeg.js +0 -12
- package/dist/chunk-npt0mdzb.js +0 -2
- package/dist/chunk-p95fsnbk.js +0 -2
- package/dist/chunk-ptc3yqn3.js +0 -2
- package/dist/chunk-pybm7c9p.js +0 -2
- package/dist/chunk-q87hkwfg.js +0 -3
- package/dist/chunk-qe6631me.js +0 -2
- package/dist/chunk-qnx71b17.js +0 -2
- package/dist/chunk-qx8cav4w.js +0 -2
- package/dist/chunk-rb7cwck6.js +0 -2
- package/dist/chunk-s1e0t3hv.js +0 -2
- package/dist/chunk-s7vfmasx.js +0 -2
- package/dist/chunk-scwbttvt.js +0 -3
- package/dist/chunk-shy2hkvj.js +0 -2
- package/dist/chunk-sxtvy0sm.js +0 -3
- package/dist/chunk-t7z67vf6.js +0 -2
- package/dist/chunk-tarvase5.js +0 -2
- package/dist/chunk-tqs9pcga.js +0 -2
- package/dist/chunk-twjfrywv.js +0 -2
- package/dist/chunk-v0wdgxga.js +0 -3
- package/dist/chunk-vyna2rsq.js +0 -2
- package/dist/chunk-w4gjx2zs.js +0 -18
- package/dist/chunk-xhe7pw6e.js +0 -2
- package/dist/chunk-y86mpnrg.js +0 -2
- package/dist/chunk-z99bf0q0.js +0 -3
- package/dist/chunk-zm0g7ntw.js +0 -2
- package/dist/chunk-zrm2x65c.js +0 -2
package/dist/craft-entry.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-2kfayg4t.js";import{Ro,Pa,Ia}from"./chunk-5a0d3048.js";import"./chunk-8502xb4n.js";import"./chunk-qa5y30sy.js";import"./chunk-qjey0jk6.js";import"./chunk-farh4p7f.js";import"./chunk-k32q90b2.js";import"./chunk-0fh47gp0.js";import"./chunk-tnp2ta5q.js";import"./chunk-x512h2gv.js";import"./chunk-4xanjv22.js";import"./chunk-mfa07erx.js";import"./chunk-669b2bya.js";import"./chunk-2s7rmn9r.js";import"./chunk-4ykgjewy.js";import"./chunk-321fbxnm.js";import"./chunk-srgpz94e.js";import"./chunk-2dpessnc.js";import"./chunk-fnxg6134.js";import"./chunk-dhnw2qwq.js";import"./chunk-q1wxgw5s.js";import"./chunk-vvzys1x7.js";import{Tu,Oa,Mh,Dh,Na,Ao,os,Ma,Da,Lh,jh,La,ja,Ba,Fa}from"./chunk-85j9qh7v.js";import"./chunk-c34qn4k8.js";import"./chunk-24hq8mka.js";import"./chunk-xymr4ys9.js";import"./chunk-0c9c9v03.js";import"./chunk-zsnmk5me.js";import"./chunk-adb045wf.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
|
|
3
3
|
`),scripts:t.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
|
|
5
5
|
`),scripts:t.scripts.join(`
|
|
6
6
|
`),hydrationData:i,metadata:{renderTime:s,cacheHit:!1,totalSize:a.length,componentCount:t.metadata.componentCount}}}function V(t,e){let n=[],r=[],a=[],i=new Map,s=[];return y(t.tree,(o,c)=>{if(o.type==="component"&&o.componentName){if(T(o.componentName))n.push(o.componentName)}if(o.type==="element"&&o.tag){let p=J(o);if(p)s.push(p);if(o.props){for(let[l,f]of Object.entries(o.props))if(l.startsWith("on")&&typeof f==="string"){let g=`handler_${i.size}`;i.set(g,f)}}}if(o.isStatic&&o.type==="element")r.push(b(o));else if(!o.isStatic&&o.type!=="text")a.push(o.tag||o.componentName||"unknown")}),{nativeComponents:n,staticHTML:r,dynamicParts:a,eventHandlers:i,nativeWidgets:s}}function Y(t,e={}){let n=R(t),r=P(n,e),a=new Map,i=[];return y(n.tree,(s)=>{if(s.type==="component"&&s.componentName){if(T(s.componentName)){i.push(s.componentName);let o=`<!--craft:${s.componentName}:${s.hydrationKey||"default"}-->`;a.set(s.hydrationKey||s.componentName,o)}}}),{staticHTML:r,dynamicPlaceholders:a,craftComponents:i}}function M(t){let e={type:"fragment",children:[]},n=e,r=[e],a=t,i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(a.length>0){let s=a.match(/^<(@?[\w-]+)([^>]*)>/);if(s){let[p,l,f]=s,g=z(f),u=l.startsWith("@craft-"),C=u?l:l.toLowerCase(),S={type:u?"component":"element",tag:C,props:g,children:[],componentName:u?C.slice(1):void 0,isStatic:!v(f),hydrationKey:F()};if(n.children=n.children||[],n.children.push(S),!i.has(C)&&!f.endsWith("/"))r.push(S),n=S;a=a.slice(p.length);continue}let o=a.match(/^<\/(@?[\w-]+)>/);if(o){let[p,l]=o,g=l.startsWith("@craft-")?l:l.toLowerCase();while(r.length>1){let u=r.pop();if(n=r[r.length-1],u.tag===g)break}a=a.slice(p.length);continue}let c=a.match(/^[^<]+/);if(c){let p=c[0];if(p.trim()){let l={type:"text",text:p,isStatic:!v(p)};n.children=n.children||[],n.children.push(l)}a=a.slice(p.length);continue}a=a.slice(1)}return e}function z(t){let e={},n=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,r;while((r=n.exec(t))!==null){let[,a,i,s,o]=r,c=i??s??o??!0;e[a]=c}return e}function y(t,e,n=[]){if(e(t,n),t.children)t.children.forEach((r,a)=>{y(r,e,[...n,`${a}`])})}function h(t,e){switch(t.type){case"text":return x(t.text||"",e);case"element":case"component":{let n=t.tag||"div",r=N(t.props||{},e),a=(t.children||[]).map((i)=>h(i,e)).join("");if(!t.children||t.children.length===0){if(["input","br","hr","img","meta","link"].includes(n))return`<${n}${r} />`}return`<${n}${r}>${a}</${n}>`}case"fragment":return(t.children||[]).map((n)=>h(n,e)).join("");case"slot":return`<!--slot:${t.slotName||"default"}-->`;default:return""}}function b(t){if(t.type==="text")return t.text||"";let e=t.tag||"div",n=N(t.props||{},{});return`<${e}${n}></${e}>`}function N(t,e){let n=[];for(let[r,a]of Object.entries(t))if(a===!0)n.push(` ${r}`);else if(a!==!1&&a!==null&&a!==void 0){let i=x(String(a),e);n.push(` ${r}="${k(i)}"`)}return n.join("")}async function H(t,e){return h(t,e)}function P(t,e){let n=[];return y(t.tree,(r)=>{if(r.isStatic)n.push(h(r,e))}),n.join("")}function j(t,e,n){let r={templateId:e.id,context:n,dynamicParts:Array.from(e.dynamicParts.entries())},a=`
|
|
7
7
|
<script data-craft-hydration>
|
|
8
8
|
window.__CRAFT_HYDRATION__ = ${JSON.stringify(r)};
|
|
9
|
-
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{
|
|
9
|
+
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{Tu as CRAFT_BRIDGE_SCRIPT,Ao as CRAFT_COMPONENTS,Ma as CRAFT_COMPONENT_RUNTIME,os as CRAFT_COMPONENT_STYLES,Ro as NATIVE_COMPONENTS,La as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Pa as compileToNative,Ia as createHotReloadServer,ja as findCraftBinary,Oa as generateCraftBridgeScript,V as generateCraftOptimizations,Fa as getAvailableFormats,Ba as getAvailableTargets,jh as getCraftComponents,G as getSSRCacheStats,Na as injectCraftBridge,Mh as isCraftEnvironment,Y as prerenderForCraft,Da as processCraftComponents,Dh as processCraftDirective,Lh as registerCraftComponent,Q as renderSSR};
|
package/dist/craft.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-2kfayg4t.js";import{Ro,Pa,Ia}from"./chunk-5a0d3048.js";import"./chunk-8502xb4n.js";import"./chunk-qa5y30sy.js";import"./chunk-qjey0jk6.js";import"./chunk-farh4p7f.js";import"./chunk-k32q90b2.js";import"./chunk-0fh47gp0.js";import"./chunk-tnp2ta5q.js";import"./chunk-x512h2gv.js";import"./chunk-4xanjv22.js";import"./chunk-mfa07erx.js";import"./chunk-669b2bya.js";import"./chunk-2s7rmn9r.js";import"./chunk-4ykgjewy.js";import"./chunk-321fbxnm.js";import"./chunk-srgpz94e.js";import"./chunk-2dpessnc.js";import"./chunk-fnxg6134.js";import"./chunk-dhnw2qwq.js";import"./chunk-q1wxgw5s.js";import"./chunk-vvzys1x7.js";import{Tu,Oa,Mh,Dh,Na,Ao,os,Ma,Da,Lh,jh,La,ja,Ba,Fa}from"./chunk-85j9qh7v.js";import"./chunk-c34qn4k8.js";import"./chunk-24hq8mka.js";import"./chunk-xymr4ys9.js";import"./chunk-0c9c9v03.js";import"./chunk-zsnmk5me.js";import"./chunk-adb045wf.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
|
|
3
3
|
`),scripts:t.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
|
|
5
5
|
`),scripts:t.scripts.join(`
|
|
6
6
|
`),hydrationData:i,metadata:{renderTime:s,cacheHit:!1,totalSize:a.length,componentCount:t.metadata.componentCount}}}function V(t,e){let n=[],r=[],a=[],i=new Map,s=[];return y(t.tree,(o,c)=>{if(o.type==="component"&&o.componentName){if(T(o.componentName))n.push(o.componentName)}if(o.type==="element"&&o.tag){let p=J(o);if(p)s.push(p);if(o.props){for(let[l,f]of Object.entries(o.props))if(l.startsWith("on")&&typeof f==="string"){let g=`handler_${i.size}`;i.set(g,f)}}}if(o.isStatic&&o.type==="element")r.push(b(o));else if(!o.isStatic&&o.type!=="text")a.push(o.tag||o.componentName||"unknown")}),{nativeComponents:n,staticHTML:r,dynamicParts:a,eventHandlers:i,nativeWidgets:s}}function Y(t,e={}){let n=R(t),r=P(n,e),a=new Map,i=[];return y(n.tree,(s)=>{if(s.type==="component"&&s.componentName){if(T(s.componentName)){i.push(s.componentName);let o=`<!--craft:${s.componentName}:${s.hydrationKey||"default"}-->`;a.set(s.hydrationKey||s.componentName,o)}}}),{staticHTML:r,dynamicPlaceholders:a,craftComponents:i}}function M(t){let e={type:"fragment",children:[]},n=e,r=[e],a=t,i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(a.length>0){let s=a.match(/^<(@?[\w-]+)([^>]*)>/);if(s){let[p,l,f]=s,g=z(f),u=l.startsWith("@craft-"),C=u?l:l.toLowerCase(),S={type:u?"component":"element",tag:C,props:g,children:[],componentName:u?C.slice(1):void 0,isStatic:!v(f),hydrationKey:F()};if(n.children=n.children||[],n.children.push(S),!i.has(C)&&!f.endsWith("/"))r.push(S),n=S;a=a.slice(p.length);continue}let o=a.match(/^<\/(@?[\w-]+)>/);if(o){let[p,l]=o,g=l.startsWith("@craft-")?l:l.toLowerCase();while(r.length>1){let u=r.pop();if(n=r[r.length-1],u.tag===g)break}a=a.slice(p.length);continue}let c=a.match(/^[^<]+/);if(c){let p=c[0];if(p.trim()){let l={type:"text",text:p,isStatic:!v(p)};n.children=n.children||[],n.children.push(l)}a=a.slice(p.length);continue}a=a.slice(1)}return e}function z(t){let e={},n=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,r;while((r=n.exec(t))!==null){let[,a,i,s,o]=r,c=i??s??o??!0;e[a]=c}return e}function y(t,e,n=[]){if(e(t,n),t.children)t.children.forEach((r,a)=>{y(r,e,[...n,`${a}`])})}function h(t,e){switch(t.type){case"text":return x(t.text||"",e);case"element":case"component":{let n=t.tag||"div",r=N(t.props||{},e),a=(t.children||[]).map((i)=>h(i,e)).join("");if(!t.children||t.children.length===0){if(["input","br","hr","img","meta","link"].includes(n))return`<${n}${r} />`}return`<${n}${r}>${a}</${n}>`}case"fragment":return(t.children||[]).map((n)=>h(n,e)).join("");case"slot":return`<!--slot:${t.slotName||"default"}-->`;default:return""}}function b(t){if(t.type==="text")return t.text||"";let e=t.tag||"div",n=N(t.props||{},{});return`<${e}${n}></${e}>`}function N(t,e){let n=[];for(let[r,a]of Object.entries(t))if(a===!0)n.push(` ${r}`);else if(a!==!1&&a!==null&&a!==void 0){let i=x(String(a),e);n.push(` ${r}="${k(i)}"`)}return n.join("")}async function H(t,e){return h(t,e)}function P(t,e){let n=[];return y(t.tree,(r)=>{if(r.isStatic)n.push(h(r,e))}),n.join("")}function j(t,e,n){let r={templateId:e.id,context:n,dynamicParts:Array.from(e.dynamicParts.entries())},a=`
|
|
7
7
|
<script data-craft-hydration>
|
|
8
8
|
window.__CRAFT_HYDRATION__ = ${JSON.stringify(r)};
|
|
9
|
-
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{
|
|
9
|
+
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{Tu as CRAFT_BRIDGE_SCRIPT,Ao as CRAFT_COMPONENTS,Ma as CRAFT_COMPONENT_RUNTIME,os as CRAFT_COMPONENT_STYLES,Ro as NATIVE_COMPONENTS,La as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Pa as compileToNative,Ia as createHotReloadServer,ja as findCraftBinary,Oa as generateCraftBridgeScript,V as generateCraftOptimizations,Fa as getAvailableFormats,Ba as getAvailableTargets,jh as getCraftComponents,G as getSSRCacheStats,Na as injectCraftBridge,Mh as isCraftEnvironment,Y as prerenderForCraft,Da as processCraftComponents,Dh as processCraftDirective,Lh as registerCraftComponent,Q as renderSSR};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { insertBeforeHeadClose } from "../document-tags.js";
|
|
1
2
|
import { serve } from "bun";
|
|
2
3
|
import fs from "node:fs";
|
|
3
4
|
import path from "node:path";
|
|
@@ -361,7 +362,7 @@ export async function serveApp(appDir = ".", options = {}) {
|
|
|
361
362
|
const injectRouteParams = (content, params) => {
|
|
362
363
|
const paramsScript = `<script data-stx-route-params>(function(){var p=${JSON.stringify(params).replace(/</g, "\\u003C").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;
|
|
363
364
|
if (content.includes("</head>"))
|
|
364
|
-
return content
|
|
365
|
+
return insertBeforeHeadClose(content, paramsScript, "");
|
|
365
366
|
if (content.includes("<body"))
|
|
366
367
|
return content.replace(/<body([^>]*)>/, `<body$1>${paramsScript}`);
|
|
367
368
|
return paramsScript + content;
|
|
@@ -478,7 +479,7 @@ export async function serveApp(appDir = ".", options = {}) {
|
|
|
478
479
|
}
|
|
479
480
|
if (Object.keys(middlewareResult.state).length > 0) {
|
|
480
481
|
const stateScript = `<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(middlewareResult.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;
|
|
481
|
-
builtPage.content = builtPage.content
|
|
482
|
+
builtPage.content = insertBeforeHeadClose(builtPage.content, stateScript, "");
|
|
482
483
|
}
|
|
483
484
|
}
|
|
484
485
|
let content = builtPage.content;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { insertBeforeHeadClose } from "../document-tags.js";
|
|
1
2
|
import { serve } from "bun";
|
|
2
3
|
import fs from "node:fs";
|
|
3
4
|
import path from "node:path";
|
|
@@ -411,8 +412,7 @@ export async function serveMultipleStxFiles(filePaths, options = {}) {
|
|
|
411
412
|
let content = templateRoute.content;
|
|
412
413
|
const paramScript = `<script>window.__routeParams = ${JSON.stringify(params)};</script>`;
|
|
413
414
|
if (content.includes("</head>"))
|
|
414
|
-
content = content
|
|
415
|
-
</head>`);
|
|
415
|
+
content = insertBeforeHeadClose(content, paramScript);
|
|
416
416
|
else
|
|
417
417
|
content = paramScript + content;
|
|
418
418
|
routeMatched = { ...templateRoute, content };
|
|
@@ -423,8 +423,7 @@ export async function serveMultipleStxFiles(filePaths, options = {}) {
|
|
|
423
423
|
if (routeMatched)
|
|
424
424
|
return injectCss(routeMatched.content).then((content) => {
|
|
425
425
|
if (content.includes("</head>"))
|
|
426
|
-
content = content
|
|
427
|
-
</head>`);
|
|
426
|
+
content = insertBeforeHeadClose(content, stxClientHelpers);
|
|
428
427
|
return new Response(content, {
|
|
429
428
|
headers: {
|
|
430
429
|
"Content-Type": "text/html",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { headCloseIndex, insertBeforeHeadClose } from "../document-tags.js";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { hasLocalConfig } from "bunfig";
|
|
@@ -436,8 +437,7 @@ ${css}
|
|
|
436
437
|
});
|
|
437
438
|
}
|
|
438
439
|
if (htmlContent.includes("</head>"))
|
|
439
|
-
return htmlContent
|
|
440
|
-
</head>`);
|
|
440
|
+
return insertBeforeHeadClose(htmlContent, assetTag);
|
|
441
441
|
if (htmlContent.includes("<body"))
|
|
442
442
|
return htmlContent.replace(/<body([^>]*)>/, `<body$1>
|
|
443
443
|
${assetTag}`);
|
|
@@ -458,7 +458,7 @@ function injectCssAndDedupeScopedStyles(html, assetTag) {
|
|
|
458
458
|
existingMatch = existing.exec(html);
|
|
459
459
|
}
|
|
460
460
|
} else {
|
|
461
|
-
const headClose = html
|
|
461
|
+
const headClose = headCloseIndex(html);
|
|
462
462
|
if (headClose !== -1)
|
|
463
463
|
edits.push({ start: headClose, end: headClose, replacement: `${assetTag}
|
|
464
464
|
` });
|
|
@@ -501,8 +501,7 @@ function injectCssIntoHtml(htmlContent, assetTag) {
|
|
|
501
501
|
});
|
|
502
502
|
}
|
|
503
503
|
if (htmlContent.includes("</head>"))
|
|
504
|
-
return htmlContent
|
|
505
|
-
</head>`);
|
|
504
|
+
return insertBeforeHeadClose(htmlContent, assetTag);
|
|
506
505
|
if (htmlContent.includes("<body"))
|
|
507
506
|
return htmlContent.replace(/<body([^>]*)>/, `<body$1>
|
|
508
507
|
${assetTag}`);
|
package/dist/document-shell.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { headCloseIndex } from "./document-tags.js";
|
|
1
2
|
import { generateColorModeBootScript } from "./color-mode-boot.js";
|
|
2
3
|
export const COMPONENT_WRAPPER_RULE = "[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}", CLOAK_STYLE = `<style data-stx-cloak>[x-cloak]{display:none !important}${COMPONENT_WRAPPER_RULE}</style>`, HTML_ATTRS_MARKER = "data-stx-html-attrs", HTML_CLASS_MARKER = "data-stx-html-class";
|
|
3
4
|
const SAFE_ATTR_NAME = /^[A-Za-z_:][\w:.-]*$/;
|
|
@@ -137,13 +138,13 @@ export function injectCloakStyle(html) {
|
|
|
137
138
|
const fragment = cloakStyleFragment(html);
|
|
138
139
|
if (fragment === null)
|
|
139
140
|
return html;
|
|
140
|
-
const headCloseIdx = html
|
|
141
|
+
const headCloseIdx = headCloseIndex(html);
|
|
141
142
|
return `${html.slice(0, headCloseIdx)}${fragment}${html.slice(headCloseIdx)}`;
|
|
142
143
|
}
|
|
143
144
|
export function cloakStyleFragment(html) {
|
|
144
145
|
if (html.includes("data-stx-cloak"))
|
|
145
146
|
return null;
|
|
146
|
-
if (html
|
|
147
|
+
if (headCloseIndex(html) === -1)
|
|
147
148
|
return null;
|
|
148
149
|
return `${CLOAK_STYLE}
|
|
149
150
|
`;
|
|
@@ -318,7 +319,7 @@ export function hasDocumentShell(html) {
|
|
|
318
319
|
return startsDocument(html);
|
|
319
320
|
}
|
|
320
321
|
export function injectConfigHeadTags(html, headConfig = {}) {
|
|
321
|
-
const headCloseIdx = html
|
|
322
|
+
const headCloseIdx = headCloseIndex(html);
|
|
322
323
|
if (headCloseIdx === -1)
|
|
323
324
|
return html;
|
|
324
325
|
const { meta = [], link = [], script = [], headRaw = "" } = headConfig, head = html.slice(0, headCloseIdx), parts = [];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The index of the document's `</head>`, or -1. */
|
|
2
|
+
export declare function headCloseIndex(html: string): number;
|
|
3
|
+
/** The index of the document's `</body>`, or -1. */
|
|
4
|
+
export declare function bodyCloseIndex(html: string): number;
|
|
5
|
+
/** Put markup just before the document's `</head>`. Unchanged when there is none. */
|
|
6
|
+
export declare function insertBeforeHeadClose(html: string, markup: string, separator?: string): string;
|
|
7
|
+
/** Put markup just before the document's `</body>`, or on the end when there is none. */
|
|
8
|
+
export declare function insertBeforeBodyClose(html: string, markup: string, separator?: string): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const RAW_TEXT_OR_TAG = /<!--[\s\S]*?-->|<(script|style|textarea|title)\b[^>]*>[\s\S]*?<\/\1\s*>|<\/(head|body)\s*>/gi;
|
|
2
|
+
function closeTagIndex(html, tag, which) {
|
|
3
|
+
if (!html.includes(`</${tag}`) && !html.includes(`</${tag.toUpperCase()}`))
|
|
4
|
+
return -1;
|
|
5
|
+
let found = -1;
|
|
6
|
+
RAW_TEXT_OR_TAG.lastIndex = 0;
|
|
7
|
+
for (let match = RAW_TEXT_OR_TAG.exec(html);match; match = RAW_TEXT_OR_TAG.exec(html)) {
|
|
8
|
+
if (match[2]?.toLowerCase() !== tag)
|
|
9
|
+
continue;
|
|
10
|
+
found = match.index;
|
|
11
|
+
if (which === "first")
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
RAW_TEXT_OR_TAG.lastIndex = 0;
|
|
15
|
+
return found;
|
|
16
|
+
}
|
|
17
|
+
export function headCloseIndex(html) {
|
|
18
|
+
return closeTagIndex(html, "head", "first");
|
|
19
|
+
}
|
|
20
|
+
export function bodyCloseIndex(html) {
|
|
21
|
+
return closeTagIndex(html, "body", "last");
|
|
22
|
+
}
|
|
23
|
+
export function insertBeforeHeadClose(html, markup, separator = `
|
|
24
|
+
`) {
|
|
25
|
+
const at = headCloseIndex(html);
|
|
26
|
+
if (at === -1)
|
|
27
|
+
return html;
|
|
28
|
+
return `${html.slice(0, at)}${markup}${separator}${html.slice(at)}`;
|
|
29
|
+
}
|
|
30
|
+
export function insertBeforeBodyClose(html, markup, separator = `
|
|
31
|
+
`) {
|
|
32
|
+
const at = bodyCloseIndex(html);
|
|
33
|
+
if (at === -1)
|
|
34
|
+
return `${html}
|
|
35
|
+
${markup}`;
|
|
36
|
+
return `${html.slice(0, at)}${markup}${separator}${html.slice(at)}`;
|
|
37
|
+
}
|
package/dist/events.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { bodyCloseIndex } from "./document-tags.js";
|
|
1
2
|
import { templateHasReactiveContext } from "./runtime-globals.js";
|
|
2
3
|
export const SCROLL_BLOCKING_EVENTS = new Set(["touchstart", "touchmove", "wheel", "mousewheel"]);
|
|
3
4
|
export function listensPassively(event, modifiers) {
|
|
@@ -398,7 +399,7 @@ export function processEventDirectives(template, context, _filePath) {
|
|
|
398
399
|
}
|
|
399
400
|
output = output.slice(0, element.startIndex) + newTag + output.slice(element.endIndex);
|
|
400
401
|
}
|
|
401
|
-
const script = generateRuntimeScript(elements.flatMap((el) => el.events)), bodyIdx = output
|
|
402
|
+
const script = generateRuntimeScript(elements.flatMap((el) => el.events)), bodyIdx = bodyCloseIndex(output);
|
|
402
403
|
if (bodyIdx !== -1)
|
|
403
404
|
output = output.slice(0, bodyIdx) + script + `
|
|
404
405
|
` + output.slice(bodyIdx);
|
package/dist/head-injection.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { headCloseIndex } from "./document-tags.js";
|
|
1
2
|
export function createHeadInjections() {
|
|
2
3
|
return { afterOpen: [], beforeClose: [] };
|
|
3
4
|
}
|
|
@@ -7,7 +8,7 @@ export function hasHeadInjections(injections) {
|
|
|
7
8
|
export function applyHeadInjections(html, injections) {
|
|
8
9
|
if (!hasHeadInjections(injections))
|
|
9
10
|
return html;
|
|
10
|
-
const afterOpen = injections.afterOpen.join(""), beforeClose = injections.beforeClose.join(""), headCloseIdx = html
|
|
11
|
+
const afterOpen = injections.afterOpen.join(""), beforeClose = injections.beforeClose.join(""), headCloseIdx = headCloseIndex(html), openAt = afterOpen ? headInsertionPoint(html) : null, closeAt = beforeClose && headCloseIdx !== -1 ? headCloseIdx : null;
|
|
11
12
|
if (openAt === null && closeAt === null)
|
|
12
13
|
return html;
|
|
13
14
|
if (openAt !== null && closeAt !== null)
|
package/dist/heatmap.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { bodyCloseIndex } from "./document-tags.js";
|
|
1
2
|
export const defaultHeatmapConfig = {
|
|
2
3
|
enabled: !1,
|
|
3
4
|
trackMouse: !0,
|
|
@@ -426,7 +427,7 @@ export function injectHeatmap(html, options) {
|
|
|
426
427
|
const heatmapScript = generateHeatmapScript(options);
|
|
427
428
|
if (!heatmapScript)
|
|
428
429
|
return html;
|
|
429
|
-
const hmBodyIdx = html
|
|
430
|
+
const hmBodyIdx = bodyCloseIndex(html);
|
|
430
431
|
if (hmBodyIdx !== -1)
|
|
431
432
|
return html.slice(0, hmBodyIdx) + heatmapScript + html.slice(hmBodyIdx);
|
|
432
433
|
return html + heatmapScript;
|
package/dist/hot-reload.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { bodyCloseIndex } from "./document-tags.js";
|
|
2
|
+
|
|
1
3
|
export class HotReloadServer {
|
|
2
4
|
clients = new Set;
|
|
3
5
|
server = null;
|
|
@@ -333,7 +335,7 @@ else {
|
|
|
333
335
|
`;
|
|
334
336
|
}
|
|
335
337
|
export function injectHotReload(html, wsPort, options = {}) {
|
|
336
|
-
const script = generateHotReloadScript(wsPort, options), bodyIdx = html
|
|
338
|
+
const script = generateHotReloadScript(wsPort, options), bodyIdx = bodyCloseIndex(html);
|
|
337
339
|
if (bodyIdx !== -1)
|
|
338
340
|
return html.slice(0, bodyIdx) + script + html.slice(bodyIdx);
|
|
339
341
|
if (html.includes("</html>"))
|
package/dist/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ declare const __dtsx_default_export__: {};
|
|
|
25
25
|
// ============================================================
|
|
26
26
|
// Explicit re-exports to resolve wildcard ambiguities
|
|
27
27
|
export { type BuildResult } from './build-optimizer.js';
|
|
28
|
-
export { insertBeforeBodyClose } from './
|
|
28
|
+
export { bodyCloseIndex, headCloseIndex, insertBeforeBodyClose, insertBeforeHeadClose } from './document-tags.js';
|
|
29
29
|
export { useServerData } from './server-data.js';
|
|
30
30
|
export { useRuntimeConfig, useServerRuntimeConfig } from './runtime-config-server.js';
|
|
31
31
|
export { useSearchParams, type SearchParamsRef, type SearchParamsCommitOptions } from './composables/use-router.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { insertBeforeBodyClose } from "./
|
|
1
|
+
export { bodyCloseIndex, headCloseIndex, insertBeforeBodyClose, insertBeforeHeadClose } from "./document-tags.js";
|
|
2
2
|
export { useServerData } from "./server-data.js";
|
|
3
3
|
export { useRuntimeConfig, useServerRuntimeConfig } from "./runtime-config-server.js";
|
|
4
4
|
export { useSearchParams } from "./composables/use-router.js";
|
package/dist/native-build.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
var {require}=import.meta;import {
|
|
1
|
+
var {require}=import.meta;import { insertBeforeHeadClose } from "./document-tags.js";
|
|
2
|
+
import { existsSync, mkdirSync, copyFileSync, chmodSync, rmSync } from "node:fs";
|
|
2
3
|
import { join, dirname, basename, resolve } from "node:path";
|
|
3
4
|
import { spawn } from "node:child_process";
|
|
4
5
|
import { platform as osPlatform } from "node:os";
|
|
@@ -40,8 +41,7 @@ export async function buildNative(config) {
|
|
|
40
41
|
html = processCraftComponents(html);
|
|
41
42
|
if (!html.includes("craft-component-styles")) {
|
|
42
43
|
if (html.includes("</head>"))
|
|
43
|
-
html = html
|
|
44
|
-
</head>`);
|
|
44
|
+
html = insertBeforeHeadClose(html, CRAFT_COMPONENT_STYLES);
|
|
45
45
|
}
|
|
46
46
|
const appName = config.name || basename(config.input, ".stx"), appVersion = config.version || "1.0.0";
|
|
47
47
|
let craftPath = config.craftPath || findCraftBinary(config.runtimeProfile);
|
package/dist/process.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { bodyCloseIndex, headCloseIndex, insertBeforeHeadClose } from "./document-tags.js";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { injectCss } from "./dev-server/ts-css.js";
|
|
@@ -965,8 +966,7 @@ async function processOtherDirectives(template, context, filePath, options, depe
|
|
|
965
966
|
return html;
|
|
966
967
|
}
|
|
967
968
|
if (/<\/head>/i.test(html))
|
|
968
|
-
return html
|
|
969
|
-
</head>`);
|
|
969
|
+
return insertBeforeHeadClose(html, snippet);
|
|
970
970
|
if (/<head\b[^>]*>/i.test(html))
|
|
971
971
|
return html.replace(/(<head\b[^>]*>)/i, `$1
|
|
972
972
|
${snippet}`);
|
|
@@ -1000,14 +1000,13 @@ ${snippet}
|
|
|
1000
1000
|
${generateLifecycleRuntime()}
|
|
1001
1001
|
</script>`;
|
|
1002
1002
|
if (output.includes("</head>")) {
|
|
1003
|
-
const headEndPos = output
|
|
1003
|
+
const headEndPos = headCloseIndex(output), firstScriptPos = output.slice(0, headEndPos).indexOf("<script");
|
|
1004
1004
|
if (firstScriptPos !== -1) {
|
|
1005
1005
|
const before = output.slice(0, firstScriptPos), after = output.slice(firstScriptPos);
|
|
1006
1006
|
output = before + runtimeScript + `
|
|
1007
1007
|
` + after;
|
|
1008
1008
|
} else
|
|
1009
|
-
output = output
|
|
1010
|
-
</head>`);
|
|
1009
|
+
output = insertBeforeHeadClose(output, runtimeScript);
|
|
1011
1010
|
} else if (output.includes("<body"))
|
|
1012
1011
|
output = output.replace(/<body([^>]*)>/, `<body$1>
|
|
1013
1012
|
${runtimeScript}`);
|
|
@@ -1064,7 +1063,7 @@ ${runtimeScript}`);
|
|
|
1064
1063
|
if (orphaned.length > 0) {
|
|
1065
1064
|
const script = generateRuntimeScript(orphaned);
|
|
1066
1065
|
if (script) {
|
|
1067
|
-
const bodyIdx = output
|
|
1066
|
+
const bodyIdx = bodyCloseIndex(output);
|
|
1068
1067
|
output = bodyIdx === -1 ? output + script : output.slice(0, bodyIdx) + script + `
|
|
1069
1068
|
` + output.slice(bodyIdx);
|
|
1070
1069
|
}
|
package/dist/production-build.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { bodyCloseIndex, insertBeforeHeadClose } from "./document-tags.js";
|
|
1
2
|
import { createHash } from "node:crypto";
|
|
2
3
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, readdirSync, statSync } from "node:fs";
|
|
3
4
|
import { basename, dirname, extname, join, relative, resolve } from "node:path";
|
|
@@ -193,7 +194,7 @@ ${externalContent}`);
|
|
|
193
194
|
hash: scriptHash,
|
|
194
195
|
sources: [filePath]
|
|
195
196
|
});
|
|
196
|
-
const pbBodyIdx = output
|
|
197
|
+
const pbBodyIdx = bodyCloseIndex(output);
|
|
197
198
|
if (pbBodyIdx !== -1)
|
|
198
199
|
output = output.slice(0, pbBodyIdx) + `<script src="${this.config.publicPath}${scriptFile}"></script>
|
|
199
200
|
` + output.slice(pbBodyIdx);
|
|
@@ -211,8 +212,7 @@ ${externalContent}`);
|
|
|
211
212
|
hash: styleHash,
|
|
212
213
|
sources: [filePath]
|
|
213
214
|
});
|
|
214
|
-
output = output
|
|
215
|
-
</head>`);
|
|
215
|
+
output = insertBeforeHeadClose(output, `<link rel="stylesheet" href="${this.config.publicPath}${styleFile}">`);
|
|
216
216
|
}
|
|
217
217
|
return output;
|
|
218
218
|
}
|
package/dist/pwa/inject.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { bodyCloseIndex, insertBeforeHeadClose } from "../document-tags.js";
|
|
1
2
|
import { getServiceWorkerFileName } from "./service-worker.js";
|
|
2
3
|
export function generatePwaTags(options) {
|
|
3
4
|
const pwa = options.pwa;
|
|
@@ -62,7 +63,7 @@ export function injectPwaTags(html, options) {
|
|
|
62
63
|
if (html.includes("<!-- stx PWA Meta Tags -->"))
|
|
63
64
|
return html;
|
|
64
65
|
if (!html.includes("</head>")) {
|
|
65
|
-
const pwaBodyIdx = html
|
|
66
|
+
const pwaBodyIdx = bodyCloseIndex(html);
|
|
66
67
|
if (pwaBodyIdx !== -1) {
|
|
67
68
|
const pwaTags = generatePwaTags(options);
|
|
68
69
|
return html.slice(0, pwaBodyIdx) + pwaTags + `
|
|
@@ -71,8 +72,7 @@ export function injectPwaTags(html, options) {
|
|
|
71
72
|
return html + generatePwaTags(options);
|
|
72
73
|
}
|
|
73
74
|
const pwaTags = generatePwaTags(options);
|
|
74
|
-
return html
|
|
75
|
-
</head>`);
|
|
75
|
+
return insertBeforeHeadClose(html, pwaTags);
|
|
76
76
|
}
|
|
77
77
|
export function generateSwRegistrationScript(options) {
|
|
78
78
|
if (!options.pwa?.enabled)
|
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-
|
|
2
|
+
import{ao,Gt,Dl,Vg}from"./chunk-qbghf76y.js";import{io,Hi,Fg,zg,Hg}from"./chunk-bx5d87xx.js";import{Ol,Nl,Ml,jg,Bg}from"./chunk-dpmayc2w.js";import{Xe,Nn,Vi}from"./chunk-mrh08821.js";import{Ug,Wg,qg,Kg,co,Py}from"./chunk-srgnevws.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
|
|
3
|
+
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-6fstz73t.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),e.success=!1,
|
|
|
233
233
|
}, 5000);
|
|
234
234
|
</script>
|
|
235
235
|
</body>
|
|
236
|
-
</html>`}function b(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=
|
|
236
|
+
</html>`}function b(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=Xe(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=ao(n,t);if(a){let s=Gt(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Hi(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,Nl as auditBuildOutput,Ol as auditConfig,re as buildPwaAssets,Ml as calculateAuditResult,Bg as formatAuditResult,Vi as formatSize,j as generateManifest,_ as generateManifestJson,zg as generateManifestLink,F as generateOfflinePage,Xe as generatePrecacheManifest,Nn as generatePrecacheManifestJs,M as generatePwaIcons,io as generatePwaTags,ao as generateServiceWorker,Vg as generateServiceWorkerAuto,Fg as generateSwRegistrationScript,Hg as generateThemeColorMeta,N as getExpectedIconPaths,Gt as getServiceWorkerFileName,Hi as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,Dl as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,co as pwaDirectives,Ug as pwaInstallDirective,qg as pwaOfflineDirective,Kg as pwaPushDirective,Wg as pwaUpdateDirective,Py as registerPwaDirectives,jg as runPwaAudit,D as validateManifest};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { bodyCloseIndex } from "./document-tags.js";
|
|
1
2
|
import * as crypto from "node:crypto";
|
|
2
3
|
function extractStoreRefs(expression) {
|
|
3
4
|
const storePattern = /\$(\w+)\./g, stores = [];
|
|
@@ -263,7 +264,7 @@ export function processTemplateBindings(html) {
|
|
|
263
264
|
const { html: processedHtml, bindings, stores } = processReactiveBindings(html);
|
|
264
265
|
if (bindings.length === 0)
|
|
265
266
|
return html;
|
|
266
|
-
const runtime = generateBindingsRuntime(bindings, stores), bodyIdx = processedHtml
|
|
267
|
+
const runtime = generateBindingsRuntime(bindings, stores), bodyIdx = bodyCloseIndex(processedHtml);
|
|
267
268
|
if (bodyIdx !== -1)
|
|
268
269
|
return processedHtml.slice(0, bodyIdx) + runtime + processedHtml.slice(bodyIdx);
|
|
269
270
|
return processedHtml + runtime;
|
package/dist/reactive.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { bodyCloseIndex } from "./document-tags.js";
|
|
1
2
|
import { evaluateExpression } from "./expressions.js";
|
|
2
3
|
import { scanAtElementPosition } from "./html-masking.js";
|
|
3
4
|
let scopeCounter = 0, elementCounter = 0;
|
|
@@ -610,7 +611,7 @@ export function processReactiveDirectives(template, context, _filePath, deferIni
|
|
|
610
611
|
if (scopes.length === 0)
|
|
611
612
|
return template;
|
|
612
613
|
let output = finalizeTemplate(template, scopes);
|
|
613
|
-
const script = generateScopeInitializers(scopes, context, deferInit), bodyCloseIdx = output
|
|
614
|
+
const script = generateScopeInitializers(scopes, context, deferInit), bodyCloseIdx = bodyCloseIndex(output);
|
|
614
615
|
if (bodyCloseIdx !== -1)
|
|
615
616
|
output = output.slice(0, bodyCloseIdx) + script + `
|
|
616
617
|
` + output.slice(bodyCloseIdx);
|
package/dist/render.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { insertBeforeBodyClose } from "./
|
|
1
|
+
import { insertBeforeBodyClose } from "./document-tags.js";
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
3
|
import { defaultConfig } from "./config.js";
|
|
4
4
|
import { extractVariables } from "./variable-extractor.js";
|