@stacksjs/stx 0.2.532 → 0.2.534

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.
Files changed (298) hide show
  1. package/dist/{chunk-y4qks0bd.js → chunk-01343ehq.js} +2 -2
  2. package/dist/chunk-0e5nasyf.js +2 -0
  3. package/dist/chunk-13zbt9py.js +2 -0
  4. package/dist/{chunk-9w2vmfha.js → chunk-1c4t7ncb.js} +2 -2
  5. package/dist/{chunk-gxfnmjzp.js → chunk-1xgs9gd5.js} +2 -2
  6. package/dist/{chunk-4gt0r98p.js → chunk-2bvk0qyd.js} +2 -2
  7. package/dist/{chunk-y7ds4qyb.js → chunk-2h4f37kx.js} +2 -2
  8. package/dist/{chunk-q6e45gnw.js → chunk-2kvbg3t5.js} +3 -3
  9. package/dist/{chunk-xdtz2v5r.js → chunk-2n4je46m.js} +2 -2
  10. package/dist/{chunk-xcfhy5bj.js → chunk-33bzhsyw.js} +2 -2
  11. package/dist/{chunk-7ybgfk0m.js → chunk-3nk8cnrm.js} +2 -2
  12. package/dist/{chunk-gsxb0ry9.js → chunk-3r1m3tyr.js} +1 -1
  13. package/dist/chunk-3zs8yxy0.js +2 -0
  14. package/dist/{chunk-khwj964t.js → chunk-40hbpz2b.js} +3 -3
  15. package/dist/chunk-4a7v51vh.js +2 -0
  16. package/dist/{chunk-xtknewf7.js → chunk-4hyhr5r7.js} +1 -1
  17. package/dist/{chunk-hp1tnxzb.js → chunk-4pxc3r1p.js} +4 -4
  18. package/dist/chunk-4qts8zk7.js +2 -0
  19. package/dist/{chunk-587ehsxn.js → chunk-4r7s3862.js} +2 -2
  20. package/dist/chunk-4y2av4ev.js +2 -0
  21. package/dist/chunk-5g498pdp.js +2 -0
  22. package/dist/chunk-5gq8m2m7.js +2 -0
  23. package/dist/chunk-5wx323bm.js +2 -0
  24. package/dist/{chunk-d2r8t40y.js → chunk-66s4nhp7.js} +2 -2
  25. package/dist/{chunk-d7x6n702.js → chunk-6dtmants.js} +3 -3
  26. package/dist/chunk-6rcxtdh3.js +2 -0
  27. package/dist/{chunk-st79dqpz.js → chunk-6sd4zdtg.js} +1 -1
  28. package/dist/{chunk-zpdq0kx1.js → chunk-6tnh3cyq.js} +1 -1
  29. package/dist/chunk-6va8wt88.js +2 -0
  30. package/dist/chunk-7v2j9bmc.js +2 -0
  31. package/dist/chunk-7zgtdap7.js +2 -0
  32. package/dist/{chunk-0pebjkzx.js → chunk-843y0pfg.js} +4 -4
  33. package/dist/{chunk-4xxhprts.js → chunk-8chxczpj.js} +3 -3
  34. package/dist/{chunk-b7xdk1g4.js → chunk-8m1y1kyr.js} +5 -5
  35. package/dist/chunk-90kzf313.js +2 -0
  36. package/dist/{chunk-t6769zcy.js → chunk-93n6yv5x.js} +12 -12
  37. package/dist/chunk-94rg5s6c.js +2 -0
  38. package/dist/chunk-9674w2gm.js +2 -0
  39. package/dist/{chunk-gvw8wh29.js → chunk-9p6bt089.js} +3 -3
  40. package/dist/{chunk-kg77xs08.js → chunk-bczcm7jk.js} +2 -2
  41. package/dist/{chunk-rs46hksk.js → chunk-bxsehntq.js} +1 -1
  42. package/dist/{chunk-vg8thz41.js → chunk-c56qtne1.js} +1 -1
  43. package/dist/chunk-d1jxmhph.js +2 -0
  44. package/dist/{chunk-5tj6expd.js → chunk-d7zterbp.js} +2 -2
  45. package/dist/{chunk-664503e6.js → chunk-d871008z.js} +4 -4
  46. package/dist/chunk-dekpf1ry.js +2 -0
  47. package/dist/chunk-epa1c4q4.js +2 -0
  48. package/dist/{chunk-xb0785wp.js → chunk-f3q84h7b.js} +2 -2
  49. package/dist/{chunk-g060jncp.js → chunk-fqfqyn48.js} +4 -4
  50. package/dist/{chunk-g5t10z04.js → chunk-gnx0fzne.js} +60 -60
  51. package/dist/chunk-gsc5t942.js +2 -0
  52. package/dist/chunk-gsm1y1kb.js +2 -0
  53. package/dist/chunk-gxedmh17.js +2 -0
  54. package/dist/{chunk-9xq5yer8.js → chunk-h4crv0by.js} +1 -1
  55. package/dist/{chunk-pr5q4wev.js → chunk-hp8g2q2n.js} +1 -1
  56. package/dist/{chunk-38w14qs7.js → chunk-hvpzy98g.js} +1 -1
  57. package/dist/chunk-j9c0yam7.js +2 -0
  58. package/dist/{chunk-12e4a0ab.js → chunk-jbfad9cc.js} +2 -2
  59. package/dist/chunk-jv3jj612.js +2 -0
  60. package/dist/chunk-jvqas8y2.js +2 -0
  61. package/dist/{chunk-rwn3b21z.js → chunk-k3v13vfr.js} +2 -2
  62. package/dist/chunk-kcs7hyep.js +2 -0
  63. package/dist/chunk-kvp0at16.js +2 -0
  64. package/dist/{chunk-31c1g3rt.js → chunk-m011s2ha.js} +3 -3
  65. package/dist/{chunk-2jk0vceh.js → chunk-m56m95gk.js} +2 -2
  66. package/dist/{chunk-7s14bthq.js → chunk-m5fw8jq1.js} +2 -2
  67. package/dist/chunk-m7jmpech.js +2 -0
  68. package/dist/chunk-m8n9wxba.js +2 -0
  69. package/dist/{chunk-fyxydww2.js → chunk-mjdyyekx.js} +2 -2
  70. package/dist/{chunk-ennxrn5g.js → chunk-nd8v4xgb.js} +5 -5
  71. package/dist/chunk-ngma9vzc.js +2 -0
  72. package/dist/{chunk-rtk6n3vh.js → chunk-ngxqydsg.js} +3 -3
  73. package/dist/{chunk-ee4wwr89.js → chunk-nmy4x6dx.js} +4 -4
  74. package/dist/chunk-pz1mjgsp.js +2 -0
  75. package/dist/{chunk-er031j13.js → chunk-qfc912e5.js} +2 -2
  76. package/dist/chunk-qk3ptn6h.js +2 -0
  77. package/dist/{chunk-03wggzg8.js → chunk-qmza4327.js} +2 -2
  78. package/dist/{chunk-j8pacd7m.js → chunk-qqr4rn9p.js} +4 -4
  79. package/dist/chunk-rx4hz615.js +2 -0
  80. package/dist/chunk-shf0hd05.js +2 -0
  81. package/dist/{chunk-3vvppnws.js → chunk-sqb6gkzf.js} +8374 -8374
  82. package/dist/chunk-t1g1sp2z.js +2 -0
  83. package/dist/{chunk-m2v04c6v.js → chunk-tgc645pa.js} +45 -45
  84. package/dist/{chunk-2dzd2h15.js → chunk-tkvp3rz0.js} +1 -1
  85. package/dist/{chunk-458etq5a.js → chunk-tqnh98j7.js} +3 -3
  86. package/dist/chunk-tr9bjtqx.js +2 -0
  87. package/dist/{chunk-2y6tzn6d.js → chunk-ty1v368m.js} +2 -2
  88. package/dist/{chunk-grb3kfya.js → chunk-v4r8nzf3.js} +1 -1
  89. package/dist/{chunk-p8yh7mgr.js → chunk-v9vvzdag.js} +2 -2
  90. package/dist/{chunk-0wvsfs4s.js → chunk-vb4xxpa6.js} +2 -2
  91. package/dist/chunk-vfnerp7h.js +2 -0
  92. package/dist/{chunk-tkeabv04.js → chunk-vhfwnvmc.js} +5 -5
  93. package/dist/{chunk-15r72kw7.js → chunk-vjdj0ex3.js} +1 -1
  94. package/dist/{chunk-9pztpvvk.js → chunk-wh7xn313.js} +1 -1
  95. package/dist/chunk-wjt46tdp.js +2 -0
  96. package/dist/chunk-wxy9re1a.js +2 -0
  97. package/dist/{chunk-kwvexxey.js → chunk-x607yxrc.js} +3 -3
  98. package/dist/{chunk-3zyvhf4p.js → chunk-xey01yna.js} +1 -1
  99. package/dist/{chunk-stbsqy7e.js → chunk-xwrbrg1q.js} +1 -1
  100. package/dist/{chunk-9sqjmd9a.js → chunk-y18yvcjb.js} +5 -5
  101. package/dist/chunk-ydtnskdv.js +2 -0
  102. package/dist/{chunk-ky25egh1.js → chunk-yw3cqy43.js} +1 -1
  103. package/dist/{chunk-1945hk44.js → chunk-z9r3tqyr.js} +1 -1
  104. package/dist/chunk-zeve89kw.js +2 -0
  105. package/dist/cli.js +12 -12
  106. package/dist/client/signals-appearance-runtime.d.ts +2 -0
  107. package/dist/client/signals-appearance-runtime.js +283 -0
  108. package/dist/client/signals-authoring-runtime.d.ts +2 -0
  109. package/dist/client/signals-authoring-runtime.js +187 -0
  110. package/dist/client/signals-binding-utils-runtime.d.ts +2 -0
  111. package/dist/client/signals-binding-utils-runtime.js +130 -0
  112. package/dist/client/signals-bootstrap-runtime.d.ts +4 -0
  113. package/dist/client/signals-bootstrap-runtime.js +24 -0
  114. package/dist/client/signals-class-runtime.d.ts +2 -0
  115. package/dist/client/signals-class-runtime.js +69 -0
  116. package/dist/client/signals-component-api-runtime.d.ts +1 -0
  117. package/dist/client/signals-component-api-runtime.js +57 -0
  118. package/dist/client/signals-component-hydration-runtime.d.ts +2 -0
  119. package/dist/client/signals-component-hydration-runtime.js +147 -0
  120. package/dist/client/signals-component-props-runtime.d.ts +2 -0
  121. package/dist/client/signals-component-props-runtime.js +90 -0
  122. package/dist/client/signals-conditional-chain-runtime.d.ts +2 -0
  123. package/dist/client/signals-conditional-chain-runtime.js +39 -0
  124. package/dist/client/signals-conditional-component-runtime.d.ts +2 -0
  125. package/dist/client/signals-conditional-component-runtime.js +82 -0
  126. package/dist/client/signals-container-cleanup-runtime.d.ts +2 -0
  127. package/dist/client/signals-container-cleanup-runtime.js +42 -0
  128. package/dist/client/signals-context-runtime.d.ts +2 -0
  129. package/dist/client/signals-context-runtime.js +48 -0
  130. package/dist/client/signals-cookie-runtime.d.ts +2 -0
  131. package/dist/client/signals-cookie-runtime.js +56 -0
  132. package/dist/client/signals-devtools-runtime.d.ts +2 -0
  133. package/dist/client/signals-devtools-runtime.js +136 -0
  134. package/dist/client/signals-dialog-runtime.d.ts +2 -0
  135. package/dist/client/signals-dialog-runtime.js +195 -0
  136. package/dist/client/signals-dom-ready-runtime.d.ts +2 -0
  137. package/dist/client/signals-dom-ready-runtime.js +306 -0
  138. package/dist/client/signals-drawer-runtime.d.ts +2 -0
  139. package/dist/client/signals-drawer-runtime.js +39 -0
  140. package/dist/client/signals-effect-runtime.d.ts +2 -0
  141. package/dist/client/signals-effect-runtime.js +157 -0
  142. package/dist/client/signals-event-shorthand-runtime.d.ts +2 -0
  143. package/dist/client/signals-event-shorthand-runtime.js +88 -0
  144. package/dist/client/signals-expression-compiler-runtime.d.ts +2 -0
  145. package/dist/client/signals-expression-compiler-runtime.js +59 -0
  146. package/dist/client/signals-expression-runtime.d.ts +2 -0
  147. package/dist/client/signals-expression-runtime.js +67 -0
  148. package/dist/client/signals-fetch-runtime.d.ts +2 -0
  149. package/dist/client/signals-fetch-runtime.js +144 -0
  150. package/dist/client/signals-fetch-transport-runtime.d.ts +2 -0
  151. package/dist/client/signals-fetch-transport-runtime.js +216 -0
  152. package/dist/client/signals-for-runtime.d.ts +2 -0
  153. package/dist/client/signals-for-runtime.js +647 -0
  154. package/dist/client/signals-globals-runtime.d.ts +2 -0
  155. package/dist/client/signals-globals-runtime.js +66 -0
  156. package/dist/client/signals-handler-runtime.d.ts +2 -0
  157. package/dist/client/signals-handler-runtime.js +80 -0
  158. package/dist/client/signals-head-runtime.d.ts +2 -0
  159. package/dist/client/signals-head-runtime.js +92 -0
  160. package/dist/client/signals-helpers-runtime.d.ts +2 -0
  161. package/dist/client/signals-helpers-runtime.js +137 -0
  162. package/dist/client/signals-host-runtime.d.ts +9 -0
  163. package/dist/client/signals-host-runtime.js +132 -0
  164. package/dist/client/signals-hydration-audit-runtime.d.ts +2 -0
  165. package/dist/client/signals-hydration-audit-runtime.js +209 -0
  166. package/dist/client/signals-hydration-runtime.d.ts +2 -0
  167. package/dist/client/signals-hydration-runtime.js +52 -0
  168. package/dist/client/signals-if-chain-runtime.d.ts +2 -0
  169. package/dist/client/signals-if-chain-runtime.js +283 -0
  170. package/dist/client/signals-if-runtime.d.ts +2 -0
  171. package/dist/client/signals-if-runtime.js +346 -0
  172. package/dist/client/signals-kept-runtime.d.ts +2 -0
  173. package/dist/client/signals-kept-runtime.js +62 -0
  174. package/dist/client/signals-lazy-hydration-runtime.d.ts +2 -0
  175. package/dist/client/signals-lazy-hydration-runtime.js +133 -0
  176. package/dist/client/signals-lifecycle-runtime.d.ts +2 -0
  177. package/dist/client/signals-lifecycle-runtime.js +114 -0
  178. package/dist/client/signals-loop-component-remap-runtime.d.ts +2 -0
  179. package/dist/client/signals-loop-component-remap-runtime.js +66 -0
  180. package/dist/client/signals-loop-conditional-runtime.d.ts +2 -0
  181. package/dist/client/signals-loop-conditional-runtime.js +48 -0
  182. package/dist/client/signals-loop-row-runtime.d.ts +2 -0
  183. package/dist/client/signals-loop-row-runtime.js +41 -0
  184. package/dist/client/signals-manifest-hydration-runtime.d.ts +2 -0
  185. package/dist/client/signals-manifest-hydration-runtime.js +82 -0
  186. package/dist/client/signals-model-runtime.d.ts +2 -0
  187. package/dist/client/signals-model-runtime.js +156 -0
  188. package/dist/client/signals-mount-runtime.d.ts +1 -0
  189. package/dist/client/signals-mount-runtime.js +231 -0
  190. package/dist/client/signals-navigation-runtime.d.ts +2 -0
  191. package/dist/client/signals-navigation-runtime.js +198 -0
  192. package/dist/client/signals-optimistic-runtime.d.ts +2 -0
  193. package/dist/client/signals-optimistic-runtime.js +34 -0
  194. package/dist/client/signals-overlay-runtime.d.ts +2 -0
  195. package/dist/client/signals-overlay-runtime.js +352 -0
  196. package/dist/client/signals-pipe-runtime.d.ts +2 -0
  197. package/dist/client/signals-pipe-runtime.js +177 -0
  198. package/dist/client/signals-process-element-runtime.d.ts +1 -0
  199. package/dist/client/signals-process-element-runtime.js +696 -0
  200. package/dist/client/signals-proxy-runtime.d.ts +2 -0
  201. package/dist/client/signals-proxy-runtime.js +78 -0
  202. package/dist/client/signals-public-api-runtime.d.ts +1 -0
  203. package/dist/client/signals-public-api-runtime.js +120 -0
  204. package/dist/client/signals-query-runtime.d.ts +2 -0
  205. package/dist/client/signals-query-runtime.js +351 -0
  206. package/dist/client/signals-reactive-core-bootstrap-runtime.d.ts +1 -0
  207. package/dist/client/signals-reactive-core-bootstrap-runtime.js +30 -0
  208. package/dist/client/signals-reactive-runtime.d.ts +2 -0
  209. package/dist/client/signals-reactive-runtime.js +67 -0
  210. package/dist/client/signals-ref-runtime.d.ts +2 -0
  211. package/dist/client/signals-ref-runtime.js +33 -0
  212. package/dist/client/signals-scope-disposal-runtime.d.ts +2 -0
  213. package/dist/client/signals-scope-disposal-runtime.js +195 -0
  214. package/dist/client/signals-scope-traversal-runtime.d.ts +2 -0
  215. package/dist/client/signals-scope-traversal-runtime.js +42 -0
  216. package/dist/client/signals-show-runtime.d.ts +2 -0
  217. package/dist/client/signals-show-runtime.js +54 -0
  218. package/dist/client/signals-spa-load-control-runtime.d.ts +2 -0
  219. package/dist/client/signals-spa-load-control-runtime.js +42 -0
  220. package/dist/client/signals-spa-load-runtime.d.ts +2 -0
  221. package/dist/client/signals-spa-load-runtime.js +187 -0
  222. package/dist/client/signals-state-runtime.d.ts +2 -0
  223. package/dist/client/signals-state-runtime.js +125 -0
  224. package/dist/client/signals-storage-runtime.d.ts +2 -0
  225. package/dist/client/signals-storage-runtime.js +79 -0
  226. package/dist/client/signals-store-registry-runtime.d.ts +1 -0
  227. package/dist/client/signals-store-registry-runtime.js +461 -0
  228. package/dist/client/signals-style-runtime.d.ts +2 -0
  229. package/dist/client/signals-style-runtime.js +35 -0
  230. package/dist/client/signals-suspense-runtime.d.ts +2 -0
  231. package/dist/client/signals-suspense-runtime.js +59 -0
  232. package/dist/client/signals-timer-runtime.d.ts +2 -0
  233. package/dist/client/signals-timer-runtime.js +378 -0
  234. package/dist/client/signals-toast-runtime.d.ts +2 -0
  235. package/dist/client/signals-toast-runtime.js +206 -0
  236. package/dist/client/signals-tooltip-runtime.d.ts +2 -0
  237. package/dist/client/signals-tooltip-runtime.js +40 -0
  238. package/dist/client/signals-transition-group-runtime.d.ts +2 -0
  239. package/dist/client/signals-transition-group-runtime.js +92 -0
  240. package/dist/client/signals-websocket-runtime.d.ts +2 -0
  241. package/dist/client/signals-websocket-runtime.js +138 -0
  242. package/dist/craft-entry.js +2 -2
  243. package/dist/craft.js +2 -2
  244. package/dist/pwa.js +3 -3
  245. package/dist/signals-context-runtime.d.ts +2 -0
  246. package/dist/signals-drawer-runtime.d.ts +2 -0
  247. package/dist/signals-host-runtime.d.ts +9 -0
  248. package/dist/signals-loop-conditional-runtime.d.ts +2 -0
  249. package/dist/signals-manifest-hydration-runtime.d.ts +2 -0
  250. package/dist/signals-optimistic-runtime.d.ts +2 -0
  251. package/dist/signals-overlay-runtime.d.ts +2 -0
  252. package/dist/signals-scope-disposal-runtime.d.ts +2 -0
  253. package/dist/signals-spa-load-control-runtime.d.ts +2 -0
  254. package/dist/signals-storage-runtime.d.ts +2 -0
  255. package/dist/signals.js +141 -9900
  256. package/dist/ssg.js +3 -3
  257. package/package.json +5 -5
  258. package/dist/chunk-0p9pwd61.js +0 -2
  259. package/dist/chunk-0zmv31nc.js +0 -2
  260. package/dist/chunk-28xtazwz.js +0 -2
  261. package/dist/chunk-2936t942.js +0 -2
  262. package/dist/chunk-29qwmthc.js +0 -2
  263. package/dist/chunk-323cxa69.js +0 -2
  264. package/dist/chunk-375zp0vr.js +0 -2
  265. package/dist/chunk-3w49r16x.js +0 -2
  266. package/dist/chunk-8bcvb86w.js +0 -2
  267. package/dist/chunk-8gmb3k1p.js +0 -2
  268. package/dist/chunk-a15yzfc6.js +0 -2
  269. package/dist/chunk-d4155ec5.js +0 -2
  270. package/dist/chunk-dd31q423.js +0 -2
  271. package/dist/chunk-f2q5bckn.js +0 -2
  272. package/dist/chunk-fhx35529.js +0 -2
  273. package/dist/chunk-h1y5q942.js +0 -2
  274. package/dist/chunk-h791c7sb.js +0 -2
  275. package/dist/chunk-h88jcr3k.js +0 -2
  276. package/dist/chunk-heq5c0gd.js +0 -2
  277. package/dist/chunk-j3b24e77.js +0 -2
  278. package/dist/chunk-jpck8nm5.js +0 -2
  279. package/dist/chunk-m4d99a9r.js +0 -2
  280. package/dist/chunk-ng2sdph7.js +0 -2
  281. package/dist/chunk-qs3p7sc6.js +0 -2
  282. package/dist/chunk-rchwwcxy.js +0 -2
  283. package/dist/chunk-rk4mttds.js +0 -2
  284. package/dist/chunk-rma3bv36.js +0 -2
  285. package/dist/chunk-rp5a91ak.js +0 -2
  286. package/dist/chunk-sp5x96rn.js +0 -2
  287. package/dist/chunk-t2mjeezd.js +0 -2
  288. package/dist/chunk-t61j834x.js +0 -2
  289. package/dist/chunk-v2vg5jqq.js +0 -2
  290. package/dist/chunk-vmfw4svt.js +0 -2
  291. package/dist/chunk-w6ecbk3y.js +0 -2
  292. package/dist/chunk-wbv6vjhm.js +0 -2
  293. package/dist/chunk-wfbr3txe.js +0 -2
  294. package/dist/chunk-wpnv0naj.js +0 -2
  295. package/dist/chunk-wwny5dk9.js +0 -2
  296. package/dist/chunk-x55avrcf.js +0 -2
  297. package/dist/chunk-yts2745t.js +0 -2
  298. package/dist/chunk-zah67v44.js +0 -2
@@ -0,0 +1,114 @@
1
+ export const SIGNALS_LIFECYCLE_RUNTIME = ` // ==========================================================================
2
+ // Lifecycle
3
+ // ==========================================================================
4
+
5
+ const mountCallbacks = [];
6
+ const destroyCallbacks = [];
7
+
8
+ function currentLifecycleScope() {
9
+ var el = window.__STX_CURRENT_ELEMENT__;
10
+ if (!el || !el.getAttribute || !window.stx || !window.stx._scopes) return null;
11
+ var scopeId = el.getAttribute('data-stx-scope');
12
+ return scopeId ? window.stx._scopes[scopeId] || null : null;
13
+ }
14
+
15
+ function onMount(fn) {
16
+ var scope = currentLifecycleScope();
17
+ if (scope) {
18
+ scope.__mountCallbacks = scope.__mountCallbacks || [];
19
+ scope.__mountCallbacks.push(fn);
20
+ // Kept apart from the queue, which a flush drains: a component behind an
21
+ // :if mounts again every time it is shown (see suspendSubtreeScopes).
22
+ scope.__mountHooks = scope.__mountHooks || [];
23
+ scope.__mountHooks.push(fn);
24
+ return;
25
+ }
26
+ mountCallbacks.push(fn);
27
+ }
28
+
29
+ // Where an onDestroy called from inside a running mount callback belongs:
30
+ // the queue runMountCallbacks is parking cleanups on, which is the mounting
31
+ // component's own. Null outside a flush.
32
+ //
33
+ // Without it such a call, typically a composable like useEventListener
34
+ // invoked in onMount, found no current element and went to the global
35
+ // queue, and every stx:load drains that queue. A component that stays on
36
+ // the page across navigations (one the layout renders) lost the listener at
37
+ // the first navigation while its markup stayed bound (#1958).
38
+ var activeDestroySink = null;
39
+
40
+ function onDestroy(fn) {
41
+ var scope = currentLifecycleScope();
42
+ if (scope) {
43
+ scope.__destroyCallbacks = scope.__destroyCallbacks || [];
44
+ scope.__destroyCallbacks.push(fn);
45
+ // Registered once, at setup, and owed at every unmount -- including each
46
+ // time an :if hides the component (see suspendSubtreeScopes).
47
+ scope.__destroyHooks = scope.__destroyHooks || [];
48
+ scope.__destroyHooks.push(fn);
49
+ return;
50
+ }
51
+ if (activeDestroySink) {
52
+ activeDestroySink.push(fn);
53
+ return;
54
+ }
55
+ destroyCallbacks.push(fn);
56
+ }
57
+
58
+ // Run mount callbacks and keep whatever teardown they hand back.
59
+ //
60
+ // A mount callback may return its own cleanup \u2014 the shape LifecycleCallback
61
+ // has always declared, and the shape every peer framework uses. Only the two
62
+ // component-factory paths honoured it; the other flush sites called fn() and
63
+ // dropped the result on the floor, so the teardown never ran and nothing said
64
+ // so. A listener or timer registered that way outlived its element and leaked
65
+ // once per re-render (#1857).
66
+ //
67
+ // The sink argument is where a returned cleanup is parked: a scoped flush
68
+ // passes that scope's __destroyCallbacks, a global flush passes the module
69
+ // queue. (No backticks in this comment \u2014 it lives inside a template literal.)
70
+ function runMountCallbacks(list, sink) {
71
+ if (!list || !list.length) return;
72
+ var target = sink || destroyCallbacks;
73
+ // Drain before running. A mount callback fires once, and leaving the queue
74
+ // in place made that untrue: the DOM-ready handler reaches this with the
75
+ // same shared mountCallbacks array twice \u2014 once inside the per-root
76
+ // hydration loop, then again for the global pass \u2014 and only emptied it
77
+ // after the second call. So every onMount on a page with a data-stx root
78
+ // ran twice, and a page with N roots ran them N+1 times. Every request the
79
+ // hook made was duplicated with it.
80
+ // Taking the batch out first also keeps a callback that registers another
81
+ // onMount honest: the new one queues for the next flush instead of being
82
+ // swallowed by the clear or replayed by the next caller.
83
+ var batch = list.splice(0, list.length);
84
+ // An onDestroy registered while the batch runs joins the same queue as a
85
+ // returned cleanup. Saved and restored, so a mount that mounts something
86
+ // else (stx.mount inside onMount) hands the outer sink back afterwards.
87
+ var previousSink = activeDestroySink;
88
+ activeDestroySink = target;
89
+ try {
90
+ for (var i = 0; i < batch.length; i++) {
91
+ try {
92
+ var cleanup = batch[i]();
93
+ if (typeof cleanup === 'function') target.push(cleanup);
94
+ }
95
+ catch (e) { console.error('[stx] onMount error:', e); }
96
+ }
97
+ }
98
+ finally {
99
+ activeDestroySink = previousSink;
100
+ }
101
+ }
102
+
103
+ // The scope's own teardown queue, created on demand so a scope that never
104
+ // returns a cleanup does not carry an empty array around.
105
+ function scopeDestroySink(scopeVars) {
106
+ if (!scopeVars) return destroyCallbacks;
107
+ scopeVars.__destroyCallbacks = scopeVars.__destroyCallbacks || [];
108
+ return scopeVars.__destroyCallbacks;
109
+ }
110
+
111
+ // Drain any early mount/destroy calls captured by the pre-initialization shim
112
+ if (window.__stx_early_mounts) { window.__stx_early_mounts.forEach(function(fn) { mountCallbacks.push(fn); }); window.__stx_early_mounts = null; }
113
+ if (window.__stx_early_destroys) { window.__stx_early_destroys.forEach(function(fn) { destroyCallbacks.push(fn); }); window.__stx_early_destroys = null; }
114
+ `;
@@ -0,0 +1,2 @@
1
+ /** Loop component scope remapping helpers for the generated client runtime. */
2
+ export declare const SIGNALS_LOOP_COMPONENT_REMAP_RUNTIME = " var __forComponentScopeCounter = 0;\n var __forComponentSetupFactories = new Map();\n\n function forEachGroupElement(nodes, callback) {\n function visit(node, insideTemplateContent) {\n if (!node || node.nodeType !== Node.ELEMENT_NODE) return;\n callback(node, insideTemplateContent);\n\n // HTMLTemplateElement children live in template.content, outside the\n // element's ordinary descendant tree. Component roots and setup scripts\n // wrapped by caller-owned :if/:for directives must still be discoverable\n // for scope remapping before those templates are cloned.\n var entersTemplateContent = node.tagName === 'TEMPLATE' && node.content;\n var childRoot = entersTemplateContent\n ? node.content\n : node;\n Array.from(childRoot.childNodes || []).forEach(function(child) {\n visit(child, insideTemplateContent || entersTemplateContent);\n });\n }\n\n nodes.forEach(function(node) { visit(node, false); });\n }\n\n // A signal component expanded inside <template :for> carries a compiled\n // data-stx-scope id and setup script. cloneNode() used to duplicate that id\n // for every row, so all instances shared the first child's props and state.\n // Give each cloned component tree its own ids before insertion, and rewrite\n // the setup scripts that target those ids.\n function remapForComponentScopes(nodes) {\n var scopeMap = {};\n forEachGroupElement(nodes, function(node) {\n if (!node.hasAttribute || !node.hasAttribute('data-stx-scope')) return;\n var oldId = node.getAttribute('data-stx-scope');\n if (!oldId) return;\n if (!scopeMap[oldId])\n scopeMap[oldId] = oldId + '_for_' + (++__forComponentScopeCounter);\n // Keep the compiler's original id through any additional structural\n // clones. DOM cloneNode() preserves attributes but not expando fields.\n if (!node.hasAttribute('data-stx-template-scope'))\n node.setAttribute('data-stx-template-scope', oldId);\n node.setAttribute('data-stx-scope', scopeMap[oldId]);\n });\n\n var oldIds = Object.keys(scopeMap);\n if (!oldIds.length) return;\n\n forEachGroupElement(nodes, function(node) {\n if (node.attributes) {\n Array.from(node.attributes).forEach(function(rawAttribute) {\n var attribute = Array.isArray(rawAttribute)\n ? { name: rawAttribute[0], value: rawAttribute[1] }\n : rawAttribute;\n if (!attribute || attribute.name === 'data-stx-scope' || attribute.name === 'data-stx-template-scope') return;\n var value = attribute.value;\n if (typeof value !== 'string') return;\n oldIds.forEach(function(oldId) {\n if (value.indexOf(oldId) !== -1)\n value = value.split(oldId).join(scopeMap[oldId]);\n });\n if (value !== attribute.value) node.setAttribute(attribute.name, value);\n });\n }\n });\n }\n";
@@ -0,0 +1,66 @@
1
+ export const SIGNALS_LOOP_COMPONENT_REMAP_RUNTIME = ` var __forComponentScopeCounter = 0;
2
+ var __forComponentSetupFactories = new Map();
3
+
4
+ function forEachGroupElement(nodes, callback) {
5
+ function visit(node, insideTemplateContent) {
6
+ if (!node || node.nodeType !== Node.ELEMENT_NODE) return;
7
+ callback(node, insideTemplateContent);
8
+
9
+ // HTMLTemplateElement children live in template.content, outside the
10
+ // element's ordinary descendant tree. Component roots and setup scripts
11
+ // wrapped by caller-owned :if/:for directives must still be discoverable
12
+ // for scope remapping before those templates are cloned.
13
+ var entersTemplateContent = node.tagName === 'TEMPLATE' && node.content;
14
+ var childRoot = entersTemplateContent
15
+ ? node.content
16
+ : node;
17
+ Array.from(childRoot.childNodes || []).forEach(function(child) {
18
+ visit(child, insideTemplateContent || entersTemplateContent);
19
+ });
20
+ }
21
+
22
+ nodes.forEach(function(node) { visit(node, false); });
23
+ }
24
+
25
+ // A signal component expanded inside <template :for> carries a compiled
26
+ // data-stx-scope id and setup script. cloneNode() used to duplicate that id
27
+ // for every row, so all instances shared the first child's props and state.
28
+ // Give each cloned component tree its own ids before insertion, and rewrite
29
+ // the setup scripts that target those ids.
30
+ function remapForComponentScopes(nodes) {
31
+ var scopeMap = {};
32
+ forEachGroupElement(nodes, function(node) {
33
+ if (!node.hasAttribute || !node.hasAttribute('data-stx-scope')) return;
34
+ var oldId = node.getAttribute('data-stx-scope');
35
+ if (!oldId) return;
36
+ if (!scopeMap[oldId])
37
+ scopeMap[oldId] = oldId + '_for_' + (++__forComponentScopeCounter);
38
+ // Keep the compiler's original id through any additional structural
39
+ // clones. DOM cloneNode() preserves attributes but not expando fields.
40
+ if (!node.hasAttribute('data-stx-template-scope'))
41
+ node.setAttribute('data-stx-template-scope', oldId);
42
+ node.setAttribute('data-stx-scope', scopeMap[oldId]);
43
+ });
44
+
45
+ var oldIds = Object.keys(scopeMap);
46
+ if (!oldIds.length) return;
47
+
48
+ forEachGroupElement(nodes, function(node) {
49
+ if (node.attributes) {
50
+ Array.from(node.attributes).forEach(function(rawAttribute) {
51
+ var attribute = Array.isArray(rawAttribute)
52
+ ? { name: rawAttribute[0], value: rawAttribute[1] }
53
+ : rawAttribute;
54
+ if (!attribute || attribute.name === 'data-stx-scope' || attribute.name === 'data-stx-template-scope') return;
55
+ var value = attribute.value;
56
+ if (typeof value !== 'string') return;
57
+ oldIds.forEach(function(oldId) {
58
+ if (value.indexOf(oldId) !== -1)
59
+ value = value.split(oldId).join(scopeMap[oldId]);
60
+ });
61
+ if (value !== attribute.value) node.setAttribute(attribute.name, value);
62
+ });
63
+ }
64
+ });
65
+ }
66
+ `;
@@ -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,48 @@
1
+ export const SIGNALS_LOOP_CONDITIONAL_RUNTIME = ` // A :for row is a clone of its template, so a conditional element in the row
2
+ // is built for every row whether or not its condition ever holds; :if then
3
+ // parks the false ones. In WebKit a <video> or <audio> sets up a media player
4
+ // as it is created: a message list with one media slot per attachment took
5
+ // 1.8s to render instead of 18ms, and every row paid for elements it never
6
+ // showed. Before any row is cloned, each eligible conditional element in the
7
+ // row template is moved into a <template> carrying its condition. Template
8
+ // content is inert, so a cloned row builds the element only when the
9
+ // condition holds (bindIf clones template content on the first true).
10
+ //
11
+ // Left alone: an if/else chain (its branches must stay siblings), an element
12
+ // that is also a loop, a component (its setup script is a sibling), and
13
+ // anything holding a script.
14
+ var IF_ATTRS = [':if', 'x-if', '@if'];
15
+ var FOR_ATTRS = [':for', 'x-for', '@for'];
16
+ function deferRowConditionals(root) {
17
+ if (!root || !root.querySelectorAll || typeof document === 'undefined' || !document.createElement) return;
18
+ // Inert HTML template content is a DOM allocation optimisation. Native
19
+ // hosts already clone recorded descriptors and bind conditions through
20
+ // their host operations; their document facade has no template content.
21
+ if (!document.createElement('template').content) return;
22
+ // A walk, not a selector: escaping ':' and '@' in an attribute selector
23
+ // through this generated source is easy to get wrong, and wrong throws.
24
+ var candidates = Array.prototype.slice.call(root.querySelectorAll('*'));
25
+ for (var i = 0; i < candidates.length; i++) {
26
+ var el = candidates[i];
27
+ if (el.tagName === 'TEMPLATE' || !el.parentNode) continue;
28
+ var attr = null;
29
+ for (var a = 0; a < IF_ATTRS.length; a++) {
30
+ if (el.hasAttribute(IF_ATTRS[a])) { attr = IF_ATTRS[a]; break; }
31
+ }
32
+ if (!attr) continue;
33
+ var skip = false;
34
+ for (var f = 0; f < FOR_ATTRS.length; f++) {
35
+ if (el.hasAttribute(FOR_ATTRS[f])) skip = true;
36
+ }
37
+ if (skip || getElseAttrInfo(el)) continue;
38
+ var next = el.nextElementSibling;
39
+ if (next && (getElseAttrInfo(next) || next.tagName === 'SCRIPT')) continue;
40
+ if (el.hasAttribute('data-stx-scope') || el.hasAttribute('x-data') || el.querySelector('script')) continue;
41
+ var holder = document.createElement('template');
42
+ holder.setAttribute(attr, el.getAttribute(attr));
43
+ el.removeAttribute(attr);
44
+ el.parentNode.insertBefore(holder, el);
45
+ holder.content.appendChild(el);
46
+ }
47
+ }
48
+ `;
@@ -0,0 +1,2 @@
1
+ /** Loop-row ownership and placeholder helpers for the generated client runtime. */
2
+ export declare const SIGNALS_LOOP_ROW_RUNTIME = " // A loop row binds in its own iteration scope, and only its loop puts it\n // there. A walk from further out (an enclosing :if hydrating the branch it\n // shows) carries no item, so it used to bind whatever in the row was still\n // unbound -- a conditional's children, waiting for their own deferred pass\n // -- against a scope without the row: on a native screen every card's\n // compliance chip came out empty. Such a walk now leaves the row alone.\n function markLoopRow(row, itemName, itemSignal) {\n row.__stx_loop_row = { name: itemName, signal: itemSignal };\n }\n function isForeignToLoopRow(el, scope) {\n var row = el.__stx_loop_row;\n return !!row && (!scope || scope[row.name] !== row.signal);\n }\n\n // Where a structural directive's output goes is wherever its placeholder\n // is NOW, not the parent it was bound under. Something may move the\n // placeholder after binding: the router adopts the first page into a\n // retained screen (<div data-stx-screen>) by moving the container's\n // children, and an app may move a node itself. A :for or :if at the top\n // level of a page kept inserting into the container while its placeholder\n // sat in the screen, and the browser threw \"insertBefore: the node before\n // which the new node is to be inserted is not a child of this node\" -- the\n // page went blank the first time a top-level condition changed. The\n // if/else chain has always inserted at its placeholder's parent; :if and\n // :for now do the same. Hidden nodes registered on the old parent (#1954)\n // follow, so a later disposal walk of the new one still finds them.\n function followPlaceholder(placeholder, parent, nodes) {\n var now = placeholder.parentNode;\n if (!now || now === parent) return parent;\n var held = parent && parent.__stx_detached_if;\n if (held && nodes) {\n nodes.forEach(function(node) {\n if (!held.has(node)) return;\n held.delete(node);\n if (!now.__stx_detached_if) now.__stx_detached_if = new Set();\n now.__stx_detached_if.add(node);\n });\n }\n return now;\n }\n";
@@ -0,0 +1,41 @@
1
+ export const SIGNALS_LOOP_ROW_RUNTIME = ` // A loop row binds in its own iteration scope, and only its loop puts it
2
+ // there. A walk from further out (an enclosing :if hydrating the branch it
3
+ // shows) carries no item, so it used to bind whatever in the row was still
4
+ // unbound -- a conditional's children, waiting for their own deferred pass
5
+ // -- against a scope without the row: on a native screen every card's
6
+ // compliance chip came out empty. Such a walk now leaves the row alone.
7
+ function markLoopRow(row, itemName, itemSignal) {
8
+ row.__stx_loop_row = { name: itemName, signal: itemSignal };
9
+ }
10
+ function isForeignToLoopRow(el, scope) {
11
+ var row = el.__stx_loop_row;
12
+ return !!row && (!scope || scope[row.name] !== row.signal);
13
+ }
14
+
15
+ // Where a structural directive's output goes is wherever its placeholder
16
+ // is NOW, not the parent it was bound under. Something may move the
17
+ // placeholder after binding: the router adopts the first page into a
18
+ // retained screen (<div data-stx-screen>) by moving the container's
19
+ // children, and an app may move a node itself. A :for or :if at the top
20
+ // level of a page kept inserting into the container while its placeholder
21
+ // sat in the screen, and the browser threw "insertBefore: the node before
22
+ // which the new node is to be inserted is not a child of this node" -- the
23
+ // page went blank the first time a top-level condition changed. The
24
+ // if/else chain has always inserted at its placeholder's parent; :if and
25
+ // :for now do the same. Hidden nodes registered on the old parent (#1954)
26
+ // follow, so a later disposal walk of the new one still finds them.
27
+ function followPlaceholder(placeholder, parent, nodes) {
28
+ var now = placeholder.parentNode;
29
+ if (!now || now === parent) return parent;
30
+ var held = parent && parent.__stx_detached_if;
31
+ if (held && nodes) {
32
+ nodes.forEach(function(node) {
33
+ if (!held.has(node)) return;
34
+ held.delete(node);
35
+ if (!now.__stx_detached_if) now.__stx_detached_if = new Set();
36
+ now.__stx_detached_if.add(node);
37
+ });
38
+ }
39
+ return now;
40
+ }
41
+ `;
@@ -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,82 @@
1
+ export const SIGNALS_MANIFEST_HYDRATION_RUNTIME = ` /**
2
+ * Bind what the server said carries a binding, instead of looking for it.
3
+ *
4
+ * The walk exists because the runtime does not know where the bindings are.
5
+ * The server does -- it rendered them -- so when it ships that list the
6
+ * runtime stops searching: resolve each id, bind that element, never touch
7
+ * its children. An element with no bindings is never visited at all.
8
+ *
9
+ * This is the piece a native host needs. A view hierarchy has no attributes
10
+ * to read and no selector to match, so discovery cannot happen there; handed
11
+ * the list, it does not have to. On the DOM the ids resolve by attribute,
12
+ * which is one query per entry rather than a full traversal.
13
+ *
14
+ * Absent a manifest nothing changes: the walk is still the default, and a
15
+ * page that ships no list hydrates exactly as it did.
16
+ */
17
+ function processFromManifest(root, scope, manifest, resolvedNodes) {
18
+ // Arrays have an entries() method too. Prefer the array itself before
19
+ // accepting the compiled document shape { entries: [...] }.
20
+ var entries = Array.isArray(manifest)
21
+ ? manifest
22
+ : (manifest && Array.isArray(manifest.entries) ? manifest.entries : null);
23
+ if (!entries || !entries.length || (!root && !resolvedNodes)) return false;
24
+ for (var i = 0; i < entries.length; i++) {
25
+ var entry = entries[i];
26
+ var id = entry && entry.id;
27
+ if (id === undefined || id === null) continue;
28
+ // Native compilation already has stable handles for every manifest id.
29
+ // Accept those handles directly so a non-DOM host never needs selectors
30
+ // or an attribute walk. The browser keeps its existing lookup fallback.
31
+ var node = resolvedNodes
32
+ ? (typeof resolvedNodes.get === 'function' ? resolvedNodes.get(id) : resolvedNodes[id])
33
+ : null;
34
+ if (!node && root) {
35
+ node = root.getAttribute && root.getAttribute('data-stx-b') === String(id)
36
+ ? root
37
+ : (root.querySelector ? root.querySelector('[data-stx-b="' + id + '"]') : null);
38
+ }
39
+ if (!node) continue;
40
+ // A structural binding can detach its source before a later manifest
41
+ // entry reaches one of that source's children. Native handles expose
42
+ // this state directly; do not register effects or handlers for a view
43
+ // that no longer exists in the host tree. Browser hydration keeps its
44
+ // existing behaviour because it does not pass resolvedNodes here.
45
+ if (resolvedNodes && node.__stxId !== undefined && node.isConnected === false) continue;
46
+ processElement(node, scope, true);
47
+ }
48
+ return true;
49
+ }
50
+
51
+ // Bind a precompiled host tree without waiting for DOMContentLoaded. Native
52
+ // passes its manifest id to node-handle table; browser hydration continues
53
+ // through the document-ready path below. The same state, effect, expression,
54
+ // event and host implementations are used by both.
55
+ function hydrateHost(root, setup, manifest, resolvedNodes) {
56
+ var mountStart = mountCallbacks.length;
57
+ var destroyStart = destroyCallbacks.length;
58
+ var outerSink = activeDestroySink;
59
+ activeDestroySink = null;
60
+ var values;
61
+ try { values = typeof setup === 'function' ? setup() : setup; }
62
+ finally { activeDestroySink = outerSink; }
63
+ var localMountHooks = mountCallbacks.splice(mountStart);
64
+ var localDestroyHooks = destroyCallbacks.splice(destroyStart);
65
+ var scope = Object.assign({ $refs: {} }, values || {});
66
+ var disposeEffects = trackEffects(function() {
67
+ processFromManifest(root, scope, manifest, resolvedNodes);
68
+ });
69
+ runMountCallbacks(localMountHooks, localDestroyHooks);
70
+ var mounted = true;
71
+ return function disposeHost() {
72
+ if (!mounted) return;
73
+ mounted = false;
74
+ disposeEffects();
75
+ var hooks = localDestroyHooks.splice(0, localDestroyHooks.length);
76
+ for (var i = 0; i < hooks.length; i++) {
77
+ try { hooks[i](); }
78
+ catch (e) { console.warn('[stx] native destroy error:', e); }
79
+ }
80
+ };
81
+ }
82
+ `;
@@ -0,0 +1,2 @@
1
+ /** Two-way form model binding for the generated client runtime. */
2
+ export declare const SIGNALS_MODEL_RUNTIME = " function bindModel(el, expr, passedScope = componentScope, attrName = '@model') {\n if (el.__stx_model_bound) return;\n el.__stx_model_bound = true;\n const tag = el.tagName.toLowerCase();\n const type = el.type;\n const modifiers = attrName.split('.').slice(1);\n const capturedScope = { ...globalHelpers, ...passedScope, ...(findElementScope(el) || {}) };\n const coerceValue = (value) => {\n var next = value;\n if (modifiers.includes('trim') && typeof next === 'string') next = next.trim();\n if (modifiers.includes('number') && next !== '') {\n var numeric = Number(next);\n if (!Number.isNaN(numeric)) next = numeric;\n }\n return next;\n };\n\n const getValue = () => {\n var direct = capturedScope[expr];\n if (direct && typeof direct === 'function' && (direct._isSignal || direct._isDerived))\n return direct();\n try {\n var unwrapScope = createExpressionAutoUnwrapProxy(capturedScope, expr);\n var fn = __stxCompileScoped(unwrapScope, [], 'return (' + expr + ')');\n return fn(...__stxArgs(fn, unwrapScope));\n }\n catch (e) {\n if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] ' + attrName + ' get error:', expr, e);\n return '';\n }\n };\n const setValue = (val) => {\n try {\n if (capturedScope[expr] && capturedScope[expr]._isSignal) {\n capturedScope[expr].set(val);\n }\nelse {\n // Write through the SAME auto-unwrap proxy the read path uses.\n //\n // This used to destructure the scope into plain parameters, so an\n // lvalue like store.title assigned onto the raw object and REPLACED\n // the signal with a raw string. Everything else bound to that signal\n // stopped updating, its .set was gone so the next write threw\n // TypeError, and nothing warned \u2014 the field the user typed into was\n // the only thing on the page that still looked right (#1883).\n //\n // The proxy's set trap already did the correct thing (call .set on a\n // signal-valued property) and was simply never reached from here.\n // Routing through it also drops the old requirement that every scope\n // key be a valid identifier, since nothing is destructured now.\n var writeScope = createModelWriteProxy(capturedScope);\n var writeFn = __stxCompile(['__scope__', '__v__'], 'with(__scope__) { ' + expr + ' = __v__ }');\n writeFn(writeScope, val);\n }\n }\ncatch (e) {\n if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] ' + attrName + ' set error:', expr, e);\n }\n };\n\n if (tag === 'input' && type === 'checkbox') {\n var syncCheckbox = () => {\n var current = getValue();\n el.checked = Array.isArray(current)\n ? current.some(function(item) { return String(item) === String(el.value); })\n : Boolean(current);\n };\n el.__stx_model_sync = syncCheckbox;\n effect(syncCheckbox);\n stxHost.listen(el, 'change', () => {\n var current = getValue();\n if (!Array.isArray(current)) {\n setValue(el.checked);\n return;\n }\n\n var checkboxValue = coerceValue(el.value);\n var next = current.filter(function(item) { return String(item) !== String(checkboxValue); });\n if (el.checked) next.push(checkboxValue);\n setValue(next);\n });\n }\n else if (tag === 'input' && type === 'radio') {\n var syncRadio = () => { el.checked = String(getValue()) === String(el.value); };\n el.__stx_model_sync = syncRadio;\n effect(syncRadio);\n stxHost.listen(el, 'change', () => {\n if (el.checked) setValue(coerceValue(el.value));\n });\n }\n else if (tag === 'select') {\n // Same equality guard as the text branch. Harmless here \u2014 a select has\n // no caret \u2014 but an unconditional write is still a needless DOM mutation\n // on every signal change, and the inconsistency invites the text-branch\n // bug being reintroduced by copying this one (#1799).\n var syncSelect = () => { var next = getValue() ?? ''; if (el.value !== next) el.value = next; };\n el.__stx_model_sync = syncSelect;\n effect(syncSelect);\n if (!el.__stx_model_observer && typeof window.MutationObserver !== 'undefined') {\n el.__stx_model_observer = new window.MutationObserver(syncSelect);\n el.__stx_model_observer.observe(el, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['value'],\n });\n el.__stx_destroy = el.__stx_destroy || [];\n el.__stx_destroy.push(function() {\n if (el.__stx_model_observer) el.__stx_model_observer.disconnect();\n el.__stx_model_observer = null;\n });\n }\n stxHost.listen(el, 'change', () => setValue(coerceValue(el.value)));\n }\nelse {\n // Writing el.value moves the text cursor to the END of the control, and\n // typing forms a loop: input -> setValue -> the signal changes -> this\n // effect re-runs -> the write. So every keystroke reset the caret\n // (stacksjs/stx#1799).\n //\n // Invisible while appending at the end of a field, which is why a login\n // form with x-model felt fine and a textarea people actually edit did\n // not. Worse inside :for, where key-based reuse updates the item signal\n // on reuse (#1669) and re-evaluates the reused row's bindings on every\n // character.\n //\n // The equality guard alone fixes typing, because the value this effect\n // computes IS the value just typed. The offset is preserved as well for\n // the case the guard cannot cover: a value that legitimately changed\n // from elsewhere while the field is focused \u2014 a formatter rewriting\n // input, a remote sync.\n effect(() => {\n var next = getValue() ?? '';\n if (el.value === next) return;\n var active = typeof document !== 'undefined' && document.activeElement === el;\n var start = null;\n var end = null;\n if (active) {\n // selectionStart throws on input types that do not support\n // selection (number, email, date), so it cannot be assumed present.\n try { start = el.selectionStart; end = el.selectionEnd; }\n catch (e) { start = null; end = null; }\n }\n el.value = next;\n if (active && start !== null && typeof el.setSelectionRange === 'function') {\n // Clamp: the incoming value may be shorter than the old offset.\n try { el.setSelectionRange(Math.min(start, next.length), Math.min(end == null ? start : end, next.length)); }\n catch (e) { /* type does not support selection */ }\n }\n });\n stxHost.listen(el, modifiers.includes('lazy') ? 'change' : 'input', () => setValue(coerceValue(el.value)));\n }\n\n el.removeAttribute(attrName);\n }\n";
@@ -0,0 +1,156 @@
1
+ export const SIGNALS_MODEL_RUNTIME = ` function bindModel(el, expr, passedScope = componentScope, attrName = '@model') {
2
+ if (el.__stx_model_bound) return;
3
+ el.__stx_model_bound = true;
4
+ const tag = el.tagName.toLowerCase();
5
+ const type = el.type;
6
+ const modifiers = attrName.split('.').slice(1);
7
+ const capturedScope = { ...globalHelpers, ...passedScope, ...(findElementScope(el) || {}) };
8
+ const coerceValue = (value) => {
9
+ var next = value;
10
+ if (modifiers.includes('trim') && typeof next === 'string') next = next.trim();
11
+ if (modifiers.includes('number') && next !== '') {
12
+ var numeric = Number(next);
13
+ if (!Number.isNaN(numeric)) next = numeric;
14
+ }
15
+ return next;
16
+ };
17
+
18
+ const getValue = () => {
19
+ var direct = capturedScope[expr];
20
+ if (direct && typeof direct === 'function' && (direct._isSignal || direct._isDerived))
21
+ return direct();
22
+ try {
23
+ var unwrapScope = createExpressionAutoUnwrapProxy(capturedScope, expr);
24
+ var fn = __stxCompileScoped(unwrapScope, [], 'return (' + expr + ')');
25
+ return fn(...__stxArgs(fn, unwrapScope));
26
+ }
27
+ catch (e) {
28
+ if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] ' + attrName + ' get error:', expr, e);
29
+ return '';
30
+ }
31
+ };
32
+ const setValue = (val) => {
33
+ try {
34
+ if (capturedScope[expr] && capturedScope[expr]._isSignal) {
35
+ capturedScope[expr].set(val);
36
+ }
37
+ else {
38
+ // Write through the SAME auto-unwrap proxy the read path uses.
39
+ //
40
+ // This used to destructure the scope into plain parameters, so an
41
+ // lvalue like store.title assigned onto the raw object and REPLACED
42
+ // the signal with a raw string. Everything else bound to that signal
43
+ // stopped updating, its .set was gone so the next write threw
44
+ // TypeError, and nothing warned \u2014 the field the user typed into was
45
+ // the only thing on the page that still looked right (#1883).
46
+ //
47
+ // The proxy's set trap already did the correct thing (call .set on a
48
+ // signal-valued property) and was simply never reached from here.
49
+ // Routing through it also drops the old requirement that every scope
50
+ // key be a valid identifier, since nothing is destructured now.
51
+ var writeScope = createModelWriteProxy(capturedScope);
52
+ var writeFn = __stxCompile(['__scope__', '__v__'], 'with(__scope__) { ' + expr + ' = __v__ }');
53
+ writeFn(writeScope, val);
54
+ }
55
+ }
56
+ catch (e) {
57
+ if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] ' + attrName + ' set error:', expr, e);
58
+ }
59
+ };
60
+
61
+ if (tag === 'input' && type === 'checkbox') {
62
+ var syncCheckbox = () => {
63
+ var current = getValue();
64
+ el.checked = Array.isArray(current)
65
+ ? current.some(function(item) { return String(item) === String(el.value); })
66
+ : Boolean(current);
67
+ };
68
+ el.__stx_model_sync = syncCheckbox;
69
+ effect(syncCheckbox);
70
+ stxHost.listen(el, 'change', () => {
71
+ var current = getValue();
72
+ if (!Array.isArray(current)) {
73
+ setValue(el.checked);
74
+ return;
75
+ }
76
+
77
+ var checkboxValue = coerceValue(el.value);
78
+ var next = current.filter(function(item) { return String(item) !== String(checkboxValue); });
79
+ if (el.checked) next.push(checkboxValue);
80
+ setValue(next);
81
+ });
82
+ }
83
+ else if (tag === 'input' && type === 'radio') {
84
+ var syncRadio = () => { el.checked = String(getValue()) === String(el.value); };
85
+ el.__stx_model_sync = syncRadio;
86
+ effect(syncRadio);
87
+ stxHost.listen(el, 'change', () => {
88
+ if (el.checked) setValue(coerceValue(el.value));
89
+ });
90
+ }
91
+ else if (tag === 'select') {
92
+ // Same equality guard as the text branch. Harmless here \u2014 a select has
93
+ // no caret \u2014 but an unconditional write is still a needless DOM mutation
94
+ // on every signal change, and the inconsistency invites the text-branch
95
+ // bug being reintroduced by copying this one (#1799).
96
+ var syncSelect = () => { var next = getValue() ?? ''; if (el.value !== next) el.value = next; };
97
+ el.__stx_model_sync = syncSelect;
98
+ effect(syncSelect);
99
+ if (!el.__stx_model_observer && typeof window.MutationObserver !== 'undefined') {
100
+ el.__stx_model_observer = new window.MutationObserver(syncSelect);
101
+ el.__stx_model_observer.observe(el, {
102
+ childList: true,
103
+ subtree: true,
104
+ attributes: true,
105
+ attributeFilter: ['value'],
106
+ });
107
+ el.__stx_destroy = el.__stx_destroy || [];
108
+ el.__stx_destroy.push(function() {
109
+ if (el.__stx_model_observer) el.__stx_model_observer.disconnect();
110
+ el.__stx_model_observer = null;
111
+ });
112
+ }
113
+ stxHost.listen(el, 'change', () => setValue(coerceValue(el.value)));
114
+ }
115
+ else {
116
+ // Writing el.value moves the text cursor to the END of the control, and
117
+ // typing forms a loop: input -> setValue -> the signal changes -> this
118
+ // effect re-runs -> the write. So every keystroke reset the caret
119
+ // (stacksjs/stx#1799).
120
+ //
121
+ // Invisible while appending at the end of a field, which is why a login
122
+ // form with x-model felt fine and a textarea people actually edit did
123
+ // not. Worse inside :for, where key-based reuse updates the item signal
124
+ // on reuse (#1669) and re-evaluates the reused row's bindings on every
125
+ // character.
126
+ //
127
+ // The equality guard alone fixes typing, because the value this effect
128
+ // computes IS the value just typed. The offset is preserved as well for
129
+ // the case the guard cannot cover: a value that legitimately changed
130
+ // from elsewhere while the field is focused \u2014 a formatter rewriting
131
+ // input, a remote sync.
132
+ effect(() => {
133
+ var next = getValue() ?? '';
134
+ if (el.value === next) return;
135
+ var active = typeof document !== 'undefined' && document.activeElement === el;
136
+ var start = null;
137
+ var end = null;
138
+ if (active) {
139
+ // selectionStart throws on input types that do not support
140
+ // selection (number, email, date), so it cannot be assumed present.
141
+ try { start = el.selectionStart; end = el.selectionEnd; }
142
+ catch (e) { start = null; end = null; }
143
+ }
144
+ el.value = next;
145
+ if (active && start !== null && typeof el.setSelectionRange === 'function') {
146
+ // Clamp: the incoming value may be shorter than the old offset.
147
+ try { el.setSelectionRange(Math.min(start, next.length), Math.min(end == null ? start : end, next.length)); }
148
+ catch (e) { /* type does not support selection */ }
149
+ }
150
+ });
151
+ stxHost.listen(el, modifiers.includes('lazy') ? 'change' : 'input', () => setValue(coerceValue(el.value)));
152
+ }
153
+
154
+ el.removeAttribute(attrName);
155
+ }
156
+ `;
@@ -0,0 +1 @@
1
+ export declare const SIGNALS_MOUNT_RUNTIME = " mountEl: function(selector, setupFn) {\n function doMount() {\n var root = document.querySelector(selector);\n if (!root) { console.warn('[stx] mountEl: element not found:', selector); return; }\n\n // Set component context for defineProps/defineEmits (Phase 4)\n var prevProps = window.__STX_CURRENT_PROPS__;\n var prevEl = window.__STX_CURRENT_ELEMENT__;\n var propsAttr = root.getAttribute && root.getAttribute('data-stx-props');\n window.__STX_CURRENT_PROPS__ = root.__stx_props || (propsAttr ? JSON.parse(propsAttr) : {});\n window.__STX_CURRENT_ELEMENT__ = root;\n\n var mountStart = mountCallbacks.length;\n var destroyStart = destroyCallbacks.length;\n\n // The setup's hooks are collected off the global queues below, so an\n // outer flush's destroy sink must not catch them first (see mount).\n var outerSink = activeDestroySink;\n activeDestroySink = null;\n var scope;\n try { scope = setupFn(); }\n finally { activeDestroySink = outerSink; }\n\n // Restore previous context (supports nested components)\n window.__STX_CURRENT_PROPS__ = prevProps;\n window.__STX_CURRENT_ELEMENT__ = prevEl;\n\n var localMountHooks = mountCallbacks.splice(mountStart);\n var localDestroyHooks = destroyCallbacks.splice(destroyStart);\n\n if (typeof scope === 'object' && scope !== null) {\n scope.$el = root;\n scope.$refs = scope.$refs || {};\n root.__stx_scope = scope;\n }\n\n var disposeEffects = trackEffects(function() {\n processElement(root, { ...componentScope, ...(scope || {}) });\n });\n root.__stx_disposers = disposeEffects;\n\n root.removeAttribute('x-cloak');\n root.querySelectorAll('[x-cloak]').forEach(function(el) { el.removeAttribute('x-cloak'); });\n\n // Through runMountCallbacks, so an onDestroy called inside one of\n // them lands here too rather than on the global queue (#1958).\n runMountCallbacks(localMountHooks, localDestroyHooks);\n\n root.__stx_destroy = localDestroyHooks;\n }\n\n if (document.readyState === 'loading') {\n mountQueue.push(doMount);\n }\nelse {\n doMount();\n }\n },\n mount: function(setupFn) {\n console.log('[mount] called');\n // Capture script reference synchronously (only valid during execution)\n var scriptEl = document.currentScript;\n\n function doMount() {\n // Auto-mount scripts are emitted after their component template. Other\n // generated helper scripts can sit between the rendered root and this\n // script, so walk past script/style siblings before selecting the root.\n // Router-injected page scripts are marked data-stx-page and must use the\n // content-container fallback below instead.\n var isSpaPageScript = scriptEl && scriptEl.hasAttribute\n && scriptEl.hasAttribute('data-stx-page')\n && !scriptEl.hasAttribute('data-stx-positioned');\n var root = null;\n if (scriptEl && !isSpaPageScript) {\n var previous = scriptEl.previousElementSibling;\n while (previous && (previous.tagName === 'SCRIPT' || previous.tagName === 'STYLE'))\n previous = previous.previousElementSibling;\n\n var next = scriptEl.nextElementSibling;\n while (next && (next.tagName === 'SCRIPT' || next.tagName === 'STYLE'))\n next = next.nextElementSibling;\n\n root = previous || next || scriptEl.parentElement;\n }\n\n // SPA fallback: during router navigation, script is appended to body>\n // (not inside the content container), so nextElementSibling won't find the page content.\n // Only use fallback when we genuinely couldn't find a suitable root element.\n // Do NOT fallback just because the script is in body> \u2014 layout scripts in body>\n // with valid siblings (e.g. sidebar <aside>) should use those siblings as root.\n\n // An x-data root that initScope has not claimed yet is not ours to mount.\n //\n // The element carries its own state expression and the reactive runtime\n // owns it; data-stx-scope is on it from the server, but the id is not\n // in stx._scopes until initScope runs, which on a navigation happens\n // later in the stx:load handler. Mounting it in the meantime binds its\n // whole subtree against whatever scope the mounting script brought.\n //\n // That is what a layout script did after every SPA navigation. Its own\n // re-executed script now lands inside the content container next to the\n // incoming page, so previousElementSibling resolved to the *page's*\n // x-data root; mount() adopted it and ran processElement over it with the\n // sidebar's scope. Every :for template inside was consumed against a\n // scope holding none of the page's data, and bindFor replaces each\n // template with its stx-for anchor on that single pass \u2014 so the markup a\n // retry needed was gone, and the effect had read no signal to re-run on.\n // The list stayed empty for the life of the page while its state sat\n // fully populated beside it. Cold loads never hit it: there the page's\n // own script mounts first, with the right scope.\n //\n // Registered scopes are left alone, so an element the reactive runtime\n // has already initialised keeps whatever behaviour it had.\n function awaitingReactiveInit(el) {\n if (!el || !el.hasAttribute || !el.hasAttribute('data-stx-xdata'))\n return false;\n var id = el.getAttribute('data-stx-scope');\n return !(id && window.stx && window.stx._scopes && window.stx._scopes[id]);\n }\n\n var needsFallback = !root || root === document.body\n || (root && root.tagName === 'SCRIPT')\n || awaitingReactiveInit(root);\n if (needsFallback) {\n var routerOpts = window.STX_ROUTER_OPTIONS || window.__stxRouterConfig || {};\n var container = document.querySelector('[data-stx-content]')\n || document.querySelector('[data-stx-router-container]')\n || (routerOpts.container ? document.querySelector(routerOpts.container) : null)\n || document.querySelector('main')\n || document.querySelector('#content');\n if (container) {\n // Use the container itself as root \u2014 process ALL content inside it\n root = container;\n // But if a specific child is already mounted, find first unmounted one instead\n var hasMount = false;\n var children = container.children;\n for (var ci = 0; ci < children.length; ci++) {\n if (children[ci].__stx_scope) { hasMount = true; break; }\n }\n if (hasMount) for (var ci = 0; ci < children.length; ci++) {\n var candidate = children[ci];\n if (candidate.__stx_scope || candidate.tagName === 'SCRIPT') continue;\n if (awaitingReactiveInit(candidate)) continue;\n root = candidate;\n break;\n }\n }\n }\n\n // The fallback can still land on one (a container whose only unmounted\n // child is the incoming page). Processing the container instead is safe:\n // processElement skips [data-stx-scope] children, so the reactive\n // runtime keeps its subtree and binds it with the right scope.\n if (awaitingReactiveInit(root)) {\n var reactiveOwnerParent = root.parentElement;\n root = reactiveOwnerParent && reactiveOwnerParent !== document.body ? reactiveOwnerParent : null;\n }\n\n if (!root) { console.warn('[stx] mount: no root element found'); return; }\n\n // Set component context for defineProps/defineEmits (Phase 4)\n var prevProps = window.__STX_CURRENT_PROPS__;\n var prevEl = window.__STX_CURRENT_ELEMENT__;\n var propsAttr = root.getAttribute && root.getAttribute('data-stx-props');\n window.__STX_CURRENT_PROPS__ = root.__stx_props || (propsAttr ? JSON.parse(propsAttr) : {});\n window.__STX_CURRENT_ELEMENT__ = root;\n\n // Track lifecycle hooks registered during setup\n var mountStart = mountCallbacks.length;\n var destroyStart = destroyCallbacks.length;\n\n // Run setup function \u2014 returns scope object with declarations\n //\n // With no outer destroy sink (#1958). This can run inside another\n // component's onMount, where runMountCallbacks has pointed onDestroy at\n // THAT component's queue. The setup's own teardown (a composable such\n // as useEventListener registers its removal with onDestroy) must land\n // on the global queue, where the splice below collects it for this\n // root. Otherwise it belonged to the outer component and outlived this\n // root: mounted on a :for row, removing the row left its listener in.\n var outerSink = activeDestroySink;\n activeDestroySink = null;\n var scope;\n try { scope = setupFn(); }\n finally { activeDestroySink = outerSink; }\n console.log('[mount] root:', root.tagName, 'scope keys:', scope ? Object.keys(scope).slice(0, 10) : 'null');\n\n // Restore previous context (supports nested components)\n window.__STX_CURRENT_PROPS__ = prevProps;\n window.__STX_CURRENT_ELEMENT__ = prevEl;\n\n // Capture mount/destroy hooks added during setup\n var localMountHooks = mountCallbacks.splice(mountStart);\n var localDestroyHooks = destroyCallbacks.splice(destroyStart);\n\n // Register scope\n if (typeof scope === 'object' && scope !== null) {\n scope.$el = root;\n scope.$refs = scope.$refs || {};\n root.__stx_scope = scope; // Store isolated scope on element\n Object.assign(componentScope, scope); // Keep for backwards compat\n }\n\n // Walk DOM and bind directives, tracking effects for cleanup\n var disposeEffects = trackEffects(function() {\n processElement(root, { ...componentScope, ...(scope || {}) });\n });\n root.__stx_disposers = disposeEffects;\n\n // Remove x-cloak after bindings are applied (prevents FOUC)\n root.removeAttribute('x-cloak');\n root.querySelectorAll('[x-cloak]').forEach(function(el) { el.removeAttribute('x-cloak'); });\n\n // Fire mount hooks\n // Through runMountCallbacks, so an onDestroy called inside one of\n // them lands here too rather than on the global queue (#1958).\n runMountCallbacks(localMountHooks, localDestroyHooks);\n\n // Store cleanup on element for auto-destroy\n root.__stx_destroy = localDestroyHooks;\n }\n\n var isRoutedMount = scriptEl && scriptEl.hasAttribute\n && scriptEl.hasAttribute('data-stx-page');\n if (document.readyState === 'loading' || isRoutedMount) {\n mountQueue.push(doMount);\n }\nelse {\n doMount();\n }\n }";