@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.
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,696 @@
1
+ export function signalsProcessElementRuntime(directiveNamesLiteral, eventRegexLiteral, handledXAttrsLiteral) {
2
+ return ` // skipChildren: this element's bindings only, because something else already
3
+ // knows where the rest are. The manifest path passes it for every entry, so
4
+ // the tree is never walked; see processFromManifest.
5
+ function processElement(el, scope = componentScope, skipChildren) {
6
+ // Lazy hydration: if this element has stx-hydrate and hasn't been hydrated
7
+ // yet, defer its subtree processing until the trigger fires.
8
+ if (el.nodeType === Node.ELEMENT_NODE && el.hasAttribute && el.hasAttribute('stx-hydrate') && !el.__stx_hydrated) {
9
+ var trigger = el.getAttribute('stx-hydrate') || 'idle';
10
+ deferHydration(el, trigger, scope);
11
+ return;
12
+ }
13
+ if (el.nodeType === Node.ELEMENT_NODE
14
+ && el.hasAttribute
15
+ && el.hasAttribute('data-stx-scope')
16
+ && hasPendingAncestorLoopBoundary(el)) {
17
+ preserveDeferredParentComponentProps(el);
18
+ // Even when the component is itself a loop root, an ancestor loop must
19
+ // create its caller item scope first. The ancestor's bindFor pass will
20
+ // clone and hydrate this component with that scope, then its own loop can
21
+ // evaluate expressions such as group.resources.
22
+ return;
23
+ }
24
+
25
+ if (el.nodeType === Node.ELEMENT_NODE && el.tagName === 'BUTTON' && el.hasAttribute && el.hasAttribute('@click')) {
26
+
27
+ }
28
+ if (el.nodeType === Node.ELEMENT_NODE && el.hasAttribute) {
29
+ // x-data elements: the reactive bridge has registered their scope into window.stx._scopes.
30
+ // Merge that scope into the processing scope and continue \u2014 we handle all directives.
31
+ // Server renames x-data \u2192 data-stx-xdata, so check both.
32
+ if (el.hasAttribute('x-data') || el.hasAttribute('data-stx-xdata') || el.__stx_scope) {
33
+ var xdScope = el.__stx_scope || (findElementScope(el) || {});
34
+ if (xdScope && Object.keys(xdScope).length > 0) {
35
+ scope = { ...scope, ...xdScope };
36
+ }
37
+ }
38
+ // v-memo / @memo \u2014 skip re-processing if dependency values haven't changed
39
+ if (el.hasAttribute('data-stx-memo')) {
40
+ var memoExpr = el.getAttribute('data-stx-memo');
41
+ try {
42
+ var memoScope = { ...globalHelpers, ...scope, ...(findElementScope(el) || {}) };
43
+ var memoFn = __stxCompileScoped(memoScope, [], 'return ' + memoExpr);
44
+ var memoVals = JSON.stringify(memoFn(...__stxArgs(memoFn, memoScope)));
45
+ if (el.__stx_memo_prev === memoVals) {
46
+ return; // Dependencies unchanged \u2014 skip re-processing
47
+ }
48
+ el.__stx_memo_prev = memoVals;
49
+ } catch(e) {}
50
+ }
51
+ }
52
+ // Normalize a signal returned by an interpolation expression before the
53
+ // DOM coerces it to text. The proxy handles ordinary signal references,
54
+ // but a helper or pipe can return the signal function itself.
55
+ const maybeUnwrapSignal = (v) => {
56
+ if (v && typeof v === 'function' && (v._isSignal || v._isDerived)) return v();
57
+ return v;
58
+ };
59
+ if (el.nodeType === Node.TEXT_NODE) {
60
+ // DOM textContent is specified as a string, but lightweight DOM
61
+ // implementations and user-created nodes can retain a numeric value
62
+ // assigned by a binding. Normalize before interpolation detection.
63
+ const text = el.textContent == null ? '' : String(el.textContent);
64
+ if (text && text.includes('{{')) {
65
+ const parts = text.split(/(\\{\\{[\\s\\S]+?\\}\\})/g);
66
+ if (parts.length > 1) {
67
+ const fragment = document.createDocumentFragment();
68
+ const parentEl = el.parentNode;
69
+ // Capture scope NOW before effects run asynchronously
70
+ // Use the passed scope parameter (not global componentScope) to preserve context
71
+ // through nested @if/@for processing where componentScope may be restored
72
+ const capturedScope = { ...globalHelpers, ...scope, ...(findElementScope(parentEl) || {}) };
73
+ parts.forEach(part => {
74
+ const match = part.match(/^\\{\\{\\s*([\\s\\S]+?)\\s*\\}\\}$/);
75
+ if (match) {
76
+ const expr = match[1];
77
+ // Skip placeholder expressions like __TITLE__ (build-time placeholders)
78
+ if (/^__[A-Z_]+__$/.test(expr.trim())) {
79
+ fragment.appendChild(document.createTextNode(part));
80
+ return;
81
+ }
82
+ // Native text-only elements cannot contain the span wrapper used
83
+ // for general interpolation. Bind a text node there so options,
84
+ // titles, and textareas retain valid DOM and accessible labels.
85
+ const isTextOnlyParent = parentEl
86
+ && (parentEl.tagName === 'OPTION' || parentEl.tagName === 'TITLE' || parentEl.tagName === 'TEXTAREA');
87
+ const bindingNode = isTextOnlyParent
88
+ ? document.createTextNode('')
89
+ : document.createElement('span');
90
+ fragment.appendChild(bindingNode);
91
+ // Use captured scope, not dynamic lookup
92
+ effect(() => {
93
+ try {
94
+ // Check for pipe syntax (Feature #2)
95
+ const pipeResult = parsePipeExpression(expr, capturedScope);
96
+ if (pipeResult) {
97
+ const unwrapScope = createExpressionAutoUnwrapProxy(capturedScope, expr);
98
+ bindingNode.textContent = maybeUnwrapSignal(
99
+ executePipeExpression(pipeResult.valueExpr, pipeResult.pipes, unwrapScope),
100
+ );
101
+ }
102
+ else {
103
+ // Use auto-unwrap proxy (Feature #1)
104
+ const unwrapScope = createExpressionAutoUnwrapProxy(capturedScope, expr);
105
+ const fn = __stxCompileScoped(capturedScope, [], 'return ' + expr);
106
+ bindingNode.textContent = maybeUnwrapSignal(fn(...__stxArgs(fn, unwrapScope)));
107
+ }
108
+ }
109
+ catch (e) {
110
+ // Auto-unwrap can break explicit signal calls like errorData().message
111
+ // because it converts the signal to its value before the expression runs.
112
+ // Retry without auto-unwrap so signal functions remain callable.
113
+ try {
114
+ const fn = __stxCompileScoped(capturedScope, [], 'return ' + expr);
115
+ bindingNode.textContent = maybeUnwrapSignal(fn(...__stxArgs(fn, capturedScope)));
116
+ }
117
+ catch (e2) {
118
+ if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Expression error:', expr, e2);
119
+ bindingNode.textContent = '';
120
+ }
121
+ }
122
+ });
123
+ }
124
+ else if (part) {
125
+ fragment.appendChild(document.createTextNode(part));
126
+ }
127
+ });
128
+ el.replaceWith(fragment);
129
+ }
130
+ }
131
+ return;
132
+ }
133
+
134
+ if (el.nodeType !== Node.ELEMENT_NODE) return;
135
+ if (isForeignToLoopRow(el, scope)) return;
136
+
137
+ // <stx-link> handling removed \u2014 StxLink builtin now produces <a> directly
138
+ // with data-stx-link attribute. The router handles SPA click interception.
139
+
140
+ // <Suspense> boundary \u2014 coordinate descendant suspense queries (#1742).
141
+ if (el.hasAttribute('data-stx-suspense') && !el.__stx_suspense_bound) {
142
+ bindSuspense(el, scope);
143
+ // bindSuspense processes the content subtree itself; don't double-process.
144
+ return;
145
+ }
146
+
147
+ // Handle @for / :for / x-for first (reactive list)
148
+ var hasColonForLoop = el.hasAttribute(':for') && isForDirectiveExpression(el.getAttribute(':for'));
149
+ if (el.hasAttribute('@for') || hasColonForLoop || el.hasAttribute('x-for')) {
150
+ var forAttr = hasColonForLoop ? ':for' : el.hasAttribute('x-for') ? 'x-for' : '@for';
151
+ bindFor(el, scope, forAttr);
152
+ return;
153
+ }
154
+
155
+ // x-else / x-else-if are owned by their preceding x-if chain (#1734).
156
+ // An inactive chain member reached via the parent's snapshot child-
157
+ // iteration must be skipped. Connectivity cannot identify inactivity:
158
+ // an active inner branch is also disconnected while an outer conditional
159
+ // temporarily detaches its parent. bindIfChain owns explicit branch state
160
+ // so nested structural effects can still hydrate active detached subtrees.
161
+ if (el.__stx_chain_member && !el.__stx_chain_active) return;
162
+
163
+ // An else/else-if with no preceding if is an orphan. Match Vue: warn,
164
+ // strip the attribute, and render it as a plain element (fall through).
165
+ if (!el.__stx_chain_member) {
166
+ var orphanElse = getElseAttrInfo(el);
167
+ if (orphanElse) {
168
+ console.warn('[STX] ' + orphanElse.name + ' has no matching preceding x-if/:if/@if sibling; rendering as a plain element.');
169
+ el.removeAttribute(orphanElse.name);
170
+ }
171
+ }
172
+
173
+ // Handle @if / :if / x-if (conditional rendering)
174
+ if (el.hasAttribute('@if') || el.hasAttribute(':if') || el.hasAttribute('x-if')) {
175
+ var ifAttr = el.hasAttribute(':if') ? ':if' : el.hasAttribute('x-if') ? 'x-if' : '@if';
176
+
177
+ // If else/else-if siblings follow, drive the whole chain with one
178
+ // mutually-exclusive effect; otherwise the single-element fast path.
179
+ var ifChain = findIfChain(el, ifAttr);
180
+ console.log('[stx] :if dispatch on', el.tagName, ifAttr + '="' + el.getAttribute(ifAttr) + '"', 'chainLen:', ifChain.length, 'branches:', ifChain.map(function(c) { return c.attr; }).join(','));
181
+ if (ifChain.length > 1) bindIfChain(ifChain, scope);
182
+ else bindIf(el, scope, ifAttr);
183
+ return;
184
+ }
185
+
186
+ // Handle @show / :show / x-show (visibility toggle - keeps element in DOM)
187
+ var isNativeModal = el.tagName === 'MODAL';
188
+ if ((el.hasAttribute('@show') && !isNativeModal)
189
+ || el.hasAttribute(':show') || el.hasAttribute('x-show')) {
190
+ var showAttr = el.hasAttribute(':show') ? ':show' : el.hasAttribute('x-show') ? 'x-show' : '@show';
191
+ bindShow(el, el.getAttribute(showAttr), scope, showAttr);
192
+ }
193
+
194
+ // Handle @model / :model / x-model (two-way binding)
195
+ var modelBinding = getModelBinding(el);
196
+ if (modelBinding) {
197
+ bindModel(el, modelBinding.expression, scope, modelBinding.name);
198
+ }
199
+
200
+ // Capture scope once for all attribute bindings on this element
201
+ // Use the passed scope parameter to preserve context through nested processing
202
+ const attrCapturedScope = { ...globalHelpers, ...scope, ...(findElementScope(el) || {}) };
203
+
204
+ // Keep the conditional owners captured while the element is in the tree.
205
+ // Walking parents on each update loses an outer owner when an inner :if
206
+ // detaches its own root. These signals suspend writes while either owner
207
+ // is hidden and refresh the latest value AFTER reinsertion, even when the
208
+ // attribute's source did not change on that show.
209
+ const attrVisibility = [];
210
+ for (var attrAncestor = el; attrAncestor; attrAncestor = attrAncestor.parentNode) {
211
+ if (attrAncestor.__stx_if_visible) attrVisibility.push(attrAncestor.__stx_if_visible);
212
+ }
213
+ function attributesVisible() {
214
+ return attrVisibility.every(function(visible) { return visible(); });
215
+ }
216
+
217
+ // Post-eval unwrap: if the expression result is a signal function (e.g.
218
+ // step was resolved via identifier lookup, not via the auto-unwrap
219
+ // proxy \u2014 happens when a client script declares const step = state(...)
220
+ // at script-realm scope, making it accessible to new Function but not
221
+ // appearing in the Proxy Object.keys), call it to get the value.
222
+ // Without this, :text="step" sets textContent to the stringified
223
+ // signal function instead of the value.
224
+ const evalAttrExpr = (rawExpr, evaluationScope) => {
225
+ const activeScope = evaluationScope || attrCapturedScope;
226
+ // Decode HTML entities that browsers may encode in attribute values
227
+ // e.g. :text="a > b" may be stored as :text="a &gt; b" in HTML
228
+ var expr = rawExpr.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&#x27;/g,"'");
229
+ try {
230
+ if (/^__[A-Z_]+__$/.test(expr.trim())) return expr;
231
+
232
+ // Check for pipe syntax (Feature #2)
233
+ const pipeResult = parsePipeExpression(expr, activeScope);
234
+ if (pipeResult) {
235
+ const unwrapScope = createExpressionAutoUnwrapProxy(activeScope, expr);
236
+ var piped = maybeUnwrapSignal(executePipeExpression(pipeResult.valueExpr, pipeResult.pipes, unwrapScope));
237
+ noteExprSuccess(expr);
238
+ return piped;
239
+ }
240
+
241
+ // Use auto-unwrap proxy (Feature #1)
242
+ const unwrapScope = createExpressionAutoUnwrapProxy(activeScope, expr);
243
+ const fn = __stxCompileScoped(unwrapScope, [], 'return (' + expr + ')');
244
+ var value = maybeUnwrapSignal(fn(...__stxArgs(fn, unwrapScope)));
245
+ noteExprSuccess(expr);
246
+ return value;
247
+ }
248
+ catch (e) {
249
+ // Auto-unwrap can break explicit signal calls like errorData().message
250
+ // Retry without auto-unwrap so signal functions remain callable
251
+ try {
252
+ const fn = __stxCompileScoped(activeScope, [], 'return (' + expr + ')');
253
+ var retried = maybeUnwrapSignal(fn(...__stxArgs(fn, activeScope)));
254
+ noteExprSuccess(expr);
255
+ return retried;
256
+ }
257
+ catch (e2) {
258
+ if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Attribute expression error:', expr, e2);
259
+ // ReferenceError/TypeError stay unlogged HERE on purpose: a signal
260
+ // may not exist yet on an effect's first pass, and warning on every
261
+ // one of those trains people to ignore the console. Instead the
262
+ // failure is recorded and cleared the moment the same expression
263
+ // evaluates successfully, so only expressions that are STILL broken
264
+ // when hydration finishes get reported \u2014 by the audit (#1773).
265
+ else noteExprFailure(expr, e2);
266
+ return '';
267
+ }
268
+ }
269
+ };
270
+
271
+ // Known directive names to exclude from generic :attr binding
272
+ var DIRECTIVE_NAMES = ${directiveNamesLiteral};
273
+
274
+ // A bound value cannot introduce a URL scheme the page did not ask for.
275
+ // This is the client half of url-safety.ts: the server refuses a scheme
276
+ // substituted into an href, and x-href over a signal reaches the same
277
+ // attribute by another road. Same policy, same unsafe: prefix, so a page
278
+ // behaves the same whether the value arrived at render or at runtime.
279
+ var URL_NAV_ATTR = {href:1, 'xlink:href':1, action:1, formaction:1, ping:1, cite:1, manifest:1, data:1, to:1};
280
+ var URL_FETCH_ATTR = {src:1, srcset:1, poster:1, background:1};
281
+ var urlRefusalWarned = false;
282
+ function safeUrlAttr(attrName, value) {
283
+ var navigable = URL_NAV_ATTR[attrName];
284
+ if (!navigable && !URL_FETCH_ATTR[attrName]) return value;
285
+ if (typeof value !== 'string' || !value) return value;
286
+ // Browsers ignore ASCII whitespace and controls inside a scheme and match
287
+ // it case-insensitively, so the spellings collapse before the test.
288
+ var probe = value.replace(/[\\u0000-\\u0020\\u00a0\\u2000-\\u200f\\u2028\\u2029\\ufeff]+/g, '').toLowerCase();
289
+ var refused = /^(?:javascript|vbscript|livescript|mocha|view-source):/.test(probe)
290
+ || (navigable
291
+ ? /^data:(?:text\\/html|text\\/xml|application\\/xhtml\\+xml|application\\/xml|image\\/svg\\+xml)/.test(probe)
292
+ : /^data:(?:text\\/html|application\\/xhtml\\+xml)/.test(probe));
293
+ if (!refused) return value;
294
+ if (!urlRefusalWarned) {
295
+ urlRefusalWarned = true;
296
+ console.warn('[stx] refused a ' + attrName + ' value whose scheme can run script: ' + probe.slice(0, 24));
297
+ }
298
+ return 'unsafe:' + value;
299
+ }
300
+ // SVG attributes are case-sensitive, but the HTML parser lowercases
301
+ // prefixed attribute names \u2014 ':viewBox' arrives as ':viewbox' because
302
+ // the spec's "adjust SVG attributes" step only covers unprefixed names.
303
+ // Without restoring the canonical casing, setAttribute('viewbox') creates
304
+ // a dead duplicate attribute and the real viewBox never updates.
305
+ var SVG_ATTR_CASE = {attributename:'attributeName', attributetype:'attributeType', basefrequency:'baseFrequency', baseprofile:'baseProfile', calcmode:'calcMode', clippathunits:'clipPathUnits', diffuseconstant:'diffuseConstant', edgemode:'edgeMode', filterunits:'filterUnits', glyphref:'glyphRef', gradienttransform:'gradientTransform', gradientunits:'gradientUnits', kernelmatrix:'kernelMatrix', kernelunitlength:'kernelUnitLength', keypoints:'keyPoints', keysplines:'keySplines', keytimes:'keyTimes', lengthadjust:'lengthAdjust', limitingconeangle:'limitingConeAngle', markerheight:'markerHeight', markerunits:'markerUnits', markerwidth:'markerWidth', maskcontentunits:'maskContentUnits', maskunits:'maskUnits', numoctaves:'numOctaves', pathlength:'pathLength', patterncontentunits:'patternContentUnits', patterntransform:'patternTransform', patternunits:'patternUnits', pointsatx:'pointsAtX', pointsaty:'pointsAtY', pointsatz:'pointsAtZ', preservealpha:'preserveAlpha', preserveaspectratio:'preserveAspectRatio', primitiveunits:'primitiveUnits', refx:'refX', refy:'refY', repeatcount:'repeatCount', repeatdur:'repeatDur', requiredextensions:'requiredExtensions', requiredfeatures:'requiredFeatures', specularconstant:'specularConstant', specularexponent:'specularExponent', spreadmethod:'spreadMethod', startoffset:'startOffset', stddeviation:'stdDeviation', stitchtiles:'stitchTiles', surfacescale:'surfaceScale', systemlanguage:'systemLanguage', tablevalues:'tableValues', targetx:'targetX', targety:'targetY', textlength:'textLength', viewbox:'viewBox', viewtarget:'viewTarget', xchannelselector:'xChannelSelector', ychannelselector:'yChannelSelector', zoomandpan:'zoomAndPan'};
306
+ var SVG_NS = 'http://www.w3.org/2000/svg';
307
+ var EVENT_RE = ${eventRegexLiteral};
308
+ var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
309
+
310
+ // Handle attributes
311
+ getElementAttributes(el).forEach(attr => {
312
+ const name = attr.name;
313
+ const value = attr.value;
314
+ if (!name) return;
315
+
316
+ /*
317
+ * A doubled colon escapes the prefix, the way a doubled at-sign does in
318
+ * a directive: @@if renders @if, so ::foo renders :foo.
319
+ *
320
+ * It was excluded from the generic attribute path, which is why it was
321
+ * never evaluated as an expression -- but a name beginning with two
322
+ * colons also begins with one, so the event catch-all below claimed it,
323
+ * registered a listener for an event named :foo, and removed the
324
+ * attribute. The author got neither a binding nor their attribute: it
325
+ * disappeared, silently, and nothing took its place.
326
+ *
327
+ * Unescaped here rather than on the server, because an unescaped :foo
328
+ * reaching this pass is indistinguishable from one the author wrote and
329
+ * would be bound as an event. The attributes were snapshotted before
330
+ * this loop, so the one written now is not revisited.
331
+ */
332
+ if (name.startsWith('::')) {
333
+ el.removeAttribute(name);
334
+ el.setAttribute(name.slice(1), value);
335
+ return;
336
+ }
337
+
338
+ // Dynamic attribute binding: @bind:attr, x-bind:attr, :attr, OR x-attr
339
+ // x-attr (e.g. x-class, x-style, x-href, x-src) is the canonical binding prefix.
340
+ // :attr still works for backward compat but is reserved for structural directives.
341
+ // x-text, x-html, x-model, x-show, x-if, x-for, x-cloak, x-ref, x-data are
342
+ // handled by their own code paths below \u2014 exclude them here.
343
+ var X_HANDLED = ${handledXAttrsLiteral};
344
+ if (name.startsWith('@bind:') || name.startsWith('x-bind:')
345
+ || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
346
+ || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
347
+ let attrName = name.startsWith('@bind:') ? name.slice(6) : name.startsWith('x-bind:') ? name.slice(7) : name.startsWith('x-') ? name.slice(2) : name.slice(1);
348
+ if (el.namespaceURI === SVG_NS && SVG_ATTR_CASE[attrName]) attrName = SVG_ATTR_CASE[attrName];
349
+ var parentBindingNames = (el.getAttribute && el.getAttribute('data-stx-parent-bindings') || '').split(/\\s+/);
350
+ var bindingScope = el.__stx_parent_scope && parentBindingNames.includes(attrName)
351
+ ? el.__stx_parent_scope
352
+ : attrCapturedScope;
353
+ effect(() => {
354
+ if (!attributesVisible()) return;
355
+ const v = evalAttrExpr(value, bindingScope);
356
+ // Form control values are live DOM properties. Setting only the HTML
357
+ // attribute does not update a <select>'s chosen option and can leave
358
+ // inputs displaying stale text after a reactive update.
359
+ if (attrName === 'value' && 'value' in el) {
360
+ var controlValue = v;
361
+ if (typeof v === 'object' && v !== null) {
362
+ try { controlValue = JSON.stringify(v); }
363
+ catch (e) { controlValue = String(v); }
364
+ }
365
+ controlValue = v === false || v === null || v === undefined ? '' : String(controlValue);
366
+ el.__stx_bound_value = controlValue;
367
+ var applyControlValue = function() {
368
+ if (!attributesVisible()) return;
369
+ var desiredValue = el.__stx_bound_value == null ? '' : String(el.__stx_bound_value);
370
+ el.value = desiredValue;
371
+ if (desiredValue === '' && el.tagName !== 'OPTION') el.removeAttribute(attrName);
372
+ else if (el.getAttribute(attrName) !== desiredValue) el.setAttribute(attrName, desiredValue);
373
+ if (typeof el.__stx_model_sync === 'function') el.__stx_model_sync();
374
+ };
375
+ applyControlValue();
376
+
377
+ // A select's value binding is processed before its child
378
+ // directives. When a nested :for creates the matching options
379
+ // afterward, the browser otherwise leaves the first option
380
+ // selected. Keep the desired value and reapply it whenever the
381
+ // option tree changes, including later reactive list updates.
382
+ if (el.tagName === 'SELECT' && !el.__stx_value_observer && typeof window.MutationObserver !== 'undefined') {
383
+ el.__stx_value_observer = new window.MutationObserver(applyControlValue);
384
+ el.__stx_value_observer.observe(el, {
385
+ childList: true,
386
+ subtree: true,
387
+ attributes: true,
388
+ attributeFilter: ['value'],
389
+ });
390
+ el.__stx_destroy = el.__stx_destroy || [];
391
+ el.__stx_destroy.push(function() {
392
+ if (el.__stx_value_observer) el.__stx_value_observer.disconnect();
393
+ el.__stx_value_observer = null;
394
+ });
395
+ }
396
+ return;
397
+ }
398
+ // Checked, selected, and indeterminate are live DOM properties, just like value.
399
+ // Updating only the HTML attribute leaves a user-touched checkbox or
400
+ // radio in its previous state because the property becomes dirty.
401
+ // Indeterminate has no corresponding effective HTML attribute at all.
402
+ if ((attrName === 'checked' || attrName === 'selected' || attrName === 'indeterminate') && attrName in el) {
403
+ var selectedState = Boolean(v);
404
+ el[attrName] = selectedState;
405
+ if (attrName === 'indeterminate') {
406
+ el.removeAttribute(attrName);
407
+ }
408
+ else if (selectedState) {
409
+ el.setAttribute(attrName, '');
410
+ }
411
+ else {
412
+ el.removeAttribute(attrName);
413
+ }
414
+ return;
415
+ }
416
+ if (attrName.startsWith('aria-') && typeof v === 'boolean') {
417
+ stxHost.setAttribute(el, attrName, String(v));
418
+ }
419
+ else if (typeof v === 'boolean') {
420
+ stxHost.setAttribute(el, attrName, v);
421
+ }
422
+ else if (v === null || v === undefined) {
423
+ stxHost.removeAttribute(el, attrName);
424
+ }
425
+ else {
426
+ var attrValue = v;
427
+ if (typeof v === 'object') {
428
+ try { attrValue = JSON.stringify(v); }
429
+ catch (e) { attrValue = String(v); }
430
+ }
431
+ var attrValueSafe = safeUrlAttr(attrName, attrValue);
432
+ // Keep structured values structured for non-DOM hosts. The DOM
433
+ // host serializes them at its boundary, preserving web output.
434
+ var hostValue = (typeof v === 'object' && v !== null) ? v : attrValueSafe;
435
+ // Writing the value an attribute already has is not nothing: a
436
+ // frame given its own src again loads again (an entry in the
437
+ // page's history each time) and a video restarts. A player whose
438
+ // rest and next set share a video re-set it on every step.
439
+ if (el.getAttribute(attrName) === String(attrValueSafe)) return;
440
+ // A frame already on the page that is pointed somewhere else
441
+ // navigates, and every navigation is an entry in the page's own
442
+ // history: a player showing a video per step left one per step,
443
+ // and Back had to be tapped through all of them before it left
444
+ // the screen. Out of the page and back in, the frame starts afresh
445
+ // (its first load adds no entry, and its old entries go with it).
446
+ var parentNode = el.parentNode;
447
+ if (attrName === 'src' && el.tagName === 'IFRAME' && parentNode && el.isConnected
448
+ && el.hasAttribute('src') && el.getAttribute('src') !== String(attrValueSafe)) {
449
+ var nextSibling = el.nextSibling;
450
+ parentNode.removeChild(el);
451
+ stxHost.setAttribute(el, attrName, hostValue);
452
+ parentNode.insertBefore(el, nextSibling);
453
+ }
454
+ else {
455
+ stxHost.setAttribute(el, attrName, hostValue);
456
+ }
457
+ }
458
+ });
459
+ el.removeAttribute(name);
460
+ }
461
+ else if (name === '@class' || name === ':class' || name === 'x-class') {
462
+ bindClass(el, value, scope, attributesVisible);
463
+ el.removeAttribute(name);
464
+ }
465
+ else if (name === '@style' || name === ':style' || name === 'x-style') {
466
+ bindStyle(el, value, scope, attributesVisible);
467
+ el.removeAttribute(name);
468
+ }
469
+ else if (name === '@text' || name === ':text' || name === 'x-text') {
470
+ effect(() => {
471
+ stxHost.setText(el, evalAttrExpr(value));
472
+ });
473
+ el.removeAttribute(name);
474
+ }
475
+ else if (name === '@html' || name === ':html' || name === 'x-html') {
476
+ effect(() => {
477
+ // Coerce null/undefined to '' so a missing/unresolved binding renders
478
+ // nothing rather than the literal string "undefined" (#1767).
479
+ var markup = evalAttrExpr(value) ?? '';
480
+ if (stxHost.isNative && stxHost.setMarkup) stxHost.setMarkup(el, markup);
481
+ else el.innerHTML = markup;
482
+ });
483
+ el.removeAttribute(name);
484
+ }
485
+ else if (name === 'ref' || name === ':ref' || name === 'x-ref' || name === 'data-stx-ref') {
486
+ // A page ref can be projected through a component whose own $refs
487
+ // replaced the compatibility scope's map. The compiler retains the
488
+ // receiver boundary so named and signal refs use the same caller.
489
+ var refRoot = stxHost.scopeOf(el);
490
+ var refCaller = el.getAttribute('data-stx-ref-caller');
491
+ var refOwnerScope = findElementScope(el);
492
+ if (refCaller) {
493
+ var receiver = refRoot;
494
+ while (receiver && receiver.getAttribute('data-stx-scope') !== refCaller
495
+ && receiver.getAttribute('data-stx-template-scope') !== refCaller) {
496
+ receiver = stxHost.scopeOf(receiver, true);
497
+ }
498
+ refOwnerScope = receiver && receiver.__stx_parent_scope;
499
+ }
500
+ // Only projected refs may reach outside their component. Caller
501
+ // snapshots exclude unrelated, previously hydrated siblings.
502
+ if (refCaller && refOwnerScope) {
503
+ if (refOwnerScope.$refs) refOwnerScope.$refs[value] = el;
504
+ }
505
+ else {
506
+ if (scope.$refs) scope.$refs[value] = el;
507
+ if (componentScope.$refs) componentScope.$refs[value] = el;
508
+ }
509
+ // Also fill a same-named signal declared in the script block, so the
510
+ // documented ref() + x-ref pair works and reading the signal returns
511
+ // the element. Without this the signal stayed empty and every read of
512
+ // it silently returned undefined.
513
+ var refTarget = refCaller && refOwnerScope
514
+ ? refOwnerScope[value]
515
+ : (scope && scope[value]) || componentScope[value];
516
+ if (refTarget && typeof refTarget === 'function' && refTarget._isSignal && typeof refTarget.set === 'function') {
517
+ refTarget.set(el);
518
+ }
519
+ }
520
+ else if (name.startsWith('@') || name.startsWith(':')) {
521
+ // Event handlers: @click, :click, @submit.prevent, :keydown.enter, etc.
522
+ const parts = name.slice(1).split('.');
523
+ // HTML folds attribute names to lowercase; the forwarding metadata
524
+ // retains the declared event spelling (e.g. update:modelValue).
525
+ const parentEventNames = (el.getAttribute && el.getAttribute('data-stx-parent-events') || '').split(/\\s+/);
526
+ const eventName = parentEventNames.find(function(event) {
527
+ return event.toLowerCase() === parts[0].toLowerCase();
528
+ }) || parts[0];
529
+ const modifiers = parts.slice(1);
530
+
531
+ // Native Modal uses @show as a lifecycle event. On ordinary elements
532
+ // it remains the visibility directive, so keep that browser behavior.
533
+ const isNativeModalLifecycleEvent = eventName === 'show'
534
+ && el.tagName === 'MODAL';
535
+ // Skip special directives (already handled above or in processElement)
536
+ if (['if', 'for', 'show', 'model', 'class', 'style', 'text', 'html', 'ref'].includes(eventName)
537
+ && !isNativeModalLifecycleEvent) {
538
+ return;
539
+ }
540
+
541
+ // Prevent duplicate event binding on the same element
542
+ var eventKey = '__stx_evt_' + eventName + '_' + value.substring(0, 20);
543
+ if (el[eventKey]) { el.removeAttribute(name); return; }
544
+ el[eventKey] = true;
545
+
546
+ // Capture scope at setup time so @for loop variables are available when event fires
547
+ const isForwardedComponentEvent = !!(el.__stx_parent_scope && parentEventNames.includes(eventName));
548
+ let eventCapturedScope = isForwardedComponentEvent
549
+ ? { ...globalHelpers, ...el.__stx_parent_scope }
550
+ : { ...globalHelpers, ...scope, ...(findElementScope(el) || {}) };
551
+
552
+ stxHost.listen(el, eventName, (event) => {
553
+ // A forwarded handler belongs to the caller, whose scope can be
554
+ // resolved again after this listener is bound: a component inside
555
+ // another component's :if, in a dialog, was bound against the
556
+ // page's scope and only later handed its real caller, so
557
+ // @pick="pickFromBank" found nothing and did nothing. Read it now.
558
+ if (isForwardedComponentEvent && el.__stx_parent_scope)
559
+ eventCapturedScope = { ...globalHelpers, ...el.__stx_parent_scope };
560
+ // Vue-style component listeners fall through to the rendered native
561
+ // root unless the child emits the same event. Signal components use
562
+ // a scope wrapper, so native events arrive here from a descendant.
563
+ // Ignore that native event only after defineEmits() has declared or
564
+ // emitted the same name, preventing submit/click handlers from
565
+ // firing once for the native event and again for the CustomEvent.
566
+ var componentEmits = el.__stx_component_emits;
567
+ if (isForwardedComponentEvent && event.target !== el
568
+ && componentEmits && componentEmits[eventName]) return;
569
+
570
+ // Vue-style component handlers receive the emitted payload directly.
571
+ // Native root events still receive the Event object so server-only
572
+ // components can forward clicks and other browser events.
573
+ var handlerEvent = isForwardedComponentEvent && event instanceof CustomEvent
574
+ ? event.detail
575
+ : event;
576
+
577
+ // Skip an opener click that reaches UI which just became visible in
578
+ // this frame. A click whose target is inside the revealed subtree is
579
+ // a real interaction and must not be discarded, especially for
580
+ // async lists whose controls are usable as soon as they render.
581
+ if (eventName === 'click') {
582
+ var ancestor = el;
583
+ while (ancestor) {
584
+ if (ancestor.__stx_shown_at
585
+ && (performance.now() - ancestor.__stx_shown_at) < 50
586
+ && !(ancestor.contains && ancestor.contains(event.target))) return;
587
+ ancestor = ancestor.parentElement;
588
+ }
589
+ }
590
+ // System key modifiers
591
+ if (modifiers.includes('self') && event.target !== el) return;
592
+ if (modifiers.includes('ctrl') && !event.ctrlKey) return;
593
+ if (modifiers.includes('alt') && !event.altKey) return;
594
+ if (modifiers.includes('shift') && !event.shiftKey) return;
595
+ if (modifiers.includes('meta') && !event.metaKey) return;
596
+ // Key modifiers
597
+ for (var mi = 0; mi < modifiers.length; mi++) {
598
+ if (KEY_MAP[modifiers[mi]] && event.key !== KEY_MAP[modifiers[mi]]) return;
599
+ }
600
+ if (modifiers.includes('prevent')) event.preventDefault();
601
+ if (modifiers.includes('stop')) event.stopPropagation();
602
+ // Execute with captured scope (includes @for loop variables)
603
+ // For x-data scopes, expressions like "mobileOpen = !mobileOpen" need to
604
+ // read the signal value AND write back through the signal's setter.
605
+ try {
606
+ if (!value || /^__[A-Z_]+__$/.test(value.trim())) return;
607
+ var shorthandFn = parseEventShorthand(value, eventCapturedScope);
608
+ if (shorthandFn) { shorthandFn(handlerEvent); return; }
609
+ // Check if any scope values are signals (x-data pattern)
610
+ var hasSignals = Object.values(eventCapturedScope).some(function(v) {
611
+ return v && typeof v === 'function' && v._isSignal;
612
+ });
613
+ // Only use signal read/write proxy for DIRECT assignment expressions
614
+ // like "count = count + 1" or "open = !open". Function calls like
615
+ // "openModal()" handle their own signal.set() internally \u2014 the writeback
616
+ // would RESET signals to their pre-handler values.
617
+ var isDirectAssignment = hasSignals && /^[a-zA-Z_$]\\w*\\s*=/.test(value.trim()) && !value.trim().startsWith('==');
618
+ if (isDirectAssignment) {
619
+ var getVars = Object.keys(eventCapturedScope).map(function(k) {
620
+ return 'var ' + k + ' = __s["' + k + '"] && typeof __s["' + k + '"] === "function" && __s["' + k + '"]._isSignal ? __s["' + k + '"]() : __s["' + k + '"]';
621
+ }).join(';');
622
+ var setVars = Object.keys(eventCapturedScope).filter(function(k) {
623
+ var v = eventCapturedScope[k];
624
+ return v && typeof v === 'function' && v._isSignal;
625
+ }).map(function(k) {
626
+ return 'if(' + k + ' !== __s["' + k + '"]()) __s["' + k + '"].set(' + k + ')';
627
+ }).join(';');
628
+ var body = getVars + ';' + value + ';' + setVars;
629
+ var fn2 = __stxCompile(['__s', '$event'], body);
630
+ fn2(eventCapturedScope, handlerEvent);
631
+ } else if (hasSignals) {
632
+ // Function calls with signals in scope keep any signal used through
633
+ // its object API as a raw signal function, and unwrap the rest for
634
+ // primitive reads.
635
+ var unwrapVars = Object.keys(eventCapturedScope).map(function(k) {
636
+ var v = eventCapturedScope[k];
637
+ // A :for item is a signal only as an implementation detail, so
638
+ // that keyed rows can update in place. Its \`.value\` is a field
639
+ // on the item, never the signal compatibility API \u2014 the same
640
+ // rule createAutoUnwrapProxy states for binding expressions.
641
+ // Without the carve-out, expressionUsesSignalApi sees
642
+ // \`option.value\` and hands the handler the raw signal, so a
643
+ // handler like \`pick(option.value)\` receives the whole item.
644
+ // It is not an error, so it lands silently: the wrong value is
645
+ // stored and only surfaces much later.
646
+ if (v && typeof v === 'function' && v._isSignal && !v._isStxLoopItem
647
+ && (expressionCallsSignal(value, k) || expressionUsesSignalApi(value, k))) {
648
+ return 'var ' + k + ' = __s["' + k + '"]';
649
+ }
650
+ return 'var ' + k + ' = __s["' + k + '"] && typeof __s["' + k + '"] === "function" && __s["' + k + '"]._isSignal ? __s["' + k + '"]() : __s["' + k + '"]';
651
+ }).join(';');
652
+ var fn3 = __stxCompile(['__s', '$event'], unwrapVars + ';' + value);
653
+ fn3(eventCapturedScope, handlerEvent);
654
+ } else {
655
+ var fn = __stxCompileScoped(eventCapturedScope, ['$event'], value);
656
+ fn(...__stxArgs(fn, eventCapturedScope), handlerEvent);
657
+ }
658
+ }
659
+ catch (e) {
660
+ // See #1694: dropping the TypeError/ReferenceError carve-out for inline
661
+ // handlers \u2014 same reason as executeHandler above. Silencing these hid
662
+ // the substring-detector bug (auto-unwrap missing .set( inside helper
663
+ // calls) for ~30min of bisecting in the field.
664
+ console.warn('[STX] Handler error:', value, e);
665
+ }
666
+ }, {
667
+ capture: modifiers.includes('capture'),
668
+ // A touch or wheel listener that is not passive holds every scroll
669
+ // starting on the element until this thread has run it. Passive
670
+ // unless .prevent needs preventDefault() or .nonpassive asks.
671
+ passive: modifiers.includes('passive')
672
+ || (/^(touchstart|touchmove|wheel|mousewheel)$/i.test(eventName)
673
+ && !modifiers.includes('prevent') && !modifiers.includes('nonpassive')),
674
+ once: modifiers.includes('once')
675
+ });
676
+ el.removeAttribute(name);
677
+ }
678
+ });
679
+
680
+ // Process children (skip script/style elements \u2014 their text content is not template markup)
681
+ // Skip elements that are roots of nested stx.mount() components \u2014 those have their own scope
682
+ if (!skipChildren && el.tagName !== 'SCRIPT' && el.tagName !== 'STYLE') {
683
+ var children = Array.from(el.childNodes);
684
+ children.forEach(function(child) {
685
+ if (child.nodeType !== Node.ELEMENT_NODE) { processElement(child, scope); return; }
686
+ // Skip script elements entirely
687
+ if (child.tagName === 'SCRIPT') return;
688
+ // Skip elements already processed by stx.mount() \u2014 they have their own scope and effects
689
+ if (child.__stx_scope) return;
690
+ // Skip data-stx-scope elements \u2014 they are managed by the reactive (x-data) runtime
691
+ if (child.hasAttribute && child.hasAttribute('data-stx-scope')) return;
692
+ processElement(child, scope);
693
+ });
694
+ }
695
+ }`;
696
+ }