@stacksjs/stx 0.2.412 → 0.2.414
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/appearance-bootstrap.js +1 -1
- package/dist/binding-manifest.d.ts +1 -1
- package/dist/builtins/image-delivery.d.ts +38 -0
- package/dist/builtins/image-delivery.js +17 -0
- package/dist/builtins/stx-image.js +1 -5
- package/dist/bundle-analyzer.js +20 -20
- package/dist/chunk-020xyn9q.js +3 -0
- package/dist/chunk-04jhmfbz.js +2 -0
- package/dist/chunk-10957mcb.js +2 -0
- package/dist/chunk-1098mas0.js +2 -0
- package/dist/chunk-169n1vpx.js +12 -0
- package/dist/chunk-1b6t12hd.js +2 -0
- package/dist/chunk-1chw8xsw.js +2 -0
- package/dist/chunk-1xdzcy9d.js +14 -0
- package/dist/chunk-2ce7f416.js +2 -0
- package/dist/chunk-2gr351s0.js +7 -0
- package/dist/chunk-2mkcjw08.js +2 -0
- package/dist/chunk-2v8wztd5.js +2 -0
- package/dist/chunk-340a824p.js +2 -0
- package/dist/chunk-39g1134q.js +2 -0
- package/dist/chunk-3c74vag1.js +2 -0
- package/dist/chunk-3kthfs03.js +3 -0
- package/dist/chunk-3qn1wcdg.js +2 -0
- package/dist/chunk-3s2vnqcf.js +2 -0
- package/dist/chunk-48bwk47q.js +2 -0
- package/dist/chunk-4bjravgk.js +2 -0
- package/dist/chunk-4jjme6a5.js +2 -0
- package/dist/chunk-5g3y8kym.js +2 -0
- package/dist/chunk-5gsxpaqk.js +2 -0
- package/dist/{chunk-bwsxym3d.js → chunk-5qns2sdz.js} +17 -17
- package/dist/chunk-69mc2np8.js +2785 -0
- package/dist/chunk-6cfa3g0r.js +2 -0
- package/dist/{chunk-bjar18jd.js → chunk-6h38kkjf.js} +46 -52
- package/dist/chunk-6hc5vz20.js +3 -0
- package/dist/chunk-6q6g76vg.js +499 -0
- package/dist/{chunk-dbc5awz9.js → chunk-6sgswrqw.js} +29 -29
- package/dist/chunk-6y8hnymb.js +2 -0
- package/dist/chunk-74j18qk0.js +930 -0
- package/dist/chunk-752hw7cd.js +4 -0
- package/dist/{chunk-t5ja7qkn.js → chunk-765e1s44.js} +11 -76
- package/dist/chunk-7gkv67ky.js +4 -0
- package/dist/chunk-7z2ra0yf.js +2 -0
- package/dist/chunk-866n724v.js +2 -0
- package/dist/chunk-8nhshfz6.js +5 -0
- package/dist/chunk-92ps1xpk.js +2 -0
- package/dist/chunk-9g27ybyr.js +3 -0
- package/dist/{chunk-xq1acw1r.js → chunk-9pt8fd2n.js} +13 -13
- package/dist/{chunk-qvnbnsv9.js → chunk-9vrja6vp.js} +4 -4
- package/dist/chunk-9xrbve19.js +2 -0
- package/dist/chunk-a688m6js.js +3 -0
- package/dist/chunk-afhxw2t8.js +2 -0
- package/dist/chunk-ak1cgcah.js +5 -0
- package/dist/{chunk-4m7ajama.js → chunk-amd6ey3t.js} +14 -14
- package/dist/chunk-apg16xcn.js +2 -0
- package/dist/chunk-b52s5z0c.js +2 -0
- package/dist/chunk-b84h16er.js +61 -0
- package/dist/{chunk-hx998w7n.js → chunk-bay9s6rs.js} +13 -13
- package/dist/chunk-bmt7w2pk.js +2 -0
- package/dist/chunk-btmhj5t7.js +2 -0
- package/dist/chunk-ce1sejr3.js +3 -0
- package/dist/chunk-cg8hg6cs.js +3 -0
- package/dist/{chunk-8wp64mym.js → chunk-czxt605c.js} +4 -5
- package/dist/chunk-d44b9ktb.js +4 -0
- package/dist/chunk-daz5aqcf.js +24 -0
- package/dist/chunk-dgdm3hy3.js +2 -0
- package/dist/chunk-dvgv8nry.js +11 -0
- package/dist/chunk-dx7n22ed.js +2 -0
- package/dist/chunk-e57rhf65.js +3 -0
- package/dist/chunk-eed4fwps.js +3 -0
- package/dist/chunk-ej9j6k1q.js +3 -0
- package/dist/chunk-et0rr8c7.js +3 -0
- package/dist/chunk-f46qsp4m.js +4 -0
- package/dist/chunk-f6az0xj5.js +2 -0
- package/dist/{chunk-bjcsc6wx.js → chunk-fh1qrp68.js} +21 -21
- package/dist/chunk-fjs0a8h7.js +2 -0
- package/dist/chunk-fr2txj8q.js +829 -0
- package/dist/{chunk-vx86cf4r.js → chunk-ft4p6d28.js} +14 -14
- package/dist/chunk-fyzajkrx.js +2 -0
- package/dist/chunk-fzapbw9p.js +3 -0
- package/dist/chunk-g578mcb0.js +194 -0
- package/dist/chunk-gawrg4gb.js +216 -0
- package/dist/chunk-gw07qmjk.js +2 -0
- package/dist/chunk-h0atqq82.js +32 -0
- package/dist/chunk-h6zsqb9r.js +3 -0
- package/dist/{chunk-hdysywd8.js → chunk-h85hrwkq.js} +13 -13
- package/dist/chunk-hbxz85wy.js +2 -0
- package/dist/chunk-hjg3ndgh.js +2 -0
- package/dist/chunk-hkxsewzk.js +2 -0
- package/dist/chunk-hrbbbtbn.js +2 -0
- package/dist/chunk-j03revz2.js +8 -0
- package/dist/chunk-j9qcrwbg.js +2 -0
- package/dist/chunk-jk4njz0w.js +2 -0
- package/dist/chunk-jmabeqfq.js +2 -0
- package/dist/chunk-jt0n43mk.js +2 -0
- package/dist/chunk-kjbv8a3m.js +2 -0
- package/dist/chunk-m1vdghnx.js +2 -0
- package/dist/chunk-m4sk62wb.js +5 -0
- package/dist/chunk-md8rqn48.js +30 -0
- package/dist/chunk-mepdnezf.js +17 -0
- package/dist/chunk-mhq0pjws.js +2 -0
- package/dist/chunk-mp6hy8g4.js +2 -0
- package/dist/chunk-ngc2wke4.js +3 -0
- package/dist/chunk-nn2vstke.js +2 -0
- package/dist/chunk-p2v2a68k.js +2 -0
- package/dist/{chunk-qn5srnj3.js → chunk-pbh4smw3.js} +16 -16
- package/dist/chunk-pdt69hpb.js +2 -0
- package/dist/chunk-pgzvyrv6.js +29 -0
- package/dist/chunk-pj1wg7jg.js +2 -0
- package/dist/chunk-pqxzp1bb.js +3 -0
- package/dist/chunk-px7fvbj6.js +3 -0
- package/dist/chunk-q4c06e8x.js +20 -0
- package/dist/chunk-q6vrb2pe.js +2 -0
- package/dist/chunk-q7qchkvk.js +2 -0
- package/dist/chunk-q9bdh4s5.js +8 -0
- package/dist/chunk-qet5gc6s.js +2033 -0
- package/dist/chunk-qz519eyp.js +2 -0
- package/dist/chunk-r3f9jcf7.js +5 -0
- package/dist/chunk-rs4v4fha.js +4 -0
- package/dist/chunk-s2x4wcrz.js +2 -0
- package/dist/chunk-s5xezjps.js +3 -0
- package/dist/chunk-scezfp0w.js +30 -0
- package/dist/chunk-sd321bn3.js +2 -0
- package/dist/{chunk-eenk6s3t.js → chunk-sd47dzs0.js} +79 -79
- package/dist/chunk-se7mwqd1.js +2 -0
- package/dist/chunk-shr559s7.js +3 -0
- package/dist/chunk-syaw6b75.js +2 -0
- package/dist/chunk-t4hzprsm.js +3 -0
- package/dist/{chunk-s9za1vvd.js → chunk-t61vdbje.js} +89 -89
- package/dist/chunk-tfexmdkt.js +3 -0
- package/dist/chunk-thyt8ed8.js +6 -0
- package/dist/chunk-v091jft4.js +12 -0
- package/dist/chunk-v4vaqxrf.js +33 -0
- package/dist/chunk-vgvtnwxa.js +4 -0
- package/dist/chunk-x0q32ees.js +3 -0
- package/dist/chunk-x5bpeb4a.js +2 -0
- package/dist/chunk-x72tv2cg.js +3 -0
- package/dist/chunk-xfp7k0v8.js +64 -0
- package/dist/chunk-xtdw3692.js +6 -0
- package/dist/chunk-y1cmjvk3.js +43 -0
- package/dist/chunk-y5310237.js +311 -0
- package/dist/chunk-ya0qecph.js +27 -0
- package/dist/chunk-yazk54jr.js +8 -0
- package/dist/chunk-ydjfar14.js +2 -0
- package/dist/chunk-ym95v4nc.js +3 -0
- package/dist/chunk-ynvdvbat.js +18 -0
- package/dist/chunk-yvx1ap9b.js +3 -0
- package/dist/chunk-z0g9jvv0.js +40 -0
- package/dist/chunk-z6d0jmjb.js +2 -0
- package/dist/{chunk-fpwzacpm.js → chunk-zhxdpzga.js} +4 -4
- package/dist/cli.js +110 -110
- package/dist/craft-entry.js +7 -7
- package/dist/craft.js +7 -7
- package/dist/database.js +2 -2
- package/dist/image-optimization/component.js +4 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/media/image/component.js +5 -5
- package/dist/media/protected/component.js +2 -2
- package/dist/media/video/index.js +4 -4
- package/dist/native/bridge/protocol.d.ts +325 -0
- package/dist/native/bridge/protocol.js +219 -0
- package/dist/native/cli.d.ts +24 -0
- package/dist/native/cli.js +52 -0
- package/dist/native/compiler/bundle.d.ts +41 -0
- package/dist/native/compiler/bundle.js +90 -0
- package/dist/native/compiler/client-script.d.ts +8 -0
- package/dist/native/compiler/client-script.js +31 -0
- package/dist/native/compiler/codegen.d.ts +10 -0
- package/dist/native/compiler/codegen.js +145 -0
- package/dist/native/compiler/headwind-to-style.d.ts +395 -0
- package/dist/native/compiler/headwind-to-style.js +1163 -0
- package/dist/native/compiler/html-to-ir.d.ts +41 -0
- package/dist/native/compiler/html-to-ir.js +411 -0
- package/dist/native/compiler/icons.d.ts +220 -0
- package/dist/native/compiler/icons.js +208 -0
- package/dist/native/compiler/ir.d.ts +234 -0
- package/dist/native/compiler/ir.js +15 -0
- package/dist/native/compiler/parser.d.ts +88 -0
- package/dist/native/compiler/parser.js +753 -0
- package/dist/native/compiler/render-screen.d.ts +26 -0
- package/dist/native/compiler/render-screen.js +31 -0
- package/dist/native/components/primitives.d.ts +291 -0
- package/dist/native/components/primitives.js +22 -0
- package/dist/native/hot-reload/client.d.ts +62 -0
- package/dist/native/hot-reload/client.js +324 -0
- package/dist/native/index.d.ts +90 -0
- package/dist/native/index.js +34 -0
- package/dist/native/primitives/ActivityIndicator.stx +5 -0
- package/dist/native/primitives/Button.stx +5 -0
- package/dist/native/primitives/DatePicker.stx +5 -0
- package/dist/native/primitives/FlatList.stx +5 -0
- package/dist/native/primitives/Image.stx +5 -0
- package/dist/native/primitives/ImageBackground.stx +5 -0
- package/dist/native/primitives/KeyboardAvoidingView.stx +5 -0
- package/dist/native/primitives/Modal.stx +5 -0
- package/dist/native/primitives/Picker.stx +5 -0
- package/dist/native/primitives/Pressable.stx +5 -0
- package/dist/native/primitives/RefreshControl.stx +5 -0
- package/dist/native/primitives/SafeAreaView.stx +5 -0
- package/dist/native/primitives/ScrollView.stx +5 -0
- package/dist/native/primitives/SectionList.stx +5 -0
- package/dist/native/primitives/Slider.stx +5 -0
- package/dist/native/primitives/StatusBar.stx +5 -0
- package/dist/native/primitives/Switch.stx +5 -0
- package/dist/native/primitives/Text.stx +5 -0
- package/dist/native/primitives/TextInput.stx +5 -0
- package/dist/native/primitives/TouchableHighlight.stx +5 -0
- package/dist/native/primitives/TouchableOpacity.stx +5 -0
- package/dist/native/primitives/View.stx +5 -0
- package/dist/native/runtime/craft.d.ts +75 -0
- package/dist/native/runtime/craft.js +0 -0
- package/dist/native/runtime/entry.d.ts +1 -0
- package/dist/native/runtime/entry.js +3 -0
- package/dist/native/runtime/index.d.ts +45 -0
- package/dist/native/runtime/index.js +165 -0
- package/dist/native/runtime/native-host.d.ts +33 -0
- package/dist/native/runtime/native-host.js +184 -0
- package/dist/native/runtime/screen.d.ts +43 -0
- package/dist/native/runtime/screen.js +808 -0
- package/dist/pwa/service-worker.js +1 -1
- package/dist/pwa/workbox.js +1 -1
- package/dist/pwa.js +8 -8
- package/dist/site-url.d.ts +1 -1
- package/dist/ssg.js +53 -53
- package/dist/visual-testing.js +42 -42
- package/dist/web-components/reactive-generator.js +2 -2
- package/package.json +9 -5
- package/dist/chunk-00g9x6w2.js +0 -2
- package/dist/chunk-04tgatyy.js +0 -2
- package/dist/chunk-097jnwd5.js +0 -2
- package/dist/chunk-0btmm4m2.js +0 -147
- package/dist/chunk-0c2h69k2.js +0 -4
- package/dist/chunk-0pkk226n.js +0 -2
- package/dist/chunk-0we9nw1d.js +0 -3
- package/dist/chunk-0y46fbkx.js +0 -3
- package/dist/chunk-18n1ftn0.js +0 -33
- package/dist/chunk-1a0v39k5.js +0 -3
- package/dist/chunk-1fs9jvpb.js +0 -2
- package/dist/chunk-1qq26zt0.js +0 -2
- package/dist/chunk-1te8k8gp.js +0 -3
- package/dist/chunk-1ws3xcea.js +0 -1199
- package/dist/chunk-213jwgpx.js +0 -3
- package/dist/chunk-24w86pek.js +0 -32
- package/dist/chunk-27fgag95.js +0 -4
- package/dist/chunk-2fw05hs2.js +0 -3
- package/dist/chunk-2tbez006.js +0 -2
- package/dist/chunk-38wvkv3s.js +0 -2
- package/dist/chunk-3rkejwjp.js +0 -2
- package/dist/chunk-3t65wb35.js +0 -2
- package/dist/chunk-3w6z6tw9.js +0 -2
- package/dist/chunk-4q1c6fw2.js +0 -7
- package/dist/chunk-50pszj17.js +0 -2
- package/dist/chunk-563shnkz.js +0 -3
- package/dist/chunk-5h104qh1.js +0 -2
- package/dist/chunk-5qjk7drw.js +0 -20
- package/dist/chunk-603x5gb2.js +0 -2
- package/dist/chunk-6kd5jjwc.js +0 -2
- package/dist/chunk-6kdrncsx.js +0 -30
- package/dist/chunk-6zggmce7.js +0 -4422
- package/dist/chunk-72rwcbp6.js +0 -3
- package/dist/chunk-76w34xne.js +0 -3
- package/dist/chunk-7dmgt8at.js +0 -2
- package/dist/chunk-82pd4b5w.js +0 -2
- package/dist/chunk-8d7nf67s.js +0 -2
- package/dist/chunk-8w2mqdnv.js +0 -2
- package/dist/chunk-90b2vt2n.js +0 -2
- package/dist/chunk-9e8t0twa.js +0 -3
- package/dist/chunk-9fqp72ze.js +0 -5
- package/dist/chunk-9xew0kgf.js +0 -2
- package/dist/chunk-a7bnvz91.js +0 -24
- package/dist/chunk-akwd34xt.js +0 -29
- package/dist/chunk-anydpa34.js +0 -3
- package/dist/chunk-aq1xq0r4.js +0 -16
- package/dist/chunk-bbt3tp6f.js +0 -499
- package/dist/chunk-bn1edb1y.js +0 -47
- package/dist/chunk-btd7ds3x.js +0 -2
- package/dist/chunk-c4511wng.js +0 -2
- package/dist/chunk-c4h579e3.js +0 -2
- package/dist/chunk-cj3adc77.js +0 -5
- package/dist/chunk-cs54ek9m.js +0 -6
- package/dist/chunk-ct1jwd4r.js +0 -2
- package/dist/chunk-cxrgxzxc.js +0 -2
- package/dist/chunk-de8t7sc9.js +0 -17
- package/dist/chunk-fcnrgxck.js +0 -2
- package/dist/chunk-fqzcft9d.js +0 -2
- package/dist/chunk-gbmeh7jg.js +0 -3
- package/dist/chunk-gc06g35w.js +0 -2
- package/dist/chunk-gs18069g.js +0 -194
- package/dist/chunk-gvbf1mhs.js +0 -930
- package/dist/chunk-h564hgzt.js +0 -2
- package/dist/chunk-h83jrhfq.js +0 -3
- package/dist/chunk-hj4vpyhp.js +0 -2
- package/dist/chunk-hrkvsj5c.js +0 -11
- package/dist/chunk-hyr4ag1k.js +0 -2
- package/dist/chunk-jxvmf02k.js +0 -2
- package/dist/chunk-k5ptvy0b.js +0 -4
- package/dist/chunk-k80sn8d1.js +0 -2
- package/dist/chunk-k8t2cmyd.js +0 -2
- package/dist/chunk-kmsyvaex.js +0 -8
- package/dist/chunk-kq4b6cwj.js +0 -2
- package/dist/chunk-kvmx7dnb.js +0 -2
- package/dist/chunk-kxc2h5vn.js +0 -5
- package/dist/chunk-mbxehgrq.js +0 -2
- package/dist/chunk-mgnq5de2.js +0 -2
- package/dist/chunk-mgrckqww.js +0 -2
- package/dist/chunk-mq5ewmz6.js +0 -2
- package/dist/chunk-mrahwn5v.js +0 -8
- package/dist/chunk-n2swas11.js +0 -3
- package/dist/chunk-n4299xgy.js +0 -2
- package/dist/chunk-naw4jt7j.js +0 -2
- package/dist/chunk-ny67c03k.js +0 -3
- package/dist/chunk-p4jb9v0w.js +0 -2
- package/dist/chunk-p4zrvt5f.js +0 -14
- package/dist/chunk-p5wp0ce6.js +0 -43
- package/dist/chunk-pcxp4r9n.js +0 -3
- package/dist/chunk-pjrn29gg.js +0 -2
- package/dist/chunk-prxwsp7n.js +0 -2
- package/dist/chunk-py2r6wtv.js +0 -2
- package/dist/chunk-q738pwv6.js +0 -2
- package/dist/chunk-q9n5swx7.js +0 -3
- package/dist/chunk-qmmp5kb5.js +0 -2
- package/dist/chunk-qqpqgwvb.js +0 -30
- package/dist/chunk-rcv2ehpq.js +0 -18
- package/dist/chunk-rq414kn5.js +0 -3
- package/dist/chunk-rz9f3zqz.js +0 -7
- package/dist/chunk-s6g8wksg.js +0 -2
- package/dist/chunk-s8jd13nb.js +0 -3
- package/dist/chunk-spxsw4mp.js +0 -2
- package/dist/chunk-strcy64y.js +0 -2
- package/dist/chunk-t1htzg9e.js +0 -4
- package/dist/chunk-t1tdjjht.js +0 -216
- package/dist/chunk-tat1cjec.js +0 -2
- package/dist/chunk-td08rnk3.js +0 -3
- package/dist/chunk-tgadbsd4.js +0 -2
- package/dist/chunk-tgrpp58r.js +0 -2
- package/dist/chunk-tkyrk66a.js +0 -3
- package/dist/chunk-tp8pzf94.js +0 -3
- package/dist/chunk-twz64kvy.js +0 -2
- package/dist/chunk-v3nwkveg.js +0 -12
- package/dist/chunk-vsbmc9kt.js +0 -2
- package/dist/chunk-vzgzaw66.js +0 -12
- package/dist/chunk-wc66mcn4.js +0 -4367
- package/dist/chunk-wkanrfb3.js +0 -2
- package/dist/chunk-x8f6wqxd.js +0 -2
- package/dist/chunk-xsng1mtq.js +0 -3
- package/dist/chunk-xwts5yky.js +0 -4
- package/dist/chunk-z5rwnnk1.js +0 -3
- package/dist/chunk-zcz9rs6p.js +0 -3
- package/dist/chunk-zpcnbdhn.js +0 -64
- package/dist/chunk-zq4ssxj9.js +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
3
|
-
${
|
|
2
|
+
function r(t,i){let e=i.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
|
|
3
|
+
${t}
|
|
4
4
|
</div>
|
|
5
5
|
<script>
|
|
6
6
|
(function() {
|
|
@@ -44,7 +44,7 @@ function H(j,z){let k=z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
})();
|
|
47
|
-
</script>`}function
|
|
47
|
+
</script>`}function p(t,i){let e=i.pwa?.updates,a=e?.message||"A new version is available. Reload to update?",n=e?.autoReload||!1,s=t.trim().length>0,o=`
|
|
48
48
|
<div class="stx-pwa-update-banner" style="
|
|
49
49
|
position: fixed;
|
|
50
50
|
bottom: 0;
|
|
@@ -62,7 +62,7 @@ function H(j,z){let k=z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="
|
|
|
62
62
|
transform: translateY(100%);
|
|
63
63
|
transition: transform 0.3s ease;
|
|
64
64
|
">
|
|
65
|
-
<span style="font-size: 14px;">${
|
|
65
|
+
<span style="font-size: 14px;">${a}</span>
|
|
66
66
|
<div style="display: flex; gap: 12px;">
|
|
67
67
|
<button data-pwa-dismiss style="
|
|
68
68
|
background: transparent;
|
|
@@ -84,13 +84,13 @@ function H(j,z){let k=z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="
|
|
|
84
84
|
font-size: 14px;
|
|
85
85
|
">Update Now</button>
|
|
86
86
|
</div>
|
|
87
|
-
</div>`;return`${
|
|
87
|
+
</div>`;return`${s?`<div class="stx-pwa-update" style="display:none;">${t}</div>`:o}
|
|
88
88
|
<script>
|
|
89
89
|
(function() {
|
|
90
90
|
const updateContainer = document.querySelector('.stx-pwa-update, .stx-pwa-update-banner');
|
|
91
91
|
const dismissBtn = updateContainer?.querySelector('[data-pwa-dismiss]');
|
|
92
92
|
const reloadBtn = updateContainer?.querySelector('[data-pwa-reload], button');
|
|
93
|
-
const autoReload = ${
|
|
93
|
+
const autoReload = ${n};
|
|
94
94
|
let newWorker = null;
|
|
95
95
|
|
|
96
96
|
function showUpdate() {
|
|
@@ -155,7 +155,7 @@ else {
|
|
|
155
155
|
// Also listen for custom event
|
|
156
156
|
window.addEventListener('pwa-update-available', showUpdate);
|
|
157
157
|
})();
|
|
158
|
-
</script>`}function
|
|
158
|
+
</script>`}function d(t,i){let e=t.trim().length>0,a=`
|
|
159
159
|
<div class="stx-offline-indicator" style="
|
|
160
160
|
position: fixed;
|
|
161
161
|
top: 16px;
|
|
@@ -178,7 +178,7 @@ else {
|
|
|
178
178
|
<circle cx="12" cy="20" r="1"/>
|
|
179
179
|
</svg>
|
|
180
180
|
<span>You are offline</span>
|
|
181
|
-
</div>`;return`${
|
|
181
|
+
</div>`;return`${e?`<div class="stx-offline-indicator" style="display:none;">${t}</div>`:`
|
|
182
182
|
<div class="stx-offline-indicator" style="
|
|
183
183
|
position: fixed;
|
|
184
184
|
top: 16px;
|
|
@@ -216,15 +216,15 @@ else {
|
|
|
216
216
|
window.addEventListener('offline', updateStatus);
|
|
217
217
|
updateStatus();
|
|
218
218
|
})();
|
|
219
|
-
</script>`}function
|
|
220
|
-
${
|
|
219
|
+
</script>`}function l(t,i){let e=i.pwa?.push,a=e?.vapidPublicKey||"",n=e?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
|
|
220
|
+
${t}
|
|
221
221
|
</div>
|
|
222
222
|
<script>
|
|
223
223
|
(function() {
|
|
224
224
|
const pushContainer = document.querySelector('.stx-pwa-push');
|
|
225
225
|
const pushBtn = pushContainer?.querySelector('button, [data-pwa-push]') || pushContainer;
|
|
226
|
-
const vapidKey = '${
|
|
227
|
-
const endpoint = '${
|
|
226
|
+
const vapidKey = '${a}';
|
|
227
|
+
const endpoint = '${n}';
|
|
228
228
|
|
|
229
229
|
async function checkPushSupport() {
|
|
230
230
|
if (!('serviceWorker' in navigator) || !('PushManager' in window)) {
|
|
@@ -298,5 +298,5 @@ catch (error) {
|
|
|
298
298
|
init();
|
|
299
299
|
}
|
|
300
300
|
})();
|
|
301
|
-
</script>`}var
|
|
302
|
-
export{
|
|
301
|
+
</script>`}var jc={name:"pwa.installButton",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return r(t,n)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Bc={name:"pwa.updatePrompt",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return p(t,n)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Fc={name:"pwa.offlineIndicator",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return d(t,n)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},zc={name:"pwa.pushSubscribe",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return l(t,n)},hasEndTag:!0,description:"Renders a push notification subscription button"},dr=[jc,Bc,Fc,zc];function od(t){return[...t,...dr]}
|
|
302
|
+
export{jc,Bc,Fc,zc,dr,od};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{fa,ga,ma,ha,ya,ba,va,wa,xa,Sa,ml}from"./chunk-6h38kkjf.js";export{fa as createIslandRegistry,ml as default,Sa as generateIslandManifest,ma as generatePartialHydrationCSS,ba as hydrateAll,ya as hydrateByStrategy,ha as hydrateIsland,va as isHydrated,wa as onHydrated,ga as processPartialHydrationDirectives,xa as processStaticDirectives};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import i from"path";var _t=".stx",s="STX_DIR",e=null;function xo(t){e=t?.trim()||null}function un(){return process.env[s]?.trim()||e||_t}function o(t=process.cwd(),...n){let r=un();return i.isAbsolute(r)?i.join(r,...n):i.join(t,r,...n)}function dn(t){if(!t||i.isAbsolute(t))return t;let n=t.replace(/\\/g,"/");if(n!==_t&&!n.startsWith(`${_t}/`))return t;let r=n.slice(_t.length+1);return r?i.join(un(),r):un()}
|
|
3
|
+
export{_t,xo,un,o,dn};
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{h,d,r,g,A}from"./chunk-69mc2np8.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],i=n[2];t.push({type:"suspense",name:s,content:i}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function Kl(e,t={},o={}){let n={...A,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(m.trim())await d(m,y,e);let E=H(c),u=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let p=await r(c,y,e,n,u);for(let b=0;b<p.length;b+=s)i.enqueue(p.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let p=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)p.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of p){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await r(I,y,e,n,u);i.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await r(_.content,y,e,n,u);i.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await r(_,y,e,n,u);i.enqueue(C)}}}}else{let w=new Map;for(let l of E)if(l.type==="shell"||l.type==="content"){let p=await r(l.content,y,e,n,u);i.enqueue(p)}else if(l.type==="suspense"&&l.name){let p=`stx-suspense-${l.name}`;i.enqueue(`<div id="${p}" data-suspense="${l.name}" style="display:contents;">
|
|
3
|
+
<template data-suspense-fallback>Loading...</template>
|
|
4
|
+
</div>`),w.set(l.name,r(l.content,y,e,n,u))}i.enqueue(`
|
|
5
|
+
<script>
|
|
6
|
+
(function() {
|
|
7
|
+
window.__stxSuspense = window.__stxSuspense || {
|
|
8
|
+
resolve: function(name, content) {
|
|
9
|
+
var el = document.querySelector('[data-suspense="' + name + '"]');
|
|
10
|
+
if (el) {
|
|
11
|
+
// Create a template to parse the HTML
|
|
12
|
+
var template = document.createElement('template');
|
|
13
|
+
template.innerHTML = content;
|
|
14
|
+
// Replace placeholder with actual content
|
|
15
|
+
el.replaceWith(template.content);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
</script>`);let x=Array.from(w.entries()).map(async([l,p])=>{i.enqueue(await mi(l,p))});await Promise.all(x)}i.close()}catch(a){i.error(a)}}})}async function mi(e,t){try{let n=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
|
|
21
|
+
<script>
|
|
22
|
+
window.__stxSuspense.resolve('${e}', \`${n}\`);
|
|
23
|
+
</script>`}catch(o){let n=o instanceof Error?o.message:String(o);return`
|
|
24
|
+
<script>
|
|
25
|
+
window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${h(n)}</div>');
|
|
26
|
+
</script>`}}var _a=`
|
|
27
|
+
<script>
|
|
28
|
+
(function(){
|
|
29
|
+
window.__stxSuspense = window.__stxSuspense || {
|
|
30
|
+
resolve: function(name, content){
|
|
31
|
+
var el = document.querySelector('[data-suspense="' + name + '"]');
|
|
32
|
+
if (!el) return;
|
|
33
|
+
var t = document.createElement('template');
|
|
34
|
+
t.innerHTML = content;
|
|
35
|
+
// Keep handles to the inserted nodes \u2014 the fragment is emptied on insert.
|
|
36
|
+
var nodes = Array.prototype.slice.call(t.content.childNodes);
|
|
37
|
+
el.replaceWith(t.content);
|
|
38
|
+
// Hydrate the streamed content so interactive islands/directives inside
|
|
39
|
+
// it come alive (no-op when the signals runtime isn't on the page).
|
|
40
|
+
if (window.stx && typeof window.stx.hydrate === 'function') {
|
|
41
|
+
nodes.forEach(function(n){ if (n.nodeType === 1) window.stx.hydrate(n); });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
</script>`;function z(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((i,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function Gl(e,t=[],o={}){let n=o.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(_a),await Promise.all(t.map(async(i)=>{let a=z(i.render(),n,i.id);s.enqueue(await mi(i.id,a))}));s.close()}catch(i){s.error(i)}}})}var B=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function Jl(e,t){return e.replace(B,(o,n,s)=>{let i=n.trim(),a=s.split(/@fallback/i),S=a[0].trim(),m=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[i]=S,`<div data-suspense="${i}">${m}</div>`})}function Yl(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,n])=>typeof n==="function");return o.length>0?o.map(([n,s])=>({id:n,render:s})):void 0}async function Zl(e,t={},o={}){let n={...A,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(m.trim())await d(m,y,e);let E=new Set,u=n.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(u!=="manual"&&R.test(c))){let x=await r(c,y,e,n,E);for(let l=0;l<x.length;l+=s)i.enqueue(x.slice(l,l+s))}else{let x=[],l=new RegExp(T.source,"g"),p;while((p=l.exec(c))!==null)x.push({name:p[1],content:p[2],start:p.index,end:p.index+p[0].length});let b=0;for(let f of x){if(f.start>b){let _=c.slice(b,f.start);if(_.trim()){let C=await r(_,y,e,n,E);i.enqueue(C)}}let v=await r(f.content,y,e,n,E);i.enqueue(v),b=f.end}if(b<c.length){let f=c.slice(b);if(f.trim()){let v=await r(f,y,e,n,E);i.enqueue(v)}}}i.close()}catch(a){i.error(a)}}})}async function Ql(e,t={}){let o={...A,...t,streaming:{...q,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),i=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S=a,m={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let u=c[1],R=c[2];m[u]=R}let y=a.replace(T,"");return{renderShell:async(u={})=>{let R={...u,__filename:e,__dirname:k.dirname(e)};return await d(i,R,e),r(y,R,e,o,new Set)},renderSection:async(u,R={})=>{try{if(!m[u])return`<div class="error-message">Section "${h(u)}" not found in template "${h(e)}"</div>`;let w={...R,__filename:e,__dirname:k.dirname(e)};await d(i,w,e);let x=new Set;return await r(m[u],w,e,o,x)}catch(w){let x=w instanceof Error?w.message:String(w);return g("Expression",x,e,m[u]||"",0,m[u]||"")}},getSections:()=>Object.keys(m),getTemplate:()=>S}}var Ra={name:"suspense",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},Aa={name:"island",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),i=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,S=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),m=S?S[1].trim():"",c=S?e.replace(S[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${i}">
|
|
47
|
+
${c}
|
|
48
|
+
<script type="application/json" data-island-props="${a}">
|
|
49
|
+
${m?`{${m}}`:"{}"}
|
|
50
|
+
</script>
|
|
51
|
+
</div>`}};function eu(e={}){let t=[];if(e.streaming?.enabled)t.push(Ra);if(e.hydration?.enabled)t.push(Aa);return t}async function tu(e,t,o,n={}){return e}function nu(e,t={}){let o=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(i,a){a.enqueue(o.encode(i))}})),s=new Headers(t.headers);if(!s.has("Content-Type"))s.set("Content-Type","text/html; charset=utf-8");if(!s.has("Transfer-Encoding"))s.set("Transfer-Encoding","chunked");if(!s.has("X-Content-Type-Options"))s.set("X-Content-Type-Options","nosniff");if(!s.has("X-Accel-Buffering"))s.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:s})}function ru(e={mode:"full"}){let{mode:t,components:o={},dynamicImports:n=!0}=e,s=Object.entries(o).map(([i,a])=>`'${i}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
|
|
52
|
+
`);if(t==="loader")return`
|
|
53
|
+
(function() {
|
|
54
|
+
window.__stx = window.__stx || {};
|
|
55
|
+
window.__stx.islands = new Map();
|
|
56
|
+
window.__stx.registerComponent = function(name, component) {
|
|
57
|
+
window.__stx.islands.set(name, component);
|
|
58
|
+
};
|
|
59
|
+
})();`;return`
|
|
60
|
+
(function() {
|
|
61
|
+
'use strict';
|
|
62
|
+
|
|
63
|
+
// Hydration runtime for stx islands
|
|
64
|
+
const stx = {
|
|
65
|
+
// Component registry
|
|
66
|
+
components: {
|
|
67
|
+
${s}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
// Loaded island instances
|
|
71
|
+
islands: new Map(),
|
|
72
|
+
|
|
73
|
+
// Register a component for hydration
|
|
74
|
+
registerComponent: function(name, loader) {
|
|
75
|
+
this.components[name] = loader;
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
// Get props for an island by ID
|
|
79
|
+
getIslandProps: function(id) {
|
|
80
|
+
const propsScript = document.querySelector('[data-island-props="' + id + '"]');
|
|
81
|
+
if (!propsScript) return {};
|
|
82
|
+
try {
|
|
83
|
+
return JSON.parse(propsScript.textContent || '{}');
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
console.warn('[stx] Failed to parse island props:', id, e);
|
|
87
|
+
return {};
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
// Hydrate a single island
|
|
92
|
+
hydrateIsland: async function(element) {
|
|
93
|
+
const name = element.dataset.island;
|
|
94
|
+
const id = element.dataset.islandId;
|
|
95
|
+
|
|
96
|
+
if (!name || this.islands.has(id)) return;
|
|
97
|
+
|
|
98
|
+
const loader = this.components[name];
|
|
99
|
+
if (!loader) {
|
|
100
|
+
console.warn('[stx] Unknown island component:', name);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
try {
|
|
105
|
+
const component = typeof loader === 'function' ? await loader() : loader;
|
|
106
|
+
const props = this.getIslandProps(id);
|
|
107
|
+
|
|
108
|
+
// Mark as hydrating
|
|
109
|
+
element.dataset.hydrating = 'true';
|
|
110
|
+
|
|
111
|
+
// Call component's hydrate method if available
|
|
112
|
+
if (component.hydrate) {
|
|
113
|
+
await component.hydrate(element, props);
|
|
114
|
+
}
|
|
115
|
+
else if (component.default && component.default.hydrate) {
|
|
116
|
+
await component.default.hydrate(element, props);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Mark as hydrated
|
|
120
|
+
delete element.dataset.hydrating;
|
|
121
|
+
element.dataset.hydrated = 'true';
|
|
122
|
+
this.islands.set(id, { element, component, props });
|
|
123
|
+
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.error('[stx] Failed to hydrate island:', name, error);
|
|
127
|
+
element.dataset.hydrateError = 'true';
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
// Hydrate all islands based on priority
|
|
132
|
+
hydrate: function() {
|
|
133
|
+
const islands = document.querySelectorAll('[data-island]');
|
|
134
|
+
|
|
135
|
+
// Group by priority
|
|
136
|
+
const eager = [];
|
|
137
|
+
const lazy = [];
|
|
138
|
+
const idle = [];
|
|
139
|
+
|
|
140
|
+
islands.forEach(function(el) {
|
|
141
|
+
const priority = el.dataset.priority || 'lazy';
|
|
142
|
+
if (priority === 'eager') eager.push(el);
|
|
143
|
+
else if (priority === 'idle') idle.push(el);
|
|
144
|
+
else lazy.push(el);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Hydrate eager immediately
|
|
148
|
+
eager.forEach(function(el) { stx.hydrateIsland(el); });
|
|
149
|
+
|
|
150
|
+
// Hydrate lazy on intersection
|
|
151
|
+
if (lazy.length > 0 && 'IntersectionObserver' in window) {
|
|
152
|
+
const observer = new IntersectionObserver(function(entries) {
|
|
153
|
+
entries.forEach(function(entry) {
|
|
154
|
+
if (entry.isIntersecting) {
|
|
155
|
+
observer.unobserve(entry.target);
|
|
156
|
+
stx.hydrateIsland(entry.target);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}, { rootMargin: '50px' });
|
|
160
|
+
|
|
161
|
+
lazy.forEach(function(el) { observer.observe(el); });
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
// Fallback: hydrate all lazy immediately
|
|
165
|
+
lazy.forEach(function(el) { stx.hydrateIsland(el); });
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Hydrate idle during browser idle time
|
|
169
|
+
if (idle.length > 0 && 'requestIdleCallback' in window) {
|
|
170
|
+
requestIdleCallback(function() {
|
|
171
|
+
idle.forEach(function(el) { stx.hydrateIsland(el); });
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
// Fallback: hydrate after a delay
|
|
176
|
+
setTimeout(function() {
|
|
177
|
+
idle.forEach(function(el) { stx.hydrateIsland(el); });
|
|
178
|
+
}, 200);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// Expose to window
|
|
184
|
+
window.__stx = stx;
|
|
185
|
+
|
|
186
|
+
// Auto-hydrate on DOMContentLoaded if not SSR
|
|
187
|
+
if (document.readyState === 'loading') {
|
|
188
|
+
document.addEventListener('DOMContentLoaded', function() { stx.hydrate(); });
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
stx.hydrate();
|
|
192
|
+
}
|
|
193
|
+
})();`}
|
|
194
|
+
export{Kl,mi,_a,Gl,Jl,Yl,Zl,Ql,Ra,Aa,eu,tu,nu,ru};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
function pi(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="id",dynamicHeight:d=!1,estimatedItemHeight:g=l,direction:x="vertical"}=c,e=[...v],t=0,n=new Map;function f(){if(d)return h();let i=Math.max(0,Math.floor(t/l)-s),r=Math.ceil(u/l),m=Math.min(e.length-1,i+r+s*2);return{startIndex:i,endIndex:m}}function h(){let i=0,r=0,m=e.length-1;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+M>t){r=Math.max(0,p-s);break}i+=M}i=0;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+=M,i>t+u){m=Math.min(e.length-1,p+s);break}}return{startIndex:r,endIndex:m}}function w(){if(d){let i=0;for(let r=0;r<e.length;r++)i+=n.get(r)||g;return i}return e.length*l}function y(i){if(d){let r=0;for(let m=0;m<i;m++)r+=n.get(m)||g;return r}return i*l}function S(){let{startIndex:i,endIndex:r}=f();return{startIndex:i,endIndex:r,scrollTop:t,totalHeight:w(),visibleItems:e.slice(i,r+1),itemHeights:new Map(n)}}function L(i,r="auto"){let m=y(i);a(m,r)}function a(i,r="auto"){t=Math.max(0,Math.min(i,w()-u))}function o(){f()}function H(i){e=[...i],n.clear(),o()}function I(){e=[],n.clear()}return{scrollToIndex:L,scrollToOffset:a,getState:S,refresh:o,setItems:H,destroy:I}}function fi(v,c={},l){let u=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualList: items "${x}" not found or not an array -->`;let t={itemHeight:50,containerHeight:400,overscan:3};if(d)try{let a=d.trim(),o=Function(`return ${a}`)();t={...t,...o}}catch{}let n=`vlist-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(t.containerHeight/t.itemHeight),h=t.overscan||3,w=0,y=Math.min(e.length-1,f+h),S="";for(let a=w;a<=y&&a<e.length;a++){let o=e[a],H=g.replace(/\{\{\s*item\s*\}\}/g,typeof o==="object"?JSON.stringify(o):String(o)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,i)=>{if(typeof o==="object"&&o!==null)return String(o[i]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(a));S+=`
|
|
3
|
+
<div class="virtual-item ${t.itemClass||""}"
|
|
4
|
+
style="position: absolute; top: ${a*t.itemHeight}px; height: ${t.itemHeight}px; width: 100%;"
|
|
5
|
+
data-index="${a}">
|
|
6
|
+
${H}
|
|
7
|
+
</div>`}let L=e.length*t.itemHeight;return`
|
|
8
|
+
<div id="${n}"
|
|
9
|
+
class="virtual-list-container ${t.containerClass||""}"
|
|
10
|
+
style="position: relative; height: ${t.containerHeight}px; overflow-y: auto;"
|
|
11
|
+
data-item-height="${t.itemHeight}"
|
|
12
|
+
data-total-items="${e.length}"
|
|
13
|
+
data-overscan="${h}">
|
|
14
|
+
<div class="virtual-list-viewport ${t.viewportClass||""}"
|
|
15
|
+
style="position: relative; height: ${L}px; width: 100%;">
|
|
16
|
+
${S}
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<script data-virtual-list="${n}">
|
|
20
|
+
(function() {
|
|
21
|
+
const container = document.getElementById('${n}');
|
|
22
|
+
if (!container) return;
|
|
23
|
+
|
|
24
|
+
const viewport = container.querySelector('.virtual-list-viewport');
|
|
25
|
+
const itemHeight = ${t.itemHeight};
|
|
26
|
+
const totalItems = ${e.length};
|
|
27
|
+
const overscan = ${h};
|
|
28
|
+
const containerHeight = ${t.containerHeight};
|
|
29
|
+
const items = ${JSON.stringify(e)};
|
|
30
|
+
const template = ${JSON.stringify(g.trim())};
|
|
31
|
+
|
|
32
|
+
let lastStartIndex = 0;
|
|
33
|
+
|
|
34
|
+
function renderItems(scrollTop) {
|
|
35
|
+
const startIndex = Math.max(0, Math.floor(scrollTop / itemHeight) - overscan);
|
|
36
|
+
const visibleCount = Math.ceil(containerHeight / itemHeight);
|
|
37
|
+
const endIndex = Math.min(totalItems - 1, startIndex + visibleCount + overscan * 2);
|
|
38
|
+
|
|
39
|
+
if (startIndex === lastStartIndex) return;
|
|
40
|
+
lastStartIndex = startIndex;
|
|
41
|
+
|
|
42
|
+
// Clear and re-render
|
|
43
|
+
viewport.innerHTML = '';
|
|
44
|
+
|
|
45
|
+
for (let i = startIndex; i <= endIndex; i++) {
|
|
46
|
+
const item = items[i];
|
|
47
|
+
const div = document.createElement('div');
|
|
48
|
+
div.className = 'virtual-item ${t.itemClass||""}';
|
|
49
|
+
div.style.cssText = 'position: absolute; top: ' + (i * itemHeight) + 'px; height: ' + itemHeight + 'px; width: 100%;';
|
|
50
|
+
div.dataset.index = i;
|
|
51
|
+
|
|
52
|
+
let html = template
|
|
53
|
+
.replace(/\\{\\{\\s*item\\s*\\}\\}/g, typeof item === 'object' ? JSON.stringify(item) : String(item))
|
|
54
|
+
.replace(/\\{\\{\\s*item\\.(\\w+)\\s*\\}\\}/g, (_, prop) => {
|
|
55
|
+
return typeof item === 'object' && item !== null ? String(item[prop] ?? '') : '';
|
|
56
|
+
})
|
|
57
|
+
.replace(/\\{\\{\\s*index\\s*\\}\\}/g, String(i));
|
|
58
|
+
|
|
59
|
+
div.innerHTML = html;
|
|
60
|
+
viewport.appendChild(div);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
container.addEventListener('scroll', function() {
|
|
65
|
+
requestAnimationFrame(() => renderItems(container.scrollTop));
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Expose API
|
|
69
|
+
container.__virtualList = {
|
|
70
|
+
scrollToIndex: function(index) {
|
|
71
|
+
container.scrollTop = index * itemHeight;
|
|
72
|
+
},
|
|
73
|
+
refresh: function() {
|
|
74
|
+
renderItems(container.scrollTop);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
})();
|
|
78
|
+
</script>
|
|
79
|
+
`})}function la(){return`
|
|
80
|
+
.virtual-list-container {
|
|
81
|
+
position: relative;
|
|
82
|
+
overflow-y: auto;
|
|
83
|
+
overflow-x: hidden;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.virtual-list-container::-webkit-scrollbar {
|
|
87
|
+
width: 8px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.virtual-list-container::-webkit-scrollbar-track {
|
|
91
|
+
background: rgba(0, 0, 0, 0.1);
|
|
92
|
+
border-radius: 4px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.virtual-list-container::-webkit-scrollbar-thumb {
|
|
96
|
+
background: rgba(0, 0, 0, 0.3);
|
|
97
|
+
border-radius: 4px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.virtual-list-container::-webkit-scrollbar-thumb:hover {
|
|
101
|
+
background: rgba(0, 0, 0, 0.5);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.virtual-list-viewport {
|
|
105
|
+
position: relative;
|
|
106
|
+
width: 100%;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.virtual-item {
|
|
110
|
+
position: absolute;
|
|
111
|
+
left: 0;
|
|
112
|
+
right: 0;
|
|
113
|
+
box-sizing: border-box;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Loading placeholder for items */
|
|
117
|
+
.virtual-item-placeholder {
|
|
118
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
119
|
+
background-size: 200% 100%;
|
|
120
|
+
animation: virtual-shimmer 1.5s infinite;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@keyframes virtual-shimmer {
|
|
124
|
+
0% { background-position: 200% 0; }
|
|
125
|
+
100% { background-position: -200% 0; }
|
|
126
|
+
}
|
|
127
|
+
`}function ua(v,c){let l=null,u=()=>{if(!l)l=pi(v(),c);return l};return{visibleItems:()=>u().getState().visibleItems,totalHeight:()=>u().getState().totalHeight,containerProps:()=>({style:{height:`${c.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(s)=>{let b=s.target;if(l)l.scrollToOffset(b.scrollTop)}}),itemProps:(s)=>({style:{position:"absolute",top:`${s*c.itemHeight}px`,height:`${c.itemHeight}px`,width:"100%"},"data-index":s}),scrollToIndex:(s)=>{u().scrollToIndex(s)}}}function da(v,c={},l){let u=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return v.replace(u,(s,b,d,g,x)=>{let e=b.trim(),t=c[e];if(!t||!Array.isArray(t))return`<!-- infiniteList: items "${e}" not found or not an array -->`;let n={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(d)try{let w=Function(`return ${d.trim()}`)();n={...n,...w}}catch{}let f=`ilist-${Math.random().toString(36).substring(2,9)}`,h=fi(`@virtualList(${e}, ${JSON.stringify({itemHeight:n.itemHeight,containerHeight:n.containerHeight,overscan:n.overscan,containerClass:n.containerClass})})${g}@endvirtualList`,c);return h=h.replace("</script>",`
|
|
128
|
+
// Infinite scroll detection
|
|
129
|
+
container.addEventListener('scroll', function() {
|
|
130
|
+
const scrollBottom = container.scrollTop + container.clientHeight;
|
|
131
|
+
const threshold = ${n.threshold};
|
|
132
|
+
const totalHeight = viewport.offsetHeight;
|
|
133
|
+
|
|
134
|
+
if (scrollBottom >= totalHeight - threshold) {
|
|
135
|
+
container.dispatchEvent(new CustomEvent('loadmore', { bubbles: true }));
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
</script>`),`
|
|
139
|
+
<div id="${f}" class="infinite-list-wrapper">
|
|
140
|
+
${h}
|
|
141
|
+
<div class="infinite-list-loading" style="display: none;">
|
|
142
|
+
${x}
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
`})}function pa(v,c={},l){let u=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualGrid: items "${x}" not found or not an array -->`;let t={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(d)try{let o=Function(`return ${d.trim()}`)();t={...t,...o}}catch{}let n=`vgrid-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(e.length/t.columns),h=f*(t.rowHeight+(t.gap||0)),w=Math.ceil(t.containerHeight/(t.rowHeight+(t.gap||0))),y=t.overscan||2,S=0,L=Math.min(f-1,w+y),a="";for(let o=S;o<=L;o++)for(let H=0;H<t.columns;H++){let I=o*t.columns+H;if(I>=e.length)break;let i=e[I],r=H*(100/t.columns),m=o*(t.rowHeight+(t.gap||0)),p=g.replace(/\{\{\s*item\s*\}\}/g,typeof i==="object"?JSON.stringify(i):String(i)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,T)=>{if(typeof i==="object"&&i!==null)return String(i[T]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(I));a+=`
|
|
146
|
+
<div class="virtual-grid-item"
|
|
147
|
+
style="position: absolute; top: ${m}px; left: ${r}%; width: calc(${100/t.columns}% - ${t.gap||0}px); height: ${t.rowHeight}px;"
|
|
148
|
+
data-index="${I}">
|
|
149
|
+
${p}
|
|
150
|
+
</div>`}return`
|
|
151
|
+
<div id="${n}"
|
|
152
|
+
class="virtual-grid-container"
|
|
153
|
+
style="position: relative; height: ${t.containerHeight}px; overflow-y: auto;">
|
|
154
|
+
<div class="virtual-grid-viewport"
|
|
155
|
+
style="position: relative; height: ${h}px; width: 100%;">
|
|
156
|
+
${a}
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
<script data-virtual-grid="${n}">
|
|
160
|
+
(function() {
|
|
161
|
+
const container = document.getElementById('${n}');
|
|
162
|
+
if (!container) return;
|
|
163
|
+
|
|
164
|
+
const viewport = container.querySelector('.virtual-grid-viewport');
|
|
165
|
+
const columns = ${t.columns};
|
|
166
|
+
const rowHeight = ${t.rowHeight};
|
|
167
|
+
const gap = ${t.gap||0};
|
|
168
|
+
const totalItems = ${e.length};
|
|
169
|
+
const overscan = ${y};
|
|
170
|
+
const containerHeight = ${t.containerHeight};
|
|
171
|
+
const items = ${JSON.stringify(e)};
|
|
172
|
+
const template = ${JSON.stringify(g.trim())};
|
|
173
|
+
|
|
174
|
+
let lastStartRow = 0;
|
|
175
|
+
|
|
176
|
+
function renderItems(scrollTop) {
|
|
177
|
+
const startRow = Math.max(0, Math.floor(scrollTop / (rowHeight + gap)) - overscan);
|
|
178
|
+
const visibleRowCount = Math.ceil(containerHeight / (rowHeight + gap));
|
|
179
|
+
const endRow = Math.min(Math.ceil(totalItems / columns) - 1, startRow + visibleRowCount + overscan * 2);
|
|
180
|
+
|
|
181
|
+
if (startRow === lastStartRow) return;
|
|
182
|
+
lastStartRow = startRow;
|
|
183
|
+
|
|
184
|
+
viewport.innerHTML = '';
|
|
185
|
+
|
|
186
|
+
for (let row = startRow; row <= endRow; row++) {
|
|
187
|
+
for (let col = 0; col < columns; col++) {
|
|
188
|
+
const index = row * columns + col;
|
|
189
|
+
if (index >= totalItems) break;
|
|
190
|
+
|
|
191
|
+
const item = items[index];
|
|
192
|
+
const div = document.createElement('div');
|
|
193
|
+
div.className = 'virtual-grid-item';
|
|
194
|
+
div.style.cssText = 'position: absolute; top: ' + (row * (rowHeight + gap)) + 'px; left: ' + (col * (100 / columns)) + '%; width: calc(' + (100 / columns) + '% - ' + gap + 'px); height: ' + rowHeight + 'px;';
|
|
195
|
+
div.dataset.index = index;
|
|
196
|
+
|
|
197
|
+
let html = template
|
|
198
|
+
.replace(/\\{\\{\\s*item\\s*\\}\\}/g, typeof item === 'object' ? JSON.stringify(item) : String(item))
|
|
199
|
+
.replace(/\\{\\{\\s*item\\.(\\w+)\\s*\\}\\}/g, (_, prop) => {
|
|
200
|
+
return typeof item === 'object' && item !== null ? String(item[prop] ?? '') : '';
|
|
201
|
+
})
|
|
202
|
+
.replace(/\\{\\{\\s*index\\s*\\}\\}/g, String(index));
|
|
203
|
+
|
|
204
|
+
div.innerHTML = html;
|
|
205
|
+
viewport.appendChild(div);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
container.addEventListener('scroll', function() {
|
|
211
|
+
requestAnimationFrame(() => renderItems(container.scrollTop));
|
|
212
|
+
});
|
|
213
|
+
})();
|
|
214
|
+
</script>
|
|
215
|
+
`})}var gl={createVirtualList:pi,processVirtualListDirectives:fi,processInfiniteListDirectives:da,processVirtualGridDirectives:pa,generateVirtualListCSS:la,useVirtualList:ua};
|
|
216
|
+
export{pi,fi,la,ua,da,pa,gl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Mu,ec,ns,rs,Hi,Vi,ss,is,tc,nc,Ui,Wi,rc,ze}from"./chunk-69mc2np8.js";import"./chunk-752hw7cd.js";import"./chunk-shr559s7.js";import"./chunk-ak1cgcah.js";import"./chunk-2gr351s0.js";import"./chunk-h0atqq82.js";import"./chunk-ngc2wke4.js";import"./chunk-xfp7k0v8.js";import"./chunk-m4sk62wb.js";import"./chunk-z0g9jvv0.js";import"./chunk-8nhshfz6.js";import"./chunk-7gkv67ky.js";import"./chunk-ce1sejr3.js";import"./chunk-czxt605c.js";export{Mu as clearScriptScanCache,ss as convertServerLoopAttributesToDirectives,Hi as convertSignalDirectivesToAttributes,is as convertSignalLoopsToAttributes,nc as extractExports,Wi as findMarkupIndexOutsideScripts,rs as hasSignalsSyntax,ns as parseLoopExpression,Vi as preEvalLiteralReactiveIfs,tc as processScriptSetup,Ui as processSignals,rc as rewriteStxImportSpecifiers,ec as scanScriptTags,ze as stripStxRuntimeImports};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{o}from"./chunk-fzapbw9p.js";import h from"path";import{hasLocalConfig as Ae}from"bunfig";var ue={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function N(t){return`--stx-${t}`}function W(t,n){let r=n.lastIndexOf("-");if(r===-1)return typeof t[n]==="string"?t[n]:void 0;let s=t[n.slice(0,r)];if(!s||typeof s!=="object")return;let i=s[n.slice(r+1)];return typeof i==="string"?i:void 0}function de(t){let n={};for(let[r,s]of Object.entries(ue)){let i=W(t,s.light);if(i===void 0)continue;n[r]=`var(${N(r)}, ${i})`}return n}function ge(t){let n=[],r=[];for(let[s,i]of Object.entries(ue)){let a=W(t,i.light),c=W(t,i.dark);if(a===void 0)continue;if(n.push(` ${N(s)}: ${a};`),c!==void 0)r.push(` ${N(s)}: ${c};`)}if(n.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...n,"}",".dark {",...r,"}",""].join(`
|
|
3
|
+
`)}var fe={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function pe(t){return`--stx-radius-${t}`}function he(){let t={};for(let[n,r]of Object.entries(fe))t[n]=`var(${pe(n)}, ${r.value})`;return t}function me(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(fe).map(([t,n])=>` ${pe(t)}: ${n.value};`),"}",""].join(`
|
|
4
|
+
`)}function ye(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}function F(t,n){let r={...t};for(let[s,i]of Object.entries(n))r[s]=ye(i)&&ye(r[s])?F(r[s],i):i;return r}function be(t={},n={}){let r=t.theme||{},s=n.theme||{},{extend:i,...a}=s,{extend:c,...d}=r,l=d.colors||{};d.colors={...l,...de(l)};let u=d.borderRadius||{};d.borderRadius={...u,...he()};let g=F(d,a),p=F(c||{},i||{});if(Object.keys(p).length>0)g.extend=p;let m=[...t.safelist||[],...n.safelist||[]],S={...t.shortcuts||{},...n.shortcuts||{}},C=[...t.preflights||[],...n.preflights||[]];return{config:{...t,...n,theme:g,safelist:m,shortcuts:S,...C.length>0?{preflights:C}:{},content:[],output:""},safelist:m,shortcuts:S,includePreflight:n.preflight!==!1,minify:n.minify===!0,tokenCSS:ge(l)+me()}}var _=/<script\b[^>]*>/iy,q=/<\/script\s*>/ig,M=/<style\b[^>]*>/iy,Q=/<\/style\s*>/ig;function Se(t,n,r,s){r.lastIndex=n;let i=r.exec(t);if(!i||i.index!==n)return-1;s.lastIndex=r.lastIndex;let a=s.exec(t);if(!a)return-1;return a.index+a[0].length}function G(t,n){return Se(t,n,_,q)}function Ct(t,n){return Se(t,n,M,Q)}function xe(t,n){if(!t.startsWith("<!--",n))return-1;let r=t.indexOf("-->",n+4);if(r===-1)return-1;return r+3}function Ce(t,n){if(t.startsWith("<!--",n)){let i=xe(t,n);return i===-1?t.length:i}if(_.lastIndex=n,_.exec(t)?.index===n){q.lastIndex=_.lastIndex;let i=q.exec(t);return i?i.index+i[0].length:t.length}if(M.lastIndex=n,M.exec(t)?.index===n){Q.lastIndex=M.lastIndex;let i=Q.exec(t);return i?i.index+i[0].length:t.length}return-1}function $t(t,n){let r=[],s=0,i=t.length,a=!1,c=null;while(s<i){let d=t[s];if(a){if(c){if(d===c)c=null}else if(d==='"'||d==="'")c=d;else if(d===">")a=!1;s++;continue}if(d!=="<"){let p=t.indexOf("<",s+1);if(p===-1)break;s=p;continue}let l=n(t,s);if(l>s){r.push({start:s,end:l,token:t.slice(s,l)}),s=l;continue}let u=Ce(t,s);if(u>s){s=u;continue}let g=t.charCodeAt(s+1);if(g>=65&&g<=90||g>=97&&g<=122)a=!0;s++}return r}function bo(t){let n=0,r=0,s=0,i=!1,a=null;while(s<t.length){if(i){let p=t[s];if(a){if(p===a)a=null}else if(p==='"'||p==="'")a=p;else if(p===">")i=!1;s++;continue}let c=t.indexOf("<",s),d=c===-1?t.length:c;while(s<d){let p=t[s++];if(p==="{")n++;else if(p==="}")r++;if(n>=2&&r>=2)return!0}if(c===-1)break;let l=Ce(t,c);if(l>c){s=l;continue}let u=t.charCodeAt(c+1),g=u===47?t.charCodeAt(c+2):u;if(g>=65&&g<=90||g>=97&&g<=122)i=!0;s=c+1}return!1}function Yn(t,n){while(t.size>=n){let r=t.keys().next();if(r.done)return;t.delete(r.value)}}var Ve=65536,He=12,U=new Map;function ne(t,n,r,s){let i=s!==void 0&&t.length>=Ve,a=i?`${s}\x00${t}`:"";if(i){let g=U.get(a);if(g)return{output:g.output,tokens:g.tokens.slice()}}let c=$t(t,n);if(c.length===0)return{output:t,tokens:[]};let d=c.map((g)=>g.token),l="",u=0;for(let g=0;g<c.length;g++){let p=c[g];l+=t.slice(u,p.start),l+=r(p.token,g),u=p.end}if(l+=t.slice(u),i)return Yn(U,He),U.set(a,{output:l,tokens:d}),{output:l,tokens:d.slice()};return{output:l,tokens:d}}var Ke=65536,Ne=4,Y=new Map;function X(t,n,r){return{output:n,scripts:r,restore:(s)=>s===n?t:Et(s,r)}}function V(t){let n=t.length>=Ke;if(n){let i=Y.get(t);if(i)return X(t,i.output,i.scripts.slice())}let{output:r,tokens:s}=ne(t,G,(i,a)=>`\x00STX_SCRIPT_${a}\x00`);if(n)return Yn(Y,Ne),Y.set(t,{output:r,scripts:s}),X(t,r,s.slice());return X(t,r,s)}function Et(t,n){if(n.length===0)return t;return t.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(r,s)=>n[+s]??"")}function ke(t,n=""){let r=`${t}${n}`,s=0;for(let i=0;i<r.length;i++){let a=r.charCodeAt(i);s=(s<<5)-s+a,s=s&s}return`stx-${Math.abs(s).toString(36)}`}function we(t,n,r={}){let{prefix:s="",preserveHost:i=!0,scopeKeyframes:a=!0,scopeCustomProperties:c=!1}=r;if(!t.trim())return"";let d=J(t),l=[],u=new Map;if(a)for(let g of d){let p=g.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(p){let m=p[1],S=`${n}_${m}`;u.set(m,S)}}for(let g of d){let p=Te(g,n,s,i,u,c);l.push(p)}return l.join(`
|
|
5
|
+
|
|
6
|
+
`)}function J(t){let n=[],r=t.replace(/\/\*[\s\S]*?\*\//g,""),s=0,i="",a=!1,c="";for(let d=0;d<r.length;d++){let l=r[d];if(l==="@"&&s===0)a=!0;if(l==="{")s++;else if(l==="}"){if(s--,s===0){if(a){c+=l;let u=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(u){let[,g,p,m]=u;if(g==="keyframes")n.push({selector:`@keyframes ${p.trim()}`,declarations:m.trim()});else if(g==="media"||g==="supports"||g==="container"){let S=J(m);n.push({selector:`@${g} ${p.trim()}`,declarations:S.map((C)=>`${C.selector} { ${C.declarations} }`).join(`
|
|
7
|
+
`)})}else n.push({selector:`@${g} ${p.trim()}`,declarations:m.trim()})}c="",a=!1}else if(i.trim()){i+=l;let u=i.match(/([^{]+)\{([^}]*)\}/);if(u)n.push({selector:u[1].trim(),declarations:u[2].trim()});i=""}continue}}if(a)c+=l;else i+=l}return n}function Te(t,n,r,s,i,a){let{selector:c,declarations:d}=t;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let g=c.replace("@keyframes ","").trim();return`@keyframes ${i.get(g)||g} { ${d} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let p=J(`x { ${d} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((m)=>Te(m,n,r,s,i,a)).join(`
|
|
8
|
+
`);return`${c} {
|
|
9
|
+
${p}
|
|
10
|
+
}`}return`${c} { ${d} }`}let l=We(c,n,r,s),u=d;for(let[g,p]of i)u=u.replace(new RegExp(`\\b${g}\\b`,"g"),p);if(a)u=u.replace(/--([a-z-]+)/gi,`--${n}-$1`);return`${l} { ${u} }`}function We(t,n,r,s){let i=t.split(",").map((c)=>c.trim()),a=[];for(let c of i){if(c.startsWith(":host")){if(s)a.push(c);else{let u=c.replace(/:host(\([^)]*\))?/,`.${n}$1`);a.push(u)}continue}if(c.includes("::slotted")){a.push(c);continue}if(c===":root"){a.push(`:root .${n}`);continue}let d=r?`${r} .${n}`:`.${n}`;a.push(`${d} ${c}`);let l=Fe(c,n);if(l)a.push(r?`${r} ${l}`:l)}return a.join(", ")}function Fe(t,n){let r=0,s=t.length;for(let l=0;l<t.length;l++){let u=t[l];if(u==="["||u==="(")r++;else if(u==="]"||u===")")r--;else if(r===0&&(u===" "||u===">"||u==="+"||u==="~")){s=l;break}}let i=t.slice(0,s),a=t.slice(s);if(!i)return"";let c=i.length,d=0;for(let l=0;l<i.length;l++){let u=i[l];if(u==="["||u==="(")d++;else if(u==="]"||u===")")d--;else if(r===0&&d===0&&u===":"){c=l;break}}return`${i.slice(0,c)}.${n}${i.slice(c)}${a}`}var Ee=String.raw`(?<![\w-])scoped(?![\w-])`,Z=/<style\s+([^>]*)>/gi,ve=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Re=new RegExp(Ee,"i"),Ue=new RegExp(Ee,"gi"),ee=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Ge(t){Z.lastIndex=0;let n=Z.exec(t);while(n!==null){if(Re.test(n[1]))return!0;n=Z.exec(t)}return!1}function te(t){let n=new Set,r=[];ee.lastIndex=0;let s=ee.exec(t);while(s!==null){let i=s[0].trim();if(n.has(i))r.push({start:s.index,end:s.index+s[0].length});else n.add(i);s=ee.exec(t)}return r}function cn(t){let n=te(t);if(n.length===0)return t;let r=Array(n.length+1),s=0;for(let i=0;i<n.length;i++){let a=n[i];r[i]=t.slice(s,a.start),s=a.end}return r[n.length]=t.slice(s),r.join("")}function Zn(t,n){if(!Ge(t))return{html:t,hasScoped:!1};let r=ke(n),s=`data-v-${r}`,i=t,a=!1;if(ve.lastIndex=0,i=i.replace(ve,(c,d,l)=>{if(!Re.test(d))return c;a=!0;let u=Ye(l,s),g=d.replace(Ue,"").trim(),p=g?` ${g}`:"";return`<style data-stx-scoped="${r}"${p}>${u}</style>`}),!a)return{html:t,hasScoped:!1};return i=Qe(i,s),{html:i,hasScoped:!0}}function Ye(t,n){return we(t,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${n}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${n}]`)}var qe=(t)=>`\x00stx-scope-mask-${t}\x00`,$e=/\u0000stx-scope-mask-(\d+)\u0000/g;function Qe(t,n){let r=ne(t,(i,a)=>{let c=G(i,a);return c>a?c:Ct(i,a)},(i,a)=>qe(a)),s=Je(r.output,n);return $e.lastIndex=0,s.replace($e,(i,a)=>r.tokens[Number(a)])}function Je(t,n){let r=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return t.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(s,i,a)=>{if(r.has(i.toLowerCase()))return s;if(s.includes(n))return s;if(i.toLowerCase()==="style"||i.toLowerCase()==="script")return s;if(a)return s.replace(`<${i}${a}`,`<${i} ${n}${a}`);if(s.endsWith("/>"))return`<${i} ${n} />`;return`<${i} ${n}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};import _e from"fs";class z{cache=new Map;maxSize;options;sizes;bytes=0;constructor(t=100,n){this.maxSize=t,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(t){if(!this.options)return;this.options={...this.options,maxBytes:t};while(this.bytes>t&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(t){if(!this.cache.has(t))return;let n=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,n),n}set(t,n){if(this.cache.has(t))this.delete(t);let r=this.options?this.options.sizeOf(n):0;if(this.options&&r>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+r>this.options.maxBytes)){let s=this.cache.keys().next().value;if(s===void 0)break;this.delete(s)}if(this.cache.set(t,n),this.sizes)this.sizes.set(t,r),this.bytes+=r}has(t){return this.cache.has(t)}delete(t){if(this.sizes){let n=this.sizes.get(t);if(n!==void 0)this.bytes-=n,this.sizes.delete(t)}return this.cache.delete(t)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var T=new Map,Ze=500;function Xe(t,n){if(n?.includes("g"))return new RegExp(t,n);let r=`${t}:${n||""}`;if(!T.has(r)){if(T.size>=Ze){let s=T.keys().next().value;if(s)T.delete(s)}T.set(r,new RegExp(t,n))}return T.get(r)}class Pe{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(t){let n=Array.from(new Set(t)),r=n.sort().join(","),s=this.pool.find((d)=>d.context.join(",")===r);if(s)return s.func;let i=this.fnCache,a=this.fnCacheMaxSize,c=(...d)=>(l)=>{try{let u=`${r}:${l}`,g=i.get(u);if(!g){if(i.size>=a){let p=i.keys().next().value;if(p)i.delete(p)}g=Function(...n,`
|
|
11
|
+
'use strict';
|
|
12
|
+
try {
|
|
13
|
+
return ${l};
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
if (e instanceof ReferenceError || e instanceof TypeError) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
throw e;
|
|
20
|
+
}
|
|
21
|
+
`),i.set(u,g)}return g(...d)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:c,context:n.slice()});return c}clear(){this.pool.length=0,this.fnCache.clear()}}var St=new Pe;class Be{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(t){this.enabled=t}isEnabled(){return this.enabled}setBudget(t,n){this.budgets.set(t,{warnThreshold:0.8,action:"warn",...n})}setBudgets(t){for(let[n,r]of Object.entries(t))this.setBudget(n,r)}removeBudget(t){this.budgets.delete(t)}getBudgets(){let t={};for(let[n,r]of this.budgets.entries())t[n]=r;return t}onViolation(t){this.violationHandlers.push(t)}offViolation(t){let n=this.violationHandlers.indexOf(t);if(n!==-1)this.violationHandlers.splice(n,1)}time(t,n){if(!this.enabled)return n();let r=performance.now(),s=n(),i=performance.now()-r;return this.recordTime(t,i),this.checkBudget(t,i),s}async timeAsync(t,n){if(!this.enabled)return n();let r=performance.now(),s=await n(),i=performance.now()-r;return this.recordTime(t,i),this.checkBudget(t,i),s}checkBudget(t,n){let r=this.budgets.get(t);if(!r)return;let s=n/r.maxTime*100,i=r.warnThreshold!==void 0?n>=r.maxTime*r.warnThreshold&&n<r.maxTime:!1,a=n>=r.maxTime;if(!i&&!a)return;let c={label:t,actualTime:n,budgetTime:r.maxTime,exceedancePercent:s,timestamp:new Date,isWarning:i};this.violations.push(c);while(this.violations.length>this.maxViolations)this.violations.shift();for(let l of this.violationHandlers)try{l(c)}catch{}let d=i?`[Performance Warning] "${t}" took ${n.toFixed(2)}ms (${s.toFixed(1)}% of ${r.maxTime}ms budget)`:`[Performance Budget Exceeded] "${t}" took ${n.toFixed(2)}ms (exceeded ${r.maxTime}ms budget by ${(s-100).toFixed(1)}%)`;switch(r.action){case"log":console.log(d);break;case"warn":console.warn(d);break;case"error":console.error(d);break;case"throw":if(a)throw Error(d);else console.warn(d);break}}recordTime(t,n){let r=this.metrics.get(t);if(r)r.count++,r.totalTime+=n,r.maxTime=Math.max(r.maxTime,n),r.minTime=Math.min(r.minTime,n);else this.metrics.set(t,{count:1,totalTime:n,maxTime:n,minTime:n})}getStats(t){if(t){let r=this.metrics.get(t);if(!r)return{};let s=this.budgets.get(t);return{count:r.count,avgTime:r.totalTime/r.count,totalTime:r.totalTime,maxTime:r.maxTime,minTime:r.minTime,budget:s?.maxTime,budgetUtilization:s?r.totalTime/r.count/s.maxTime*100:void 0}}let n={};for(let[r,s]of this.metrics.entries()){let i=this.budgets.get(r);n[r]={count:s.count,avgTime:s.totalTime/s.count,totalTime:s.totalTime,maxTime:s.maxTime,minTime:s.minTime,budget:i?.maxTime,budgetUtilization:i?s.totalTime/s.count/i.maxTime*100:void 0}}return n}getViolations(t){if(t)return this.violations.filter((n)=>n.label===t);return[...this.violations]}getViolationStats(){let t={},n=0,r=0;for(let s of this.violations)if(t[s.label]=(t[s.label]||0)+1,s.isWarning)n++;else r++;return{total:this.violations.length,byLabel:t,warnings:n,errors:r}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var se=null;function et(){if(!se)se=new Be;return se}var H=new Proxy({},{get(t,n){return et()[n]}});var Me=[];function P(t){let n=new z(t);return Me.push(n),n}function ho(){for(let t of Me)t.clear()}function D(t,...n){return`${n.map((r)=>String(r??"")).join("\x00")}\x00${t.length}\x00${Bun.hash(t)}`}function yo(t){let n=[];for(let r of new Set(t))try{n.push({path:r,mtimeMs:_e.statSync(r).mtimeMs})}catch{}return n}function kt(t){for(let n of t)try{if(_e.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var y=null,ie=!1,w=null,B="",v=!1,De=256,k=new Map,b=new Map,A=null,ze=null,O=new Map;function j(t){return Bun.hash(t).toString(16).padStart(16,"0").slice(0,16)}function re(t,n){if(k.has(t))k.delete(t);else if(k.size>=De)k.delete(k.keys().next().value);k.set(t,n)}function tt(t){let n=j(t);if(b.has(n))b.delete(n);else if(b.size>=De)b.delete(b.keys().next().value);return b.set(n,t),n}function zu(t){let n=b.get(t);if(n===void 0)return;return b.delete(t),b.set(t,n),n}async function nt(t,n=A){if(!n)return null;try{let r=Bun.file(h.join(n,`cw-${j(t)}.css`));if(!await r.exists())return null;return await r.text()}catch{return null}}async function st(t,n,r=A){if(!r)return;try{if(!fs.existsSync(r))fs.mkdirSync(r,{recursive:!0});await Bun.write(h.join(r,`cw-${j(t)}.css`),n)}catch{}}async function Oe(t){try{let n=await import(t);if(n&&n.CSSGenerator)return{CSSGenerator:n.CSSGenerator,config:n.config,build:n.build,defaultConfig:n.defaultConfig,extractClasses:n.extractClasses}}catch{}return null}var rt=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],it=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function ot(){let t=[],n=process.cwd();while(n!==h.dirname(n)){for(let r of["node_modules","pantry"])for(let s of rt)t.push(h.join(n,r,...s));n=h.dirname(n)}return t}function at(){let t=[],n=process.env.HOME||process.env.USERPROFILE||"",r=[n&&h.join(n,"Code","Tools","ts-css"),n&&h.join(n,"Code","Tools","crosswind"),n&&h.join(n,"repos","stacks-org","ts-css"),n&&h.join(n,"repos","stacks-org","crosswind"),h.join(process.cwd(),"..","ts-css"),h.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let s of r)t.push(h.join(s,"packages","toolkit","dist","engine","index.js")),t.push(h.join(s,"packages","toolkit","src","engine","index.ts"));if(n)t.push(h.join(n,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return t}async function vo(){if(ie)return y;ie=!0;try{let t=async(i)=>{for(let a of i){if(!await Bun.file(a).exists())continue;let c=await Oe(a);if(c){if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${h.dirname(h.dirname(a))}`);return c}}return null};if(process.env.CROSSWIND_SRC){let i=h.resolve(process.env.CROSSWIND_SRC),a=await t([i]);if(!a)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return y=a,y}let n=await t(ot());if(n)return y=n,y;let r=it;for(let i of r){let a=await Oe(i);if(a){if(y=a,!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return y}}let s=await t(at());if(s)return y=s,y;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Hu(){oe.clear(),y=null,ie=!1,w=null,B="",k.clear(),b.clear(),ze=null,O.clear()}var je=!1;async function wo(t){try{let n=Ae({name:"css",cwd:t})?"css":Ae({name:"crosswind",cwd:t})?"crosswind":null;if(!n)return null;if(n==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!je)je=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:r}=await import("bunfig"),s=await r({name:n,cwd:t,defaultConfig:{},checkEnv:!1,verbose:!1});if(!s?.path||!s.config||Object.keys(s.config).length===0)return null;let i=h.relative(t,s.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||s.path}`);return s.config}catch(n){if(n instanceof Error&&n.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,n instanceof Error?n.message:n),null}}async function Cc(t){let n=null;try{let{loadStxConfig:r}=await import("./chunk-syaw6b75.js"),s=await r(t);if(s.css)if(typeof s.css==="string"){let i=h.isAbsolute(s.css)?s.css:h.resolve(t,s.css);if(await Bun.file(i).exists()){let a=await import(i);n=a.default||a,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${s.css}`)}}else{if(n={...s.css,content:s.css.content||[],preflight:s.css.preflight??!0,minify:s.css.minify??!1},s.css.config){let i=h.isAbsolute(s.css.config)?s.css.config:h.resolve(t,s.css.config);if(await Bun.file(i).exists()){let a=await import(i);n={...a.default||a,...n}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return n||await wo(t)}function $c(t){try{let n=new WeakSet;return j(JSON.stringify(t??{},(r,s)=>{if(typeof s==="function")return`[fn]${String(s)}`;if(typeof s==="object"&&s!==null){if(n.has(s))return"[circular]";n.add(s)}return s})??"")}catch{return"unhashable"}}async function Tt(t){if(v)return B;v=!0;try{let n=await vo();if(!n||!n.build)return v=!1,"";if(!w)w=await wo(t);if(!w)return v=!1,"";let r=n.defaultConfig?.theme||{},s=w.theme||{},i={...n.defaultConfig,...w,theme:{...r,...s,extend:{...r.extend||{},...s.extend||{}}}},a=performance.now(),c=await n.build(i),d=performance.now()-a;if(B=c.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${c.classes.size} classes in ${d.toFixed(1)}ms`),i.output){let l=h.isAbsolute(i.output)?i.output:h.join(t,i.output),u=h.dirname(l);if(!fs.existsSync(u))fs.mkdirSync(u,{recursive:!0});await Bun.write(l,c.css)}return v=!1,c.css}catch(n){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,n),v=!1,B}}async function ln(t){w=null,await Tt(t)}function Vu(){return B}function Ec(t){let n=new Set,r=/class\s*=\s*["']([^"']+)["']/gi,s=r.exec(t);while(s!==null){for(let c of s[1].split(/\s+/))if(c.trim())n.add(c.trim());s=r.exec(t)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,a=i.exec(t);while(a!==null){let c=a[1].match(/'([^']+)'/g);if(c){for(let d of c)for(let l of d.slice(1,-1).split(/\s+/))if(l.trim())n.add(l.trim())}a=i.exec(t)}return n}var oe=P(64);async function Tc(t,n){let r=()=>O.get(n?h.resolve(n):process.cwd())?.fingerprint??null,s=oe.get(D(t,n,r()));if(s!==void 0)return s;let i=await ct(t,n);if(i)oe.set(D(t,n,r()),i);return i}async function ct(t,n){try{let r=await vo();if(!r)return"";let s=typeof r.extractClasses==="function"?r.extractClasses(t):Ec(t);if(s.size===0)return"";let i=n?h.resolve(n):process.cwd(),a=o(i,"cache");if(!A)A=a;let c=O.get(i);if(!c){let x=await Cc(i);c={config:x,fingerprint:$c(x)},O.set(i,c),ze=c.fingerprint}let d=[...s].sort().join(" "),l=`${c.fingerprint||"default"}::${d}`,u=k.get(l);if(u!==void 0)return re(l,u),u;let g=await nt(l,a);if(g!==null)return re(l,g),g;let p=r.defaultConfig||r.config,m=c.config||{},S=be(p,m),{safelist:C,includePreflight:ae,minify:ce,tokenCSS:Ie}=S,I=S.config,L=new r.CSSGenerator(I),K=I.shortcuts||m.shortcuts||{},le=Object.keys(K).filter((x)=>s.has(x)||C.includes(x));for(let x of C)if(!K[x])L.generate(x);for(let x of s)if(!K[x])L.generate(x);let E="";if(le.length>0){let x=new r.CSSGenerator(I);for(let Le of le)x.generate(Le);if(E=x.toCSS(!1,ce),E&&!E.endsWith(`
|
|
22
|
+
`))E+=`
|
|
23
|
+
`}let R=E+L.toCSS(ae,ce);return R=Ie+R,re(l,R),st(l,R,a),R}catch(r){return console.warn("Failed to generate Css CSS:",r),""}}async function f(t,n,r=!1,s=!1){let i=await Tc(t,n);if(!i)return s?cn(t):t;let a=r?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${tt(i)}.css">`:`<style data-css="generated">
|
|
24
|
+
${i}
|
|
25
|
+
</style>`;if(s)return lt(t,a);let c=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(c.test(t)){let d=!1;return t.replace(c,()=>{if(d)return"";return d=!0,a})}if(t.includes("</head>"))return t.replace("</head>",`${a}
|
|
26
|
+
</head>`);if(t.includes("<body"))return t.replace(/<body([^>]*)>/,`<body$1>
|
|
27
|
+
${a}`);return a+t}function lt(t,n){let r=te(t).map((l)=>({...l,replacement:""})),s=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,i=s.exec(t);if(i!==null){let l=!0;while(i!==null)r.push({start:i.index,end:i.index+i[0].length,replacement:l?n:""}),l=!1,i=s.exec(t)}else{let l=t.indexOf("</head>");if(l!==-1)r.push({start:l,end:l,replacement:`${n}
|
|
28
|
+
`});else{let u=t.match(/<body([^>]*)>/);if(u?.index!==void 0)r.push({start:u.index,end:u.index+u[0].length,replacement:`${u[0]}
|
|
29
|
+
${n}`});else r.push({start:0,end:0,replacement:n})}}r.sort((l,u)=>l.start-u.start||l.end-u.end);for(let l=1;l<r.length;l++)if(r[l].start<r[l-1].end)return ut(cn(t),n);let a=Array(r.length*2+1),c=0,d=0;for(let l of r)a[d++]=t.slice(c,l.start),a[d++]=l.replacement,c=l.end;return a[d]=t.slice(c),a.join("")}function ut(t,n){let r=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(r.test(t)){let s=!1;return t.replace(r,()=>{if(s)return"";return s=!0,n})}if(t.includes("</head>"))return t.replace("</head>",`${n}
|
|
30
|
+
</head>`);if(t.includes("<body"))return t.replace(/<body([^>]*)>/,`<body$1>
|
|
31
|
+
${n}`);return n+t}
|
|
32
|
+
export{z,Xe,H,P,ho,D,yo,kt,G,Ct,xe,$t,bo,Yn,ne,V,Et,cn,Zn,e,zu,vo,Hu,wo,Cc,$c,Tt,ln,Vu,Ec,Tc,f};
|