@askrjs/askr 0.0.51 → 0.0.52

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 (593) hide show
  1. package/dist/bench/components/benchmark-row.d.ts +2 -2
  2. package/dist/bench/components/benchmark-row.js +0 -2
  3. package/dist/bench/components/benchmark-table.js +0 -2
  4. package/dist/benchmark.d.ts +1 -2
  5. package/dist/benchmark.js +2 -4
  6. package/dist/bin/askr-ssg.d.ts +1 -2
  7. package/dist/bin/askr-ssg.js +21 -6
  8. package/dist/boot/hydration.js +10 -11
  9. package/dist/boot/index.d.ts +1 -2
  10. package/dist/boot/index.js +20 -11
  11. package/dist/boot/root-lifecycle.d.ts +6 -3
  12. package/dist/boot/root-lifecycle.js +14 -10
  13. package/dist/boot/route-startup.js +13 -4
  14. package/dist/boot/types.d.ts +1 -2
  15. package/dist/common/attr-names.js +0 -2
  16. package/dist/common/component.d.ts +1 -2
  17. package/dist/common/control.d.ts +1 -2
  18. package/dist/common/control.js +0 -2
  19. package/dist/common/dom-range.d.ts +13 -0
  20. package/dist/common/env.js +1 -7
  21. package/dist/common/error-boundary.d.ts +1 -2
  22. package/dist/common/invariant.js +0 -2
  23. package/dist/common/jsx.d.ts +1 -2
  24. package/dist/common/jsx.js +0 -2
  25. package/dist/common/logger.js +0 -2
  26. package/dist/common/promise.js +0 -2
  27. package/dist/common/props.d.ts +1 -2
  28. package/dist/common/render-context.js +0 -2
  29. package/dist/common/route-activity.js +0 -2
  30. package/dist/common/router-internal.js +0 -2
  31. package/dist/common/router.d.ts +1 -2
  32. package/dist/common/ssr-errors.d.ts +1 -2
  33. package/dist/common/ssr-errors.js +0 -2
  34. package/dist/common/ssr.d.ts +1 -2
  35. package/dist/common/ssr.js +0 -2
  36. package/dist/common/vnode.d.ts +1 -2
  37. package/dist/common/vnode.js +0 -2
  38. package/dist/components/error-boundary.d.ts +1 -2
  39. package/dist/components/error-boundary.js +0 -2
  40. package/dist/components/link.d.ts +2 -2
  41. package/dist/components/link.js +0 -2
  42. package/dist/control/case.d.ts +1 -2
  43. package/dist/control/case.js +0 -2
  44. package/dist/control/for.d.ts +1 -2
  45. package/dist/control/for.js +0 -2
  46. package/dist/control/shared.d.ts +1 -2
  47. package/dist/control/shared.js +0 -2
  48. package/dist/control/show.d.ts +1 -2
  49. package/dist/control/show.js +0 -2
  50. package/dist/data/data-runtime.d.ts +1 -2
  51. package/dist/data/data-runtime.js +3 -5
  52. package/dist/data/invalidation-listeners.js +0 -2
  53. package/dist/data/invalidation.d.ts +1 -2
  54. package/dist/data/invalidation.js +0 -2
  55. package/dist/data/mutation-cell.d.ts +1 -2
  56. package/dist/data/mutation-cell.js +6 -5
  57. package/dist/data/query-cell.d.ts +3 -2
  58. package/dist/data/query-cell.js +43 -9
  59. package/dist/data/query-key.js +0 -2
  60. package/dist/data/shared.js +2 -3
  61. package/dist/data/types.d.ts +1 -2
  62. package/dist/foundations/icon/icon.d.ts +1 -2
  63. package/dist/foundations/icon/icon.js +0 -2
  64. package/dist/foundations/icon/icon.types.d.ts +1 -2
  65. package/dist/foundations/interactions/dismissable.d.ts +1 -2
  66. package/dist/foundations/interactions/dismissable.js +0 -2
  67. package/dist/foundations/interactions/focusable.d.ts +1 -2
  68. package/dist/foundations/interactions/focusable.js +0 -2
  69. package/dist/foundations/interactions/hoverable.d.ts +1 -2
  70. package/dist/foundations/interactions/hoverable.js +0 -2
  71. package/dist/foundations/interactions/interaction-policy.d.ts +1 -2
  72. package/dist/foundations/interactions/interaction-policy.js +0 -2
  73. package/dist/foundations/interactions/pressable.d.ts +1 -2
  74. package/dist/foundations/interactions/pressable.js +0 -2
  75. package/dist/foundations/interactions/roving-focus.d.ts +1 -2
  76. package/dist/foundations/interactions/roving-focus.js +0 -2
  77. package/dist/foundations/state/controllable.d.ts +1 -2
  78. package/dist/foundations/state/controllable.js +0 -2
  79. package/dist/foundations/structures/collection.d.ts +1 -2
  80. package/dist/foundations/structures/collection.js +0 -2
  81. package/dist/foundations/structures/layer.d.ts +1 -2
  82. package/dist/foundations/structures/layer.js +0 -2
  83. package/dist/foundations/structures/layout.d.ts +1 -2
  84. package/dist/foundations/structures/layout.js +0 -2
  85. package/dist/foundations/structures/presence.d.ts +1 -2
  86. package/dist/foundations/structures/presence.js +0 -2
  87. package/dist/foundations/structures/slot.d.ts +1 -2
  88. package/dist/foundations/structures/slot.js +0 -2
  89. package/dist/foundations/utilities/aria.d.ts +1 -2
  90. package/dist/foundations/utilities/aria.js +0 -2
  91. package/dist/foundations/utilities/compose-handlers.d.ts +1 -2
  92. package/dist/foundations/utilities/compose-handlers.js +0 -2
  93. package/dist/foundations/utilities/compose-ref.d.ts +1 -2
  94. package/dist/foundations/utilities/compose-ref.js +0 -2
  95. package/dist/foundations/utilities/event-types.d.ts +1 -2
  96. package/dist/foundations/utilities/merge-props.d.ts +1 -2
  97. package/dist/foundations/utilities/merge-props.js +0 -2
  98. package/dist/foundations/utilities/use-id.d.ts +1 -2
  99. package/dist/foundations/utilities/use-id.js +0 -2
  100. package/dist/fx/fx.d.ts +1 -2
  101. package/dist/fx/fx.js +0 -2
  102. package/dist/fx/noop.js +0 -2
  103. package/dist/fx/timing.d.ts +1 -2
  104. package/dist/fx/timing.js +0 -2
  105. package/dist/index.d.ts +1 -1
  106. package/dist/index.js +0 -2
  107. package/dist/jsx/types.d.ts +1 -2
  108. package/dist/jsx/utils.d.ts +1 -2
  109. package/dist/jsx/utils.js +0 -2
  110. package/dist/jsx-dev-runtime.d.ts +16 -2
  111. package/dist/jsx-dev-runtime.js +3 -12
  112. package/dist/jsx-runtime.d.ts +16 -2
  113. package/dist/jsx-runtime.js +15 -24
  114. package/dist/jsx-runtime2.d.ts +1 -1
  115. package/dist/renderer/attributes.js +28 -6
  116. package/dist/renderer/boundaries.js +48 -172
  117. package/dist/renderer/boundary-materialization.js +72 -0
  118. package/dist/renderer/boundary-range-adoption.js +76 -0
  119. package/dist/renderer/boundary-range-sync.js +101 -0
  120. package/dist/renderer/boundary-state.js +50 -0
  121. package/dist/renderer/child-shape.js +0 -2
  122. package/dist/renderer/children-fastpath.js +3 -3
  123. package/dist/renderer/children.js +0 -2
  124. package/dist/renderer/cleanup.js +70 -13
  125. package/dist/renderer/component-host-cleanup.js +123 -48
  126. package/dist/renderer/component-host-instances.js +59 -8
  127. package/dist/renderer/component-host-replacement.js +105 -0
  128. package/dist/renderer/component-host-results.js +138 -0
  129. package/dist/renderer/component-host.js +94 -169
  130. package/dist/renderer/dom-host.js +0 -2
  131. package/dist/renderer/dom-internal.js +110 -53
  132. package/dist/renderer/dom-range.js +161 -0
  133. package/dist/renderer/dom.js +5 -4
  134. package/dist/renderer/element-children.js +112 -32
  135. package/dist/renderer/error-boundary-dom.js +19 -11
  136. package/dist/renderer/evaluate-dom-range.js +3 -4
  137. package/dist/renderer/evaluate-reconcile.js +12 -37
  138. package/dist/renderer/evaluate.js +14 -3
  139. package/dist/renderer/fastpath.js +4 -12
  140. package/dist/renderer/for-commit-dom-map.js +6 -18
  141. package/dist/renderer/for-commit-removal.js +7 -16
  142. package/dist/renderer/for-commit-reorder.js +0 -2
  143. package/dist/renderer/for-commit.js +172 -44
  144. package/dist/renderer/hydration-boundaries.js +60 -0
  145. package/dist/renderer/hydration-listener-transaction.js +49 -0
  146. package/dist/renderer/index.js +8 -7
  147. package/dist/renderer/intrinsic-blueprint-analysis.js +202 -0
  148. package/dist/renderer/intrinsic-blueprint-bindings.js +152 -0
  149. package/dist/renderer/intrinsic-blueprint-materialization.js +100 -0
  150. package/dist/renderer/intrinsic-blueprint.js +30 -0
  151. package/dist/renderer/intrinsic-hydration-adoption.js +66 -0
  152. package/dist/renderer/keyed-children.js +3 -9
  153. package/dist/renderer/keyed.js +10 -10
  154. package/dist/renderer/namespaces.js +0 -2
  155. package/dist/renderer/prop-bindings.js +56 -21
  156. package/dist/renderer/reactive-child-dom.js +10 -4
  157. package/dist/renderer/reactive-child-sources.js +0 -2
  158. package/dist/renderer/reactive-children.js +29 -20
  159. package/dist/renderer/reconcile-commit.js +0 -2
  160. package/dist/renderer/reconcile-fastpaths.js +4 -11
  161. package/dist/renderer/reconcile-resolution.js +31 -55
  162. package/dist/renderer/reconcile.js +0 -2
  163. package/dist/renderer/retained-element-rollback.js +159 -148
  164. package/dist/renderer/stable-patch.js +3 -4
  165. package/dist/renderer/static-reuse.js +0 -2
  166. package/dist/renderer/utils.js +18 -9
  167. package/dist/router/access.js +0 -2
  168. package/dist/router/activity.d.ts +1 -2
  169. package/dist/router/activity.js +0 -2
  170. package/dist/router/authoring.d.ts +1 -2
  171. package/dist/router/authoring.js +0 -2
  172. package/dist/router/internal-types.d.ts +1 -2
  173. package/dist/router/lazy.d.ts +1 -2
  174. package/dist/router/lazy.js +0 -2
  175. package/dist/router/manifest.d.ts +1 -2
  176. package/dist/router/manifest.js +0 -2
  177. package/dist/router/match.js +0 -2
  178. package/dist/router/navigate.d.ts +1 -2
  179. package/dist/router/navigate.js +4 -7
  180. package/dist/router/navigation-registry.d.ts +1 -2
  181. package/dist/router/navigation-registry.js +0 -2
  182. package/dist/router/navigation-scroll.d.ts +1 -2
  183. package/dist/router/navigation-scroll.js +0 -2
  184. package/dist/router/navigation-targets.d.ts +3 -4
  185. package/dist/router/navigation-targets.js +419 -40
  186. package/dist/router/policy.d.ts +1 -2
  187. package/dist/router/policy.js +0 -2
  188. package/dist/router/rendering.d.ts +1 -2
  189. package/dist/router/rendering.js +4 -3
  190. package/dist/router/resolution.d.ts +1 -2
  191. package/dist/router/resolution.js +0 -2
  192. package/dist/router/route-context.js +0 -2
  193. package/dist/router/route-matching.d.ts +1 -2
  194. package/dist/router/route-matching.js +0 -2
  195. package/dist/router/route-query.d.ts +1 -2
  196. package/dist/router/route-query.js +1 -3
  197. package/dist/router/store.d.ts +1 -2
  198. package/dist/router/store.js +0 -2
  199. package/dist/runtime/access.d.ts +1 -2
  200. package/dist/runtime/access.js +0 -2
  201. package/dist/runtime/child-scope.d.ts +21 -2
  202. package/dist/runtime/child-scope.js +101 -54
  203. package/dist/runtime/component-cleanup.d.ts +1 -2
  204. package/dist/runtime/component-cleanup.js +2 -4
  205. package/dist/runtime/component-commit.js +25 -23
  206. package/dist/runtime/component-facade.js +5 -3
  207. package/dist/runtime/component-internal.d.ts +11 -6
  208. package/dist/runtime/component-internal.js +63 -45
  209. package/dist/runtime/component-lifecycle.d.ts +2 -41
  210. package/dist/runtime/component-lifecycle.js +6 -149
  211. package/dist/runtime/component-scope.d.ts +3 -4
  212. package/dist/runtime/component-scope.js +27 -8
  213. package/dist/runtime/component.js +4 -3
  214. package/dist/runtime/context.d.ts +5 -2
  215. package/dist/runtime/context.js +29 -3
  216. package/dist/runtime/control.d.ts +22 -3
  217. package/dist/runtime/control.js +168 -55
  218. package/dist/runtime/derive.d.ts +1 -2
  219. package/dist/runtime/derive.js +0 -2
  220. package/dist/runtime/dev-namespace.d.ts +5 -6
  221. package/dist/runtime/dev-namespace.js +32 -25
  222. package/dist/runtime/effect.d.ts +8 -5
  223. package/dist/runtime/effect.js +158 -75
  224. package/dist/runtime/error-boundary.d.ts +1 -2
  225. package/dist/runtime/error-boundary.js +0 -2
  226. package/dist/runtime/events.d.ts +3 -3
  227. package/dist/runtime/events.js +66 -69
  228. package/dist/runtime/execution-model.d.ts +1 -2
  229. package/dist/runtime/execution-model.js +0 -2
  230. package/dist/runtime/fastlane.d.ts +1 -2
  231. package/dist/runtime/fastlane.js +0 -2
  232. package/dist/runtime/for-bench.d.ts +1 -2
  233. package/dist/runtime/for-bench.js +9 -167
  234. package/dist/runtime/for-internal.d.ts +68 -5
  235. package/dist/runtime/for-internal.js +201 -14
  236. package/dist/runtime/for-reconcile.d.ts +1 -2
  237. package/dist/runtime/for-reconcile.js +76 -23
  238. package/dist/runtime/for-scopes.d.ts +5 -5
  239. package/dist/runtime/for-scopes.js +168 -48
  240. package/dist/runtime/for-signals.d.ts +13 -4
  241. package/dist/runtime/for-signals.js +155 -81
  242. package/dist/runtime/for-types.d.ts +1 -2
  243. package/dist/runtime/for.d.ts +2 -2
  244. package/dist/runtime/for.js +3 -3
  245. package/dist/runtime/index.d.ts +5 -5
  246. package/dist/runtime/index.js +12 -10
  247. package/dist/runtime/lifecycle-batch.d.ts +59 -0
  248. package/dist/runtime/lifecycle-batch.js +178 -0
  249. package/dist/runtime/lifecycle-operation-settlement.d.ts +5 -0
  250. package/dist/runtime/lifecycle-operation-settlement.js +51 -0
  251. package/dist/runtime/lifecycle-operations.d.ts +1 -2
  252. package/dist/runtime/lifecycle-operations.js +5 -6
  253. package/dist/runtime/perf-metrics.d.ts +8 -7
  254. package/dist/runtime/perf-metrics.js +4 -68
  255. package/dist/runtime/portal.d.ts +1 -2
  256. package/dist/runtime/portal.js +103 -11
  257. package/dist/runtime/readable.d.ts +9 -4
  258. package/dist/runtime/readable.js +41 -17
  259. package/dist/runtime/resource-cell.js +2 -4
  260. package/dist/runtime/resource-operation.d.ts +1 -2
  261. package/dist/runtime/resource-operation.js +37 -34
  262. package/dist/runtime/runtime.d.ts +1 -2
  263. package/dist/runtime/runtime.js +0 -2
  264. package/dist/runtime/scheduler.d.ts +1 -2
  265. package/dist/runtime/scheduler.js +8 -11
  266. package/dist/runtime/selector-store.js +0 -2
  267. package/dist/runtime/selector.d.ts +1 -2
  268. package/dist/runtime/selector.js +3 -11
  269. package/dist/runtime/snapshot-source.d.ts +1 -2
  270. package/dist/runtime/snapshot-source.js +0 -2
  271. package/dist/runtime/state.d.ts +1 -2
  272. package/dist/runtime/state.js +1 -3
  273. package/dist/ssg/batch-render.js +0 -2
  274. package/dist/ssg/create-static-gen.d.ts +4 -2
  275. package/dist/ssg/create-static-gen.js +65 -14
  276. package/dist/ssg/generate-metadata.js +0 -2
  277. package/dist/ssg/generation-plan.js +0 -2
  278. package/dist/ssg/incremental-manifest.js +1 -3
  279. package/dist/ssg/resolve-ssg-data.js +0 -2
  280. package/dist/ssg/route-utils.js +0 -2
  281. package/dist/ssg/static-routes.js +0 -2
  282. package/dist/ssg/types.d.ts +2 -3
  283. package/dist/ssg/write-static-files.js +16 -12
  284. package/dist/ssr/attrs.js +0 -2
  285. package/dist/ssr/boundaries.js +16 -5
  286. package/dist/ssr/component-runtime.js +1 -27
  287. package/dist/ssr/context.d.ts +1 -2
  288. package/dist/ssr/context.js +0 -2
  289. package/dist/ssr/errors.d.ts +1 -2
  290. package/dist/ssr/errors.js +0 -2
  291. package/dist/ssr/escape.js +0 -2
  292. package/dist/ssr/hydration-data.js +0 -2
  293. package/dist/ssr/hydration-verify.d.ts +1 -2
  294. package/dist/ssr/hydration-verify.js +34 -7
  295. package/dist/ssr/index-internal.d.ts +1 -2
  296. package/dist/ssr/index-internal.js +0 -2
  297. package/dist/ssr/render-keys.js +0 -2
  298. package/dist/ssr/render-resolved.d.ts +1 -2
  299. package/dist/ssr/render-resolved.js +0 -2
  300. package/dist/ssr/render-sync.d.ts +1 -2
  301. package/dist/ssr/render-sync.js +27 -19
  302. package/dist/ssr/route-policy-resolution.js +0 -2
  303. package/dist/ssr/route-render.d.ts +1 -2
  304. package/dist/ssr/route-render.js +0 -2
  305. package/dist/ssr/sink.d.ts +1 -2
  306. package/dist/ssr/sink.js +0 -2
  307. package/dist/ssr/types.d.ts +1 -2
  308. package/dist/ssr/verify-hydration.js +0 -2
  309. package/dist/testing/index.d.ts +1 -2
  310. package/dist/testing/index.js +0 -2
  311. package/package.json +57 -44
  312. package/dist/bench/components/benchmark-row.d.ts.map +0 -1
  313. package/dist/bench/components/benchmark-row.js.map +0 -1
  314. package/dist/bench/components/benchmark-table.js.map +0 -1
  315. package/dist/benchmark.d.ts.map +0 -1
  316. package/dist/benchmark.js.map +0 -1
  317. package/dist/bin/askr-ssg.d.ts.map +0 -1
  318. package/dist/bin/askr-ssg.js.map +0 -1
  319. package/dist/boot/hydration.js.map +0 -1
  320. package/dist/boot/index.d.ts.map +0 -1
  321. package/dist/boot/index.js.map +0 -1
  322. package/dist/boot/root-lifecycle.d.ts.map +0 -1
  323. package/dist/boot/root-lifecycle.js.map +0 -1
  324. package/dist/boot/route-startup.js.map +0 -1
  325. package/dist/boot/types.d.ts.map +0 -1
  326. package/dist/common/attr-names.js.map +0 -1
  327. package/dist/common/component.d.ts.map +0 -1
  328. package/dist/common/control.d.ts.map +0 -1
  329. package/dist/common/control.js.map +0 -1
  330. package/dist/common/env.js.map +0 -1
  331. package/dist/common/error-boundary.d.ts.map +0 -1
  332. package/dist/common/invariant.js.map +0 -1
  333. package/dist/common/jsx.d.ts.map +0 -1
  334. package/dist/common/jsx.js.map +0 -1
  335. package/dist/common/logger.js.map +0 -1
  336. package/dist/common/promise.js.map +0 -1
  337. package/dist/common/props.d.ts.map +0 -1
  338. package/dist/common/render-context.js.map +0 -1
  339. package/dist/common/route-activity.js.map +0 -1
  340. package/dist/common/router-internal.js.map +0 -1
  341. package/dist/common/router.d.ts.map +0 -1
  342. package/dist/common/ssr-errors.d.ts.map +0 -1
  343. package/dist/common/ssr-errors.js.map +0 -1
  344. package/dist/common/ssr.d.ts.map +0 -1
  345. package/dist/common/ssr.js.map +0 -1
  346. package/dist/common/vnode.d.ts.map +0 -1
  347. package/dist/common/vnode.js.map +0 -1
  348. package/dist/components/error-boundary.d.ts.map +0 -1
  349. package/dist/components/error-boundary.js.map +0 -1
  350. package/dist/components/link.d.ts.map +0 -1
  351. package/dist/components/link.js.map +0 -1
  352. package/dist/control/case.d.ts.map +0 -1
  353. package/dist/control/case.js.map +0 -1
  354. package/dist/control/for.d.ts.map +0 -1
  355. package/dist/control/for.js.map +0 -1
  356. package/dist/control/shared.d.ts.map +0 -1
  357. package/dist/control/shared.js.map +0 -1
  358. package/dist/control/show.d.ts.map +0 -1
  359. package/dist/control/show.js.map +0 -1
  360. package/dist/data/data-runtime.d.ts.map +0 -1
  361. package/dist/data/data-runtime.js.map +0 -1
  362. package/dist/data/invalidation-listeners.js.map +0 -1
  363. package/dist/data/invalidation.d.ts.map +0 -1
  364. package/dist/data/invalidation.js.map +0 -1
  365. package/dist/data/mutation-cell.d.ts.map +0 -1
  366. package/dist/data/mutation-cell.js.map +0 -1
  367. package/dist/data/query-cell.d.ts.map +0 -1
  368. package/dist/data/query-cell.js.map +0 -1
  369. package/dist/data/query-key.js.map +0 -1
  370. package/dist/data/shared.js.map +0 -1
  371. package/dist/data/types.d.ts.map +0 -1
  372. package/dist/foundations/icon/icon.d.ts.map +0 -1
  373. package/dist/foundations/icon/icon.js.map +0 -1
  374. package/dist/foundations/icon/icon.types.d.ts.map +0 -1
  375. package/dist/foundations/interactions/dismissable.d.ts.map +0 -1
  376. package/dist/foundations/interactions/dismissable.js.map +0 -1
  377. package/dist/foundations/interactions/focusable.d.ts.map +0 -1
  378. package/dist/foundations/interactions/focusable.js.map +0 -1
  379. package/dist/foundations/interactions/hoverable.d.ts.map +0 -1
  380. package/dist/foundations/interactions/hoverable.js.map +0 -1
  381. package/dist/foundations/interactions/interaction-policy.d.ts.map +0 -1
  382. package/dist/foundations/interactions/interaction-policy.js.map +0 -1
  383. package/dist/foundations/interactions/pressable.d.ts.map +0 -1
  384. package/dist/foundations/interactions/pressable.js.map +0 -1
  385. package/dist/foundations/interactions/roving-focus.d.ts.map +0 -1
  386. package/dist/foundations/interactions/roving-focus.js.map +0 -1
  387. package/dist/foundations/state/controllable.d.ts.map +0 -1
  388. package/dist/foundations/state/controllable.js.map +0 -1
  389. package/dist/foundations/structures/collection.d.ts.map +0 -1
  390. package/dist/foundations/structures/collection.js.map +0 -1
  391. package/dist/foundations/structures/layer.d.ts.map +0 -1
  392. package/dist/foundations/structures/layer.js.map +0 -1
  393. package/dist/foundations/structures/layout.d.ts.map +0 -1
  394. package/dist/foundations/structures/layout.js.map +0 -1
  395. package/dist/foundations/structures/presence.d.ts.map +0 -1
  396. package/dist/foundations/structures/presence.js.map +0 -1
  397. package/dist/foundations/structures/slot.d.ts.map +0 -1
  398. package/dist/foundations/structures/slot.js.map +0 -1
  399. package/dist/foundations/utilities/aria.d.ts.map +0 -1
  400. package/dist/foundations/utilities/aria.js.map +0 -1
  401. package/dist/foundations/utilities/compose-handlers.d.ts.map +0 -1
  402. package/dist/foundations/utilities/compose-handlers.js.map +0 -1
  403. package/dist/foundations/utilities/compose-ref.d.ts.map +0 -1
  404. package/dist/foundations/utilities/compose-ref.js.map +0 -1
  405. package/dist/foundations/utilities/event-types.d.ts.map +0 -1
  406. package/dist/foundations/utilities/merge-props.d.ts.map +0 -1
  407. package/dist/foundations/utilities/merge-props.js.map +0 -1
  408. package/dist/foundations/utilities/use-id.d.ts.map +0 -1
  409. package/dist/foundations/utilities/use-id.js.map +0 -1
  410. package/dist/fx/fx.d.ts.map +0 -1
  411. package/dist/fx/fx.js.map +0 -1
  412. package/dist/fx/noop.js.map +0 -1
  413. package/dist/fx/timing.d.ts.map +0 -1
  414. package/dist/fx/timing.js.map +0 -1
  415. package/dist/index.js.map +0 -1
  416. package/dist/jsx/types.d.ts.map +0 -1
  417. package/dist/jsx/utils.d.ts.map +0 -1
  418. package/dist/jsx/utils.js.map +0 -1
  419. package/dist/jsx-dev-runtime.d.ts.map +0 -1
  420. package/dist/jsx-dev-runtime.js.map +0 -1
  421. package/dist/jsx-runtime.d.ts.map +0 -1
  422. package/dist/jsx-runtime.js.map +0 -1
  423. package/dist/renderer/attributes.js.map +0 -1
  424. package/dist/renderer/boundaries.js.map +0 -1
  425. package/dist/renderer/child-shape.js.map +0 -1
  426. package/dist/renderer/children-fastpath.js.map +0 -1
  427. package/dist/renderer/children.js.map +0 -1
  428. package/dist/renderer/cleanup.js.map +0 -1
  429. package/dist/renderer/component-host-cleanup.js.map +0 -1
  430. package/dist/renderer/component-host-instances.js.map +0 -1
  431. package/dist/renderer/component-host.js.map +0 -1
  432. package/dist/renderer/dom-host.js.map +0 -1
  433. package/dist/renderer/dom-internal.js.map +0 -1
  434. package/dist/renderer/element-children.js.map +0 -1
  435. package/dist/renderer/error-boundary-dom.js.map +0 -1
  436. package/dist/renderer/evaluate-dom-range.js.map +0 -1
  437. package/dist/renderer/evaluate-reconcile.js.map +0 -1
  438. package/dist/renderer/evaluate.js.map +0 -1
  439. package/dist/renderer/fastpath.js.map +0 -1
  440. package/dist/renderer/for-commit-dom-map.js.map +0 -1
  441. package/dist/renderer/for-commit-removal.js.map +0 -1
  442. package/dist/renderer/for-commit-reorder.js.map +0 -1
  443. package/dist/renderer/for-commit.js.map +0 -1
  444. package/dist/renderer/index.js.map +0 -1
  445. package/dist/renderer/keyed-children.js.map +0 -1
  446. package/dist/renderer/keyed.js.map +0 -1
  447. package/dist/renderer/namespaces.js.map +0 -1
  448. package/dist/renderer/prop-bindings.js.map +0 -1
  449. package/dist/renderer/reactive-child-dom.js.map +0 -1
  450. package/dist/renderer/reactive-child-sources.js.map +0 -1
  451. package/dist/renderer/reactive-children.js.map +0 -1
  452. package/dist/renderer/reconcile-commit.js.map +0 -1
  453. package/dist/renderer/reconcile-fastpaths.js.map +0 -1
  454. package/dist/renderer/reconcile-resolution.js.map +0 -1
  455. package/dist/renderer/reconcile.js.map +0 -1
  456. package/dist/renderer/retained-element-rollback.js.map +0 -1
  457. package/dist/renderer/stable-patch.js.map +0 -1
  458. package/dist/renderer/static-reuse.js.map +0 -1
  459. package/dist/renderer/utils.js.map +0 -1
  460. package/dist/router/access.js.map +0 -1
  461. package/dist/router/activity.d.ts.map +0 -1
  462. package/dist/router/activity.js.map +0 -1
  463. package/dist/router/authoring.d.ts.map +0 -1
  464. package/dist/router/authoring.js.map +0 -1
  465. package/dist/router/internal-types.d.ts.map +0 -1
  466. package/dist/router/lazy.d.ts.map +0 -1
  467. package/dist/router/lazy.js.map +0 -1
  468. package/dist/router/manifest.d.ts.map +0 -1
  469. package/dist/router/manifest.js.map +0 -1
  470. package/dist/router/match.js.map +0 -1
  471. package/dist/router/navigate.d.ts.map +0 -1
  472. package/dist/router/navigate.js.map +0 -1
  473. package/dist/router/navigation-registry.d.ts.map +0 -1
  474. package/dist/router/navigation-registry.js.map +0 -1
  475. package/dist/router/navigation-scroll.d.ts.map +0 -1
  476. package/dist/router/navigation-scroll.js.map +0 -1
  477. package/dist/router/navigation-targets.d.ts.map +0 -1
  478. package/dist/router/navigation-targets.js.map +0 -1
  479. package/dist/router/policy.d.ts.map +0 -1
  480. package/dist/router/policy.js.map +0 -1
  481. package/dist/router/rendering.d.ts.map +0 -1
  482. package/dist/router/rendering.js.map +0 -1
  483. package/dist/router/resolution.d.ts.map +0 -1
  484. package/dist/router/resolution.js.map +0 -1
  485. package/dist/router/route-context.js.map +0 -1
  486. package/dist/router/route-matching.d.ts.map +0 -1
  487. package/dist/router/route-matching.js.map +0 -1
  488. package/dist/router/route-query.d.ts.map +0 -1
  489. package/dist/router/route-query.js.map +0 -1
  490. package/dist/router/store.d.ts.map +0 -1
  491. package/dist/router/store.js.map +0 -1
  492. package/dist/runtime/access.d.ts.map +0 -1
  493. package/dist/runtime/access.js.map +0 -1
  494. package/dist/runtime/child-scope.d.ts.map +0 -1
  495. package/dist/runtime/child-scope.js.map +0 -1
  496. package/dist/runtime/component-cleanup.d.ts.map +0 -1
  497. package/dist/runtime/component-cleanup.js.map +0 -1
  498. package/dist/runtime/component-commit.js.map +0 -1
  499. package/dist/runtime/component-internal.d.ts.map +0 -1
  500. package/dist/runtime/component-internal.js.map +0 -1
  501. package/dist/runtime/component-lifecycle.d.ts.map +0 -1
  502. package/dist/runtime/component-lifecycle.js.map +0 -1
  503. package/dist/runtime/component-scope.d.ts.map +0 -1
  504. package/dist/runtime/component-scope.js.map +0 -1
  505. package/dist/runtime/context.d.ts.map +0 -1
  506. package/dist/runtime/context.js.map +0 -1
  507. package/dist/runtime/control.d.ts.map +0 -1
  508. package/dist/runtime/control.js.map +0 -1
  509. package/dist/runtime/derive.d.ts.map +0 -1
  510. package/dist/runtime/derive.js.map +0 -1
  511. package/dist/runtime/dev-namespace.d.ts.map +0 -1
  512. package/dist/runtime/dev-namespace.js.map +0 -1
  513. package/dist/runtime/effect.d.ts.map +0 -1
  514. package/dist/runtime/effect.js.map +0 -1
  515. package/dist/runtime/error-boundary.d.ts.map +0 -1
  516. package/dist/runtime/error-boundary.js.map +0 -1
  517. package/dist/runtime/events.d.ts.map +0 -1
  518. package/dist/runtime/events.js.map +0 -1
  519. package/dist/runtime/execution-model.d.ts.map +0 -1
  520. package/dist/runtime/execution-model.js.map +0 -1
  521. package/dist/runtime/fastlane.d.ts.map +0 -1
  522. package/dist/runtime/fastlane.js.map +0 -1
  523. package/dist/runtime/for-bench.d.ts.map +0 -1
  524. package/dist/runtime/for-bench.js.map +0 -1
  525. package/dist/runtime/for-internal.d.ts.map +0 -1
  526. package/dist/runtime/for-internal.js.map +0 -1
  527. package/dist/runtime/for-reconcile.d.ts.map +0 -1
  528. package/dist/runtime/for-reconcile.js.map +0 -1
  529. package/dist/runtime/for-scopes.d.ts.map +0 -1
  530. package/dist/runtime/for-scopes.js.map +0 -1
  531. package/dist/runtime/for-signals.d.ts.map +0 -1
  532. package/dist/runtime/for-signals.js.map +0 -1
  533. package/dist/runtime/for-types.d.ts.map +0 -1
  534. package/dist/runtime/lifecycle-operations.d.ts.map +0 -1
  535. package/dist/runtime/lifecycle-operations.js.map +0 -1
  536. package/dist/runtime/perf-metrics.d.ts.map +0 -1
  537. package/dist/runtime/perf-metrics.js.map +0 -1
  538. package/dist/runtime/portal.d.ts.map +0 -1
  539. package/dist/runtime/portal.js.map +0 -1
  540. package/dist/runtime/readable.d.ts.map +0 -1
  541. package/dist/runtime/readable.js.map +0 -1
  542. package/dist/runtime/resource-cell.js.map +0 -1
  543. package/dist/runtime/resource-operation.d.ts.map +0 -1
  544. package/dist/runtime/resource-operation.js.map +0 -1
  545. package/dist/runtime/runtime.d.ts.map +0 -1
  546. package/dist/runtime/runtime.js.map +0 -1
  547. package/dist/runtime/scheduler.d.ts.map +0 -1
  548. package/dist/runtime/scheduler.js.map +0 -1
  549. package/dist/runtime/selector-store.js.map +0 -1
  550. package/dist/runtime/selector.d.ts.map +0 -1
  551. package/dist/runtime/selector.js.map +0 -1
  552. package/dist/runtime/snapshot-source.d.ts.map +0 -1
  553. package/dist/runtime/snapshot-source.js.map +0 -1
  554. package/dist/runtime/state.d.ts.map +0 -1
  555. package/dist/runtime/state.js.map +0 -1
  556. package/dist/ssg/batch-render.js.map +0 -1
  557. package/dist/ssg/create-static-gen.d.ts.map +0 -1
  558. package/dist/ssg/create-static-gen.js.map +0 -1
  559. package/dist/ssg/generate-metadata.js.map +0 -1
  560. package/dist/ssg/generation-plan.js.map +0 -1
  561. package/dist/ssg/incremental-manifest.js.map +0 -1
  562. package/dist/ssg/resolve-ssg-data.js.map +0 -1
  563. package/dist/ssg/route-utils.js.map +0 -1
  564. package/dist/ssg/static-routes.js.map +0 -1
  565. package/dist/ssg/types.d.ts.map +0 -1
  566. package/dist/ssg/write-static-files.js.map +0 -1
  567. package/dist/ssr/attrs.js.map +0 -1
  568. package/dist/ssr/boundaries.js.map +0 -1
  569. package/dist/ssr/component-runtime.js.map +0 -1
  570. package/dist/ssr/context.d.ts.map +0 -1
  571. package/dist/ssr/context.js.map +0 -1
  572. package/dist/ssr/errors.d.ts.map +0 -1
  573. package/dist/ssr/errors.js.map +0 -1
  574. package/dist/ssr/escape.js.map +0 -1
  575. package/dist/ssr/hydration-data.js.map +0 -1
  576. package/dist/ssr/hydration-verify.d.ts.map +0 -1
  577. package/dist/ssr/hydration-verify.js.map +0 -1
  578. package/dist/ssr/index-internal.d.ts.map +0 -1
  579. package/dist/ssr/index-internal.js.map +0 -1
  580. package/dist/ssr/render-keys.js.map +0 -1
  581. package/dist/ssr/render-resolved.d.ts.map +0 -1
  582. package/dist/ssr/render-resolved.js.map +0 -1
  583. package/dist/ssr/render-sync.d.ts.map +0 -1
  584. package/dist/ssr/render-sync.js.map +0 -1
  585. package/dist/ssr/route-policy-resolution.js.map +0 -1
  586. package/dist/ssr/route-render.d.ts.map +0 -1
  587. package/dist/ssr/route-render.js.map +0 -1
  588. package/dist/ssr/sink.d.ts.map +0 -1
  589. package/dist/ssr/sink.js.map +0 -1
  590. package/dist/ssr/types.d.ts.map +0 -1
  591. package/dist/ssr/verify-hydration.js.map +0 -1
  592. package/dist/testing/index.d.ts.map +0 -1
  593. package/dist/testing/index.js.map +0 -1
@@ -15,11 +15,10 @@ function validateForKeys(forState, newArray) {
15
15
  if (key === null || key === void 0) failForValidation("[askr] Invalid For key detected. Keys should be stable, non-null, and unique within a For list.");
16
16
  if (seen.has(key)) failForValidation(`[askr] Duplicate For key detected: ${String(key)}. Keys should be stable, non-null, and unique within a For list.`);
17
17
  seen.add(key);
18
- const keyString = String(key);
19
18
  const keyKind = typeof key;
20
- const previousKeyKind = forState.devKeyKinds?.get(keyString);
21
- if (previousKeyKind && previousKeyKind !== keyKind) failForValidation(`[askr] For key type changed for ${keyString}. Keys must remain consistently typed across renders.`);
22
- keyKinds.set(keyString, keyKind);
19
+ const previousKeyKind = forState.devKeyKinds?.get(key);
20
+ if (previousKeyKind && previousKeyKind !== keyKind) failForValidation(`[askr] For key type changed for ${String(key)}. Keys must remain consistently typed across renders.`);
21
+ keyKinds.set(key, keyKind);
23
22
  }
24
23
  forState.devKeyKinds = keyKinds;
25
24
  }
@@ -32,6 +31,7 @@ function reconcileForItems(forState, newArray) {
32
31
  const oldLen = orderedKeys.length;
33
32
  const newLen = newArray.length;
34
33
  forState.lastRemovedNodes = [];
34
+ forState.lastRemovedRanges = [];
35
35
  if (newLen === 0) {
36
36
  if (oldLen > 0) disposeAllItems(forState, forState.fallback ? "teardown" : "none");
37
37
  recordBenchFastLane("TRUNCATE");
@@ -46,20 +46,75 @@ function reconcileForItems(forState, newArray) {
46
46
  return renderFallbackScope(forState);
47
47
  }
48
48
  if (forState.fallbackScope) disposeFallbackScope(forState, "none");
49
+ if (newLen === oldLen + 1) {
50
+ let oldIndex = 0;
51
+ let insertedIndex = -1;
52
+ let insertedKey = null;
53
+ for (let newIndex = 0; newIndex < newLen; newIndex++) {
54
+ const item = newArray[newIndex];
55
+ const key = byFn(item, newIndex);
56
+ const expectedKey = orderedKeys[oldIndex];
57
+ if (oldIndex < oldLen && key === expectedKey) {
58
+ const existing = items.get(key);
59
+ if (!existing || existing.item !== item || existing.scope.needsDomUpdate || oldIndex !== newIndex && existing.indexSignal._hasBeenRead) {
60
+ insertedIndex = -2;
61
+ break;
62
+ }
63
+ oldIndex++;
64
+ } else if (insertedIndex === -1 && !items.has(key)) {
65
+ insertedIndex = newIndex;
66
+ insertedKey = key;
67
+ } else {
68
+ insertedIndex = -2;
69
+ break;
70
+ }
71
+ }
72
+ if (insertedIndex >= 0 && oldIndex === oldLen && insertedKey !== null) {
73
+ const insertedItem = createItemInstance(insertedKey, newArray[insertedIndex], insertedIndex, forState);
74
+ const resultVNodes = forState.orderedVNodes.slice();
75
+ const resultItems = forState.orderedItems.slice();
76
+ const resultKeys = orderedKeys.slice();
77
+ resultVNodes.splice(insertedIndex, 0, insertedItem.scope.vnode);
78
+ resultItems.splice(insertedIndex, 0, insertedItem);
79
+ resultKeys.splice(insertedIndex, 0, insertedKey);
80
+ items.set(insertedKey, insertedItem);
81
+ recordBenchFastLane("INSERT_ONE");
82
+ recordBenchEvent("itemReused", oldLen);
83
+ forState.lastCommitStrategy = "INSERT_ONE";
84
+ forState.orderedKeys = resultKeys;
85
+ forState.orderedItems = resultItems;
86
+ forState.orderedVNodes = resultVNodes;
87
+ forState.pendingDirtyIndices = null;
88
+ forState.pendingSwapIndices = null;
89
+ forState.pendingMoveOnly = false;
90
+ forState.pendingInsertedIndex = insertedIndex;
91
+ if (BENCH_BUILD_ENABLED) {
92
+ recordBenchTiming("reconcile", performance.now() - reconcileStartMs);
93
+ flushBenchMetrics();
94
+ }
95
+ return resultVNodes;
96
+ }
97
+ }
49
98
  if (oldLen < newLen) {
50
99
  let canUseAppendPath = true;
51
- for (let i = 0; i < oldLen; i++) if (byFn(newArray[i], i) !== orderedKeys[i]) {
52
- canUseAppendPath = false;
53
- break;
100
+ let canSkipCommittedPrefix = true;
101
+ for (let i = 0; i < oldLen; i++) {
102
+ const key = byFn(newArray[i], i);
103
+ if (key !== orderedKeys[i]) {
104
+ canUseAppendPath = false;
105
+ break;
106
+ }
107
+ const existing = forState.orderedItems[i] ?? items.get(key);
108
+ if (!existing || existing.item !== newArray[i] || existing.scope.needsDomUpdate || existing.scope.hydrationPending) canSkipCommittedPrefix = false;
54
109
  }
55
110
  if (canUseAppendPath) {
56
- recordBenchFastLane("APPEND");
111
+ if (BENCH_BUILD_ENABLED) recordBenchFastLane("APPEND");
57
112
  forState.lastCommitStrategy = "APPEND";
58
113
  const resultVNodes = forState.orderedVNodes;
59
114
  const resultItems = forState.orderedItems;
60
115
  resultVNodes.length = newLen;
61
116
  resultItems.length = newLen;
62
- for (let i = 0; i < oldLen; i++) {
117
+ if (!canSkipCommittedPrefix) for (let i = 0; i < oldLen; i++) {
63
118
  const item = newArray[i];
64
119
  const key = orderedKeys[i];
65
120
  const existing = resultItems[i] ?? items.get(key);
@@ -67,7 +122,7 @@ function reconcileForItems(forState, newArray) {
67
122
  resultItems[i] = existing;
68
123
  resultVNodes[i] = existing.scope.vnode;
69
124
  }
70
- recordBenchEvent("itemReused", oldLen);
125
+ if (BENCH_BUILD_ENABLED) recordBenchEvent("itemReused", oldLen);
71
126
  for (let i = oldLen; i < newLen; i++) {
72
127
  const item = newArray[i];
73
128
  const key = byFn(item, i);
@@ -85,6 +140,7 @@ function reconcileForItems(forState, newArray) {
85
140
  forState.pendingDirtyIndices = null;
86
141
  forState.pendingSwapIndices = null;
87
142
  forState.pendingMoveOnly = false;
143
+ forState.pendingAppendStart = canSkipCommittedPrefix ? oldLen : 0;
88
144
  return resultVNodes;
89
145
  }
90
146
  }
@@ -102,7 +158,7 @@ function reconcileForItems(forState, newArray) {
102
158
  break;
103
159
  }
104
160
  if (canUseRemoveOnePath) {
105
- recordBenchFastLane("REMOVE_ONE");
161
+ if (BENCH_BUILD_ENABLED) recordBenchFastLane("REMOVE_ONE");
106
162
  forState.lastCommitStrategy = "NO_REORDER";
107
163
  const previousOrderedItems = forState.orderedItems.slice();
108
164
  const resultVNodes = forState.orderedVNodes;
@@ -123,7 +179,7 @@ function reconcileForItems(forState, newArray) {
123
179
  resultItems[i] = existing;
124
180
  resultVNodes[i] = existing.scope.vnode;
125
181
  }
126
- recordBenchEvent("itemReused", newLen);
182
+ if (BENCH_BUILD_ENABLED) recordBenchEvent("itemReused", newLen);
127
183
  const removedKey = orderedKeys[removedIndex];
128
184
  const removedItem = items.get(removedKey);
129
185
  if (removedItem) {
@@ -211,9 +267,8 @@ function reconcileForItems(forState, newArray) {
211
267
  const item = newArray[i];
212
268
  const key = orderedKeys[i];
213
269
  const existing = items.get(key);
214
- const itemChanged = existing.item !== item;
215
- if (itemChanged) updateItemInstance(forState, existing, item);
216
- if (!itemChanged && existing.scope.needsDomUpdate) dirtyIndices.push(i);
270
+ if (existing.item !== item) updateItemInstance(forState, existing, item);
271
+ if (existing.scope.needsDomUpdate) dirtyIndices.push(i);
217
272
  resultItems[i] = existing;
218
273
  resultVNodes[i] = existing.scope.vnode;
219
274
  }
@@ -274,7 +329,7 @@ function reconcileForItems(forState, newArray) {
274
329
  const nextOrderedItems = forState.orderedItems.slice();
275
330
  nextOrderedItems[firstMismatch] = secondExisting;
276
331
  nextOrderedItems[secondMismatch] = firstExisting;
277
- recordBenchEvent("itemReused");
332
+ if (BENCH_BUILD_ENABLED) recordBenchEvent("itemReused");
278
333
  recordBenchEvent("itemReused");
279
334
  if (firstExisting.item !== firstItem) updateItemInstance(forState, firstExisting, firstItem);
280
335
  if (secondExisting.item !== secondItem) updateItemInstance(forState, secondExisting, secondItem);
@@ -311,7 +366,7 @@ function reconcileForItems(forState, newArray) {
311
366
  recordBenchEvent("itemReused");
312
367
  }
313
368
  if (canUseMoveOnlyPath) {
314
- recordBenchFastLane("FULL_KEYED");
369
+ if (BENCH_BUILD_ENABLED) recordBenchFastLane("FULL_KEYED");
315
370
  forState.lastCommitStrategy = "FULL_KEYED";
316
371
  for (let i = 0; i < moveOnlyItems.length; i++) {
317
372
  syncForItemIndex(forState, moveOnlyItems[i], i);
@@ -330,7 +385,7 @@ function reconcileForItems(forState, newArray) {
330
385
  return moveOnlyVNodes;
331
386
  }
332
387
  }
333
- recordBenchFastLane("FULL_KEYED");
388
+ if (BENCH_BUILD_ENABLED) recordBenchFastLane("FULL_KEYED");
334
389
  forState.lastCommitStrategy = "FULL_KEYED";
335
390
  const toRemove = new Set(orderedKeys);
336
391
  const newOrderedKeys = [];
@@ -340,18 +395,18 @@ function reconcileForItems(forState, newArray) {
340
395
  for (let i = 0; i < newArray.length; i++) {
341
396
  const item = newArray[i];
342
397
  const key = byFn(item, i);
343
- recordBenchEvent("keyLookup");
398
+ if (BENCH_BUILD_ENABLED) recordBenchEvent("keyLookup");
344
399
  toRemove.delete(key);
345
400
  newOrderedKeys.push(key);
346
401
  const existing = items.get(key);
347
- recordBenchEvent(existing ? "keyHit" : "keyMiss");
402
+ if (BENCH_BUILD_ENABLED) recordBenchEvent(existing ? "keyHit" : "keyMiss");
348
403
  if (!existing) {
349
404
  const itemInstance = createItemInstance(key, item, i, forState);
350
405
  items.set(key, itemInstance);
351
406
  newOrderedItems.push(itemInstance);
352
407
  resultVNodes.push(itemInstance.scope.vnode);
353
408
  } else {
354
- recordBenchEvent("itemReused");
409
+ if (BENCH_BUILD_ENABLED) recordBenchEvent("itemReused");
355
410
  const itemChanged = existing.item !== item;
356
411
  const indexChanged = existing.indexSignal.peek() !== i;
357
412
  if (itemChanged) {
@@ -385,5 +440,3 @@ function reconcileForItems(forState, newArray) {
385
440
  }
386
441
  //#endregion
387
442
  export { reconcileForItems };
388
-
389
- //# sourceMappingURL=for-reconcile.js.map
@@ -1,5 +1,5 @@
1
1
  import { ChildScope } from "./child-scope.js";
2
- import { ForIndexSignal, ForItemPropertySignal, ForItemSignal } from "./for-signals.js";
2
+ import { ForIndexSignal, ReactiveForItemState } from "./for-signals.js";
3
3
  import { ForState } from "./for-internal.js";
4
4
  import { VNode } from "../common/vnode.js";
5
5
 
@@ -8,12 +8,13 @@ interface ForItemInstance<T> {
8
8
  key: string | number;
9
9
  item: T;
10
10
  reactiveItem: T;
11
- itemSignal: ForItemSignal<T> | null;
12
- itemPropertySignals: Map<PropertyKey, ForItemPropertySignal> | null;
11
+ reactiveItemState: ReactiveForItemState<T> | null;
13
12
  indexSignal: ForIndexSignal;
14
13
  scope: ChildScope;
15
14
  }
16
15
  type RemovedDomCleanupMode = 'none' | 'teardown' | 'full-clear';
16
+ declare function captureForItemTransactionSnapshot<T>(forState: ForState<T>, itemInstance: ForItemInstance<T>): void;
17
+ declare function captureForFallbackTransactionSnapshot<T>(forState: ForState<T>, fallbackScope?: ChildScope | null): void;
17
18
  declare function syncForItemIndex<T>(forState: ForState<T>, itemInstance: ForItemInstance<T>, nextIndex: number): boolean;
18
19
  declare function disposeItemInstance<T>(forState: ForState<T>, itemInstance: ForItemInstance<T>, domCleanup: RemovedDomCleanupMode): void;
19
20
  declare function createItemInstance<T>(key: string | number, item: T, index: number, forState: ForState<T>): ForItemInstance<T>;
@@ -22,5 +23,4 @@ declare function disposeFallbackScope<T>(forState: ForState<T>, domCleanup: Remo
22
23
  declare function renderFallbackScope<T>(forState: ForState<T>): VNode[];
23
24
  declare function disposeAllItems<T>(forState: ForState<T>, domCleanup: RemovedDomCleanupMode): void;
24
25
  //#endregion
25
- export { ForItemInstance, RemovedDomCleanupMode };
26
- //# sourceMappingURL=for-scopes.d.ts.map
26
+ export { ForItemInstance, RemovedDomCleanupMode };
@@ -1,16 +1,96 @@
1
1
  import { isDevelopmentEnvironment } from "../common/env.js";
2
2
  import { getRuntimeRenderer } from "./access.js";
3
- import { createChildScope, disposeChildScope } from "./child-scope.js";
4
- import { canProxyForItem, createForIndexSignal, createForItemSignal, createReactiveForItem, haveSameOwnKeys, notifyForSignalReaders, readForItemProperty, removeForParentReaders, scopeReadsSource, syncForIndexSignal } from "./for-signals.js";
5
- import { recordBenchEvent } from "./for-bench.js";
6
- //#region src/runtime/for-scopes.ts
3
+ import { captureChildScopeTransactionSnapshot, createChildScope, disposeChildScope } from "./child-scope.js";
4
+ import { canProxyForItem, createForIndexSignal, createReactiveForItem, haveSameOwnKeys, notifyForSignalReaders, readForItemProperty, removeForParentReaders, scopeDirectlyReadsSource, scopeReadsSource, syncForIndexSignal } from "./for-signals.js";
5
+ import "./for-bench.js";
7
6
  function enqueueForScopeUpdate(parent) {
8
7
  parent?._enqueueRun?.();
9
8
  }
9
+ const forStatesByScope = /* @__PURE__ */ new WeakMap();
10
+ function enqueueForBoundaryScopeCommit() {
11
+ const forState = this.blueprintOwner ?? forStatesByScope.get(this);
12
+ if (!forState) return;
13
+ if (forState._enqueueBoundaryCommit) {
14
+ forState._enqueueBoundaryCommit();
15
+ return;
16
+ }
17
+ enqueueForScopeUpdate(forState.parentInstance);
18
+ }
19
+ function createForOwnedChildScope(forState, key) {
20
+ return createChildScope(forState.parentInstance, key, enqueueForBoundaryScopeCommit);
21
+ }
22
+ function captureForItemTransactionSnapshot(forState, itemInstance) {
23
+ const transaction = forState._transaction;
24
+ if (!transaction || transaction.itemSnapshots?.has(itemInstance)) return;
25
+ if (transaction.collectionSnapshotMode === "reset-empty" || transaction.items.get(itemInstance.key) !== itemInstance) return;
26
+ const itemSnapshots = transaction.itemSnapshots ??= /* @__PURE__ */ new Map();
27
+ const propertySignals = itemInstance.reactiveItemState?.propertySignals ?? null;
28
+ const itemSignal = itemInstance.reactiveItemState?.itemSignal ?? null;
29
+ const propertySnapshots = propertySignals && propertySignals.size > 0 ? new Map(Array.from(propertySignals, ([property, signal]) => [property, {
30
+ signal,
31
+ value: signal.peek(),
32
+ hasBeenRead: signal._hasBeenRead === true
33
+ }])) : null;
34
+ itemSnapshots.set(itemInstance, {
35
+ item: itemInstance.item,
36
+ itemSignalExists: itemSignal !== null,
37
+ itemSignalValue: itemSignal?.peek(),
38
+ itemSignalHasBeenRead: itemSignal?._hasBeenRead === true,
39
+ indexValue: itemInstance.indexSignal.peek(),
40
+ indexHasBeenRead: itemInstance.indexSignal._hasBeenRead === true,
41
+ propertySignalStore: propertySignals,
42
+ propertySignals: propertySnapshots,
43
+ scope: captureChildScopeTransactionSnapshot(itemInstance.scope)
44
+ });
45
+ }
46
+ function captureForFallbackTransactionSnapshot(forState, fallbackScope = forState.fallbackScope) {
47
+ const transaction = forState._transaction;
48
+ if (!transaction || !fallbackScope || transaction.fallbackScope !== fallbackScope || transaction.fallbackScopeSnapshot) return;
49
+ transaction.fallbackScopeSnapshot = captureChildScopeTransactionSnapshot(fallbackScope);
50
+ }
51
+ function stageForSignalEffect(forState, source, notify, skipInstance = null, skipOwnedBy = null) {
52
+ const transaction = forState._transaction;
53
+ if (!transaction) return false;
54
+ const effects = transaction.signalEffects ??= /* @__PURE__ */ new Map();
55
+ const existing = effects.get(source);
56
+ if (existing) {
57
+ existing.notify ||= notify;
58
+ if (existing.skipInstance !== skipInstance) existing.skipInstance = null;
59
+ if (existing.skipOwnedBy !== skipOwnedBy) existing.skipOwnedBy = null;
60
+ } else effects.set(source, {
61
+ parentInstance: forState.parentInstance,
62
+ notify,
63
+ skipInstance,
64
+ skipOwnedBy
65
+ });
66
+ return true;
67
+ }
10
68
  function syncForItemIndex(forState, itemInstance, nextIndex) {
11
69
  const indexSignal = itemInstance.indexSignal;
12
- if (indexSignal.peek() === nextIndex) return false;
13
- if (!scopeReadsSource(itemInstance.scope, indexSignal)) {
70
+ const previousIndex = indexSignal.peek();
71
+ if (previousIndex === nextIndex) return false;
72
+ if (indexSignal._hasBeenRead !== true) {
73
+ const transaction = forState._transaction;
74
+ if (transaction) {
75
+ const snapshots = transaction.unreadIndexSnapshots ??= /* @__PURE__ */ new Map();
76
+ if (!snapshots.has(indexSignal)) snapshots.set(indexSignal, previousIndex);
77
+ }
78
+ indexSignal.set(nextIndex, false);
79
+ return false;
80
+ }
81
+ captureForItemTransactionSnapshot(forState, itemInstance);
82
+ const scopeReadsIndex = scopeReadsSource(itemInstance.scope, indexSignal);
83
+ const scopeDirectlyReadsIndex = scopeDirectlyReadsSource(itemInstance.scope, indexSignal);
84
+ if (forState._transaction) {
85
+ const shouldNotify = indexSignal._hasBeenRead === true;
86
+ indexSignal.set(nextIndex, false);
87
+ stageForSignalEffect(forState, indexSignal, shouldNotify, scopeReadsIndex ? itemInstance.scope.componentInstance : null);
88
+ if (!scopeReadsIndex) return false;
89
+ if (scopeDirectlyReadsIndex) rerenderItemInstance(forState, itemInstance, itemInstance.reactiveItem);
90
+ else itemInstance.scope.markDirty();
91
+ return true;
92
+ }
93
+ if (!scopeReadsIndex) {
14
94
  syncForIndexSignal(indexSignal, nextIndex);
15
95
  return false;
16
96
  }
@@ -19,25 +99,32 @@ function syncForItemIndex(forState, itemInstance, nextIndex) {
19
99
  rerenderItemInstance(forState, itemInstance, itemInstance.reactiveItem);
20
100
  return true;
21
101
  }
22
- function materializeItemVnode(key, vnode) {
102
+ function materializeItemVnode(forState, key, vnode) {
23
103
  if (vnode && typeof vnode === "object" && "type" in vnode) {
24
104
  const vn = vnode;
25
105
  vn.key = key;
26
- if (typeof vn.type === "string") {
106
+ if (forState.parentInstance?.ssr && typeof vn.type === "string") {
27
107
  if (!vn.props) vn.props = {};
28
108
  if (vn.props["data-key"] === void 0) vn.props["data-key"] = String(key);
109
+ if (vn.props["data-askr-key-kind"] === void 0) vn.props["data-askr-key-kind"] = typeof key;
29
110
  }
30
111
  }
31
112
  }
32
113
  function renderItemScope(forState, scope, item, indexSignal, key) {
33
- recordBenchEvent("rowFactory");
34
114
  const vnode = scope.render(() => forState.renderFn(item, indexSignal));
35
- materializeItemVnode(key, vnode);
115
+ materializeItemVnode(forState, key, vnode);
36
116
  return vnode;
37
117
  }
38
118
  function disposeItemInstance(forState, itemInstance, domCleanup) {
39
- recordBenchEvent("itemRemoved");
40
119
  const removedDom = itemInstance.scope.dom;
120
+ const removedRange = itemInstance.scope.range;
121
+ const transaction = forState._transaction;
122
+ if (transaction) {
123
+ (transaction.removedScopes ??= []).push(itemInstance.scope);
124
+ if (removedDom) forState.lastRemovedNodes.push(removedDom);
125
+ if (removedRange) forState.lastRemovedRanges.push(removedRange);
126
+ return;
127
+ }
41
128
  try {
42
129
  disposeChildScope(itemInstance.scope);
43
130
  } catch (err) {
@@ -48,27 +135,25 @@ function disposeItemInstance(forState, itemInstance, domCleanup) {
48
135
  if (domCleanup === "teardown") getRuntimeRenderer().teardownNodeSubtree(removedDom);
49
136
  }
50
137
  forState.lastRemovedNodes.push(removedDom);
138
+ if (removedRange) forState.lastRemovedRanges.push(removedRange);
51
139
  }
52
140
  function createItemInstance(key, item, index, forState) {
53
- recordBenchEvent("itemCreated");
54
141
  const indexSignal = createForIndexSignal(index);
55
- const itemSignal = canProxyForItem(item) ? createForItemSignal(item) : null;
56
- const itemPropertySignals = itemSignal ? /* @__PURE__ */ new Map() : null;
57
- const reactiveItem = itemSignal && itemPropertySignals ? createReactiveForItem(itemSignal, itemPropertySignals) : item;
58
- const scope = createChildScope(forState.parentInstance, key, () => {
59
- if (forState._enqueueBoundaryCommit) {
60
- forState._enqueueBoundaryCommit();
61
- return;
62
- }
63
- enqueueForScopeUpdate(forState.parentInstance);
64
- });
65
- renderItemScope(forState, scope, reactiveItem, indexSignal, key);
142
+ const reactiveItemState = canProxyForItem(item) ? createReactiveForItem(item) : null;
143
+ const reactiveItem = reactiveItemState?.proxy ?? item;
144
+ const scope = createForOwnedChildScope(forState, key);
145
+ scope.blueprintOwner = forState;
146
+ try {
147
+ renderItemScope(forState, scope, reactiveItem, indexSignal, key);
148
+ } catch (error) {
149
+ disposeChildScope(scope);
150
+ throw error;
151
+ }
66
152
  return {
67
153
  key,
68
154
  item,
69
155
  reactiveItem,
70
- itemSignal,
71
- itemPropertySignals,
156
+ reactiveItemState,
72
157
  indexSignal,
73
158
  scope
74
159
  };
@@ -78,16 +163,19 @@ function rerenderItemInstance(forState, itemInstance, item) {
78
163
  }
79
164
  function updateItemInstance(forState, itemInstance, item) {
80
165
  if (itemInstance.item === item) return false;
166
+ captureForItemTransactionSnapshot(forState, itemInstance);
81
167
  const previousItem = itemInstance.item;
82
168
  itemInstance.item = item;
83
169
  const scope = itemInstance.scope;
84
170
  let scopeReadsChangedSignal = false;
85
- const itemSignal = itemInstance.itemSignal;
86
- if (!itemSignal) {
171
+ const reactiveItemState = itemInstance.reactiveItemState;
172
+ if (!reactiveItemState) {
87
173
  rerenderItemInstance(forState, itemInstance, item);
88
174
  return true;
89
175
  }
90
- const propertySignals = itemInstance.itemPropertySignals;
176
+ const itemSignal = reactiveItemState.itemSignal;
177
+ reactiveItemState.currentItem = item;
178
+ const propertySignals = reactiveItemState.propertySignals;
91
179
  const changedPropertySignals = [];
92
180
  if (propertySignals && propertySignals.size > 0) for (const [prop, propertySignal] of propertySignals) {
93
181
  const previousValue = readForItemProperty(previousItem, prop);
@@ -96,17 +184,35 @@ function updateItemInstance(forState, itemInstance, item) {
96
184
  if (scopeReadsSource(scope, propertySignal)) scopeReadsChangedSignal = true;
97
185
  changedPropertySignals.push([propertySignal, nextValue]);
98
186
  }
99
- if (scopeReadsSource(scope, itemSignal)) scopeReadsChangedSignal = true;
100
- const itemShapeChanged = changedPropertySignals.length === 0 && !haveSameOwnKeys(previousItem, item);
101
- const notifyReaders = !scopeReadsChangedSignal && (changedPropertySignals.length > 0 || itemShapeChanged);
102
- const visibleChange = scopeReadsChangedSignal || changedPropertySignals.length > 0 || itemShapeChanged;
103
- for (const [propertySignal, nextValue] of changedPropertySignals) {
187
+ if (itemSignal && scopeReadsSource(scope, itemSignal)) scopeReadsChangedSignal = true;
188
+ let coalescedPropertyChanged = false;
189
+ const coalescedProperties = reactiveItemState.coalescedProperties;
190
+ if (coalescedProperties !== null) if (Array.isArray(coalescedProperties)) {
191
+ for (const property of coalescedProperties) if (!Object.is(readForItemProperty(previousItem, property), readForItemProperty(item, property))) {
192
+ coalescedPropertyChanged = true;
193
+ break;
194
+ }
195
+ } else {
196
+ coalescedPropertyChanged = !Object.is(readForItemProperty(previousItem, coalescedProperties), readForItemProperty(item, coalescedProperties));
197
+ const secondProperty = reactiveItemState.coalescedProperty2;
198
+ if (secondProperty !== null && !coalescedPropertyChanged) coalescedPropertyChanged = !Object.is(readForItemProperty(previousItem, secondProperty), readForItemProperty(item, secondProperty));
199
+ }
200
+ const wholeItemChanged = itemSignal?._hasBeenRead === true && (reactiveItemState.wholeItemRead || coalescedPropertyChanged);
201
+ const itemShapeChanged = !wholeItemChanged && changedPropertySignals.length === 0 && !haveSameOwnKeys(previousItem, item);
202
+ const notifyReaders = !scopeReadsChangedSignal && (changedPropertySignals.length > 0 || itemShapeChanged || wholeItemChanged);
203
+ const visibleChange = scopeReadsChangedSignal || changedPropertySignals.length > 0 || itemShapeChanged || wholeItemChanged;
204
+ for (const [propertySignal, nextValue] of changedPropertySignals) if (stageForSignalEffect(forState, propertySignal, notifyReaders, null, itemInstance.scope.componentInstance)) propertySignal.set(nextValue, false);
205
+ else {
104
206
  removeForParentReaders(forState.parentInstance, propertySignal);
105
207
  propertySignal.set(nextValue, notifyReaders);
106
208
  }
107
- removeForParentReaders(forState.parentInstance, itemSignal);
108
- itemSignal.set(item, notifyReaders);
109
- if (scopeReadsChangedSignal) rerenderItemInstance(forState, itemInstance, itemInstance.reactiveItem);
209
+ if (itemSignal && stageForSignalEffect(forState, itemSignal, notifyReaders, null, itemInstance.scope.componentInstance)) itemSignal.set(item, false);
210
+ else if (itemSignal) {
211
+ removeForParentReaders(forState.parentInstance, itemSignal);
212
+ itemSignal.set(item, notifyReaders);
213
+ }
214
+ if (scopeReadsChangedSignal) if (itemSignal !== null && scopeDirectlyReadsSource(scope, itemSignal) || changedPropertySignals.some(([propertySignal]) => scopeDirectlyReadsSource(scope, propertySignal))) rerenderItemInstance(forState, itemInstance, itemInstance.reactiveItem);
215
+ else scope.markDirty();
110
216
  return visibleChange;
111
217
  }
112
218
  const FOR_FALLBACK_SCOPE_KEY = "__for-fallback__";
@@ -114,13 +220,19 @@ function disposeFallbackScope(forState, domCleanup) {
114
220
  const fallbackScope = forState.fallbackScope;
115
221
  if (!fallbackScope) return;
116
222
  const removedDom = fallbackScope.dom;
117
- disposeChildScope(fallbackScope);
223
+ const removedRange = fallbackScope.range;
224
+ const transaction = forState._transaction;
225
+ if (transaction) {
226
+ (transaction.removedScopes ??= []).push(fallbackScope);
227
+ if (removedRange) forState.lastRemovedRanges.push(removedRange);
228
+ } else disposeChildScope(fallbackScope);
118
229
  forState.fallbackScope = null;
119
230
  if (!removedDom) return;
120
231
  if (removedDom instanceof Element) {
121
232
  if (domCleanup === "teardown") getRuntimeRenderer().teardownNodeSubtree(removedDom);
122
233
  }
123
234
  forState.lastRemovedNodes.push(removedDom);
235
+ if (removedRange) forState.lastRemovedRanges.push(removedRange);
124
236
  }
125
237
  function renderFallbackScope(forState) {
126
238
  if (forState.fallback == null || forState.fallback === false) {
@@ -129,21 +241,31 @@ function renderFallbackScope(forState) {
129
241
  forState.orderedItems = [];
130
242
  return [];
131
243
  }
132
- const fallbackScope = forState.fallbackScope ?? createChildScope(forState.parentInstance, FOR_FALLBACK_SCOPE_KEY, () => {
133
- if (forState._enqueueBoundaryCommit) {
134
- forState._enqueueBoundaryCommit();
135
- return;
136
- }
137
- enqueueForScopeUpdate(forState.parentInstance);
138
- });
244
+ const fallbackScope = forState.fallbackScope ?? createForOwnedChildScope(forState, FOR_FALLBACK_SCOPE_KEY);
245
+ if (!forState.fallbackScope) forStatesByScope.set(fallbackScope, forState);
139
246
  forState.fallbackScope = fallbackScope;
140
- const vnode = fallbackScope.render(() => forState.fallback);
247
+ captureForFallbackTransactionSnapshot(forState, fallbackScope);
248
+ const fallbackVNode = forState.fallback;
249
+ const vnode = fallbackScope.render(() => fallbackVNode);
141
250
  forState.orderedVNodes = vnode == null || vnode === false ? [] : [vnode];
142
251
  forState.orderedItems = [];
143
252
  return forState.orderedVNodes;
144
253
  }
145
254
  function disposeAllItems(forState, domCleanup) {
146
255
  const { items, orderedKeys } = forState;
256
+ if (forState._transaction?.collectionSnapshotMode === "preserve-clear") {
257
+ const transaction = forState._transaction;
258
+ transaction.removeAllItems = true;
259
+ for (let index = 0; index < forState.orderedItems.length; index++) {
260
+ const removedDom = forState.orderedItems[index]?.scope.dom;
261
+ if (removedDom) forState.lastRemovedNodes.push(removedDom);
262
+ const range = forState.orderedItems[index]?.scope.range;
263
+ if (range) forState.lastRemovedRanges.push(range);
264
+ }
265
+ forState.items = /* @__PURE__ */ new Map();
266
+ forState.orderedKeys = [];
267
+ return;
268
+ }
147
269
  for (let index = 0; index < orderedKeys.length; index += 1) {
148
270
  const key = orderedKeys[index];
149
271
  const itemInstance = items.get(key);
@@ -155,6 +277,4 @@ function disposeAllItems(forState, domCleanup) {
155
277
  forState.orderedKeys = orderedKeys;
156
278
  }
157
279
  //#endregion
158
- export { createItemInstance, disposeAllItems, disposeFallbackScope, disposeItemInstance, renderFallbackScope, syncForItemIndex, updateItemInstance };
159
-
160
- //# sourceMappingURL=for-scopes.js.map
280
+ export { captureForFallbackTransactionSnapshot, captureForItemTransactionSnapshot, createItemInstance, disposeAllItems, disposeFallbackScope, disposeItemInstance, renderFallbackScope, syncForItemIndex, updateItemInstance };
@@ -15,16 +15,25 @@ type ForIndexSignal = ReadableSource<number> & (() => number) & {
15
15
  peek(): number;
16
16
  set(newValue: number | ((prev: number) => number), notifyReaders?: boolean): void;
17
17
  };
18
- declare function notifyForSignalReaders(source: ReadableSource<unknown>, skipInstance?: ComponentInstance | null): void;
18
+ declare function notifyForSignalReaders(source: ReadableSource<unknown>, skipInstance?: ComponentInstance | null, skipOwnedBy?: ComponentInstance | null): void;
19
19
  declare function createForIndexSignal(initialIndex: number): ForIndexSignal;
20
20
  declare function syncForIndexSignal(indexSignal: ForIndexSignal, nextIndex: number): boolean;
21
21
  declare function createForItemSignal<T>(initialItem: T): ForItemSignal<T>;
22
22
  declare function readForItemProperty(item: unknown, prop: PropertyKey): unknown;
23
23
  declare function haveSameOwnKeys(previousItem: unknown, nextItem: unknown): boolean;
24
24
  declare function scopeReadsSource(scope: ChildScope, source: ReadableSource<unknown>): boolean;
25
+ declare function scopeDirectlyReadsSource(scope: ChildScope, source: ReadableSource<unknown>): boolean;
25
26
  declare function removeForParentReaders(parentInstance: ComponentInstance | null, source: ReadableSource<unknown>): void;
26
27
  declare function canProxyForItem(item: unknown): item is object;
27
- declare function createReactiveForItem<T>(itemSignal: ForItemSignal<T>, propertySignals: Map<PropertyKey, ForItemPropertySignal>): T;
28
+ interface ReactiveForItemState<T> {
29
+ currentItem: T;
30
+ itemSignal: ForItemSignal<T> | null;
31
+ propertySignals: Map<PropertyKey, ForItemPropertySignal> | null;
32
+ coalescedProperties: PropertyKey | PropertyKey[] | null;
33
+ coalescedProperty2: PropertyKey | null;
34
+ wholeItemRead: boolean;
35
+ proxy: T;
36
+ }
37
+ declare function createReactiveForItem<T>(item: T): ReactiveForItemState<T>;
28
38
  //#endregion
29
- export { ForIndexSignal, ForItemPropertySignal, ForItemSignal };
30
- //# sourceMappingURL=for-signals.d.ts.map
39
+ export { ForIndexSignal, ForItemPropertySignal, ForItemSignal, ReactiveForItemState };