@shadow-js/web 1.0.0 → 1.0.2

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 (349) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/dev/attributes.d.ts +10 -5
  3. package/dist/dev/attributes.js +28 -51
  4. package/dist/dev/attributes.js.map +1 -1
  5. package/dist/dev/autofocus.d.ts +0 -2
  6. package/dist/dev/autofocus.js +1 -2
  7. package/dist/dev/class-style.d.ts +6 -4
  8. package/dist/dev/class-style.js +25 -9
  9. package/dist/dev/class-style.js.map +1 -1
  10. package/dist/dev/component.d.ts +0 -2
  11. package/dist/dev/component.js +1 -2
  12. package/dist/dev/control-flow/activity.d.ts +0 -2
  13. package/dist/dev/control-flow/activity.js +1 -2
  14. package/dist/dev/control-flow/branch.js +0 -1
  15. package/dist/dev/control-flow/client-only.d.ts +0 -2
  16. package/dist/dev/control-flow/client-only.js +1 -2
  17. package/dist/dev/control-flow/dynamic.d.ts +11 -4
  18. package/dist/dev/control-flow/dynamic.js +57 -41
  19. package/dist/dev/control-flow/dynamic.js.map +1 -1
  20. package/dist/dev/control-flow/error-boundary.d.ts +0 -2
  21. package/dist/dev/control-flow/error-boundary.js +1 -2
  22. package/dist/dev/control-flow/for.d.ts +0 -2
  23. package/dist/dev/control-flow/for.js +1 -2
  24. package/dist/dev/control-flow/fragment.d.ts +0 -2
  25. package/dist/dev/control-flow/fragment.js +1 -2
  26. package/dist/dev/control-flow/hot-link.js +1 -2
  27. package/dist/dev/control-flow/index-list.d.ts +0 -2
  28. package/dist/dev/control-flow/index-list.js +1 -2
  29. package/dist/dev/control-flow/lazy.d.ts +0 -2
  30. package/dist/dev/control-flow/lazy.js +1 -2
  31. package/dist/dev/control-flow/no-hydration.d.ts +0 -2
  32. package/dist/dev/control-flow/no-hydration.js +1 -2
  33. package/dist/dev/control-flow/portal.d.ts +0 -2
  34. package/dist/dev/control-flow/portal.js +3 -2
  35. package/dist/dev/control-flow/portal.js.map +1 -1
  36. package/dist/dev/control-flow/root-errors.d.ts +0 -2
  37. package/dist/dev/control-flow/root-errors.js +1 -2
  38. package/dist/dev/control-flow/show.d.ts +0 -2
  39. package/dist/dev/control-flow/show.js +1 -2
  40. package/dist/dev/control-flow/suspense-list.d.ts +0 -2
  41. package/dist/dev/control-flow/suspense-list.js +1 -2
  42. package/dist/dev/control-flow/suspense.d.ts +0 -2
  43. package/dist/dev/control-flow/suspense.js +1 -2
  44. package/dist/dev/control-flow/switch.d.ts +0 -2
  45. package/dist/dev/control-flow/switch.js +1 -2
  46. package/dist/dev/derived.d.ts +0 -2
  47. package/dist/dev/derived.js +1 -2
  48. package/dist/dev/element.d.ts +0 -2
  49. package/dist/dev/element.js +2 -3
  50. package/dist/dev/element.js.map +1 -1
  51. package/dist/dev/events.d.ts +0 -2
  52. package/dist/dev/events.js +16 -46
  53. package/dist/dev/events.js.map +1 -1
  54. package/dist/dev/head/components.d.ts +0 -2
  55. package/dist/dev/head/components.js +1 -2
  56. package/dist/dev/head/registry.js +1 -2
  57. package/dist/dev/head/server-head.d.ts +0 -2
  58. package/dist/dev/head/server-head.js +1 -2
  59. package/dist/dev/head/sink.js +1 -2
  60. package/dist/dev/head/use-head.d.ts +0 -2
  61. package/dist/dev/head/use-head.js +1 -2
  62. package/dist/dev/head/validate.d.ts +0 -2
  63. package/dist/dev/head/validate.js +1 -2
  64. package/dist/dev/hmr.d.ts +0 -2
  65. package/dist/dev/hmr.js +1 -2
  66. package/dist/dev/hydration.d.ts +0 -2
  67. package/dist/dev/hydration.js +1 -2
  68. package/dist/dev/insert.d.ts +15 -7
  69. package/dist/dev/insert.js +36 -15
  70. package/dist/dev/insert.js.map +1 -1
  71. package/dist/dev/internal/claim.d.ts +2 -3
  72. package/dist/dev/internal/claim.js +19 -4
  73. package/dist/dev/internal/claim.js.map +1 -1
  74. package/dist/dev/internal/css-units.js +1 -2
  75. package/dist/dev/internal/diagnostics.d.ts +7 -5
  76. package/dist/dev/internal/diagnostics.js +15 -6
  77. package/dist/dev/internal/diagnostics.js.map +1 -1
  78. package/dist/dev/internal/early-events.js +21 -4
  79. package/dist/dev/internal/early-events.js.map +1 -1
  80. package/dist/dev/internal/hydration-hooks.d.ts +0 -2
  81. package/dist/dev/internal/hydration-hooks.js +0 -1
  82. package/dist/dev/internal/hydration-scope.d.ts +0 -2
  83. package/dist/dev/internal/hydration-scope.js +1 -2
  84. package/dist/dev/internal/names.d.ts +0 -2
  85. package/dist/dev/internal/names.js +1 -2
  86. package/dist/dev/internal/portal-context.d.ts +0 -2
  87. package/dist/dev/internal/portal-context.js +1 -2
  88. package/dist/dev/internal/react-names.js +26 -63
  89. package/dist/dev/internal/react-names.js.map +1 -1
  90. package/dist/dev/internal/reconcile.d.ts +0 -2
  91. package/dist/dev/internal/reconcile.js +4 -8
  92. package/dist/dev/internal/reconcile.js.map +1 -1
  93. package/dist/dev/internal/stream-context.d.ts +0 -2
  94. package/dist/dev/internal/stream-context.js +1 -2
  95. package/dist/dev/jsx/aria.d.ts +0 -2
  96. package/dist/dev/jsx/component.d.ts +0 -2
  97. package/dist/dev/jsx/events.d.ts +0 -2
  98. package/dist/dev/jsx/global.d.ts +5 -4
  99. package/dist/dev/jsx/html.d.ts +1 -2
  100. package/dist/dev/jsx/intrinsic.d.ts +0 -2
  101. package/dist/dev/jsx/mathml.d.ts +0 -2
  102. package/dist/dev/jsx/svg.d.ts +0 -2
  103. package/dist/dev/jsx/types.d.ts +0 -2
  104. package/dist/dev/jsx-runtime.d.ts +0 -2
  105. package/dist/dev/reactive.d.ts +0 -2
  106. package/dist/dev/reactive.js +1 -2
  107. package/dist/dev/render.d.ts +0 -2
  108. package/dist/dev/render.js +1 -2
  109. package/dist/dev/resource-hints.d.ts +0 -2
  110. package/dist/dev/resource-hints.js +5 -4
  111. package/dist/dev/resource-hints.js.map +1 -1
  112. package/dist/dev/select-value.d.ts +0 -2
  113. package/dist/dev/select-value.js +6 -17
  114. package/dist/dev/select-value.js.map +1 -1
  115. package/dist/dev/server/attributes.d.ts +3 -2
  116. package/dist/dev/server/attributes.js +6 -3
  117. package/dist/dev/server/attributes.js.map +1 -1
  118. package/dist/dev/server/class-style.d.ts +0 -2
  119. package/dist/dev/server/class-style.js +1 -2
  120. package/dist/dev/server/component.d.ts +0 -2
  121. package/dist/dev/server/component.js +1 -2
  122. package/dist/dev/server/derived.d.ts +0 -2
  123. package/dist/dev/server/derived.js +1 -2
  124. package/dist/dev/server/element.d.ts +0 -2
  125. package/dist/dev/server/element.js +9 -6
  126. package/dist/dev/server/element.js.map +1 -1
  127. package/dist/dev/server/errors.js +8 -3
  128. package/dist/dev/server/errors.js.map +1 -1
  129. package/dist/dev/server/escape.d.ts +0 -2
  130. package/dist/dev/server/escape.js +15 -8
  131. package/dist/dev/server/escape.js.map +1 -1
  132. package/dist/dev/server/form-controls.d.ts +0 -2
  133. package/dist/dev/server/form-controls.js +6 -4
  134. package/dist/dev/server/form-controls.js.map +1 -1
  135. package/dist/dev/server/hydration-script.d.ts +0 -2
  136. package/dist/dev/server/hydration-script.js +1 -2
  137. package/dist/dev/server/index.d.ts +2 -1
  138. package/dist/dev/server/index.js +2 -1
  139. package/dist/dev/server/node.d.ts +0 -2
  140. package/dist/dev/server/node.js +1 -2
  141. package/dist/dev/server/portals.d.ts +0 -2
  142. package/dist/dev/server/portals.js +0 -1
  143. package/dist/dev/server/raw-text.d.ts +28 -0
  144. package/dist/dev/server/raw-text.js +66 -0
  145. package/dist/dev/server/raw-text.js.map +1 -0
  146. package/dist/dev/server/render.d.ts +2 -3
  147. package/dist/dev/server/render.js +3 -4
  148. package/dist/dev/server/render.js.map +1 -1
  149. package/dist/dev/server/serialize.d.ts +0 -2
  150. package/dist/dev/server/serialize.js +1 -2
  151. package/dist/dev/server/stream.d.ts +1 -3
  152. package/dist/dev/server/stream.js +3 -4
  153. package/dist/dev/server/stream.js.map +1 -1
  154. package/dist/dev/server.d.ts +2 -1
  155. package/dist/dev/server.js +2 -1
  156. package/dist/dev/spread.d.ts +0 -2
  157. package/dist/dev/spread.js +8 -56
  158. package/dist/dev/spread.js.map +1 -1
  159. package/dist/dev/template.d.ts +0 -2
  160. package/dist/dev/template.js +1 -2
  161. package/dist/dev/view-transition.d.ts +0 -2
  162. package/dist/dev/view-transition.js +1 -2
  163. package/dist/prod/attributes.js +1 -1
  164. package/dist/prod/attributes.js.map +1 -1
  165. package/dist/prod/class-style.js +1 -1
  166. package/dist/prod/class-style.js.map +1 -1
  167. package/dist/prod/control-flow/dynamic.js +1 -1
  168. package/dist/prod/control-flow/dynamic.js.map +1 -1
  169. package/dist/prod/control-flow/portal.js +1 -1
  170. package/dist/prod/control-flow/portal.js.map +1 -1
  171. package/dist/prod/element.js +1 -1
  172. package/dist/prod/element.js.map +1 -1
  173. package/dist/prod/events.js +1 -1
  174. package/dist/prod/events.js.map +1 -1
  175. package/dist/prod/insert.js +1 -1
  176. package/dist/prod/insert.js.map +1 -1
  177. package/dist/prod/internal/claim.js +1 -1
  178. package/dist/prod/internal/claim.js.map +1 -1
  179. package/dist/prod/internal/diagnostics.js +1 -1
  180. package/dist/prod/internal/diagnostics.js.map +1 -1
  181. package/dist/prod/internal/early-events.js +1 -1
  182. package/dist/prod/internal/early-events.js.map +1 -1
  183. package/dist/prod/internal/react-names.js +1 -1
  184. package/dist/prod/internal/react-names.js.map +1 -1
  185. package/dist/prod/internal/reconcile.js +1 -1
  186. package/dist/prod/internal/reconcile.js.map +1 -1
  187. package/dist/prod/resource-hints.js +1 -1
  188. package/dist/prod/resource-hints.js.map +1 -1
  189. package/dist/prod/select-value.js +1 -1
  190. package/dist/prod/select-value.js.map +1 -1
  191. package/dist/prod/server/attributes.js +1 -1
  192. package/dist/prod/server/attributes.js.map +1 -1
  193. package/dist/prod/server/element.js +1 -1
  194. package/dist/prod/server/element.js.map +1 -1
  195. package/dist/prod/server/errors.js +1 -1
  196. package/dist/prod/server/errors.js.map +1 -1
  197. package/dist/prod/server/escape.js +1 -1
  198. package/dist/prod/server/escape.js.map +1 -1
  199. package/dist/prod/server/form-controls.js +2 -2
  200. package/dist/prod/server/form-controls.js.map +1 -1
  201. package/dist/prod/server/index.js +1 -1
  202. package/dist/prod/server/raw-text.js +2 -0
  203. package/dist/prod/server/raw-text.js.map +1 -0
  204. package/dist/prod/server/render.js +1 -1
  205. package/dist/prod/server/render.js.map +1 -1
  206. package/dist/prod/server/stream.js +1 -1
  207. package/dist/prod/server/stream.js.map +1 -1
  208. package/dist/prod/server.js +1 -1
  209. package/dist/prod/spread.js +1 -1
  210. package/dist/prod/spread.js.map +1 -1
  211. package/dist/server/attributes.js +1 -1
  212. package/dist/server/attributes.js.map +1 -1
  213. package/dist/server/class-style.js +1 -1
  214. package/dist/server/class-style.js.map +1 -1
  215. package/dist/server/control-flow/dynamic.js +1 -1
  216. package/dist/server/control-flow/dynamic.js.map +1 -1
  217. package/dist/server/control-flow/portal.js +1 -1
  218. package/dist/server/control-flow/portal.js.map +1 -1
  219. package/dist/server/element.js +1 -1
  220. package/dist/server/element.js.map +1 -1
  221. package/dist/server/events.js +1 -1
  222. package/dist/server/events.js.map +1 -1
  223. package/dist/server/insert.js +1 -1
  224. package/dist/server/insert.js.map +1 -1
  225. package/dist/server/internal/claim.js +1 -1
  226. package/dist/server/internal/claim.js.map +1 -1
  227. package/dist/server/internal/diagnostics.js +1 -1
  228. package/dist/server/internal/diagnostics.js.map +1 -1
  229. package/dist/server/internal/early-events.js +1 -1
  230. package/dist/server/internal/early-events.js.map +1 -1
  231. package/dist/server/internal/react-names.js +1 -1
  232. package/dist/server/internal/react-names.js.map +1 -1
  233. package/dist/server/internal/reconcile.js +1 -1
  234. package/dist/server/internal/reconcile.js.map +1 -1
  235. package/dist/server/resource-hints.js +1 -1
  236. package/dist/server/resource-hints.js.map +1 -1
  237. package/dist/server/select-value.js +1 -1
  238. package/dist/server/select-value.js.map +1 -1
  239. package/dist/server/server/attributes.js +1 -1
  240. package/dist/server/server/attributes.js.map +1 -1
  241. package/dist/server/server/element.js +1 -1
  242. package/dist/server/server/element.js.map +1 -1
  243. package/dist/server/server/errors.js +1 -1
  244. package/dist/server/server/errors.js.map +1 -1
  245. package/dist/server/server/escape.js +1 -1
  246. package/dist/server/server/escape.js.map +1 -1
  247. package/dist/server/server/form-controls.js +2 -2
  248. package/dist/server/server/form-controls.js.map +1 -1
  249. package/dist/server/server/index.js +1 -1
  250. package/dist/server/server/raw-text.js +2 -0
  251. package/dist/server/server/raw-text.js.map +1 -0
  252. package/dist/server/server/render.js +1 -1
  253. package/dist/server/server/render.js.map +1 -1
  254. package/dist/server/server/stream.js +1 -1
  255. package/dist/server/server/stream.js.map +1 -1
  256. package/dist/server/server.js +1 -1
  257. package/dist/server/spread.js +1 -1
  258. package/dist/server/spread.js.map +1 -1
  259. package/dist/server-dev/attributes.js +28 -51
  260. package/dist/server-dev/attributes.js.map +1 -1
  261. package/dist/server-dev/autofocus.js +1 -2
  262. package/dist/server-dev/class-style.js +25 -9
  263. package/dist/server-dev/class-style.js.map +1 -1
  264. package/dist/server-dev/component.js +1 -2
  265. package/dist/server-dev/control-flow/activity.js +1 -2
  266. package/dist/server-dev/control-flow/branch.js +0 -1
  267. package/dist/server-dev/control-flow/client-only.js +1 -2
  268. package/dist/server-dev/control-flow/dynamic.js +23 -12
  269. package/dist/server-dev/control-flow/dynamic.js.map +1 -1
  270. package/dist/server-dev/control-flow/error-boundary.js +1 -2
  271. package/dist/server-dev/control-flow/for.js +1 -2
  272. package/dist/server-dev/control-flow/fragment.js +1 -2
  273. package/dist/server-dev/control-flow/hot-link.js +1 -2
  274. package/dist/server-dev/control-flow/index-list.js +1 -2
  275. package/dist/server-dev/control-flow/lazy.js +1 -2
  276. package/dist/server-dev/control-flow/no-hydration.js +1 -2
  277. package/dist/server-dev/control-flow/portal.js +3 -2
  278. package/dist/server-dev/control-flow/portal.js.map +1 -1
  279. package/dist/server-dev/control-flow/root-errors.js +1 -2
  280. package/dist/server-dev/control-flow/show.js +1 -2
  281. package/dist/server-dev/control-flow/suspense-list.js +1 -2
  282. package/dist/server-dev/control-flow/suspense.js +1 -2
  283. package/dist/server-dev/control-flow/switch.js +1 -2
  284. package/dist/server-dev/derived.js +1 -2
  285. package/dist/server-dev/element.js +4 -3
  286. package/dist/server-dev/element.js.map +1 -1
  287. package/dist/server-dev/events.js +16 -46
  288. package/dist/server-dev/events.js.map +1 -1
  289. package/dist/server-dev/head/components.js +1 -2
  290. package/dist/server-dev/head/registry.js +1 -2
  291. package/dist/server-dev/head/server-head.js +1 -2
  292. package/dist/server-dev/head/sink.js +1 -2
  293. package/dist/server-dev/head/use-head.js +1 -2
  294. package/dist/server-dev/head/validate.js +1 -2
  295. package/dist/server-dev/hydration.js +1 -2
  296. package/dist/server-dev/insert.js +36 -15
  297. package/dist/server-dev/insert.js.map +1 -1
  298. package/dist/server-dev/internal/claim.js +19 -4
  299. package/dist/server-dev/internal/claim.js.map +1 -1
  300. package/dist/server-dev/internal/css-units.js +1 -2
  301. package/dist/server-dev/internal/diagnostics.js +15 -6
  302. package/dist/server-dev/internal/diagnostics.js.map +1 -1
  303. package/dist/server-dev/internal/early-events.js +21 -4
  304. package/dist/server-dev/internal/early-events.js.map +1 -1
  305. package/dist/server-dev/internal/hydration-hooks.js +0 -1
  306. package/dist/server-dev/internal/hydration-scope.js +1 -2
  307. package/dist/server-dev/internal/names.js +1 -2
  308. package/dist/server-dev/internal/portal-context.js +1 -2
  309. package/dist/server-dev/internal/react-names.js +26 -63
  310. package/dist/server-dev/internal/react-names.js.map +1 -1
  311. package/dist/server-dev/internal/reconcile.js +4 -8
  312. package/dist/server-dev/internal/reconcile.js.map +1 -1
  313. package/dist/server-dev/internal/stream-context.js +1 -2
  314. package/dist/server-dev/reactive.js +1 -2
  315. package/dist/server-dev/render.js +1 -2
  316. package/dist/server-dev/resource-hints.js +5 -4
  317. package/dist/server-dev/resource-hints.js.map +1 -1
  318. package/dist/server-dev/select-value.js +6 -17
  319. package/dist/server-dev/select-value.js.map +1 -1
  320. package/dist/server-dev/server/attributes.js +6 -3
  321. package/dist/server-dev/server/attributes.js.map +1 -1
  322. package/dist/server-dev/server/class-style.js +1 -2
  323. package/dist/server-dev/server/component.js +1 -2
  324. package/dist/server-dev/server/derived.js +1 -2
  325. package/dist/server-dev/server/element.js +9 -6
  326. package/dist/server-dev/server/element.js.map +1 -1
  327. package/dist/server-dev/server/errors.js +8 -3
  328. package/dist/server-dev/server/errors.js.map +1 -1
  329. package/dist/server-dev/server/escape.js +15 -8
  330. package/dist/server-dev/server/escape.js.map +1 -1
  331. package/dist/server-dev/server/form-controls.js +6 -4
  332. package/dist/server-dev/server/form-controls.js.map +1 -1
  333. package/dist/server-dev/server/hydration-script.js +1 -2
  334. package/dist/server-dev/server/index.js +2 -1
  335. package/dist/server-dev/server/node.js +1 -2
  336. package/dist/server-dev/server/portals.js +0 -1
  337. package/dist/server-dev/server/raw-text.js +86 -0
  338. package/dist/server-dev/server/raw-text.js.map +1 -0
  339. package/dist/server-dev/server/render.js +3 -4
  340. package/dist/server-dev/server/render.js.map +1 -1
  341. package/dist/server-dev/server/serialize.js +1 -2
  342. package/dist/server-dev/server/stream.js +3 -4
  343. package/dist/server-dev/server/stream.js.map +1 -1
  344. package/dist/server-dev/server.js +2 -1
  345. package/dist/server-dev/spread.js +8 -56
  346. package/dist/server-dev/spread.js.map +1 -1
  347. package/dist/server-dev/template.js +1 -2
  348. package/dist/server-dev/view-transition.js +1 -2
  349. package/package.json +3 -2
@@ -1 +1 @@
1
- {"version":3,"file":"early-events.js","names":[],"sources":["../../../src/internal/early-events.ts"],"sourcesContent":["/**\n * Early event capture (ADR-016): a tiny inline script, placed before the bundle, records the events a\n * user makes before the application has hydrated. `hydrate()` then replays them once its handlers are\n * attached, so a click made while the page was still loading is not lost. The script is generated by\n * `generateHydrationScript` on the server; the replay is the client half, and it does nothing when the\n * page has no captured events.\n */\n\n/** The event types recorded when a page does not name its own. @internal */\nexport const DEFAULT_EARLY_EVENTS: readonly string[] = [\"click\", \"input\"];\n\n/** The window property the capture script writes. Its shape is checked before use. @internal */\nexport const EARLY_CAPTURE_KEY = \"__SHADOWJS_EARLY__\";\n\n/** Event names are plain lower-case words: anything else would end up inside the script text. */\nconst EVENT_NAME = /^[a-z]+$/;\n\n/**\n * The inline script body. A capture listener on the document (capture phase, so it sees events even\n * when a page stops their propagation) queues each event; the queue and the listener are kept on\n * `window` for the replay.\n * @internal\n */\nexport function captureScriptBody(names: readonly string[]): string {\n const list = JSON.stringify(names.filter((name) => EVENT_NAME.test(name)));\n return (\n \"(function(){var d=document,n=\" +\n list +\n \",q=[];function c(e){q.push(e)}\" +\n \"for(var i=0;i<n.length;i++)d.addEventListener(n[i],c,true);\" +\n `window.${EARLY_CAPTURE_KEY}={queue:q,names:n,listener:c};})();`\n );\n}\n\ninterface Capture {\n readonly queue: Event[];\n readonly names: string[];\n readonly listener: (event: Event) => void;\n}\n\n/** The capture the script left on the window, validated, or undefined. */\nfunction readCapture(): Capture | undefined {\n const value: unknown = Reflect.get(globalThis, EARLY_CAPTURE_KEY);\n if (typeof value !== \"object\" || value === null) return undefined;\n const queue: unknown = Reflect.get(value, \"queue\");\n const names: unknown = Reflect.get(value, \"names\");\n const listener: unknown = Reflect.get(value, \"listener\");\n if (!Array.isArray(queue) || !Array.isArray(names) || typeof listener !== \"function\") {\n return undefined;\n }\n const events = queue.filter((item): item is Event => item instanceof Event);\n const kinds = names.filter((name): name is string => typeof name === \"string\");\n return { queue: events, names: kinds, listener: listener as (event: Event) => void };\n}\n\n/** A new event of the same type that bubbles like the original and carries its pointer position. */\nfunction reissue(event: Event): Event {\n const init: EventInit = { bubbles: true, cancelable: event.cancelable, composed: true };\n if (event instanceof MouseEvent) {\n return new MouseEvent(event.type, {\n ...init,\n clientX: event.clientX,\n clientY: event.clientY,\n button: event.button,\n buttons: event.buttons,\n altKey: event.altKey,\n ctrlKey: event.ctrlKey,\n metaKey: event.metaKey,\n shiftKey: event.shiftKey,\n });\n }\n return new Event(event.type, init);\n}\n\n/**\n * Stops the capture and replays what it recorded, in order, on the elements they were made on. Called\n * by `hydrate()` after the handlers are attached. Does nothing when no capture ran.\n * @internal\n */\nexport function replayEarlyEvents(): void {\n const capture = readCapture();\n if (capture === undefined) return;\n Reflect.deleteProperty(globalThis, EARLY_CAPTURE_KEY);\n for (const name of capture.names) document.removeEventListener(name, capture.listener, true);\n for (const event of capture.queue) {\n const target = event.target;\n if (target instanceof Node) target.dispatchEvent(reissue(event));\n }\n}\n"],"mappings":";;;;;;;;;AASA,MAAa,uBAA0C,CAAC,SAAS,OAAO;;AAGxE,MAAa,oBAAoB;;AAGjC,MAAM,aAAa;;;;;;;AAQnB,SAAgB,kBAAkB,OAAkC;CAElE,OACE,kCAFW,KAAK,UAAU,MAAM,QAAQ,SAAS,WAAW,KAAK,IAAI,CAAC,CAGnE,IACH,mGAEU,kBAAkB;AAEhC;;AASA,SAAS,cAAmC;CAC1C,MAAM,QAAiB,QAAQ,IAAI,YAAY,iBAAiB;CAChE,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO,KAAA;CACxD,MAAM,QAAiB,QAAQ,IAAI,OAAO,OAAO;CACjD,MAAM,QAAiB,QAAQ,IAAI,OAAO,OAAO;CACjD,MAAM,WAAoB,QAAQ,IAAI,OAAO,UAAU;CACvD,IAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,CAAC,MAAM,QAAQ,KAAK,KAAK,OAAO,aAAa,YACxE;CAIF,OAAO;EAAE,OAFM,MAAM,QAAQ,SAAwB,gBAAgB,KAEhD;EAAG,OADV,MAAM,QAAQ,SAAyB,OAAO,SAAS,QAClC;EAAa;CAAmC;AACrF;;AAGA,SAAS,QAAQ,OAAqB;CACpC,MAAM,OAAkB;EAAE,SAAS;EAAM,YAAY,MAAM;EAAY,UAAU;CAAK;CACtF,IAAI,iBAAiB,YACnB,OAAO,IAAI,WAAW,MAAM,MAAM;EAChC,GAAG;EACH,SAAS,MAAM;EACf,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,SAAS,MAAM;EACf,SAAS,MAAM;EACf,UAAU,MAAM;CAClB,CAAC;CAEH,OAAO,IAAI,MAAM,MAAM,MAAM,IAAI;AACnC;;;;;;AAOA,SAAgB,oBAA0B;CACxC,MAAM,UAAU,YAAY;CAC5B,IAAI,YAAY,KAAA,GAAW;CAC3B,QAAQ,eAAe,YAAY,iBAAiB;CACpD,KAAK,MAAM,QAAQ,QAAQ,OAAO,SAAS,oBAAoB,MAAM,QAAQ,UAAU,IAAI;CAC3F,KAAK,MAAM,SAAS,QAAQ,OAAO;EACjC,MAAM,SAAS,MAAM;EACrB,IAAI,kBAAkB,MAAM,OAAO,cAAc,QAAQ,KAAK,CAAC;CACjE;AACF"}
1
+ {"version":3,"file":"early-events.js","names":[],"sources":["../../../src/internal/early-events.ts"],"sourcesContent":["/**\n * Early event capture (ADR-016): a tiny inline script, placed before the bundle, records the events a\n * user makes before the application has hydrated. `hydrate()` then replays them once its handlers are\n * attached, so a click made while the page was still loading is not lost. The script is generated by\n * `generateHydrationScript` on the server; the replay is the client half, and it does nothing when the\n * page has no captured events.\n */\n\n/** The event types recorded when a page does not name its own. @internal */\nexport const DEFAULT_EARLY_EVENTS: readonly string[] = [\"click\", \"input\"];\n\n/** The window property the capture script writes. Its shape is checked before use. @internal */\nexport const EARLY_CAPTURE_KEY = \"__SHADOWJS_EARLY__\";\n\n/**\n * The most events the capture script keeps. A page whose bundle never loads would otherwise hold every\n * click and keystroke of the visit; the first ones are the ones worth replaying. @internal\n */\nexport const MAX_EARLY_EVENTS = 100;\n\n/** Event names are plain lower-case words: anything else would end up inside the script text. */\nconst EVENT_NAME = /^[a-z]+$/;\n\n/**\n * The inline script body. A capture listener on the document (capture phase, so it sees events even\n * when a page stops their propagation) queues each event; the queue and the listener are kept on\n * `window` for the replay.\n * @internal\n */\nexport function captureScriptBody(names: readonly string[]): string {\n const list = JSON.stringify(names.filter((name) => EVENT_NAME.test(name)));\n return (\n \"(function(){var d=document,n=\" +\n list +\n `,q=[];function c(e){if(q.length<${MAX_EARLY_EVENTS})q.push(e)}` +\n \"for(var i=0;i<n.length;i++)d.addEventListener(n[i],c,true);\" +\n `window.${EARLY_CAPTURE_KEY}={queue:q,names:n,listener:c};})();`\n );\n}\n\ninterface Capture {\n readonly queue: Event[];\n readonly names: string[];\n readonly listener: (event: Event) => void;\n}\n\n/** The capture the script left on the window, validated, or undefined. */\nfunction readCapture(): Capture | undefined {\n const value: unknown = Reflect.get(globalThis, EARLY_CAPTURE_KEY);\n if (typeof value !== \"object\" || value === null) return undefined;\n const queue: unknown = Reflect.get(value, \"queue\");\n const names: unknown = Reflect.get(value, \"names\");\n const listener: unknown = Reflect.get(value, \"listener\");\n if (!Array.isArray(queue) || !Array.isArray(names) || typeof listener !== \"function\") {\n return undefined;\n }\n const events = queue.filter((item): item is Event => item instanceof Event);\n const kinds = names.filter((name): name is string => typeof name === \"string\");\n return { queue: events, names: kinds, listener: listener as (event: Event) => void };\n}\n\n/** A new event of the same type that bubbles like the original and carries its pointer position. */\nfunction reissue(event: Event): Event {\n const init: EventInit = { bubbles: true, cancelable: event.cancelable, composed: true };\n if (event instanceof MouseEvent) {\n return new MouseEvent(event.type, {\n ...init,\n clientX: event.clientX,\n clientY: event.clientY,\n button: event.button,\n buttons: event.buttons,\n altKey: event.altKey,\n ctrlKey: event.ctrlKey,\n metaKey: event.metaKey,\n shiftKey: event.shiftKey,\n });\n }\n return new Event(event.type, init);\n}\n\n/**\n * Stops the capture and replays what it recorded, in order, on the elements they were made on. Called\n * by `hydrate()` after the handlers are attached. Does nothing when no capture ran.\n * @internal\n */\nexport function replayEarlyEvents(): void {\n const capture = readCapture();\n if (capture === undefined) return;\n Reflect.deleteProperty(globalThis, EARLY_CAPTURE_KEY);\n for (const name of capture.names) document.removeEventListener(name, capture.listener, true);\n for (const event of capture.queue) {\n const target = event.target;\n if (target instanceof Node) target.dispatchEvent(withoutDefaultAction(reissue(event)));\n }\n}\n\n/**\n * The replayed event runs the page's handlers, not the browser's default action: the real event\n * already ran it when the user made it. A dispatched `click` on a link follows the link, so without\n * this a link was followed twice. The native flag is set right away, which cancels the default action,\n * and the handlers still see `defaultPrevented` as false (a router skips a click that is already\n * prevented) until one of them prevents it itself.\n */\nfunction withoutDefaultAction(event: Event): Event {\n event.preventDefault();\n let prevented = false;\n Object.defineProperties(event, {\n defaultPrevented: { get: () => prevented },\n preventDefault: {\n value: () => {\n prevented = true;\n },\n },\n });\n return event;\n}\n"],"mappings":";;;;;;;;;AASA,MAAa,uBAA0C,CAAC,SAAS,OAAO;;AAGxE,MAAa,oBAAoB;;AASjC,MAAM,aAAa;;;;;;;AAQnB,SAAgB,kBAAkB,OAAkC;CAElE,OACE,kCAFW,KAAK,UAAU,MAAM,QAAQ,SAAS,WAAW,KAAK,IAAI,CAAC,CAGnE,IACH,mHAEU,kBAAkB;AAEhC;;AASA,SAAS,cAAmC;CAC1C,MAAM,QAAiB,QAAQ,IAAI,YAAY,iBAAiB;CAChE,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO,KAAA;CACxD,MAAM,QAAiB,QAAQ,IAAI,OAAO,OAAO;CACjD,MAAM,QAAiB,QAAQ,IAAI,OAAO,OAAO;CACjD,MAAM,WAAoB,QAAQ,IAAI,OAAO,UAAU;CACvD,IAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,CAAC,MAAM,QAAQ,KAAK,KAAK,OAAO,aAAa,YACxE;CAIF,OAAO;EAAE,OAFM,MAAM,QAAQ,SAAwB,gBAAgB,KAEhD;EAAG,OADV,MAAM,QAAQ,SAAyB,OAAO,SAAS,QAClC;EAAa;CAAmC;AACrF;;AAGA,SAAS,QAAQ,OAAqB;CACpC,MAAM,OAAkB;EAAE,SAAS;EAAM,YAAY,MAAM;EAAY,UAAU;CAAK;CACtF,IAAI,iBAAiB,YACnB,OAAO,IAAI,WAAW,MAAM,MAAM;EAChC,GAAG;EACH,SAAS,MAAM;EACf,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,SAAS,MAAM;EACf,SAAS,MAAM;EACf,UAAU,MAAM;CAClB,CAAC;CAEH,OAAO,IAAI,MAAM,MAAM,MAAM,IAAI;AACnC;;;;;;AAOA,SAAgB,oBAA0B;CACxC,MAAM,UAAU,YAAY;CAC5B,IAAI,YAAY,KAAA,GAAW;CAC3B,QAAQ,eAAe,YAAY,iBAAiB;CACpD,KAAK,MAAM,QAAQ,QAAQ,OAAO,SAAS,oBAAoB,MAAM,QAAQ,UAAU,IAAI;CAC3F,KAAK,MAAM,SAAS,QAAQ,OAAO;EACjC,MAAM,SAAS,MAAM;EACrB,IAAI,kBAAkB,MAAM,OAAO,cAAc,qBAAqB,QAAQ,KAAK,CAAC,CAAC;CACvF;AACF;;;;;;;;AASA,SAAS,qBAAqB,OAAqB;CACjD,MAAM,eAAe;CACrB,IAAI,YAAY;CAChB,OAAO,iBAAiB,OAAO;EAC7B,kBAAkB,EAAE,WAAW,UAAU;EACzC,gBAAgB,EACd,aAAa;GACX,YAAY;EACd,EACF;CACF,CAAC;CACD,OAAO;AACT"}
@@ -1,4 +1,3 @@
1
- //#region src/internal/hydration-hooks.d.ts
2
1
  /**
3
2
  * The claiming half of hydration, as a hook. `hydrate()` installs the real implementation for the
4
3
  * length of its pass; outside a pass the hooks are idle: nothing is claimed, and the renderer builds
@@ -39,5 +38,4 @@ export interface Claims {
39
38
  export declare const claims: {
40
39
  current: Claims;
41
40
  };
42
- //#endregion
43
41
  //# sourceMappingURL=hydration-hooks.d.ts.map
@@ -21,7 +21,6 @@ const claims = { current: {
21
21
  isClaiming: () => false,
22
22
  withoutClaiming: (fn) => fn()
23
23
  } };
24
- //#endregion
25
24
  export { claims };
26
25
 
27
26
  //# sourceMappingURL=hydration-hooks.js.map
@@ -1,4 +1,3 @@
1
- //#region src/internal/hydration-scope.d.ts
2
1
  /**
3
2
  * A hydration scope: the deterministic source of hydration keys shared by the server renderer and
4
3
  * the client hydrator. Keys depend only on the nesting and order of component calls, never on owners,
@@ -127,5 +126,4 @@ export declare function resourceKey(explicit: string | undefined): string;
127
126
  * @since 1.0.0
128
127
  */
129
128
  export declare function childScope(key: string | undefined): HydrationScope | null;
130
- //#endregion
131
129
  //# sourceMappingURL=hydration-scope.d.ts.map
@@ -1,4 +1,4 @@
1
- //#region src/internal/hydration-scope.ts
1
+ // src/internal/hydration-scope.ts
2
2
  let current = null;
3
3
  /**
4
4
  * Creates the scope a render or a hydration starts from: what `renderToString` and `hydrate()` put in
@@ -150,7 +150,6 @@ function childScope(key) {
150
150
  resources: 0
151
151
  };
152
152
  }
153
- //#endregion
154
153
  export { childScope, createRootScope, currentScope, enterComponent, nextKey, resourceKey, withScope };
155
154
 
156
155
  //# sourceMappingURL=hydration-scope.js.map
@@ -1,4 +1,3 @@
1
- //#region src/internal/names.d.ts
2
1
  /**
3
2
  * The XHTML namespace URI: the `namespaceURI` of ordinary HTML elements.
4
3
  *
@@ -29,5 +28,4 @@ export declare const SVG_NS = "http://www.w3.org/2000/svg";
29
28
  * @since 1.0.0
30
29
  */
31
30
  export declare const MATHML_NS = "http://www.w3.org/1998/Math/MathML";
32
- //#endregion
33
31
  //# sourceMappingURL=names.d.ts.map
@@ -1,4 +1,4 @@
1
- //#region src/internal/names.ts
1
+ // src/internal/names.ts
2
2
  /**
3
3
  * The XHTML namespace URI: the `namespaceURI` of ordinary HTML elements.
4
4
  *
@@ -29,7 +29,6 @@ const SVG_NS = "http://www.w3.org/2000/svg";
29
29
  * @since 1.0.0
30
30
  */
31
31
  const MATHML_NS = "http://www.w3.org/1998/Math/MathML";
32
- //#endregion
33
32
  export { HTML_NS, MATHML_NS, SVG_NS };
34
33
 
35
34
  //# sourceMappingURL=names.js.map
@@ -1,5 +1,4 @@
1
1
  import { Context } from "@shadow-js/core";
2
- //#region src/internal/portal-context.d.ts
3
2
  /**
4
3
  * Receives the markup of the portals a server render produces: what {@link PortalContext} provides
5
4
  * when the render was given a `portals` collector.
@@ -35,5 +34,4 @@ export interface PortalSink {
35
34
  * @since 1.0.0
36
35
  */
37
36
  export declare const PortalContext: Context<PortalSink | null>;
38
- //#endregion
39
37
  //# sourceMappingURL=portal-context.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { createContext } from "@shadow-js/core";
2
- //#region src/internal/portal-context.ts
2
+ // src/internal/portal-context.ts
3
3
  /**
4
4
  * The context through which a server render hands portals their collector: the renderers provide it
5
5
  * when they are given a `portals` option (see `createServerPortals`). A custom portal reads it on the
@@ -22,7 +22,6 @@ import { createContext } from "@shadow-js/core";
22
22
  * @since 1.0.0
23
23
  */
24
24
  const PortalContext = /* @__PURE__ */ createContext(null, { name: "Portal" });
25
- //#endregion
26
25
  export { PortalContext };
27
26
 
28
27
  //# sourceMappingURL=portal-context.js.map
@@ -1,4 +1,4 @@
1
- //#region src/internal/react-names.ts
1
+ // src/internal/react-names.ts
2
2
  /**
3
3
  * React spellings at run time: the attribute and event names that a props object (a spread) passes
4
4
  * through. The compiler resolves the same names at build time (`packages/compiler/src/internal/
@@ -11,22 +11,16 @@
11
11
  * `stroke-width`). A camelCase name whose first word is one of these families is hyphenated. The
12
12
  * families are the first words of the CSS properties SVG takes as attributes, so one rule covers the
13
13
  * presentation list. The compiler's table (`packages/compiler/src/internal/react-names.ts`) lists the
14
- * same names, and a test checks each one.
14
+ * same names, and a test checks each one. The exceptions are SVG attributes that start with a family but are
15
+ * not CSS properties (`clipPathUnits`, `markerWidth`): they are camelCase in SVG, so they keep their case.
15
16
  */
16
- const SVG_PROPERTY_FAMILY = /^(?:alignment|baseline|clip|color|dominant|enable|fill|flood|font|glyph|image|letter|lighting|marker|mask|mix|paint|pointer|shape|stop|stroke|text|transform|unicode|vector|white|word|writing)(?=[A-Z])/;
17
- /**
18
- * SVG attributes that start with a property family but are not CSS properties (`clipPathUnits`,
19
- * `markerWidth`): they are camelCase in SVG, so they keep their case.
20
- */
21
- const SVG_CAMEL_ATTRIBUTES = /* @__PURE__ */ new Set([
22
- "clipPathUnits",
23
- "glyphRef",
24
- "markerHeight",
25
- "markerUnits",
26
- "markerWidth",
27
- "maskContentUnits",
28
- "maskUnits",
29
- "textLength"
17
+ const SVG_PROPERTY_FAMILY = /^(?!clipPathUnits|glyphRef|marker(?:Height|Units|Width)|mask(?:Content)?Units|textLength)(?:alignment|baseline|clip|color|dominant|enable|fill|flood|font|glyph|image|letter|lighting|marker|mask|mix|paint|pointer|shape|stop|stroke|text|transform|unicode|vector|white|word|writing)(?=[A-Z])/;
18
+ /** React names whose attribute differs from the lower-cased key, in HTML and SVG alike. */
19
+ const RENAMED = /* @__PURE__ */ new Map([
20
+ ["className", "class"],
21
+ ["htmlFor", "for"],
22
+ ["httpEquiv", "http-equiv"],
23
+ ["acceptCharset", "accept-charset"]
30
24
  ]);
31
25
  /**
32
26
  * The attribute name for a props key on an element: HTML names are lower case (what the parser and
@@ -35,28 +29,27 @@ const SVG_CAMEL_ATTRIBUTES = /* @__PURE__ */ new Set([
35
29
  * @internal
36
30
  */
37
31
  function attributeName(name, svg) {
38
- if (name === "className") return "class";
39
- if (name === "htmlFor") return "for";
40
- if (name === "httpEquiv") return "http-equiv";
41
- if (name === "acceptCharset") return "accept-charset";
32
+ const renamed = RENAMED.get(name);
33
+ if (renamed !== void 0) return renamed;
42
34
  if (!svg) return name.toLowerCase();
43
35
  if (name.includes(":")) return name;
44
- const xlink = /^xlink([A-Z].*)$/.exec(name);
45
- if (xlink !== null) return `xlink:${lowerFirst(xlink[1] ?? "")}`;
46
- const xml = /^xml([A-Z].*)$/.exec(name);
47
- if (xml !== null) return `xml:${lowerFirst(xml[1] ?? "")}`;
48
- if (SVG_CAMEL_ATTRIBUTES.has(name) || !SVG_PROPERTY_FAMILY.test(name)) return name;
36
+ const prefixed = /^(xlink|xml)([A-Z])(.*)$/.exec(name);
37
+ if (prefixed !== null) return `${prefixed[1]}:${prefixed[2]?.toLowerCase()}${prefixed[3]}`;
38
+ if (!SVG_PROPERTY_FAMILY.test(name)) return name;
49
39
  return name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
50
40
  }
51
- function lowerFirst(text) {
52
- return text.replace(/^[A-Z]/, (letter) => letter.toLowerCase());
53
- }
54
41
  /** Props that have no DOM form: a spread ignores them (React's `key` and hydration flags). @internal */
55
42
  const IGNORED_KEYS = /* @__PURE__ */ new Set([
56
43
  "key",
57
44
  "suppressHydrationWarning",
58
45
  "suppressContentEditableWarning"
59
46
  ]);
47
+ /** React events that bubble under another name. */
48
+ const REACT_EVENTS = /* @__PURE__ */ new Map([
49
+ ["focus", "focusin"],
50
+ ["blur", "focusout"],
51
+ ["doubleclick", "dblclick"]
52
+ ]);
60
53
  const CHANGE_ON_TYPES = /* @__PURE__ */ new Set([
61
54
  "checkbox",
62
55
  "radio",
@@ -72,45 +65,15 @@ const CHANGE_ON_TYPES = /* @__PURE__ */ new Set([
72
65
  function eventPlan(attribute, tag, type) {
73
66
  const reactSpelling = /^on[A-Z]/.test(attribute);
74
67
  const capture = reactSpelling && attribute.endsWith("Capture");
75
- const base = attribute.slice(2, capture ? -7 : void 0);
76
- if (!reactSpelling) return {
77
- type: base.toLowerCase(),
78
- capture: false,
79
- passive: false
80
- };
81
- const lower = base.toLowerCase();
82
- if (lower === "change") return {
83
- type: tag === "textarea" || tag === "input" && (type === null || !CHANGE_ON_TYPES.has(type)) ? "input" : "change",
84
- capture,
85
- passive: false
86
- };
87
- if (lower === "focus") return {
88
- type: "focusin",
89
- capture,
90
- passive: false
91
- };
92
- if (lower === "blur") return {
93
- type: "focusout",
94
- capture,
95
- passive: false
96
- };
97
- if (lower === "doubleclick") return {
98
- type: "dblclick",
99
- capture,
100
- passive: false
101
- };
102
- if (lower === "wheel") return {
103
- type: "wheel",
104
- capture,
105
- passive: !capture
106
- };
68
+ const lower = attribute.slice(2, capture ? -7 : void 0).toLowerCase();
69
+ let planned = lower;
70
+ if (reactSpelling) planned = lower === "change" ? tag === "textarea" || tag === "input" && (type === null || !CHANGE_ON_TYPES.has(type)) ? "input" : "change" : REACT_EVENTS.get(lower) ?? lower;
107
71
  return {
108
- type: lower,
72
+ type: planned,
109
73
  capture,
110
- passive: false
74
+ passive: reactSpelling && lower === "wheel" && !capture
111
75
  };
112
76
  }
113
- //#endregion
114
77
  export { IGNORED_KEYS, attributeName, eventPlan };
115
78
 
116
79
  //# sourceMappingURL=react-names.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-names.js","names":[],"sources":["../../../src/internal/react-names.ts"],"sourcesContent":["/**\n * React spellings at run time: the attribute and event names that a props object (a spread) passes\n * through. The compiler resolves the same names at build time (`packages/compiler/src/internal/\n * react-names.ts`); a test keeps the two presentation lists equal, so keep them in step.\n *\n * @internal\n */\n\n/**\n * SVG presentation attributes are CSS properties, and React spells them in camelCase (`strokeWidth` is\n * `stroke-width`). A camelCase name whose first word is one of these families is hyphenated. The\n * families are the first words of the CSS properties SVG takes as attributes, so one rule covers the\n * presentation list. The compiler's table (`packages/compiler/src/internal/react-names.ts`) lists the\n * same names, and a test checks each one.\n */\nconst SVG_PROPERTY_FAMILY =\n /^(?:alignment|baseline|clip|color|dominant|enable|fill|flood|font|glyph|image|letter|lighting|marker|mask|mix|paint|pointer|shape|stop|stroke|text|transform|unicode|vector|white|word|writing)(?=[A-Z])/;\n\n/**\n * SVG attributes that start with a property family but are not CSS properties (`clipPathUnits`,\n * `markerWidth`): they are camelCase in SVG, so they keep their case.\n */\nconst SVG_CAMEL_ATTRIBUTES: ReadonlySet<string> = new Set([\n \"clipPathUnits\",\n \"glyphRef\",\n \"markerHeight\",\n \"markerUnits\",\n \"markerWidth\",\n \"maskContentUnits\",\n \"maskUnits\",\n \"textLength\",\n]);\n\n/**\n * The attribute name for a props key on an element: HTML names are lower case (what the parser and\n * `setAttribute` write anyway, and what server markup needs); SVG presentation names are hyphenated,\n * `xlinkHref` and `xmlLang` take their prefix, and other SVG names keep their case (`viewBox`).\n * @internal\n */\nexport function attributeName(name: string, svg: boolean): string {\n if (name === \"className\") return \"class\";\n if (name === \"htmlFor\") return \"for\";\n if (name === \"httpEquiv\") return \"http-equiv\";\n if (name === \"acceptCharset\") return \"accept-charset\";\n if (!svg) return name.toLowerCase();\n if (name.includes(\":\")) return name;\n const xlink = /^xlink([A-Z].*)$/.exec(name);\n if (xlink !== null) return `xlink:${lowerFirst(xlink[1] ?? \"\")}`;\n const xml = /^xml([A-Z].*)$/.exec(name);\n if (xml !== null) return `xml:${lowerFirst(xml[1] ?? \"\")}`;\n if (SVG_CAMEL_ATTRIBUTES.has(name) || !SVG_PROPERTY_FAMILY.test(name)) return name;\n return name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n}\n\nfunction lowerFirst(text: string): string {\n return text.replace(/^[A-Z]/, (letter) => letter.toLowerCase());\n}\n\n/** Props that have no DOM form: a spread ignores them (React's `key` and hydration flags). @internal */\nexport const IGNORED_KEYS: ReadonlySet<string> = new Set([\n \"key\",\n \"suppressHydrationWarning\",\n \"suppressContentEditableWarning\",\n]);\n\n/** The DOM event for a React-spelled prop (see the compiler's `eventPlan`). @internal */\nexport interface EventPlan {\n readonly type: string;\n readonly capture: boolean;\n readonly passive: boolean;\n}\n\nconst CHANGE_ON_TYPES: ReadonlySet<string> = new Set([\"checkbox\", \"radio\", \"file\"]);\n\n/**\n * Plans the DOM event for an `on*` prop. React's spellings follow React: `onChange` is the per-edit\n * `input` event on text inputs and textareas and the `change` event on other controls; `onFocus` and\n * `onBlur` bubble as `focusin` and `focusout`; a `...Capture` suffix binds the capture phase; `onWheel`\n * is passive. A lower-case `on` spelling is the native event.\n * @internal\n */\nexport function eventPlan(attribute: string, tag: string, type: string | null): EventPlan {\n const reactSpelling = /^on[A-Z]/.test(attribute);\n const capture = reactSpelling && attribute.endsWith(\"Capture\");\n const base = attribute.slice(2, capture ? -\"Capture\".length : undefined);\n if (!reactSpelling) return { type: base.toLowerCase(), capture: false, passive: false };\n const lower = base.toLowerCase();\n if (lower === \"change\") {\n const perEdit =\n tag === \"textarea\" || (tag === \"input\" && (type === null || !CHANGE_ON_TYPES.has(type)));\n return { type: perEdit ? \"input\" : \"change\", capture, passive: false };\n }\n if (lower === \"focus\") return { type: \"focusin\", capture, passive: false };\n if (lower === \"blur\") return { type: \"focusout\", capture, passive: false };\n if (lower === \"doubleclick\") return { type: \"dblclick\", capture, passive: false };\n if (lower === \"wheel\") return { type: \"wheel\", capture, passive: !capture };\n return { type: lower, capture, passive: false };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,sBACJ;;;;;AAMF,MAAM,uCAA4C,IAAI,IAAI;CACxD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;;;AAQD,SAAgB,cAAc,MAAc,KAAsB;CAChE,IAAI,SAAS,aAAa,OAAO;CACjC,IAAI,SAAS,WAAW,OAAO;CAC/B,IAAI,SAAS,aAAa,OAAO;CACjC,IAAI,SAAS,iBAAiB,OAAO;CACrC,IAAI,CAAC,KAAK,OAAO,KAAK,YAAY;CAClC,IAAI,KAAK,SAAS,GAAG,GAAG,OAAO;CAC/B,MAAM,QAAQ,mBAAmB,KAAK,IAAI;CAC1C,IAAI,UAAU,MAAM,OAAO,SAAS,WAAW,MAAM,MAAM,EAAE;CAC7D,MAAM,MAAM,iBAAiB,KAAK,IAAI;CACtC,IAAI,QAAQ,MAAM,OAAO,OAAO,WAAW,IAAI,MAAM,EAAE;CACvD,IAAI,qBAAqB,IAAI,IAAI,KAAK,CAAC,oBAAoB,KAAK,IAAI,GAAG,OAAO;CAC9E,OAAO,KAAK,QAAQ,WAAW,WAAW,IAAI,OAAO,YAAY,GAAG;AACtE;AAEA,SAAS,WAAW,MAAsB;CACxC,OAAO,KAAK,QAAQ,WAAW,WAAW,OAAO,YAAY,CAAC;AAChE;;AAGA,MAAa,+BAAoC,IAAI,IAAI;CACvD;CACA;CACA;AACF,CAAC;AASD,MAAM,kCAAuC,IAAI,IAAI;CAAC;CAAY;CAAS;AAAM,CAAC;;;;;;;;AASlF,SAAgB,UAAU,WAAmB,KAAa,MAAgC;CACxF,MAAM,gBAAgB,WAAW,KAAK,SAAS;CAC/C,MAAM,UAAU,iBAAiB,UAAU,SAAS,SAAS;CAC7D,MAAM,OAAO,UAAU,MAAM,GAAG,UAAU,KAAoB,KAAA,CAAS;CACvE,IAAI,CAAC,eAAe,OAAO;EAAE,MAAM,KAAK,YAAY;EAAG,SAAS;EAAO,SAAS;CAAM;CACtF,MAAM,QAAQ,KAAK,YAAY;CAC/B,IAAI,UAAU,UAGZ,OAAO;EAAE,MADP,QAAQ,cAAe,QAAQ,YAAY,SAAS,QAAQ,CAAC,gBAAgB,IAAI,IAAI,KAC9D,UAAU;EAAU;EAAS,SAAS;CAAM;CAEvE,IAAI,UAAU,SAAS,OAAO;EAAE,MAAM;EAAW;EAAS,SAAS;CAAM;CACzE,IAAI,UAAU,QAAQ,OAAO;EAAE,MAAM;EAAY;EAAS,SAAS;CAAM;CACzE,IAAI,UAAU,eAAe,OAAO;EAAE,MAAM;EAAY;EAAS,SAAS;CAAM;CAChF,IAAI,UAAU,SAAS,OAAO;EAAE,MAAM;EAAS;EAAS,SAAS,CAAC;CAAQ;CAC1E,OAAO;EAAE,MAAM;EAAO;EAAS,SAAS;CAAM;AAChD"}
1
+ {"version":3,"file":"react-names.js","names":[],"sources":["../../../src/internal/react-names.ts"],"sourcesContent":["/**\n * React spellings at run time: the attribute and event names that a props object (a spread) passes\n * through. The compiler resolves the same names at build time (`packages/compiler/src/internal/\n * react-names.ts`); a test keeps the two presentation lists equal, so keep them in step.\n *\n * @internal\n */\n\n/**\n * SVG presentation attributes are CSS properties, and React spells them in camelCase (`strokeWidth` is\n * `stroke-width`). A camelCase name whose first word is one of these families is hyphenated. The\n * families are the first words of the CSS properties SVG takes as attributes, so one rule covers the\n * presentation list. The compiler's table (`packages/compiler/src/internal/react-names.ts`) lists the\n * same names, and a test checks each one. The exceptions are SVG attributes that start with a family but are\n * not CSS properties (`clipPathUnits`, `markerWidth`): they are camelCase in SVG, so they keep their case.\n */\nconst SVG_PROPERTY_FAMILY =\n /^(?!clipPathUnits|glyphRef|marker(?:Height|Units|Width)|mask(?:Content)?Units|textLength)(?:alignment|baseline|clip|color|dominant|enable|fill|flood|font|glyph|image|letter|lighting|marker|mask|mix|paint|pointer|shape|stop|stroke|text|transform|unicode|vector|white|word|writing)(?=[A-Z])/;\n\n/** React names whose attribute differs from the lower-cased key, in HTML and SVG alike. */\nconst RENAMED: ReadonlyMap<string, string> = new Map([\n [\"className\", \"class\"],\n [\"htmlFor\", \"for\"],\n [\"httpEquiv\", \"http-equiv\"],\n [\"acceptCharset\", \"accept-charset\"],\n]);\n\n/**\n * The attribute name for a props key on an element: HTML names are lower case (what the parser and\n * `setAttribute` write anyway, and what server markup needs); SVG presentation names are hyphenated,\n * `xlinkHref` and `xmlLang` take their prefix, and other SVG names keep their case (`viewBox`).\n * @internal\n */\nexport function attributeName(name: string, svg: boolean): string {\n const renamed = RENAMED.get(name);\n if (renamed !== undefined) return renamed;\n if (!svg) return name.toLowerCase();\n if (name.includes(\":\")) return name;\n const prefixed = /^(xlink|xml)([A-Z])(.*)$/.exec(name);\n if (prefixed !== null) return `${prefixed[1]}:${prefixed[2]?.toLowerCase()}${prefixed[3]}`;\n if (!SVG_PROPERTY_FAMILY.test(name)) return name;\n return name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n}\n\n/** Props that have no DOM form: a spread ignores them (React's `key` and hydration flags). @internal */\nexport const IGNORED_KEYS: ReadonlySet<string> = new Set([\n \"key\",\n \"suppressHydrationWarning\",\n \"suppressContentEditableWarning\",\n]);\n\n/** The DOM event for a React-spelled prop (see the compiler's `eventPlan`). @internal */\nexport interface EventPlan {\n readonly type: string;\n readonly capture: boolean;\n readonly passive: boolean;\n}\n\n/** React events that bubble under another name. */\nconst REACT_EVENTS: ReadonlyMap<string, string> = new Map([\n [\"focus\", \"focusin\"],\n [\"blur\", \"focusout\"],\n [\"doubleclick\", \"dblclick\"],\n]);\n\nconst CHANGE_ON_TYPES: ReadonlySet<string> = new Set([\"checkbox\", \"radio\", \"file\"]);\n\n/**\n * Plans the DOM event for an `on*` prop. React's spellings follow React: `onChange` is the per-edit\n * `input` event on text inputs and textareas and the `change` event on other controls; `onFocus` and\n * `onBlur` bubble as `focusin` and `focusout`; a `...Capture` suffix binds the capture phase; `onWheel`\n * is passive. A lower-case `on` spelling is the native event.\n * @internal\n */\nexport function eventPlan(attribute: string, tag: string, type: string | null): EventPlan {\n const reactSpelling = /^on[A-Z]/.test(attribute);\n const capture = reactSpelling && attribute.endsWith(\"Capture\");\n const lower = attribute.slice(2, capture ? -\"Capture\".length : undefined).toLowerCase();\n let planned = lower;\n if (reactSpelling) {\n planned =\n lower === \"change\"\n ? tag === \"textarea\" || (tag === \"input\" && (type === null || !CHANGE_ON_TYPES.has(type)))\n ? \"input\"\n : \"change\"\n : (REACT_EVENTS.get(lower) ?? lower);\n }\n return { type: planned, capture, passive: reactSpelling && lower === \"wheel\" && !capture };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAM,sBACJ;;AAGF,MAAM,0BAAuC,IAAI,IAAI;CACnD,CAAC,aAAa,OAAO;CACrB,CAAC,WAAW,KAAK;CACjB,CAAC,aAAa,YAAY;CAC1B,CAAC,iBAAiB,gBAAgB;AACpC,CAAC;;;;;;;AAQD,SAAgB,cAAc,MAAc,KAAsB;CAChE,MAAM,UAAU,QAAQ,IAAI,IAAI;CAChC,IAAI,YAAY,KAAA,GAAW,OAAO;CAClC,IAAI,CAAC,KAAK,OAAO,KAAK,YAAY;CAClC,IAAI,KAAK,SAAS,GAAG,GAAG,OAAO;CAC/B,MAAM,WAAW,2BAA2B,KAAK,IAAI;CACrD,IAAI,aAAa,MAAM,OAAO,GAAG,SAAS,GAAG,GAAG,SAAS,EAAE,EAAE,YAAY,IAAI,SAAS;CACtF,IAAI,CAAC,oBAAoB,KAAK,IAAI,GAAG,OAAO;CAC5C,OAAO,KAAK,QAAQ,WAAW,WAAW,IAAI,OAAO,YAAY,GAAG;AACtE;;AAGA,MAAa,+BAAoC,IAAI,IAAI;CACvD;CACA;CACA;AACF,CAAC;;AAUD,MAAM,+BAA4C,IAAI,IAAI;CACxD,CAAC,SAAS,SAAS;CACnB,CAAC,QAAQ,UAAU;CACnB,CAAC,eAAe,UAAU;AAC5B,CAAC;AAED,MAAM,kCAAuC,IAAI,IAAI;CAAC;CAAY;CAAS;AAAM,CAAC;;;;;;;;AASlF,SAAgB,UAAU,WAAmB,KAAa,MAAgC;CACxF,MAAM,gBAAgB,WAAW,KAAK,SAAS;CAC/C,MAAM,UAAU,iBAAiB,UAAU,SAAS,SAAS;CAC7D,MAAM,QAAQ,UAAU,MAAM,GAAG,UAAU,KAAoB,KAAA,CAAS,CAAC,CAAC,YAAY;CACtF,IAAI,UAAU;CACd,IAAI,eACF,UACE,UAAU,WACN,QAAQ,cAAe,QAAQ,YAAY,SAAS,QAAQ,CAAC,gBAAgB,IAAI,IAAI,KACnF,UACA,WACD,aAAa,IAAI,KAAK,KAAK;CAEpC,OAAO;EAAE,MAAM;EAAS;EAAS,SAAS,iBAAiB,UAAU,WAAW,CAAC;CAAQ;AAC3F"}
@@ -1,4 +1,3 @@
1
- //#region src/internal/reconcile.d.ts
2
1
  /**
3
2
  * Updates one region of `parent`'s children from the nodes `prev` to the nodes `next`, keeping every
4
3
  * node that stays and moving as few as possible: the list reconciliation `insert` performs for arrays
@@ -36,5 +35,4 @@
36
35
  * @since 1.0.0
37
36
  */
38
37
  export declare function reconcileNodes(parent: Node, prev: readonly Node[], next: readonly Node[], end: Node | null): void;
39
- //#endregion
40
38
  //# sourceMappingURL=reconcile.d.ts.map
@@ -1,4 +1,4 @@
1
- //#region src/internal/reconcile.ts
1
+ // src/internal/reconcile.ts
2
2
  /** Removes `node` only when it is still a child of `parent`, so detached nodes are ignored. */
3
3
  function removeNode(parent, node) {
4
4
  if (node !== void 0 && node.parentNode === parent) parent.removeChild(node);
@@ -20,10 +20,10 @@ function markLongestIncreasing(values, offset, marks) {
20
20
  if ((values[tails[middle] ?? 0] ?? 0) < value) low = middle + 1;
21
21
  else high = middle;
22
22
  }
23
- previous[index] = low > 0 ? tails[low - 1] ?? -1 : -1;
23
+ previous[index] = tails[low - 1] ?? -1;
24
24
  tails[low] = index;
25
25
  }
26
- let cursor = tails.length > 0 ? tails[tails.length - 1] ?? -1 : -1;
26
+ let cursor = tails.at(-1) ?? -1;
27
27
  while (cursor !== -1) {
28
28
  marks[(values[cursor] ?? 0) - offset] = 1;
29
29
  cursor = previous[cursor] ?? -1;
@@ -96,10 +96,7 @@ function reconcileNodes(parent, prev, next, end) {
96
96
  else survivors.push(position);
97
97
  }
98
98
  if (survivors.length === 0) {
99
- for (let index = head; index < nextTail; index += 1) {
100
- const node = next[index];
101
- if (node !== void 0) parent.insertBefore(node, before);
102
- }
99
+ for (const node of next.slice(head, nextTail)) parent.insertBefore(node, before);
103
100
  return;
104
101
  }
105
102
  const stable = new Uint8Array(nextTail - head);
@@ -116,7 +113,6 @@ function reconcileNodes(parent, prev, next, end) {
116
113
  anchorNode = node;
117
114
  }
118
115
  }
119
- //#endregion
120
116
  export { reconcileNodes };
121
117
 
122
118
  //# sourceMappingURL=reconcile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reconcile.js","names":[],"sources":["../../../src/internal/reconcile.ts"],"sourcesContent":["/** A parent that can move a child in place (Element.prototype.moveBefore, where implemented). */\ninterface MovableParent extends Node {\n moveBefore(node: Node, child: Node | null): void;\n}\n\n/** Removes `node` only when it is still a child of `parent`, so detached nodes are ignored. */\nfunction removeNode(parent: Node, node: Node | undefined): void {\n if (node !== undefined && node.parentNode === parent) parent.removeChild(node);\n}\n\n/**\n * Marks the members of one longest strictly increasing subsequence of `values` in `marks`, where\n * `values[k]` is the target position of the k-th surviving node and `marks[v - offset]` is set for\n * target position `v`. Patience sorting: O(n log n).\n */\nfunction markLongestIncreasing(values: readonly number[], offset: number, marks: Uint8Array): void {\n // tails[k]: index into `values` of the smallest tail of an increasing run of length k + 1.\n const tails: number[] = [];\n const previous: number[] = values.map(() => -1);\n for (let index = 0; index < values.length; index += 1) {\n const value = values[index] ?? 0;\n let low = 0;\n let high = tails.length;\n while (low < high) {\n const middle = (low + high) >> 1;\n const probe = values[tails[middle] ?? 0] ?? 0;\n if (probe < value) low = middle + 1;\n else high = middle;\n }\n previous[index] = low > 0 ? (tails[low - 1] ?? -1) : -1;\n tails[low] = index;\n }\n let cursor = tails.length > 0 ? (tails[tails.length - 1] ?? -1) : -1;\n while (cursor !== -1) {\n marks[(values[cursor] ?? 0) - offset] = 1;\n cursor = previous[cursor] ?? -1;\n }\n}\n\n/**\n * Updates one region of `parent`'s children from the nodes `prev` to the nodes `next`, keeping every\n * node that stays and moving as few as possible: the list reconciliation `insert` performs for arrays\n * (and so for `For`). Use it in a custom list renderer.\n *\n * Preconditions: `prev` are the nodes this region owns, in DOM order and all children of `parent`;\n * `next` holds no duplicates; `end` is the node after the region (null for the end of `parent`).\n *\n * Strategy, in three steps:\n * 1. Trim the common prefix and suffix: appends, prepends, and removals at either end touch\n * only the nodes that changed (no move at all).\n * 2. Remove the nodes that left the value. A node that is still present is never removed.\n * 3. Place the rest from the end of `next` backwards. Nodes on a longest increasing subsequence of\n * surviving positions stay where they are; every other node is moved (or inserted) directly\n * before the node that follows it in `next`. Moves use `moveBefore` when the parent has it,\n * which keeps focus and iframe state, and `insertBefore` otherwise. Each node moves at most once,\n * and the number of moves is minimal for the surviving order.\n *\n * @param parent The parent of the region.\n * @param prev The nodes the region holds now, in DOM order, all children of `parent`.\n * @param next The nodes the region must hold, in order, without duplicates. A node of `prev` that is\n * not in `next` is removed; a node of `next` that is not in `prev` is inserted.\n * @param end The node right after the region; `null` when the region runs to the end of `parent`.\n * @example\n * import { reconcileNodes } from \"@shadow-js/web/extend\";\n *\n * const item = (text: string): HTMLLIElement =>\n * Object.assign(document.createElement(\"li\"), { textContent: text });\n * const list = document.createElement(\"ul\");\n * const a = item(\"a\");\n * const b = item(\"b\");\n * const c = item(\"c\");\n * list.append(a, b, c);\n * reconcileNodes(list, [a, b, c], [c, a], null); // removes b, moves c before a\n * @since 1.0.0\n */\nexport function reconcileNodes(\n parent: Node,\n prev: readonly Node[],\n next: readonly Node[],\n end: Node | null,\n): void {\n const prevLength = prev.length;\n const nextLength = next.length;\n\n let head = 0;\n while (head < prevLength && head < nextLength && prev[head] === next[head]) head += 1;\n let prevTail = prevLength;\n let nextTail = nextLength;\n while (prevTail > head && nextTail > head && prev[prevTail - 1] === next[nextTail - 1]) {\n prevTail -= 1;\n nextTail -= 1;\n }\n if (prevTail === head && nextTail === head) return;\n\n // Everything in the common suffix is already in place, so the middle goes before its first node.\n const before = nextTail < nextLength ? (next[nextTail] ?? null) : end;\n\n if (nextTail === head) {\n for (let index = head; index < prevTail; index += 1) removeNode(parent, prev[index]);\n return;\n }\n\n const target = new Map<Node, number>();\n for (let index = head; index < nextTail; index += 1) {\n const node = next[index];\n if (node !== undefined) target.set(node, index);\n }\n\n const survivors: number[] = [];\n for (let index = head; index < prevTail; index += 1) {\n const node = prev[index];\n if (node === undefined) continue;\n const position = target.get(node);\n if (position === undefined) removeNode(parent, node);\n else survivors.push(position);\n }\n\n if (survivors.length === 0) {\n for (let index = head; index < nextTail; index += 1) {\n const node = next[index];\n if (node !== undefined) parent.insertBefore(node, before);\n }\n return;\n }\n\n const stable = new Uint8Array(nextTail - head);\n markLongestIncreasing(survivors, head, stable);\n const movable = typeof (parent as Partial<MovableParent>).moveBefore === \"function\";\n\n let anchorNode = before;\n for (let index = nextTail - 1; index >= head; index -= 1) {\n const node = next[index];\n if (node === undefined) continue;\n if (stable[index - head] !== 1) {\n if (movable && node.parentNode === parent)\n (parent as MovableParent).moveBefore(node, anchorNode);\n else parent.insertBefore(node, anchorNode);\n }\n anchorNode = node;\n }\n}\n"],"mappings":";;AAMA,SAAS,WAAW,QAAc,MAA8B;CAC9D,IAAI,SAAS,KAAA,KAAa,KAAK,eAAe,QAAQ,OAAO,YAAY,IAAI;AAC/E;;;;;;AAOA,SAAS,sBAAsB,QAA2B,QAAgB,OAAyB;CAEjG,MAAM,QAAkB,CAAC;CACzB,MAAM,WAAqB,OAAO,UAAU,EAAE;CAC9C,KAAK,IAAI,QAAQ,GAAG,QAAQ,OAAO,QAAQ,SAAS,GAAG;EACrD,MAAM,QAAQ,OAAO,UAAU;EAC/B,IAAI,MAAM;EACV,IAAI,OAAO,MAAM;EACjB,OAAO,MAAM,MAAM;GACjB,MAAM,SAAU,MAAM,QAAS;GAE/B,KADc,OAAO,MAAM,WAAW,MAAM,KAChC,OAAO,MAAM,SAAS;QAC7B,OAAO;EACd;EACA,SAAS,SAAS,MAAM,IAAK,MAAM,MAAM,MAAM,KAAM;EACrD,MAAM,OAAO;CACf;CACA,IAAI,SAAS,MAAM,SAAS,IAAK,MAAM,MAAM,SAAS,MAAM,KAAM;CAClE,OAAO,WAAW,IAAI;EACpB,OAAO,OAAO,WAAW,KAAK,UAAU;EACxC,SAAS,SAAS,WAAW;CAC/B;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,eACd,QACA,MACA,MACA,KACM;CACN,MAAM,aAAa,KAAK;CACxB,MAAM,aAAa,KAAK;CAExB,IAAI,OAAO;CACX,OAAO,OAAO,cAAc,OAAO,cAAc,KAAK,UAAU,KAAK,OAAO,QAAQ;CACpF,IAAI,WAAW;CACf,IAAI,WAAW;CACf,OAAO,WAAW,QAAQ,WAAW,QAAQ,KAAK,WAAW,OAAO,KAAK,WAAW,IAAI;EACtF,YAAY;EACZ,YAAY;CACd;CACA,IAAI,aAAa,QAAQ,aAAa,MAAM;CAG5C,MAAM,SAAS,WAAW,aAAc,KAAK,aAAa,OAAQ;CAElE,IAAI,aAAa,MAAM;EACrB,KAAK,IAAI,QAAQ,MAAM,QAAQ,UAAU,SAAS,GAAG,WAAW,QAAQ,KAAK,MAAM;EACnF;CACF;CAEA,MAAM,yBAAS,IAAI,IAAkB;CACrC,KAAK,IAAI,QAAQ,MAAM,QAAQ,UAAU,SAAS,GAAG;EACnD,MAAM,OAAO,KAAK;EAClB,IAAI,SAAS,KAAA,GAAW,OAAO,IAAI,MAAM,KAAK;CAChD;CAEA,MAAM,YAAsB,CAAC;CAC7B,KAAK,IAAI,QAAQ,MAAM,QAAQ,UAAU,SAAS,GAAG;EACnD,MAAM,OAAO,KAAK;EAClB,IAAI,SAAS,KAAA,GAAW;EACxB,MAAM,WAAW,OAAO,IAAI,IAAI;EAChC,IAAI,aAAa,KAAA,GAAW,WAAW,QAAQ,IAAI;OAC9C,UAAU,KAAK,QAAQ;CAC9B;CAEA,IAAI,UAAU,WAAW,GAAG;EAC1B,KAAK,IAAI,QAAQ,MAAM,QAAQ,UAAU,SAAS,GAAG;GACnD,MAAM,OAAO,KAAK;GAClB,IAAI,SAAS,KAAA,GAAW,OAAO,aAAa,MAAM,MAAM;EAC1D;EACA;CACF;CAEA,MAAM,SAAS,IAAI,WAAW,WAAW,IAAI;CAC7C,sBAAsB,WAAW,MAAM,MAAM;CAC7C,MAAM,UAAU,OAAQ,OAAkC,eAAe;CAEzE,IAAI,aAAa;CACjB,KAAK,IAAI,QAAQ,WAAW,GAAG,SAAS,MAAM,SAAS,GAAG;EACxD,MAAM,OAAO,KAAK;EAClB,IAAI,SAAS,KAAA,GAAW;EACxB,IAAI,OAAO,QAAQ,UAAU,GAAG;GAC9B,IAAI,WAAW,KAAK,eAAe,QACjC,OAA0B,WAAW,MAAM,UAAU;QAClD,OAAO,aAAa,MAAM,UAAU;EAC3C;EACA,aAAa;CACf;AACF"}
1
+ {"version":3,"file":"reconcile.js","names":[],"sources":["../../../src/internal/reconcile.ts"],"sourcesContent":["/** A parent that can move a child in place (Element.prototype.moveBefore, where implemented). */\ninterface MovableParent extends Node {\n moveBefore(node: Node, child: Node | null): void;\n}\n\n/** Removes `node` only when it is still a child of `parent`, so detached nodes are ignored. */\nfunction removeNode(parent: Node, node: Node | undefined): void {\n if (node !== undefined && node.parentNode === parent) parent.removeChild(node);\n}\n\n/**\n * Marks the members of one longest strictly increasing subsequence of `values` in `marks`, where\n * `values[k]` is the target position of the k-th surviving node and `marks[v - offset]` is set for\n * target position `v`. Patience sorting: O(n log n).\n */\nfunction markLongestIncreasing(values: readonly number[], offset: number, marks: Uint8Array): void {\n // tails[k]: index into `values` of the smallest tail of an increasing run of length k + 1.\n const tails: number[] = [];\n const previous: number[] = values.map(() => -1);\n for (let index = 0; index < values.length; index += 1) {\n const value = values[index] ?? 0;\n let low = 0;\n let high = tails.length;\n while (low < high) {\n const middle = (low + high) >> 1;\n const probe = values[tails[middle] ?? 0] ?? 0;\n if (probe < value) low = middle + 1;\n else high = middle;\n }\n // `tails[-1]` is undefined, which reads as no predecessor.\n previous[index] = tails[low - 1] ?? -1;\n tails[low] = index;\n }\n let cursor = tails.at(-1) ?? -1;\n while (cursor !== -1) {\n marks[(values[cursor] ?? 0) - offset] = 1;\n cursor = previous[cursor] ?? -1;\n }\n}\n\n/**\n * Updates one region of `parent`'s children from the nodes `prev` to the nodes `next`, keeping every\n * node that stays and moving as few as possible: the list reconciliation `insert` performs for arrays\n * (and so for `For`). Use it in a custom list renderer.\n *\n * Preconditions: `prev` are the nodes this region owns, in DOM order and all children of `parent`;\n * `next` holds no duplicates; `end` is the node after the region (null for the end of `parent`).\n *\n * Strategy, in three steps:\n * 1. Trim the common prefix and suffix: appends, prepends, and removals at either end touch\n * only the nodes that changed (no move at all).\n * 2. Remove the nodes that left the value. A node that is still present is never removed.\n * 3. Place the rest from the end of `next` backwards. Nodes on a longest increasing subsequence of\n * surviving positions stay where they are; every other node is moved (or inserted) directly\n * before the node that follows it in `next`. Moves use `moveBefore` when the parent has it,\n * which keeps focus and iframe state, and `insertBefore` otherwise. Each node moves at most once,\n * and the number of moves is minimal for the surviving order.\n *\n * @param parent The parent of the region.\n * @param prev The nodes the region holds now, in DOM order, all children of `parent`.\n * @param next The nodes the region must hold, in order, without duplicates. A node of `prev` that is\n * not in `next` is removed; a node of `next` that is not in `prev` is inserted.\n * @param end The node right after the region; `null` when the region runs to the end of `parent`.\n * @example\n * import { reconcileNodes } from \"@shadow-js/web/extend\";\n *\n * const item = (text: string): HTMLLIElement =>\n * Object.assign(document.createElement(\"li\"), { textContent: text });\n * const list = document.createElement(\"ul\");\n * const a = item(\"a\");\n * const b = item(\"b\");\n * const c = item(\"c\");\n * list.append(a, b, c);\n * reconcileNodes(list, [a, b, c], [c, a], null); // removes b, moves c before a\n * @since 1.0.0\n */\nexport function reconcileNodes(\n parent: Node,\n prev: readonly Node[],\n next: readonly Node[],\n end: Node | null,\n): void {\n const prevLength = prev.length;\n const nextLength = next.length;\n\n let head = 0;\n while (head < prevLength && head < nextLength && prev[head] === next[head]) head += 1;\n let prevTail = prevLength;\n let nextTail = nextLength;\n while (prevTail > head && nextTail > head && prev[prevTail - 1] === next[nextTail - 1]) {\n prevTail -= 1;\n nextTail -= 1;\n }\n if (prevTail === head && nextTail === head) return;\n\n // Everything in the common suffix is already in place, so the middle goes before its first node.\n const before = nextTail < nextLength ? (next[nextTail] ?? null) : end;\n\n if (nextTail === head) {\n for (let index = head; index < prevTail; index += 1) removeNode(parent, prev[index]);\n return;\n }\n\n const target = new Map<Node, number>();\n for (let index = head; index < nextTail; index += 1) {\n const node = next[index];\n if (node !== undefined) target.set(node, index);\n }\n\n const survivors: number[] = [];\n for (let index = head; index < prevTail; index += 1) {\n const node = prev[index];\n if (node === undefined) continue;\n const position = target.get(node);\n if (position === undefined) removeNode(parent, node);\n else survivors.push(position);\n }\n\n // Nothing survived: the new nodes go in document order. Inserting them back to front (the move loop below)\n // ends with the same tree but not the same steps, and a `<select>` picks its shown option while its options\n // arrive, so a replaced option list would show the wrong value.\n if (survivors.length === 0) {\n for (const node of next.slice(head, nextTail)) parent.insertBefore(node, before);\n return;\n }\n\n const stable = new Uint8Array(nextTail - head);\n markLongestIncreasing(survivors, head, stable);\n const movable = typeof (parent as Partial<MovableParent>).moveBefore === \"function\";\n\n let anchorNode = before;\n for (let index = nextTail - 1; index >= head; index -= 1) {\n const node = next[index];\n if (node === undefined) continue;\n if (stable[index - head] !== 1) {\n if (movable && node.parentNode === parent)\n (parent as MovableParent).moveBefore(node, anchorNode);\n else parent.insertBefore(node, anchorNode);\n }\n anchorNode = node;\n }\n}\n"],"mappings":";;AAMA,SAAS,WAAW,QAAc,MAA8B;CAC9D,IAAI,SAAS,KAAA,KAAa,KAAK,eAAe,QAAQ,OAAO,YAAY,IAAI;AAC/E;;;;;;AAOA,SAAS,sBAAsB,QAA2B,QAAgB,OAAyB;CAEjG,MAAM,QAAkB,CAAC;CACzB,MAAM,WAAqB,OAAO,UAAU,EAAE;CAC9C,KAAK,IAAI,QAAQ,GAAG,QAAQ,OAAO,QAAQ,SAAS,GAAG;EACrD,MAAM,QAAQ,OAAO,UAAU;EAC/B,IAAI,MAAM;EACV,IAAI,OAAO,MAAM;EACjB,OAAO,MAAM,MAAM;GACjB,MAAM,SAAU,MAAM,QAAS;GAE/B,KADc,OAAO,MAAM,WAAW,MAAM,KAChC,OAAO,MAAM,SAAS;QAC7B,OAAO;EACd;EAEA,SAAS,SAAS,MAAM,MAAM,MAAM;EACpC,MAAM,OAAO;CACf;CACA,IAAI,SAAS,MAAM,GAAG,EAAE,KAAK;CAC7B,OAAO,WAAW,IAAI;EACpB,OAAO,OAAO,WAAW,KAAK,UAAU;EACxC,SAAS,SAAS,WAAW;CAC/B;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,eACd,QACA,MACA,MACA,KACM;CACN,MAAM,aAAa,KAAK;CACxB,MAAM,aAAa,KAAK;CAExB,IAAI,OAAO;CACX,OAAO,OAAO,cAAc,OAAO,cAAc,KAAK,UAAU,KAAK,OAAO,QAAQ;CACpF,IAAI,WAAW;CACf,IAAI,WAAW;CACf,OAAO,WAAW,QAAQ,WAAW,QAAQ,KAAK,WAAW,OAAO,KAAK,WAAW,IAAI;EACtF,YAAY;EACZ,YAAY;CACd;CACA,IAAI,aAAa,QAAQ,aAAa,MAAM;CAG5C,MAAM,SAAS,WAAW,aAAc,KAAK,aAAa,OAAQ;CAElE,IAAI,aAAa,MAAM;EACrB,KAAK,IAAI,QAAQ,MAAM,QAAQ,UAAU,SAAS,GAAG,WAAW,QAAQ,KAAK,MAAM;EACnF;CACF;CAEA,MAAM,yBAAS,IAAI,IAAkB;CACrC,KAAK,IAAI,QAAQ,MAAM,QAAQ,UAAU,SAAS,GAAG;EACnD,MAAM,OAAO,KAAK;EAClB,IAAI,SAAS,KAAA,GAAW,OAAO,IAAI,MAAM,KAAK;CAChD;CAEA,MAAM,YAAsB,CAAC;CAC7B,KAAK,IAAI,QAAQ,MAAM,QAAQ,UAAU,SAAS,GAAG;EACnD,MAAM,OAAO,KAAK;EAClB,IAAI,SAAS,KAAA,GAAW;EACxB,MAAM,WAAW,OAAO,IAAI,IAAI;EAChC,IAAI,aAAa,KAAA,GAAW,WAAW,QAAQ,IAAI;OAC9C,UAAU,KAAK,QAAQ;CAC9B;CAKA,IAAI,UAAU,WAAW,GAAG;EAC1B,KAAK,MAAM,QAAQ,KAAK,MAAM,MAAM,QAAQ,GAAG,OAAO,aAAa,MAAM,MAAM;EAC/E;CACF;CAEA,MAAM,SAAS,IAAI,WAAW,WAAW,IAAI;CAC7C,sBAAsB,WAAW,MAAM,MAAM;CAC7C,MAAM,UAAU,OAAQ,OAAkC,eAAe;CAEzE,IAAI,aAAa;CACjB,KAAK,IAAI,QAAQ,WAAW,GAAG,SAAS,MAAM,SAAS,GAAG;EACxD,MAAM,OAAO,KAAK;EAClB,IAAI,SAAS,KAAA,GAAW;EACxB,IAAI,OAAO,QAAQ,UAAU,GAAG;GAC9B,IAAI,WAAW,KAAK,eAAe,QACjC,OAA0B,WAAW,MAAM,UAAU;QAClD,OAAO,aAAa,MAAM,UAAU;EAC3C;EACA,aAAa;CACf;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { Context } from "@shadow-js/core";
2
- //#region src/internal/stream-context.d.ts
3
2
  /**
4
3
  * A Suspense boundary whose content was not ready when the shell rendered: `renderToStream` calls
5
4
  * `rebuild` again each time a resource settles, and streams the markup once it is complete.
@@ -43,5 +42,4 @@ export interface StreamSink {
43
42
  * @since 1.0.0
44
43
  */
45
44
  export declare const StreamContext: Context<StreamSink | null>;
46
- //#endregion
47
45
  //# sourceMappingURL=stream-context.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { createContext } from "@shadow-js/core";
2
- //#region src/internal/stream-context.ts
2
+ // src/internal/stream-context.ts
3
3
  /**
4
4
  * The context through which `renderToStream` lets a Suspense-like boundary defer its content: a
5
5
  * boundary that is pending in the shell renders its fallback between `<!--[b:ID-->` and `<!--]-->`
@@ -17,7 +17,6 @@ import { createContext } from "@shadow-js/core";
17
17
  * @since 1.0.0
18
18
  */
19
19
  const StreamContext = /* @__PURE__ */ createContext(null, { name: "Stream" });
20
- //#endregion
21
20
  export { StreamContext };
22
21
 
23
22
  //# sourceMappingURL=stream-context.js.map
@@ -1,5 +1,4 @@
1
1
  import { Booleanish, Maybe } from "./types.js";
2
- //#region src/jsx/aria.d.ts
3
2
  /**
4
3
  * Every ARIA role of WAI-ARIA 1.2 (plus `generic` and `search`, which later ARIA versions use).
5
4
  *
@@ -68,5 +67,4 @@ export interface AriaAttributes {
68
67
  */
69
68
  role?: Maybe<AriaRole>;
70
69
  }
71
- //#endregion
72
70
  //# sourceMappingURL=aria.d.ts.map
@@ -1,5 +1,4 @@
1
1
  import { JsxChild } from "./types.js";
2
- //#region src/jsx/component.d.ts
3
2
  /**
4
3
  * A component: a function from props to a JSX element. Components run once; props are read through
5
4
  * their getters, so they stay reactive.
@@ -85,5 +84,4 @@ export type ParentComponent<P = Record<never, never>> = Component<ParentProps<P>
85
84
  export type FlowComponent<P = Record<never, never>, C = JsxChild> = Component<P & {
86
85
  children: C;
87
86
  }>;
88
- //#endregion
89
87
  //# sourceMappingURL=component.d.ts.map
@@ -1,4 +1,3 @@
1
- //#region src/jsx/events.d.ts
2
1
  /**
3
2
  * Event handler types for JSX. Each handler receives the precise DOM event subtype, with
4
3
  * `currentTarget` typed as the element that owns the attribute.
@@ -359,6 +358,5 @@ export type MediaEventAttributes<T> = HandlerProps<T, HTMLMediaElementEventMap,
359
358
  * @since 1.0.0
360
359
  */
361
360
  export type VideoEventAttributes<T> = HandlerProps<T, HTMLVideoElementEventMap, VideoEventNames> & OnProps<T, HTMLVideoElementEventMap, VideoEventNames> & CaptureProps<T, HTMLVideoElementEventMap, VideoEventNames>;
362
- //#endregion
363
361
  export {};
364
362
  //# sourceMappingURL=events.d.ts.map
@@ -1,7 +1,6 @@
1
1
  import { Booleanish, CSSProperties, CSSPropertyValue, ClassValue, JsxChild, Maybe, Ref, TextChild } from "./types.js";
2
2
  import { EventAttributes, MediaEventAttributes, VideoEventAttributes, WindowEventAttributes } from "./events.js";
3
3
  import { AriaAttributes } from "./aria.js";
4
- //#region src/jsx/global.d.ts
5
4
  /**
6
5
  * Values accepted by `data-*` attributes. `true` and `false` are written as the strings "true" and
7
6
  * "false", so they are not presence flags.
@@ -134,8 +133,11 @@ export interface DomProps<T> {
134
133
  className?: Maybe<ClassValue>;
135
134
  /** Toggles class names by truthiness; only keys that changed are touched. */
136
135
  classList?: Maybe<Record<string, boolean | undefined>>;
137
- /** A CSS text string, or a declaration object. */
138
- style?: Maybe<string | CSSProperties>;
136
+ /**
137
+ * A CSS text string, a declaration object, or an array of them (not nested) that is written in
138
+ * order, so a later declaration wins; `null`, `undefined`, `false` and `""` items are skipped.
139
+ */
140
+ style?: Maybe<string | CSSProperties | ReadonlyArray<string | CSSProperties | null | undefined | false>>;
139
141
  }
140
142
  /**
141
143
  * Every attribute an element of type `T` accepts, without children and without element-specific
@@ -207,5 +209,4 @@ export type VideoElementProps<T extends Element, A = unknown> = MediaElementProp
207
209
  * @since 1.0.0
208
210
  */
209
211
  export type WindowElementProps<T extends Element, A = unknown> = ElementProps<T, A> & WindowEventAttributes<T>;
210
- //#endregion
211
212
  //# sourceMappingURL=global.d.ts.map
@@ -1,6 +1,5 @@
1
1
  import { LooseString, Maybe } from "./types.js";
2
2
  import { Aliases, ElementProps, MediaElementProps, TextElementProps, VideoElementProps, VoidElementProps, WindowElementProps } from "./global.js";
3
- //#region src/jsx/html.d.ts
4
3
  /** Targets of links and forms. Any other browsing-context name is also accepted. @since 1.0.0 */
5
4
  export type LinkTarget = LooseString<"_self" | "_blank" | "_parent" | "_top">;
6
5
  /** Referrer policies, as in the HTML standard. @since 1.0.0 */
@@ -164,6 +163,7 @@ export interface IFrameAttributes {
164
163
  referrerpolicy?: Maybe<ReferrerPolicy>;
165
164
  sandbox?: Maybe<string>;
166
165
  src?: Maybe<string>;
166
+ /** An HTML document the frame runs: an HTML sink with the trust of `innerHTML`. Sanitize it and set `sandbox`. */
167
167
  srcdoc?: Maybe<string>;
168
168
  width?: Maybe<number | string>;
169
169
  }
@@ -875,5 +875,4 @@ export interface HTMLIntrinsicElements {
875
875
  /** The HTML `<xmp>` element: example markup shown as written (deprecated: use pre). */
876
876
  xmp: ElementProps<HTMLElementDeprecatedTagNameMap["xmp"]>;
877
877
  }
878
- //#endregion
879
878
  //# sourceMappingURL=html.d.ts.map
@@ -3,7 +3,6 @@ import { Aliases, ElementProps, GlobalAttributes, TextElementProps } from "./glo
3
3
  import { AnchorAttributes, HTMLIntrinsicElements, ScriptAttributes, StyleElementAttributes } from "./html.js";
4
4
  import { MathMLGlobalAttributes, MathMLIntrinsicElements } from "./mathml.js";
5
5
  import { SVGAnchorAttributes, SVGCoreAttributes, SVGHrefAttributes, SVGIntrinsicElements, SVGPresentationAttributes, SVGReactPresentationAttributes } from "./svg.js";
6
- //#region src/jsx/intrinsic.d.ts
7
6
  /** The DOM element a shared `a` may be. @internal */
8
7
  type AnchorElement = HTMLElementTagNameMap["a"] | SVGElementTagNameMap["a"] | MathMLTagElement<"a">;
9
8
  /** The DOM element a shared `script` may be. @internal */
@@ -54,6 +53,5 @@ type UniqueIntrinsicElements = Omit<HTMLIntrinsicElements & SVGIntrinsicElements
54
53
  export type IntrinsicElementMap = UniqueIntrinsicElements & SharedIntrinsicElements & {
55
54
  [name: `${string}-${string}`]: CustomElementProps;
56
55
  };
57
- //#endregion
58
56
  export {};
59
57
  //# sourceMappingURL=intrinsic.d.ts.map
@@ -1,6 +1,5 @@
1
1
  import { Booleanish, MathMLTagElement, Maybe } from "./types.js";
2
2
  import { ElementProps, VoidElementProps } from "./global.js";
3
- //#region src/jsx/mathml.d.ts
4
3
  /** A MathML length or unitless number, e.g. `"2em"`, `"thin"`, `3`. @since 1.0.0 */
5
4
  export type MathValue = Maybe<number | string>;
6
5
  /** The `mathvariant` presentation values. @since 1.0.0 */
@@ -182,5 +181,4 @@ export interface MathMLIntrinsicElements {
182
181
  /** The MathML `<semantics>` element: an expression paired with its annotations. */
183
182
  semantics: ElementProps<MathMLElementTagNameMap["semantics"], MathMLGlobalAttributes>;
184
183
  }
185
- //#endregion
186
184
  //# sourceMappingURL=mathml.d.ts.map
@@ -1,6 +1,5 @@
1
1
  import { LooseString, Maybe } from "./types.js";
2
2
  import { ElementProps, TextElementProps, VoidElementProps, WindowElementProps } from "./global.js";
3
- //#region src/jsx/svg.d.ts
4
3
  /** A length, coordinate, or other SVG number. Plain numbers are user units. @since 1.0.0 */
5
4
  export type SvgValue = Maybe<number | string>;
6
5
  /** Coordinate-system units of gradients, patterns, clip paths and masks. @since 1.0.0 */
@@ -603,5 +602,4 @@ export interface SVGTransferFunctionAttributes {
603
602
  tableValues?: Maybe<string>;
604
603
  type?: Maybe<"identity" | "table" | "discrete" | "linear" | "gamma">;
605
604
  }
606
- //#endregion
607
605
  //# sourceMappingURL=svg.d.ts.map
@@ -1,4 +1,3 @@
1
- //#region src/jsx/types.d.ts
2
1
  /**
3
2
  * Shared value types for ShadowJS JSX. Everything here is a type: this module emits no code.
4
3
  *
@@ -171,6 +170,5 @@ export type MathMLTagElement<K extends string> = K extends keyof MathMLElementTa
171
170
  export type RefOf<Props> = Props extends {
172
171
  ref?: infer R;
173
172
  } ? Extract<NonNullable<R>, Element> : never;
174
- //#endregion
175
173
  export {};
176
174
  //# sourceMappingURL=types.d.ts.map
@@ -7,7 +7,6 @@ import { HTMLIntrinsicElements } from "./jsx/html.js";
7
7
  import { MathMLIntrinsicElements } from "./jsx/mathml.js";
8
8
  import { SVGIntrinsicElements } from "./jsx/svg.js";
9
9
  import { CustomElementProps, IntrinsicElementMap } from "./jsx/intrinsic.js";
10
- //#region src/jsx-runtime.d.ts
11
10
  /**
12
11
  * The app's custom events, by name, for the `on:` and `oncapture:` prefixes: declaration-merge it so
13
12
  * `on:toast={...}` receives a typed event. Empty by default; a name without an entry is not accepted
@@ -89,6 +88,5 @@ export type ValidComponent = keyof JSX.IntrinsicElements | Component<never>;
89
88
  * @since 1.0.0
90
89
  */
91
90
  export type ComponentProps<T extends ValidComponent> = T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : T extends ((props: infer P) => unknown) ? P : never;
92
- //#endregion
93
91
  export type { AriaAttributes, AriaRole, Booleanish, BoundEventHandler, CSSProperties, ClassValue, Component, CustomElementProps, EventHandler, EventHandlerProp, FlowComponent, HTMLIntrinsicElements, IntrinsicElementMap, JsxChild, ListenerObject, MathMLIntrinsicElements, Maybe, MaybeAccessor, ParentComponent, ParentProps, Ref, SVGIntrinsicElements, TextChild, VoidComponent, VoidProps };
94
92
  //# sourceMappingURL=jsx-runtime.d.ts.map
@@ -1,5 +1,4 @@
1
1
  import { Cleanup } from "@shadow-js/core";
2
- //#region src/reactive.d.ts
3
2
  /**
4
3
  * Runs `fn` as a render effect: synchronously when created, and again when the signals it reads
5
4
  * change. It is the effect the compiler emits for DOM bindings; application code usually prefers
@@ -106,5 +105,4 @@ export declare function use<T>(fn: (el: Element, arg: () => T) => unknown, el: E
106
105
  * @since 1.0.0
107
106
  */
108
107
  export declare function refTo(target: unknown, el: Element): void;
109
- //#endregion
110
108
  //# sourceMappingURL=reactive.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { getOwner, onCleanup, untrack, useMemo, useRenderEffect } from "@shadow-js/core";
2
- //#region src/reactive.ts
2
+ // src/reactive.ts
3
3
  function effect(compute, apply) {
4
4
  if (apply === void 0) useRenderEffect(compute);
5
5
  else useRenderEffect(compute, apply);
@@ -79,7 +79,6 @@ function refTo(target, el) {
79
79
  holder.current = null;
80
80
  });
81
81
  }
82
- //#endregion
83
82
  export { effect, memo, refTo, use };
84
83
 
85
84
  //# sourceMappingURL=reactive.js.map
@@ -1,5 +1,4 @@
1
1
  import { RootErrorOptions } from "./control-flow/root-errors.js";
2
- //#region src/render.d.ts
3
2
  /**
4
3
  * Options of {@link render}: the error reporters of the root.
5
4
  * @since 1.0.0
@@ -32,5 +31,4 @@ export type RenderOptions = RootErrorOptions;
32
31
  * @since 1.0.0
33
32
  */
34
33
  export declare function render(code: () => unknown, container: Element | Document | DocumentFragment, options?: RenderOptions): () => void;
35
- //#endregion
36
34
  //# sourceMappingURL=render.d.ts.map