@stacksjs/stx 0.2.531 → 0.2.533
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ktmacsqc.js → chunk-01343ehq.js} +2 -2
- package/dist/chunk-0e5nasyf.js +2 -0
- package/dist/chunk-13zbt9py.js +2 -0
- package/dist/{chunk-9w2vmfha.js → chunk-1c4t7ncb.js} +2 -2
- package/dist/{chunk-gxfnmjzp.js → chunk-1xgs9gd5.js} +2 -2
- package/dist/{chunk-hrrxggpx.js → chunk-2bvk0qyd.js} +63 -12
- package/dist/{chunk-cp8f1pv4.js → chunk-2h4f37kx.js} +2 -2
- package/dist/{chunk-q6e45gnw.js → chunk-2kvbg3t5.js} +3 -3
- package/dist/{chunk-8n7qsr17.js → chunk-2n4je46m.js} +2 -2
- package/dist/{chunk-xcfhy5bj.js → chunk-33bzhsyw.js} +2 -2
- package/dist/{chunk-7ybgfk0m.js → chunk-3nk8cnrm.js} +2 -2
- package/dist/{chunk-gsxb0ry9.js → chunk-3r1m3tyr.js} +1 -1
- package/dist/chunk-3zs8yxy0.js +2 -0
- package/dist/{chunk-d3mssbgp.js → chunk-40hbpz2b.js} +5 -5
- package/dist/chunk-4a7v51vh.js +2 -0
- package/dist/{chunk-xtknewf7.js → chunk-4hyhr5r7.js} +1 -1
- package/dist/{chunk-srcv6wvm.js → chunk-4pxc3r1p.js} +4 -4
- package/dist/chunk-4qts8zk7.js +2 -0
- package/dist/{chunk-587ehsxn.js → chunk-4r7s3862.js} +2 -2
- package/dist/chunk-4y2av4ev.js +2 -0
- package/dist/chunk-5g498pdp.js +2 -0
- package/dist/chunk-5gq8m2m7.js +2 -0
- package/dist/chunk-5wx323bm.js +2 -0
- package/dist/{chunk-d2r8t40y.js → chunk-66s4nhp7.js} +2 -2
- package/dist/{chunk-d7x6n702.js → chunk-6dtmants.js} +3 -3
- package/dist/chunk-6rcxtdh3.js +2 -0
- package/dist/{chunk-st79dqpz.js → chunk-6sd4zdtg.js} +1 -1
- package/dist/{chunk-zpdq0kx1.js → chunk-6tnh3cyq.js} +1 -1
- package/dist/chunk-6va8wt88.js +2 -0
- package/dist/chunk-7v2j9bmc.js +2 -0
- package/dist/chunk-7zgtdap7.js +2 -0
- package/dist/{chunk-rsy1r1t2.js → chunk-843y0pfg.js} +4 -4
- package/dist/{chunk-b0tmg1q1.js → chunk-8chxczpj.js} +3 -3
- package/dist/{chunk-b7xdk1g4.js → chunk-8m1y1kyr.js} +5 -5
- package/dist/chunk-90kzf313.js +2 -0
- package/dist/{chunk-m5c2gts6.js → chunk-93n6yv5x.js} +12 -12
- package/dist/chunk-94rg5s6c.js +2 -0
- package/dist/chunk-9674w2gm.js +2 -0
- package/dist/{chunk-tvssmzc2.js → chunk-9p6bt089.js} +3 -3
- package/dist/{chunk-kg77xs08.js → chunk-bczcm7jk.js} +2 -2
- package/dist/{chunk-v38kqjew.js → chunk-bxsehntq.js} +1 -1
- package/dist/{chunk-vg8thz41.js → chunk-c56qtne1.js} +1 -1
- package/dist/chunk-d1jxmhph.js +2 -0
- package/dist/{chunk-5tj6expd.js → chunk-d7zterbp.js} +2 -2
- package/dist/{chunk-mc5agc81.js → chunk-d871008z.js} +4 -4
- package/dist/chunk-dekpf1ry.js +2 -0
- package/dist/chunk-epa1c4q4.js +2 -0
- package/dist/{chunk-95z7yemm.js → chunk-f3q84h7b.js} +2 -2
- package/dist/{chunk-mwte3cbe.js → chunk-fqfqyn48.js} +4 -4
- package/dist/{chunk-qwpgggkj.js → chunk-gnx0fzne.js} +60 -60
- package/dist/chunk-gsc5t942.js +2 -0
- package/dist/chunk-gsm1y1kb.js +2 -0
- package/dist/chunk-gxedmh17.js +2 -0
- package/dist/{chunk-9xq5yer8.js → chunk-h4crv0by.js} +1 -1
- package/dist/{chunk-pr5q4wev.js → chunk-hp8g2q2n.js} +1 -1
- package/dist/{chunk-38w14qs7.js → chunk-hvpzy98g.js} +1 -1
- package/dist/chunk-j9c0yam7.js +2 -0
- package/dist/{chunk-12e4a0ab.js → chunk-jbfad9cc.js} +2 -2
- package/dist/chunk-jv3jj612.js +2 -0
- package/dist/chunk-jvqas8y2.js +2 -0
- package/dist/{chunk-z14e2qyn.js → chunk-k3v13vfr.js} +2 -2
- package/dist/chunk-kcs7hyep.js +2 -0
- package/dist/chunk-kvp0at16.js +2 -0
- package/dist/{chunk-31c1g3rt.js → chunk-m011s2ha.js} +3 -3
- package/dist/{chunk-2jk0vceh.js → chunk-m56m95gk.js} +2 -2
- package/dist/{chunk-7s14bthq.js → chunk-m5fw8jq1.js} +2 -2
- package/dist/chunk-m7jmpech.js +2 -0
- package/dist/chunk-m8n9wxba.js +2 -0
- package/dist/{chunk-fyxydww2.js → chunk-mjdyyekx.js} +2 -2
- package/dist/{chunk-ennxrn5g.js → chunk-nd8v4xgb.js} +5 -5
- package/dist/chunk-ngma9vzc.js +2 -0
- package/dist/{chunk-rtk6n3vh.js → chunk-ngxqydsg.js} +3 -3
- package/dist/{chunk-cxxcy624.js → chunk-nmy4x6dx.js} +4 -4
- package/dist/chunk-pz1mjgsp.js +2 -0
- package/dist/{chunk-er031j13.js → chunk-qfc912e5.js} +2 -2
- package/dist/chunk-qk3ptn6h.js +2 -0
- package/dist/{chunk-03wggzg8.js → chunk-qmza4327.js} +2 -2
- package/dist/{chunk-w3xs6kb9.js → chunk-qqr4rn9p.js} +4 -4
- package/dist/chunk-rx4hz615.js +2 -0
- package/dist/chunk-shf0hd05.js +2 -0
- package/dist/{chunk-3vvppnws.js → chunk-sqb6gkzf.js} +8374 -8374
- package/dist/chunk-t1g1sp2z.js +2 -0
- package/dist/{chunk-9f3m5ecs.js → chunk-tgc645pa.js} +45 -45
- package/dist/{chunk-2dzd2h15.js → chunk-tkvp3rz0.js} +1 -1
- package/dist/{chunk-458etq5a.js → chunk-tqnh98j7.js} +3 -3
- package/dist/chunk-tr9bjtqx.js +2 -0
- package/dist/{chunk-2y6tzn6d.js → chunk-ty1v368m.js} +2 -2
- package/dist/{chunk-fmp8dmt0.js → chunk-v4r8nzf3.js} +1 -1
- package/dist/{chunk-p8yh7mgr.js → chunk-v9vvzdag.js} +2 -2
- package/dist/{chunk-0wvsfs4s.js → chunk-vb4xxpa6.js} +2 -2
- package/dist/chunk-vfnerp7h.js +2 -0
- package/dist/{chunk-tkeabv04.js → chunk-vhfwnvmc.js} +5 -5
- package/dist/{chunk-15r72kw7.js → chunk-vjdj0ex3.js} +1 -1
- package/dist/{chunk-9pztpvvk.js → chunk-wh7xn313.js} +1 -1
- package/dist/chunk-wjt46tdp.js +2 -0
- package/dist/chunk-wxy9re1a.js +2 -0
- package/dist/{chunk-kwvexxey.js → chunk-x607yxrc.js} +3 -3
- package/dist/{chunk-3zyvhf4p.js → chunk-xey01yna.js} +1 -1
- package/dist/{chunk-7b2hj6nt.js → chunk-xwrbrg1q.js} +1 -1
- package/dist/{chunk-9sqjmd9a.js → chunk-y18yvcjb.js} +5 -5
- package/dist/chunk-ydtnskdv.js +2 -0
- package/dist/{chunk-ky25egh1.js → chunk-yw3cqy43.js} +1 -1
- package/dist/{chunk-tyts58ks.js → chunk-z9r3tqyr.js} +1 -1
- package/dist/chunk-zeve89kw.js +2 -0
- package/dist/cli.js +12 -12
- package/dist/client/signals-appearance-runtime.d.ts +2 -0
- package/dist/client/signals-appearance-runtime.js +283 -0
- package/dist/client/signals-authoring-runtime.d.ts +2 -0
- package/dist/client/signals-authoring-runtime.js +187 -0
- package/dist/client/signals-binding-utils-runtime.d.ts +2 -0
- package/dist/client/signals-binding-utils-runtime.js +130 -0
- package/dist/client/signals-bootstrap-runtime.d.ts +4 -0
- package/dist/client/signals-bootstrap-runtime.js +24 -0
- package/dist/client/signals-class-runtime.d.ts +2 -0
- package/dist/client/signals-class-runtime.js +69 -0
- package/dist/client/signals-component-api-runtime.d.ts +1 -0
- package/dist/client/signals-component-api-runtime.js +57 -0
- package/dist/client/signals-component-hydration-runtime.d.ts +2 -0
- package/dist/client/signals-component-hydration-runtime.js +147 -0
- package/dist/client/signals-component-props-runtime.d.ts +2 -0
- package/dist/client/signals-component-props-runtime.js +90 -0
- package/dist/client/signals-conditional-chain-runtime.d.ts +2 -0
- package/dist/client/signals-conditional-chain-runtime.js +39 -0
- package/dist/client/signals-conditional-component-runtime.d.ts +2 -0
- package/dist/client/signals-conditional-component-runtime.js +82 -0
- package/dist/client/signals-container-cleanup-runtime.d.ts +2 -0
- package/dist/client/signals-container-cleanup-runtime.js +42 -0
- package/dist/client/signals-context-runtime.d.ts +2 -0
- package/dist/client/signals-context-runtime.js +48 -0
- package/dist/client/signals-cookie-runtime.d.ts +2 -0
- package/dist/client/signals-cookie-runtime.js +56 -0
- package/dist/client/signals-devtools-runtime.d.ts +2 -0
- package/dist/client/signals-devtools-runtime.js +136 -0
- package/dist/client/signals-dialog-runtime.d.ts +2 -0
- package/dist/client/signals-dialog-runtime.js +195 -0
- package/dist/client/signals-dom-ready-runtime.d.ts +2 -0
- package/dist/client/signals-dom-ready-runtime.js +306 -0
- package/dist/client/signals-drawer-runtime.d.ts +2 -0
- package/dist/client/signals-drawer-runtime.js +39 -0
- package/dist/client/signals-effect-runtime.d.ts +2 -0
- package/dist/client/signals-effect-runtime.js +157 -0
- package/dist/client/signals-event-shorthand-runtime.d.ts +2 -0
- package/dist/client/signals-event-shorthand-runtime.js +88 -0
- package/dist/client/signals-expression-compiler-runtime.d.ts +2 -0
- package/dist/client/signals-expression-compiler-runtime.js +59 -0
- package/dist/client/signals-expression-runtime.d.ts +2 -0
- package/dist/client/signals-expression-runtime.js +67 -0
- package/dist/client/signals-fetch-runtime.d.ts +2 -0
- package/dist/client/signals-fetch-runtime.js +144 -0
- package/dist/client/signals-fetch-transport-runtime.d.ts +2 -0
- package/dist/client/signals-fetch-transport-runtime.js +216 -0
- package/dist/client/signals-for-runtime.d.ts +2 -0
- package/dist/client/signals-for-runtime.js +647 -0
- package/dist/client/signals-globals-runtime.d.ts +2 -0
- package/dist/client/signals-globals-runtime.js +66 -0
- package/dist/client/signals-handler-runtime.d.ts +2 -0
- package/dist/client/signals-handler-runtime.js +80 -0
- package/dist/client/signals-head-runtime.d.ts +2 -0
- package/dist/client/signals-head-runtime.js +92 -0
- package/dist/client/signals-helpers-runtime.d.ts +2 -0
- package/dist/client/signals-helpers-runtime.js +137 -0
- package/dist/client/signals-host-runtime.d.ts +9 -0
- package/dist/client/signals-host-runtime.js +132 -0
- package/dist/client/signals-hydration-audit-runtime.d.ts +2 -0
- package/dist/client/signals-hydration-audit-runtime.js +209 -0
- package/dist/client/signals-hydration-runtime.d.ts +2 -0
- package/dist/client/signals-hydration-runtime.js +52 -0
- package/dist/client/signals-if-chain-runtime.d.ts +2 -0
- package/dist/client/signals-if-chain-runtime.js +283 -0
- package/dist/client/signals-if-runtime.d.ts +2 -0
- package/dist/client/signals-if-runtime.js +346 -0
- package/dist/client/signals-kept-runtime.d.ts +2 -0
- package/dist/client/signals-kept-runtime.js +62 -0
- package/dist/client/signals-lazy-hydration-runtime.d.ts +2 -0
- package/dist/client/signals-lazy-hydration-runtime.js +133 -0
- package/dist/client/signals-lifecycle-runtime.d.ts +2 -0
- package/dist/client/signals-lifecycle-runtime.js +114 -0
- package/dist/client/signals-loop-component-remap-runtime.d.ts +2 -0
- package/dist/client/signals-loop-component-remap-runtime.js +66 -0
- package/dist/client/signals-loop-conditional-runtime.d.ts +2 -0
- package/dist/client/signals-loop-conditional-runtime.js +48 -0
- package/dist/client/signals-loop-row-runtime.d.ts +2 -0
- package/dist/client/signals-loop-row-runtime.js +41 -0
- package/dist/client/signals-manifest-hydration-runtime.d.ts +2 -0
- package/dist/client/signals-manifest-hydration-runtime.js +82 -0
- package/dist/client/signals-model-runtime.d.ts +2 -0
- package/dist/client/signals-model-runtime.js +156 -0
- package/dist/client/signals-mount-runtime.d.ts +1 -0
- package/dist/client/signals-mount-runtime.js +231 -0
- package/dist/client/signals-navigation-runtime.d.ts +2 -0
- package/dist/client/signals-navigation-runtime.js +198 -0
- package/dist/client/signals-optimistic-runtime.d.ts +2 -0
- package/dist/client/signals-optimistic-runtime.js +34 -0
- package/dist/client/signals-overlay-runtime.d.ts +2 -0
- package/dist/client/signals-overlay-runtime.js +352 -0
- package/dist/client/signals-pipe-runtime.d.ts +2 -0
- package/dist/client/signals-pipe-runtime.js +177 -0
- package/dist/client/signals-process-element-runtime.d.ts +1 -0
- package/dist/client/signals-process-element-runtime.js +696 -0
- package/dist/client/signals-proxy-runtime.d.ts +2 -0
- package/dist/client/signals-proxy-runtime.js +78 -0
- package/dist/client/signals-public-api-runtime.d.ts +1 -0
- package/dist/client/signals-public-api-runtime.js +120 -0
- package/dist/client/signals-query-runtime.d.ts +2 -0
- package/dist/client/signals-query-runtime.js +351 -0
- package/dist/client/signals-reactive-core-bootstrap-runtime.d.ts +1 -0
- package/dist/client/signals-reactive-core-bootstrap-runtime.js +30 -0
- package/dist/client/signals-reactive-runtime.d.ts +2 -0
- package/dist/client/signals-reactive-runtime.js +67 -0
- package/dist/client/signals-ref-runtime.d.ts +2 -0
- package/dist/client/signals-ref-runtime.js +33 -0
- package/dist/client/signals-scope-disposal-runtime.d.ts +2 -0
- package/dist/client/signals-scope-disposal-runtime.js +195 -0
- package/dist/client/signals-scope-traversal-runtime.d.ts +2 -0
- package/dist/client/signals-scope-traversal-runtime.js +42 -0
- package/dist/client/signals-show-runtime.d.ts +2 -0
- package/dist/client/signals-show-runtime.js +54 -0
- package/dist/client/signals-spa-load-control-runtime.d.ts +2 -0
- package/dist/client/signals-spa-load-control-runtime.js +42 -0
- package/dist/client/signals-spa-load-runtime.d.ts +2 -0
- package/dist/client/signals-spa-load-runtime.js +187 -0
- package/dist/client/signals-state-runtime.d.ts +2 -0
- package/dist/client/signals-state-runtime.js +125 -0
- package/dist/client/signals-storage-runtime.d.ts +2 -0
- package/dist/client/signals-storage-runtime.js +79 -0
- package/dist/client/signals-store-registry-runtime.d.ts +1 -0
- package/dist/client/signals-store-registry-runtime.js +461 -0
- package/dist/client/signals-style-runtime.d.ts +2 -0
- package/dist/client/signals-style-runtime.js +35 -0
- package/dist/client/signals-suspense-runtime.d.ts +2 -0
- package/dist/client/signals-suspense-runtime.js +59 -0
- package/dist/client/signals-timer-runtime.d.ts +2 -0
- package/dist/client/signals-timer-runtime.js +378 -0
- package/dist/client/signals-toast-runtime.d.ts +2 -0
- package/dist/client/signals-toast-runtime.js +206 -0
- package/dist/client/signals-tooltip-runtime.d.ts +2 -0
- package/dist/client/signals-tooltip-runtime.js +40 -0
- package/dist/client/signals-transition-group-runtime.d.ts +2 -0
- package/dist/client/signals-transition-group-runtime.js +92 -0
- package/dist/client/signals-websocket-runtime.d.ts +2 -0
- package/dist/client/signals-websocket-runtime.js +138 -0
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/runtime/native-host.js +4 -1
- package/dist/pwa.js +3 -3
- package/dist/signals-context-runtime.d.ts +2 -0
- package/dist/signals-drawer-runtime.d.ts +2 -0
- package/dist/signals-host-runtime.d.ts +9 -0
- package/dist/signals-loop-conditional-runtime.d.ts +2 -0
- package/dist/signals-manifest-hydration-runtime.d.ts +2 -0
- package/dist/signals-optimistic-runtime.d.ts +2 -0
- package/dist/signals-overlay-runtime.d.ts +2 -0
- package/dist/signals-scope-disposal-runtime.d.ts +2 -0
- package/dist/signals-spa-load-control-runtime.d.ts +2 -0
- package/dist/signals-storage-runtime.d.ts +2 -0
- package/dist/signals.js +141 -9900
- package/dist/ssg.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-0zmv31nc.js +0 -2
- package/dist/chunk-1cdanx2v.js +0 -2
- package/dist/chunk-1wt5fagh.js +0 -2
- package/dist/chunk-2936t942.js +0 -2
- package/dist/chunk-3dd5zxbt.js +0 -2
- package/dist/chunk-3v91cb0g.js +0 -2
- package/dist/chunk-4cyjdghc.js +0 -2
- package/dist/chunk-5achv4zv.js +0 -2
- package/dist/chunk-5yg6m30k.js +0 -2
- package/dist/chunk-6qzjyr8e.js +0 -2
- package/dist/chunk-785ckss2.js +0 -2
- package/dist/chunk-88kjwkza.js +0 -2
- package/dist/chunk-8bcvb86w.js +0 -2
- package/dist/chunk-8h1zg44w.js +0 -2
- package/dist/chunk-8jtyra19.js +0 -2
- package/dist/chunk-bnsz09pg.js +0 -2
- package/dist/chunk-c9rwnsk7.js +0 -2
- package/dist/chunk-csjax0ej.js +0 -2
- package/dist/chunk-dd31q423.js +0 -2
- package/dist/chunk-dptjyncv.js +0 -2
- package/dist/chunk-et8ejd7k.js +0 -2
- package/dist/chunk-g1kyy5h1.js +0 -2
- package/dist/chunk-h791c7sb.js +0 -2
- package/dist/chunk-h88jcr3k.js +0 -2
- package/dist/chunk-hvvbppt4.js +0 -2
- package/dist/chunk-j4rb9rxx.js +0 -2
- package/dist/chunk-ka7qdsha.js +0 -2
- package/dist/chunk-m4d99a9r.js +0 -2
- package/dist/chunk-m5gdwq1d.js +0 -2
- package/dist/chunk-nz5ekyxn.js +0 -2
- package/dist/chunk-rchwwcxy.js +0 -2
- package/dist/chunk-s5cb4hkj.js +0 -2
- package/dist/chunk-t2mjeezd.js +0 -2
- package/dist/chunk-vk18649m.js +0 -2
- package/dist/chunk-vmfw4svt.js +0 -2
- package/dist/chunk-wbv6vjhm.js +0 -2
- package/dist/chunk-wpnv0naj.js +0 -2
- package/dist/chunk-wv2crxm6.js +0 -2
- package/dist/chunk-xda69f13.js +0 -2
- package/dist/chunk-ym182eg0.js +0 -2
- package/dist/chunk-zah67v44.js +0 -2
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export const SIGNALS_TRANSITION_GROUP_RUNTIME = ` // \u2500\u2500 <TransitionGroup> support (#1742) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
2
|
+
// Class-driven enter/leave + FLIP move animations for keyed :for lists whose
|
|
3
|
+
// parent is a [data-stx-transition-group]. All helpers are self-contained and
|
|
4
|
+
// guarded (no-ops off the happy path), and every transition has a timeout
|
|
5
|
+
// fallback so a missed transitionend (or a layout-less environment) can't hang
|
|
6
|
+
// a leaving node in the DOM. bindFor calls these only when the parent is a
|
|
7
|
+
// group AND the group has already done its initial render (no enter on mount).
|
|
8
|
+
function tgDurationMs(el) {
|
|
9
|
+
try {
|
|
10
|
+
var cs = (typeof getComputedStyle === 'function') ? getComputedStyle(el) : null;
|
|
11
|
+
if (cs) {
|
|
12
|
+
var raw = (cs.transitionDuration || '').split(',')[0].trim();
|
|
13
|
+
var ms = raw.indexOf('ms') >= 0 ? parseFloat(raw) : parseFloat(raw) * 1000;
|
|
14
|
+
if (ms > 0) return ms;
|
|
15
|
+
}
|
|
16
|
+
} catch (e) {}
|
|
17
|
+
return 300;
|
|
18
|
+
}
|
|
19
|
+
function tgOnEnd(el, cb) {
|
|
20
|
+
var done = false;
|
|
21
|
+
function finish() {
|
|
22
|
+
if (done) return;
|
|
23
|
+
done = true;
|
|
24
|
+
try { el.removeEventListener('transitionend', finish); } catch (e) {}
|
|
25
|
+
cb();
|
|
26
|
+
}
|
|
27
|
+
try { el.addEventListener('transitionend', finish); } catch (e) {}
|
|
28
|
+
// Fallback: transitionend may never fire (no real layout, display:none,
|
|
29
|
+
// a dropped event). Always converge.
|
|
30
|
+
setTimeout(finish, tgDurationMs(el) + 60);
|
|
31
|
+
}
|
|
32
|
+
function tgRaf2(fn) {
|
|
33
|
+
var raf = (typeof requestAnimationFrame === 'function') ? requestAnimationFrame : function(f) { return setTimeout(f, 16); };
|
|
34
|
+
raf(function() { raf(fn); });
|
|
35
|
+
}
|
|
36
|
+
function tgEnter(el, name) {
|
|
37
|
+
if (!el || el.nodeType !== 1 || !el.classList) return;
|
|
38
|
+
el.classList.add(name + '-enter-from', name + '-enter-active');
|
|
39
|
+
tgRaf2(function() {
|
|
40
|
+
el.classList.remove(name + '-enter-from');
|
|
41
|
+
el.classList.add(name + '-enter-to');
|
|
42
|
+
tgOnEnd(el, function() { el.classList.remove(name + '-enter-active', name + '-enter-to'); });
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function tgLeave(el, name) {
|
|
46
|
+
if (!el || el.nodeType !== 1 || !el.classList) return false;
|
|
47
|
+
el.classList.add(name + '-leave-from', name + '-leave-active');
|
|
48
|
+
tgRaf2(function() {
|
|
49
|
+
el.classList.remove(name + '-leave-from');
|
|
50
|
+
el.classList.add(name + '-leave-to');
|
|
51
|
+
tgOnEnd(el, function() { if (el.parentNode) el.parentNode.removeChild(el); });
|
|
52
|
+
});
|
|
53
|
+
return true; // took over the DOM removal
|
|
54
|
+
}
|
|
55
|
+
function tgSnapshot(els) {
|
|
56
|
+
var m = new Map();
|
|
57
|
+
for (var i = 0; i < els.length; i++) {
|
|
58
|
+
var el = els[i];
|
|
59
|
+
if (el && el.nodeType === 1 && el.getBoundingClientRect) {
|
|
60
|
+
try { m.set(el, el.getBoundingClientRect()); } catch (e) {}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return m;
|
|
64
|
+
}
|
|
65
|
+
function tgFlip(els, first, name) {
|
|
66
|
+
var moved = [];
|
|
67
|
+
for (var i = 0; i < els.length; i++) {
|
|
68
|
+
var el = els[i];
|
|
69
|
+
if (!el || el.nodeType !== 1 || !first.has(el) || !el.getBoundingClientRect) continue;
|
|
70
|
+
var last, f = first.get(el);
|
|
71
|
+
try { last = el.getBoundingClientRect(); } catch (e) { continue; }
|
|
72
|
+
var dx = f.left - last.left, dy = f.top - last.top;
|
|
73
|
+
if (dx || dy) {
|
|
74
|
+
el.style.transform = 'translate(' + dx + 'px,' + dy + 'px)';
|
|
75
|
+
el.style.transitionDuration = '0s';
|
|
76
|
+
moved.push(el);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (!moved.length) return;
|
|
80
|
+
// Force reflow so the inverted transform is committed before we play it.
|
|
81
|
+
if (els[0] && typeof els[0].offsetHeight === 'number') void els[0].offsetHeight;
|
|
82
|
+
var raf = (typeof requestAnimationFrame === 'function') ? requestAnimationFrame : function(f) { return setTimeout(f, 16); };
|
|
83
|
+
raf(function() {
|
|
84
|
+
moved.forEach(function(el) {
|
|
85
|
+
el.classList.add(name + '-move');
|
|
86
|
+
el.style.transform = '';
|
|
87
|
+
el.style.transitionDuration = '';
|
|
88
|
+
tgOnEnd(el, function() { el.classList.remove(name + '-move'); el.style.transform = ''; el.style.transitionDuration = ''; });
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** WebSocket composable embedded in the generated browser runtime. */
|
|
2
|
+
export declare const SIGNALS_WEBSOCKET_RUNTIME = " // ==========================================================================\n // WebSocket Composable\n // ==========================================================================\n\n function useWebSocket(url, options) {\n options = options || {};\n var ws = state(null);\n var status = state('CLOSED');\n var lastMessage = state(null);\n var error = state(null);\n\n var reconnectAttempts = 0;\n var maxReconnects = options.reconnect === false ? 0 : (options.maxReconnects || 10);\n var reconnectDelay = options.reconnectDelay || 1000;\n var reconnectTimer = null;\n var manualClose = false;\n var listeners = {};\n var subscriptions = {};\n\n function connect() {\n if (ws() && ws().readyState <= 1) return;\n manualClose = false;\n status.set('CONNECTING');\n error.set(null);\n\n var socket = new WebSocket(url);\n\n socket.onopen = function() {\n status.set('OPEN');\n reconnectAttempts = 0;\n // A channel is commonly selected immediately after useWebSocket(),\n // while the native socket is still CONNECTING. Keep that intent and\n // subscribe once the transport is writable. Replaying the set here\n // also restores channels after an automatic reconnect.\n for (var channel in subscriptions) {\n send({ event: 'subscribe', channel: channel });\n }\n if (options.onOpen) options.onOpen(socket);\n };\n\n socket.onmessage = function(event) {\n var data = event.data;\n try { data = JSON.parse(data); } catch(e) {}\n lastMessage.set(data);\n if (options.onMessage) options.onMessage(data, event);\n // Dispatch to channel listeners\n if (data && data.channel && data.event) {\n var key = data.channel + ':' + data.event;\n var fns = listeners[key];\n if (fns) {\n for (var i = 0; i < fns.length; i++) {\n fns[i](data.data);\n }\n }\n }\n };\n\n socket.onerror = function(event) {\n error.set(event);\n if (options.onError) options.onError(event);\n };\n\n socket.onclose = function(event) {\n status.set('CLOSED');\n ws.set(null);\n if (options.onClose) options.onClose(event);\n if (!manualClose && reconnectAttempts < maxReconnects) {\n reconnectAttempts++;\n var delay = reconnectDelay * Math.min(reconnectAttempts, 5);\n reconnectTimer = setTimeout(connect, delay);\n }\n };\n\n ws.set(socket);\n }\n\n function send(data) {\n var socket = ws();\n if (socket && socket.readyState === WebSocket.OPEN) {\n socket.send(typeof data === 'string' ? data : JSON.stringify(data));\n }\n }\n\n function close() {\n manualClose = true;\n if (reconnectTimer) { clearTimeout(reconnectTimer); reconnectTimer = null; }\n var socket = ws();\n if (socket) socket.close();\n }\n\n function subscribe(channel) {\n subscriptions[channel] = true;\n var socket = ws();\n if (socket && socket.readyState === WebSocket.OPEN) {\n send({ event: 'subscribe', channel: channel });\n }\n return {\n listen: function(event, handler) {\n var key = channel + ':' + event;\n if (!listeners[key]) listeners[key] = [];\n listeners[key].push(handler);\n return this;\n },\n leave: function() {\n delete subscriptions[channel];\n send({ event: 'unsubscribe', channel: channel });\n // Remove all listeners for this channel\n var prefix = channel + ':';\n for (var key in listeners) {\n if (key.indexOf(prefix) === 0) {\n delete listeners[key];\n }\n }\n }\n };\n }\n\n if (options.immediate !== false) {\n connect();\n }\n\n onDestroy(function() {\n close();\n listeners = {};\n });\n\n return {\n ws: ws,\n status: status,\n lastMessage: lastMessage,\n error: error,\n send: send,\n close: close,\n connect: connect,\n subscribe: subscribe\n };\n }\n";
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
export const SIGNALS_WEBSOCKET_RUNTIME = ` // ==========================================================================
|
|
2
|
+
// WebSocket Composable
|
|
3
|
+
// ==========================================================================
|
|
4
|
+
|
|
5
|
+
function useWebSocket(url, options) {
|
|
6
|
+
options = options || {};
|
|
7
|
+
var ws = state(null);
|
|
8
|
+
var status = state('CLOSED');
|
|
9
|
+
var lastMessage = state(null);
|
|
10
|
+
var error = state(null);
|
|
11
|
+
|
|
12
|
+
var reconnectAttempts = 0;
|
|
13
|
+
var maxReconnects = options.reconnect === false ? 0 : (options.maxReconnects || 10);
|
|
14
|
+
var reconnectDelay = options.reconnectDelay || 1000;
|
|
15
|
+
var reconnectTimer = null;
|
|
16
|
+
var manualClose = false;
|
|
17
|
+
var listeners = {};
|
|
18
|
+
var subscriptions = {};
|
|
19
|
+
|
|
20
|
+
function connect() {
|
|
21
|
+
if (ws() && ws().readyState <= 1) return;
|
|
22
|
+
manualClose = false;
|
|
23
|
+
status.set('CONNECTING');
|
|
24
|
+
error.set(null);
|
|
25
|
+
|
|
26
|
+
var socket = new WebSocket(url);
|
|
27
|
+
|
|
28
|
+
socket.onopen = function() {
|
|
29
|
+
status.set('OPEN');
|
|
30
|
+
reconnectAttempts = 0;
|
|
31
|
+
// A channel is commonly selected immediately after useWebSocket(),
|
|
32
|
+
// while the native socket is still CONNECTING. Keep that intent and
|
|
33
|
+
// subscribe once the transport is writable. Replaying the set here
|
|
34
|
+
// also restores channels after an automatic reconnect.
|
|
35
|
+
for (var channel in subscriptions) {
|
|
36
|
+
send({ event: 'subscribe', channel: channel });
|
|
37
|
+
}
|
|
38
|
+
if (options.onOpen) options.onOpen(socket);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
socket.onmessage = function(event) {
|
|
42
|
+
var data = event.data;
|
|
43
|
+
try { data = JSON.parse(data); } catch(e) {}
|
|
44
|
+
lastMessage.set(data);
|
|
45
|
+
if (options.onMessage) options.onMessage(data, event);
|
|
46
|
+
// Dispatch to channel listeners
|
|
47
|
+
if (data && data.channel && data.event) {
|
|
48
|
+
var key = data.channel + ':' + data.event;
|
|
49
|
+
var fns = listeners[key];
|
|
50
|
+
if (fns) {
|
|
51
|
+
for (var i = 0; i < fns.length; i++) {
|
|
52
|
+
fns[i](data.data);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
socket.onerror = function(event) {
|
|
59
|
+
error.set(event);
|
|
60
|
+
if (options.onError) options.onError(event);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
socket.onclose = function(event) {
|
|
64
|
+
status.set('CLOSED');
|
|
65
|
+
ws.set(null);
|
|
66
|
+
if (options.onClose) options.onClose(event);
|
|
67
|
+
if (!manualClose && reconnectAttempts < maxReconnects) {
|
|
68
|
+
reconnectAttempts++;
|
|
69
|
+
var delay = reconnectDelay * Math.min(reconnectAttempts, 5);
|
|
70
|
+
reconnectTimer = setTimeout(connect, delay);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
ws.set(socket);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function send(data) {
|
|
78
|
+
var socket = ws();
|
|
79
|
+
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
80
|
+
socket.send(typeof data === 'string' ? data : JSON.stringify(data));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function close() {
|
|
85
|
+
manualClose = true;
|
|
86
|
+
if (reconnectTimer) { clearTimeout(reconnectTimer); reconnectTimer = null; }
|
|
87
|
+
var socket = ws();
|
|
88
|
+
if (socket) socket.close();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function subscribe(channel) {
|
|
92
|
+
subscriptions[channel] = true;
|
|
93
|
+
var socket = ws();
|
|
94
|
+
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
95
|
+
send({ event: 'subscribe', channel: channel });
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
listen: function(event, handler) {
|
|
99
|
+
var key = channel + ':' + event;
|
|
100
|
+
if (!listeners[key]) listeners[key] = [];
|
|
101
|
+
listeners[key].push(handler);
|
|
102
|
+
return this;
|
|
103
|
+
},
|
|
104
|
+
leave: function() {
|
|
105
|
+
delete subscriptions[channel];
|
|
106
|
+
send({ event: 'unsubscribe', channel: channel });
|
|
107
|
+
// Remove all listeners for this channel
|
|
108
|
+
var prefix = channel + ':';
|
|
109
|
+
for (var key in listeners) {
|
|
110
|
+
if (key.indexOf(prefix) === 0) {
|
|
111
|
+
delete listeners[key];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (options.immediate !== false) {
|
|
119
|
+
connect();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
onDestroy(function() {
|
|
123
|
+
close();
|
|
124
|
+
listeners = {};
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
ws: ws,
|
|
129
|
+
status: status,
|
|
130
|
+
lastMessage: lastMessage,
|
|
131
|
+
error: error,
|
|
132
|
+
send: send,
|
|
133
|
+
close: close,
|
|
134
|
+
connect: connect,
|
|
135
|
+
subscribe: subscribe
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
`;
|
package/dist/craft-entry.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Vr,Io,Oo}from"./chunk-m011s2ha.js";import"./chunk-vhfwnvmc.js";import"./chunk-bpr4bkde.js";import"./chunk-2bvk0qyd.js";import"./chunk-d7zterbp.js";import"./chunk-6v1gwdbv.js";import"./chunk-gnx0fzne.js";import"./chunk-y18yvcjb.js";import"./chunk-tkvp3rz0.js";import"./chunk-v9vvzdag.js";import"./chunk-01343ehq.js";import"./chunk-1xgs9gd5.js";import"./chunk-x607yxrc.js";import"./chunk-tqnh98j7.js";import{kd,Eo,Cd,Ed,_o,Ur,To,_d,$o,Td,$d,Ro,Ao,Po}from"./chunk-93n6yv5x.js";import"./chunk-843y0pfg.js";import"./chunk-bczcm7jk.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
|
|
3
3
|
`),scripts:t.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
|
|
5
5
|
`),scripts:t.scripts.join(`
|
|
6
6
|
`),hydrationData:i,metadata:{renderTime:s,cacheHit:!1,totalSize:a.length,componentCount:t.metadata.componentCount}}}function V(t,e){let n=[],r=[],a=[],i=new Map,s=[];return y(t.tree,(o,c)=>{if(o.type==="component"&&o.componentName){if(T(o.componentName))n.push(o.componentName)}if(o.type==="element"&&o.tag){let p=J(o);if(p)s.push(p);if(o.props){for(let[l,f]of Object.entries(o.props))if(l.startsWith("on")&&typeof f==="string"){let g=`handler_${i.size}`;i.set(g,f)}}}if(o.isStatic&&o.type==="element")r.push(b(o));else if(!o.isStatic&&o.type!=="text")a.push(o.tag||o.componentName||"unknown")}),{nativeComponents:n,staticHTML:r,dynamicParts:a,eventHandlers:i,nativeWidgets:s}}function Y(t,e={}){let n=R(t),r=P(n,e),a=new Map,i=[];return y(n.tree,(s)=>{if(s.type==="component"&&s.componentName){if(T(s.componentName)){i.push(s.componentName);let o=`<!--craft:${s.componentName}:${s.hydrationKey||"default"}-->`;a.set(s.hydrationKey||s.componentName,o)}}}),{staticHTML:r,dynamicPlaceholders:a,craftComponents:i}}function M(t){let e={type:"fragment",children:[]},n=e,r=[e],a=t,i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(a.length>0){let s=a.match(/^<(@?[\w-]+)([^>]*)>/);if(s){let[p,l,f]=s,g=z(f),u=l.startsWith("@craft-"),C=u?l:l.toLowerCase(),S={type:u?"component":"element",tag:C,props:g,children:[],componentName:u?C.slice(1):void 0,isStatic:!v(f),hydrationKey:F()};if(n.children=n.children||[],n.children.push(S),!i.has(C)&&!f.endsWith("/"))r.push(S),n=S;a=a.slice(p.length);continue}let o=a.match(/^<\/(@?[\w-]+)>/);if(o){let[p,l]=o,g=l.startsWith("@craft-")?l:l.toLowerCase();while(r.length>1){let u=r.pop();if(n=r[r.length-1],u.tag===g)break}a=a.slice(p.length);continue}let c=a.match(/^[^<]+/);if(c){let p=c[0];if(p.trim()){let l={type:"text",text:p,isStatic:!v(p)};n.children=n.children||[],n.children.push(l)}a=a.slice(p.length);continue}a=a.slice(1)}return e}function z(t){let e={},n=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,r;while((r=n.exec(t))!==null){let[,a,i,s,o]=r,c=i??s??o??!0;e[a]=c}return e}function y(t,e,n=[]){if(e(t,n),t.children)t.children.forEach((r,a)=>{y(r,e,[...n,`${a}`])})}function h(t,e){switch(t.type){case"text":return x(t.text||"",e);case"element":case"component":{let n=t.tag||"div",r=N(t.props||{},e),a=(t.children||[]).map((i)=>h(i,e)).join("");if(!t.children||t.children.length===0){if(["input","br","hr","img","meta","link"].includes(n))return`<${n}${r} />`}return`<${n}${r}>${a}</${n}>`}case"fragment":return(t.children||[]).map((n)=>h(n,e)).join("");case"slot":return`<!--slot:${t.slotName||"default"}-->`;default:return""}}function b(t){if(t.type==="text")return t.text||"";let e=t.tag||"div",n=N(t.props||{},{});return`<${e}${n}></${e}>`}function N(t,e){let n=[];for(let[r,a]of Object.entries(t))if(a===!0)n.push(` ${r}`);else if(a!==!1&&a!==null&&a!==void 0){let i=x(String(a),e);n.push(` ${r}="${k(i)}"`)}return n.join("")}async function H(t,e){return h(t,e)}function P(t,e){let n=[];return y(t.tree,(r)=>{if(r.isStatic)n.push(h(r,e))}),n.join("")}function j(t,e,n){let r={templateId:e.id,context:n,dynamicParts:Array.from(e.dynamicParts.entries())},a=`
|
|
7
7
|
<script data-craft-hydration>
|
|
8
8
|
window.__CRAFT_HYDRATION__ = ${JSON.stringify(r)};
|
|
9
|
-
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{kd as CRAFT_BRIDGE_SCRIPT,
|
|
9
|
+
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{kd as CRAFT_BRIDGE_SCRIPT,Ur as CRAFT_COMPONENTS,_d as CRAFT_COMPONENT_RUNTIME,To as CRAFT_COMPONENT_STYLES,Vr as NATIVE_COMPONENTS,Ro as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Io as compileToNative,Oo as createHotReloadServer,Eo as generateCraftBridgeScript,V as generateCraftOptimizations,Po as getAvailableFormats,Ao as getAvailableTargets,$d as getCraftComponents,G as getSSRCacheStats,_o as injectCraftBridge,Cd as isCraftEnvironment,Y as prerenderForCraft,$o as processCraftComponents,Ed as processCraftDirective,Td as registerCraftComponent,Q as renderSSR};
|
package/dist/craft.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Vr,Io,Oo}from"./chunk-m011s2ha.js";import"./chunk-vhfwnvmc.js";import"./chunk-bpr4bkde.js";import"./chunk-2bvk0qyd.js";import"./chunk-d7zterbp.js";import"./chunk-6v1gwdbv.js";import"./chunk-gnx0fzne.js";import"./chunk-y18yvcjb.js";import"./chunk-tkvp3rz0.js";import"./chunk-v9vvzdag.js";import"./chunk-01343ehq.js";import"./chunk-1xgs9gd5.js";import"./chunk-x607yxrc.js";import"./chunk-tqnh98j7.js";import{kd,Eo,Cd,Ed,_o,Ur,To,_d,$o,Td,$d,Ro,Ao,Po}from"./chunk-93n6yv5x.js";import"./chunk-843y0pfg.js";import"./chunk-bczcm7jk.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
|
|
3
3
|
`),scripts:t.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
|
|
5
5
|
`),scripts:t.scripts.join(`
|
|
6
6
|
`),hydrationData:i,metadata:{renderTime:s,cacheHit:!1,totalSize:a.length,componentCount:t.metadata.componentCount}}}function V(t,e){let n=[],r=[],a=[],i=new Map,s=[];return y(t.tree,(o,c)=>{if(o.type==="component"&&o.componentName){if(T(o.componentName))n.push(o.componentName)}if(o.type==="element"&&o.tag){let p=J(o);if(p)s.push(p);if(o.props){for(let[l,f]of Object.entries(o.props))if(l.startsWith("on")&&typeof f==="string"){let g=`handler_${i.size}`;i.set(g,f)}}}if(o.isStatic&&o.type==="element")r.push(b(o));else if(!o.isStatic&&o.type!=="text")a.push(o.tag||o.componentName||"unknown")}),{nativeComponents:n,staticHTML:r,dynamicParts:a,eventHandlers:i,nativeWidgets:s}}function Y(t,e={}){let n=R(t),r=P(n,e),a=new Map,i=[];return y(n.tree,(s)=>{if(s.type==="component"&&s.componentName){if(T(s.componentName)){i.push(s.componentName);let o=`<!--craft:${s.componentName}:${s.hydrationKey||"default"}-->`;a.set(s.hydrationKey||s.componentName,o)}}}),{staticHTML:r,dynamicPlaceholders:a,craftComponents:i}}function M(t){let e={type:"fragment",children:[]},n=e,r=[e],a=t,i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(a.length>0){let s=a.match(/^<(@?[\w-]+)([^>]*)>/);if(s){let[p,l,f]=s,g=z(f),u=l.startsWith("@craft-"),C=u?l:l.toLowerCase(),S={type:u?"component":"element",tag:C,props:g,children:[],componentName:u?C.slice(1):void 0,isStatic:!v(f),hydrationKey:F()};if(n.children=n.children||[],n.children.push(S),!i.has(C)&&!f.endsWith("/"))r.push(S),n=S;a=a.slice(p.length);continue}let o=a.match(/^<\/(@?[\w-]+)>/);if(o){let[p,l]=o,g=l.startsWith("@craft-")?l:l.toLowerCase();while(r.length>1){let u=r.pop();if(n=r[r.length-1],u.tag===g)break}a=a.slice(p.length);continue}let c=a.match(/^[^<]+/);if(c){let p=c[0];if(p.trim()){let l={type:"text",text:p,isStatic:!v(p)};n.children=n.children||[],n.children.push(l)}a=a.slice(p.length);continue}a=a.slice(1)}return e}function z(t){let e={},n=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,r;while((r=n.exec(t))!==null){let[,a,i,s,o]=r,c=i??s??o??!0;e[a]=c}return e}function y(t,e,n=[]){if(e(t,n),t.children)t.children.forEach((r,a)=>{y(r,e,[...n,`${a}`])})}function h(t,e){switch(t.type){case"text":return x(t.text||"",e);case"element":case"component":{let n=t.tag||"div",r=N(t.props||{},e),a=(t.children||[]).map((i)=>h(i,e)).join("");if(!t.children||t.children.length===0){if(["input","br","hr","img","meta","link"].includes(n))return`<${n}${r} />`}return`<${n}${r}>${a}</${n}>`}case"fragment":return(t.children||[]).map((n)=>h(n,e)).join("");case"slot":return`<!--slot:${t.slotName||"default"}-->`;default:return""}}function b(t){if(t.type==="text")return t.text||"";let e=t.tag||"div",n=N(t.props||{},{});return`<${e}${n}></${e}>`}function N(t,e){let n=[];for(let[r,a]of Object.entries(t))if(a===!0)n.push(` ${r}`);else if(a!==!1&&a!==null&&a!==void 0){let i=x(String(a),e);n.push(` ${r}="${k(i)}"`)}return n.join("")}async function H(t,e){return h(t,e)}function P(t,e){let n=[];return y(t.tree,(r)=>{if(r.isStatic)n.push(h(r,e))}),n.join("")}function j(t,e,n){let r={templateId:e.id,context:n,dynamicParts:Array.from(e.dynamicParts.entries())},a=`
|
|
7
7
|
<script data-craft-hydration>
|
|
8
8
|
window.__CRAFT_HYDRATION__ = ${JSON.stringify(r)};
|
|
9
|
-
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{kd as CRAFT_BRIDGE_SCRIPT,
|
|
9
|
+
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{kd as CRAFT_BRIDGE_SCRIPT,Ur as CRAFT_COMPONENTS,_d as CRAFT_COMPONENT_RUNTIME,To as CRAFT_COMPONENT_STYLES,Vr as NATIVE_COMPONENTS,Ro as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Io as compileToNative,Oo as createHotReloadServer,Eo as generateCraftBridgeScript,V as generateCraftOptimizations,Po as getAvailableFormats,Ao as getAvailableTargets,$d as getCraftComponents,G as getSSRCacheStats,_o as injectCraftBridge,Cd as isCraftEnvironment,Y as prerenderForCraft,$o as processCraftComponents,Ed as processCraftDirective,Td as registerCraftComponent,Q as renderSSR};
|
|
@@ -3,6 +3,9 @@ import { resolveIconName } from "../compiler/icons.js";
|
|
|
3
3
|
import { affectsGeometry, parseSvgMarkup, parseViewBox, SVG_NODE_TYPES, svgGeometry } from "../compiler/svg.js";
|
|
4
4
|
import { nativePropName } from "../prop-names.js";
|
|
5
5
|
import { cloneNativeBindingNode } from "./binding-tree.js";
|
|
6
|
+
function irDisplay(value) {
|
|
7
|
+
return value === "none" || value === "grid" || value === "flex" ? value : "flex";
|
|
8
|
+
}
|
|
6
9
|
function eventAt(payload, node) {
|
|
7
10
|
if (payload === void 0 || payload === null)
|
|
8
11
|
return { target: node, currentTarget: node };
|
|
@@ -449,7 +452,7 @@ export function createNativeHost(options) {
|
|
|
449
452
|
record.baseStyle.display = record.shownDisplay;
|
|
450
453
|
record.shownDisplay = void 0;
|
|
451
454
|
}
|
|
452
|
-
const display = visible ? resolveStyle(record).display
|
|
455
|
+
const display = visible ? irDisplay(resolveStyle(record).display) : "none";
|
|
453
456
|
if (record.materialized)
|
|
454
457
|
emit({ op: "updateNode", id: node.__stxId, patch: { style: { display } } });
|
|
455
458
|
return was;
|
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Bn,Ne,Ho,
|
|
3
|
-
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-
|
|
2
|
+
import{Bn,Ne,Ho,Xa}from"./chunk-m56m95gk.js";import{jn,Wr,qa,Ga,Ka}from"./chunk-6dtmants.js";import{Bo,Fo,zo,Va,Wa}from"./chunk-66s4nhp7.js";import{ie,ht,qr}from"./chunk-6abvk7vj.js";import{Zc,Qc,el,tl,mr,wu}from"./chunk-r6gxy92f.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
|
|
3
|
+
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-9674w2gm.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),e.success=!1,
|
|
|
233
233
|
}, 5000);
|
|
234
234
|
</script>
|
|
235
235
|
</body>
|
|
236
|
-
</html>`}function b(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=ie(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Bn(n,t);if(a){let s=Ne(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Wr(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,Fo as auditBuildOutput,Bo as auditConfig,re as buildPwaAssets,zo as calculateAuditResult,Wa as formatAuditResult,qr as formatSize,j as generateManifest,_ as generateManifestJson,
|
|
236
|
+
</html>`}function b(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=ie(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Bn(n,t);if(a){let s=Ne(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Wr(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,Fo as auditBuildOutput,Bo as auditConfig,re as buildPwaAssets,zo as calculateAuditResult,Wa as formatAuditResult,qr as formatSize,j as generateManifest,_ as generateManifestJson,Ga as generateManifestLink,F as generateOfflinePage,ie as generatePrecacheManifest,ht as generatePrecacheManifestJs,M as generatePwaIcons,jn as generatePwaTags,Bn as generateServiceWorker,Xa as generateServiceWorkerAuto,qa as generateSwRegistrationScript,Ka as generateThemeColorMeta,N as getExpectedIconPaths,Ne as getServiceWorkerFileName,Wr as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,Ho as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,mr as pwaDirectives,Zc as pwaInstallDirective,el as pwaOfflineDirective,tl as pwaPushDirective,Qc as pwaUpdateDirective,wu as registerPwaDirectives,Va as runPwaAudit,D as validateManifest};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Computed helpers and component value sharing for the client runtime. */
|
|
2
|
+
export declare const SIGNALS_CONTEXT_RUNTIME = " // ==========================================================================\n // Public API\n // ==========================================================================\n\n // ==========================================================================\n // $: Computed Shorthand Support (Feature #7)\n // ==========================================================================\n\n // Helper function for $: reactive declarations (transformed by compiler)\n // Usage: $computed(() => count * 2) is shorthand for derived()\n function $computed(fn) {\n return derived(fn);\n }\n\n // Helper for watching a value with auto-unwrap\n function $watch(deps, fn) {\n effect(() => {\n // Access all dependencies to track them\n const values = Array.isArray(deps) ? deps.map(d => {\n if (typeof d === 'function' && (d._isSignal || d._isDerived)) return d();\n return d;\n }) : (typeof deps === 'function' && (deps._isSignal || deps._isDerived)) ? [deps()] : [deps];\n\n fn(...values);\n });\n }\n\n // provide() \u2014 share values across components (like Vue's provide/inject)\n // Usage: provide('Modal', Modal) \u2014 makes Modal accessible in all components\n //\n // inject() was auto-imported but implemented nowhere, so half of the pair\n // worked: provide() succeeded and the failure surfaced only in the consumer\n // (#1804). Values are recorded in a private registry as well as on window,\n // because the global write collides with native properties \u2014 provide('name',\n // x) lands on window.name, which the browser coerces to a string.\n var __stxProvided = Object.create(null);\n\n function provide(name, value) {\n __stxProvided[name] = value;\n window[name] = value;\n }\n\n function inject(name, defaultValue) {\n if (name in __stxProvided) return __stxProvided[name];\n if (name in window) return window[name];\n return defaultValue;\n }\n";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Drawer controls used by the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_DRAWER_RUNTIME = " // \u2500\u2500 Drawer system \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Same pattern as modal but slides from a side\n var drawer = {\n open: function(id) {\n var el = document.querySelector('[data-stx-drawer=\"' + id + '\"]');\n if (!el) { console.warn('[stx:drawer] Drawer \"' + id + '\" not found'); return; }\n el.style.display = 'flex';\n // Force reflow then animate\n void el.offsetHeight;\n el.setAttribute('data-stx-drawer-open', '');\n // The lock, Escape for the topmost and the Tab trap come from the\n // overlay stack, shared with every other overlay (stacksjs/stx#2057).\n // Each drawer used to bind its own Escape and set body overflow itself,\n // so two open closed together and the first to close unlocked the page.\n overlays.open('stx-drawer:' + id, {\n panel: el,\n onEscape: el.getAttribute('data-close-escape') !== 'false' ? function() { drawer.close(id); } : null\n });\n if (el.getAttribute('data-close-backdrop') !== 'false') {\n el.onclick = function(e) { if (e.target === el) drawer.close(id); };\n }\n },\n close: function(id) {\n var el = document.querySelector('[data-stx-drawer=\"' + id + '\"]');\n if (!el) return;\n el.removeAttribute('data-stx-drawer-open');\n el.onclick = null;\n overlays.close('stx-drawer:' + id);\n setTimeout(function() {\n if (!el.hasAttribute('data-stx-drawer-open')) el.style.display = 'none';\n }, 300);\n },\n toggle: function(id) {\n var el = document.querySelector('[data-stx-drawer=\"' + id + '\"]');\n if (el && el.hasAttribute('data-stx-drawer-open')) drawer.close(id);\n else drawer.open(id);\n }\n };\n";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default browser host used by the generated signals runtime.
|
|
3
|
+
*
|
|
4
|
+
* Keeping this as source text lets the same binding runtime swap in a native
|
|
5
|
+
* host through `window.__stx_host` without coupling reactive primitives to the
|
|
6
|
+
* DOM. The leading indentation and trailing blank line are intentional: this
|
|
7
|
+
* fragment is interpolated directly into the generated runtime.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SIGNALS_HOST_RUNTIME = " // \u2500\u2500 Host \u2500\u2500\n //\n // The tree this runtime mutates. Every write the binding layer makes to a\n // node goes through here, so the same runtime can drive something that is not\n // the document -- native views over a bridge (stacksjs/stx#1984).\n //\n // Signals never touch a node, so nothing above this line needs to change; the\n // coupling is entirely in the bind layer. A host is swapped in by assigning\n // window.__stx_host before the runtime executes. The name is stxHost, not\n // host, because the runtime already calls two local DOM nodes host -- a\n // shadowed adapter fails as node.anchor is not a function, deep inside a\n // branch swap, and nowhere near the line that caused it, which keeps the web path\n // exactly as it was: same calls, one property lookup earlier.\n var stxHost = window.__stx_host || {\n setText: function(node, value) { node.textContent = value; },\n setMarkup: function(node, value) { node.innerHTML = value == null ? '' : value; },\n setAttribute: function(node, name, value) {\n if (value === false) { node.removeAttribute(name); return; }\n if (value === true) { node.setAttribute(name, ''); return; }\n var next = value;\n if (typeof value === 'object' && value !== null) {\n try { next = JSON.stringify(value); }\n catch (e) { next = String(value); }\n }\n node.setAttribute(name, next);\n },\n removeAttribute: function(node, name) { node.removeAttribute(name); },\n setStyle: function(node, value) {\n if (typeof value === 'object' && value !== null) {\n Object.assign(node.style, value);\n if (Object.prototype.hasOwnProperty.call(value, 'display')) node.__stx_display = value.display || '';\n }\n else if (typeof value === 'string') {\n node.style.cssText = value;\n node.__stx_display = node.style.display || '';\n }\n // Reactive style updates must not clear the display:none owned by :show.\n // This also keeps the latest explicit display for when the gate opens.\n if (node.__stx_visible === false) node.style.display = 'none';\n },\n\n // Structural operations, for the bindings that build rows rather than\n // update one node (#1984).\n //\n // anchor() is a position in the child list that survives the nodes around\n // it moving -- a comment node here, since the document has one; a native\n // host keeps an index or a zero-size sentinel.\n //\n // clone() is the one that does not carry over as-is: a DOM subtree can be\n // deep-copied, a native view hierarchy cannot. A native host materialises a\n // fresh subtree from the template it was given instead of copying views,\n // which is why the row template is passed rather than a node to duplicate.\n // A native host registers the handler against the view and has the platform\n // call it; nothing about the binding layer changes, which is the point.\n // The options argument carries passive/capture/once. A native host has no use for\n // passive -- there is no scroll thread to block -- but dropping the\n // parameter silently makes every touch listener blocking again, so it stays\n // in the signature and each host decides what to do with it.\n listen: function(node, event, handler, options) { node.addEventListener(event, handler, options); },\n\n // Returns the PREVIOUS visibility. bindShow needs to know whether it just\n // revealed something, and asking the node afterwards is the one read-back\n // in the binding layer -- a native host cannot answer what a UIView's\n // display value was, because it has none. A write that reports what it\n // replaced removes the question: the DOM host reads its own style, a native\n // host reads isHidden, and the binder reads neither.\n //\n // Restoring an explicit display (a flex row, an inline-block) is the host's\n // business too; it records it the first time it hides the node.\n // The scope root a node belongs to: nearest ancestor-or-self that owns a\n // scope, or null. Three binding paths need it -- ref ownership, and an\n // if-chain finding the scope its branch belongs to.\n //\n // Not a query method. A host is never handed a selector, because a native\n // view tree has nothing to match one against: the DOM host walks with\n // closest(), a native host reads the node-to-scope map it maintains as it\n // creates views. The from flag skips the node itself, which the ref path needs\n // when it walks outward past a receiver it has already rejected.\n scopeOf: function(node, from) {\n var start = from ? (node && node.parentElement) : node;\n return (start && start.closest) ? start.closest('[data-stx-scope]') : null;\n },\n\n setVisible: function(node, visible) {\n if (node.__stx_display === undefined) {\n var d = node.style.display;\n node.__stx_display = (d && d !== 'none') ? d : '';\n }\n var was = node.style.display !== 'none';\n node.__stx_visible = visible;\n node.style.display = visible ? node.__stx_display : 'none';\n return was;\n },\n\n anchor: function(label) { return document.createComment(label); },\n clone: function(node) { return node.cloneNode(true); },\n insert: function(parent, node, before) { parent.insertBefore(node, before); },\n remove: function(node) { if (node.parentNode) node.parentNode.removeChild(node); },\n\n // Teardown needs to reach a subtree, and both ways of reaching one were\n // selector queries -- the last DOM assumption left in the binding layer\n // (#1984). A view hierarchy has no selectors, and a native host already\n // knows what it built, so being asked is cheaper for it than searching is\n // for the document.\n //\n // descendants() is every node under this one, for the per-node teardown\n // state the runtime hangs off elements. scopesIn() is the scope IDS in the\n // subtree, this node included -- ids and not nodes, because the only thing\n // done with them is a lookup in window.stx._scopes.\n descendants: function(node) {\n var out = [];\n if (!node || !node.querySelectorAll) return out;\n var all = node.querySelectorAll('*');\n for (var i = 0; i < all.length; i++) out.push(all[i]);\n return out;\n },\n scopesIn: function(node) {\n var ids = [];\n if (!node) return ids;\n var own = node.getAttribute && node.getAttribute('data-stx-scope');\n if (own) ids.push(own);\n if (node.querySelectorAll) {\n var matches = node.querySelectorAll('[data-stx-scope]');\n for (var i = 0; i < matches.length; i++) {\n var id = matches[i].getAttribute('data-stx-scope');\n if (id) ids.push(id);\n }\n }\n return ids;\n }\n };\n";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Loop-row conditional deferral for the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_LOOP_CONDITIONAL_RUNTIME = " // A :for row is a clone of its template, so a conditional element in the row\n // is built for every row whether or not its condition ever holds; :if then\n // parks the false ones. In WebKit a <video> or <audio> sets up a media player\n // as it is created: a message list with one media slot per attachment took\n // 1.8s to render instead of 18ms, and every row paid for elements it never\n // showed. Before any row is cloned, each eligible conditional element in the\n // row template is moved into a <template> carrying its condition. Template\n // content is inert, so a cloned row builds the element only when the\n // condition holds (bindIf clones template content on the first true).\n //\n // Left alone: an if/else chain (its branches must stay siblings), an element\n // that is also a loop, a component (its setup script is a sibling), and\n // anything holding a script.\n var IF_ATTRS = [':if', 'x-if', '@if'];\n var FOR_ATTRS = [':for', 'x-for', '@for'];\n function deferRowConditionals(root) {\n if (!root || !root.querySelectorAll || typeof document === 'undefined' || !document.createElement) return;\n // Inert HTML template content is a DOM allocation optimisation. Native\n // hosts already clone recorded descriptors and bind conditions through\n // their host operations; their document facade has no template content.\n if (!document.createElement('template').content) return;\n // A walk, not a selector: escaping ':' and '@' in an attribute selector\n // through this generated source is easy to get wrong, and wrong throws.\n var candidates = Array.prototype.slice.call(root.querySelectorAll('*'));\n for (var i = 0; i < candidates.length; i++) {\n var el = candidates[i];\n if (el.tagName === 'TEMPLATE' || !el.parentNode) continue;\n var attr = null;\n for (var a = 0; a < IF_ATTRS.length; a++) {\n if (el.hasAttribute(IF_ATTRS[a])) { attr = IF_ATTRS[a]; break; }\n }\n if (!attr) continue;\n var skip = false;\n for (var f = 0; f < FOR_ATTRS.length; f++) {\n if (el.hasAttribute(FOR_ATTRS[f])) skip = true;\n }\n if (skip || getElseAttrInfo(el)) continue;\n var next = el.nextElementSibling;\n if (next && (getElseAttrInfo(next) || next.tagName === 'SCRIPT')) continue;\n if (el.hasAttribute('data-stx-scope') || el.hasAttribute('x-data') || el.querySelector('script')) continue;\n var holder = document.createElement('template');\n holder.setAttribute(attr, el.getAttribute(attr));\n el.removeAttribute(attr);\n el.parentNode.insertBefore(holder, el);\n holder.content.appendChild(el);\n }\n }\n";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Manifest-driven browser and native hydration for the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_MANIFEST_HYDRATION_RUNTIME = " /**\n * Bind what the server said carries a binding, instead of looking for it.\n *\n * The walk exists because the runtime does not know where the bindings are.\n * The server does -- it rendered them -- so when it ships that list the\n * runtime stops searching: resolve each id, bind that element, never touch\n * its children. An element with no bindings is never visited at all.\n *\n * This is the piece a native host needs. A view hierarchy has no attributes\n * to read and no selector to match, so discovery cannot happen there; handed\n * the list, it does not have to. On the DOM the ids resolve by attribute,\n * which is one query per entry rather than a full traversal.\n *\n * Absent a manifest nothing changes: the walk is still the default, and a\n * page that ships no list hydrates exactly as it did.\n */\n function processFromManifest(root, scope, manifest, resolvedNodes) {\n // Arrays have an entries() method too. Prefer the array itself before\n // accepting the compiled document shape { entries: [...] }.\n var entries = Array.isArray(manifest)\n ? manifest\n : (manifest && Array.isArray(manifest.entries) ? manifest.entries : null);\n if (!entries || !entries.length || (!root && !resolvedNodes)) return false;\n for (var i = 0; i < entries.length; i++) {\n var entry = entries[i];\n var id = entry && entry.id;\n if (id === undefined || id === null) continue;\n // Native compilation already has stable handles for every manifest id.\n // Accept those handles directly so a non-DOM host never needs selectors\n // or an attribute walk. The browser keeps its existing lookup fallback.\n var node = resolvedNodes\n ? (typeof resolvedNodes.get === 'function' ? resolvedNodes.get(id) : resolvedNodes[id])\n : null;\n if (!node && root) {\n node = root.getAttribute && root.getAttribute('data-stx-b') === String(id)\n ? root\n : (root.querySelector ? root.querySelector('[data-stx-b=\"' + id + '\"]') : null);\n }\n if (!node) continue;\n // A structural binding can detach its source before a later manifest\n // entry reaches one of that source's children. Native handles expose\n // this state directly; do not register effects or handlers for a view\n // that no longer exists in the host tree. Browser hydration keeps its\n // existing behaviour because it does not pass resolvedNodes here.\n if (resolvedNodes && node.__stxId !== undefined && node.isConnected === false) continue;\n processElement(node, scope, true);\n }\n return true;\n }\n\n // Bind a precompiled host tree without waiting for DOMContentLoaded. Native\n // passes its manifest id to node-handle table; browser hydration continues\n // through the document-ready path below. The same state, effect, expression,\n // event and host implementations are used by both.\n function hydrateHost(root, setup, manifest, resolvedNodes) {\n var mountStart = mountCallbacks.length;\n var destroyStart = destroyCallbacks.length;\n var outerSink = activeDestroySink;\n activeDestroySink = null;\n var values;\n try { values = typeof setup === 'function' ? setup() : setup; }\n finally { activeDestroySink = outerSink; }\n var localMountHooks = mountCallbacks.splice(mountStart);\n var localDestroyHooks = destroyCallbacks.splice(destroyStart);\n var scope = Object.assign({ $refs: {} }, values || {});\n var disposeEffects = trackEffects(function() {\n processFromManifest(root, scope, manifest, resolvedNodes);\n });\n runMountCallbacks(localMountHooks, localDestroyHooks);\n var mounted = true;\n return function disposeHost() {\n if (!mounted) return;\n mounted = false;\n disposeEffects();\n var hooks = localDestroyHooks.splice(0, localDestroyHooks.length);\n for (var i = 0; i < hooks.length; i++) {\n try { hooks[i](); }\n catch (e) { console.warn('[stx] native destroy error:', e); }\n }\n };\n }\n";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Optimistic state overlay used by the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_OPTIMISTIC_RUNTIME = " // ==========================================================================\n // Optimistic State (useOptimistic) \u2014 stacksjs/stx#1742\n // ==========================================================================\n // Mirrors signals-api.ts useOptimistic. Shows base + pending actions while an\n // async action is in flight; the overlay is discarded the moment base changes\n // (server confirmed). Returns [optimistic, addOptimistic]. addOptimistic\n // returns a settle() to roll back; pass a promise as the 2nd arg to auto-settle.\n function useOptimistic(base, reducer) {\n var readBase = (typeof base === 'function') ? base : function() { return base; };\n var pending = state([]);\n var optimistic = derived(function() {\n return pending().reduce(function(acc, entry) { return reducer(acc, entry.action); }, readBase());\n });\n var primed = false;\n effect(function() {\n readBase(); // track base only\n if (!primed) { primed = true; return; }\n if (peek(function() { return pending().length; })) pending.set([]);\n });\n function addOptimistic(action, settleWhen) {\n var entry = { action: action };\n pending.set(pending().concat([entry]));\n var settle = function() {\n var next = pending().filter(function(e) { return e !== entry; });\n if (next.length !== pending().length) pending.set(next);\n };\n if (settleWhen && typeof settleWhen.then === 'function') {\n Promise.resolve(settleWhen).then(settle, settle);\n }\n return settle;\n }\n return [optimistic, addOptimistic];\n }\n";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Shared overlay stack and modal facade used by the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_OVERLAY_RUNTIME = " // \u2500\u2500 Overlay stack \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n //\n // One stack for everything that takes over the page: stxAlert/stxConfirm,\n // the runtime modal and drawer, @stacksjs/components' Dialog and Drawer, and\n // anything an app draws itself (window.stx.overlays). Each of those used to\n // keep its own listener, its own scroll lock and its own idea of whether it\n // was on top, so with one open over another a single Escape closed both, two\n // Tab traps fought over focus, and the first to close unlocked the page under\n // the one still open (stacksjs/stx#2057; #1998 fixed the same thing for the\n // confirm dialogs alone).\n //\n // Only the topmost overlay answers Escape and owns Tab. The page is locked\n // from the first open to the last close. Focus moves into an overlay when it\n // opens and back to whatever opened it when it closes.\n //\n // A popup - a menu, a listbox, a popover - goes on the same stack as a\n // non-modal layer (modal: false). It takes Escape while it is on top, so one\n // Escape inside a dialog closes the menu and leaves the dialog, but it does\n // not lock the page, trap Tab or move focus: those follow the topmost MODAL\n // layer. Each popup used to listen for Escape on the document itself, and\n // whichever listener was registered first won.\n var _overlays = [];\n var _overlayScroll = null;\n var _overlayInerted = [];\n var _overlayListening = false;\n var _OVERLAY_FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\n function _overlayTop() {\n return _overlays.length ? _overlays[_overlays.length - 1] : null;\n }\n\n // The layer that owns Tab and the page lock: the topmost modal one.\n function _overlayTopModal() {\n for (var i = _overlays.length - 1; i >= 0; i--) {\n if (_overlays[i].modal) return _overlays[i];\n }\n return null;\n }\n\n function _overlayIndex(id) {\n for (var i = 0; i < _overlays.length; i++) {\n if (_overlays[i].id === id) return i;\n }\n return -1;\n }\n\n // The panel is asked for, not held: a component's panel may not be rendered\n // yet on the frame it opens, and may be replaced while open.\n function _overlayPanel(entry) {\n var panel = entry && entry.panel;\n try {\n // A selector is looked up each time, like a function: the element it\n // names may be rendered after the overlay opens, or replaced while open.\n if (typeof panel === 'string') panel = document.querySelector(panel);\n else if (typeof panel === 'function') panel = panel();\n }\n catch (_e) { panel = null; }\n return panel || entry.root || null;\n }\n\n function _overlayShown(nodes) {\n return Array.prototype.filter.call(nodes, function(el) {\n return el.offsetParent !== null || el === document.activeElement;\n });\n }\n\n function _overlayFocusable(panel) {\n return _overlayShown(panel.querySelectorAll(_OVERLAY_FOCUSABLE));\n }\n\n // One listener for every overlay, in the bubble phase: a widget inside an\n // overlay that consumes Escape (a menu closing itself) calls preventDefault\n // and the overlay leaves it alone.\n function _overlayKey(e) {\n var top = _overlayTop();\n if (!top) return;\n if (e.key === 'Escape') {\n if (e.defaultPrevented || !top.onEscape) return;\n e.preventDefault();\n top.onEscape();\n return;\n }\n if (e.key !== 'Tab') return;\n var trap = _overlayTopModal();\n if (!trap) return;\n var panel = _overlayPanel(trap);\n if (!panel) return;\n var items = _overlayFocusable(panel);\n if (!items.length) {\n e.preventDefault();\n if (panel.focus) panel.focus();\n return;\n }\n var first = items[0];\n var last = items[items.length - 1];\n var active = document.activeElement;\n if (!panel.contains(active)) {\n e.preventDefault();\n (e.shiftKey ? last : first).focus();\n return;\n }\n if (e.shiftKey && active === first) {\n e.preventDefault();\n last.focus();\n }\n else if (!e.shiftKey && active === last) {\n e.preventDefault();\n first.focus();\n }\n }\n\n // Lock, listen and inert to match the stack after any change.\n function _overlaySync() {\n for (var i = 0; i < _overlayInerted.length; i++) {\n try { _overlayInerted[i].inert = false; }\n catch (_e) { /* element may be gone */ }\n }\n _overlayInerted = [];\n\n var top = _overlayTop();\n var modal = _overlayTopModal();\n if (!modal && _overlayScroll) {\n document.body.style.overflow = _overlayScroll.body;\n document.documentElement.style.overflow = _overlayScroll.html;\n document.body.style.paddingRight = _overlayScroll.pad;\n _overlayScroll = null;\n }\n if (!top) {\n if (_overlayScroll) {\n document.body.style.overflow = _overlayScroll.body;\n document.documentElement.style.overflow = _overlayScroll.html;\n document.body.style.paddingRight = _overlayScroll.pad;\n _overlayScroll = null;\n }\n if (_overlayListening) {\n document.removeEventListener('keydown', _overlayKey);\n _overlayListening = false;\n }\n return;\n }\n\n if (modal && !_overlayScroll) {\n _overlayScroll = {\n body: document.body.style.overflow,\n html: document.documentElement.style.overflow,\n pad: document.body.style.paddingRight\n };\n // The scrollbar's width comes back as padding, so the page does not jump\n // sideways when it disappears.\n var gap = window.innerWidth - document.documentElement.clientWidth;\n if (gap > 0) {\n var existing = Number.parseFloat(window.getComputedStyle(document.body).paddingRight) || 0;\n document.body.style.paddingRight = (existing + gap) + 'px';\n }\n document.body.style.overflow = 'hidden';\n document.documentElement.style.overflow = 'hidden';\n }\n if (!_overlayListening) {\n document.addEventListener('keydown', _overlayKey);\n _overlayListening = true;\n }\n\n // An overlay given a z-index stacks by the order it opened in, not by\n // where it sits in the document: one lifted into the body early (a sheet\n // mounted before the sheet it later opens over) drew underneath. Set on\n // every change, so what stays open closes up when one under it closes. A\n // closed overlay keeps its last value, so it slides away above the one\n // it was over.\n for (var z = 0; z < _overlays.length; z++) {\n var layer = _overlays[z];\n if (typeof layer.zIndex === 'number' && layer.root && layer.root.style) layer.root.style.zIndex = String(layer.zIndex + z);\n }\n\n // inert, rather than aria-hidden, takes the page behind out of the tab\n // order and the accessibility tree together (#1998). Only behind an\n // overlay that is a child of the body element - one the runtime appended,\n // or one an app lifted there - or one opened inside such an overlay (a\n // dialog in a sheet's content). An overlay rendered inside the page's own\n // markup would go inert with the page; its Tab trap is what holds it.\n var root = _overlayInertRoot(modal);\n if (root) {\n var kids = document.body.children;\n for (var k = 0; k < kids.length; k++) {\n var kid = kids[k];\n if (kid === root || kid.inert) continue;\n try {\n kid.inert = true;\n _overlayInerted.push(kid);\n }\n catch (_e) { /* inert unsupported; the Tab trap still holds */ }\n }\n }\n }\n\n // The child of the body that keeps the rest of the page inert while this\n // modal layer is on top: its own root when that is in the body, or the\n // root of the open overlay it sits inside. A dialog opened from a sheet's\n // content is not itself in the body, and the page behind the sheet used to\n // come back to the keyboard and screen readers while it was up.\n function _overlayInertRoot(modal) {\n if (!modal) return null;\n var el = modal.root || _overlayPanel(modal);\n while (el && el.parentNode && el.parentNode !== document.body) el = el.parentNode;\n if (!el || el.parentNode !== document.body) return null;\n if (el === modal.root) return el;\n for (var i = 0; i < _overlays.length; i++) {\n if (_overlays[i] !== modal && _overlays[i].root === el) return el;\n }\n return null;\n }\n\n // The next chance to act, whichever comes first: rAF is suspended in a\n // background tab, so a timer races it.\n function _overlaySoon(callback) {\n var done = false;\n var once = function() {\n if (done) return;\n done = true;\n callback();\n };\n if (typeof requestAnimationFrame === 'function') requestAnimationFrame(once);\n setTimeout(once, 32);\n }\n\n // Retried, because focus() on an element that is not displayed yet is a\n // silent no-op. Stops once the overlay has closed.\n function _overlayFocusIn(entry, attempts) {\n if (_overlayIndex(entry.id) === -1) return;\n var target = null;\n try { target = typeof entry.initialFocus === 'function' ? entry.initialFocus() : entry.initialFocus; }\n catch (_e) { target = null; }\n var panel = _overlayPanel(entry);\n // An [autofocus] that is not shown (behind a :show, a player in a\n // dialog that is showing something else) cannot take focus: skipped, or\n // focus went nowhere and the panel's first control never got it.\n if (!target && panel) target = _overlayShown(panel.querySelectorAll('[autofocus]'))[0] || _overlayFocusable(panel)[0] || panel;\n if (target && target.focus) target.focus();\n if (target && document.activeElement === target) return;\n if (attempts > 0) _overlaySoon(function() { _overlayFocusIn(entry, attempts - 1); });\n }\n\n var overlays = {\n /**\n * Put an overlay on top. Calling it again for an open id updates its\n * options and nothing else, so it is safe from an effect that re-runs.\n *\n * options: modal (default true; false for a popup, which takes Escape\n * while on top but does not lock, trap or move focus), panel (an element,\n * a selector, or a function returning one; focus stays inside it), root (the overlay's outermost element, if it is not the panel),\n * zIndex (a base: the root's z-index becomes it plus the overlay's place\n * in the stack, so a later overlay draws over an earlier one wherever it\n * sits in the document), onEscape (leave out for one that must be answered), initialFocus\n * (element or function; defaults to [autofocus], then the first focusable,\n * then the panel), opener (where focus goes back; defaults to whatever had\n * it), restoreFocus (default true).\n */\n open: function(id, options) {\n var opts = options || {};\n var at = _overlayIndex(id);\n if (at !== -1) {\n var existing = _overlays[at];\n for (var key in opts) {\n if (Object.prototype.hasOwnProperty.call(opts, key)) existing[key] = opts[key];\n }\n _overlaySync();\n return;\n }\n var isModal = opts.modal !== false;\n var entry = {\n id: id,\n modal: isModal,\n panel: opts.panel,\n root: opts.root || null,\n zIndex: typeof opts.zIndex === 'number' ? opts.zIndex : null,\n onEscape: opts.onEscape || null,\n initialFocus: opts.initialFocus || null,\n // A popup hands focus back itself, to its own trigger, and only when\n // focus was inside it; a modal layer always does.\n restoreFocus: opts.restoreFocus !== undefined ? opts.restoreFocus !== false : isModal,\n opener: opts.opener !== undefined ? opts.opener : document.activeElement\n };\n _overlays.push(entry);\n _overlaySync();\n // Synchronously first, so a caller that asserts focus straight after\n // opening sees it; then retried for a panel that is not displayed yet.\n // A popup keeps focus where its own keyboard handling puts it.\n if (isModal || opts.initialFocus) _overlayFocusIn(entry, 10);\n },\n /** Take an overlay off the stack, wherever it is in it. */\n close: function(id) {\n var at = _overlayIndex(id);\n if (at === -1) return;\n var wasTop = at === _overlays.length - 1;\n var entry = _overlays.splice(at, 1)[0];\n _overlaySync();\n // Only the overlay that had the keyboard gives it back. Closing one\n // underneath (its owner went away) must not pull focus out of the top.\n var opener = entry.opener;\n if (wasTop && entry.restoreFocus && opener && opener.isConnected !== false && typeof opener.focus === 'function') {\n try { opener.focus(); }\n catch (_e) { /* gone; nothing to give focus back to */ }\n }\n },\n /** Whether this overlay is the one that has the keyboard. */\n isTop: function(id) {\n var top = _overlayTop();\n return !!top && top.id === id;\n },\n /** Open overlay ids, outermost first. */\n list: function() {\n return _overlays.map(function(o) { return o.id; });\n }\n };\n\n // \u2500\u2500 Modal system \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n var modal = {\n open: function(id) {\n var el = document.querySelector('[data-stx-modal=\"' + id + '\"]');\n if (!el) { console.warn('[stx:modal] Modal \"' + id + '\" not found'); return; }\n el.style.display = 'flex';\n // Force reflow then animate\n void el.offsetHeight;\n el.setAttribute('data-stx-modal-open', '');\n // The lock, Escape for the topmost and the Tab trap come from the\n // overlay stack, shared with every other overlay (stacksjs/stx#2057).\n // Each modal used to bind its own Escape and set body overflow itself,\n // so two open closed together and the first to close unlocked the page.\n overlays.open('stx-modal:' + id, {\n panel: el,\n onEscape: el.getAttribute('data-close-escape') !== 'false' ? function() { modal.close(id); } : null\n });\n if (el.getAttribute('data-close-backdrop') !== 'false') {\n el.onclick = function(e) { if (e.target === el) modal.close(id); };\n }\n },\n close: function(id) {\n var el = document.querySelector('[data-stx-modal=\"' + id + '\"]');\n if (!el) return;\n el.removeAttribute('data-stx-modal-open');\n el.onclick = null;\n overlays.close('stx-modal:' + id);\n setTimeout(function() {\n if (!el.hasAttribute('data-stx-modal-open')) el.style.display = 'none';\n }, 200);\n },\n toggle: function(id) {\n var el = document.querySelector('[data-stx-modal=\"' + id + '\"]');\n if (el && el.hasAttribute('data-stx-modal-open')) modal.close(id);\n else modal.open(id);\n }\n };\n";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Scope and effect disposal used by the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_SCOPE_DISPOSAL_RUNTIME = " // ==========================================================================\n // Scope Disposal\n // ==========================================================================\n\n // Walk a subtree (root + descendants) and fire each [data-stx-scope]'s\n // destroy callbacks + remove the entry from window.stx._scopes. Pre-fix\n // (stacksjs/stx#1727) only cleanupContainer (called during SPA navigation)\n // ran this walk, so dynamic unmounts driven by :if/:for leaked scopes\n // indefinitely. Now bindIf, bindFor, and cleanupContainer all funnel\n // through this helper so the cleanup is symmetric regardless of who\n // initiated the removal.\n // Dispose the EFFECTS bound inside a subtree leaving the page for good: a\n // removed :for row, a hidden template :if clone, a hidden :for empty\n // placeholder, or a container on SPA navigation (#1954).\n // disposeSubtreeScopes only releases scope registrations. Without this, the\n // effects that bound the subtree stay subscribed to every signal they read\n // and keep running, so work per update grows with every removal.\n // Descendants first, then the root, the order cleanupContainer always used.\n function disposeSubtreeEffects(root) {\n if (!root) return;\n var nodes = stxHost.descendants(root);\n nodes.push(root);\n var owned = ['__stx_disposers', '__stx_effect_disposers', '__stx_if_disposers', '__stx_chain_disposers'];\n for (var n = 0; n < nodes.length; n++) {\n var el = nodes[n];\n if (typeof el.__stx_hydration_cancel === 'function') {\n try { el.__stx_hydration_cancel(); } catch (e) { /* noop */ }\n el.__stx_hydration_cancel = null;\n }\n if (Array.isArray(el.__stx_destroy)) {\n var hooks = el.__stx_destroy;\n el.__stx_destroy = null;\n hooks.forEach(function(fn) {\n try { fn(); }\n catch (e) { console.warn('[stx] destroy hook error:', e); }\n });\n }\n if (el.__stx_detached_if) {\n var detached = el.__stx_detached_if;\n el.__stx_detached_if = null;\n detached.forEach(function(node) { disposeSubtreeEffects(node); });\n }\n for (var k = 0; k < owned.length; k++) {\n var disposeOwned = el[owned[k]];\n if (typeof disposeOwned === 'function') {\n el[owned[k]] = null;\n disposeOwned();\n }\n }\n }\n }\n\n // :if is a toggle, and a component inside one lives through every toggle:\n // its scope is registered once and kept (#1737), and showing the branch puts\n // the same markup back. Its LIFECYCLE follows the toggle, though. Hiding runs\n // what the component registered to release -- its onDestroy, and whatever\n // its onMount handed back -- and showing it again runs its onMount again.\n // Each show is a mount and each hide an unmount, which is the pairing every\n // component on a page already gets.\n //\n // Before this, a hidden component never heard about it and a re-shown one\n // was never told it was back (the asymmetry stacksjs/stx#2036 stopped short\n // of). A gated modal shell -- one that traps focus, locks body scroll and\n // claims Escape from onMount, and releases them in onDestroy -- did all of\n // that on its first opening and on no later one: the second time it opened\n // with the page scrolling behind it and Escape doing nothing.\n //\n // Only scopes that actually mounted are suspended, so a component whose\n // first mount is still deferred (behind a false :if, or an stx-hydrate\n // island) keeps waiting for its own flush.\n function suspendSubtreeScopes(nodes) {\n if (!nodes || !window.stx || !window.stx._scopes) return;\n var ids = [];\n for (var i = 0; i < nodes.length; i++) {\n var found = stxHost.scopesIn(nodes[i]);\n for (var k = 0; k < found.length; k++) {\n if (ids.indexOf(found[k]) === -1) ids.push(found[k]);\n }\n }\n // Innermost first, the order a page unmounts in: a child releases what it\n // holds before the component it sits in does.\n for (var n = ids.length - 1; n >= 0; n--) {\n var scopeVars = window.stx._scopes[ids[n]];\n if (!scopeVars || !scopeVars.__mounted) continue;\n scopeVars.__mounted = false;\n scopeVars.__suspended = true;\n var release = scopeVars.__destroyCallbacks || [];\n // What onDestroy registered at setup is owed again at the next hide;\n // a cleanup a mount handed back belonged to that mount alone.\n scopeVars.__destroyCallbacks = (scopeVars.__destroyHooks || []).slice();\n for (var j = 0; j < release.length; j++) {\n try { release[j](); }\n catch (e) { console.warn('[stx] scope destroy error:', e); }\n }\n scopeVars.__mountCallbacks = (scopeVars.__mountHooks || []).slice();\n }\n }\n\n // The other half: a suspended scope whose markup is back on the page mounts\n // again. A scope still off the page (hidden by an :if of its own inside this\n // branch) is left for that :if to resume.\n function resumeSubtreeScopes(nodes) {\n if (!nodes || !window.stx || !window.stx._scopes) return;\n for (var i = 0; i < nodes.length; i++) {\n var ids = stxHost.scopesIn(nodes[i]);\n for (var k = 0; k < ids.length; k++) {\n var scopeVars = window.stx._scopes[ids[k]];\n if (!scopeVars || scopeVars.__mounted || !scopeVars.__suspended) continue;\n if (scopeVars.__el && scopeVars.__el.isConnected === false) continue;\n scopeVars.__suspended = false;\n scopeVars.__mounted = true;\n runMountCallbacks(scopeVars.__mountCallbacks, scopeDestroySink(scopeVars));\n }\n }\n }\n\n function disposeSubtreeScopes(root) {\n if (!root || !window.stx || !window.stx._scopes) return;\n // The host reports which scopes live in this subtree: the document finds\n // them with a selector, a native host reads the map it keeps as it builds\n // views (#1984).\n var scopeIds = stxHost.scopesIn(root);\n for (var n = 0; n < scopeIds.length; n++) {\n var scopeId = scopeIds[n];\n if (!scopeId) continue;\n var scopeVars = window.stx._scopes[scopeId];\n if (!scopeVars) continue;\n // Hidden by an :if, it already released everything on the way out;\n // running the hooks again would unmount it twice. (A hidden component's\n // root is detached, so no walk reaches it today; this keeps the next\n // disposal path that does from unmounting it twice.)\n var alreadyReleased = scopeVars.__suspended && !scopeVars.__mounted;\n if (!alreadyReleased && scopeVars.__destroyCallbacks && Array.isArray(scopeVars.__destroyCallbacks)) {\n for (var j = 0; j < scopeVars.__destroyCallbacks.length; j++) {\n try { scopeVars.__destroyCallbacks[j](); }\n catch (e) { console.warn('[stx] scope destroy error:', e); }\n }\n }\n delete window.stx._scopes[scopeId];\n }\n }\n\n // Reclaim registry entries whose element is gone from the document.\n //\n // disposeSubtreeScopes only deletes scopes found UNDER the cleanup container,\n // so two shapes leaked forever across SPA navigation (#1775): components\n // rendered outside the swap container (an @include in the layout, above\n // <main>), and elements already detached by the time cleanup ran its\n // querySelectorAll. Each round-trip re-ran the include scripts under fresh\n // scope ids while the previous ids stayed in window.stx._scopes \u2014 ~4 orphans\n // per hop, unbounded, each retaining that scope's vars, signals and closures.\n // Since #1958 a same-layout navigation no longer re-runs the layout's\n // component scripts, and a layout change cleans up the whole body first, so\n // navigation should no longer produce the first shape; the sweep stays for\n // the second, and as the backstop for anything that still does.\n //\n // The sweep is deliberately CONSERVATIVE \u2014 an over-eager delete is the #1737\n // failure (a scope removed from the registry cannot be recreated: its setup\n // IIFE ran once at page load), which is strictly worse than a leak. An entry\n // is dropped only when all three hold:\n // 1. the runtime actually bound it to an element (__el recorded),\n // 2. that element is no longer connected to the document, and\n // 3. neither it nor any ancestor is retained by a live conditional.\n // Entries with no __el (e.g. a scope whose element still sits inside untouched\n // <template> content, never inserted) are left alone \u2014 we can't prove they're\n // dead, and a later clone re-uses that registration.\n function sweepOrphanedScopes() {\n if (!window.stx || !window.stx._scopes) return;\n var scopes = window.stx._scopes;\n for (var id in scopes) {\n if (!Object.prototype.hasOwnProperty.call(scopes, id)) continue;\n var entry = scopes[id];\n if (!entry) continue;\n var el = entry.__el;\n if (!el || el.isConnected) continue;\n // Detached but RETAINED: :if toggles keep their element (bindIf re-inserts\n // the SAME node) and :if/:else chains keep their branches. Parent links\n // inside a detached subtree stay intact, so walking up from the scope\n // element still finds the conditional that owns it.\n var retained = false;\n for (var p = el; p; p = p.parentNode) {\n if (p.__stx_if_bound || p.__stx_chain_member) { retained = true; break; }\n }\n if (retained) continue;\n // Suspended by an :if: released when it hid, so not again here.\n if (!(entry.__suspended && !entry.__mounted) && entry.__destroyCallbacks && Array.isArray(entry.__destroyCallbacks)) {\n for (var k = 0; k < entry.__destroyCallbacks.length; k++) {\n try { entry.__destroyCallbacks[k](); }\n catch (e) { console.warn('[stx] scope destroy error:', e); }\n }\n }\n delete scopes[id];\n }\n }\n";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** SPA load scheduling and teardown boundaries for the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_SPA_LOAD_CONTROL_RUNTIME = " // Re-initialize components after SPA content swap.\n // Debounce to handle rapid re-fires (HMR triggers navigate which triggers stx:load again).\n var _stxLoadTimer = null;\n if (window.__stxLoadHandler) {\n window.removeEventListener('stx:load', window.__stxLoadHandler);\n }\n function stxLoadHandler() {\n if (_stxLoadTimer) { clearTimeout(_stxLoadTimer); }\n _stxLoadTimer = setTimeout(_handleStxLoad, 5);\n }\n window.__stxLoadHandler = stxLoadHandler;\n window.addEventListener('stx:load', stxLoadHandler);\n\n // Run a pending stx:load now instead of after the debounce. The router's\n // instant navigation (a tab bar) reveals the new screen in a single frame\n // once the page is bound; waiting out the timer revealed it with its\n // {{ }} still unbound and filled it in a frame later.\n function flushStxLoad() {\n if (!_stxLoadTimer) return false;\n clearTimeout(_stxLoadTimer);\n _handleStxLoad();\n return true;\n }\n // The page-level onDestroy callbacks a navigation is leaving behind.\n //\n // stx:load used to run everything in destroyCallbacks, on the reading that\n // the queue held the outgoing page. It does not by then: the router runs the\n // incoming page's scripts BEFORE it fires stx:load, and a page-level\n // onDestroy registered by one of them (a layout partial's useColorMode, a\n // listener, a stream) joined the same queue and was run at once - its owner\n // still on screen. A tab bar that retains screens made it certain, since\n // that path had already filed the outgoing page's callbacks with its screen,\n // so the queue stx:load drained held only the new page's. The page then\n // stopped following the system theme, among other things, until a reload.\n //\n // The router marks the boundary with _beginSwap just before the incoming\n // scripts run. Null means no boundary was marked since the last stx:load (a\n // re-fire, an older router), and then the queue is drained as before.\n var departingDestroys = null;\n function beginSwap() {\n departingDestroys = (departingDestroys || []).concat(destroyCallbacks.splice(0));\n }";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Browser storage composables used by the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_STORAGE_RUNTIME = " // Storage access is guarded end to end (stacksjs/stx#1793). Every one of\n // these can throw, and each throw took down the whole client script for the\n // page rather than just the composable:\n //\n // getItem - SecurityError in a sandboxed iframe or with storage disabled\n // parse - any non-JSON value already sitting at the key\n // setItem - QuotaExceededError, Safari private mode\n //\n // The parse fallback is deliberately LENIENT: a value that isn't JSON is\n // returned as the raw string rather than discarded for defaultValue. A key\n // that previously held a bare 'list' keeps reading back 'list' and is\n // rewritten as JSON on the next set, so migrating an existing key onto this\n // composable no longer needs the key to be renamed. This also matches\n // composables/use-storage.ts, whose default serializer already returns the\n // raw string on parse failure \u2014 the two implementations have to agree.\n function stxParseStored(raw, fallback, key, label) {\n if (raw === null || raw === undefined) return fallback;\n try { return JSON.parse(raw); }\n catch (e) {\n console.warn('[stx] ' + label + ': \"' + key + '\" holds a value that is not JSON (' + String(raw).slice(0, 64) + '); using it as a raw string. Write it with the same composable to store it as JSON.');\n return raw;\n }\n }\n function stxStorageRead(store, key, fallback, label) {\n var raw;\n try { raw = store.getItem(key); }\n catch (e) {\n console.warn('[stx] ' + label + ': cannot read \"' + key + '\" (' + (e && e.message ? e.message : e) + '); using the default.');\n return fallback;\n }\n return stxParseStored(raw, fallback, key, label);\n }\n function stxStorageWrite(store, key, value, label) {\n try { store.setItem(key, JSON.stringify(value)); }\n catch (e) {\n console.warn('[stx] ' + label + ': cannot persist \"' + key + '\" (' + (e && e.message ? e.message : e) + '); the value stays in memory only.');\n }\n }\n\n function useLocalStorage(key, defaultValue) {\n var s = state(stxStorageRead(localStorage, key, defaultValue, 'useLocalStorage'));\n effect(function() {\n stxStorageWrite(localStorage, key, s(), 'useLocalStorage');\n });\n var handler = function(e) {\n // Fires from ANOTHER tab at an arbitrary later time, so an unguarded\n // parse here throws inside a window listener with a stack pointing at\n // the runtime rather than at the consumer.\n // storageArea is also matched so a sessionStorage write to the same key\n // name can't clobber this signal \u2014 useSessionStorage already filtered,\n // this side didn't. Synthetic events (tests) leave storageArea null and\n // are still accepted; real browsers always populate it.\n if (e.key === key && (!e.storageArea || e.storageArea === localStorage))\n s.set(stxParseStored(e.newValue, defaultValue, key, 'useLocalStorage'));\n };\n window.addEventListener('storage', handler);\n onDestroy(function() { window.removeEventListener('storage', handler); });\n return s;\n }\n\n // Mirror of useLocalStorage against sessionStorage. Strict-mode lint\n // already suggests this function name as the replacement for raw\n // window.sessionStorage access; this is the implementation that backs\n // that hint. Same JSON serialization, cross-tab sync via the 'storage'\n // event (filtered to sessionStorage's storageArea \u2014 localStorage events\n // share the same listener but fire from a different area).\n function useSessionStorage(key, defaultValue) {\n var s = state(stxStorageRead(sessionStorage, key, defaultValue, 'useSessionStorage'));\n effect(function() {\n stxStorageWrite(sessionStorage, key, s(), 'useSessionStorage');\n });\n var handler = function(e) {\n if (e.key === key && (!e.storageArea || e.storageArea === sessionStorage))\n s.set(stxParseStored(e.newValue, defaultValue, key, 'useSessionStorage'));\n };\n window.addEventListener('storage', handler);\n onDestroy(function() { window.removeEventListener('storage', handler); });\n return s;\n }";
|