@stacksjs/stx 0.2.794 → 0.2.798

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 (247) hide show
  1. package/dist/{chunk-d6arvs57.js → chunk-0beyn8ak.js} +5 -5
  2. package/dist/{chunk-5a92srn2.js → chunk-0gsq8gps.js} +1 -1
  3. package/dist/chunk-0xnvjw7s.js +2 -0
  4. package/dist/chunk-1wyccmsr.js +2 -0
  5. package/dist/{chunk-7pk3t82j.js → chunk-20yz8bjp.js} +2 -2
  6. package/dist/{chunk-h0jnatd4.js → chunk-2ws2qe1k.js} +2 -2
  7. package/dist/{chunk-ssh2gycr.js → chunk-2z2bq2at.js} +3 -3
  8. package/dist/chunk-31qjy9xr.js +2 -0
  9. package/dist/chunk-33devn0s.js +2 -0
  10. package/dist/{chunk-c0ejyxfj.js → chunk-33vr7x2t.js} +3 -3
  11. package/dist/chunk-33wpv2n1.js +2 -0
  12. package/dist/{chunk-wk6xsyv3.js → chunk-3mby4nes.js} +3 -3
  13. package/dist/chunk-3p5gxc6t.js +2 -0
  14. package/dist/{chunk-j6255z7f.js → chunk-3x598qjt.js} +4 -4
  15. package/dist/chunk-4hgz9dkv.js +2 -0
  16. package/dist/{chunk-rrb9m2q2.js → chunk-4sesw88b.js} +5 -5
  17. package/dist/{chunk-94gyfwpz.js → chunk-4v50nafp.js} +14 -14
  18. package/dist/chunk-5kc9kjaa.js +2 -0
  19. package/dist/{chunk-vav9ktgm.js → chunk-5wwcgze3.js} +2 -2
  20. package/dist/chunk-5xd53dwe.js +2 -0
  21. package/dist/chunk-5y6518h8.js +2 -0
  22. package/dist/chunk-5y77pe7b.js +2 -0
  23. package/dist/chunk-6a97a9wk.js +2 -0
  24. package/dist/{chunk-5j619xgb.js → chunk-6b5zhtb3.js} +2 -2
  25. package/dist/chunk-6hre8cg4.js +2 -0
  26. package/dist/{chunk-4s5q1aea.js → chunk-6m4y5dh5.js} +6 -6
  27. package/dist/chunk-6pyweb05.js +2 -0
  28. package/dist/chunk-6tp7ys77.js +2 -0
  29. package/dist/chunk-6zxzr20d.js +2 -0
  30. package/dist/chunk-75ctpxr3.js +2 -0
  31. package/dist/{chunk-w9nwb8r3.js → chunk-7bxnjr3b.js} +7 -7
  32. package/dist/chunk-7gw96jpj.js +2 -0
  33. package/dist/chunk-7m4eesp0.js +2 -0
  34. package/dist/chunk-7na8bets.js +2 -0
  35. package/dist/{chunk-kr8qdg0r.js → chunk-7yb82rm6.js} +2 -2
  36. package/dist/{chunk-e3wmnjz8.js → chunk-810r5dk3.js} +3 -3
  37. package/dist/{chunk-e0wxcst7.js → chunk-89jn2jmf.js} +4 -4
  38. package/dist/{chunk-488kx8j5.js → chunk-8bzq2z0m.js} +5 -5
  39. package/dist/chunk-8k2n6abg.js +2 -0
  40. package/dist/chunk-8vqs94f3.js +2 -0
  41. package/dist/{chunk-dhqp3z4w.js → chunk-91htcq62.js} +2 -2
  42. package/dist/chunk-9736003n.js +2 -0
  43. package/dist/{chunk-agtvdtx4.js → chunk-9b6896tb.js} +2 -2
  44. package/dist/{chunk-y0pqpch2.js → chunk-9k6tza24.js} +7 -7
  45. package/dist/chunk-9w33k6f7.js +2 -0
  46. package/dist/{chunk-enep9r03.js → chunk-9x62j5f0.js} +52 -52
  47. package/dist/{chunk-b4r7d6me.js → chunk-a1ba9d2r.js} +5 -5
  48. package/dist/{chunk-efrc97by.js → chunk-a20wq8wf.js} +4 -4
  49. package/dist/{chunk-t3ptzpfc.js → chunk-a3xqfyb6.js} +2 -2
  50. package/dist/chunk-ag8j9ec2.js +2 -0
  51. package/dist/chunk-ak15dt1a.js +2 -0
  52. package/dist/{chunk-27rzdq3n.js → chunk-akcyaxwv.js} +2 -2
  53. package/dist/{chunk-w5hhqjwr.js → chunk-aw6369cx.js} +1 -1
  54. package/dist/chunk-b5ck6epd.js +177 -0
  55. package/dist/chunk-b98743ja.js +2 -0
  56. package/dist/{chunk-14ft0zc7.js → chunk-b9d70mgr.js} +6 -6
  57. package/dist/chunk-bskxswmn.js +2 -0
  58. package/dist/chunk-bv5h4etd.js +2 -0
  59. package/dist/chunk-c7x3bmvs.js +2 -0
  60. package/dist/{chunk-2gqhfge6.js → chunk-c84pxd2k.js} +2 -2
  61. package/dist/chunk-camm2hcx.js +2 -0
  62. package/dist/chunk-cd2wda5c.js +2 -0
  63. package/dist/chunk-cv6pqg85.js +2 -0
  64. package/dist/chunk-cy0mab8y.js +2 -0
  65. package/dist/chunk-d554f2fj.js +2 -0
  66. package/dist/chunk-dd1vqndp.js +2 -0
  67. package/dist/{chunk-0r61tkfe.js → chunk-ddhkhhc7.js} +2 -2
  68. package/dist/{chunk-9tqa8xvf.js → chunk-dsnggn3g.js} +2 -2
  69. package/dist/chunk-e14v1q9c.js +2 -0
  70. package/dist/{chunk-2m5h2mtr.js → chunk-e37g6ezw.js} +41 -41
  71. package/dist/chunk-e3xw2bzh.js +2 -0
  72. package/dist/{chunk-nps2whkz.js → chunk-eegb7f3t.js} +6 -6
  73. package/dist/chunk-eeztqt6f.js +2 -0
  74. package/dist/{chunk-1y9ez7nz.js → chunk-ef3w5thv.js} +2 -2
  75. package/dist/chunk-eh528njb.js +2 -0
  76. package/dist/chunk-en0wry1c.js +20 -0
  77. package/dist/chunk-eszpqrxy.js +2 -0
  78. package/dist/{chunk-2p4yad7w.js → chunk-fp0ew9n4.js} +4 -4
  79. package/dist/chunk-fyxkzs9c.js +2 -0
  80. package/dist/{chunk-d18xd9x5.js → chunk-gjf8cjdt.js} +3 -3
  81. package/dist/{chunk-7gdwvnwc.js → chunk-gvnfb6s2.js} +2 -2
  82. package/dist/{chunk-fpn4dren.js → chunk-gzfvj15b.js} +1 -1
  83. package/dist/chunk-hb4jkdfr.js +2 -0
  84. package/dist/{chunk-qp3xd98j.js → chunk-hg9mwgnr.js} +2 -2
  85. package/dist/{chunk-8q63njnd.js → chunk-hmt0vqhb.js} +1 -1
  86. package/dist/{chunk-v8rfeev5.js → chunk-hp9e8nz6.js} +2 -2
  87. package/dist/chunk-hzps1xya.js +2 -0
  88. package/dist/{chunk-985afhhy.js → chunk-j3st59hv.js} +2 -2
  89. package/dist/{chunk-7sartb04.js → chunk-jde0shn4.js} +2 -2
  90. package/dist/{chunk-15ckxpq7.js → chunk-jeprxn45.js} +6 -6
  91. package/dist/{chunk-bwcj9z19.js → chunk-jt0yn7ab.js} +4 -4
  92. package/dist/chunk-k8gpvg0w.js +2 -0
  93. package/dist/chunk-kgn911k7.js +2 -0
  94. package/dist/{chunk-jdj1358b.js → chunk-kj8dvzpc.js} +2 -2
  95. package/dist/chunk-km8c0j9g.js +2 -0
  96. package/dist/{chunk-w6taxq7d.js → chunk-mj3hzy1e.js} +5 -5
  97. package/dist/{chunk-66b56g2z.js → chunk-nw0v655w.js} +6 -6
  98. package/dist/{chunk-6v4b0xc1.js → chunk-p1mghe1h.js} +6 -6
  99. package/dist/{chunk-pa9zfbh6.js → chunk-p2a6dwj6.js} +6 -6
  100. package/dist/chunk-pw89m3re.js +2 -0
  101. package/dist/chunk-q38vjqv2.js +2 -0
  102. package/dist/{chunk-yyr7vb7k.js → chunk-q3ma4khe.js} +5 -5
  103. package/dist/{chunk-ne69yaak.js → chunk-q7q9e0gj.js} +10 -10
  104. package/dist/{chunk-kce6pzmj.js → chunk-qef2vv0m.js} +3 -3
  105. package/dist/{chunk-q14d714d.js → chunk-qjbpa1n4.js} +4 -4
  106. package/dist/{chunk-5gppagt3.js → chunk-qm2wmqre.js} +1 -1
  107. package/dist/{chunk-605b93pe.js → chunk-qpvwxppw.js} +4 -4
  108. package/dist/{chunk-8nb8b0nf.js → chunk-qxt6hdat.js} +1 -1
  109. package/dist/{chunk-1hajf3wc.js → chunk-r6d6jphq.js} +21 -21
  110. package/dist/chunk-rbv6fxtx.js +3 -0
  111. package/dist/chunk-rrketemm.js +2 -0
  112. package/dist/chunk-rwys552r.js +3 -0
  113. package/dist/chunk-s0bx4gjh.js +2 -0
  114. package/dist/{chunk-gv3bfkdm.js → chunk-s14jcqdf.js} +5 -5
  115. package/dist/{chunk-es006emk.js → chunk-s3fmmm98.js} +3 -3
  116. package/dist/chunk-s8s7b7rv.js +2 -0
  117. package/dist/{chunk-vkn133cs.js → chunk-s9b6abkb.js} +2 -2
  118. package/dist/{chunk-3gn1t0pa.js → chunk-sprgkk9j.js} +31 -31
  119. package/dist/chunk-sywqa4da.js +2 -0
  120. package/dist/{chunk-gb65t4n1.js → chunk-t65tn8ee.js} +2 -2
  121. package/dist/{chunk-vrbcdds3.js → chunk-trjhz9d9.js} +1 -1
  122. package/dist/chunk-txrbz95y.js +2 -0
  123. package/dist/{chunk-h0c6jtrj.js → chunk-v9hm1xv6.js} +5 -5
  124. package/dist/{chunk-bmfk3b29.js → chunk-w0zayhmg.js} +2 -2
  125. package/dist/{chunk-tnn0br4w.js → chunk-w58bnt44.js} +3 -3
  126. package/dist/chunk-w7681v48.js +2 -0
  127. package/dist/chunk-w7wz670a.js +2 -0
  128. package/dist/{chunk-epcy3r18.js → chunk-wp6bdac7.js} +113 -105
  129. package/dist/{chunk-8ztgy5y4.js → chunk-x8ckxemg.js} +107 -107
  130. package/dist/{chunk-74rf78w8.js → chunk-x8h81amr.js} +2 -2
  131. package/dist/{chunk-hh9t97hr.js → chunk-xa36escd.js} +3 -3
  132. package/dist/{chunk-7fr038wx.js → chunk-xskswvef.js} +4 -4
  133. package/dist/chunk-xzgtdcbg.js +2 -0
  134. package/dist/{chunk-k4bdf0dw.js → chunk-y9bj3566.js} +2 -2
  135. package/dist/chunk-yfdb3x3p.js +2 -0
  136. package/dist/{chunk-qv85c3qy.js → chunk-yv4dwdhc.js} +2 -2
  137. package/dist/{chunk-1stvxcjv.js → chunk-z1aq59qj.js} +3 -3
  138. package/dist/{chunk-nwbq8qvb.js → chunk-z1fb5k3h.js} +1305 -449
  139. package/dist/{chunk-tnkxww7b.js → chunk-z8wfvqbk.js} +5 -5
  140. package/dist/chunk-z9a80qqg.js +2 -0
  141. package/dist/chunk-za5kx15m.js +2 -0
  142. package/dist/{chunk-8e23zh2y.js → chunk-zbv8e4rq.js} +2 -2
  143. package/dist/{chunk-v1z6n7wz.js → chunk-znx5m1jv.js} +4 -4
  144. package/dist/{chunk-6pt4158p.js → chunk-zqsacq3r.js} +1 -1
  145. package/dist/{chunk-rgz797k3.js → chunk-zsy145ac.js} +3 -3
  146. package/dist/{chunk-j56mg28d.js → chunk-zx8tnhfr.js} +3 -3
  147. package/dist/cli.js +19 -19
  148. package/dist/client/signals-authoring-runtime.js +6 -3
  149. package/dist/client/signals-binding-utils-runtime.js +2 -4
  150. package/dist/client/signals-component-props-runtime.js +8 -2
  151. package/dist/client/signals-expression-compiler-runtime.js +1 -1
  152. package/dist/client/signals-for-runtime.js +34 -0
  153. package/dist/client/signals-handler-runtime.js +68 -24
  154. package/dist/client/signals-helpers-runtime.js +51 -0
  155. package/dist/client/signals-native-row-runtime.d.ts +26 -0
  156. package/dist/client/signals-native-row-runtime.js +661 -0
  157. package/dist/client/signals-pipe-runtime.js +16 -0
  158. package/dist/client/signals-process-element-runtime.js +305 -287
  159. package/dist/client/signals-proxy-runtime.js +56 -31
  160. package/dist/craft-entry.js +2 -2
  161. package/dist/craft.js +2 -2
  162. package/dist/native/accessibility.js +8 -0
  163. package/dist/native/compiler/bundle.js +1 -1
  164. package/dist/native/compiler/inline-style.js +93 -4
  165. package/dist/native/compiler/style-variables.js +9 -1
  166. package/dist/native/event-names.js +1 -0
  167. package/dist/native/prop-names.js +9 -1
  168. package/dist/native/runtime/binding-tree.d.ts +2 -0
  169. package/dist/native/runtime/binding-tree.js +12 -1
  170. package/dist/native/runtime/craft-bridge.js +66 -0
  171. package/dist/native/runtime/craft.d.ts +78 -2
  172. package/dist/native/runtime/native-host.d.ts +2 -0
  173. package/dist/native/runtime/native-host.js +315 -91
  174. package/dist/native-build.js +2 -23
  175. package/dist/pwa.js +3 -3
  176. package/dist/signals.d.ts +13 -10
  177. package/dist/signals.js +5 -3
  178. package/dist/ssg.js +15 -15
  179. package/dist/stx-virtual-ts.d.ts +25 -1
  180. package/dist/stx-virtual-ts.js +109 -6
  181. package/dist/typecheck.d.ts +3 -1
  182. package/dist/typecheck.js +28 -11
  183. package/package.json +6 -6
  184. package/dist/chunk-0675z8hj.js +0 -177
  185. package/dist/chunk-1brkqd5f.js +0 -2
  186. package/dist/chunk-1ds97d9m.js +0 -2
  187. package/dist/chunk-1tvb2stj.js +0 -2
  188. package/dist/chunk-2vxh8b8g.js +0 -2
  189. package/dist/chunk-33na85q2.js +0 -2
  190. package/dist/chunk-3t4t655h.js +0 -2
  191. package/dist/chunk-43ynckvh.js +0 -2
  192. package/dist/chunk-4v22nj67.js +0 -2
  193. package/dist/chunk-5v5w0cd2.js +0 -2
  194. package/dist/chunk-699t603m.js +0 -2
  195. package/dist/chunk-6f6xqzhb.js +0 -2
  196. package/dist/chunk-7mrr4ke5.js +0 -2
  197. package/dist/chunk-7tzzzvdg.js +0 -2
  198. package/dist/chunk-8a5txj4f.js +0 -2
  199. package/dist/chunk-8pphy0p1.js +0 -2
  200. package/dist/chunk-8rmb79zw.js +0 -2
  201. package/dist/chunk-8rwnzmvb.js +0 -2
  202. package/dist/chunk-90pxjq62.js +0 -2
  203. package/dist/chunk-9s4ggstz.js +0 -2
  204. package/dist/chunk-9wmjmas8.js +0 -2
  205. package/dist/chunk-9xdz8r73.js +0 -2
  206. package/dist/chunk-agvykxs8.js +0 -2
  207. package/dist/chunk-ajj56vrw.js +0 -2
  208. package/dist/chunk-ay4ep67v.js +0 -2
  209. package/dist/chunk-bwfncfe1.js +0 -3
  210. package/dist/chunk-cdsv4yrv.js +0 -2
  211. package/dist/chunk-d5e47gr4.js +0 -2
  212. package/dist/chunk-d910ytt2.js +0 -2
  213. package/dist/chunk-d9p7xaj7.js +0 -2
  214. package/dist/chunk-dsrn2vgp.js +0 -2
  215. package/dist/chunk-fkkdt6sj.js +0 -2
  216. package/dist/chunk-fpw03bhv.js +0 -2
  217. package/dist/chunk-fxy0cq7h.js +0 -2
  218. package/dist/chunk-g6smtcc0.js +0 -2
  219. package/dist/chunk-g747k4gg.js +0 -3
  220. package/dist/chunk-gryrg1c0.js +0 -2
  221. package/dist/chunk-gvj862m1.js +0 -2
  222. package/dist/chunk-h5nrnen8.js +0 -2
  223. package/dist/chunk-hagk74x6.js +0 -2
  224. package/dist/chunk-hv0whj8t.js +0 -2
  225. package/dist/chunk-k2brrhf8.js +0 -2
  226. package/dist/chunk-k6ncb5qm.js +0 -2
  227. package/dist/chunk-kn38mjpp.js +0 -2
  228. package/dist/chunk-kvmpc0sg.js +0 -2
  229. package/dist/chunk-nbjgytem.js +0 -2
  230. package/dist/chunk-nf2bzqaw.js +0 -2
  231. package/dist/chunk-nt7wqqax.js +0 -2
  232. package/dist/chunk-pq1qs7bp.js +0 -2
  233. package/dist/chunk-pvw58x2j.js +0 -20
  234. package/dist/chunk-qk9v0emh.js +0 -2
  235. package/dist/chunk-qnj444zc.js +0 -2
  236. package/dist/chunk-qzb0v08n.js +0 -2
  237. package/dist/chunk-s1wdzttg.js +0 -2
  238. package/dist/chunk-sq0qc9sk.js +0 -2
  239. package/dist/chunk-th5afzmv.js +0 -2
  240. package/dist/chunk-tktkj2dc.js +0 -2
  241. package/dist/chunk-vgzfsh1z.js +0 -2
  242. package/dist/chunk-wmh4yxcs.js +0 -2
  243. package/dist/chunk-wr3adhd8.js +0 -2
  244. package/dist/chunk-xmae29mn.js +0 -2
  245. package/dist/chunk-zdwnzq78.js +0 -2
  246. package/dist/chunk-zssf9fdg.js +0 -2
  247. package/dist/chunk-zyf6737j.js +0 -2
@@ -0,0 +1,661 @@
1
+ export const SIGNALS_NATIVE_ROW_RUNTIME = ` // ==========================================================================
2
+ // Native row plans
3
+ // ==========================================================================
4
+
5
+ var __STX_ROW_GENERIC_ATTRS = { 'stx-hydrate': 1, 'data-stx-memo': 1, 'data-stx-suspense': 1, 'x-data': 1, 'data-stx-xdata': 1, ref: 1, 'data-stx-ref': 1, 'data-stx-lazy': 1, 'data-stx-slot-scope': 1 };
6
+ var __STX_ROW_SKIPPED_EVENTS = { if: 1, for: 1, show: 1, model: 1, class: 1, style: 1, text: 1, html: 1, ref: 1 };
7
+ var __STX_ROW_CONTROL_ATTRS = { value: 1, checked: 1, selected: 1, indeterminate: 1 };
8
+ var __STX_IDENT = /^[A-Za-z_$][\\w$]*$/;
9
+ var __STX_QUOTED = /'(?:[^'\\\\]|\\\\.)*'|"(?:[^"\\\\]|\\\\.)*"/g;
10
+ var __STX_KEYWORDS = { return: 1, true: 1, false: 1, null: 1, typeof: 1, instanceof: 1, new: 1, this: 1, void: 1, in: 1, of: 1, delete: 1, function: 1, var: 1, let: 1, const: 1, if: 1, else: 1 };
11
+
12
+ function __stxAlwaysVisible() { return true; }
13
+
14
+ // What planning throws for a template it leaves to the generic path: one
15
+ // object, not an Error with a stack to capture for every refusal.
16
+ var ROW_UNPLANNED = { unplanned: true };
17
+
18
+ // A plan for rows cloned from \`template\`, or null where the generic path
19
+ // has to make them.
20
+ function planNativeRow(template) {
21
+ if (!template || template.nodeType !== 1 || !template.attributes) return null;
22
+ // Two scopes a row reads from: its own (bindings inside the row) and, for
23
+ // a component, its caller's (the props the caller passes). Each keeps the
24
+ // names its expressions mention and the functions compiled per shape.
25
+ var plan = { sites: [], eval: rowGroup(), prop: rowGroup(), props: null, component: false, scopeId: null, setup: null, root: null };
26
+ if (template.hasAttribute('data-stx-scope')) {
27
+ plan.component = true;
28
+ plan.scopeId = template.getAttribute('data-stx-template-scope') || template.getAttribute('data-stx-scope');
29
+ var setups = window.__stx_componentSetups;
30
+ plan.setup = setups && setups[plan.scopeId];
31
+ if (typeof plan.setup !== 'function') return null;
32
+ }
33
+ try {
34
+ plan.root = planRowNode(plan, template, true, false);
35
+ }
36
+ catch (e) {
37
+ return null;
38
+ }
39
+ return plan.root ? plan : null;
40
+ }
41
+
42
+ function rowGroup() {
43
+ return { names: [], nameIndex: {}, shapes: new Map() };
44
+ }
45
+
46
+ function planRowSite(plan, raw, kind) {
47
+ var expr = raw.indexOf('&') === -1 ? raw : raw.replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&#x27;/g, "'");
48
+ // The same body text each path compiles, so the functions are the ones
49
+ // the generic path would have made.
50
+ var body = kind === 'attr' || kind === 'text' || kind === 'prop' ? 'return (' + expr + ')'
51
+ : kind === 'if' ? 'return ' + expr + ''
52
+ : 'return ' + raw;
53
+ var source = kind === 'attr' || kind === 'text' || kind === 'if' ? expr : raw;
54
+ var group = kind === 'prop' ? plan.prop : plan.eval;
55
+ if (parsePipeExpression(source, {}) !== null) throw ROW_UNPLANNED;
56
+ if (plan.component && raw.indexOf(plan.scopeId) !== -1) throw ROW_UNPLANNED;
57
+ // The names the expression can read: not the words of its quoted strings
58
+ // (a class list in a ternary) nor keywords, which every row would
59
+ // otherwise look up in its scope for nothing.
60
+ var unquoted = source.indexOf("'") === -1 && source.indexOf('"') === -1 ? source : source.replace(__STX_QUOTED, ' ');
61
+ var names = __stxNamesIn(unquoted).filter(function(k) { return !__STX_KEYWORDS[k]; });
62
+ for (var i = 0; i < names.length; i++) {
63
+ if (group.nameIndex[names[i]] === undefined) {
64
+ group.nameIndex[names[i]] = group.names.length;
65
+ group.names.push(names[i]);
66
+ }
67
+ }
68
+ var site = { index: plan.sites.length, kind: kind, group: group, expr: source, body: body, names: names, placeholder: /^__[A-Z_]+__$/.test(source.trim()), ident: __STX_IDENT.test(source.trim()), handler: null };
69
+ plan.sites.push(site);
70
+ return site;
71
+ }
72
+
73
+ // One element of the template: its bindings, the attributes a row's copy
74
+ // keeps, and its children. Throws where the template needs the generic path;
75
+ // returns { generic: true } for an :if branch whose content does.
76
+ function planRowNode(plan, tmpl, isRoot, inBranch, gated) {
77
+ var node = { tmpl: tmpl, attrs: [], ops: [], children: [], ifSite: null, generic: false, inert: false, remap: [], gated: !!(gated || inBranch) };
78
+ var attrs = getElementAttributes(tmpl);
79
+ var parentEvents = __stxWords(tmpl.getAttribute('data-stx-parent-events') || '');
80
+ var parentBindings = isRoot && plan.component ? __stxWords(tmpl.getAttribute('data-stx-parent-bindings') || '') : [];
81
+ // A component's props, as bindParentComponentProps reads them: each
82
+ // parent binding from its :name attribute, else from the bindings an
83
+ // enclosing loop deferred (data-stx-deferred-parent-bindings). What the
84
+ // row leaves deferred is the same for every row.
85
+ var deferredProps = null;
86
+ if (isRoot && plan.component) {
87
+ plan.props = [];
88
+ deferredProps = readDeferredParentComponentProps(tmpl);
89
+ for (var b = 0; b < parentBindings.length; b++) {
90
+ var propName = parentBindings[b];
91
+ var propExpression = tmpl.hasAttribute(':' + propName) ? tmpl.getAttribute(':' + propName) : deferredProps[propName];
92
+ if (typeof propExpression !== 'string') continue;
93
+ plan.props.push({ name: propName, site: planRowSite(plan, propExpression, 'prop') });
94
+ delete deferredProps[propName];
95
+ }
96
+ }
97
+ if (getElseAttrInfo(tmpl)) throw ROW_UNPLANNED;
98
+ var generic = false;
99
+ for (var i = 0; i < attrs.length; i++) {
100
+ var name = attrs[i].name;
101
+ var value = attrs[i].value;
102
+ if (!name) continue;
103
+ if (name === ':if' || name === '@if') {
104
+ if (isRoot) throw ROW_UNPLANNED;
105
+ if (getElseAttrInfo(tmpl.nextElementSibling)) throw ROW_UNPLANNED;
106
+ node.ifSite = planRowSite(plan, value, 'if');
107
+ continue;
108
+ }
109
+ if (name === 'x-if') throw ROW_UNPLANNED;
110
+ if ((name === ':for' || name === '@for' || name === 'x-for') && isForDirectiveExpression(value)) throw ROW_UNPLANNED;
111
+ if (name === 'x-cloak') continue;
112
+ if (name === 'data-stx-scope' || name === 'data-stx-template-scope') {
113
+ if (!isRoot) throw ROW_UNPLANNED;
114
+ continue;
115
+ }
116
+ if (__STX_ROW_GENERIC_ATTRS[name] || name.startsWith('::') || name.startsWith('x-') || name.startsWith('@bind:')) { generic = true; continue; }
117
+ if (name.charCodeAt(0) === 58) {
118
+ var bound = name.slice(1);
119
+ var base = bound.split('.')[0];
120
+ if (base === 'class' || base === 'style' || base === 'text') {
121
+ if (name !== ':' + base) { generic = true; continue; }
122
+ node.ops.push({ kind: base, site: planRowSite(plan, value, base) });
123
+ if (base === 'text') node.inert = true;
124
+ continue;
125
+ }
126
+ if (DIRECTIVE_NAMES[base] || EVENT_RE.test(bound)) { generic = true; continue; }
127
+ if (isRoot && plan.component && parentBindings.indexOf(bound) !== -1) continue;
128
+ if ((__STX_ROW_CONTROL_ATTRS[bound] && bound in tmpl) || (bound === 'src' && tmpl.tagName === 'IFRAME')) { generic = true; continue; }
129
+ node.ops.push({ kind: 'attr', attrName: bound, site: planRowSite(plan, value, 'attr') });
130
+ continue;
131
+ }
132
+ if (name.charCodeAt(0) === 64) {
133
+ if (name === '@class' || name === '@style' || name === '@text') {
134
+ var directive = name.slice(1);
135
+ node.ops.push({ kind: directive, site: planRowSite(plan, value, directive) });
136
+ if (directive === 'text') node.inert = true;
137
+ continue;
138
+ }
139
+ var parts = name.slice(1).split('.');
140
+ var eventName = parentEvents.find(function(event) { return event.toLowerCase() === parts[0].toLowerCase(); }) || parts[0];
141
+ if (__STX_ROW_SKIPPED_EVENTS[eventName]) { generic = true; continue; }
142
+ if (plan.component && value.indexOf(plan.scopeId) !== -1) throw ROW_UNPLANNED;
143
+ node.ops.push({
144
+ kind: 'event',
145
+ eventName: eventName,
146
+ modifiers: parts.slice(1),
147
+ value: value,
148
+ key: '__stx_evt_' + eventName + '_' + value.substring(0, 20),
149
+ forwarded: isRoot && plan.component && parentEvents.indexOf(eventName) !== -1,
150
+ });
151
+ continue;
152
+ }
153
+ if (deferredProps && name === 'data-stx-deferred-parent-bindings' && plan.props.length) {
154
+ if (Object.keys(deferredProps).length) node.attrs.push({ name: name, value: JSON.stringify(deferredProps) });
155
+ continue;
156
+ }
157
+ if (plan.component && typeof value === 'string' && value.indexOf(plan.scopeId) !== -1) node.remap.push(node.attrs.length);
158
+ node.attrs.push(attrs[i]);
159
+ }
160
+ if (generic) {
161
+ if (!inBranch || !node.ifSite) throw ROW_UNPLANNED;
162
+ return { tmpl: tmpl, generic: true, ifSite: node.ifSite };
163
+ }
164
+ var kids = tmpl.childNodes || [];
165
+ for (var k = 0; k < kids.length; k++) {
166
+ var child = kids[k];
167
+ if (child.nodeType !== 1 || child.tagName === 'SCRIPT' || child.tagName === 'TEMPLATE' || child.__stx_scope) throw ROW_UNPLANNED;
168
+ var hasIf = child.hasAttribute(':if') || child.hasAttribute('@if');
169
+ node.children.push(planRowNode(plan, child, false, hasIf, node.gated));
170
+ }
171
+ return node;
172
+ }
173
+
174
+ // Which of the plan's names this row's scope holds, and the functions
175
+ // compiled for that answer. Rows of one loop nearly always share one.
176
+ function rowShape(group, own, layers) {
177
+ var names = group.names;
178
+ var stack = own[__STX_LAYERS];
179
+ // A row's scope is its loop's layers (the same objects for every row)
180
+ // and a few of its own (its item, its component's variables), which hold
181
+ // the same names from row to row. When this row's are the last row's or
182
+ // hold the same names, every name lives where it did: nothing to look up.
183
+ var last = group.last;
184
+ if (last && stack.length === last.stack.length && own[__STX_HIDDEN] === undefined && Object.keys(own).length === 0) {
185
+ var same = true;
186
+ for (var j = 0; j < stack.length && same; j++) {
187
+ if (stack[j] !== last.stack[j]) same = Object.keys(stack[j]).join('\x01') === last.names[j];
188
+ }
189
+ if (same) {
190
+ for (var n = 0; n < names.length; n++) layers[n] = last.at[n] < 0 ? null : stack[last.at[n]];
191
+ last.stack = stack;
192
+ return last.shape;
193
+ }
194
+ }
195
+ var signature = '';
196
+ var at = new Array(names.length);
197
+ for (var i = 0; i < names.length; i++) {
198
+ var layer = __stxLayerOf(own, names[i]);
199
+ layers[i] = layer;
200
+ at[i] = layer === null ? -1 : stack.lastIndexOf(layer);
201
+ signature += layer === null ? '0' : '1';
202
+ }
203
+ var shape = group.shapes.get(signature);
204
+ if (!shape) {
205
+ shape = { signature: signature, compiled: [] };
206
+ group.shapes.set(signature, shape);
207
+ }
208
+ // Remembered for the next row only when every name was found in a layer
209
+ // (not on the scope's own object, which differs per row).
210
+ var ownless = Object.keys(own).length === 0 && own[__STX_HIDDEN] === undefined;
211
+ if (ownless) {
212
+ for (var k = 0; k < names.length; k++) if (layers[k] !== null && at[k] < 0) ownless = false;
213
+ }
214
+ group.last = ownless ? { stack: stack, names: stack.map(function(layer) { return Object.keys(layer).join('\x01'); }), at: at, shape: shape } : null;
215
+ return shape;
216
+ }
217
+
218
+ // How the expression uses a name its scope holds, worked out when a row
219
+ // first evaluates it: a prop's scope keeps a signal its expression calls or
220
+ // uses as a signal (createAutoUnwrapProxy's rule), everything else follows
221
+ // the expression (StxAutoUnwrapHandler's).
222
+ function rowSignalUse(site, name) {
223
+ return site.kind === 'prop'
224
+ ? (expressionCallsSignal(site.expr, name) || expressionUsesSignalApi(site.expr, name) ? 1 : 0)
225
+ : expressionSignalUse(site.expr, name);
226
+ }
227
+
228
+ function compileRowSite(site, shape) {
229
+ var nameIndex = site.group.nameIndex;
230
+ var keys = [];
231
+ var uses = [];
232
+ for (var i = 0; i < site.names.length; i++) {
233
+ if (shape.signature.charCodeAt(nameIndex[site.names[i]]) === 49) {
234
+ keys.push(site.names[i]);
235
+ uses.push(rowSignalUse(site, site.names[i]));
236
+ }
237
+ }
238
+ var slots = keys.map(function(key) { return nameIndex[key]; });
239
+ var compiled = { keys: keys, slots: slots, uses: uses, fn: null, error: null };
240
+ try { compiled.fn = __stxCompile(keys, site.body); }
241
+ catch (e) { compiled.error = e; }
242
+ shape.compiled[site.index] = compiled;
243
+ return compiled;
244
+ }
245
+
246
+ function readRowScope(own, key) {
247
+ var layer = __stxLayerOf(own, key);
248
+ return layer === null ? own[key] : layer[key];
249
+ }
250
+
251
+ // What the expression's auto-unwrap proxy would hand the function for one
252
+ // name (StxAutoUnwrapHandler.get with the expression).
253
+ function unwrapRowValue(site, value, use) {
254
+ if (value && typeof value === 'function' && (value._isSignal || value._isDerived)) {
255
+ if (value._isStxLoopItem) return value();
256
+ if (use === 1) return value;
257
+ if (use === 0) return value();
258
+ var keep;
259
+ try {
260
+ var current = value();
261
+ keep = !(current && typeof current === 'object' && Object.prototype.hasOwnProperty.call(current, 'value'));
262
+ }
263
+ catch (e) { keep = true; }
264
+ return keep ? value : value();
265
+ }
266
+ if (value && typeof value === 'object' && value._isStxStore) {
267
+ if (!site.handler) {
268
+ var expr = site.expr;
269
+ site.handler = site.kind === 'prop'
270
+ ? new StxAutoUnwrapHandler(function(prop) { return typeof prop === 'string' && (expressionCallsSignal(expr, prop) || expressionUsesSignalApi(expr, prop)); }, null)
271
+ : new StxAutoUnwrapHandler(null, expr);
272
+ }
273
+ return new Proxy(value, site.handler);
274
+ }
275
+ return value;
276
+ }
277
+
278
+ // An expression evaluated as its generic path does: through the unwrapping
279
+ // scope first, then the raw scope, then reported and replaced by \`fallback\`.
280
+ // \`at\`: the scope the site reads, as the row found it (row.local or row.caller).
281
+ function evaluateRowSite(at, site, el, fallback, subscribe) {
282
+ if (site.placeholder) return site.expr;
283
+ var compiled = at.shape.compiled[site.index] || compileRowSite(site, at.shape);
284
+ var keys = compiled.keys;
285
+ var layers = at.layers;
286
+ var raw = new Array(keys.length);
287
+ var args = new Array(keys.length);
288
+ for (var i = 0; i < keys.length; i++) {
289
+ // The layer holding each name was found once for the row (rowShape):
290
+ // the layers are the row's own objects and the scopes it was given.
291
+ var value = layers[compiled.slots[i]][keys[i]];
292
+ raw[i] = value;
293
+ if (subscribe && value && typeof value === 'function' && (value._isSignal || value._isDerived)) value();
294
+ args[i] = unwrapRowValue(site, value, compiled.uses[i]);
295
+ }
296
+ if (compiled.fn) {
297
+ try {
298
+ var result = compiled.fn.apply(null, args);
299
+ if (site.kind === 'attr' || site.kind === 'text') {
300
+ if (result && typeof result === 'function' && (result._isSignal || result._isDerived)) result = result();
301
+ noteExprSuccess(site.expr);
302
+ }
303
+ return result;
304
+ }
305
+ catch (e1) {
306
+ try {
307
+ var retried = compiled.fn.apply(null, raw);
308
+ if (site.kind === 'attr' || site.kind === 'text') {
309
+ if (retried && typeof retried === 'function' && (retried._isSignal || retried._isDerived)) retried = retried();
310
+ noteExprSuccess(site.expr);
311
+ }
312
+ return retried;
313
+ }
314
+ catch (e2) {
315
+ return failRowSite(at, site, el, e2, fallback);
316
+ }
317
+ }
318
+ }
319
+ return failRowSite(at, site, el, compiled.error, fallback);
320
+ }
321
+
322
+ function failRowSite(at, site, el, error, fallback) {
323
+ reportUnknownBinding(error, site.expr, at.scope, el);
324
+ if (site.kind === 'prop') {
325
+ if (!(error instanceof ReferenceError) && !(error instanceof TypeError)) console.warn('[STX] Parent component prop error:', site.expr, error);
326
+ return fallback;
327
+ }
328
+ var label = site.kind === 'attr' || site.kind === 'text' ? '[STX] Attribute expression error:'
329
+ : site.kind === 'style' ? '[STX] Style expression error:'
330
+ : site.kind === 'class' ? '[STX] Class expression error:' : '[STX] Expression error:';
331
+ if (!(error instanceof ReferenceError) && !(error instanceof TypeError)) console.warn(label, site.expr, error);
332
+ else if (site.kind === 'attr' || site.kind === 'text') noteExprFailure(site.expr, error);
333
+ return fallback;
334
+ }
335
+
336
+ // The visibility gates an element's attribute bindings wait on: every :if
337
+ // around it, the row's own and those around the loop.
338
+ function rowVisibility(el, row, pnode) {
339
+ // Outside every :if of the row, in a loop no :if hides: always visible,
340
+ // without walking up to find that out.
341
+ if (!pnode.gated && !row.outer.length && !row.inserted) return __stxAlwaysVisible;
342
+ var gates = [];
343
+ for (var node = el; node; node = node.parentNode) {
344
+ if (node.__stx_if_visible) gates.push(node.__stx_if_visible);
345
+ if (node === row.root && !node.parentNode) {
346
+ for (var i = 0; i < row.outer.length; i++) gates.push(row.outer[i]);
347
+ break;
348
+ }
349
+ }
350
+ if (!gates.length) return __stxAlwaysVisible;
351
+ if (gates.length === 1) { var gate = gates[0]; return function() { return gate(); }; }
352
+ return function() {
353
+ for (var g = 0; g < gates.length; g++) if (!gates[g]()) return false;
354
+ return true;
355
+ };
356
+ }
357
+
358
+ // The nodes of one planned element, children placed and :if children
359
+ // given their anchors, nothing bound yet.
360
+ function buildRowNode(pnode, row) {
361
+ var el = stxHost.cloneElement(pnode.tmpl, pnode.attrs);
362
+ for (var r = 0; r < pnode.remap.length; r++) {
363
+ var attribute = pnode.attrs[pnode.remap[r]];
364
+ el.setAttribute(attribute.name, attribute.value.split(row.plan.scopeId).join(row.scopeId));
365
+ }
366
+ var kids = new Array(pnode.children.length);
367
+ for (var i = 0; i < pnode.children.length; i++) {
368
+ var child = pnode.children[i];
369
+ var made;
370
+ if (child.ifSite) {
371
+ made = { pnode: child, el: null, anchor: stxHost.anchor('stx-if') };
372
+ stxHost.append(el, made.anchor);
373
+ }
374
+ else {
375
+ made = buildRowNode(child, row);
376
+ stxHost.append(el, made.el);
377
+ }
378
+ kids[i] = made;
379
+ }
380
+ return { pnode: pnode, el: el, kids: kids, anchor: null };
381
+ }
382
+
383
+ function bindRowNode(made, row) {
384
+ var pnode = made.pnode;
385
+ var el = made.el;
386
+ var ops = pnode.ops;
387
+ var visible = null;
388
+ var urlWarning = null;
389
+ for (var i = 0; i < ops.length; i++) {
390
+ var op = ops[i];
391
+ if (op.kind === 'attr') {
392
+ if (!visible) visible = rowVisibility(el, row, pnode);
393
+ if (!urlWarning) urlWarning = { warned: false };
394
+ bindRowAttribute(el, op, row, visible, urlWarning);
395
+ }
396
+ else if (op.kind === 'class') {
397
+ if (!visible) visible = rowVisibility(el, row, pnode);
398
+ bindRowClass(el, op.site, row, visible);
399
+ }
400
+ else if (op.kind === 'style') {
401
+ if (!visible) visible = rowVisibility(el, row, pnode);
402
+ bindRowStyle(el, op.site, row, visible);
403
+ }
404
+ else if (op.kind === 'text') {
405
+ el.__stx_inert_content = true;
406
+ bindRowText(el, op.site, row);
407
+ }
408
+ else if (op.kind === 'event') {
409
+ if (el[op.key]) continue;
410
+ el[op.key] = true;
411
+ var forwarded = op.forwarded && !!el.__stx_parent_scope;
412
+ // A forwarded handler runs in its caller's scope, which the listener
413
+ // layers again when it fires; one layering serves all of the row's.
414
+ if (forwarded && row.forwardedScope === null) row.forwardedScope = layerTemplateScopes(globalHelpers, el.__stx_parent_scope);
415
+ listenTemplateEvent(el, op.eventName, op.modifiers, op.value, forwarded ? row.forwardedScope : row.evalScope, forwarded);
416
+ }
417
+ }
418
+ if (pnode.inert) return;
419
+ for (var k = 0; k < made.kids.length; k++) {
420
+ var kid = made.kids[k];
421
+ if (kid.anchor) bindRowIf(kid, made.el, row);
422
+ else bindRowNode(kid, row);
423
+ }
424
+ }
425
+
426
+ function bindRowAttribute(el, op, row, visible, urlWarning) {
427
+ effect(function() {
428
+ if (!visible()) return;
429
+ applyBoundAttribute(el, op.attrName, evaluateRowSite(row.local, op.site, el, ''), visible, urlWarning);
430
+ });
431
+ }
432
+
433
+ function bindRowText(el, site, row) {
434
+ effect(function() { stxHost.setText(el, evaluateRowSite(row.local, site, el, '')); });
435
+ }
436
+
437
+ function bindRowStyle(el, site, row, visible) {
438
+ effect(function() {
439
+ if (!visible()) return;
440
+ stxHost.setStyle(el, evaluateRowSite(row.local, site, el, {}), true);
441
+ });
442
+ }
443
+
444
+ // bindClass, reading its names through the row's scope.
445
+ function bindRowClass(el, site, row, visible) {
446
+ var originalClasses = el.className;
447
+ effect(function() {
448
+ if (!visible()) return;
449
+ var value = evaluateRowSite(row.local, site, el, '', true);
450
+ if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
451
+ Object.keys(value).forEach(function(cls) {
452
+ var tokens = cls.split(/\\s+/).filter(Boolean);
453
+ if (value[cls]) tokens.forEach(function(t) { el.classList.add(t); });
454
+ else tokens.forEach(function(t) { el.classList.remove(t); });
455
+ });
456
+ }
457
+ else if (Array.isArray(value)) {
458
+ el.className = [originalClasses, value.filter(Boolean).join(' ')].filter(Boolean).join(' ');
459
+ }
460
+ else {
461
+ el.className = [originalClasses, value || ''].filter(Boolean).join(' ');
462
+ }
463
+ });
464
+ }
465
+
466
+ // bindIf for an element of a planned row. Its element is made the first
467
+ // time it shows, rather than cloned with the row and removed again.
468
+ function bindRowIf(made, parentEl, row) {
469
+ var pnode = made.pnode;
470
+ var site = pnode.ifSite;
471
+ var placeholder = made.anchor;
472
+ var parent = parentEl;
473
+ var el = null;
474
+ var isInserted = false;
475
+ var childrenProcessed = false;
476
+ var firstRun = true;
477
+ var direct = site.ident ? readRowScope(row.local.own, site.expr.trim()) : null;
478
+ var directSignal = direct && (direct._isSignal || direct._isDerived) ? direct : null;
479
+ effect(function() {
480
+ parent = followPlaceholder(placeholder, parent, el ? [el] : []);
481
+ var value = directSignal ? directSignal() : evaluateRowSite(row.local, site, null, '');
482
+ var initial = firstRun;
483
+ firstRun = false;
484
+ if (!el) {
485
+ if (!value) return;
486
+ el = makeRowBranch(pnode, row);
487
+ made.el = el;
488
+ if (initial) {
489
+ // Shown from the start: placed as the generic path's clone was.
490
+ stxHost.insert(parent, el, placeholder.nextSibling);
491
+ isInserted = true;
492
+ }
493
+ }
494
+ stxHost.setVisible(el, !!value);
495
+ if (value && !isInserted) {
496
+ stxHost.insert(parent, el, placeholder.nextSibling);
497
+ if (parent && parent.__stx_detached_if) parent.__stx_detached_if.delete(el);
498
+ el.__stx_if_visible.set(true);
499
+ el.__stx_shown_at = performance.now();
500
+ isInserted = true;
501
+ peek(resumeDetachedBranches);
502
+ if (childrenProcessed) {
503
+ queueMicrotask(function() {
504
+ if (isInserted) peek(function() { resumeSubtreeScopes([el]); });
505
+ });
506
+ }
507
+ }
508
+ else if (!value && isInserted) {
509
+ el.__stx_if_visible.set(false);
510
+ suspendSubtreeScopes([el]);
511
+ stxHost.remove(el);
512
+ if (parent) {
513
+ if (!parent.__stx_detached_if) parent.__stx_detached_if = new Set();
514
+ parent.__stx_detached_if.add(el);
515
+ }
516
+ isInserted = false;
517
+ }
518
+ if (value && isInserted && !childrenProcessed) {
519
+ childrenProcessed = true;
520
+ peek(function() { hydrateRowBranch(made, row); });
521
+ }
522
+ });
523
+ }
524
+
525
+ function makeRowBranch(pnode, row) {
526
+ var el;
527
+ if (pnode.generic) {
528
+ el = stxHost.clone(pnode.tmpl);
529
+ el.removeAttribute(':if');
530
+ el.removeAttribute('@if');
531
+ if (row.plan.component) remapRowSubtree(el, row);
532
+ }
533
+ else {
534
+ var made = buildRowNode(pnode, row);
535
+ el = made.el;
536
+ el.__stx_row_made = made;
537
+ }
538
+ el.__stx_if_bound = true;
539
+ el.__stx_if_visible = state(true);
540
+ return el;
541
+ }
542
+
543
+ function remapRowSubtree(el, row) {
544
+ var oldId = row.plan.scopeId;
545
+ [el].concat(stxHost.descendants(el)).forEach(function(node) {
546
+ if (!node.attributes) return;
547
+ getElementAttributes(node).forEach(function(attribute) {
548
+ if (typeof attribute.value === 'string' && attribute.value.indexOf(oldId) !== -1)
549
+ node.setAttribute(attribute.name, attribute.value.split(oldId).join(row.scopeId));
550
+ });
551
+ });
552
+ }
553
+
554
+ function hydrateRowBranch(made, row) {
555
+ var el = made.el;
556
+ var built = el.__stx_row_made;
557
+ if (built) {
558
+ el.__stx_row_made = null;
559
+ el.__stx_if_disposers = trackEffects(function() { bindRowNode(built, row); });
560
+ resumeDetachedBranches();
561
+ return;
562
+ }
563
+ // Generic content, processed as bindIf's shown branch is: once its row
564
+ // is on the screen, since the generic walk reads the tree around it.
565
+ var run = function() {
566
+ if (!el.isConnected) {
567
+ if (!row.inserted) { row.after.push(run); return; }
568
+ var resume = function() { peek(run); };
569
+ resume.el = el;
570
+ detachedBranches.add(resume);
571
+ return;
572
+ }
573
+ var wasTracked = !!el.__stx_disposers;
574
+ if (wasTracked || !el.__stx_disposers)
575
+ el.__stx_if_disposers = trackEffects(function() { processElement(el, row.evalScope); });
576
+ resumeDetachedBranches();
577
+ };
578
+ run();
579
+ }
580
+
581
+ // The scope a row's expressions read, with the layer each name lives in
582
+ // found once (rowShape): the layers are the row's own objects and the
583
+ // scopes it was given, so a read goes straight to the layer.
584
+ function rowScopeAt(group, scope) {
585
+ var own = __stxOwnOf.get(scope);
586
+ var layers = new Array(group.names.length);
587
+ return { scope: scope, own: own, layers: layers, shape: rowShape(group, own, layers) };
588
+ }
589
+
590
+ // bindParentComponentProps for a planned row: the caller's props, each
591
+ // evaluated with the function compiled for it, written as the generic
592
+ // path writes them.
593
+ function bindRowProps(root, row, callerScope) {
594
+ root.__stx_parent_props_bound = true;
595
+ var props = row.plan.props;
596
+ var caller = row.caller = rowScopeAt(row.plan.prop, layerTemplateScopes(globalHelpers, callerScope));
597
+ for (var i = 0; i < props.length; i++) bindRowProp(root, props[i], caller);
598
+ }
599
+
600
+ function bindRowProp(root, prop, caller) {
601
+ var name = prop.name;
602
+ effect(function() {
603
+ var value = evaluateRowSite(caller, prop.site, root, undefined);
604
+ if (value && typeof value === 'function' && (value._isSignal || value._isDerived)) value = value();
605
+ if (name.startsWith('aria-') && typeof value === 'boolean') stxHost.setAttribute(root, name, String(value));
606
+ else if (value === null || value === undefined) stxHost.removeAttribute(root, name);
607
+ else stxHost.setAttribute(root, name, value);
608
+ syncComponentPropSignal(root, name, value);
609
+ });
610
+ }
611
+
612
+ // A row of \`plan\`, bound before it is inserted. \`parent\` is where it will
613
+ // go; the caller inserts it and then calls finishNativeRow.
614
+ function createNativeRow(plan, itemScope, parent) {
615
+ var row = { plan: plan, root: null, scope: null, evalScope: null, local: null, caller: null, forwardedScope: null, outer: [], after: [], inserted: false, scopeVars: null, scopeId: null };
616
+ for (var node = parent; node; node = node.parentNode) if (node.__stx_if_visible) row.outer.push(node.__stx_if_visible);
617
+ if (plan.component) row.scopeId = plan.scopeId + '_for_' + (++__forComponentScopeCounter);
618
+ var made = buildRowNode(plan.root, row);
619
+ var root = made.el;
620
+ row.root = root;
621
+ if (plan.component) {
622
+ if (!root.hasAttribute('data-stx-template-scope')) root.setAttribute('data-stx-template-scope', plan.scopeId);
623
+ root.setAttribute('data-stx-scope', row.scopeId);
624
+ if (!(window.stx._scopes && window.stx._scopes[row.scopeId])) runClonedComponentSetup(plan.setup, root);
625
+ var callerScope = componentCallerScopeFrom(parent, itemScope);
626
+ root.__stx_parent_scope = callerScope;
627
+ if (plan.props.length) bindRowProps(root, row, callerScope);
628
+ var scopeVars = window.stx._scopes && window.stx._scopes[row.scopeId];
629
+ if (!scopeVars) return { root: root, row: row };
630
+ scopeVars.__el = root;
631
+ row.scopeVars = scopeVars;
632
+ row.scope = layerTemplateScopes(callerScope, scopeVars);
633
+ // processElement layers the helpers and the component's variables over
634
+ // this scope for each element; it already starts with the helpers (the
635
+ // item scope's first layer) and ends with the variables, so the same
636
+ // names resolve to the same layers through it as it is.
637
+ row.evalScope = row.scope;
638
+ }
639
+ else {
640
+ row.scope = itemScope;
641
+ row.evalScope = layerTemplateScopes(globalHelpers, itemScope, findElementScope(parent) || {});
642
+ }
643
+ row.local = rowScopeAt(plan.eval, row.evalScope);
644
+ var dispose = trackEffects(function() { bindRowNode(made, row); });
645
+ if (plan.component) root.__stx_disposers = dispose;
646
+ else root.__stx_effect_disposers = dispose;
647
+ return { root: root, row: row };
648
+ }
649
+
650
+ function finishNativeRow(created) {
651
+ var row = created.row;
652
+ row.inserted = true;
653
+ var scopeVars = row.scopeVars;
654
+ if (scopeVars && scopeVars.__mountCallbacks && !scopeVars.__mounted) {
655
+ scopeVars.__mounted = true;
656
+ runMountCallbacks(scopeVars.__mountCallbacks, scopeDestroySink(scopeVars));
657
+ }
658
+ var after = row.after.splice(0, row.after.length);
659
+ for (var i = 0; i < after.length; i++) after[i]();
660
+ }
661
+ `;
@@ -13,6 +13,22 @@ export const SIGNALS_PIPE_RUNTIME = ` // ======================================
13
13
  if (expr.indexOf('|') === -1) return null;
14
14
  const known = __stxPipeIndex.get(expr);
15
15
  if (known === -1) return null;
16
+ // Nearly every bar is half of a ||: when no bar stands alone, there is no
17
+ // pipe, and the character scan below (slow in an interpreter, for an
18
+ // expression of any length) has nothing to find.
19
+ if (known === undefined) {
20
+ let bar = expr.indexOf('|');
21
+ while (bar !== -1) {
22
+ if (expr.charCodeAt(bar + 1) === 124) { bar = expr.indexOf('|', bar + 2); continue; }
23
+ if (bar > 0 && expr.charCodeAt(bar - 1) === 63) { bar = expr.indexOf('|', bar + 1); continue; }
24
+ break;
25
+ }
26
+ if (bar === -1) {
27
+ if (__stxPipeIndex.size >= 5000) __stxPipeIndex.clear();
28
+ __stxPipeIndex.set(expr, -1);
29
+ return null;
30
+ }
31
+ }
16
32
  // Find pipe operators: single | that's not part of || or preceded by ?
17
33
  // We need to find | that is:
18
34
  // 1. Not preceded by | or ?