@stacksjs/stx 0.2.413 → 0.2.415
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.js +19 -11
- package/dist/bundle-analyzer.js +20 -20
- package/dist/chunk-020xyn9q.js +3 -0
- package/dist/chunk-04jhmfbz.js +2 -0
- package/dist/chunk-0pnj3zt2.js +2 -0
- package/dist/{chunk-bwjxk1dw.js → chunk-0zaess6f.js} +29 -29
- package/dist/chunk-1098mas0.js +2 -0
- package/dist/chunk-169n1vpx.js +12 -0
- package/dist/chunk-18vmfkcc.js +2 -0
- package/dist/chunk-1b6t12hd.js +2 -0
- package/dist/chunk-1xdzcy9d.js +14 -0
- package/dist/chunk-1zs30k3y.js +2 -0
- package/dist/chunk-2ce7f416.js +2 -0
- package/dist/chunk-340a824p.js +2 -0
- package/dist/chunk-393341w7.js +2 -0
- package/dist/chunk-39g1134q.js +2 -0
- package/dist/chunk-3efw27as.js +2785 -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-42wbs8vq.js +17 -0
- package/dist/chunk-4bjravgk.js +2 -0
- package/dist/chunk-5gsxpaqk.js +2 -0
- package/dist/{chunk-bwsxym3d.js → chunk-5qns2sdz.js} +17 -17
- 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-74j18qk0.js +930 -0
- package/dist/chunk-752hw7cd.js +4 -0
- package/dist/{chunk-kgd8kchy.js → chunk-765e1s44.js} +11 -76
- package/dist/chunk-7gkv67ky.js +4 -0
- package/dist/chunk-7z2ra0yf.js +2 -0
- package/dist/chunk-8eqrwj1k.js +20 -0
- package/dist/chunk-8nhshfz6.js +5 -0
- package/dist/chunk-92ps1xpk.js +2 -0
- package/dist/chunk-96k8s808.js +3 -0
- package/dist/chunk-9amp82bx.js +7 -0
- package/dist/chunk-9g27ybyr.js +3 -0
- package/dist/chunk-9p9qkbtg.js +3 -0
- package/dist/{chunk-xq1acw1r.js → chunk-9pt8fd2n.js} +13 -13
- package/dist/{chunk-24zher49.js → chunk-9vrja6vp.js} +4 -4
- package/dist/chunk-9xrbve19.js +2 -0
- package/dist/chunk-a688m6js.js +3 -0
- package/dist/chunk-ak1cgcah.js +5 -0
- package/dist/{chunk-4m7ajama.js → chunk-amd6ey3t.js} +14 -14
- package/dist/chunk-amtr3rmf.js +11 -0
- package/dist/chunk-atws6p5s.js +2 -0
- package/dist/chunk-b84h16er.js +61 -0
- package/dist/chunk-b98be3yp.js +32 -0
- package/dist/{chunk-hx998w7n.js → chunk-bay9s6rs.js} +13 -13
- package/dist/chunk-ce1sejr3.js +3 -0
- package/dist/chunk-cg8hg6cs.js +3 -0
- package/dist/{chunk-4f9zyfdw.js → chunk-czxt605c.js} +4 -5
- package/dist/chunk-dd8cja4h.js +2 -0
- package/dist/chunk-dgdm3hy3.js +2 -0
- package/dist/chunk-e9hs7kk6.js +12 -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-f1sxycmv.js +2 -0
- package/dist/chunk-f46qsp4m.js +4 -0
- package/dist/chunk-fbcv4fes.js +2 -0
- package/dist/{chunk-bjcsc6wx.js → chunk-fh1qrp68.js} +21 -21
- package/dist/chunk-fjs0a8h7.js +2 -0
- package/dist/chunk-fpfzm238.js +2 -0
- package/dist/chunk-fr2txj8q.js +829 -0
- package/dist/{chunk-xssw417m.js → chunk-ft4p6d28.js} +14 -14
- package/dist/chunk-fyzajkrx.js +2 -0
- package/dist/chunk-fzapbw9p.js +3 -0
- package/dist/chunk-g03s93qr.js +3 -0
- package/dist/chunk-g186znp9.js +33 -0
- package/dist/chunk-gawrg4gb.js +216 -0
- package/dist/chunk-gc1drn2p.js +2 -0
- package/dist/chunk-gea5hf0v.js +2 -0
- package/dist/chunk-gqv3ta5d.js +2 -0
- package/dist/chunk-h6kp2m9r.js +2 -0
- package/dist/chunk-h6zsqb9r.js +3 -0
- package/dist/{chunk-2snqdnk9.js → chunk-h85hrwkq.js} +13 -13
- package/dist/chunk-hbxz85wy.js +2 -0
- package/dist/chunk-hepd9qgx.js +6 -0
- package/dist/chunk-hhnw2sn3.js +2 -0
- package/dist/chunk-hjg3ndgh.js +2 -0
- package/dist/chunk-hk1mj4tz.js +2 -0
- package/dist/{chunk-smcj3442.js → chunk-hkrmcbwy.js} +79 -79
- package/dist/chunk-hn9pkyv8.js +2 -0
- package/dist/chunk-hpgr4qgp.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-jnkrn913.js +4 -0
- package/dist/chunk-jp10q90g.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-mp6hy8g4.js +2 -0
- package/dist/chunk-nc8my58s.js +2 -0
- package/dist/chunk-ngc2wke4.js +3 -0
- package/dist/chunk-nn2vstke.js +2 -0
- package/dist/chunk-nppdrf0x.js +2 -0
- package/dist/chunk-p2v2a68k.js +2 -0
- package/dist/chunk-pazfr1a1.js +2 -0
- package/dist/{chunk-qn5srnj3.js → chunk-pbh4smw3.js} +16 -16
- package/dist/chunk-pdb5fw3r.js +2 -0
- package/dist/chunk-pdt69hpb.js +2 -0
- package/dist/chunk-pgzvyrv6.js +29 -0
- package/dist/chunk-px7fvbj6.js +3 -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-qghxz7jm.js +194 -0
- package/dist/chunk-r3f9jcf7.js +5 -0
- package/dist/chunk-re8b5r9x.js +3 -0
- package/dist/chunk-s5xezjps.js +3 -0
- package/dist/chunk-sd321bn3.js +2 -0
- package/dist/chunk-shr559s7.js +3 -0
- package/dist/chunk-t4hzprsm.js +3 -0
- package/dist/chunk-t5pvq5mx.js +2 -0
- package/dist/{chunk-pv3d7sfn.js → chunk-t61vdbje.js} +89 -89
- package/dist/chunk-tafqyf2g.js +2033 -0
- package/dist/chunk-tfexmdkt.js +3 -0
- package/dist/chunk-thyt8ed8.js +6 -0
- package/dist/chunk-v91p6ekp.js +24 -0
- package/dist/chunk-vgvtnwxa.js +4 -0
- package/dist/chunk-w72qx0eb.js +2 -0
- package/dist/chunk-wfy1zq53.js +30 -0
- package/dist/chunk-wzx0164n.js +18 -0
- package/dist/chunk-x0q32ees.js +3 -0
- package/dist/chunk-xfp7k0v8.js +64 -0
- package/dist/chunk-xtvf6n6f.js +4 -0
- package/dist/chunk-xwzvfqcb.js +2 -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-z0g9jvv0.js +40 -0
- package/dist/chunk-z23kaxq6.js +2 -0
- package/dist/chunk-z8xn5ta3.js +2 -0
- package/dist/{chunk-8sdhs0zk.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/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-0btmm4m2.js +0 -147
- package/dist/chunk-0c2h69k2.js +0 -4
- package/dist/chunk-0d0qeqvv.js +0 -2
- package/dist/chunk-0psndabd.js +0 -2
- package/dist/chunk-0qv8yf53.js +0 -2
- package/dist/chunk-0vkxyvsd.js +0 -2
- package/dist/chunk-0we9nw1d.js +0 -3
- package/dist/chunk-0xqdmemy.js +0 -3
- package/dist/chunk-0y46fbkx.js +0 -3
- package/dist/chunk-158wqccn.js +0 -4422
- package/dist/chunk-1cyxbb8y.js +0 -16
- package/dist/chunk-1enwnh2a.js +0 -2
- package/dist/chunk-213pzm0d.js +0 -3
- package/dist/chunk-21hzqyja.js +0 -12
- package/dist/chunk-266t58b8.js +0 -5
- package/dist/chunk-27fgag95.js +0 -4
- package/dist/chunk-2a9n102n.js +0 -2
- package/dist/chunk-2eqzrczk.js +0 -2
- package/dist/chunk-2ke37m54.js +0 -14
- package/dist/chunk-35ds08e7.js +0 -3
- package/dist/chunk-3mtwkjcg.js +0 -2
- package/dist/chunk-4xr8zwkp.js +0 -2
- package/dist/chunk-58v77x2c.js +0 -2
- package/dist/chunk-5mhq8605.js +0 -2
- package/dist/chunk-5se8xt9e.js +0 -64
- package/dist/chunk-5zh0h080.js +0 -2
- package/dist/chunk-62435225.js +0 -2
- package/dist/chunk-6kdrncsx.js +0 -30
- package/dist/chunk-6n2rr3x7.js +0 -2
- package/dist/chunk-6xk87qf2.js +0 -30
- package/dist/chunk-72rwcbp6.js +0 -3
- package/dist/chunk-76w34xne.js +0 -3
- package/dist/chunk-7ekd7zj9.js +0 -2
- package/dist/chunk-7pr3wdd5.js +0 -3
- package/dist/chunk-7rxvafwc.js +0 -24
- package/dist/chunk-7tnwfa7w.js +0 -8
- package/dist/chunk-8c5je0wf.js +0 -2
- package/dist/chunk-8dz6nyvx.js +0 -2
- package/dist/chunk-98zj3fv2.js +0 -7
- package/dist/chunk-9e8t0twa.js +0 -3
- package/dist/chunk-9fqp72ze.js +0 -5
- package/dist/chunk-anydpa34.js +0 -3
- package/dist/chunk-ay6zjq8v.js +0 -3
- package/dist/chunk-az4v4ard.js +0 -3
- package/dist/chunk-ba5erggg.js +0 -2
- package/dist/chunk-bnagrdz6.js +0 -2
- package/dist/chunk-by8wghtf.js +0 -2
- package/dist/chunk-cd7h4q51.js +0 -2
- package/dist/chunk-cjmv8hgp.js +0 -33
- package/dist/chunk-cthf912y.js +0 -2
- package/dist/chunk-cxbpmwq5.js +0 -4
- package/dist/chunk-d3sy16qn.js +0 -2
- package/dist/chunk-dh6s7mrj.js +0 -1199
- package/dist/chunk-dm2nzg7a.js +0 -2
- package/dist/chunk-e2sgcnxc.js +0 -2
- package/dist/chunk-e3b7jj74.js +0 -2
- package/dist/chunk-ec4wq2sv.js +0 -6
- package/dist/chunk-ekzg97dn.js +0 -29
- package/dist/chunk-epjt342x.js +0 -2
- package/dist/chunk-eqe26g14.js +0 -18
- package/dist/chunk-ev0v1yma.js +0 -2
- package/dist/chunk-f53psr2y.js +0 -5
- package/dist/chunk-f8p69dsg.js +0 -3
- package/dist/chunk-f95drhdb.js +0 -194
- package/dist/chunk-ff5a6hvb.js +0 -17
- package/dist/chunk-fs5fy4h8.js +0 -2
- package/dist/chunk-fzsygce3.js +0 -2
- package/dist/chunk-g465x63k.js +0 -2
- package/dist/chunk-g708ekh1.js +0 -2
- package/dist/chunk-gcr9e83g.js +0 -11
- package/dist/chunk-gdmyrsr8.js +0 -4
- package/dist/chunk-gkms2ngq.js +0 -2
- package/dist/chunk-gnfywmgs.js +0 -7
- package/dist/chunk-hpf8kq7e.js +0 -2
- package/dist/chunk-j4x3faf8.js +0 -2
- package/dist/chunk-jkavtw9f.js +0 -2
- package/dist/chunk-kg1rdena.js +0 -3
- package/dist/chunk-km91wx0v.js +0 -2
- package/dist/chunk-kmsyvaex.js +0 -8
- package/dist/chunk-mrahwn5v.js +0 -8
- package/dist/chunk-nk3czvnk.js +0 -2
- package/dist/chunk-nmw4eewb.js +0 -2
- package/dist/chunk-nq5zxrk0.js +0 -4
- package/dist/chunk-ny67c03k.js +0 -3
- package/dist/chunk-p4wdxp2c.js +0 -2
- package/dist/chunk-pcxp4r9n.js +0 -3
- package/dist/chunk-pdyeaxc1.js +0 -2
- package/dist/chunk-pf06ded4.js +0 -2
- package/dist/chunk-pfs0gpzm.js +0 -2
- package/dist/chunk-pshdwq44.js +0 -2
- package/dist/chunk-pwgv84pn.js +0 -32
- package/dist/chunk-pwsnafp3.js +0 -4367
- package/dist/chunk-q9n5swx7.js +0 -3
- package/dist/chunk-qr346wnp.js +0 -2
- package/dist/chunk-r02hke04.js +0 -2
- package/dist/chunk-ranshpyc.js +0 -3
- package/dist/chunk-rn194bhp.js +0 -20
- package/dist/chunk-rn1hgyc8.js +0 -930
- package/dist/chunk-s7z5dp70.js +0 -43
- package/dist/chunk-s8jd13nb.js +0 -3
- package/dist/chunk-sn7exv0n.js +0 -2
- package/dist/chunk-t1tdjjht.js +0 -216
- package/dist/chunk-t6qx04s8.js +0 -499
- package/dist/chunk-t6y6gyps.js +0 -2
- package/dist/chunk-tjfs7cc3.js +0 -2
- package/dist/chunk-tkyrk66a.js +0 -3
- package/dist/chunk-tntv9hvq.js +0 -2
- package/dist/chunk-v3nwkveg.js +0 -12
- package/dist/chunk-vd4cb5xr.js +0 -2
- package/dist/chunk-vkhdce50.js +0 -2
- package/dist/chunk-w183av08.js +0 -2
- package/dist/chunk-w2m02njv.js +0 -2
- package/dist/chunk-wpjrcrs5.js +0 -2
- package/dist/chunk-wqmppf6b.js +0 -3
- package/dist/chunk-wtb9fxdy.js +0 -2
- package/dist/chunk-xmzygmcz.js +0 -3
- package/dist/chunk-xsng1mtq.js +0 -3
- package/dist/chunk-xxzefj4j.js +0 -2
- package/dist/chunk-yq8x8bxq.js +0 -47
- package/dist/chunk-ytma76qe.js +0 -3
- package/dist/chunk-yw1m115e.js +0 -2
- package/dist/chunk-z64a924m.js +0 -2
- package/dist/chunk-zcz9rs6p.js +0 -3
package/dist/visual-testing.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import
|
|
3
|
-
${
|
|
2
|
+
import c from"fs";import p from"path";import T from"crypto";var y=[{name:"mobile",width:375,height:667,isMobile:!0,hasTouch:!0},{name:"tablet",width:768,height:1024,isMobile:!0,hasTouch:!0},{name:"desktop",width:1280,height:800,isMobile:!1,hasTouch:!1},{name:"wide",width:1920,height:1080,isMobile:!1,hasTouch:!1}];function w(n={}){let d={snapshotDir:n.snapshotDir||"__snapshots__",screenshotDir:n.screenshotDir||"__screenshots__",updateSnapshots:n.updateSnapshots||process.env.UPDATE_SNAPSHOTS==="true",threshold:n.threshold??0.01,viewports:n.viewports||y,generateDiff:n.generateDiff??!0,diffDir:n.diffDir||"__diffs__",compare:n.compare||V,ci:n.ci??process.env.CI==="true",retries:n.retries??(n.ci?3:1)};return{async snapshot(r,l){let e=p.join(d.snapshotDir,`${l}.html`),s=g(r),i=S(s);if(await Bun.file(e).exists()){let o=await Bun.file(e).text(),u=S(g(o));if(i===u)return{passed:!0,snapshotPath:e,message:"Snapshot matches"};if(d.updateSnapshots)return await c.promises.mkdir(p.dirname(e),{recursive:!0}),await Bun.write(e,s),{passed:!0,snapshotPath:e,message:"Snapshot updated"};let t=p.join(d.diffDir,`${l}.actual.html`),a=p.join(d.diffDir,`${l}.diff.html`);return await c.promises.mkdir(d.diffDir,{recursive:!0}),await Bun.write(t,s),await Bun.write(a,k(o,s)),{passed:!1,snapshotPath:e,actualPath:t,diffPath:a,message:"Snapshot does not match"}}return await c.promises.mkdir(p.dirname(e),{recursive:!0}),await Bun.write(e,s),{passed:!0,snapshotPath:e,message:"New snapshot created"}},async snapshotJson(r,l){let e=p.join(d.snapshotDir,`${l}.json`),s=JSON.stringify(r,null,2);if(await Bun.file(e).exists()){let i=await Bun.file(e).text();if(s===i)return{passed:!0,snapshotPath:e};if(d.updateSnapshots)return await Bun.write(e,s),{passed:!0,snapshotPath:e,message:"Snapshot updated"};return{passed:!1,snapshotPath:e,message:`JSON snapshot mismatch:
|
|
3
|
+
${B(i,s)}`}}return await c.promises.mkdir(p.dirname(e),{recursive:!0}),await Bun.write(e,s),{passed:!0,snapshotPath:e,message:"New snapshot created"}},matchInlineSnapshot(r,l){let e=g(r);if(l===void 0)return{passed:!0,expected:e};let s=g(l);return{passed:e===s,expected:e}},getConfig(){return d}}}function b(n={}){let d=w(n),r=d.getConfig();return{async compareScreenshots(l,e,s="desktop"){let i=p.join(r.screenshotDir,s,`${l}.png`),o=p.join(r.diffDir,s,`${l}.actual.png`),u=p.join(r.diffDir,s,`${l}.diff.png`);if(await Bun.file(i).exists()){let t=await Bun.file(i).arrayBuffer(),a=Buffer.from(t),f=await r.compare(e,a);if(f.match||f.diffPercentage<=r.threshold)return{viewport:s,passed:!0,baselinePath:i};if(r.updateSnapshots)return await c.promises.mkdir(p.dirname(i),{recursive:!0}),await Bun.write(i,e),{viewport:s,passed:!0,baselinePath:i};if(await c.promises.mkdir(p.dirname(o),{recursive:!0}),await Bun.write(o,e),f.diffImage&&r.generateDiff)await Bun.write(u,f.diffImage);return{viewport:s,passed:!1,baselinePath:i,actualPath:o,diffPath:r.generateDiff?u:void 0,diffPercentage:f.diffPercentage}}return await c.promises.mkdir(p.dirname(i),{recursive:!0}),await Bun.write(i,e),{viewport:s,passed:!0,baselinePath:i}},async testViewports(l,e,s=r.viewports){let i=[];for(let o of s){let u=null;for(let t=0;t<r.retries;t++)try{let a=await e(o),f=await this.compareScreenshots(l,a,o.name);i.push(f),u=null;break}catch(a){if(u=a,t<r.retries-1)await new Promise((f)=>setTimeout(f,100*(t+1)))}if(u)i.push({viewport:o.name,passed:!1,baselinePath:"",diffPercentage:100})}return i},getSnapshotTester(){return d}}}function D(n={}){let r=b(n).getSnapshotTester(),l=new Map;return{addStory(e){l.set(`${e.component}/${e.name}`,e)},addStories(e){for(let s of e)this.addStory(s)},getStories(){return Array.from(l.values())},getStoriesForComponent(e){return Array.from(l.values()).filter((s)=>s.component===e)},async testStory(e){let s=l.get(e);if(!s)return{name:e,passed:!1,duration:0,snapshots:[],screenshots:[],errors:[Error(`Story not found: ${e}`)]};let i=Date.now(),o={name:e,passed:!0,duration:0,snapshots:[],screenshots:[],errors:[]};try{let u=await s.render(),t=await r.snapshot(u,e.replace(/\//g,"-"));if(o.snapshots.push(t),!t.passed)o.passed=!1}catch(u){o.passed=!1,o.errors.push(u)}return o.duration=Date.now()-i,o},async testAllStories(){let e=[];for(let s of l.keys()){let i=await this.testStory(s);e.push(i)}return e},async generateStoryIndex(){let e={};for(let s of l.values()){if(!e[s.component])e[s.component]=[];e[s.component].push({name:s.name,args:s.args})}return JSON.stringify(e,null,2)}}}async function R(n,d={}){let r={outputDir:d.outputDir||"visual-test-report",format:d.format||"html",title:d.title||"Visual Test Report",includeScreenshots:d.includeScreenshots??!0};await c.promises.mkdir(r.outputDir,{recursive:!0});let l=n.length,e=n.filter((t)=>t.passed).length,s=l-e,i=n.reduce((t,a)=>t+a.duration,0);if(r.format==="json"){let t={title:r.title,summary:{total:l,passed:e,failed:s,duration:i},results:n,generatedAt:new Date().toISOString()},a=p.join(r.outputDir,"report.json");return await Bun.write(a,JSON.stringify(t,null,2)),a}if(r.format==="markdown"){let t=`# ${r.title}
|
|
4
4
|
|
|
5
|
-
`;
|
|
5
|
+
`;t+=`## Summary
|
|
6
6
|
|
|
7
|
-
`,
|
|
8
|
-
`,
|
|
9
|
-
`,
|
|
10
|
-
`,
|
|
7
|
+
`,t+=`- Total: ${l}
|
|
8
|
+
`,t+=`- Passed: ${e}
|
|
9
|
+
`,t+=`- Failed: ${s}
|
|
10
|
+
`,t+=`- Duration: ${i}ms
|
|
11
11
|
|
|
12
|
-
`,
|
|
12
|
+
`,t+=`## Results
|
|
13
13
|
|
|
14
|
-
`;for(let
|
|
14
|
+
`;for(let f of n){let P=f.passed?"\u2705":"\u274C";if(t+=`### ${P} ${f.name}
|
|
15
15
|
|
|
16
|
-
`,
|
|
16
|
+
`,t+=`Duration: ${f.duration}ms
|
|
17
17
|
|
|
18
|
-
`,
|
|
19
|
-
`;for(let
|
|
20
|
-
`;
|
|
21
|
-
`}if(
|
|
22
|
-
`;for(let
|
|
23
|
-
`}
|
|
24
|
-
`}}let
|
|
18
|
+
`,f.errors.length>0){t+=`**Errors:**
|
|
19
|
+
`;for(let h of f.errors)t+=`- ${h.message}
|
|
20
|
+
`;t+=`
|
|
21
|
+
`}if(f.snapshots.length>0){t+=`**Snapshots:**
|
|
22
|
+
`;for(let h of f.snapshots){let x=h.passed?"\u2705":"\u274C";t+=`- ${x} ${h.snapshotPath}
|
|
23
|
+
`}t+=`
|
|
24
|
+
`}}let a=p.join(r.outputDir,"report.md");return await Bun.write(a,t),a}let o=`<!DOCTYPE html>
|
|
25
25
|
<html lang="en">
|
|
26
26
|
<head>
|
|
27
27
|
<meta charset="UTF-8">
|
|
28
28
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
29
|
-
<title>${
|
|
29
|
+
<title>${r.title}</title>
|
|
30
30
|
<style>
|
|
31
31
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
32
32
|
body { font-family: system-ui, sans-serif; line-height: 1.6; color: #333; max-width: 1200px; margin: 0 auto; padding: 2rem; }
|
|
@@ -53,60 +53,60 @@ ${z(Q,G)}`}}return await B.promises.mkdir($.dirname(q),{recursive:!0}),await Bun
|
|
|
53
53
|
</style>
|
|
54
54
|
</head>
|
|
55
55
|
<body>
|
|
56
|
-
<h1>${
|
|
56
|
+
<h1>${r.title}</h1>
|
|
57
57
|
|
|
58
58
|
<div class="summary">
|
|
59
59
|
<div class="stat">
|
|
60
|
-
<div class="stat-value">${
|
|
60
|
+
<div class="stat-value">${l}</div>
|
|
61
61
|
<div class="stat-label">Total Tests</div>
|
|
62
62
|
</div>
|
|
63
63
|
<div class="stat">
|
|
64
|
-
<div class="stat-value passed">${
|
|
64
|
+
<div class="stat-value passed">${e}</div>
|
|
65
65
|
<div class="stat-label">Passed</div>
|
|
66
66
|
</div>
|
|
67
67
|
<div class="stat">
|
|
68
|
-
<div class="stat-value failed">${
|
|
68
|
+
<div class="stat-value failed">${s}</div>
|
|
69
69
|
<div class="stat-label">Failed</div>
|
|
70
70
|
</div>
|
|
71
71
|
<div class="stat">
|
|
72
|
-
<div class="stat-value">${
|
|
72
|
+
<div class="stat-value">${i}ms</div>
|
|
73
73
|
<div class="stat-label">Duration</div>
|
|
74
74
|
</div>
|
|
75
75
|
</div>
|
|
76
76
|
|
|
77
77
|
<div class="results">
|
|
78
|
-
${
|
|
79
|
-
<div class="result ${
|
|
78
|
+
${n.map((t)=>`
|
|
79
|
+
<div class="result ${t.passed?"":"expanded"}">
|
|
80
80
|
<div class="result-header" onclick="this.parentElement.classList.toggle('expanded')">
|
|
81
|
-
<span>${
|
|
82
|
-
<span class="status ${
|
|
81
|
+
<span>${t.name}</span>
|
|
82
|
+
<span class="status ${t.passed?"pass":"fail"}">${t.passed?"PASS":"FAIL"}</span>
|
|
83
83
|
</div>
|
|
84
84
|
<div class="result-body">
|
|
85
|
-
<p>Duration: ${
|
|
86
|
-
${
|
|
85
|
+
<p>Duration: ${t.duration}ms</p>
|
|
86
|
+
${t.errors.length>0?`
|
|
87
87
|
<div class="error">
|
|
88
|
-
${
|
|
88
|
+
${t.errors.map((a)=>`<div>${v(a.message)}</div>`).join("")}
|
|
89
89
|
</div>
|
|
90
90
|
`:""}
|
|
91
|
-
${
|
|
91
|
+
${t.snapshots.filter((a)=>!a.passed).map((a)=>`
|
|
92
92
|
<div class="snapshot-diff">
|
|
93
|
-
<p>Snapshot: ${
|
|
94
|
-
${
|
|
93
|
+
<p>Snapshot: ${a.snapshotPath}</p>
|
|
94
|
+
${a.diffPath?`<p><a href="file://${a.diffPath}">View diff</a></p>`:""}
|
|
95
95
|
</div>
|
|
96
96
|
`).join("")}
|
|
97
|
-
${
|
|
97
|
+
${t.screenshots.filter((a)=>!a.passed).map((a)=>`
|
|
98
98
|
<div class="diff-view">
|
|
99
99
|
<div>
|
|
100
100
|
<div class="diff-label">Baseline</div>
|
|
101
|
-
${
|
|
101
|
+
${r.includeScreenshots?`<img src="file://${a.baselinePath}" alt="baseline">`:`<p>${a.baselinePath}</p>`}
|
|
102
102
|
</div>
|
|
103
103
|
<div>
|
|
104
104
|
<div class="diff-label">Actual</div>
|
|
105
|
-
${
|
|
105
|
+
${r.includeScreenshots&&a.actualPath?`<img src="file://${a.actualPath}" alt="actual">`:`<p>${a.actualPath||"N/A"}</p>`}
|
|
106
106
|
</div>
|
|
107
107
|
<div>
|
|
108
|
-
<div class="diff-label">Diff (${(
|
|
109
|
-
${
|
|
108
|
+
<div class="diff-label">Diff (${(a.diffPercentage||0).toFixed(2)}%)</div>
|
|
109
|
+
${r.includeScreenshots&&a.diffPath?`<img src="file://${a.diffPath}" alt="diff">`:`<p>${a.diffPath||"N/A"}</p>`}
|
|
110
110
|
</div>
|
|
111
111
|
</div>
|
|
112
112
|
`).join("")}
|
|
@@ -120,7 +120,7 @@ ${z(Q,G)}`}}return await B.promises.mkdir($.dirname(q),{recursive:!0}),await Bun
|
|
|
120
120
|
document.querySelectorAll('.result.fail').forEach(el => el.classList.add('expanded'));
|
|
121
121
|
</script>
|
|
122
122
|
</body>
|
|
123
|
-
</html>`,
|
|
124
|
-
`),
|
|
125
|
-
`),
|
|
126
|
-
`)}function
|
|
123
|
+
</html>`,u=p.join(r.outputDir,"report.html");return await Bun.write(u,o),u}function g(n){return n.replace(/<!--[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/>\s+/g,">").replace(/\s+</g,"<").replace(/"/g,'"').replace(/"/g,'"').trim()}function S(n){return T.createHash("md5").update(n).digest("hex")}function k(n,d){let r=n.split(`
|
|
124
|
+
`),l=d.split(`
|
|
125
|
+
`),e="<html><head><style>";e+=".diff { font-family: monospace; white-space: pre; }",e+=".add { background: #dcfce7; }",e+=".remove { background: #fee2e2; }",e+=".line-num { color: #888; width: 3em; display: inline-block; }",e+='</style></head><body><div class="diff">';let s=Math.max(r.length,l.length);for(let i=0;i<s;i++){let o=r[i]||"",u=l[i]||"";if(o===u)e+=`<div><span class="line-num">${i+1}</span> ${v(o)}</div>`;else{if(o)e+=`<div class="remove"><span class="line-num">${i+1}</span>-${v(o)}</div>`;if(u)e+=`<div class="add"><span class="line-num">${i+1}</span>+${v(u)}</div>`}}return e+="</div></body></html>",e}function B(n,d){let r=JSON.parse(n),l=JSON.parse(d),e=[];function s(i,o,u){if(typeof o!==typeof u){e.push(`${i}: type changed from ${typeof o} to ${typeof u}`);return}if(o===null||u===null){if(o!==u)e.push(`${i}: ${JSON.stringify(o)} \u2192 ${JSON.stringify(u)}`);return}if(typeof o==="object"){let t=Object.keys(o),a=Object.keys(u);for(let f of t)if(!a.includes(f))e.push(`${i}.${f}: removed`);else s(`${i}.${f}`,o[f],u[f]);for(let f of a)if(!t.includes(f))e.push(`${i}.${f}: added`)}else if(o!==u)e.push(`${i}: ${JSON.stringify(o)} \u2192 ${JSON.stringify(u)}`)}return s("root",r,l),e.join(`
|
|
126
|
+
`)}function v(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function V(n,d){if(n.length!==d.length)return{match:!1,diffPercentage:100,diffPixels:Math.max(n.length,d.length)};let r=0;for(let e=0;e<n.length;e++)if(n[e]!==d[e])r++;let l=r/n.length*100;return{match:r===0,diffPercentage:l,diffPixels:r}}var m=null;async function j(n,d){if(!m)m=w();return m.snapshot(n,d)}async function C(n,d){if(!m)m=w();return m.snapshotJson(n,d)}function N(){m=null}var _={createSnapshotTester:w,createVisualRegressionTester:b,createStoryTester:D,generateReport:R,snapshot:j,snapshotJson:C,defaultViewports:y};export{w as createSnapshotTester,D as createStoryTester,b as createVisualRegressionTester,_ as default,y as defaultViewports,R as generateReport,N as resetDefaultTester,j as snapshot,C as snapshotJson};
|
|
@@ -157,7 +157,7 @@ finally {
|
|
|
157
157
|
`;
|
|
158
158
|
}
|
|
159
159
|
export function generateReactiveComponentJS(component, template, options = {}) {
|
|
160
|
-
const { properties = [], computed = [], watchers = [], methods = {}, lifecycle = {} } = options,
|
|
160
|
+
const { properties = [], computed = [], watchers = [], methods = {}, lifecycle = {} } = options, { name: className, tag: tagName } = component, useShadow = component.shadowDOM !== !1, propsDefinition = properties.map((prop) => {
|
|
161
161
|
const defaultValue = prop.default !== void 0 ? JSON.stringify(prop.default) : getDefaultForType(prop.type);
|
|
162
162
|
return ` ${prop.name}: { type: '${prop.type}', default: ${defaultValue}, reflect: ${!!prop.reflect} }`;
|
|
163
163
|
}).join(`,
|
|
@@ -266,7 +266,7 @@ export { ${className} };
|
|
|
266
266
|
`;
|
|
267
267
|
}
|
|
268
268
|
export function generateReactiveComponentTS(component, template, options = {}) {
|
|
269
|
-
const { properties = [], computed = [], watchers = [], methods = {}, lifecycle = {} } = options,
|
|
269
|
+
const { properties = [], computed = [], watchers = [], methods = {}, lifecycle = {} } = options, { name: className, tag: tagName } = component, useShadow = component.shadowDOM !== !1, propsInterface = properties.map((prop) => {
|
|
270
270
|
const tsType = getTypeScriptType(prop.type);
|
|
271
271
|
return ` ${prop.name}: ${tsType};`;
|
|
272
272
|
}).join(`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.415",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -56,6 +56,10 @@
|
|
|
56
56
|
"types": "./dist/visual-testing.d.ts",
|
|
57
57
|
"import": "./dist/visual-testing.js"
|
|
58
58
|
},
|
|
59
|
+
"./native": {
|
|
60
|
+
"types": "./dist/native/index.d.ts",
|
|
61
|
+
"import": "./dist/native/index.js"
|
|
62
|
+
},
|
|
59
63
|
"./bundle-analyzer": {
|
|
60
64
|
"types": "./dist/bundle-analyzer/index.d.ts",
|
|
61
65
|
"import": "./dist/bundle-analyzer.js"
|
|
@@ -118,12 +122,12 @@
|
|
|
118
122
|
"dependencies": {
|
|
119
123
|
"@stacksjs/ts-css": "^0.3.2",
|
|
120
124
|
"@stacksjs/clapp": "^0.2.16",
|
|
121
|
-
"@stacksjs/desktop": "0.2.
|
|
122
|
-
"@stacksjs/sanitizer": "0.2.
|
|
125
|
+
"@stacksjs/desktop": "0.2.415",
|
|
126
|
+
"@stacksjs/sanitizer": "0.2.415",
|
|
123
127
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
124
|
-
"bun-plugin-stx": "0.2.
|
|
128
|
+
"bun-plugin-stx": "0.2.415",
|
|
125
129
|
"bunfig": "^0.15.19",
|
|
126
|
-
"stx-router": "0.2.
|
|
130
|
+
"stx-router": "0.2.415",
|
|
127
131
|
"ts-broadcasting": "^0.0.11",
|
|
128
132
|
"ts-images": "^0.2.22",
|
|
129
133
|
"ts-syntax-highlighter": "^0.2.1"
|
package/dist/chunk-0btmm4m2.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var N=new Map,Q=new Map;function T(A){if(N.set(A.name,A),A.client)Q.set(A.name,A.client)}function V(A){return N.get(A)}function W(){return Array.from(N.values())}function X(A){return Q.delete(A),N.delete(A)}function G(A){return T(A),{name:A.name,hasEndTag:A.hasEndTag??!0,description:A.description,handler:async(C,F,H,L)=>{let J=U(F,A.defaults);if(A.validate){let E=A.validate(J);if(E!==!0){let M=typeof E==="string"?E:`Invalid parameters for @${A.name}`;throw Error(M)}}let K=C;if(A.transform)K=await A.transform(C,J,H,L);if(A.clientScript){let E=A.clientScript(J);K+=`<script>${E}</script>`}if(A.css){let E=A.css(J);K+=`<style>${E}</style>`}return K}}}function Y(A,B){let C=typeof B==="function"?{mounted:B}:B;return Q.set(A,C),C}function U(A,B){let C={...B};for(let F of A){let H=F.indexOf(":"),L=F.indexOf("="),J=H>=0&&(L<0||H<L)?H:L;if(J>=0){let K=F.slice(0,J).trim(),E=F.slice(J+1).trim();if(E==="true")E=!0;else if(E==="false")E=!1;else if(E==="null")E=null;else if(!Number.isNaN(Number(E)))E=Number(E);else if(typeof E==="string"&&E.startsWith("{"))try{E=JSON.parse(E)}catch{}C[K]=E}else{let K=Object.keys(C).filter((E)=>!B||!(E in B)).length;C[K===0?"value":`arg${K}`]=F}}return C}function Z(){return[G({name:"uppercase",description:"Convert content to uppercase",transform:(A)=>A.toUpperCase()}),G({name:"lowercase",description:"Convert content to lowercase",transform:(A)=>A.toLowerCase()}),G({name:"capitalize",description:"Capitalize first letter of content",transform:(A)=>A.charAt(0).toUpperCase()+A.slice(1)}),G({name:"trim",description:"Remove leading and trailing whitespace",transform:(A)=>A.trim()}),G({name:"truncate",description:"Truncate content to specified length",defaults:{length:100,suffix:"..."},transform:(A,{length:B,suffix:C})=>A.length>B?A.slice(0,B)+C:A}),G({name:"highlight",description:"Highlight content with background color",defaults:{color:"yellow"},transform:(A,{color:B})=>`<mark style="background-color: ${B}; padding: 0.1em 0.2em; border-radius: 0.2em;">${A}</mark>`}),G({name:"badge",description:"Create a badge/tag",defaults:{variant:"default",color:""},transform:(A,{variant:B,color:C})=>{let F={default:"background: #e5e7eb; color: #374151;",primary:"background: #3b82f6; color: white;",success:"background: #10b981; color: white;",warning:"background: #f59e0b; color: white;",danger:"background: #ef4444; color: white;",info:"background: #06b6d4; color: white;"};return`<span style="${C?`background: ${C}; color: white;`:F[B]||F.default} padding: 0.25em 0.5em; border-radius: 9999px; font-size: 0.875em; font-weight: 500;">${A}</span>`}}),G({name:"code",description:"Style content as inline code",transform:(A)=>`<code style="background: #f3f4f6; padding: 0.2em 0.4em; border-radius: 0.25em; font-family: ui-monospace, monospace; font-size: 0.875em;">${A}</code>`}),G({name:"tooltip",description:"Add a tooltip to content",defaults:{text:"",position:"top"},hasEndTag:!0,transform:(A,{text:B,position:C})=>`<span class="stx-tooltip" data-tooltip="${B}" data-tooltip-position="${C}" style="position: relative; cursor: help;">${A}</span>`,css:()=>`
|
|
3
|
-
.stx-tooltip::after {
|
|
4
|
-
content: attr(data-tooltip);
|
|
5
|
-
position: absolute;
|
|
6
|
-
bottom: 100%;
|
|
7
|
-
left: 50%;
|
|
8
|
-
transform: translateX(-50%);
|
|
9
|
-
padding: 0.5em 0.75em;
|
|
10
|
-
background: #1f2937;
|
|
11
|
-
color: white;
|
|
12
|
-
font-size: 0.75rem;
|
|
13
|
-
border-radius: 0.25rem;
|
|
14
|
-
white-space: nowrap;
|
|
15
|
-
opacity: 0;
|
|
16
|
-
visibility: hidden;
|
|
17
|
-
transition: opacity 0.2s, visibility 0.2s;
|
|
18
|
-
z-index: 1000;
|
|
19
|
-
margin-bottom: 0.25rem;
|
|
20
|
-
}
|
|
21
|
-
.stx-tooltip:hover::after {
|
|
22
|
-
opacity: 1;
|
|
23
|
-
visibility: visible;
|
|
24
|
-
}
|
|
25
|
-
`}),G({name:"clipboard",description:"Add copy to clipboard functionality",defaults:{label:"Copy"},transform:(A,{label:B})=>{let C=`clipboard-${Date.now()}-${Math.random().toString(36).slice(2)}`;return`
|
|
26
|
-
<span class="stx-clipboard" data-clipboard-id="${C}">
|
|
27
|
-
<span class="stx-clipboard-content">${A}</span>
|
|
28
|
-
<button type="button" class="stx-clipboard-btn" onclick="navigator.clipboard.writeText(document.querySelector('[data-clipboard-id=\\'${C}\\'] .stx-clipboard-content').textContent).then(() => { this.textContent = 'Copied!'; setTimeout(() => this.textContent = '${B}', 2000); })">${B}</button>
|
|
29
|
-
</span>
|
|
30
|
-
`},css:()=>`
|
|
31
|
-
.stx-clipboard {
|
|
32
|
-
display: inline-flex;
|
|
33
|
-
align-items: center;
|
|
34
|
-
gap: 0.5em;
|
|
35
|
-
}
|
|
36
|
-
.stx-clipboard-btn {
|
|
37
|
-
padding: 0.25em 0.5em;
|
|
38
|
-
font-size: 0.75em;
|
|
39
|
-
background: #e5e7eb;
|
|
40
|
-
border: none;
|
|
41
|
-
border-radius: 0.25em;
|
|
42
|
-
cursor: pointer;
|
|
43
|
-
}
|
|
44
|
-
.stx-clipboard-btn:hover {
|
|
45
|
-
background: #d1d5db;
|
|
46
|
-
}
|
|
47
|
-
`}),G({name:"time",description:"Display relative time",defaults:{date:""},hasEndTag:!1,transform:(A,{date:B})=>{let C=B?new Date(B).getTime():Date.now();return`<time datetime="${new Date(C).toISOString()}" data-stx-relative-time="${C}"></time>`},clientScript:()=>`
|
|
48
|
-
document.querySelectorAll('[data-stx-relative-time]').forEach(el => {
|
|
49
|
-
const timestamp = parseInt(el.dataset.stxRelativeTime);
|
|
50
|
-
const rtf = new Intl.RelativeTimeFormat('en', { numeric: 'auto' });
|
|
51
|
-
const diff = timestamp - Date.now();
|
|
52
|
-
const seconds = Math.floor(diff / 1000);
|
|
53
|
-
const minutes = Math.floor(seconds / 60);
|
|
54
|
-
const hours = Math.floor(minutes / 60);
|
|
55
|
-
const days = Math.floor(hours / 24);
|
|
56
|
-
|
|
57
|
-
if (Math.abs(days) > 0) el.textContent = rtf.format(days, 'day');
|
|
58
|
-
else if (Math.abs(hours) > 0) el.textContent = rtf.format(hours, 'hour');
|
|
59
|
-
else if (Math.abs(minutes) > 0) el.textContent = rtf.format(minutes, 'minute');
|
|
60
|
-
else el.textContent = rtf.format(seconds, 'second');
|
|
61
|
-
});
|
|
62
|
-
`}),G({name:"currency",description:"Format number as currency",defaults:{amount:0,currency:"USD",locale:"en-US"},hasEndTag:!1,transform:(A,{amount:B,currency:C,locale:F})=>{return new Intl.NumberFormat(F,{style:"currency",currency:C}).format(B)}}),G({name:"number",description:"Format number with locale",defaults:{value:0,decimals:2,locale:"en-US"},hasEndTag:!1,transform:(A,{value:B,decimals:C,locale:F})=>{return new Intl.NumberFormat(F,{minimumFractionDigits:C,maximumFractionDigits:C}).format(B)}}),G({name:"pluralize",description:"Pluralize text based on count",defaults:{count:0,singular:"",plural:""},hasEndTag:!1,transform:(A,{count:B,singular:C,plural:F})=>{let H=B===1?C:F||C+"s";return`${B} ${H}`}})]}function _(){return`
|
|
63
|
-
// STX Directive Runtime
|
|
64
|
-
(function() {
|
|
65
|
-
if (typeof window === 'undefined') return;
|
|
66
|
-
|
|
67
|
-
window.STX = window.STX || {};
|
|
68
|
-
window.STX.directives = window.STX.directives || {};
|
|
69
|
-
|
|
70
|
-
// Register a client-side directive
|
|
71
|
-
window.STX.directive = function(name, definition) {
|
|
72
|
-
if (typeof definition === 'function') {
|
|
73
|
-
definition = { mounted: definition };
|
|
74
|
-
}
|
|
75
|
-
window.STX.directives[name] = definition;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// Apply directive to element
|
|
79
|
-
window.STX.applyDirective = function(el, name, value, arg, modifiers) {
|
|
80
|
-
const directive = window.STX.directives[name];
|
|
81
|
-
if (!directive) {
|
|
82
|
-
console.warn('[stx] Unknown directive:', name);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const binding = {
|
|
87
|
-
value: value,
|
|
88
|
-
arg: arg,
|
|
89
|
-
modifiers: modifiers || {},
|
|
90
|
-
dir: directive
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// Store binding on element for updates
|
|
94
|
-
el.__stx_directives__ = el.__stx_directives__ || {};
|
|
95
|
-
el.__stx_directives__[name] = binding;
|
|
96
|
-
|
|
97
|
-
// Call lifecycle hooks
|
|
98
|
-
if (directive.created) directive.created(el, binding);
|
|
99
|
-
if (directive.beforeMount) directive.beforeMount(el, binding);
|
|
100
|
-
|
|
101
|
-
// Defer mounted until DOM is ready
|
|
102
|
-
requestAnimationFrame(function() {
|
|
103
|
-
if (directive.mounted) directive.mounted(el, binding);
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// Update directive on element
|
|
108
|
-
window.STX.updateDirective = function(el, name, newValue) {
|
|
109
|
-
const binding = el.__stx_directives__ && el.__stx_directives__[name];
|
|
110
|
-
if (!binding) return;
|
|
111
|
-
|
|
112
|
-
const directive = binding.dir;
|
|
113
|
-
const oldValue = binding.value;
|
|
114
|
-
binding.oldValue = oldValue;
|
|
115
|
-
binding.value = newValue;
|
|
116
|
-
|
|
117
|
-
if (directive.beforeUpdate) directive.beforeUpdate(el, binding);
|
|
118
|
-
if (directive.updated) directive.updated(el, binding);
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
// Remove directive from element
|
|
122
|
-
window.STX.removeDirective = function(el, name) {
|
|
123
|
-
const binding = el.__stx_directives__ && el.__stx_directives__[name];
|
|
124
|
-
if (!binding) return;
|
|
125
|
-
|
|
126
|
-
const directive = binding.dir;
|
|
127
|
-
if (directive.beforeUnmount) directive.beforeUnmount(el, binding);
|
|
128
|
-
if (directive.unmounted) directive.unmounted(el, binding);
|
|
129
|
-
|
|
130
|
-
delete el.__stx_directives__[name];
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
// Auto-apply directives on page load
|
|
134
|
-
document.addEventListener('DOMContentLoaded', function() {
|
|
135
|
-
document.querySelectorAll('[data-stx-directive]').forEach(function(el) {
|
|
136
|
-
const directives = el.dataset.stxDirective.split(';');
|
|
137
|
-
directives.forEach(function(d) {
|
|
138
|
-
const [name, value] = d.split(':').map(s => s.trim());
|
|
139
|
-
window.STX.applyDirective(el, name, value);
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
console.log('[stx] Directive runtime initialized');
|
|
145
|
-
})();
|
|
146
|
-
`}function $(A){let B=/v-(\w+)(?::(\w+))?(?:\.([\w.]+))?="([^"]*)"/g;return A.replace(B,(C,F,H,L,J)=>{let E=(L?L.split("."):[]).reduce((M,S)=>{return M[S]=!0,M},{});return`data-stx-directive="${F}:${J}" data-stx-directive-arg="${H||""}" data-stx-directive-modifiers='${JSON.stringify(E)}'`})}
|
|
147
|
-
export{T as Ps,V as Qs,W as Rs,X as Ss,G as Ts,Y as Us,Z as Vs,_ as Ws,$ as Xs};
|
package/dist/chunk-0c2h69k2.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import z from"fs";function B(x){return[...x].sort().map((b)=>{try{let j=z.statSync(b);return`${b}:${j.size}:${j.mtimeMs}`}catch{return`${b}:missing`}}).join(`
|
|
3
|
-
`)}function C(x,b,j){let q=x.get(b);return q!==void 0&&q.signature===j?q.value:void 0}function D(x,b,j,q){return x.set(b,{signature:j,value:q}),q}
|
|
4
|
-
export{B as Ri,C as Si,D as Ti};
|
package/dist/chunk-0d0qeqvv.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Jh as a,Kh as b,Lh as c,Mh as d,Nh as e,Oh as f,Ph as g}from"./chunk-t1tdjjht.js";import"./chunk-ay6zjq8v.js";export{d as useVirtualList,b as processVirtualListDirectives,f as processVirtualGridDirectives,e as processInfiniteListDirectives,c as generateVirtualListCSS,g as default,a as createVirtualList};
|
package/dist/chunk-0psndabd.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Al as c,Bl as d,Cl as e,Dl as f,El as g,yl as a,zl as b}from"./chunk-ec4wq2sv.js";import"./chunk-9fqp72ze.js";import"./chunk-tkyrk66a.js";import"./chunk-35ds08e7.js";import"./chunk-4f9zyfdw.js";import"./chunk-ay6zjq8v.js";export{e as productionApiDispatcher,g as isServerApiSource,b as generateApiTypes,a as discoverServerApi,f as createServerApi,d as createApiDispatcher,c as buildServerApi};
|
package/dist/chunk-0qv8yf53.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Aw as q,Bw as r,Cw as s,Dw as t,Ew as u,Fw as v,Gw as w,Hw as x,Iw as y,Jw as z,Kw as A,Lw as B,Mw as C,Nw as D,Ow as E,Pw as F,Qw as G,Rw as H,Sw as I,Tw as J,Vw as K,Ww as L,Yw as M,kw as a,lw as b,mw as c,nw as d,ow as e,pw as f,qw as g,rw as h,sw as i,tw as j,uw as k,vw as l,ww as m,xw as n,yw as o,zw as p}from"./chunk-4f9zyfdw.js";import"./chunk-ay6zjq8v.js";M();export{o as setAppUrl,H as runMiddleware,r as route,j as resolveLayoutChain,s as resetRoutes,z as registerMiddleware,g as patternToRegex,t as navigateTo,h as matchRoute,E as loadMiddlewareFromDirectory,c as isNonPageRoutePattern,b as isNonPageRoutePath,B as hasMiddleware,L as getRouterScriptDev,K as getRouterScript,D as getMiddlewareNames,A as getMiddleware,d as generateRouteTypes,e as generateRouteManifest,n as formatRoutes,m as findErrorPage,f as filePathToPattern,J as extractLayoutMetadata,I as deriveLayoutGroup,q as defineRoutes,p as defineRoute,v as defineMiddleware,y as createStorageManager,w as createServerCookieManager,l as createRouter,F as createRouteLocation,G as createMiddlewareContext,x as createClientCookieManager,C as clearMiddleware,i as bracketPathToRegex,u as abortNavigation,k as Router,a as NON_PAGE_DIRS};
|
package/dist/chunk-0vkxyvsd.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ao as b,Bo as c,Co as d,Do as e,Eo as f,Fo as g,Go as h,Ho as i,Io as j,Jo as k,Ko as l,Lo as m,Mo as n,zo as a}from"./chunk-pwsnafp3.js";import"./chunk-1cyxbb8y.js";import"./chunk-zcz9rs6p.js";import"./chunk-v3nwkveg.js";import"./chunk-9fqp72ze.js";import"./chunk-0btmm4m2.js";import"./chunk-pwgv84pn.js";import"./chunk-tkyrk66a.js";import"./chunk-ranshpyc.js";import"./chunk-98zj3fv2.js";import"./chunk-35ds08e7.js";import"./chunk-5se8xt9e.js";import"./chunk-gnfywmgs.js";import"./chunk-yq8x8bxq.js";import"./chunk-266t58b8.js";import"./chunk-nq5zxrk0.js";import"./chunk-az4v4ard.js";import"./chunk-4f9zyfdw.js";import"./chunk-xssw417m.js";import"./chunk-kg1rdena.js";import"./chunk-ay6zjq8v.js";export{n as stripStxRuntimeImports,b as scanScriptTags,m as rewriteStxImportSpecifiers,k as processSignals,i as processScriptSetup,f as preEvalLiteralReactiveIfs,c as parseLoopExpression,d as hasSignalsSyntax,l as findMarkupIndexOutsideScripts,j as extractExports,h as convertSignalLoopsToAttributes,e as convertSignalDirectivesToAttributes,g as convertServerLoopAttributesToDirectives,a as clearScriptScanCache};
|
package/dist/chunk-0we9nw1d.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import G from"path";var L=new Set([".jpg",".jpeg",".png",".gif"]),O=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function M(j,z){let H=z.formats??O;if(!z.publicDir)return j;let C=N(j),J=[],Y=/<img\b[^>]*?>/gi,K=[],Q;while((Q=Y.exec(j))!==null){let q=Q[0],y=q.match(/\bsrc=["']([^"']+)["']/i);if(!y)continue;if(_(Q.index,C))continue;K.push({idx:Q.index,length:q.length,src:y[1],raw:q})}if(K.length===0)return j;let Z=await Promise.all(K.map(async(q)=>{let y=await X(q.src,z.publicDir,H);return{match:q,sources:y}}));for(let{match:q,sources:y}of Z){if(y.length===0)continue;let I=`<picture>${y.map(($)=>`<source type="${$.mime}" srcset="${w($.url)}">`).join("")}${q.raw}</picture>`;J.push({start:q.idx,end:q.idx+q.length,replacement:I})}if(J.length===0)return j;let V="",W=0;for(let q of J)V+=j.slice(W,q.start),V+=q.replacement,W=q.end;return V+=j.slice(W),V}async function X(j,z,H){if(!F(j))return[];let C=G.extname(j).toLowerCase();if(!L.has(C))return[];if(!j.startsWith("/"))return[];let J=G.join(z,j.slice(1)),Y=G.dirname(J),K=G.basename(J,C),Q=G.resolve(Y),Z=G.resolve(z);if(!Q.startsWith(Z))return[];let V=G.posix.dirname(j),W=H.map(async(y)=>{let k=G.join(Y,`${K}${y.ext}`);if(!await Bun.file(k).exists())return null;return{url:G.posix.join(V,`${K}${y.ext}`),mime:y.mime}});return(await Promise.all(W)).filter((y)=>y!==null)}function F(j){if(!j)return!1;if(j.startsWith("http://")||j.startsWith("https://"))return!1;if(j.startsWith("//"))return!1;if(j.startsWith("data:"))return!1;return!0}function N(j){let z=[],H=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,C;while((C=H.exec(j))!==null)z.push([C.index,C.index+C[0].length]);return z}function _(j,z){for(let[H,C]of z)if(j>=H&&j<C)return!0;return!1}function w(j){return j.replace(/&/g,"&").replace(/"/g,""")}
|
|
3
|
-
export{M as li};
|
package/dist/chunk-0xqdmemy.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Mm as b}from"./chunk-pwsnafp3.js";import{Fv as L,Jv as R}from"./chunk-yq8x8bxq.js";function P(j,U){let Q=1,J=U,B="<template",z="</template";while(J<j.length&&Q>0){let G=j.indexOf("<",J);if(G===-1)break;if(J=G,j.startsWith(B,J)&&(J+B.length>=j.length||/[\s>\/]/.test(j[J+B.length]))){Q++,J+=B.length;continue}if(j.startsWith(z,J)){let W=j.indexOf(">",J+z.length);if(W!==-1){if(Q--,Q===0)return W+1;J=W+1;continue}}J++}return Q===0?J:-1}var F=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function O(j,U){let Q=null;for(let J=U;J<j.length;J++){let B=j[J];if(Q){if(B==="\\"){J++;continue}if(B===Q)Q=null;continue}if(B==='"'||B==="'"){Q=B;continue}if(B===">")return J+1}return-1}function I(j,U,Q){let J=U.toLowerCase(),B=1,z=Q;while(z<j.length){let G=j.indexOf("<",z);if(G===-1)return-1;if(j.startsWith("<!--",G)){let $=j.indexOf("-->",G+4);z=$===-1?j.length:$+3;continue}let W=O(j,G+1);if(W===-1)return-1;let Z=j.slice(G,W),Y=Z.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(Y&&Y[2].toLowerCase()===J){if(Y[1]==="/"){if(B--,B===0)return W}else if(!/\/\s*>$/.test(Z))B++}z=W}return-1}function w(j){let U=[],Q=[],J=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,B=0;while(B<j.length){let z=j.indexOf("<",B);if(z===-1)break;if(j.startsWith("<!--",z)){let X=j.indexOf("-->",z+4);B=X===-1?j.length:X+3;continue}let G=O(j,z+1);if(G===-1)break;let W=j.slice(z,G),Z=W.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!Z){B=G;continue}let Y=Z[2].toLowerCase();if(Z[1]==="/"){let X=Q.lastIndexOf(Y);if(X!==-1)Q.splice(X);B=G;continue}let $=/\/\s*>$/.test(W),K=Q.length===0?W.match(J):null;if(K){let X=K[1]||K[2],H=W.replace(J,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),_=$||F.has(Y)?-1:I(j,Y,G);if(_===-1)U.push({start:z,end:G,slotName:X,element:H}),B=G;else U.push({start:z,end:_,slotName:X,element:H+j.slice(G,_)}),B=_;continue}if(!$&&!F.has(Y)){if(Q.push(Y),Y==="script"||Y==="style"){let X=j.toLowerCase().indexOf(`</${Y}>`,G);if(X!==-1){B=X;continue}}}B=G}return U}function D(j){let U=[],Q=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,B=0;while(B<j.length){let z=j.indexOf("<",B);if(z===-1)break;if(j.startsWith("<!--",z)){let X=j.indexOf("-->",z+4);B=X===-1?j.length:X+3;continue}let G=O(j,z+1);if(G===-1)break;let W=j.slice(z,G),Z=W.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!Z){B=G;continue}let Y=Z[1]==="/",$=Z[2].toLowerCase();if(Y){let X=Q.lastIndexOf($);if(X!==-1)Q.splice(X);B=G;continue}if($==="template"&&Q.length===0){let X=W.match(J);if(X){let H=P(j,G);if(H!==-1){let _=X[1]||X[2]||X[3];U.push({start:z,end:H,slotName:_,content:j.slice(G,H-11).trim(),propsBinding:X[4]||void 0}),B=H;continue}}}if(!/\/\s*>$/.test(W)&&!F.has($)){if(Q.push($),$==="script"||$==="style"){let X=j.toLowerCase().indexOf(`</${$}>`,G);if(X!==-1){B=X;continue}}}B=G}return U}function v(j){let U={default:"",named:new Map},Q=j,J=D(j);for(let z of J)U.named.set(z.slotName,{name:z.slotName,content:z.content,propsBinding:z.propsBinding});J.sort((z,G)=>G.start-z.start);for(let z of J)Q=Q.slice(0,z.start)+Q.slice(z.end);let B=w(Q);for(let z of B){let G=U.named.get(z.slotName);if(G)G.content+=z.element;else U.named.set(z.slotName,{name:z.slotName,content:z.element})}for(let z=B.length-1;z>=0;z--){let G=B[z];Q=Q.slice(0,G.start)+Q.slice(G.end)}return U.default=Q.trim(),U}function S(j){let U=j.match(/name\s*=\s*["']([^"']+)["']/),Q=U?U[1]:"",J={},B=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,z;while((z=B.exec(j))!==null)J[z[1]]=z[2];let G=j.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),W=G?G[1].trim():"";return{name:Q,props:J,defaultContent:W}}async function k(j,U,Q,J){if(!j)return Q;let B=j.content;if(j.propsBinding&&Object.keys(U).length>0){let z=j.propsBinding.trim(),G={...J};if(z.startsWith("{")&&z.endsWith("}")){let W=z.slice(1,-1).split(",").map((Z)=>Z.trim()).filter(Boolean);for(let Z of W){let[Y,$]=Z.split(":").map((X)=>X.trim()),K=$||Y;if(U[Y]!==void 0)G[K]=U[Y]}}else G[z]=U;B=N(B,G)}return B}function N(j,U){return j.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Q,J)=>{try{let B=J.trim(),z=y(B,U);return b(String(z??""))}catch{return`{{ ${J} }}`}})}function y(j,U){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(j)){let J=j.split("."),B=U;for(let z of J)if(B&&typeof B==="object"&&z in B)B=B[z];else return;return B}let Q=j.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Q){let[,J,B,z]=Q,G=U[J],W=parseInt(z,10);if(typeof G==="number")switch(B){case"+":return G+W;case"-":return G-W;case"*":return G*W;case"/":return G/W}}try{if(!L(j))return;return R(j,Object.keys(U))(...Object.values(U))}catch{return}}async function T(j,U,Q){let J=j;J=await C(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,W,Z,Y)=>{let $=U.named.get(W),K=Y?.trim()||"",X=Z||"",H={},_=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,q;while((q=_.exec(X))!==null){let A=q[1],V=q[2];H[A]=y(V,Q)}return await k($,H,K,Q)});let z=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(z,(G,W,Z)=>{if(/\bname\s*=/.test(W||""))return G;let Y=Z?.trim()||"";return U.default||Y}),J}async function C(j,U,Q){let J=[],B=[];j.replace(U,(W,...Z)=>{let Y=Z[Z.length-2];return B.push({match:W,index:Y}),J.push(Q(W,...Z.slice(0,-2))),W});let z=await Promise.all(J),G=j;for(let W=B.length-1;W>=0;W--){let{match:Z,index:Y}=B[W];G=G.slice(0,Y)+z[W]+G.slice(Y+Z.length)}return G}function E(j){let U=v(j);return{defaultSlot:U.default,namedSlots:U.named}}async function x(j,U,Q,J){return await T(j,{default:U,named:Q},J)}
|
|
3
|
-
export{v as Sg,S as Tg,k as Ug,T as Vg,E as Wg,x as Xg};
|
package/dist/chunk-0y46fbkx.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var G={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},N={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function W(q,B){return`${G[B]}${q}\x1B[0m`}function O(q,B){return`${N[B]}${q}\x1B[0m`}var I=(q)=>W(q,"red"),E=(q)=>W(q,"green"),R=(q)=>W(q,"yellow"),T=(q)=>W(q,"blue");var Y=(q)=>W(q,"cyan");var $=(q)=>O(q,"bold"),M=(q)=>O(q,"dim");function v(){console.log(""),console.log(Y(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(Y(" \u2551")+$(" \uD83D\uDCD6 STX Story ")+Y("\u2551")),console.log(Y(" \u2551")+M(" Component Showcase & Testing ")+Y("\u2551")),console.log(Y(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function p(q,B){if(console.log($(" Server running at:")),console.log(""),console.log(` ${M("\u279C")} ${$("Local:")} ${Y(q)}`),B)console.log(` ${M("\u279C")} ${$("Network:")} ${Y(B)}`);console.log("")}function x(q){let B=q>0?"\u2713":"\u25CB",H=q>0?E:R;console.log(` ${H(B)} Found ${$(String(q))} story ${q===1?"file":"files"}`)}function b(q,B){if(console.log(""),console.log(` ${I("\u2717")} ${$(I("Error:"))} ${q}`),B)console.log(` ${M(B)}`);console.log("")}function m(q){console.log(` ${R("\u26A0")} ${R("Warning:")} ${q}`)}function h(q){console.log(` ${T("\u2139")} ${q}`)}function g(q,B,H){console.log(""),console.log(Y(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(Y(" \u2551")+$(" Build Complete ")+Y("\u2551")),console.log(Y(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(""),console.log(` ${E("\u2713")} Stories: ${$(String(q))}`),console.log(` ${E("\u2713")} Output: ${$(B)}`),console.log(` ${E("\u2713")} Time: ${$(`${H}ms`)}`),console.log("")}function y(){console.log(""),console.log($(" Keyboard Shortcuts:")),console.log(""),console.log(` ${Y("h")} Show this help`),console.log(` ${Y("o")} Open in browser`),console.log(` ${Y("r")} Restart server`),console.log(` ${Y("c")} Clear console`),console.log(` ${Y("q")} Quit`),console.log("")}import _ from"fs";import z from"path";async function c(q){let{root:B,config:H}=q,J=[],L=await w(B,H.storyMatch,H.storyIgnored);for(let Q of L){let K=z.resolve(B,Q),X=U(Q,K);J.push(X)}return J}async function w(q,B,H){let J=[];async function L(Q,K){let X=await _.promises.readdir(Q,{withFileTypes:!0});for(let Z of X){let V=z.join(Q,Z.name),A=z.relative(K,V);if(S(A,H))continue;if(Z.isDirectory())await L(V,K);else if(Z.isFile()){if(C(A,B))J.push(A)}}}return await L(q,q),J}function S(q,B){for(let H of B)if(D(q,H))return!0;return!1}function C(q,B){for(let H of B)if(D(q,H))return!0;return!1}function D(q,B){let H=q.replace(/\\/g,"/"),L=B.replace(/\\/g,"/").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"{{GLOBSTAR}}").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\{\{GLOBSTAR\}\}/g,".*");return L=`^${L}$`,new RegExp(L).test(H)}function U(q,B){let H=z.basename(q,".story.stx");return{id:q.toLowerCase().replace(/\.story\.stx$/,"").replace(/[/\\]/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),path:B,relativePath:q,fileName:H,treeFile:{title:H,path:q}}}function s(q,B){let{root:H,config:J}=q,L=[],Q=_.watch(H,{recursive:!0},async(K,X)=>{if(!X)return;let Z=X.replace(/\\/g,"/");if(!C(Z,J.storyMatch))return;if(S(Z,J.storyIgnored))return;let V=z.resolve(H,Z);try{await _.promises.access(V);let A=U(Z,V);B(K==="rename"?"add":"change",A)}catch{let A=U(Z,V);B("unlink",A)}});return L.push(Q),()=>{for(let K of L)K.close()}}function k(q,B){let H=B.treeFile||{title:B.fileName,path:B.relativePath};if(q.tree.file==="title")return H.title.split("/");if(q.tree.file==="path")return[...B.relativePath.split("/").slice(0,-1),H.title];if(typeof q.tree.file==="function")return q.tree.file(H);return[H.title]}function l(q,B){for(let K of B)K.treePath=k(q,K);let H=(q.tree.groups||[]).map((K)=>({groupConfig:{id:K.id||K.title,title:K.title,include:K.include},treeObject:{}})),J={treeObject:{}};H.push(J);for(let K=0;K<B.length;K++){let X=B[K],Z=F(X,H,J);P(X.treePath,K,Z.treeObject)}let L=q.tree.order==="asc"?(K,X)=>K.localeCompare(X):q.tree.order,Q=[];for(let K of H)if(K===J)Q.push(...j(K.treeObject,L));else if(K.groupConfig&&Object.keys(K.treeObject).length>0)Q.push({group:!0,id:K.groupConfig.id,title:K.groupConfig.title,children:j(K.treeObject,L)});return Q}function F(q,B,H){let J=q.treeFile||{title:q.fileName,path:q.relativePath};for(let L of B)if(L.groupConfig?.include&&L.groupConfig.include(J))return L;return H}function P(q,B,H){let J=H;for(let L=0;L<q.length;L++){let Q=q[L];if(L===q.length-1)if(J[Q]!==void 0){let X=1;while(J[`${Q}-${X}`]!==void 0)X++;J[`${Q}-${X}`]=B}else J[Q]=B;else{if(J[Q]===void 0)J[Q]={};else if(typeof J[Q]==="number"){let X=J[Q];J[Q]={"":X}}J=J[Q]}}}function j(q,B){let H=[];for(let[J,L]of Object.entries(q))if(typeof L==="number")H.push({title:J,index:L});else H.push({title:J,children:j(L,B)});return H.sort((J,L)=>B(J.title,L.title)),H}
|
|
3
|
-
export{v as a,p as b,x as c,b as d,m as e,h as f,g,y as h,c as i,s as j,l as k};
|