@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
@@ -1,4 +1,4 @@
1
- import { accessibilityChanges, authoredAccessibilityProps, projectAccessibility } from "../accessibility.js";
1
+ import { ACCESSIBILITY_FIELDS, accessibilityChanges, authoredAccessibilityProps, isAccessibilityAttribute, projectAccessibility } from "../accessibility.js";
2
2
  import { seedClassTable } from "../compiler/class-table.js";
3
3
  import { compileClassStyles, NATIVE_STATE_VARIANTS } from "../compiler/headwind-to-style.js";
4
4
  import { resolveIconName } from "../compiler/icons.js";
@@ -8,7 +8,7 @@ import { affectsGeometry, applySvgAnimation, parseSvgMarkup, parseViewBox, SVG_A
8
8
  import { NATIVE_EVENT_NAMES } from "../event-names.js";
9
9
  import { nativePropName } from "../prop-names.js";
10
10
  import { authoredTextEntryProps, projectTextEntry, TEXT_ENTRY_SOURCES, textEntryChanges } from "../text-entry.js";
11
- import { BindingElement, cloneNativeBindingNode } from "./binding-tree.js";
11
+ import { BindingElement, cloneNativeBindingNode, cloneNativeBindingNodeWith } from "./binding-tree.js";
12
12
  import { NATIVE_FORM_ENTRIES } from "./jsc-globals.js";
13
13
  import { createNativeOverlayPresenter } from "./overlay-presenter.js";
14
14
  import { prepareInitialMedia } from "./initial-media-mutations.js";
@@ -60,9 +60,53 @@ export const HOST_METHODS = [
60
60
  "descendants",
61
61
  "scopesIn"
62
62
  ];
63
+ const wordLists = new Map;
64
+ function words(text) {
65
+ let list = wordLists.get(text);
66
+ if (list === void 0) {
67
+ list = text.split(/\s+/).filter(Boolean);
68
+ if (wordLists.size >= 2000)
69
+ wordLists.clear();
70
+ wordLists.set(text, list);
71
+ }
72
+ return list;
73
+ }
74
+ const flatNames = new Map;
75
+ function flatName(name) {
76
+ let flat = flatNames.get(name);
77
+ if (flat === void 0) {
78
+ flat = name.replace(/-/g, "").toLowerCase();
79
+ if (flatNames.size >= 2000)
80
+ flatNames.clear();
81
+ flatNames.set(name, flat);
82
+ }
83
+ return flat;
84
+ }
85
+ const nativeEventNames = new Map;
86
+ function nativeEventName(event) {
87
+ let name = nativeEventNames.get(event);
88
+ if (name === void 0) {
89
+ name = NATIVE_EVENT_NAMES[event.toLowerCase()] ?? event;
90
+ if (nativeEventNames.size >= 2000)
91
+ nativeEventNames.clear();
92
+ nativeEventNames.set(event, name);
93
+ }
94
+ return name;
95
+ }
96
+ const scriptEventNames = new Map;
97
+ function scriptOnlyEvent(event) {
98
+ let only = scriptEventNames.get(event);
99
+ if (only === void 0) {
100
+ only = NATIVE_EVENT_NAMES[event.toLowerCase()] === void 0 && !/^on[A-Z]/.test(event);
101
+ if (scriptEventNames.size >= 2000)
102
+ scriptEventNames.clear();
103
+ scriptEventNames.set(event, only);
104
+ }
105
+ return only;
106
+ }
63
107
  function followsHref() {}
64
108
  export function createNativeHost(options) {
65
- const records = new Map, attributeObservers = new WeakMap, childObservers = new WeakMap, handlers = new Map, eventRegistrations = new WeakMap, componentListeners = new WeakMap, controlsWithDefaultListeners = new WeakSet, implicitSubmitListeners = new WeakMap, formResetCallbacks = new WeakMap;
109
+ const records = new Map, attributeObservers = new WeakMap, childObservers = new WeakMap, handlers = new Map, eventRegistrations = new WeakMap, componentListeners = new WeakMap, controlsWithDefaultListeners = new WeakSet, implicitSubmitListeners = new WeakMap, formResetCallbacks = new WeakMap, boundHrefs = new WeakMap;
66
110
  let queue = [], mediaFlushTimer, scheduled = !1, counter = 0, colorScheme = options.colorScheme ?? "light", viewportWidth = Number.isFinite(options.viewportWidth) ? Math.max(0, options.viewportWidth) : 0;
67
111
  const widthBounds = { min: new Set, max: new Set }, crossesWidthBound = (from, to) => {
68
112
  for (const min of widthBounds.min)
@@ -175,11 +219,17 @@ export function createNativeHost(options) {
175
219
  return value.trim();
176
220
  return null;
177
221
  }
178
- function installLinkListener(node) {
222
+ function installLinkListener(node, authored = node) {
179
223
  markCurrentLink(node);
180
224
  if (!followLink)
181
225
  return;
182
- if (isBindingNode(node) && node.attributes.some((attribute) => attribute.name.endsWith("href") && /^(?::|x-bind:|@bind:|x-)href$/.test(attribute.name)) || typeof descriptorOf(node)?.props.href === "string")
226
+ let bound = boundHrefs.get(authored);
227
+ if (bound === void 0 || authored === node) {
228
+ bound = isBindingNode(authored) && authored.attributes.some((attribute) => attribute.name.endsWith("href") && /^(?::|x-bind:|@bind:|x-)href$/.test(attribute.name));
229
+ if (authored !== node)
230
+ boundHrefs.set(authored, bound);
231
+ }
232
+ if (bound || typeof descriptorOf(node)?.props.href === "string")
183
233
  host.listen(node, "click", followsHref);
184
234
  }
185
235
  function markCurrentLink(node) {
@@ -235,7 +285,10 @@ export function createNativeHost(options) {
235
285
  return record;
236
286
  }
237
287
  function decorateControl(node, type) {
238
- const htmlCheckbox = type === "Checkbox" && descriptorOf(node)?.props.type === "checkbox", hidden = descriptorOf(node)?.props.type === "hidden";
288
+ const own = descriptorOf(node);
289
+ if (type !== "TextInput" && type !== "Picker" && type !== "Checkbox" && own?.props.type !== "hidden" && !own?.props["data-stx-form"])
290
+ return;
291
+ const htmlCheckbox = type === "Checkbox" && own?.props.type === "checkbox", hidden = own?.props.type === "hidden";
239
292
  if (type === "TextInput" || type === "Picker" || htmlCheckbox || hidden) {
240
293
  Object.defineProperty(node, "value", {
241
294
  configurable: !0,
@@ -281,6 +334,24 @@ export function createNativeHost(options) {
281
334
  function hostProps(record) {
282
335
  return { ...record.props, ...projectAccessibility(record.props, record.type), ...projectTextEntry(record.type, record.props) };
283
336
  }
337
+ function createdProps(record) {
338
+ const props = record.props, created = {};
339
+ let accessible = record.type === "Image";
340
+ const names = Object.keys(props);
341
+ for (let i = 0;i < names.length; i++) {
342
+ const name = names[i], first = name.charCodeAt(0);
343
+ if (first === 100 ? name.startsWith("data-stx-") && name !== "data-stx-component-wrapper" : name === "__stxId")
344
+ continue;
345
+ if (!accessible && (first === 97 || first === 114))
346
+ accessible = isAccessibilityAttribute(name) || ACCESSIBILITY_FIELDS.includes(name);
347
+ created[name] = props[name];
348
+ }
349
+ if (accessible)
350
+ Object.assign(created, projectAccessibility(props, record.type));
351
+ if (record.type === "TextInput")
352
+ Object.assign(created, projectTextEntry(record.type, props));
353
+ return created;
354
+ }
284
355
  function ariaState(value) {
285
356
  return value === !0 || value === "true";
286
357
  }
@@ -344,7 +415,7 @@ export function createNativeHost(options) {
344
415
  let delegatedPress = !1;
345
416
  if (pressable) {
346
417
  for (let owner = node.__stxOwner;owner; owner = owner.__stxOwner)
347
- if (componentListeners.get(owner)?.some((listener) => (NATIVE_EVENT_NAMES[listener.event.toLowerCase()] ?? listener.event) === "onPress")) {
418
+ if (componentListeners.get(owner)?.some((listener) => nativeEventName(listener.event) === "onPress")) {
348
419
  delegatedPress = !0;
349
420
  break;
350
421
  }
@@ -370,7 +441,7 @@ export function createNativeHost(options) {
370
441
  } else if (!eligible && previous) {
371
442
  previous.stop();
372
443
  implicitSubmitListeners.delete(node);
373
- if (!componentListeners.get(node)?.some((listener) => (NATIVE_EVENT_NAMES[listener.event.toLowerCase()] ?? listener.event) === "onSubmitEditing")) {
444
+ if (!componentListeners.get(node)?.some((listener) => nativeEventName(listener.event) === "onSubmitEditing")) {
374
445
  const id = record.events.onSubmitEditing;
375
446
  if (id)
376
447
  handlers.delete(id);
@@ -381,12 +452,15 @@ export function createNativeHost(options) {
381
452
  }
382
453
  }
383
454
  }
384
- function materialize(node) {
455
+ function materialize(node, inherited) {
385
456
  const record = recordOf(node);
386
457
  if (record.materialized || node.__stxAnchor !== void 0)
387
458
  return;
388
459
  installControlListeners(node);
389
- record.style = resolveStyle(record, node.__stxId);
460
+ if (inherited !== void 0)
461
+ record.inheritedVariables = inherited;
462
+ record.styleDirty = !1;
463
+ resolveClasses(node.__stxId, record, !1);
390
464
  record.materialized = !0;
391
465
  emit({
392
466
  op: "createNode",
@@ -394,7 +468,7 @@ export function createNativeHost(options) {
394
468
  node: {
395
469
  type: record.type,
396
470
  ...record.key === void 0 ? {} : { key: record.key },
397
- props: hostProps(record),
471
+ props: createdProps(record),
398
472
  style: { ...record.style },
399
473
  ...Object.keys(record.events).length ? { events: { ...record.events } } : {},
400
474
  ...record.text === void 0 ? {} : { children: [record.text] }
@@ -404,23 +478,65 @@ export function createNativeHost(options) {
404
478
  for (const child of record.children) {
405
479
  if (child.__stxAnchor !== void 0)
406
480
  continue;
407
- materialize(child);
481
+ materialize(child, record.variables);
408
482
  emit({ op: "insertChild", parentId: node.__stxId, childId: child.__stxId, index: index++ });
409
483
  }
410
484
  }
411
485
  let resolvingId = "";
412
486
  const reportStyle = (diagnostic) => {
413
487
  console.warn(`[STX Native] ${diagnostic.kind}: ${resolvingId}: ${diagnostic.name}`);
414
- }, NO_LAYERS = [];
488
+ }, NO_LAYERS = [], classMemos = new Map;
489
+ function classStylesOf(record, forStyle) {
490
+ const classes = record.forwardedClasses === void 0 ? `${record.classes} ` : `${record.classes} ${record.forwardedClasses}`, source = record.type === "TextInput" ? `\x01${classes}` : classes;
491
+ let memo = record.classMemo;
492
+ if (!memo || memo.source !== source || memo.variables !== record.variables || memo.scheme !== colorScheme) {
493
+ memo = classMemos.get(source);
494
+ if (!memo || memo.variables !== record.variables || memo.scheme !== colorScheme) {
495
+ memo = { source, variables: record.variables, scheme: colorScheme };
496
+ if (classMemos.size >= 2000)
497
+ classMemos.clear();
498
+ classMemos.set(source, memo);
499
+ }
500
+ record.classMemo = memo;
501
+ }
502
+ if (forStyle)
503
+ return memo.style ??= compileClassStyles(classes, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules, appearance: colorScheme, pointer: options.pointer === !0 });
504
+ return memo.props ??= compileClassStyles(classes, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules });
505
+ }
415
506
  function resolveStyle(record, id) {
416
507
  resolvingId = id;
417
508
  const report = reportStyle;
418
509
  let inherited = record.inheritedVariables;
419
- for (const source of record.styleAncestors ?? [])
420
- inherited = parseNativeStyleLayers([source], inherited, report).variables;
510
+ const ancestors = record.styleAncestors;
511
+ if (ancestors)
512
+ for (let i = 0;i < ancestors.length; i++)
513
+ inherited = parseNativeStyleLayers([ancestors[i]], inherited, report).variables;
421
514
  const resolved = parseNativeStyleLayers([record.styleSource, record.boundStyle, record.forwardedStyle], inherited, report);
422
515
  record.variables = resolved.variables;
423
- const classes = compileClassStyles(`${record.classes} ${record.forwardedClasses ?? ""}`, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules, appearance: colorScheme, pointer: options.pointer === !0 }), classStyle = { ...classes.style };
516
+ const classes = classStylesOf(record, !0), plain = !classes.responsive?.length && !classes.states && !classes.disabled && !record.focusWithin && !record.focused && record.dividerStyle === void 0 && isBlank(record.layoutDefaults) && isBlank(record.baseStyle) && !isHiddenInput(record);
517
+ let kept;
518
+ const keptAs = `${colorScheme}${record.visible ? 1 : 0}`;
519
+ if (plain) {
520
+ let byFirst = resolvedStyles.get(classes);
521
+ if (!byFirst)
522
+ resolvedStyles.set(classes, byFirst = new WeakMap);
523
+ const first = layerKey(resolved.styles[0]);
524
+ let bySecond = byFirst.get(first);
525
+ if (!bySecond)
526
+ byFirst.set(first, bySecond = new WeakMap);
527
+ const second = layerKey(resolved.styles[1]);
528
+ let byThird = bySecond.get(second);
529
+ if (!byThird)
530
+ bySecond.set(second, byThird = new WeakMap);
531
+ const third = layerKey(resolved.styles[2]);
532
+ kept = byThird.get(third);
533
+ if (!kept)
534
+ byThird.set(third, kept = new Map);
535
+ const known = kept.get(keptAs);
536
+ if (known)
537
+ return { ...known };
538
+ }
539
+ const classStyle = { ...classes.style };
424
540
  for (const layer of classes.responsive ?? []) {
425
541
  widthBounds.min.add(layer.min);
426
542
  if (layer.max !== void 0)
@@ -452,13 +568,23 @@ export function createNativeHost(options) {
452
568
  }
453
569
  Object.assign(classStyle, focused);
454
570
  }
455
- const style = applyNativeLayoutDefaults({ ...record.layoutDefaults, ...classStyle, ...record.dividerStyle, ...resolved.styles[0], ...record.baseStyle, ...resolved.styles[1], ...resolved.styles[2] }), pointer = {};
456
- for (const [state, key] of [["hover", "hoverStyle"], ["active", "pressStyle"]]) {
457
- const layer = classes.pointer?.[state];
458
- if (layer)
459
- pointer[key] = { ...layer.style, ...colorScheme === "dark" ? layer.dark : {} };
460
- }
461
- return { ...style, ...pointer, ...record.visible && !isHiddenInput(record) ? {} : { display: "none" } };
571
+ const style = applyNativeLayoutDefaults({ ...record.layoutDefaults, ...classStyle, ...record.dividerStyle, ...resolved.styles[0], ...record.baseStyle, ...resolved.styles[1], ...resolved.styles[2] }), hover = classes.pointer?.hover, active = classes.pointer?.active;
572
+ if (hover)
573
+ style.hoverStyle = { ...hover.style, ...colorScheme === "dark" ? hover.dark : {} };
574
+ if (active)
575
+ style.pressStyle = { ...active.style, ...colorScheme === "dark" ? active.dark : {} };
576
+ if (!record.visible || isHiddenInput(record))
577
+ style.display = "none";
578
+ if (kept)
579
+ kept.set(keptAs, { ...style });
580
+ return style;
581
+ }
582
+ const resolvedStyles = new WeakMap, BLANK_LAYER = {};
583
+ function layerKey(style) {
584
+ return !style || isBlank(style) ? BLANK_LAYER : style;
585
+ }
586
+ function isBlank(value) {
587
+ return !value || Object.keys(value).length === 0;
462
588
  }
463
589
  function refreshFocusChain(node) {
464
590
  for (let current = node;current; current = current.__stxOwner) {
@@ -476,6 +602,10 @@ export function createNativeHost(options) {
476
602
  return;
477
603
  const record = recordOf(node), before = record.variables;
478
604
  record.inheritedVariables = inherited;
605
+ if (!record.materialized) {
606
+ record.styleDirty = !0;
607
+ return;
608
+ }
479
609
  applyClasses(node.__stxId, record, !0);
480
610
  const after = record.variables;
481
611
  if (!appearanceChanged && before !== void 0 && sameVariables(before, after))
@@ -494,7 +624,10 @@ export function createNativeHost(options) {
494
624
  return !0;
495
625
  }
496
626
  function forwardedHostRoot(node, name) {
497
- if (!isBindingNode(node) || !(node.getAttribute("data-stx-native-forward") ?? "").split(/\s+/).includes(name))
627
+ if (!isBindingNode(node))
628
+ return;
629
+ const forward = node.getAttribute("data-stx-native-forward");
630
+ if (!forward || !words(forward).includes(name))
498
631
  return;
499
632
  const find = (candidate) => {
500
633
  if (candidate !== node && isBindingNode(candidate) && candidate.hasAttribute("data-stx-native-host-owner"))
@@ -517,8 +650,11 @@ export function createNativeHost(options) {
517
650
  const bindings = node.getAttribute("data-stx-parent-bindings");
518
651
  if (!bindings)
519
652
  return !1;
520
- const flat = (text) => text.replace(/-/g, "").toLowerCase(), wanted = flat(name);
521
- return bindings.split(/\s+/).some((binding) => binding && flat(binding) === wanted);
653
+ const wanted = flatName(name), names = words(bindings);
654
+ for (let i = 0;i < names.length; i++)
655
+ if (flatName(names[i]) === wanted)
656
+ return !0;
657
+ return !1;
522
658
  }
523
659
  function applyForwardedStyle(node, name, value) {
524
660
  const record = recordOf(node);
@@ -547,15 +683,24 @@ export function createNativeHost(options) {
547
683
  notifyAttributes(node, name);
548
684
  }
549
685
  function applyClasses(id, record, onlyIfChanged = !1) {
550
- const style = resolveStyle(record, id), patch = {};
551
- for (const key in record.style)
552
- if (!(key in style))
553
- patch[key] = null;
554
- const changed = !onlyIfChanged || JSON.stringify(record.style) !== JSON.stringify(style);
686
+ if (!record.materialized) {
687
+ record.styleDirty = !0;
688
+ return;
689
+ }
690
+ resolveClasses(id, record, onlyIfChanged);
691
+ }
692
+ function resolveClasses(id, record, onlyIfChanged) {
693
+ const style = resolveStyle(record, id);
694
+ if (record.materialized) {
695
+ const patch = {};
696
+ for (const key in record.style)
697
+ if (!(key in style))
698
+ patch[key] = null;
699
+ if (!onlyIfChanged || JSON.stringify(record.style) !== JSON.stringify(style))
700
+ emit({ op: "updateNode", id, patch: { style: { ...patch, ...style } } });
701
+ }
555
702
  record.style = style;
556
- if (record.materialized && changed)
557
- emit({ op: "updateNode", id, patch: { style: { ...patch, ...style } } });
558
- const classes = compileClassStyles(`${record.classes} ${record.forwardedClasses ?? ""}`, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules }), divideChanged = JSON.stringify(classes.divide) !== JSON.stringify(record.divide);
703
+ const classes = classStylesOf(record, !1), divideChanged = classes.divide !== record.divide && JSON.stringify(classes.divide) !== JSON.stringify(record.divide);
559
704
  record.divide = classes.divide;
560
705
  if (divideChanged || record.divide)
561
706
  refreshDividersOf(record);
@@ -605,6 +750,9 @@ export function createNativeHost(options) {
605
750
  visit(node);
606
751
  return out;
607
752
  }
753
+ function componentEventOnly(node, event) {
754
+ return isBindingNode(node) && node.hasAttribute("data-stx-component-wrapper") && scriptOnlyEvent(event);
755
+ }
608
756
  function isBindingNode(node) {
609
757
  return node.nodeType === 1;
610
758
  }
@@ -753,6 +901,89 @@ export function createNativeHost(options) {
753
901
  installLinkListener(node);
754
902
  return node;
755
903
  }
904
+ function placesQuietly(parent, record, node) {
905
+ if (record.divide || record.hadDividers)
906
+ return !1;
907
+ if (node.__stxAnchor === void 0) {
908
+ const own = descriptorOf(node);
909
+ if (own && (own.materialized || own.focusWithin))
910
+ return !1;
911
+ }
912
+ for (let current = parent;current; current = current.__stxOwner)
913
+ if (childObservers.has(current))
914
+ return !1;
915
+ return !0;
916
+ }
917
+ function placeDetached(parent, record, node, index) {
918
+ record.children.splice(index, 0, node);
919
+ const isView = node.__stxAnchor === void 0;
920
+ if (isView && record.viewCount !== void 0)
921
+ record.viewCount++;
922
+ node.__stxOwner = parent;
923
+ if (isView) {
924
+ const own = recordOf(node);
925
+ own.inheritedVariables = record.variables;
926
+ own.styleDirty = !0;
927
+ }
928
+ insertIntoBindingParent(parent, node, index);
929
+ }
930
+ const plainProps = new Map;
931
+ function plainProp(prop, type) {
932
+ const key = `${type}\x01${prop}`;
933
+ let plain = plainProps.get(key);
934
+ if (plain === void 0) {
935
+ plain = !(type === "Image" && prop === "alt" || prop === "role" || prop.startsWith("aria-") || prop.startsWith("accessibility") || TEXT_ENTRY_SOURCES.has(prop) || prop === "multiline" || prop === "disabled" || NATIVE_STATE_VARIANTS.has(prop) || type === "Icon" && prop === "name" || prop === "href" || SVG_NODE_TYPES.has(type));
936
+ plainProps.set(key, plain);
937
+ }
938
+ return plain;
939
+ }
940
+ function copyNode(node, source, copy) {
941
+ if (!isBindingNode(node))
942
+ copy.__stxOwner = node.__stxOwner;
943
+ decoratePosition(copy);
944
+ if (node.__stxScope !== void 0)
945
+ copy.__stxScope = node.__stxScope;
946
+ const descriptor = source ?? {
947
+ type: "View",
948
+ props: {},
949
+ style: {},
950
+ baseStyle: {},
951
+ classes: "",
952
+ events: {},
953
+ children: [],
954
+ visible: !0,
955
+ materialized: !0
956
+ };
957
+ records.set(copy.__stxId, {
958
+ type: descriptor.type,
959
+ key: descriptor.key,
960
+ props: { ...descriptor.props, __stxId: copy.__stxId },
961
+ style: { ...descriptor.style },
962
+ baseStyle: { ...descriptor.baseStyle },
963
+ layoutDefaults: descriptor.layoutDefaults === void 0 ? void 0 : { ...descriptor.layoutDefaults },
964
+ styleSource: descriptor.styleSource,
965
+ styleAncestors: descriptor.styleAncestors,
966
+ inheritedVariables: descriptor.inheritedVariables,
967
+ variables: descriptor.variables,
968
+ boundStyle: descriptor.boundStyle,
969
+ classes: descriptor.classes,
970
+ forwardedClasses: descriptor.forwardedClasses,
971
+ forwardedStyle: descriptor.forwardedStyle,
972
+ events: { ...descriptor.events },
973
+ text: descriptor.text,
974
+ children: [],
975
+ visible: descriptor.visible,
976
+ materialized: !1,
977
+ controlDefaults: descriptor.controlDefaults,
978
+ divide: descriptor.divide,
979
+ styleDirty: !0
980
+ });
981
+ decorateControl(copy, descriptor.type);
982
+ if (!isBindingNode(copy) || copy.isConnected)
983
+ setConnected(copy, !1);
984
+ installLinkListener(copy, node);
985
+ return copy;
986
+ }
756
987
  const overlayPresenter = createNativeOverlayPresenter({
757
988
  canFocus: options.views?.capabilities.focus === !0,
758
989
  canPresentNonModal: options.views?.capabilities.nonModalPresentation === !0,
@@ -900,7 +1131,8 @@ export function createNativeHost(options) {
900
1131
  const forwarded = forwardedHostRoot(node, name);
901
1132
  reflectAttribute(node, name, value);
902
1133
  if (forwarded) {
903
- reflectAttribute(forwarded, name, value);
1134
+ if (forwarded !== node)
1135
+ reflectAttribute(forwarded, name, value);
904
1136
  if (applyForwardedStyle(forwarded, name, value))
905
1137
  return;
906
1138
  node = forwarded;
@@ -912,7 +1144,18 @@ export function createNativeHost(options) {
912
1144
  applyClasses(node.__stxId, record);
913
1145
  return;
914
1146
  }
915
- const record = recordOf(node), prop = nativePropName(name, record.type), accessibilityBefore = record.type === "Image" && prop === "alt" || prop === "role" || prop.startsWith("aria-") || prop.startsWith("accessibility") ? projectAccessibility(record.props, record.type) : void 0, textEntryBefore = TEXT_ENTRY_SOURCES.has(prop) ? projectTextEntry(record.type, record.props) : void 0, wasDisabled = disabled(record);
1147
+ const record = recordOf(node), prop = nativePropName(name, record.type);
1148
+ if (plainProp(prop, record.type)) {
1149
+ record.props[prop] = value;
1150
+ if (record.focused && disabled(record)) {
1151
+ record.focused = !1;
1152
+ refreshFocusChain(node);
1153
+ }
1154
+ if (record.materialized)
1155
+ emit({ op: "updateNode", id: node.__stxId, patch: { props: { [prop]: value } } });
1156
+ return;
1157
+ }
1158
+ const accessibilityBefore = record.type === "Image" && prop === "alt" || prop === "role" || prop.startsWith("aria-") || prop.startsWith("accessibility") ? projectAccessibility(record.props, record.type) : void 0, textEntryBefore = TEXT_ENTRY_SOURCES.has(prop) ? projectTextEntry(record.type, record.props) : void 0, wasDisabled = disabled(record);
916
1159
  record.props[prop] = value;
917
1160
  if (TEXT_ENTRY_SOURCES.has(prop) || prop === "multiline")
918
1161
  syncImplicitSubmit(node);
@@ -1066,15 +1309,23 @@ export function createNativeHost(options) {
1066
1309
  listen(node, event, handler, options) {
1067
1310
  if (disposed)
1068
1311
  return () => {};
1069
- const listenerOptions = options, listeners = componentListeners.get(node) ?? [], listener = { event, handler, once: !!listenerOptions?.once, capture: !!listenerOptions?.capture };
1312
+ const listenerOptions = options;
1313
+ let listeners = componentListeners.get(node);
1314
+ if (!listeners)
1315
+ componentListeners.set(node, listeners = []);
1316
+ const listener = { event, handler, once: !!listenerOptions?.once, capture: !!listenerOptions?.capture };
1070
1317
  listeners.push(listener);
1071
- componentListeners.set(node, listeners);
1072
1318
  const unsubscribe = () => {
1073
1319
  const index = listeners.indexOf(listener);
1074
1320
  if (index !== -1)
1075
1321
  listeners.splice(index, 1);
1076
- }, nativeEvent = NATIVE_EVENT_NAMES[event.toLowerCase()] ?? event, record = recordOf(node), registrations = eventRegistrations.get(node) ?? new Map;
1077
- eventRegistrations.set(node, registrations);
1322
+ };
1323
+ if (componentEventOnly(node, event))
1324
+ return unsubscribe;
1325
+ const nativeEvent = nativeEventName(event), record = recordOf(node);
1326
+ let registrations = eventRegistrations.get(node);
1327
+ if (!registrations)
1328
+ eventRegistrations.set(node, registrations = new Map);
1078
1329
  const existing = registrations.get(nativeEvent);
1079
1330
  if (existing && handlers.has(existing))
1080
1331
  return unsubscribe;
@@ -1117,7 +1368,7 @@ export function createNativeHost(options) {
1117
1368
  Object.defineProperty(physical, "currentTarget", { configurable: !0, value: target });
1118
1369
  const group = componentListeners.get(target) ?? [];
1119
1370
  for (const current of [...group]) {
1120
- if ((NATIVE_EVENT_NAMES[current.event.toLowerCase()] ?? current.event) !== nativeEvent || current.capture !== capture)
1371
+ if (nativeEventName(current.event) !== nativeEvent || current.capture !== capture)
1121
1372
  continue;
1122
1373
  if (target !== node && (current.event === "blur" || current.event === "focus"))
1123
1374
  continue;
@@ -1160,7 +1411,7 @@ export function createNativeHost(options) {
1160
1411
  }
1161
1412
  const form = formOwner(node);
1162
1413
  if (form && nativeEvent === "onSubmitEditing" && !physical?.defaultPrevented && !record.props.multiline && hostProps(record).returnKeyType !== "next") {
1163
- const implicit = implicitSubmitListeners.get(node), authored = componentListeners.get(node)?.some((listener) => (NATIVE_EVENT_NAMES[listener.event.toLowerCase()] ?? listener.event) === "onSubmitEditing" && listener.handler !== implicit?.listener);
1414
+ const implicit = implicitSubmitListeners.get(node), authored = componentListeners.get(node)?.some((listener) => nativeEventName(listener.event) === "onSubmitEditing" && listener.handler !== implicit?.listener);
1164
1415
  if (implicit && !authored) {
1165
1416
  const submitter = collectDescendants(form).find((control) => {
1166
1417
  const candidate = descriptorOf(control);
@@ -1184,7 +1435,7 @@ export function createNativeHost(options) {
1184
1435
  record.events[nativeEvent] = id;
1185
1436
  if (record.materialized)
1186
1437
  emit({ op: "updateNode", id: node.__stxId, patch: { events: { [nativeEvent]: id } } });
1187
- if (nativeEvent === "onPress") {
1438
+ if (nativeEvent === "onPress" && record.children.length) {
1188
1439
  for (const child of collectDescendants(node))
1189
1440
  if (["Button", "Pressable"].includes(descriptorOf(child)?.type ?? ""))
1190
1441
  installControlListeners(child);
@@ -1227,10 +1478,12 @@ export function createNativeHost(options) {
1227
1478
  record.baseStyle.display = record.shownDisplay;
1228
1479
  record.shownDisplay = void 0;
1229
1480
  }
1230
- record.style = resolveStyle(record, node.__stxId);
1231
- const display = visible ? irDisplay(record.style.display) : "none";
1232
- if (record.materialized)
1481
+ if (record.materialized) {
1482
+ record.style = resolveStyle(record, node.__stxId);
1483
+ const display = visible ? irDisplay(record.style.display) : "none";
1233
1484
  emit({ op: "updateNode", id: node.__stxId, patch: { style: { display } } });
1485
+ } else
1486
+ record.styleDirty = !0;
1234
1487
  if (was !== visible)
1235
1488
  refreshDividers(node.__stxOwner);
1236
1489
  return was;
@@ -1241,56 +1494,27 @@ export function createNativeHost(options) {
1241
1494
  return anchor;
1242
1495
  },
1243
1496
  clone(node) {
1244
- const source = descriptorOf(node), id = nextId("n"), copy = isBindingNode(node) ? cloneNativeBindingNode(node, id, void 0, HostElement) : plainNode(id);
1245
- if (!isBindingNode(node))
1246
- copy.__stxOwner = node.__stxOwner;
1247
- decoratePosition(copy);
1248
- if (node.__stxScope !== void 0)
1249
- copy.__stxScope = node.__stxScope;
1250
- const descriptor = source ?? {
1251
- type: "View",
1252
- props: {},
1253
- style: {},
1254
- baseStyle: {},
1255
- classes: "",
1256
- events: {},
1257
- children: [],
1258
- visible: !0,
1259
- materialized: !0
1260
- };
1261
- records.set(copy.__stxId, {
1262
- type: descriptor.type,
1263
- key: descriptor.key,
1264
- props: { ...descriptor.props, __stxId: copy.__stxId },
1265
- style: { ...descriptor.style },
1266
- baseStyle: { ...descriptor.baseStyle },
1267
- layoutDefaults: { ...descriptor.layoutDefaults },
1268
- styleSource: descriptor.styleSource,
1269
- styleAncestors: descriptor.styleAncestors,
1270
- inheritedVariables: descriptor.inheritedVariables,
1271
- variables: descriptor.variables,
1272
- boundStyle: descriptor.boundStyle,
1273
- classes: descriptor.classes,
1274
- forwardedClasses: descriptor.forwardedClasses,
1275
- forwardedStyle: descriptor.forwardedStyle,
1276
- events: { ...descriptor.events },
1277
- text: descriptor.text,
1278
- children: [],
1279
- visible: descriptor.visible,
1280
- materialized: !1,
1281
- controlDefaults: descriptor.controlDefaults
1282
- });
1283
- decorateControl(copy, descriptor.type);
1284
- setConnected(copy, !1);
1285
- installLinkListener(copy);
1286
- for (const child of descriptor.children) {
1497
+ const source = descriptorOf(node), copy = copyNode(node, source, isBindingNode(node) ? cloneNativeBindingNode(node, nextId("n"), void 0, HostElement) : plainNode(nextId("n")));
1498
+ for (const child of source?.children ?? []) {
1287
1499
  const childCopy = this.clone(child);
1288
1500
  this.insert(copy, childCopy);
1289
1501
  }
1290
1502
  return copy;
1291
1503
  },
1504
+ append(parent, node) {
1505
+ this.insert(parent, node);
1506
+ },
1507
+ cloneElement(node, attributes) {
1508
+ const source = descriptorOf(node);
1509
+ return copyNode(node, source, isBindingNode(node) ? cloneNativeBindingNodeWith(node, nextId("n"), attributes, HostElement) : plainNode(nextId("n")));
1510
+ },
1292
1511
  insert(parent, node, before) {
1293
- const record = recordOf(parent), oldOwner = node.__stxOwner, isView = node.__stxAnchor === void 0, existing = oldOwner === parent ? record.children.findIndex((child) => child.__stxId === node.__stxId) : -1;
1512
+ const record = recordOf(parent), oldOwner = node.__stxOwner;
1513
+ if (!oldOwner && !record.materialized && placesQuietly(parent, record, node)) {
1514
+ placeDetached(parent, record, node, before ? Math.max(0, lastIndexOfChild(record.children, before.__stxId)) : record.children.length);
1515
+ return;
1516
+ }
1517
+ const isView = node.__stxAnchor === void 0, existing = oldOwner === parent ? record.children.findIndex((child) => child.__stxId === node.__stxId) : -1;
1294
1518
  if (existing !== -1) {
1295
1519
  record.children.splice(existing, 1);
1296
1520
  if (isView && record.viewCount !== void 0)
@@ -1322,7 +1546,7 @@ export function createNativeHost(options) {
1322
1546
  notifyChildren(parent);
1323
1547
  if (node.__stxAnchor !== void 0 || !record.materialized)
1324
1548
  return;
1325
- materialize(node);
1549
+ materialize(node, record.variables);
1326
1550
  let nativeIndex = 0;
1327
1551
  if (index <= record.children.length >> 1) {
1328
1552
  for (let i = 0;i < index; i++)
@@ -2,7 +2,7 @@ var {require}=import.meta;import { existsSync, mkdirSync, copyFileSync, chmodSyn
2
2
  import { join, dirname, basename, resolve } from "node:path";
3
3
  import { spawn } from "node:child_process";
4
4
  import { platform as osPlatform } from "node:os";
5
- import { resolveCraftExecutablePath } from "@stacksjs/desktop";
5
+ import { createDiskImage, resolveCraftExecutablePath } from "@stacksjs/desktop";
6
6
  import { injectCraftBridge } from "./craft-bridge.js";
7
7
  import { processCraftComponents, CRAFT_COMPONENT_STYLES } from "./craft-components.js";
8
8
  import { renderTemplate } from "./render.js";
@@ -432,28 +432,7 @@ function getDefaultFormat(target) {
432
432
  }
433
433
  }
434
434
  async function createDMG(appBundlePath, outputPath, volumeName) {
435
- return new Promise((resolve) => {
436
- const proc = spawn("hdiutil", [
437
- "create",
438
- "-volname",
439
- volumeName,
440
- "-srcfolder",
441
- appBundlePath,
442
- "-ov",
443
- "-format",
444
- "UDZO",
445
- outputPath
446
- ]);
447
- proc.on("close", (code) => {
448
- if (code === 0)
449
- resolve({ success: !0 });
450
- else
451
- resolve({ success: !1, error: `hdiutil exited with code ${code}` });
452
- });
453
- proc.on("error", (err) => {
454
- resolve({ success: !1, error: err.message });
455
- });
456
- });
435
+ return createDiskImage({ appBundlePath, outputPath, volumeName });
457
436
  }
458
437
  async function createZip(sourceDir, outputPath) {
459
438
  return new Promise((resolve) => {