@stacksjs/stx 0.2.532 → 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-y4qks0bd.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-4gt0r98p.js → chunk-2bvk0qyd.js} +2 -2
- package/dist/{chunk-y7ds4qyb.js → chunk-2h4f37kx.js} +2 -2
- package/dist/{chunk-q6e45gnw.js → chunk-2kvbg3t5.js} +3 -3
- package/dist/{chunk-xdtz2v5r.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-khwj964t.js → chunk-40hbpz2b.js} +3 -3
- package/dist/chunk-4a7v51vh.js +2 -0
- package/dist/{chunk-xtknewf7.js → chunk-4hyhr5r7.js} +1 -1
- package/dist/{chunk-hp1tnxzb.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-0pebjkzx.js → chunk-843y0pfg.js} +4 -4
- package/dist/{chunk-4xxhprts.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-t6769zcy.js → chunk-93n6yv5x.js} +12 -12
- package/dist/chunk-94rg5s6c.js +2 -0
- package/dist/chunk-9674w2gm.js +2 -0
- package/dist/{chunk-gvw8wh29.js → chunk-9p6bt089.js} +3 -3
- package/dist/{chunk-kg77xs08.js → chunk-bczcm7jk.js} +2 -2
- package/dist/{chunk-rs46hksk.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-664503e6.js → chunk-d871008z.js} +4 -4
- package/dist/chunk-dekpf1ry.js +2 -0
- package/dist/chunk-epa1c4q4.js +2 -0
- package/dist/{chunk-xb0785wp.js → chunk-f3q84h7b.js} +2 -2
- package/dist/{chunk-g060jncp.js → chunk-fqfqyn48.js} +4 -4
- package/dist/{chunk-g5t10z04.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-rwn3b21z.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-ee4wwr89.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-j8pacd7m.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-m2v04c6v.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-grb3kfya.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-stbsqy7e.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-1945hk44.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/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-0p9pwd61.js +0 -2
- package/dist/chunk-0zmv31nc.js +0 -2
- package/dist/chunk-28xtazwz.js +0 -2
- package/dist/chunk-2936t942.js +0 -2
- package/dist/chunk-29qwmthc.js +0 -2
- package/dist/chunk-323cxa69.js +0 -2
- package/dist/chunk-375zp0vr.js +0 -2
- package/dist/chunk-3w49r16x.js +0 -2
- package/dist/chunk-8bcvb86w.js +0 -2
- package/dist/chunk-8gmb3k1p.js +0 -2
- package/dist/chunk-a15yzfc6.js +0 -2
- package/dist/chunk-d4155ec5.js +0 -2
- package/dist/chunk-dd31q423.js +0 -2
- package/dist/chunk-f2q5bckn.js +0 -2
- package/dist/chunk-fhx35529.js +0 -2
- package/dist/chunk-h1y5q942.js +0 -2
- package/dist/chunk-h791c7sb.js +0 -2
- package/dist/chunk-h88jcr3k.js +0 -2
- package/dist/chunk-heq5c0gd.js +0 -2
- package/dist/chunk-j3b24e77.js +0 -2
- package/dist/chunk-jpck8nm5.js +0 -2
- package/dist/chunk-m4d99a9r.js +0 -2
- package/dist/chunk-ng2sdph7.js +0 -2
- package/dist/chunk-qs3p7sc6.js +0 -2
- package/dist/chunk-rchwwcxy.js +0 -2
- package/dist/chunk-rk4mttds.js +0 -2
- package/dist/chunk-rma3bv36.js +0 -2
- package/dist/chunk-rp5a91ak.js +0 -2
- package/dist/chunk-sp5x96rn.js +0 -2
- package/dist/chunk-t2mjeezd.js +0 -2
- package/dist/chunk-t61j834x.js +0 -2
- package/dist/chunk-v2vg5jqq.js +0 -2
- package/dist/chunk-vmfw4svt.js +0 -2
- package/dist/chunk-w6ecbk3y.js +0 -2
- package/dist/chunk-wbv6vjhm.js +0 -2
- package/dist/chunk-wfbr3txe.js +0 -2
- package/dist/chunk-wpnv0naj.js +0 -2
- package/dist/chunk-wwny5dk9.js +0 -2
- package/dist/chunk-x55avrcf.js +0 -2
- package/dist/chunk-yts2745t.js +0 -2
- package/dist/chunk-zah67v44.js +0 -2
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
export const SIGNALS_COMPONENT_HYDRATION_RUNTIME = ` function hydrateComponentScopes(nodes, callerScope) {
|
|
2
|
+
var roots = [];
|
|
3
|
+
var scripts = [];
|
|
4
|
+
forEachGroupElement(nodes, function(node, insideTemplateContent) {
|
|
5
|
+
// A template's content is inert source material. Remapping must traverse
|
|
6
|
+
// it, but setup and event hydration belong to the live clones inserted by
|
|
7
|
+
// bindIf/bindFor, where the correct iteration scope is available.
|
|
8
|
+
if (insideTemplateContent) return;
|
|
9
|
+
if (node.hasAttribute && node.hasAttribute('data-stx-scope')) roots.push(node);
|
|
10
|
+
if (node.tagName === 'SCRIPT' && node.hasAttribute('data-stx-scoped')) scripts.push(node);
|
|
11
|
+
});
|
|
12
|
+
if (!roots.length) return;
|
|
13
|
+
|
|
14
|
+
function hasPendingStructuralAncestor(root) {
|
|
15
|
+
var cursor = root && root.parentElement;
|
|
16
|
+
while (cursor && cursor.nodeType === Node.ELEMENT_NODE) {
|
|
17
|
+
if (cursor.hasAttribute('@for')
|
|
18
|
+
|| cursor.hasAttribute(':for')
|
|
19
|
+
|| cursor.hasAttribute('x-for')
|
|
20
|
+
|| cursor.hasAttribute('@if')
|
|
21
|
+
|| cursor.hasAttribute(':if')
|
|
22
|
+
|| cursor.hasAttribute('x-if')
|
|
23
|
+
|| cursor.hasAttribute('@else-if')
|
|
24
|
+
|| cursor.hasAttribute(':else-if')
|
|
25
|
+
|| cursor.hasAttribute('x-else-if')
|
|
26
|
+
|| cursor.hasAttribute('@else')
|
|
27
|
+
|| cursor.hasAttribute(':else')
|
|
28
|
+
|| cursor.hasAttribute('x-else'))
|
|
29
|
+
return true;
|
|
30
|
+
cursor = cursor.parentElement;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Scripts cloned from template.content are inert in browsers. Compile each
|
|
36
|
+
// distinct component setup body once, then run that cached function for
|
|
37
|
+
// every loop instance. Temporarily restoring the template's original scope
|
|
38
|
+
// id lets existing compiled setup code locate the correct root without
|
|
39
|
+
// rewriting and reparsing the full script for every row.
|
|
40
|
+
scripts.forEach(function(old) {
|
|
41
|
+
var text = old.textContent || '';
|
|
42
|
+
var pendingRoots = roots.filter(function(root) {
|
|
43
|
+
var scopeId = root.getAttribute('data-stx-scope');
|
|
44
|
+
var originalScopeId = root.getAttribute('data-stx-template-scope') || scopeId;
|
|
45
|
+
return scopeId
|
|
46
|
+
&& originalScopeId
|
|
47
|
+
&& text.indexOf(originalScopeId) !== -1
|
|
48
|
+
&& !hasPendingStructuralAncestor(root)
|
|
49
|
+
&& !(window.stx._scopes && window.stx._scopes[scopeId]);
|
|
50
|
+
});
|
|
51
|
+
if (!pendingRoots.length) return;
|
|
52
|
+
|
|
53
|
+
var setup = __forComponentSetupFactories.get(text);
|
|
54
|
+
if (!setup) {
|
|
55
|
+
try {
|
|
56
|
+
setup = new Function(text);
|
|
57
|
+
__forComponentSetupFactories.set(text, setup);
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
console.error('[stx] cloned component setup compile error:', e);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
pendingRoots.forEach(function(root) {
|
|
66
|
+
var scopeId = root.getAttribute('data-stx-scope');
|
|
67
|
+
var originalScopeId = root.getAttribute('data-stx-template-scope') || scopeId;
|
|
68
|
+
if (!scopeId || !originalScopeId) return;
|
|
69
|
+
|
|
70
|
+
root.setAttribute('data-stx-scope', originalScopeId);
|
|
71
|
+
// The setup finds its root by id, which a detached clone cannot answer
|
|
72
|
+
// to: rows a :for builds inside a component's closed :if are set up
|
|
73
|
+
// before the :if puts them in the document, and found nothing, so they
|
|
74
|
+
// never read a prop. Hand the root over (utils.ts reads it).
|
|
75
|
+
var previousSetupRoot = window.__STX_SETUP_ROOT__;
|
|
76
|
+
window.__STX_SETUP_ROOT__ = root;
|
|
77
|
+
try {
|
|
78
|
+
setup();
|
|
79
|
+
var registeredScope = window.stx._scopes && (window.stx._scopes[originalScopeId] || window.stx._scopes[scopeId]);
|
|
80
|
+
if (registeredScope && originalScopeId !== scopeId) {
|
|
81
|
+
delete window.stx._scopes[originalScopeId];
|
|
82
|
+
window.stx._scopes[scopeId] = registeredScope;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
console.error('[stx] cloned component setup error:', e);
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
window.__STX_SETUP_ROOT__ = previousSetupRoot;
|
|
90
|
+
root.setAttribute('data-stx-scope', scopeId);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// A component that is itself a structural source still needs its setup
|
|
95
|
+
// sibling when bindFor/bindIf turns that source into a clone template.
|
|
96
|
+
// Final row instances have no structural attribute and can discard it.
|
|
97
|
+
var isStructuralSource = pendingRoots.some(function(root) {
|
|
98
|
+
return root.hasAttribute('@for')
|
|
99
|
+
|| root.hasAttribute(':for')
|
|
100
|
+
|| root.hasAttribute('x-for')
|
|
101
|
+
|| root.hasAttribute('@if')
|
|
102
|
+
|| root.hasAttribute(':if')
|
|
103
|
+
|| root.hasAttribute('x-if');
|
|
104
|
+
});
|
|
105
|
+
if (!isStructuralSource && old.parentNode) old.parentNode.removeChild(old);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
roots.forEach(function(root) {
|
|
109
|
+
// Still inside a conditional or loop this walk has not bound: the
|
|
110
|
+
// directive decides whether the component is on the page at all, and
|
|
111
|
+
// hydrates it through this same function when it is. Mounting it from
|
|
112
|
+
// here is what ran a hidden pane's onMount when an enclosing :if opened
|
|
113
|
+
// (stacksjs/stx#2071): the walk reached the pane's root while the pane's
|
|
114
|
+
// own :if was still an attribute, so its condition was never asked. The
|
|
115
|
+
// setup half above already leaves these roots alone.
|
|
116
|
+
if (hasPendingStructuralAncestor(root)) return;
|
|
117
|
+
var scopeId = root.getAttribute('data-stx-scope');
|
|
118
|
+
var scopeVars = scopeId && window.stx._scopes && window.stx._scopes[scopeId];
|
|
119
|
+
var resolvedCallerScope = resolveComponentCallerScope(root, callerScope);
|
|
120
|
+
root.__stx_parent_scope = resolvedCallerScope;
|
|
121
|
+
bindParentComponentProps(root, resolvedCallerScope);
|
|
122
|
+
if (!scopeVars) return;
|
|
123
|
+
if (root.__stx_disposers) {
|
|
124
|
+
// Bound already, by the page's scope walk: a component behind a false
|
|
125
|
+
// :if in a PARTIAL is in the list that walk collects, and is detached
|
|
126
|
+
// by the time it is reached, so it was bound and its mount deferred
|
|
127
|
+
// (stacksjs/stx#2036). Showing the branch is that mount. Without this
|
|
128
|
+
// the component rendered and its onMount never ran at all.
|
|
129
|
+
if (scopeVars.__mountCallbacks && !scopeVars.__mounted && !scopeVars.__suspended && root.isConnected) {
|
|
130
|
+
scopeVars.__el = root;
|
|
131
|
+
scopeVars.__mounted = true;
|
|
132
|
+
runMountCallbacks(scopeVars.__mountCallbacks, scopeDestroySink(scopeVars));
|
|
133
|
+
}
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
scopeVars.__el = root;
|
|
137
|
+
var childScope = { ...resolvedCallerScope, ...scopeVars };
|
|
138
|
+
root.__stx_disposers = trackEffects(function() {
|
|
139
|
+
processElement(root, childScope);
|
|
140
|
+
});
|
|
141
|
+
if (scopeVars.__mountCallbacks && !scopeVars.__mounted) {
|
|
142
|
+
scopeVars.__mounted = true;
|
|
143
|
+
runMountCallbacks(scopeVars.__mountCallbacks, scopeDestroySink(scopeVars));
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Parent-to-component reactive prop bindings for the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_COMPONENT_PROPS_RUNTIME = " function bindParentComponentProps(el, callerScope) {\n if (!el || !el.getAttribute || el.__stx_parent_props_bound) return;\n var names = (el.getAttribute('data-stx-parent-bindings') || '').split(/\\s+/).filter(Boolean);\n if (!names.length) return;\n if (hasPendingLoopBoundary(el)) {\n preserveDeferredParentComponentProps(el);\n return;\n }\n var deferred = readDeferredParentComponentProps(el);\n var bindings = names.map(function(name) {\n var sourceName = ':' + name;\n var expression = el.hasAttribute(sourceName) ? el.getAttribute(sourceName) : deferred[name];\n return typeof expression === 'string'\n ? { name: name, sourceName: sourceName, expression: expression }\n : null;\n }).filter(Boolean);\n if (!bindings.length) return;\n el.__stx_parent_props_bound = true;\n var scope = { ...globalHelpers, ...callerScope };\n\n bindings.forEach(function(binding) {\n var name = binding.name;\n var sourceName = binding.sourceName;\n var expression = binding.expression;\n effect(function() {\n var value;\n try {\n // Support both signal styles in forwarded props:\n // :open=\"open\" and :open=\"open()\".\n // Auto-unwrap bare signals, but preserve a signal function when this\n // expression explicitly calls it or accesses its object API.\n var unwrapScope = createAutoUnwrapProxy(scope, function(prop) {\n if (typeof prop !== 'string') return false;\n return expressionCallsSignal(expression, prop)\n || expressionUsesSignalApi(expression, prop);\n });\n var fn = __stxCompileScoped(unwrapScope, [], 'return (' + expression + ')');\n value = fn(...__stxArgs(fn, unwrapScope));\n if (value && typeof value === 'function' && (value._isSignal || value._isDerived)) value = value();\n }\n catch (e) {\n if (!(e instanceof ReferenceError) && !(e instanceof TypeError))\n console.warn('[STX] Parent component prop error:', expression, e);\n value = undefined;\n }\n\n // Preserve native prop types; the DOM host reflects boolean presence\n // and serializes structured values at its own boundary.\n if (name.startsWith('aria-') && typeof value === 'boolean') {\n stxHost.setAttribute(el, name, String(value));\n }\n else if (value === null || value === undefined) {\n stxHost.removeAttribute(el, name);\n }\n else {\n stxHost.setAttribute(el, name, value);\n }\n // The component setup scope is already registered for normal and\n // cloned signal components. Update its prop signal directly so object\n // identity and synchronous Vue-like prop delivery do not depend on a\n // MutationObserver round trip through a serialized DOM attribute.\n // The attribute remains the public DOM reflection and observer fallback\n // for scopes that register after this binding pass.\n syncComponentPropSignal(el, name, value);\n });\n el.removeAttribute(sourceName);\n delete deferred[name];\n });\n if (Object.keys(deferred).length)\n el.setAttribute('data-stx-deferred-parent-bindings', JSON.stringify(deferred));\n else\n el.removeAttribute('data-stx-deferred-parent-bindings');\n }\n\n function resolveComponentCallerScope(el, pageScope) {\n var resolved = { ...pageScope };\n var ancestors = [];\n var current = el && (el.parentElement || el.parentNode);\n while (current && current !== document) {\n if (current.getAttribute && current.hasAttribute('data-stx-scope'))\n ancestors.push(current.getAttribute('data-stx-scope'));\n current = current.parentElement || current.parentNode;\n }\n ancestors.reverse().forEach(function(scopeId) {\n var ancestorScope = window.stx._scopes && window.stx._scopes[scopeId];\n if (ancestorScope) Object.assign(resolved, ancestorScope);\n });\n return resolved;\n }\n";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export const SIGNALS_COMPONENT_PROPS_RUNTIME = ` function bindParentComponentProps(el, callerScope) {
|
|
2
|
+
if (!el || !el.getAttribute || el.__stx_parent_props_bound) return;
|
|
3
|
+
var names = (el.getAttribute('data-stx-parent-bindings') || '').split(/\\s+/).filter(Boolean);
|
|
4
|
+
if (!names.length) return;
|
|
5
|
+
if (hasPendingLoopBoundary(el)) {
|
|
6
|
+
preserveDeferredParentComponentProps(el);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
var deferred = readDeferredParentComponentProps(el);
|
|
10
|
+
var bindings = names.map(function(name) {
|
|
11
|
+
var sourceName = ':' + name;
|
|
12
|
+
var expression = el.hasAttribute(sourceName) ? el.getAttribute(sourceName) : deferred[name];
|
|
13
|
+
return typeof expression === 'string'
|
|
14
|
+
? { name: name, sourceName: sourceName, expression: expression }
|
|
15
|
+
: null;
|
|
16
|
+
}).filter(Boolean);
|
|
17
|
+
if (!bindings.length) return;
|
|
18
|
+
el.__stx_parent_props_bound = true;
|
|
19
|
+
var scope = { ...globalHelpers, ...callerScope };
|
|
20
|
+
|
|
21
|
+
bindings.forEach(function(binding) {
|
|
22
|
+
var name = binding.name;
|
|
23
|
+
var sourceName = binding.sourceName;
|
|
24
|
+
var expression = binding.expression;
|
|
25
|
+
effect(function() {
|
|
26
|
+
var value;
|
|
27
|
+
try {
|
|
28
|
+
// Support both signal styles in forwarded props:
|
|
29
|
+
// :open="open" and :open="open()".
|
|
30
|
+
// Auto-unwrap bare signals, but preserve a signal function when this
|
|
31
|
+
// expression explicitly calls it or accesses its object API.
|
|
32
|
+
var unwrapScope = createAutoUnwrapProxy(scope, function(prop) {
|
|
33
|
+
if (typeof prop !== 'string') return false;
|
|
34
|
+
return expressionCallsSignal(expression, prop)
|
|
35
|
+
|| expressionUsesSignalApi(expression, prop);
|
|
36
|
+
});
|
|
37
|
+
var fn = __stxCompileScoped(unwrapScope, [], 'return (' + expression + ')');
|
|
38
|
+
value = fn(...__stxArgs(fn, unwrapScope));
|
|
39
|
+
if (value && typeof value === 'function' && (value._isSignal || value._isDerived)) value = value();
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
if (!(e instanceof ReferenceError) && !(e instanceof TypeError))
|
|
43
|
+
console.warn('[STX] Parent component prop error:', expression, e);
|
|
44
|
+
value = undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Preserve native prop types; the DOM host reflects boolean presence
|
|
48
|
+
// and serializes structured values at its own boundary.
|
|
49
|
+
if (name.startsWith('aria-') && typeof value === 'boolean') {
|
|
50
|
+
stxHost.setAttribute(el, name, String(value));
|
|
51
|
+
}
|
|
52
|
+
else if (value === null || value === undefined) {
|
|
53
|
+
stxHost.removeAttribute(el, name);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
stxHost.setAttribute(el, name, value);
|
|
57
|
+
}
|
|
58
|
+
// The component setup scope is already registered for normal and
|
|
59
|
+
// cloned signal components. Update its prop signal directly so object
|
|
60
|
+
// identity and synchronous Vue-like prop delivery do not depend on a
|
|
61
|
+
// MutationObserver round trip through a serialized DOM attribute.
|
|
62
|
+
// The attribute remains the public DOM reflection and observer fallback
|
|
63
|
+
// for scopes that register after this binding pass.
|
|
64
|
+
syncComponentPropSignal(el, name, value);
|
|
65
|
+
});
|
|
66
|
+
el.removeAttribute(sourceName);
|
|
67
|
+
delete deferred[name];
|
|
68
|
+
});
|
|
69
|
+
if (Object.keys(deferred).length)
|
|
70
|
+
el.setAttribute('data-stx-deferred-parent-bindings', JSON.stringify(deferred));
|
|
71
|
+
else
|
|
72
|
+
el.removeAttribute('data-stx-deferred-parent-bindings');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function resolveComponentCallerScope(el, pageScope) {
|
|
76
|
+
var resolved = { ...pageScope };
|
|
77
|
+
var ancestors = [];
|
|
78
|
+
var current = el && (el.parentElement || el.parentNode);
|
|
79
|
+
while (current && current !== document) {
|
|
80
|
+
if (current.getAttribute && current.hasAttribute('data-stx-scope'))
|
|
81
|
+
ancestors.push(current.getAttribute('data-stx-scope'));
|
|
82
|
+
current = current.parentElement || current.parentNode;
|
|
83
|
+
}
|
|
84
|
+
ancestors.reverse().forEach(function(scopeId) {
|
|
85
|
+
var ancestorScope = window.stx._scopes && window.stx._scopes[scopeId];
|
|
86
|
+
if (ancestorScope) Object.assign(resolved, ancestorScope);
|
|
87
|
+
});
|
|
88
|
+
return resolved;
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Conditional-chain discovery helpers for the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_CONDITIONAL_CHAIN_RUNTIME = " var __bindIfCounter = 0;\n // \u2500\u2500 x-else / x-else-if chain support (stacksjs/stx#1734) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Returns { name, terminal } for an else/else-if attribute present on el,\n // or null. terminal=true for the catch-all x-else (no further siblings\n // join the chain). Checks all three prefixes (:, x-, @).\n function getElseAttrInfo(el) {\n if (!el || !el.hasAttribute) return null;\n if (el.hasAttribute(':else-if')) return { name: ':else-if', terminal: false };\n if (el.hasAttribute('x-else-if')) return { name: 'x-else-if', terminal: false };\n if (el.hasAttribute('@else-if')) return { name: '@else-if', terminal: false };\n if (el.hasAttribute(':else')) return { name: ':else', terminal: true };\n if (el.hasAttribute('x-else')) return { name: 'x-else', terminal: true };\n if (el.hasAttribute('@else')) return { name: '@else', terminal: true };\n return null;\n }\n\n // Walk forward from an x-if/:if/@if head element collecting consecutive\n // else-if/else siblings (nextElementSibling skips text/comment nodes, so\n // whitespace between branches is tolerated \u2014 matches Vue). Returns a chain\n // array whose first entry is the if head; trailing x-else (if any) has\n // expr=null and terminal=true.\n function findIfChain(el, ifAttr) {\n var chain = [{ el: el, attr: ifAttr, expr: el.getAttribute(ifAttr), terminal: false }];\n var sib = el.nextElementSibling;\n while (sib) {\n var info = getElseAttrInfo(sib);\n if (!info) break;\n chain.push({\n el: sib,\n attr: info.name,\n expr: info.terminal ? null : sib.getAttribute(info.name),\n terminal: info.terminal,\n });\n if (info.terminal) break; // x-else is the chain terminator\n sib = sib.nextElementSibling;\n }\n return chain;\n }\n";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const SIGNALS_CONDITIONAL_CHAIN_RUNTIME = ` var __bindIfCounter = 0;
|
|
2
|
+
// \u2500\u2500 x-else / x-else-if chain support (stacksjs/stx#1734) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
3
|
+
// Returns { name, terminal } for an else/else-if attribute present on el,
|
|
4
|
+
// or null. terminal=true for the catch-all x-else (no further siblings
|
|
5
|
+
// join the chain). Checks all three prefixes (:, x-, @).
|
|
6
|
+
function getElseAttrInfo(el) {
|
|
7
|
+
if (!el || !el.hasAttribute) return null;
|
|
8
|
+
if (el.hasAttribute(':else-if')) return { name: ':else-if', terminal: false };
|
|
9
|
+
if (el.hasAttribute('x-else-if')) return { name: 'x-else-if', terminal: false };
|
|
10
|
+
if (el.hasAttribute('@else-if')) return { name: '@else-if', terminal: false };
|
|
11
|
+
if (el.hasAttribute(':else')) return { name: ':else', terminal: true };
|
|
12
|
+
if (el.hasAttribute('x-else')) return { name: 'x-else', terminal: true };
|
|
13
|
+
if (el.hasAttribute('@else')) return { name: '@else', terminal: true };
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Walk forward from an x-if/:if/@if head element collecting consecutive
|
|
18
|
+
// else-if/else siblings (nextElementSibling skips text/comment nodes, so
|
|
19
|
+
// whitespace between branches is tolerated \u2014 matches Vue). Returns a chain
|
|
20
|
+
// array whose first entry is the if head; trailing x-else (if any) has
|
|
21
|
+
// expr=null and terminal=true.
|
|
22
|
+
function findIfChain(el, ifAttr) {
|
|
23
|
+
var chain = [{ el: el, attr: ifAttr, expr: el.getAttribute(ifAttr), terminal: false }];
|
|
24
|
+
var sib = el.nextElementSibling;
|
|
25
|
+
while (sib) {
|
|
26
|
+
var info = getElseAttrInfo(sib);
|
|
27
|
+
if (!info) break;
|
|
28
|
+
chain.push({
|
|
29
|
+
el: sib,
|
|
30
|
+
attr: info.name,
|
|
31
|
+
expr: info.terminal ? null : sib.getAttribute(info.name),
|
|
32
|
+
terminal: info.terminal,
|
|
33
|
+
});
|
|
34
|
+
if (info.terminal) break; // x-else is the chain terminator
|
|
35
|
+
sib = sib.nextElementSibling;
|
|
36
|
+
}
|
|
37
|
+
return chain;
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Conditional component scope preservation for the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_CONDITIONAL_COMPONENT_RUNTIME = " // A false :if detaches its subtree before the DOMContentLoaded scope walk\n // reaches nested components. Capture and bind their caller-owned props while\n // the ancestor chain is still connected, otherwise resolveComponentCallerScope\n // can no longer see the component that declared expressions such as\n // :options=\"environmentOptions\".\n function preserveConditionalComponentScopes(root, callerScope) {\n if (!root || !root.querySelectorAll) return;\n // A <template :if> branch is inert source: what shows is a clone of its\n // content, hydrated and bound by processTemplateNodes when it is inserted.\n // A DOM whose querySelectorAll reaches into template content (the test\n // DOM, a native host) would otherwise bind the SOURCE component's caller\n // props here, consuming :value on the source, so every clone carried the\n // value of the moment it was cloned and stopped following the page.\n if (root.tagName === 'TEMPLATE') return;\n var scopeEls = [];\n if (root.matches && root.matches('[data-stx-scope]')) scopeEls.push(root);\n root.querySelectorAll('[data-stx-scope]').forEach(function(scopeEl) { scopeEls.push(scopeEl); });\n scopeEls.forEach(function(scopeEl) {\n if (scopeEl.__stx_parent_props_bound) return;\n // A component inside a descendant loop cannot resolve its caller props\n // until bindFor creates the iteration scope. Binding it while the outer\n // conditional is being detached would consume expressions such as\n // :status=\"deployment.status\" before the deployment item exists, leaving every\n // later clone with the child's default prop. bindFor hydrates these\n // component scopes after insertion with the correct per-item scope.\n var current = scopeEl;\n while (current && current !== root) {\n if (current.hasAttribute\n && (current.hasAttribute('@for') || current.hasAttribute(':for') || current.hasAttribute('x-for'))) {\n preserveDeferredParentComponentProps(scopeEl);\n return;\n }\n current = current.parentElement || current.parentNode;\n }\n scopeEl.__stx_parent_scope = resolveComponentCallerScope(scopeEl, callerScope);\n bindParentComponentProps(scopeEl, scopeEl.__stx_parent_scope);\n });\n }\n\n // Component setup scripts are emitted immediately after their scoped root.\n // When that root itself carries :if, detaching only the element leaves the\n // sibling setup script outside the conditional node group. Scripts inserted\n // through innerHTML are inert, so the later hydration pass has no script to\n // execute and the component keeps raw directives and interpolations.\n function findConditionalComponentSetupSiblings(root) {\n if (!root || !root.hasAttribute || !root.hasAttribute('data-stx-scope')) return [];\n var scopeId = root.getAttribute('data-stx-scope');\n var templateScopeId = root.getAttribute('data-stx-template-scope') || scopeId;\n if (!scopeId) return [];\n\n var scripts = [];\n var sibling = root.nextSibling;\n while (sibling) {\n var next = sibling.nextSibling;\n if (sibling.nodeType === Node.TEXT_NODE && !(sibling.textContent || '').trim()) {\n sibling = next;\n continue;\n }\n if (sibling.nodeType === Node.COMMENT_NODE) {\n sibling = next;\n continue;\n }\n if (sibling.nodeType === Node.ELEMENT_NODE\n && sibling.tagName === 'STYLE'\n && sibling.hasAttribute('data-stx-vendor')) {\n sibling = next;\n continue;\n }\n if (sibling.nodeType === Node.ELEMENT_NODE\n && sibling.tagName === 'SCRIPT'\n && sibling.hasAttribute('data-stx-scoped')\n && ((sibling.textContent || '').indexOf(scopeId) !== -1\n || (templateScopeId && (sibling.textContent || '').indexOf(templateScopeId) !== -1))) {\n scripts.push(sibling);\n sibling = next;\n continue;\n }\n break;\n }\n return scripts;\n }\n";
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export const SIGNALS_CONDITIONAL_COMPONENT_RUNTIME = ` // A false :if detaches its subtree before the DOMContentLoaded scope walk
|
|
2
|
+
// reaches nested components. Capture and bind their caller-owned props while
|
|
3
|
+
// the ancestor chain is still connected, otherwise resolveComponentCallerScope
|
|
4
|
+
// can no longer see the component that declared expressions such as
|
|
5
|
+
// :options="environmentOptions".
|
|
6
|
+
function preserveConditionalComponentScopes(root, callerScope) {
|
|
7
|
+
if (!root || !root.querySelectorAll) return;
|
|
8
|
+
// A <template :if> branch is inert source: what shows is a clone of its
|
|
9
|
+
// content, hydrated and bound by processTemplateNodes when it is inserted.
|
|
10
|
+
// A DOM whose querySelectorAll reaches into template content (the test
|
|
11
|
+
// DOM, a native host) would otherwise bind the SOURCE component's caller
|
|
12
|
+
// props here, consuming :value on the source, so every clone carried the
|
|
13
|
+
// value of the moment it was cloned and stopped following the page.
|
|
14
|
+
if (root.tagName === 'TEMPLATE') return;
|
|
15
|
+
var scopeEls = [];
|
|
16
|
+
if (root.matches && root.matches('[data-stx-scope]')) scopeEls.push(root);
|
|
17
|
+
root.querySelectorAll('[data-stx-scope]').forEach(function(scopeEl) { scopeEls.push(scopeEl); });
|
|
18
|
+
scopeEls.forEach(function(scopeEl) {
|
|
19
|
+
if (scopeEl.__stx_parent_props_bound) return;
|
|
20
|
+
// A component inside a descendant loop cannot resolve its caller props
|
|
21
|
+
// until bindFor creates the iteration scope. Binding it while the outer
|
|
22
|
+
// conditional is being detached would consume expressions such as
|
|
23
|
+
// :status="deployment.status" before the deployment item exists, leaving every
|
|
24
|
+
// later clone with the child's default prop. bindFor hydrates these
|
|
25
|
+
// component scopes after insertion with the correct per-item scope.
|
|
26
|
+
var current = scopeEl;
|
|
27
|
+
while (current && current !== root) {
|
|
28
|
+
if (current.hasAttribute
|
|
29
|
+
&& (current.hasAttribute('@for') || current.hasAttribute(':for') || current.hasAttribute('x-for'))) {
|
|
30
|
+
preserveDeferredParentComponentProps(scopeEl);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
current = current.parentElement || current.parentNode;
|
|
34
|
+
}
|
|
35
|
+
scopeEl.__stx_parent_scope = resolveComponentCallerScope(scopeEl, callerScope);
|
|
36
|
+
bindParentComponentProps(scopeEl, scopeEl.__stx_parent_scope);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Component setup scripts are emitted immediately after their scoped root.
|
|
41
|
+
// When that root itself carries :if, detaching only the element leaves the
|
|
42
|
+
// sibling setup script outside the conditional node group. Scripts inserted
|
|
43
|
+
// through innerHTML are inert, so the later hydration pass has no script to
|
|
44
|
+
// execute and the component keeps raw directives and interpolations.
|
|
45
|
+
function findConditionalComponentSetupSiblings(root) {
|
|
46
|
+
if (!root || !root.hasAttribute || !root.hasAttribute('data-stx-scope')) return [];
|
|
47
|
+
var scopeId = root.getAttribute('data-stx-scope');
|
|
48
|
+
var templateScopeId = root.getAttribute('data-stx-template-scope') || scopeId;
|
|
49
|
+
if (!scopeId) return [];
|
|
50
|
+
|
|
51
|
+
var scripts = [];
|
|
52
|
+
var sibling = root.nextSibling;
|
|
53
|
+
while (sibling) {
|
|
54
|
+
var next = sibling.nextSibling;
|
|
55
|
+
if (sibling.nodeType === Node.TEXT_NODE && !(sibling.textContent || '').trim()) {
|
|
56
|
+
sibling = next;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (sibling.nodeType === Node.COMMENT_NODE) {
|
|
60
|
+
sibling = next;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (sibling.nodeType === Node.ELEMENT_NODE
|
|
64
|
+
&& sibling.tagName === 'STYLE'
|
|
65
|
+
&& sibling.hasAttribute('data-stx-vendor')) {
|
|
66
|
+
sibling = next;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (sibling.nodeType === Node.ELEMENT_NODE
|
|
70
|
+
&& sibling.tagName === 'SCRIPT'
|
|
71
|
+
&& sibling.hasAttribute('data-stx-scoped')
|
|
72
|
+
&& ((sibling.textContent || '').indexOf(scopeId) !== -1
|
|
73
|
+
|| (templateScopeId && (sibling.textContent || '').indexOf(templateScopeId) !== -1))) {
|
|
74
|
+
scripts.push(sibling);
|
|
75
|
+
sibling = next;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
return scripts;
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** SPA container cleanup used by the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_CONTAINER_CLEANUP_RUNTIME = " // ==========================================================================\n // Container Cleanup (for SPA navigation)\n // ==========================================================================\n\n function cleanupContainer(container) {\n if (!container) return;\n\n // Clear pending mount callbacks from the departing page\n mountCallbacks.length = 0;\n\n // Reset componentScope \u2014 clear old page variables to prevent scope leaking\n // between SPA navigations. Preserve $refs and re-apply shell-level scope\n // from persistent elements (sidebar, nav) that live outside the container.\n var preservedRefs = componentScope.$refs || {};\n componentScope = { $refs: preservedRefs };\n // Re-apply scope from shell elements (outside the swap container)\n var shellElements = document.querySelectorAll('[data-stx-content] ~ *');\n document.querySelectorAll('body > *').forEach(function(el) {\n if (el === container) return;\n if (el.tagName === 'SCRIPT' || el.tagName === 'STYLE') return;\n if (el.__stx_scope) Object.assign(componentScope, el.__stx_scope);\n });\n\n // 1-2. Every descendant, then the container: cancel pending island\n // hydration (#1746), fire destroy hooks, dispose effects. Shared with\n // :for row removal and template :if hide so all three release the same\n // trackers, including the row and branch ones added for #1954.\n disposeSubtreeEffects(container);\n // Clear __stx_scope so _handleStxLoad's processElement guard doesn't skip it\n container.__stx_scope = null;\n\n // 3. Clean up scopes registered on departing components. Routed\n // through disposeSubtreeScopes so the same walk runs for SPA\n // navigation and for :if/:for-driven unmount (see #1727).\n disposeSubtreeScopes(container);\n\n // 4. Reclaim entries the container walk can't see \u2014 components rendered\n // outside the swap container, or already detached before step 3 ran its\n // querySelectorAll. Without this the registry grew every navigation (#1775).\n sweepOrphanedScopes();\n }\n";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const SIGNALS_CONTAINER_CLEANUP_RUNTIME = ` // ==========================================================================
|
|
2
|
+
// Container Cleanup (for SPA navigation)
|
|
3
|
+
// ==========================================================================
|
|
4
|
+
|
|
5
|
+
function cleanupContainer(container) {
|
|
6
|
+
if (!container) return;
|
|
7
|
+
|
|
8
|
+
// Clear pending mount callbacks from the departing page
|
|
9
|
+
mountCallbacks.length = 0;
|
|
10
|
+
|
|
11
|
+
// Reset componentScope \u2014 clear old page variables to prevent scope leaking
|
|
12
|
+
// between SPA navigations. Preserve $refs and re-apply shell-level scope
|
|
13
|
+
// from persistent elements (sidebar, nav) that live outside the container.
|
|
14
|
+
var preservedRefs = componentScope.$refs || {};
|
|
15
|
+
componentScope = { $refs: preservedRefs };
|
|
16
|
+
// Re-apply scope from shell elements (outside the swap container)
|
|
17
|
+
var shellElements = document.querySelectorAll('[data-stx-content] ~ *');
|
|
18
|
+
document.querySelectorAll('body > *').forEach(function(el) {
|
|
19
|
+
if (el === container) return;
|
|
20
|
+
if (el.tagName === 'SCRIPT' || el.tagName === 'STYLE') return;
|
|
21
|
+
if (el.__stx_scope) Object.assign(componentScope, el.__stx_scope);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// 1-2. Every descendant, then the container: cancel pending island
|
|
25
|
+
// hydration (#1746), fire destroy hooks, dispose effects. Shared with
|
|
26
|
+
// :for row removal and template :if hide so all three release the same
|
|
27
|
+
// trackers, including the row and branch ones added for #1954.
|
|
28
|
+
disposeSubtreeEffects(container);
|
|
29
|
+
// Clear __stx_scope so _handleStxLoad's processElement guard doesn't skip it
|
|
30
|
+
container.__stx_scope = null;
|
|
31
|
+
|
|
32
|
+
// 3. Clean up scopes registered on departing components. Routed
|
|
33
|
+
// through disposeSubtreeScopes so the same walk runs for SPA
|
|
34
|
+
// navigation and for :if/:for-driven unmount (see #1727).
|
|
35
|
+
disposeSubtreeScopes(container);
|
|
36
|
+
|
|
37
|
+
// 4. Reclaim entries the container walk can't see \u2014 components rendered
|
|
38
|
+
// outside the swap container, or already detached before step 3 ran its
|
|
39
|
+
// querySelectorAll. Without this the registry grew every navigation (#1775).
|
|
40
|
+
sweepOrphanedScopes();
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
@@ -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,48 @@
|
|
|
1
|
+
export const SIGNALS_CONTEXT_RUNTIME = ` // ==========================================================================
|
|
2
|
+
// Public API
|
|
3
|
+
// ==========================================================================
|
|
4
|
+
|
|
5
|
+
// ==========================================================================
|
|
6
|
+
// $: Computed Shorthand Support (Feature #7)
|
|
7
|
+
// ==========================================================================
|
|
8
|
+
|
|
9
|
+
// Helper function for $: reactive declarations (transformed by compiler)
|
|
10
|
+
// Usage: $computed(() => count * 2) is shorthand for derived()
|
|
11
|
+
function $computed(fn) {
|
|
12
|
+
return derived(fn);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Helper for watching a value with auto-unwrap
|
|
16
|
+
function $watch(deps, fn) {
|
|
17
|
+
effect(() => {
|
|
18
|
+
// Access all dependencies to track them
|
|
19
|
+
const values = Array.isArray(deps) ? deps.map(d => {
|
|
20
|
+
if (typeof d === 'function' && (d._isSignal || d._isDerived)) return d();
|
|
21
|
+
return d;
|
|
22
|
+
}) : (typeof deps === 'function' && (deps._isSignal || deps._isDerived)) ? [deps()] : [deps];
|
|
23
|
+
|
|
24
|
+
fn(...values);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// provide() \u2014 share values across components (like Vue's provide/inject)
|
|
29
|
+
// Usage: provide('Modal', Modal) \u2014 makes Modal accessible in all components
|
|
30
|
+
//
|
|
31
|
+
// inject() was auto-imported but implemented nowhere, so half of the pair
|
|
32
|
+
// worked: provide() succeeded and the failure surfaced only in the consumer
|
|
33
|
+
// (#1804). Values are recorded in a private registry as well as on window,
|
|
34
|
+
// because the global write collides with native properties \u2014 provide('name',
|
|
35
|
+
// x) lands on window.name, which the browser coerces to a string.
|
|
36
|
+
var __stxProvided = Object.create(null);
|
|
37
|
+
|
|
38
|
+
function provide(name, value) {
|
|
39
|
+
__stxProvided[name] = value;
|
|
40
|
+
window[name] = value;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function inject(name, defaultValue) {
|
|
44
|
+
if (name in __stxProvided) return __stxProvided[name];
|
|
45
|
+
if (name in window) return window[name];
|
|
46
|
+
return defaultValue;
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Cookie signal composable used by the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_COOKIE_RUNTIME = " // Reactive cookie binding. Mirrors useLocalStorage's shape: returns a string-\n // valued signal, writes on .set(), and respects cookie attributes via opts.\n // Setting the signal to '' deletes the cookie (max-age=0). Cookies don't fire\n // a 'storage' event, so cross-tab updates aren't auto-reflected; consumers\n // that need that can poll on 'visibilitychange' themselves. See issue #1701.\n function useCookie(name, opts) {\n opts = opts || {};\n var encode = opts.encode || encodeURIComponent;\n var decode = opts.decode || decodeURIComponent;\n // Escape cookie name so dots/brackets/etc. read safely through the matcher.\n var escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n var nameRe = new RegExp('(?:^|; )' + escapedName + '=([^;]*)');\n function read() {\n if (typeof document === 'undefined') return opts.defaultValue || '';\n var m = document.cookie.match(nameRe);\n return m ? decode(m[1]) : (opts.defaultValue || '');\n }\n var s = state(read());\n function serialise(value) {\n var parts = [name + '=' + (value ? encode(value) : '')];\n parts.push('path=' + (opts.path || '/'));\n if (opts.domain) parts.push('domain=' + opts.domain);\n if (value === '') parts.push('max-age=0');\n else if (typeof opts.maxAge === 'number') parts.push('max-age=' + opts.maxAge);\n else if (opts.expires !== undefined) {\n // Date, seconds-from-now, or anything Date can parse \u2014 matching the\n // composable. Accepting only a Date here meant the same option silently\n // produced a session cookie on the runtime path.\n var expiresDate = opts.expires instanceof Date\n ? opts.expires\n : (typeof opts.expires === 'number' ? new Date(Date.now() + opts.expires * 1000) : new Date(opts.expires));\n parts.push('expires=' + expiresDate.toUTCString());\n }\n parts.push('SameSite=' + (opts.sameSite || 'Lax'));\n var secure = opts.secure;\n if (secure === undefined) secure = typeof location !== 'undefined' && location.protocol === 'https:';\n if (secure) parts.push('Secure');\n return parts.join('; ');\n }\n // subscribe, not effect: an effect runs once at creation, so merely\n // DECLARING a cookie rewrote it from these options. A second declaration\n // that only wanted to read - no options, because it is not the owner of the\n // policy - therefore reserialised it with no max-age, which is the\n // definition of a session cookie. A 30-day login died at browser close\n // because the user opened a settings page (#1933).\n //\n // subscribe fires on set() only, so construction is a pure read: read()\n // above already seeds the signal. This matches the composable, which has\n // always used subscribe.\n s.subscribe(function(value) {\n if (typeof document === 'undefined') return;\n document.cookie = serialise(value);\n });\n return s;\n }\n";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export const SIGNALS_COOKIE_RUNTIME = ` // Reactive cookie binding. Mirrors useLocalStorage's shape: returns a string-
|
|
2
|
+
// valued signal, writes on .set(), and respects cookie attributes via opts.
|
|
3
|
+
// Setting the signal to '' deletes the cookie (max-age=0). Cookies don't fire
|
|
4
|
+
// a 'storage' event, so cross-tab updates aren't auto-reflected; consumers
|
|
5
|
+
// that need that can poll on 'visibilitychange' themselves. See issue #1701.
|
|
6
|
+
function useCookie(name, opts) {
|
|
7
|
+
opts = opts || {};
|
|
8
|
+
var encode = opts.encode || encodeURIComponent;
|
|
9
|
+
var decode = opts.decode || decodeURIComponent;
|
|
10
|
+
// Escape cookie name so dots/brackets/etc. read safely through the matcher.
|
|
11
|
+
var escapedName = name.replace(/[.*+?^\${}()|[\\]\\\\]/g, '\\\\$&');
|
|
12
|
+
var nameRe = new RegExp('(?:^|; )' + escapedName + '=([^;]*)');
|
|
13
|
+
function read() {
|
|
14
|
+
if (typeof document === 'undefined') return opts.defaultValue || '';
|
|
15
|
+
var m = document.cookie.match(nameRe);
|
|
16
|
+
return m ? decode(m[1]) : (opts.defaultValue || '');
|
|
17
|
+
}
|
|
18
|
+
var s = state(read());
|
|
19
|
+
function serialise(value) {
|
|
20
|
+
var parts = [name + '=' + (value ? encode(value) : '')];
|
|
21
|
+
parts.push('path=' + (opts.path || '/'));
|
|
22
|
+
if (opts.domain) parts.push('domain=' + opts.domain);
|
|
23
|
+
if (value === '') parts.push('max-age=0');
|
|
24
|
+
else if (typeof opts.maxAge === 'number') parts.push('max-age=' + opts.maxAge);
|
|
25
|
+
else if (opts.expires !== undefined) {
|
|
26
|
+
// Date, seconds-from-now, or anything Date can parse \u2014 matching the
|
|
27
|
+
// composable. Accepting only a Date here meant the same option silently
|
|
28
|
+
// produced a session cookie on the runtime path.
|
|
29
|
+
var expiresDate = opts.expires instanceof Date
|
|
30
|
+
? opts.expires
|
|
31
|
+
: (typeof opts.expires === 'number' ? new Date(Date.now() + opts.expires * 1000) : new Date(opts.expires));
|
|
32
|
+
parts.push('expires=' + expiresDate.toUTCString());
|
|
33
|
+
}
|
|
34
|
+
parts.push('SameSite=' + (opts.sameSite || 'Lax'));
|
|
35
|
+
var secure = opts.secure;
|
|
36
|
+
if (secure === undefined) secure = typeof location !== 'undefined' && location.protocol === 'https:';
|
|
37
|
+
if (secure) parts.push('Secure');
|
|
38
|
+
return parts.join('; ');
|
|
39
|
+
}
|
|
40
|
+
// subscribe, not effect: an effect runs once at creation, so merely
|
|
41
|
+
// DECLARING a cookie rewrote it from these options. A second declaration
|
|
42
|
+
// that only wanted to read - no options, because it is not the owner of the
|
|
43
|
+
// policy - therefore reserialised it with no max-age, which is the
|
|
44
|
+
// definition of a session cookie. A 30-day login died at browser close
|
|
45
|
+
// because the user opened a settings page (#1933).
|
|
46
|
+
//
|
|
47
|
+
// subscribe fires on set() only, so construction is a pure read: read()
|
|
48
|
+
// above already seeds the signal. This matches the composable, which has
|
|
49
|
+
// always used subscribe.
|
|
50
|
+
s.subscribe(function(value) {
|
|
51
|
+
if (typeof document === 'undefined') return;
|
|
52
|
+
document.cookie = serialise(value);
|
|
53
|
+
});
|
|
54
|
+
return s;
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** DevTools introspection used by the generated client runtime. */
|
|
2
|
+
export declare const SIGNALS_DEVTOOLS_RUNTIME = " // ==========================================================================\n // DevTools introspection (stacksjs/stx#1747, Phase 1)\n // ==========================================================================\n // A read-only, console-usable inspector wired to the live runtime \u2014 no manual\n // registration. Reads signal values via peek() so inspecting never subscribes\n // the active effect (i.e. it can't pollute the reactive graph).\n function __stxDevtoolsClassify(sv) {\n var out = { signals: {}, derived: {}, stores: {}, values: {}, methods: [] };\n if (!sv || typeof sv !== 'object') return out;\n Object.keys(sv).forEach(function(k) {\n if (k.indexOf('__') === 0 || k === '$el' || k === '$refs' || k === '$props') return;\n var v = sv[k];\n try {\n if (typeof v === 'function' && v._isSignal) out.signals[k] = peek(function() { return v(); });\n else if (typeof v === 'function' && v._isDerived) out.derived[k] = peek(function() { return v(); });\n else if (v && v._isStxStore) out.stores[k] = '[store]';\n else if (typeof v === 'function') out.methods.push(k);\n else out.values[k] = v;\n }\n catch (e) { out.values[k] = '[unreadable]'; }\n });\n return out;\n }\n window.__stxDevtools = {\n version: 4,\n // \u2500\u2500 Phase 2: reactivity instrumentation (dev-mode, opt-in) \u2500\u2500\n // Turn counting on/off. OFF by default so the runtime stays zero-overhead\n // until a devtools session asks for it.\n enable: function() { __stxDevtoolsTracking = true; },\n disable: function() { __stxDevtoolsTracking = false; },\n tracking: function() { return __stxDevtoolsTracking; },\n // Global tallies since the last reset: total signal changes + effect re-runs.\n stats: function() {\n return { signalSets: __stxDevtoolsStats.signalSets, effectRuns: __stxDevtoolsStats.effectRuns, tracking: __stxDevtoolsTracking };\n },\n resetStats: function() { __stxDevtoolsStats.signalSets = 0; __stxDevtoolsStats.effectRuns = 0; __stxDevtoolsIfTrace.length = 0; __stxDevtoolsQueries.length = 0; __stxDevtoolsMutations.length = 0; },\n // Phase 3: structured :if decision trace \u2014 which branch each reactive\n // @if/v-if/:if chain picked, newest last. Recorded only while tracking.\n ifTrace: function() { return __stxDevtoolsIfTrace.slice(); },\n // Phase 3: data-layer query timeline \u2014 { source, url, method, status, ok, ms }\n // for each useFetch/useQuery/useMutation request, newest last.\n queries: function() { return __stxDevtoolsQueries.slice(); },\n // Phase 4: state-change log \u2014 each recorded signal mutation { name, scope,\n // prev, next }, newest last. Resolves each signal id to its name + owning\n // scope/store at query time, so the buffer itself holds no live references.\n mutations: function() {\n var nameById = {};\n function index(container, label) {\n if (!container || typeof container !== 'object') return;\n Object.keys(container).forEach(function(k) {\n if (k.indexOf('__') === 0) return;\n var v = container[k];\n if (typeof v === 'function' && v._stxSignalId) nameById[v._stxSignalId] = { name: k, scope: label };\n });\n }\n var scopes = (window.stx && window.stx._scopes) || {};\n Object.keys(scopes).forEach(function(id) { index(scopes[id], id); });\n if (window.stx && window.stx._stores && typeof window.stx._stores.forEach === 'function')\n window.stx._stores.forEach(function(s, id) { index(s, 'store:' + id); });\n return __stxDevtoolsMutations.map(function(m) {\n var info = nameById[m.sid];\n return { name: info ? info.name : '(anonymous)', scope: info ? info.scope : null, prev: m.prev, next: m.next };\n });\n },\n // Reactive graph: per scope, each signal/derived with its current value, how\n // many times it was set (when tracking), and how many effects subscribe to\n // it (the dependency edges \u2014 \"which effects read this signal\", as a count).\n graph: function() {\n var out = [];\n var scopes = (window.stx && window.stx._scopes) || {};\n Object.keys(scopes).forEach(function(scopeId) {\n var sv = scopes[scopeId];\n if (!sv || typeof sv !== 'object') return;\n var nodes = [];\n Object.keys(sv).forEach(function(k) {\n if (k.indexOf('__') === 0 || k === '$el' || k === '$refs' || k === '$props') return;\n var v = sv[k];\n if (typeof v === 'function' && (v._isSignal || v._isDerived)) {\n nodes.push({\n name: k,\n type: v._isDerived ? 'derived' : 'signal',\n value: peek(function() { return v(); }),\n setCount: v._setCount || 0,\n subscribers: (v._effects && typeof v._effects.size === 'number') ? v._effects.size : 0\n });\n }\n });\n if (nodes.length) out.push({ scopeId: scopeId, nodes: nodes });\n });\n return out;\n },\n // Component tree from [data-stx-scope] elements, nested by DOM ancestry.\n tree: function() {\n var byEl = new Map();\n var roots = [];\n var nodes = document.querySelectorAll('[data-stx-scope]');\n Array.prototype.forEach.call(nodes, function(el) {\n byEl.set(el, { scopeId: el.getAttribute('data-stx-scope'), tag: (el.tagName || '').toLowerCase(), children: [], el: el });\n });\n Array.prototype.forEach.call(nodes, function(el) {\n var node = byEl.get(el);\n var p = el.parentElement;\n while (p && !byEl.has(p)) p = p.parentElement;\n if (p) byEl.get(p).children.push(node); else roots.push(node);\n });\n function clean(n) { return { scopeId: n.scopeId, tag: n.tag, children: n.children.map(clean) }; }\n return roots.map(clean);\n },\n // Signals / derived / stores / methods / plain values for a scope id.\n scope: function(scopeId) {\n var sv = (window.stx && window.stx._scopes) ? window.stx._scopes[scopeId] : null;\n return sv ? __stxDevtoolsClassify(sv) : null;\n },\n // The nearest enclosing scope's inspection for a DOM element.\n inspect: function(el) {\n var s = el;\n while (s && !(s.getAttribute && s.getAttribute('data-stx-scope'))) s = s.parentElement;\n return s ? this.scope(s.getAttribute('data-stx-scope')) : null;\n },\n // All registered stores by id.\n stores: function() {\n var out = {};\n var reg = window.stx && window.stx._stores;\n if (reg && typeof reg.forEach === 'function') reg.forEach(function(v, k) { out[k] = true; });\n return out;\n },\n // One store's state \u2014 its state signals / getters (derived) / plain values /\n // actions (methods). A store is just an object of those, so the same\n // classifier as scope() works (values read via peek \u2014 no graph pollution).\n store: function(id) {\n var reg = window.stx && window.stx._stores;\n var s = reg && typeof reg.get === 'function' ? reg.get(id) : null;\n return s ? __stxDevtoolsClassify(s) : null;\n },\n };\n";
|