sigmx 0.1.0 → 0.2.0

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 (308) hide show
  1. package/README.md +54 -43
  2. package/dist/cli.js +3 -1
  3. package/dist/cli.js.map +2 -2
  4. package/dist/kernel/compile.d.ts +8 -9
  5. package/dist/kernel/compile.js +102 -67
  6. package/dist/kernel/compile.js.map +2 -2
  7. package/dist/kernel/contracts.d.ts +12 -13
  8. package/dist/kernel/index.d.ts +11 -12
  9. package/dist/kernel/index.js +14 -12
  10. package/dist/kernel/index.js.map +3 -3
  11. package/dist/kernel/precompile.d.ts +8 -12
  12. package/dist/kernel/precompile.js +33 -76
  13. package/dist/kernel/precompile.js.map +2 -2
  14. package/dist/kernel/precompiled.d.ts +7 -4
  15. package/dist/kernel/precompiled.js +5 -5
  16. package/dist/kernel/precompiled.js.map +2 -2
  17. package/dist/kernel/reactive.d.ts +13 -11
  18. package/dist/kernel/reactive.js +96 -71
  19. package/dist/kernel/reactive.js.map +3 -3
  20. package/dist/kernel/runtime.js +85 -63
  21. package/dist/kernel/runtime.js.map +3 -3
  22. package/dist/kernel/scan.d.ts +2 -11
  23. package/dist/kernel/scan.js +26 -9
  24. package/dist/kernel/scan.js.map +2 -2
  25. package/dist/kernel/state.d.ts +5 -8
  26. package/dist/kernel/state.js +114 -76
  27. package/dist/kernel/state.js.map +2 -2
  28. package/dist/kernel/strict-csp.d.ts +0 -5
  29. package/dist/kernel/strict-csp.js +2 -2
  30. package/dist/kernel/strict-csp.js.map +2 -2
  31. package/dist/lib/casing.d.ts +4 -1
  32. package/dist/lib/casing.js +8 -1
  33. package/dist/lib/casing.js.map +2 -2
  34. package/dist/lib/objects.d.ts +5 -4
  35. package/dist/lib/objects.js +13 -5
  36. package/dist/lib/objects.js.map +2 -2
  37. package/dist/lib/schedule.d.ts +3 -5
  38. package/dist/lib/schedule.js +12 -10
  39. package/dist/lib/schedule.js.map +2 -2
  40. package/dist/lib/sse.d.ts +10 -1
  41. package/dist/lib/sse.js +32 -28
  42. package/dist/lib/sse.js.map +2 -2
  43. package/dist/plugins/def.d.ts +5 -0
  44. package/dist/plugins/def.js +22 -0
  45. package/dist/plugins/def.js.map +7 -0
  46. package/dist/plugins/directives/attribute-sync.js +8 -12
  47. package/dist/plugins/directives/attribute-sync.js.map +2 -2
  48. package/dist/plugins/directives/boost.d.ts +1 -1
  49. package/dist/plugins/directives/boost.js +34 -30
  50. package/dist/plugins/directives/boost.js.map +2 -2
  51. package/dist/plugins/directives/busy-flag.js +13 -16
  52. package/dist/plugins/directives/busy-flag.js.map +2 -2
  53. package/dist/plugins/directives/class-toggle.js +17 -16
  54. package/dist/plugins/directives/class-toggle.js.map +2 -2
  55. package/dist/plugins/directives/cloak.js +2 -7
  56. package/dist/plugins/directives/cloak.js.map +2 -2
  57. package/dist/plugins/directives/collapse.js +36 -37
  58. package/dist/plugins/directives/collapse.js.map +2 -2
  59. package/dist/plugins/directives/declare.js +5 -8
  60. package/dist/plugins/directives/declare.js.map +2 -2
  61. package/dist/plugins/directives/derive.js +9 -15
  62. package/dist/plugins/directives/derive.js.map +2 -2
  63. package/dist/plugins/directives/element-ref.js +8 -8
  64. package/dist/plugins/directives/element-ref.js.map +2 -2
  65. package/dist/plugins/directives/event-listener.js +18 -23
  66. package/dist/plugins/directives/event-listener.js.map +2 -2
  67. package/dist/plugins/directives/frame-loop.js +9 -14
  68. package/dist/plugins/directives/frame-loop.js.map +2 -2
  69. package/dist/plugins/directives/html.js +6 -7
  70. package/dist/plugins/directives/html.js.map +2 -2
  71. package/dist/plugins/directives/inline-style.js +17 -20
  72. package/dist/plugins/directives/inline-style.js.map +2 -2
  73. package/dist/plugins/directives/mask.js +19 -23
  74. package/dist/plugins/directives/mask.js.map +2 -2
  75. package/dist/plugins/directives/media-query.d.ts +4 -1
  76. package/dist/plugins/directives/media-query.js +13 -12
  77. package/dist/plugins/directives/media-query.js.map +2 -2
  78. package/dist/plugins/directives/on-mount.js +4 -9
  79. package/dist/plugins/directives/on-mount.js.map +2 -2
  80. package/dist/plugins/directives/patch-listener.js +24 -19
  81. package/dist/plugins/directives/patch-listener.js.map +2 -2
  82. package/dist/plugins/directives/remove-me.js +7 -8
  83. package/dist/plugins/directives/remove-me.js.map +2 -2
  84. package/dist/plugins/directives/scroll-to.d.ts +4 -1
  85. package/dist/plugins/directives/scroll-to.js +8 -14
  86. package/dist/plugins/directives/scroll-to.js.map +2 -2
  87. package/dist/plugins/directives/size-watch.js +7 -12
  88. package/dist/plugins/directives/size-watch.js.map +2 -2
  89. package/dist/plugins/directives/state-dump.js +6 -10
  90. package/dist/plugins/directives/state-dump.js.map +2 -2
  91. package/dist/plugins/directives/storage-sync.js +13 -9
  92. package/dist/plugins/directives/storage-sync.js.map +2 -2
  93. package/dist/plugins/directives/teleport.js +8 -14
  94. package/dist/plugins/directives/teleport.js.map +2 -2
  95. package/dist/plugins/directives/text-content.js +6 -7
  96. package/dist/plugins/directives/text-content.js.map +2 -2
  97. package/dist/plugins/directives/timer.js +7 -13
  98. package/dist/plugins/directives/timer.js.map +2 -2
  99. package/dist/plugins/directives/transition.d.ts +1 -2
  100. package/dist/plugins/directives/transition.js +32 -34
  101. package/dist/plugins/directives/transition.js.map +2 -2
  102. package/dist/plugins/directives/tween.d.ts +2 -2
  103. package/dist/plugins/directives/tween.js +34 -50
  104. package/dist/plugins/directives/tween.js.map +2 -2
  105. package/dist/plugins/directives/two-way-bind.d.ts +1 -1
  106. package/dist/plugins/directives/two-way-bind.js +70 -67
  107. package/dist/plugins/directives/two-way-bind.js.map +2 -2
  108. package/dist/plugins/directives/url-params.js +36 -59
  109. package/dist/plugins/directives/url-params.js.map +3 -3
  110. package/dist/plugins/directives/url-replace.js +6 -7
  111. package/dist/plugins/directives/url-replace.js.map +2 -2
  112. package/dist/plugins/directives/validity.js +6 -9
  113. package/dist/plugins/directives/validity.js.map +2 -2
  114. package/dist/plugins/directives/viewport.js +18 -23
  115. package/dist/plugins/directives/viewport.js.map +2 -2
  116. package/dist/plugins/directives/visibility.js +9 -14
  117. package/dist/plugins/directives/visibility.js.map +2 -2
  118. package/dist/plugins/directives/watch.d.ts +0 -1
  119. package/dist/plugins/directives/watch.js +2 -8
  120. package/dist/plugins/directives/watch.js.map +2 -2
  121. package/dist/plugins/functions/bulk-set.js +10 -7
  122. package/dist/plugins/functions/bulk-set.js.map +2 -2
  123. package/dist/plugins/functions/bulk-toggle.js +10 -7
  124. package/dist/plugins/functions/bulk-toggle.js.map +2 -2
  125. package/dist/plugins/functions/confirm.js +2 -2
  126. package/dist/plugins/functions/confirm.js.map +2 -2
  127. package/dist/plugins/functions/copy-text.js +5 -5
  128. package/dist/plugins/functions/copy-text.js.map +2 -2
  129. package/dist/plugins/functions/dispatch.js +5 -5
  130. package/dist/plugins/functions/dispatch.js.map +2 -2
  131. package/dist/plugins/functions/locale-format.d.ts +4 -1
  132. package/dist/plugins/functions/locale-format.js +9 -16
  133. package/dist/plugins/functions/locale-format.js.map +2 -2
  134. package/dist/plugins/functions/range-map.js +6 -6
  135. package/dist/plugins/functions/range-map.js.map +2 -2
  136. package/dist/plugins/functions/request.d.ts +7 -3
  137. package/dist/plugins/functions/request.js +85 -80
  138. package/dist/plugins/functions/request.js.map +2 -2
  139. package/dist/plugins/functions/untracked-read.js +3 -2
  140. package/dist/plugins/functions/untracked-read.js.map +2 -2
  141. package/dist/plugins/functions/websocket.d.ts +3 -3
  142. package/dist/plugins/functions/websocket.js +18 -25
  143. package/dist/plugins/functions/websocket.js.map +2 -2
  144. package/dist/plugins/index.d.ts +34 -36
  145. package/dist/plugins/index.js +31 -35
  146. package/dist/plugins/index.js.map +2 -2
  147. package/dist/plugins/server-events/apply-elements.d.ts +1 -1
  148. package/dist/plugins/server-events/apply-elements.js +41 -40
  149. package/dist/plugins/server-events/apply-elements.js.map +2 -2
  150. package/dist/plugins/server-events/apply-state.js +9 -12
  151. package/dist/plugins/server-events/apply-state.js.map +2 -2
  152. package/dist/plugins/server-events/morph.d.ts +0 -2
  153. package/dist/plugins/server-events/morph.js +58 -55
  154. package/dist/plugins/server-events/morph.js.map +3 -3
  155. package/dist/presets/all.d.ts +0 -1
  156. package/dist/presets/all.js +22 -26
  157. package/dist/presets/all.js.map +2 -2
  158. package/dist/presets/essentials.d.ts +0 -1
  159. package/dist/presets/essentials.js +27 -9
  160. package/dist/presets/essentials.js.map +2 -2
  161. package/dist/presets/minimal.d.ts +0 -1
  162. package/dist/presets/minimal.js +2 -2
  163. package/dist/presets/minimal.js.map +2 -2
  164. package/dist/server.d.ts +108 -0
  165. package/dist/server.js +218 -0
  166. package/dist/server.js.map +7 -0
  167. package/dist/sigmx.standalone.js +1 -1
  168. package/dist/standalone.js.map +2 -2
  169. package/dist/vite.d.ts +2 -2
  170. package/dist/vite.js +48 -15
  171. package/dist/vite.js.map +2 -2
  172. package/package.json +21 -2
  173. package/dist/auto.d.ts +0 -1
  174. package/dist/auto.js +0 -7
  175. package/dist/auto.js.map +0 -7
  176. package/dist/core/csp.d.ts +0 -7
  177. package/dist/core/csp.js +0 -20
  178. package/dist/core/csp.js.map +0 -7
  179. package/dist/core/engine.d.ts +0 -10
  180. package/dist/core/engine.js +0 -200
  181. package/dist/core/engine.js.map +0 -7
  182. package/dist/core/expr.d.ts +0 -12
  183. package/dist/core/expr.js +0 -94
  184. package/dist/core/expr.js.map +0 -7
  185. package/dist/core/index.d.ts +0 -16
  186. package/dist/core/index.js +0 -46
  187. package/dist/core/index.js.map +0 -7
  188. package/dist/core/signals.d.ts +0 -42
  189. package/dist/core/signals.js +0 -195
  190. package/dist/core/signals.js.map +0 -7
  191. package/dist/core/store.d.ts +0 -32
  192. package/dist/core/store.js +0 -185
  193. package/dist/core/store.js.map +0 -7
  194. package/dist/core/types.d.ts +0 -101
  195. package/dist/core/types.js +0 -1
  196. package/dist/core/types.js.map +0 -7
  197. package/dist/plugins/actions/clipboard.d.ts +0 -2
  198. package/dist/plugins/actions/clipboard.js +0 -11
  199. package/dist/plugins/actions/clipboard.js.map +0 -7
  200. package/dist/plugins/actions/fit.d.ts +0 -2
  201. package/dist/plugins/actions/fit.js +0 -14
  202. package/dist/plugins/actions/fit.js.map +0 -7
  203. package/dist/plugins/actions/intl.d.ts +0 -2
  204. package/dist/plugins/actions/intl.js +0 -21
  205. package/dist/plugins/actions/intl.js.map +0 -7
  206. package/dist/plugins/actions/peek.d.ts +0 -2
  207. package/dist/plugins/actions/peek.js +0 -6
  208. package/dist/plugins/actions/peek.js.map +0 -7
  209. package/dist/plugins/actions/setAll.d.ts +0 -2
  210. package/dist/plugins/actions/setAll.js +0 -11
  211. package/dist/plugins/actions/setAll.js.map +0 -7
  212. package/dist/plugins/actions/toggleAll.d.ts +0 -2
  213. package/dist/plugins/actions/toggleAll.js +0 -11
  214. package/dist/plugins/actions/toggleAll.js.map +0 -7
  215. package/dist/plugins/attributes/attr.d.ts +0 -2
  216. package/dist/plugins/attributes/attr.js +0 -20
  217. package/dist/plugins/attributes/attr.js.map +0 -7
  218. package/dist/plugins/attributes/bind.d.ts +0 -6
  219. package/dist/plugins/attributes/bind.js +0 -81
  220. package/dist/plugins/attributes/bind.js.map +0 -7
  221. package/dist/plugins/attributes/class.d.ts +0 -2
  222. package/dist/plugins/attributes/class.js +0 -22
  223. package/dist/plugins/attributes/class.js.map +0 -7
  224. package/dist/plugins/attributes/computed.d.ts +0 -2
  225. package/dist/plugins/attributes/computed.js +0 -20
  226. package/dist/plugins/attributes/computed.js.map +0 -7
  227. package/dist/plugins/attributes/customValidity.d.ts +0 -2
  228. package/dist/plugins/attributes/customValidity.js +0 -14
  229. package/dist/plugins/attributes/customValidity.js.map +0 -7
  230. package/dist/plugins/attributes/effect.d.ts +0 -2
  231. package/dist/plugins/attributes/effect.js +0 -12
  232. package/dist/plugins/attributes/effect.js.map +0 -7
  233. package/dist/plugins/attributes/indicator.d.ts +0 -2
  234. package/dist/plugins/attributes/indicator.js +0 -20
  235. package/dist/plugins/attributes/indicator.js.map +0 -7
  236. package/dist/plugins/attributes/init.d.ts +0 -2
  237. package/dist/plugins/attributes/init.js +0 -14
  238. package/dist/plugins/attributes/init.js.map +0 -7
  239. package/dist/plugins/attributes/jsonSignals.d.ts +0 -2
  240. package/dist/plugins/attributes/jsonSignals.js +0 -15
  241. package/dist/plugins/attributes/jsonSignals.js.map +0 -7
  242. package/dist/plugins/attributes/matchMedia.d.ts +0 -2
  243. package/dist/plugins/attributes/matchMedia.js +0 -19
  244. package/dist/plugins/attributes/matchMedia.js.map +0 -7
  245. package/dist/plugins/attributes/on.d.ts +0 -5
  246. package/dist/plugins/attributes/on.js +0 -28
  247. package/dist/plugins/attributes/on.js.map +0 -7
  248. package/dist/plugins/attributes/onIntersect.d.ts +0 -2
  249. package/dist/plugins/attributes/onIntersect.js +0 -28
  250. package/dist/plugins/attributes/onIntersect.js.map +0 -7
  251. package/dist/plugins/attributes/onInterval.d.ts +0 -2
  252. package/dist/plugins/attributes/onInterval.js +0 -18
  253. package/dist/plugins/attributes/onInterval.js.map +0 -7
  254. package/dist/plugins/attributes/onRaf.d.ts +0 -1
  255. package/dist/plugins/attributes/onRaf.js +0 -19
  256. package/dist/plugins/attributes/onRaf.js.map +0 -7
  257. package/dist/plugins/attributes/onResize.d.ts +0 -1
  258. package/dist/plugins/attributes/onResize.js +0 -17
  259. package/dist/plugins/attributes/onResize.js.map +0 -7
  260. package/dist/plugins/attributes/onSignalPatch.d.ts +0 -5
  261. package/dist/plugins/attributes/onSignalPatch.js +0 -35
  262. package/dist/plugins/attributes/onSignalPatch.js.map +0 -7
  263. package/dist/plugins/attributes/persist.d.ts +0 -6
  264. package/dist/plugins/attributes/persist.js +0 -16
  265. package/dist/plugins/attributes/persist.js.map +0 -7
  266. package/dist/plugins/attributes/queryString.d.ts +0 -5
  267. package/dist/plugins/attributes/queryString.js +0 -54
  268. package/dist/plugins/attributes/queryString.js.map +0 -7
  269. package/dist/plugins/attributes/ref.d.ts +0 -2
  270. package/dist/plugins/attributes/ref.js +0 -13
  271. package/dist/plugins/attributes/ref.js.map +0 -7
  272. package/dist/plugins/attributes/replaceUrl.d.ts +0 -1
  273. package/dist/plugins/attributes/replaceUrl.js +0 -11
  274. package/dist/plugins/attributes/replaceUrl.js.map +0 -7
  275. package/dist/plugins/attributes/scrollIntoView.d.ts +0 -2
  276. package/dist/plugins/attributes/scrollIntoView.js +0 -19
  277. package/dist/plugins/attributes/scrollIntoView.js.map +0 -7
  278. package/dist/plugins/attributes/show.d.ts +0 -2
  279. package/dist/plugins/attributes/show.js +0 -19
  280. package/dist/plugins/attributes/show.js.map +0 -7
  281. package/dist/plugins/attributes/signals.d.ts +0 -2
  282. package/dist/plugins/attributes/signals.js +0 -13
  283. package/dist/plugins/attributes/signals.js.map +0 -7
  284. package/dist/plugins/attributes/style.d.ts +0 -2
  285. package/dist/plugins/attributes/style.js +0 -25
  286. package/dist/plugins/attributes/style.js.map +0 -7
  287. package/dist/plugins/attributes/text.d.ts +0 -1
  288. package/dist/plugins/attributes/text.js +0 -13
  289. package/dist/plugins/attributes/text.js.map +0 -7
  290. package/dist/plugins/attributes/viewTransition.d.ts +0 -1
  291. package/dist/plugins/attributes/viewTransition.js +0 -11
  292. package/dist/plugins/attributes/viewTransition.js.map +0 -7
  293. package/dist/plugins/directives/transition-name.d.ts +0 -1
  294. package/dist/plugins/directives/transition-name.js +0 -11
  295. package/dist/plugins/directives/transition-name.js.map +0 -7
  296. package/dist/plugins/directives/trap.d.ts +0 -5
  297. package/dist/plugins/directives/trap.js +0 -48
  298. package/dist/plugins/directives/trap.js.map +0 -7
  299. package/dist/sigmx.auto.js +0 -5
  300. package/dist/utils/object.d.ts +0 -9
  301. package/dist/utils/object.js +0 -26
  302. package/dist/utils/object.js.map +0 -7
  303. package/dist/utils/text.d.ts +0 -7
  304. package/dist/utils/text.js +0 -15
  305. package/dist/utils/text.js.map +0 -7
  306. package/dist/utils/timing.d.ts +0 -14
  307. package/dist/utils/timing.js +0 -58
  308. package/dist/utils/timing.js.map +0 -7
@@ -1,52 +1,50 @@
1
1
  import { attr } from "./directives/attribute-sync.js";
2
- import { bind } from "./directives/two-way-bind.js";
2
+ import { boost } from "./directives/boost.js";
3
+ import { indicator } from "./directives/busy-flag.js";
3
4
  import { className } from "./directives/class-toggle.js";
5
+ import { cloak } from "./directives/cloak.js";
6
+ import { collapse } from "./directives/collapse.js";
7
+ import { signals } from "./directives/declare.js";
4
8
  import { computed } from "./directives/derive.js";
5
- import { customValidity } from "./directives/validity.js";
6
- import { effect } from "./directives/watch.js";
7
- import { indicator } from "./directives/busy-flag.js";
8
- import { init } from "./directives/on-mount.js";
9
- import { jsonSignals } from "./directives/state-dump.js";
10
- import { matchMedia } from "./directives/media-query.js";
9
+ import { ref } from "./directives/element-ref.js";
11
10
  import { on } from "./directives/event-listener.js";
12
- import { onIntersect } from "./directives/viewport.js";
13
- import { onInterval } from "./directives/timer.js";
14
11
  import { onRaf } from "./directives/frame-loop.js";
15
- import { onResize } from "./directives/size-watch.js";
12
+ import { html } from "./directives/html.js";
13
+ import { style } from "./directives/inline-style.js";
14
+ import { applyMask, mask } from "./directives/mask.js";
15
+ import { matchMedia } from "./directives/media-query.js";
16
+ import { init } from "./directives/on-mount.js";
16
17
  import { onSignalPatch } from "./directives/patch-listener.js";
18
+ import { removeMe } from "./directives/remove-me.js";
19
+ import { scrollIntoView } from "./directives/scroll-to.js";
20
+ import { onResize } from "./directives/size-watch.js";
21
+ import { jsonSignals } from "./directives/state-dump.js";
17
22
  import { persist } from "./directives/storage-sync.js";
23
+ import { teleport } from "./directives/teleport.js";
24
+ import { text } from "./directives/text-content.js";
25
+ import { onInterval } from "./directives/timer.js";
26
+ import { transition } from "./directives/transition.js";
27
+ import { animate } from "./directives/tween.js";
28
+ import { bind } from "./directives/two-way-bind.js";
18
29
  import { queryString } from "./directives/url-params.js";
19
- import { ref } from "./directives/element-ref.js";
20
30
  import { replaceUrl } from "./directives/url-replace.js";
21
- import { scrollIntoView } from "./directives/scroll-to.js";
31
+ import { customValidity } from "./directives/validity.js";
32
+ import { onIntersect } from "./directives/viewport.js";
22
33
  import { show } from "./directives/visibility.js";
23
- import { signals } from "./directives/declare.js";
24
- import { style } from "./directives/inline-style.js";
25
- import { text } from "./directives/text-content.js";
26
- import { viewTransition } from "./directives/transition-name.js";
27
- import { clipboard } from "./functions/copy-text.js";
28
- import { fit } from "./functions/range-map.js";
29
- import { intl } from "./functions/locale-format.js";
30
- import { peek } from "./functions/untracked-read.js";
34
+ import { effect } from "./directives/watch.js";
31
35
  import { setAll } from "./functions/bulk-set.js";
32
36
  import { toggleAll } from "./functions/bulk-toggle.js";
33
- import { animate } from "./directives/tween.js";
37
+ import { confirm } from "./functions/confirm.js";
38
+ import { clipboard } from "./functions/copy-text.js";
39
+ import { dispatch } from "./functions/dispatch.js";
40
+ import { intl } from "./functions/locale-format.js";
41
+ import { fit } from "./functions/range-map.js";
34
42
  import { httpDelete, httpGet, httpPatch, httpPost, httpPut } from "./functions/request.js";
43
+ import { peek } from "./functions/untracked-read.js";
44
+ import { websocket } from "./functions/websocket.js";
35
45
  import { applyElements } from "./server-events/apply-elements.js";
36
46
  import { applyState } from "./server-events/apply-state.js";
37
47
  import { activateScripts, morph, morphInner } from "./server-events/morph.js";
38
- import { boost } from "./directives/boost.js";
39
- import { cloak } from "./directives/cloak.js";
40
- import { collapse } from "./directives/collapse.js";
41
- import { html } from "./directives/html.js";
42
- import { applyMask, mask } from "./directives/mask.js";
43
- import { removeMe } from "./directives/remove-me.js";
44
- import { teleport } from "./directives/teleport.js";
45
- import { transition } from "./directives/transition.js";
46
- import { trap } from "./directives/trap.js";
47
- import { confirm } from "./functions/confirm.js";
48
- import { dispatch } from "./functions/dispatch.js";
49
- import { websocket } from "./functions/websocket.js";
50
48
  export {
51
49
  activateScripts,
52
50
  animate,
@@ -101,8 +99,6 @@ export {
101
99
  text,
102
100
  toggleAll,
103
101
  transition,
104
- trap,
105
- viewTransition,
106
102
  websocket
107
103
  };
108
104
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/plugins/index.ts"],
4
- "sourcesContent": ["// Pure re-exports: nothing registers on import, so bundlers keep only what you use.\nexport { attr } from './directives/attribute-sync.js'\nexport { bind } from './directives/two-way-bind.js'\nexport { className } from './directives/class-toggle.js'\nexport { computed } from './directives/derive.js'\nexport { customValidity } from './directives/validity.js'\nexport { effect } from './directives/watch.js'\nexport { indicator } from './directives/busy-flag.js'\nexport { init } from './directives/on-mount.js'\nexport { jsonSignals } from './directives/state-dump.js'\nexport { matchMedia } from './directives/media-query.js'\nexport { on } from './directives/event-listener.js'\nexport { onIntersect } from './directives/viewport.js'\nexport { onInterval } from './directives/timer.js'\nexport { onRaf } from './directives/frame-loop.js'\nexport { onResize } from './directives/size-watch.js'\nexport { onSignalPatch } from './directives/patch-listener.js'\nexport { persist } from './directives/storage-sync.js'\nexport { queryString } from './directives/url-params.js'\nexport { ref } from './directives/element-ref.js'\nexport { replaceUrl } from './directives/url-replace.js'\nexport { scrollIntoView } from './directives/scroll-to.js'\nexport { show } from './directives/visibility.js'\nexport { signals } from './directives/declare.js'\nexport { style } from './directives/inline-style.js'\nexport { text } from './directives/text-content.js'\nexport { viewTransition } from './directives/transition-name.js'\nexport { clipboard } from './functions/copy-text.js'\nexport { fit } from './functions/range-map.js'\nexport { intl } from './functions/locale-format.js'\nexport { peek } from './functions/untracked-read.js'\nexport { setAll } from './functions/bulk-set.js'\nexport { toggleAll } from './functions/bulk-toggle.js'\nexport { animate } from './directives/tween.js'\nexport { httpDelete, httpGet, httpPatch, httpPost, httpPut } from './functions/request.js'\nexport type { RequestOptions } from './functions/request.js'\nexport { applyElements } from './server-events/apply-elements.js'\nexport { applyState } from './server-events/apply-state.js'\nexport { activateScripts, morph, morphInner } from './server-events/morph.js'\nexport type { MorphOptions } from './server-events/morph.js'\n// ecosystem plugins (Alpine, htmx equivalents)\nexport { boost } from './directives/boost.js'\nexport { cloak } from './directives/cloak.js'\nexport { collapse } from './directives/collapse.js'\nexport { html } from './directives/html.js'\nexport { applyMask, mask } from './directives/mask.js'\nexport { removeMe } from './directives/remove-me.js'\nexport { teleport } from './directives/teleport.js'\nexport { transition } from './directives/transition.js'\nexport { trap } from './directives/trap.js'\nexport { confirm } from './functions/confirm.js'\nexport { dispatch } from './functions/dispatch.js'\nexport { websocket } from './functions/websocket.js'\nexport type { Socket } from './functions/websocket.js'\n"],
5
- "mappings": "AACA,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AACrB,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,WAAW;AACpB,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,YAAY;AACrB,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,WAAW;AACpB,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,YAAY,SAAS,WAAW,UAAU,eAAe;AAElE,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB,OAAO,kBAAkB;AAGnD,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,WAAW,YAAY;AAChC,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;",
4
+ "sourcesContent": ["export { attr } from './directives/attribute-sync.js';\nexport { boost } from './directives/boost.js';\nexport { indicator } from './directives/busy-flag.js';\nexport { className } from './directives/class-toggle.js';\nexport { cloak } from './directives/cloak.js';\nexport { collapse } from './directives/collapse.js';\nexport { signals } from './directives/declare.js';\nexport { computed } from './directives/derive.js';\nexport { ref } from './directives/element-ref.js';\nexport { on } from './directives/event-listener.js';\nexport { onRaf } from './directives/frame-loop.js';\nexport { html } from './directives/html.js';\nexport { style } from './directives/inline-style.js';\nexport { applyMask, mask } from './directives/mask.js';\nexport { matchMedia } from './directives/media-query.js';\nexport { init } from './directives/on-mount.js';\nexport { onSignalPatch } from './directives/patch-listener.js';\nexport { removeMe } from './directives/remove-me.js';\nexport { scrollIntoView } from './directives/scroll-to.js';\nexport { onResize } from './directives/size-watch.js';\nexport { jsonSignals } from './directives/state-dump.js';\nexport { persist } from './directives/storage-sync.js';\nexport { teleport } from './directives/teleport.js';\nexport { text } from './directives/text-content.js';\nexport { onInterval } from './directives/timer.js';\nexport { transition } from './directives/transition.js';\nexport { animate } from './directives/tween.js';\nexport { bind } from './directives/two-way-bind.js';\nexport { queryString } from './directives/url-params.js';\nexport { replaceUrl } from './directives/url-replace.js';\nexport { customValidity } from './directives/validity.js';\nexport { onIntersect } from './directives/viewport.js';\nexport { show } from './directives/visibility.js';\nexport { effect } from './directives/watch.js';\nexport { setAll } from './functions/bulk-set.js';\nexport { toggleAll } from './functions/bulk-toggle.js';\nexport { confirm } from './functions/confirm.js';\nexport { clipboard } from './functions/copy-text.js';\nexport { dispatch } from './functions/dispatch.js';\nexport { intl } from './functions/locale-format.js';\nexport { fit } from './functions/range-map.js';\nexport type { RequestOptions } from './functions/request.js';\nexport { httpDelete, httpGet, httpPatch, httpPost, httpPut } from './functions/request.js';\nexport { peek } from './functions/untracked-read.js';\nexport type { Socket } from './functions/websocket.js';\nexport { websocket } from './functions/websocket.js';\nexport { applyElements } from './server-events/apply-elements.js';\nexport { applyState } from './server-events/apply-state.js';\nexport type { MorphOptions } from './server-events/morph.js';\nexport { activateScripts, morph, morphInner } from './server-events/morph.js';\n"],
5
+ "mappings": "AAAA,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,WAAW;AACpB,SAAS,UAAU;AACnB,SAAS,aAAa;AACtB,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,WAAW,YAAY;AAChC,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,WAAW;AAEpB,SAAS,YAAY,SAAS,WAAW,UAAU,eAAe;AAClE,SAAS,YAAY;AAErB,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAE3B,SAAS,iBAAiB,OAAO,kBAAkB;",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- /** Server event `patch-elements`: `elements <html>`, `selector`, `mode`, `useViewTransition true`. */
1
+ /** Server event `patch-elements`: `elements <html>`, `selector`, `mode`. */
2
2
  export declare const applyElements: import("../../kernel/contracts.js").HandlerPlugin;
@@ -1,59 +1,60 @@
1
- import { handler } from "../../kernel/index.js";
1
+ import { srv } from "../def.js";
2
2
  import { activateScripts, morph, morphInner } from "./morph.js";
3
- const MODES = ["outer", "inner", "replace", "prepend", "append", "before", "after", "remove"];
3
+ const mergeHead = (head, next) => {
4
+ const wanted = [...next.children];
5
+ for (const old of [...head.children]) {
6
+ const i = wanted.findIndex((n) => n.isEqualNode(old));
7
+ if (i < 0) old.remove();
8
+ else wanted.splice(i, 1);
9
+ }
10
+ for (const n of wanted) {
11
+ const copy = document.importNode(n, true);
12
+ head.append(copy);
13
+ activateScripts(copy);
14
+ }
15
+ };
4
16
  const parse = (html) => {
5
- if (/<\/(html|head|body)>/i.test(html)) return new DOMParser().parseFromString(html, "text/html");
17
+ if (/^\s*<(!doctype|html)[\s>]|<\/(html|head|body)>/i.test(html))
18
+ return new DOMParser().parseFromString(html, "text/html");
6
19
  const t = document.createElement("template");
7
20
  t.innerHTML = html;
8
21
  return t.content;
9
22
  };
10
- const apply = (runtime, html, selector, mode) => {
23
+ const applyElements = srv("patch-elements", (runtime, { elements = "", selector = "", mode = "outer" }) => {
11
24
  const o = { ignoreAttr: runtime.attr("ignore-morph"), preserveAttr: runtime.attr("preserve-attr") };
12
- const parsed = parse(html);
25
+ const parsed = parse(elements);
13
26
  if (parsed instanceof Document) {
14
- if (parsed.head.childNodes.length) morphInner(document.head, parsed.head, o);
27
+ for (const { name, value } of parsed.documentElement.attributes) document.documentElement.setAttribute(name, value);
28
+ if (parsed.head.childNodes.length) mergeHead(document.head, parsed.head);
15
29
  morph(document.body, parsed.body, o);
16
30
  return;
17
31
  }
18
- const frag = parsed;
19
- if (mode === "remove") {
20
- for (const t of document.querySelectorAll(selector)) t.remove();
21
- return;
22
- }
23
- if (!selector) {
24
- if (mode !== "outer" && mode !== "replace") throw new Error(`patch-elements mode "${mode}" needs a selector`);
25
- for (const child of [...frag.children]) {
26
- const target = child.id && document.getElementById(child.id);
27
- if (!target) {
28
- console.warn("patch-elements: no element with id", child.id);
29
- continue;
30
- }
31
- if (mode === "outer") morph(target, child, o);
32
- else target.replaceWith(child), activateScripts(child);
33
- }
34
- return;
35
- }
36
- const targets = [...document.querySelectorAll(selector)];
37
- if (!targets.length) console.warn("patch-elements: no elements match", selector);
38
- targets.forEach((t, i) => {
39
- const content = i === targets.length - 1 ? frag : frag.cloneNode(true);
32
+ const patch = (t, content) => {
40
33
  const nodes = [...content.childNodes];
41
- if (mode === "outer" && nodes.length === 1 && isElement(nodes[0])) morph(t, nodes[0], o);
34
+ if (mode === "outer" && nodes.length === 1 && nodes[0].nodeType === 1) morph(t, nodes[0], o);
42
35
  else if (mode === "inner") morphInner(t, content, o);
43
36
  else {
44
- if (mode === "outer" || mode === "replace") t.replaceWith(content);
45
- else t[mode](content);
37
+ mode === "outer" || mode === "replace" ? t.replaceWith(content) : t[mode](content);
46
38
  for (const n of nodes) activateScripts(n);
47
39
  }
48
- });
49
- };
50
- const isElement = (n) => n.nodeType === 1;
51
- const applyElements = handler({
52
- name: "patch-elements",
53
- handle(runtime, { elements = "", selector = "", mode = "outer", useViewTransition }) {
54
- if (!MODES.includes(mode)) throw new Error(`patch-elements: unknown mode "${mode}"`);
55
- const run = () => apply(runtime, elements, selector, mode);
56
- useViewTransition === "true" && "startViewTransition" in document ? document.startViewTransition(run) : run();
40
+ };
41
+ if (selector) {
42
+ const targets = [...document.querySelectorAll(selector)];
43
+ if (mode === "remove") for (const t of targets) t.remove();
44
+ else
45
+ targets.forEach((t, i) => {
46
+ patch(t, i + 1 < targets.length ? parsed.cloneNode(true) : parsed);
47
+ });
48
+ } else {
49
+ if (mode !== "outer" && mode !== "replace") throw new Error(`mode "${mode}" needs a selector`);
50
+ for (const child of [...parsed.children]) {
51
+ const target = child.id && document.getElementById(child.id);
52
+ if (target) {
53
+ const f = document.createDocumentFragment();
54
+ f.append(child);
55
+ patch(target, f);
56
+ }
57
+ }
57
58
  }
58
59
  });
59
60
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/plugins/server-events/apply-elements.ts"],
4
- "sourcesContent": ["import { handler, type Runtime } from '../../kernel/index.js'\nimport { activateScripts, morph, morphInner } from './morph.js'\n\nconst MODES = ['outer', 'inner', 'replace', 'prepend', 'append', 'before', 'after', 'remove'] as const\ntype Mode = (typeof MODES)[number]\n\nconst parse = (html: string): DocumentFragment | Document => {\n if (/<\\/(html|head|body)>/i.test(html)) return new DOMParser().parseFromString(html, 'text/html')\n const t = document.createElement('template')\n t.innerHTML = html\n return t.content\n}\n\nconst apply = (runtime: Runtime, html: string, selector: string, mode: Mode): void => {\n const o = { ignoreAttr: runtime.attr('ignore-morph'), preserveAttr: runtime.attr('preserve-attr') }\n const parsed = parse(html)\n if (parsed instanceof Document) {\n if (parsed.head.childNodes.length) morphInner(document.head, parsed.head, o)\n morph(document.body, parsed.body, o)\n return\n }\n const frag = parsed\n if (mode === 'remove') {\n for (const t of document.querySelectorAll(selector)) t.remove()\n return\n }\n if (!selector) {\n if (mode !== 'outer' && mode !== 'replace') throw new Error(`patch-elements mode \"${mode}\" needs a selector`)\n for (const child of [...frag.children]) {\n const target = child.id && document.getElementById(child.id)\n if (!target) {\n console.warn('patch-elements: no element with id', child.id)\n continue\n }\n if (mode === 'outer') morph(target, child, o)\n else (target.replaceWith(child), activateScripts(child))\n }\n return\n }\n const targets = [...document.querySelectorAll(selector)]\n if (!targets.length) console.warn('patch-elements: no elements match', selector)\n targets.forEach((t, i) => {\n const content = i === targets.length - 1 ? frag : (frag.cloneNode(true) as DocumentFragment)\n const nodes = [...content.childNodes]\n if (mode === 'outer' && nodes.length === 1 && isElement(nodes[0])) morph(t, nodes[0], o)\n else if (mode === 'inner') morphInner(t, content, o)\n else {\n if (mode === 'outer' || mode === 'replace') t.replaceWith(content)\n else t[mode](content)\n for (const n of nodes) activateScripts(n)\n }\n })\n}\n\nconst isElement = (n: Node): n is Element => n.nodeType === 1\n\n/** Server event `patch-elements`: `elements <html>`, `selector`, `mode`, `useViewTransition true`. */\nexport const applyElements = handler({\n name: 'patch-elements',\n handle(runtime, { elements = '', selector = '', mode = 'outer', useViewTransition }) {\n if (!MODES.includes(mode as Mode)) throw new Error(`patch-elements: unknown mode \"${mode}\"`)\n const run = () => apply(runtime, elements, selector, mode as Mode)\n useViewTransition === 'true' && 'startViewTransition' in document ? document.startViewTransition(run) : run()\n },\n})\n"],
5
- "mappings": "AAAA,SAAS,eAA6B;AACtC,SAAS,iBAAiB,OAAO,kBAAkB;AAEnD,MAAM,QAAQ,CAAC,SAAS,SAAS,WAAW,WAAW,UAAU,UAAU,SAAS,QAAQ;AAG5F,MAAM,QAAQ,CAAC,SAA8C;AAC3D,MAAI,wBAAwB,KAAK,IAAI,EAAG,QAAO,IAAI,UAAU,EAAE,gBAAgB,MAAM,WAAW;AAChG,QAAM,IAAI,SAAS,cAAc,UAAU;AAC3C,IAAE,YAAY;AACd,SAAO,EAAE;AACX;AAEA,MAAM,QAAQ,CAAC,SAAkB,MAAc,UAAkB,SAAqB;AACpF,QAAM,IAAI,EAAE,YAAY,QAAQ,KAAK,cAAc,GAAG,cAAc,QAAQ,KAAK,eAAe,EAAE;AAClG,QAAM,SAAS,MAAM,IAAI;AACzB,MAAI,kBAAkB,UAAU;AAC9B,QAAI,OAAO,KAAK,WAAW,OAAQ,YAAW,SAAS,MAAM,OAAO,MAAM,CAAC;AAC3E,UAAM,SAAS,MAAM,OAAO,MAAM,CAAC;AACnC;AAAA,EACF;AACA,QAAM,OAAO;AACb,MAAI,SAAS,UAAU;AACrB,eAAW,KAAK,SAAS,iBAAiB,QAAQ,EAAG,GAAE,OAAO;AAC9D;AAAA,EACF;AACA,MAAI,CAAC,UAAU;AACb,QAAI,SAAS,WAAW,SAAS,UAAW,OAAM,IAAI,MAAM,wBAAwB,IAAI,oBAAoB;AAC5G,eAAW,SAAS,CAAC,GAAG,KAAK,Q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AS,oBAAoB,GAAG,IAAI,IAAI;AAAA,EAC9G;AACF,CAAC;",
4
+ "sourcesContent": ["import { srv } from '../def.js';\nimport { activateScripts, morph, morphInner } from './morph.js';\n\n/**\n * `<head>` children are matched by equality, not position: a stylesheet or meta that is already\n * present is left alone (no reload flash), missing ones are added, absent ones removed.\n */\nconst mergeHead = (head: HTMLHeadElement, next: HTMLHeadElement) => {\n const wanted = [...next.children];\n for (const old of [...head.children]) {\n const i = wanted.findIndex((n) => n.isEqualNode(old));\n if (i < 0) old.remove();\n else wanted.splice(i, 1);\n }\n for (const n of wanted) {\n const copy = document.importNode(n, true);\n head.append(copy);\n activateScripts(copy);\n }\n};\n\nconst parse = (html: string): DocumentFragment | Document => {\n if (/^\\s*<(!doctype|html)[\\s>]|<\\/(html|head|body)>/i.test(html))\n return new DOMParser().parseFromString(html, 'text/html');\n const t = document.createElement('template');\n t.innerHTML = html;\n return t.content;\n};\n\n/** Server event `patch-elements`: `elements <html>`, `selector`, `mode`. */\nexport const applyElements = srv('patch-elements', (runtime, { elements = '', selector = '', mode = 'outer' }) => {\n const o = { ignoreAttr: runtime.attr('ignore-morph'), preserveAttr: runtime.attr('preserve-attr') };\n const parsed = parse(elements);\n if (parsed instanceof Document) {\n for (const { name, value } of parsed.documentElement.attributes) document.documentElement.setAttribute(name, value);\n if (parsed.head.childNodes.length) mergeHead(document.head, parsed.head);\n morph(document.body, parsed.body, o);\n return;\n }\n /** Put `content` at `t` per `mode`; a lone element in outer mode is morphed rather than swapped. */\n const patch = (t: Element, content: DocumentFragment) => {\n const nodes = [...content.childNodes];\n if (mode === 'outer' && nodes.length === 1 && nodes[0].nodeType === 1) morph(t, nodes[0] as Element, o);\n else if (mode === 'inner') morphInner(t, content, o);\n else {\n mode === 'outer' || mode === 'replace' ? t.replaceWith(content) : (t as any)[mode](content);\n for (const n of nodes) activateScripts(n);\n }\n };\n if (selector) {\n const targets = [...document.querySelectorAll(selector)];\n if (mode === 'remove') for (const t of targets) t.remove();\n else\n targets.forEach((t, i) => {\n patch(t, i + 1 < targets.length ? (parsed.cloneNode(true) as DocumentFragment) : parsed);\n });\n } else {\n if (mode !== 'outer' && mode !== 'replace') throw new Error(`mode \"${mode}\" needs a selector`);\n for (const child of [...parsed.children]) {\n const target = child.id && document.getElementById(child.id);\n if (target) {\n const f = document.createDocumentFragment();\n f.append(child);\n patch(target, f);\n }\n }\n }\n});\n"],
5
+ "mappings": "AAAA,SAAS,WAAW;AACpB,SAAS,iBAAiB,OAAO,kBAAkB;AAMnD,MAAM,YAAY,CAAC,MAAuB,SAA0B;AAClE,QAAM,SAAS,CAAC,GAAG,KAAK,QAAQ;AAChC,aAAW,OAAO,CAAC,GAAG,KAAK,QAAQ,GAAG;AACpC,UAAM,IAAI,OAAO,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,CAAC;AACpD,QAAI,IAAI,EAAG,KAAI,OAAO;AAAA,QACjB,QAAO,OAAO,GAAG,CAAC;AAAA,EACzB;AACA,aAAW,KAAK,QAAQ;AACtB,UAAM,OAAO,SAAS,WAAW,GAAG,IAAI;AACxC,SAAK,OAAO,IAAI;AAChB,oBAAgB,IAAI;AAAA,EACtB;AACF;AAEA,MAAM,QAAQ,CAAC,SAA8C;AAC3D,MAAI,kDAAkD,KAAK,IAAI;AAC7D,WAAO,IAAI,UAAU,EAAE,gBAAgB,MAAM,WAAW;AAC1D,QAAM,IAAI,SAAS,cAAc,UAAU;AAC3C,IAAE,YAAY;AACd,SAAO,EAAE;AACX;AAGO,MAAM,gBAAgB,IAAI,kBAAkB,CAAC,SAAS,EAAE,WAAW,IAAI,WAAW,IAAI,OAAO,QAAQ,MAAM;AAChH,QAAM,IAAI,EAAE,YAAY,QAAQ,KAAK,cAAc,GAAG,cAAc,QAAQ,KAAK,eAAe,EAAE;AAClG,QAAM,SAAS,MAAM,QAAQ;AAC7B,MAAI,kBAAkB,UAAU;AAC9B,eAAW,EAAE,MAAM,MAAM,KAAK,OAAO,gBAAgB,WAAY,UAAS,g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handler({
3
- name: "patch-signals",
4
- handle(runtime, { signals, onlyIfMissing }) {
5
- if (!signals) return;
6
- let patch;
7
- try {
8
- patch = JSON.parse(signals);
9
- } catch {
10
- patch = runtime.compiler([], `return (${signals})`)();
11
- }
12
- runtime.store.merge(patch, { ifMissing: onlyIfMissing === "true" });
1
+ import { srv } from "../def.js";
2
+ const applyState = srv("patch-signals", (runtime, { signals, onlyIfMissing }) => {
3
+ if (!signals) return;
4
+ let patch;
5
+ try {
6
+ patch = JSON.parse(signals);
7
+ } catch {
8
+ patch = runtime.compiler([], `return (${signals})`)();
13
9
  }
10
+ runtime.store.merge(patch, { ifMissing: onlyIfMissing === "true" });
14
11
  });
15
12
  export {
16
13
  applyState
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/plugins/server-events/apply-state.ts"],
4
- "sourcesContent": ["import { handler } from '../../kernel/index.js'\n\n/** Server event `patch-signals`: `signals {json}` merged into the store; `onlyIfMissing true` keeps existing values. */\nexport const applyState = handler({\n name: 'patch-signals',\n handle(runtime, { signals, onlyIfMissing }) {\n if (!signals) return\n let patch: Record<string, unknown>\n try {\n patch = JSON.parse(signals)\n } catch {\n patch = runtime.compiler([], `return (${signals})`)()\n }\n runtime.store.merge(patch, { ifMissing: onlyIfMissing === 'true' })\n },\n})\n"],
5
- "mappings": "AAAA,SAAS,eAAe;AAGjB,MAAM,aAAa,QAAQ;AAAA,EAChC,MAAM;AAAA,EACN,OAAO,SAAS,EAAE,SAAS,cAAc,GAAG;AAC1C,QAAI,CAAC,QAAS;AACd,QAAI;AACJ,QAAI;AACF,cAAQ,KAAK,MAAM,OAAO;AAAA,IAC5B,QAAQ;AACN,cAAQ,QAAQ,SAAS,CAAC,GAAG,WAAW,OAAO,GAAG,EAAE;AAAA,IACtD;AACA,YAAQ,MAAM,MAAM,OAAO,EAAE,WAAW,kBAAkB,OAAO,CAAC;AAAA,EACpE;AACF,CAAC;",
4
+ "sourcesContent": ["import { srv } from '../def.js';\n\n/** Server event `patch-signals`: `signals {json}` merged into the store; `onlyIfMissing true` keeps existing values. */\nexport const applyState = srv('patch-signals', (runtime, { signals, onlyIfMissing }) => {\n if (!signals) return;\n let patch: Record<string, unknown>;\n try {\n patch = JSON.parse(signals);\n } catch {\n patch = runtime.compiler([], `return (${signals})`)();\n }\n runtime.store.merge(patch, { ifMissing: onlyIfMissing === 'true' });\n});\n"],
5
+ "mappings": "AAAA,SAAS,WAAW;AAGb,MAAM,aAAa,IAAI,iBAAiB,CAAC,SAAS,EAAE,SAAS,cAAc,MAAM;AACtF,MAAI,CAAC,QAAS;AACd,MAAI;AACJ,MAAI;AACF,YAAQ,KAAK,MAAM,OAAO;AAAA,EAC5B,QAAQ;AACN,YAAQ,QAAQ,SAAS,CAAC,GAAG,WAAW,OAAO,GAAG,EAAE;AAAA,EACtD;AACA,UAAQ,MAAM,MAAM,OAAO,EAAE,WAAW,kBAAkB,OAAO,CAAC;AACpE,CAAC;",
6
6
  "names": []
7
7
  }
@@ -6,7 +6,5 @@ export type MorphOptions = {
6
6
  };
7
7
  /** Scripts inserted through the DOM do not execute; replace them with fresh copies that do. */
8
8
  export declare const activateScripts: (root: Node) => void;
9
- /** Morph `target` into `next` (outer). */
10
9
  export declare const morph: (target: Element, next: Element, o?: MorphOptions) => void;
11
- /** Morph the children of `target` into the children of `next` (inner). */
12
10
  export declare const morphInner: (target: Element, next: ParentNode, o?: MorphOptions) => void;
@@ -1,9 +1,9 @@
1
1
  const ran = /* @__PURE__ */ new WeakSet();
2
- const isEl = (n) => !!n && n.nodeType === 1;
2
+ const isEl = (n) => n?.nodeType === 1;
3
3
  const activateScripts = (root) => {
4
4
  if (!isEl(root)) return;
5
- for (const old of root.matches("script") ? [root] : [...root.querySelectorAll("script")]) {
6
- if (ran.has(old)) continue;
5
+ for (const old of [root, ...root.querySelectorAll("script")]) {
6
+ if (!old.matches("script") || ran.has(old)) continue;
7
7
  const s = document.createElement("script");
8
8
  for (const { name, value } of old.attributes) s.setAttribute(name, value);
9
9
  s.text = old.text;
@@ -11,58 +11,61 @@ const activateScripts = (root) => {
11
11
  old.replaceWith(s);
12
12
  }
13
13
  };
14
- const idsIn = (n) => [...isEl(n) && n.id ? [n] : [], ...n.querySelectorAll("[id]")];
15
- const containsKept = (n, ctx) => isEl(n) && idsIn(n).some((e) => ctx.keep.has(e.id));
16
- const discard = (n, ctx) => {
17
- containsKept(n, ctx) ? ctx.pantry.append(n) : n.remove();
14
+ const fresh = (b, insert) => {
15
+ const n = document.importNode(b, true);
16
+ insert(n);
17
+ activateScripts(n);
18
18
  };
19
+ const idsIn = (n) => [n, ...n.querySelectorAll?.("[id]") ?? []].filter((e) => isEl(e) && e.id);
20
+ const containsKept = (n, ctx) => idsIn(n).some((e) => ctx.keep.has(e.id));
19
21
  const place = (parent, node, before) => {
20
- const p = parent;
21
22
  try {
22
- p.moveBefore ? p.moveBefore(node, before) : parent.insertBefore(node, before);
23
+ parent.moveBefore(node, before);
23
24
  } catch {
24
25
  parent.insertBefore(node, before);
25
26
  }
26
27
  };
27
- const findKept = (id, from, ctx) => {
28
- for (let n = from; n; n = n.nextSibling) if (isEl(n) && n.id === id) return n;
29
- return ctx.pantry.querySelector(`#${CSS.escape(id)}`) ?? document.getElementById(id);
30
- };
31
- const compatible = (old, next, ctx) => old.nodeType === next.nodeType && old.nodeName === next.nodeName && (!isEl(old) || !old.id || old.id === next.id) && !(isEl(old) && ctx.keep.has(old.id) && old.id !== next.id);
28
+ const compatible = (old, next) => old.nodeName === next.nodeName && (!isEl(old) || !old.id || old.id === next.id);
32
29
  const syncAttributes = (a, b, ctx) => {
33
- const keep = new Set((b.getAttribute(ctx.preserve) ?? a.getAttribute(ctx.preserve) ?? "").split(/\s+/).filter(Boolean));
30
+ const keep = new Set((b.getAttribute(ctx.preserve) ?? a.getAttribute(ctx.preserve) ?? "").split(/\s+/));
31
+ const differs = (name) => !keep.has(name) && a.getAttribute(name) !== b.getAttribute(name);
34
32
  let changed = false;
35
- const attrDiffers = (name) => !keep.has(name) && a.getAttribute(name) !== b.getAttribute(name);
36
- if (a instanceof HTMLInputElement && b instanceof HTMLInputElement && a.type !== "file") {
37
- if (attrDiffers("value")) a.value = b.getAttribute("value") ?? "", changed = true;
38
- if (attrDiffers("checked")) a.checked = b.hasAttribute("checked"), changed = true;
39
- } else if (a instanceof HTMLTextAreaElement && b instanceof HTMLTextAreaElement) {
40
- if (!keep.has("value") && a.defaultValue !== b.defaultValue) a.value = b.defaultValue, changed = true;
41
- } else if (a instanceof HTMLOptionElement && b instanceof HTMLOptionElement) {
42
- if (attrDiffers("selected")) a.selected = b.hasAttribute("selected"), changed = true;
33
+ const live = a instanceof HTMLInputElement && a.type !== "file" ? ["value", "checked"] : a instanceof HTMLOptionElement ? ["selected"] : [];
34
+ for (const name of live) {
35
+ if (differs(name)) {
36
+ a[name] = name === "value" ? b.getAttribute(name) ?? "" : b.hasAttribute(name);
37
+ changed = true;
38
+ }
43
39
  }
44
- for (const { name, value } of b.attributes) if (!keep.has(name) && a.getAttribute(name) !== value) a.setAttribute(name, value);
40
+ if (a instanceof HTMLTextAreaElement && !keep.has("value") && a.defaultValue !== b.defaultValue) {
41
+ a.value = b.defaultValue;
42
+ changed = true;
43
+ }
44
+ for (const { name, value } of b.attributes)
45
+ if (!keep.has(name) && a.getAttribute(name) !== value) a.setAttribute(name, value);
45
46
  for (const { name } of [...a.attributes]) if (!keep.has(name) && !b.hasAttribute(name)) a.removeAttribute(name);
46
- if (changed) (a instanceof HTMLOptionElement ? a.closest("select") : a)?.dispatchEvent(new Event("sigmx-prop-change", { bubbles: true }));
47
+ if (changed)
48
+ (a instanceof HTMLOptionElement ? a.closest("select") : a)?.dispatchEvent(
49
+ new Event("sigmx-prop-change", { bubbles: true })
50
+ );
47
51
  };
48
52
  const morphNode = (a, b, ctx) => {
49
- if (a.nodeType !== b.nodeType || a.nodeName !== b.nodeName) {
50
- const fresh = document.importNode(b, true);
51
- a.replaceWith(fresh);
52
- activateScripts(fresh);
53
+ if (a.nodeName !== b.nodeName) {
54
+ fresh(b, (n) => a.replaceWith(n));
53
55
  return;
54
56
  }
55
57
  if (!isEl(a) || !isEl(b)) {
56
58
  if (a.nodeValue !== b.nodeValue) a.nodeValue = b.nodeValue;
57
59
  return;
58
60
  }
61
+ if (b.localName === "script" && !a.isEqualNode(b)) {
62
+ fresh(b, (n) => a.replaceWith(n));
63
+ return;
64
+ }
59
65
  if (a.hasAttribute(ctx.ignore) && b.hasAttribute(ctx.ignore)) return;
60
66
  syncAttributes(a, b, ctx);
61
- if (a instanceof HTMLTemplateElement && b instanceof HTMLTemplateElement) {
62
- a.innerHTML = b.innerHTML;
63
- } else if (!a.isEqualNode(b)) {
64
- morphChildren(a, b, ctx);
65
- }
67
+ if (a instanceof HTMLTemplateElement) a.innerHTML = b.innerHTML;
68
+ else if (!a.isEqualNode(b)) morphChildren(a, b, ctx);
66
69
  };
67
70
  const morphChildren = (parent, next, ctx) => {
68
71
  let cur = parent.firstChild;
@@ -70,51 +73,51 @@ const morphChildren = (parent, next, ctx) => {
70
73
  while (cur && cur !== stop) {
71
74
  const n = cur;
72
75
  cur = cur.nextSibling;
73
- discard(n, ctx);
76
+ if (!(isEl(n) && ctx.keep.get(n.id) === n)) n.remove();
74
77
  }
75
78
  return cur === stop;
76
79
  };
77
80
  for (const nb of [...next.childNodes]) {
78
- if (isEl(nb) && nb.id && ctx.keep.has(nb.id)) {
79
- const match = findKept(nb.id, cur, ctx);
80
- if (match) {
81
- if (dropUntil(match) && cur) cur = match.nextSibling;
82
- else place(parent, match, cur);
83
- morphNode(match, nb, ctx);
84
- continue;
85
- }
81
+ const kept = isEl(nb) && ctx.keep.get(nb.id);
82
+ if (kept) {
83
+ let m2 = cur;
84
+ while (m2 && m2 !== kept) m2 = m2.nextSibling;
85
+ if (m2) {
86
+ dropUntil(kept);
87
+ cur = kept.nextSibling;
88
+ } else place(parent, kept, cur);
89
+ morphNode(kept, nb, ctx);
90
+ continue;
86
91
  }
87
92
  let m = cur;
88
- while (m && !compatible(m, nb, ctx)) m = m.nextSibling;
93
+ while (m && !compatible(m, nb)) m = m.nextSibling;
89
94
  if (m) {
90
95
  dropUntil(m);
91
96
  cur = m.nextSibling;
92
97
  morphNode(m, nb, ctx);
93
98
  } else if (isEl(nb) && containsKept(nb, ctx)) {
94
- const shell = document.createElementNS(nb.namespaceURI ?? "http://www.w3.org/1999/xhtml", nb.tagName);
99
+ const shell = document.importNode(nb, false);
95
100
  parent.insertBefore(shell, cur);
96
101
  morphNode(shell, nb, ctx);
97
102
  } else {
98
- const fresh = document.importNode(nb, true);
99
- parent.insertBefore(fresh, cur);
100
- activateScripts(fresh);
103
+ fresh(nb, (n) => parent.insertBefore(n, cur));
101
104
  }
102
105
  }
103
106
  dropUntil(null);
104
107
  };
105
108
  const context = (target, next, o) => {
106
- const keep = /* @__PURE__ */ new Set();
107
109
  const wanted = new Map(idsIn(next).map((e) => [e.id, e.tagName]));
108
- for (const e of idsIn(target)) if (wanted.get(e.id) === e.tagName) keep.add(e.id);
109
- return { keep, pantry: document.createDocumentFragment(), ignore: o.ignoreAttr ?? "data-ignore-morph", preserve: o.preserveAttr ?? "data-preserve-attr" };
110
+ return {
111
+ keep: new Map(idsIn(target).flatMap((e) => wanted.get(e.id) === e.tagName ? [[e.id, e]] : [])),
112
+ ignore: o.ignoreAttr ?? "data-ignore-morph",
113
+ preserve: o.preserveAttr ?? "data-preserve-attr"
114
+ };
110
115
  };
111
116
  const morph = (target, next, o = {}) => {
112
- const ctx = context(target, next, o);
113
- morphNode(target, next, ctx);
117
+ morphNode(target, next, context(target, next, o));
114
118
  };
115
119
  const morphInner = (target, next, o = {}) => {
116
- const ctx = context(target, next, o);
117
- morphChildren(target, next, ctx);
120
+ morphChildren(target, next, context(target, next, o));
118
121
  };
119
122
  export {
120
123
  activateScripts,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/plugins/server-events/morph.ts"],
4
- "sourcesContent": ["// Id-aware DOM morphing: update `target` in place to match `next`, keeping elements whose ids\n// appear in both trees (and their state: focus, input values, scroll) instead of recreating them.\n\nexport type MorphOptions = {\n /** Attribute that marks a subtree to leave alone when present on both sides. */\n ignoreAttr?: string\n /** Attribute listing space-separated attribute names to keep from the old element. */\n preserveAttr?: string\n}\n\ntype Ctx = { keep: Set<string>; pantry: DocumentFragment; ignore: string; preserve: string }\n\nconst ran = new WeakSet<Node>()\nconst isEl = (n: Node | null): n is Element => !!n && n.nodeType === 1\n\n/** Scripts inserted through the DOM do not execute; replace them with fresh copies that do. */\nexport const activateScripts = (root: Node): void => {\n if (!isEl(root)) return\n for (const old of (root.matches('script') ? [root] : [...root.querySelectorAll('script')]) as HTMLScriptElement[]) {\n if (ran.has(old)) continue\n const s = document.createElement('script')\n for (const { name, value } of old.attributes) s.setAttribute(name, value)\n s.text = old.text\n ran.add(s)\n old.replaceWith(s)\n }\n}\n\n/** Every element with an id in and under `n`. */\nconst idsIn = (n: Node): Element[] => [...(isEl(n) && n.id ? [n] : []), ...(n as ParentNode).querySelectorAll('[id]')]\nconst containsKept = (n: Node, ctx: Ctx): boolean => isEl(n) && idsIn(n).some((e) => ctx.keep.has(e.id))\n\n/** Remove a node, or park it if it (or a descendant) is wanted elsewhere in the new tree. */\nconst discard = (n: Node, ctx: Ctx): void => {\n containsKept(n, ctx) ? ctx.pantry.append(n) : (n as ChildNode).remove()\n}\n\nconst place = (parent: Node, node: Node, before: Node | null): void => {\n const p = parent as Node & { moveBefore?: (n: Node, b: Node | null) => void }\n try {\n p.moveBefore ? p.moveBefore(node, before) : parent.insertBefore(node, before)\n } catch {\n parent.insertBefore(node, before)\n }\n}\n\nconst findKept = (id: string, from: Node | null, ctx: Ctx): Element | null => {\n for (let n = from; n; n = n.nextSibling) if (isEl(n) && n.id === id) return n\n return ctx.pantry.querySelector(`#${CSS.escape(id)}`) ?? document.getElementById(id)\n}\n\nconst compatible = (old: Node, next: Node, ctx: Ctx): boolean =>\n old.nodeType === next.nodeType &&\n old.nodeName === next.nodeName &&\n (!isEl(old) || !old.id || old.id === (next as Element).id) &&\n !(isEl(old) && ctx.keep.has(old.id) && old.id !== (next as Element).id)\n\nconst syncAttributes = (a: Element, b: Element, ctx: Ctx): void => {\n const keep = new Set((b.getAttribute(ctx.preserve) ?? a.getAttribute(ctx.preserve) ?? '').split(/\\s+/).filter(Boolean))\n // Live form state (what the user typed or ticked) is only overwritten when the server's\n // default actually changed, i.e. the *attribute* differs between old and new markup.\n let changed = false\n const attrDiffers = (name: string) => !keep.has(name) && a.getAttribute(name) !== b.getAttribute(name)\n if (a instanceof HTMLInputElement && b instanceof HTMLInputElement && a.type !== 'file') {\n if (attrDiffers('value')) (a.value = b.getAttribute('value') ?? ''), (changed = true)\n if (attrDiffers('checked')) (a.checked = b.hasAttribute('checked')), (changed = true)\n } else if (a instanceof HTMLTextAreaElement && b instanceof HTMLTextAreaElement) {\n if (!keep.has('value') && a.defaultValue !== b.defaultValue) (a.value = b.defaultValue), (changed = true)\n } else if (a instanceof HTMLOptionElement && b instanceof HTMLOptionElement) {\n if (attrDiffers('selected')) (a.selected = b.hasAttribute('selected')), (changed = true)\n }\n for (const { name, value } of b.attributes) if (!keep.has(name) && a.getAttribute(name) !== value) a.setAttribute(name, value)\n for (const { name } of [...a.attributes]) if (!keep.has(name) && !b.hasAttribute(name)) a.removeAttribute(name)\n\n if (changed) (a instanceof HTMLOptionElement ? a.closest('select') : a)?.dispatchEvent(new Event('sigmx-prop-change', { bubbles: true }))\n}\n\nconst morphNode = (a: Node, b: Node, ctx: Ctx): void => {\n if (a.nodeType !== b.nodeType || a.nodeName !== b.nodeName) {\n const fresh = document.importNode(b, true)\n ;(a as ChildNode).replaceWith(fresh)\n activateScripts(fresh)\n return\n }\n if (!isEl(a) || !isEl(b)) {\n if (a.nodeValue !== b.nodeValue) a.nodeValue = b.nodeValue\n return\n }\n if (a.hasAttribute(ctx.ignore) && b.hasAttribute(ctx.ignore)) return\n syncAttributes(a, b, ctx)\n if (a instanceof HTMLTemplateElement && b instanceof HTMLTemplateElement) {\n a.innerHTML = b.innerHTML\n } else if (!a.isEqualNode(b)) {\n morphChildren(a, b, ctx)\n }\n}\n\nconst morphChildren = (parent: Node, next: Node, ctx: Ctx): void => {\n let cur: Node | null = parent.firstChild\n /** Discard old siblings from `cur` up to (not including) `stop`; returns whether `stop` was reached. */\n const dropUntil = (stop: Node | null): boolean => {\n while (cur && cur !== stop) {\n const n = cur\n cur = cur.nextSibling\n discard(n, ctx)\n }\n return cur === stop\n }\n for (const nb of [...next.childNodes]) {\n if (isEl(nb) && nb.id && ctx.keep.has(nb.id)) {\n const match = findKept(nb.id, cur, ctx)\n if (match) {\n if (dropUntil(match) && cur) cur = match.nextSibling\n else place(parent, match, cur)\n morphNode(match, nb, ctx)\n continue\n }\n }\n let m: Node | null = cur\n while (m && !compatible(m, nb, ctx)) m = m.nextSibling\n if (m) {\n dropUntil(m)\n cur = m.nextSibling\n morphNode(m, nb, ctx)\n } else if (isEl(nb) && containsKept(nb, ctx)) {\n // Build a shell so the wanted descendants can be pulled in rather than recreated.\n const shell = document.createElementNS(nb.namespaceURI ?? 'http://www.w3.org/1999/xhtml', nb.tagName)\n parent.insertBefore(shell, cur)\n morphNode(shell, nb, ctx)\n } else {\n const fresh = document.importNode(nb, true)\n parent.insertBefore(fresh, cur)\n activateScripts(fresh)\n }\n }\n dropUntil(null)\n}\n\nconst context = (target: Node, next: Node, o: MorphOptions): Ctx => {\n const keep = new Set<string>()\n const wanted = new Map(idsIn(next).map((e) => [e.id, e.tagName]))\n for (const e of idsIn(target)) if (wanted.get(e.id) === e.tagName) keep.add(e.id)\n return { keep, pantry: document.createDocumentFragment(), ignore: o.ignoreAttr ?? 'data-ignore-morph', preserve: o.preserveAttr ?? 'data-preserve-attr' }\n}\n\n/** Morph `target` into `next` (outer). */\nexport const morph = (target: Element, next: Element, o: MorphOptions = {}): void => {\n const ctx = context(target, next, o)\n morphNode(target, next, ctx)\n}\n\n/** Morph the children of `target` into the children of `next` (inner). */\nexport const morphInner = (target: Element, next: ParentNode, o: MorphOptions = {}): void => {\n const ctx = context(target, next, o)\n morphChildren(target, next, ctx)\n}\n"],
5
- "mappings": "AAYA,MAAM,MAAM,oBAAI,QAAc;AAC9B,MAAM,OAAO,CAAC,MAAiC,CAAC,CAAC,KAAK,EAAE,aAAa;AAG9D,MAAM,kBAAkB,CAAC,SAAqB;AACnD,MAAI,CAAC,KAAK,IAAI,EAAG;AACjB,aAAW,OAAQ,KAAK,QAAQ,QAAQ,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,KAAK,iBAAiB,QAAQ,CAAC,GAA2B;AACjH,QAAI,IAAI,IAAI,GAAG,EAAG;AAClB,UAAM,IAAI,SAAS,cAAc,QAAQ;AACzC,eAAW,EAAE,MAAM,MAAM,KAAK,IAAI,WAAY,GAAE,aAAa,MAAM,KAAK;AACxE,MAAE,OAAO,IAAI;AACb,QAAI,IAAI,CAAC;AACT,QAAI,YAAY,CAAC;AAAA,EACnB;AACF;AAGA,MAAM,QAAQ,CAAC,MAAuB,CAAC,GAAI,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,GAAI,GAAI,EAAiB,iBAAiB,MAAM,CAAC;AACrH,MAAM,eAAe,CAAC,GAAS,QAAsB,KAAK,CAAC,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,IAAI,EAAE,EAAE,CAAC;AAGvG,MAAM,UAAU,CAAC,GAAS,QAAmB;AAC3C,eAAa,GAAG,GAAG,IAAI,IAAI,OAAO,OAAO,CAAC,IAAK,EAAgB,OAAO;AACxE;AAEA,MAAM,QAAQ,CAAC,QAAc,MAAY,WAA8B;AACrE,QAAM,IAAI;AACV,MAAI;AACF,MAAE,aAAa,EAAE,WAAW,MAAM,MAAM,IAAI,OAAO,aAAa,MAAM,MAAM;AAAA,EAC9E,QAAQ;AACN,WAAO,aAAa,MAAM,MAAM;AAAA,EAClC;AACF;AAEA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K,IAAI,EAAE,EAAE;AAChF,SAAO,EAAE,MAAM,QAAQ,SAAS,uBAAuB,GAAG,QAAQ,EAAE,cAAc,qBAAqB,UAAU,EAAE,gBAAgB,qBAAqB;AAC1J;AAGO,MAAM,QAAQ,CAAC,QAAiB,MAAe,IAAkB,CAAC,MAAY;AACnF,QAAM,MAAM,QAAQ,QAAQ,MAAM,CAAC;AACnC,YAAU,QAAQ,MAAM,GAAG;AAC7B;AAGO,MAAM,aAAa,CAAC,QAAiB,MAAkB,IAAkB,CAAC,MAAY;AAC3F,QAAM,MAAM,QAAQ,QAAQ,MAAM,CAAC;AACnC,gBAAc,QAAQ,MAAM,GAAG;AACjC;",
6
- "names": []
4
+ "sourcesContent": ["// Id-aware DOM morphing: update `target` in place to match `next`, keeping elements whose ids\n// appear in both trees (and their state: focus, input values, scroll) instead of recreating them.\n\nexport type MorphOptions = {\n /** Attribute that marks a subtree to leave alone when present on both sides. */\n ignoreAttr?: string;\n /** Attribute listing space-separated attribute names to keep from the old element. */\n preserveAttr?: string;\n};\n\n/** `keep`: id \u2192 the old element to reuse wherever the new tree wants that id. */\ntype Ctx = { keep: Map<string, Element>; ignore: string; preserve: string };\n\nconst ran = new WeakSet<Node>();\nconst isEl = (n: Node | null): n is Element => n?.nodeType === 1;\n\n/** Scripts inserted through the DOM do not execute; replace them with fresh copies that do. */\nexport const activateScripts = (root: Node): void => {\n if (!isEl(root)) return;\n for (const old of [root, ...root.querySelectorAll('script')] as HTMLScriptElement[]) {\n if (!old.matches('script') || ran.has(old)) continue;\n const s = document.createElement('script');\n for (const { name, value } of old.attributes) s.setAttribute(name, value);\n s.text = old.text;\n ran.add(s);\n old.replaceWith(s);\n }\n};\n\n/** Import `b` into the document, `insert` it, and run its scripts. */\nconst fresh = (b: Node, insert: (n: Node) => void): void => {\n const n = document.importNode(b, true);\n insert(n);\n activateScripts(n);\n};\n\nconst idsIn = (n: Node): Element[] =>\n [n, ...((n as ParentNode).querySelectorAll?.('[id]') ?? [])].filter((e) => isEl(e) && e.id) as Element[];\nconst containsKept = (n: Node, ctx: Ctx): boolean => idsIn(n).some((e) => ctx.keep.has(e.id));\n\nconst place = (parent: Node, node: Node, before: Node | null): void => {\n try {\n (parent as any).moveBefore(node, before);\n } catch {\n parent.insertBefore(node, before);\n }\n};\n\n/** Same kind of node, and an old element with an id is only reused for the same id. */\nconst compatible = (old: Node, next: Node): boolean =>\n old.nodeName === next.nodeName && (!isEl(old) || !old.id || old.id === (next as Element).id);\n\nconst syncAttributes = (a: Element, b: Element, ctx: Ctx): void => {\n const keep = new Set((b.getAttribute(ctx.preserve) ?? a.getAttribute(ctx.preserve) ?? '').split(/\\s+/));\n const differs = (name: string) => !keep.has(name) && a.getAttribute(name) !== b.getAttribute(name);\n let changed = false;\n // Live form state (what the user typed or ticked) is only overwritten when the server's\n // default actually changed, i.e. the *attribute* differs between old and new markup.\n const live =\n a instanceof HTMLInputElement && a.type !== 'file'\n ? ['value', 'checked']\n : a instanceof HTMLOptionElement\n ? ['selected']\n : [];\n for (const name of live) {\n if (differs(name)) {\n (a as any)[name] = name === 'value' ? (b.getAttribute(name) ?? '') : b.hasAttribute(name);\n changed = true;\n }\n }\n if (\n a instanceof HTMLTextAreaElement &&\n !keep.has('value') &&\n a.defaultValue !== (b as HTMLTextAreaElement).defaultValue\n ) {\n a.value = (b as HTMLTextAreaElement).defaultValue;\n changed = true;\n }\n for (const { name, value } of b.attributes)\n if (!keep.has(name) && a.getAttribute(name) !== value) a.setAttribute(name, value);\n for (const { name } of [...a.attributes]) if (!keep.has(name) && !b.hasAttribute(name)) a.removeAttribute(name);\n\n if (changed)\n (a instanceof HTMLOptionElement ? a.closest('select') : a)?.dispatchEvent(\n new Event('sigmx-prop-change', { bubbles: true }),\n );\n};\n\nconst morphNode = (a: Node, b: Node, ctx: Ctx): void => {\n if (a.nodeName !== b.nodeName) {\n fresh(b, (n) => (a as ChildNode).replaceWith(n));\n return;\n }\n if (!isEl(a) || !isEl(b)) {\n if (a.nodeValue !== b.nodeValue) a.nodeValue = b.nodeValue;\n return;\n }\n // A changed script must run again; patching its text or src in place would not execute it.\n if (b.localName === 'script' && !a.isEqualNode(b)) {\n fresh(b, (n) => a.replaceWith(n));\n return;\n }\n if (a.hasAttribute(ctx.ignore) && b.hasAttribute(ctx.ignore)) return;\n syncAttributes(a, b, ctx);\n if (a instanceof HTMLTemplateElement) a.innerHTML = b.innerHTML;\n else if (!a.isEqualNode(b)) morphChildren(a, b, ctx);\n};\n\nconst morphChildren = (parent: Node, next: Node, ctx: Ctx): void => {\n let cur: Node | null = parent.firstChild;\n /**\n * Remove old siblings from `cur` up to (not including) `stop`; returns whether `stop` was reached.\n * Kept elements inside removed subtrees stay referenced by `ctx.keep` and are pulled back in later.\n */\n const dropUntil = (stop: Node | null): boolean => {\n while (cur && cur !== stop) {\n const n = cur;\n cur = cur.nextSibling;\n // A kept element stays connected until `place` moves it, so focus, media and iframe state survive.\n if (!(isEl(n) && ctx.keep.get(n.id) === n)) (n as ChildNode).remove();\n }\n return cur === stop;\n };\n for (const nb of [...next.childNodes]) {\n const kept = isEl(nb) && ctx.keep.get(nb.id);\n if (kept) {\n // Ahead among the old siblings: drop what precedes it. Elsewhere (moved, or inside a removed\n // subtree): pull it in here and leave the remaining old siblings for the next new children.\n let m: Node | null = cur;\n while (m && m !== kept) m = m.nextSibling;\n if (m) {\n dropUntil(kept);\n cur = kept.nextSibling;\n } else place(parent, kept, cur);\n morphNode(kept, nb, ctx);\n continue;\n }\n let m: Node | null = cur;\n while (m && !compatible(m, nb)) m = m.nextSibling;\n if (m) {\n dropUntil(m);\n cur = m.nextSibling;\n morphNode(m, nb, ctx);\n } else if (isEl(nb) && containsKept(nb, ctx)) {\n // Build a shell (same element, attributes, no children) so the wanted descendants can be pulled in.\n const shell = document.importNode(nb, false);\n parent.insertBefore(shell, cur);\n morphNode(shell, nb, ctx);\n } else {\n fresh(nb, (n) => parent.insertBefore(n, cur));\n }\n }\n dropUntil(null);\n};\n\nconst context = (target: Node, next: Node, o: MorphOptions): Ctx => {\n const wanted = new Map(idsIn(next).map((e) => [e.id, e.tagName]));\n return {\n keep: new Map(idsIn(target).flatMap((e) => (wanted.get(e.id) === e.tagName ? [[e.id, e] as const] : []))),\n ignore: o.ignoreAttr ?? 'data-ignore-morph',\n preserve: o.preserveAttr ?? 'data-preserve-attr',\n };\n};\n\nexport const morph = (target: Element, next: Element, o: MorphOptions = {}): void => {\n morphNode(target, next, context(target, next, o));\n};\n\nexport const morphInner = (target: Element, next: ParentNode, o: MorphOptions = {}): void => {\n morphChildren(target, next, context(target, next, o));\n};\n"],
5
+ "mappings": "AAaA,MAAM,MAAM,oBAAI,QAAc;AAC9B,MAAM,OAAO,CAAC,MAAiC,GAAG,aAAa;AAGxD,MAAM,kBAAkB,CAAC,SAAqB;AACnD,MAAI,CAAC,KAAK,IAAI,EAAG;AACjB,aAAW,OAAO,CAAC,MAAM,GAAG,KAAK,iBAAiB,QAAQ,CAAC,GAA0B;AACnF,QAAI,CAAC,IAAI,QAAQ,QAAQ,KAAK,IAAI,IAAI,GAAG,EAAG;AAC5C,UAAM,IAAI,SAAS,cAAc,QAAQ;AACzC,eAAW,EAAE,MAAM,MAAM,KAAK,IAAI,WAAY,GAAE,aAAa,MAAM,KAAK;AACxE,MAAE,OAAO,IAAI;AACb,QAAI,IAAI,CAAC;AACT,QAAI,YAAY,CAAC;AAAA,EACnB;AACF;AAGA,MAAM,QAAQ,CAAC,GAAS,WAAoC;AAC1D,QAAM,IAAI,SAAS,WAAW,GAAG,IAAI;AACrC,SAAO,CAAC;AACR,kBAAgB,CAAC;AACnB;AAEA,MAAM,QAAQ,CAAC,MACb,CAAC,GAAG,GAAK,EAAiB,mBAAmB,MAAM,KAAK,CAAC,CAAE,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,KAAK,EAAE,EAAE;AAC5F,MAAM,eAAe,CAAC,GAAS,QAAsB,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,IAAI,EAA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