@barefootjs/jsx 0.33.2 → 0.33.4

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 (61) hide show
  1. package/dist/analyzer.d.ts +17 -0
  2. package/dist/analyzer.d.ts.map +1 -1
  3. package/dist/compiler.d.ts +21 -5
  4. package/dist/compiler.d.ts.map +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +804 -445
  8. package/dist/ir-to-client-js/build-references.d.ts.map +1 -1
  9. package/dist/ir-to-client-js/collect-elements.d.ts.map +1 -1
  10. package/dist/ir-to-client-js/control-flow/plan/build-component-loop.d.ts.map +1 -1
  11. package/dist/ir-to-client-js/control-flow/plan/loop.d.ts +2 -4
  12. package/dist/ir-to-client-js/control-flow/plan/loop.d.ts.map +1 -1
  13. package/dist/ir-to-client-js/control-flow/stringify/component-loop.d.ts.map +1 -1
  14. package/dist/ir-to-client-js/control-flow/stringify/loop-child-arm.d.ts.map +1 -1
  15. package/dist/ir-to-client-js/control-flow.d.ts.map +1 -1
  16. package/dist/ir-to-client-js/html-template.d.ts.map +1 -1
  17. package/dist/ir-to-client-js/imports.d.ts +60 -2
  18. package/dist/ir-to-client-js/imports.d.ts.map +1 -1
  19. package/dist/ir-to-client-js/prop-handling.d.ts +4 -7
  20. package/dist/ir-to-client-js/prop-handling.d.ts.map +1 -1
  21. package/dist/ir-to-client-js/utils.d.ts +26 -2
  22. package/dist/ir-to-client-js/utils.d.ts.map +1 -1
  23. package/dist/jsx-to-ir.d.ts.map +1 -1
  24. package/dist/props-binding.d.ts +35 -0
  25. package/dist/props-binding.d.ts.map +1 -1
  26. package/dist/types.d.ts +63 -13
  27. package/dist/types.d.ts.map +1 -1
  28. package/package.json +2 -2
  29. package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +145 -97
  30. package/src/__tests__/child-component-ref-not-mirrored.test.ts +90 -0
  31. package/src/__tests__/fragment-body-loop-key.test.ts +95 -0
  32. package/src/__tests__/ir-to-client-js/imports.test.ts +107 -0
  33. package/src/__tests__/ir-to-client-js/merge-compiled-client-js-imports.test.ts +138 -0
  34. package/src/__tests__/issue-2754-rest-spread-needs-slot.test.ts +85 -0
  35. package/src/__tests__/issue-2756-loop-row-honors-client-only.test.ts +173 -0
  36. package/src/__tests__/merge-template-imports.test.ts +41 -1
  37. package/src/__tests__/multi-component-shared-default-import.test.ts +55 -0
  38. package/src/__tests__/multi-root-loop-body.test.ts +7 -3
  39. package/src/__tests__/preamble-declarations.test.ts +42 -0
  40. package/src/__tests__/root-key-relay.test.ts +170 -0
  41. package/src/__tests__/signal-getter-not-called.test.ts +149 -0
  42. package/src/__tests__/state-only-file-default-import.test.ts +47 -0
  43. package/src/analyzer.ts +36 -0
  44. package/src/compiler.ts +94 -104
  45. package/src/index.ts +1 -1
  46. package/src/ir-to-client-js/build-references.ts +7 -0
  47. package/src/ir-to-client-js/collect-elements.ts +27 -5
  48. package/src/ir-to-client-js/control-flow/plan/build-component-loop.ts +19 -1
  49. package/src/ir-to-client-js/control-flow/plan/loop.ts +2 -4
  50. package/src/ir-to-client-js/control-flow/stringify/component-loop.ts +7 -0
  51. package/src/ir-to-client-js/control-flow/stringify/inner-loop.ts +6 -2
  52. package/src/ir-to-client-js/control-flow/stringify/loop-child-arm.ts +5 -2
  53. package/src/ir-to-client-js/control-flow.ts +12 -0
  54. package/src/ir-to-client-js/html-template.ts +174 -23
  55. package/src/ir-to-client-js/imports.ts +178 -5
  56. package/src/ir-to-client-js/index.ts +5 -0
  57. package/src/ir-to-client-js/prop-handling.ts +6 -17
  58. package/src/ir-to-client-js/utils.ts +30 -2
  59. package/src/jsx-to-ir.ts +592 -58
  60. package/src/props-binding.ts +51 -0
  61. package/src/types.ts +60 -13
@@ -1,7 +1,7 @@
1
1
  // Bun Snapshot v1, https://bun.sh/docs/test/snapshots
2
2
 
3
3
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L15 — Ternary 1`] = `
4
- "import { $, __bfSlot, createComponent, createDisposableEffect, createEffect, createSignal, escapeText, escapeTextOrMarkup, escapeTextOrNode, hydrate, insert, lazySlots } from '@barefootjs/client/runtime'
4
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, __bfSlot, createDisposableEffect, escapeText, insert } from '@barefootjs/client/runtime'
5
5
 
6
6
  export function initTodoItem(__scope, _p = {}) {
7
7
  if (!__scope) return
@@ -69,7 +69,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
69
69
  `;
70
70
 
71
71
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L18 — Logical AND 1`] = `
72
- "import { $, $c, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, insert, lazySlots, renderChild } from '@barefootjs/client/runtime'
72
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, $c, initChild, insert, renderChild } from '@barefootjs/client/runtime'
73
73
 
74
74
  export function initTodoItem(__scope, _p = {}) {
75
75
  if (!__scope) return
@@ -139,7 +139,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
139
139
  `;
140
140
 
141
141
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L31 — (no label) 1`] = `
142
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, mapArray, renderChild } from '@barefootjs/client/runtime'
142
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, initChild, mapArray, renderChild } from '@barefootjs/client/runtime'
143
143
 
144
144
  export function initTodoItem(__scope, _p = {}) {
145
145
  if (!__scope) return
@@ -198,7 +198,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
198
198
  `;
199
199
 
200
200
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L40 — ✅ Simple predicate 1`] = `
201
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, mapArray, renderChild } from '@barefootjs/client/runtime'
201
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, initChild, mapArray, renderChild } from '@barefootjs/client/runtime'
202
202
 
203
203
  export function initTodoItem(__scope, _p = {}) {
204
204
  if (!__scope) return
@@ -257,7 +257,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
257
257
  `;
258
258
 
259
259
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L45 — ✅ Block body with simple statements — also works 1`] = `
260
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, mapArray, renderChild } from '@barefootjs/client/runtime'
260
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, initChild, mapArray, renderChild } from '@barefootjs/client/runtime'
261
261
 
262
262
  export function initTodoItem(__scope, _p = {}) {
263
263
  if (!__scope) return
@@ -326,7 +326,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
326
326
  `;
327
327
 
328
328
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L59 — ✅ Projection — works on every adapter 1`] = `
329
- "import { $, createComponent, createEffect, createSignal, escapeAttr, escapeText, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, mapArray, patchLeaf } from '@barefootjs/client/runtime'
329
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArray, patchLeaf } from '@barefootjs/client/runtime'
330
330
 
331
331
  export function initTodoItem(__scope, _p = {}) {
332
332
  if (!__scope) return
@@ -392,7 +392,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
392
392
  `;
393
393
 
394
394
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L64 — ✅ Statement body — JS-runtime adapters; /* @client */ on Go/Mojo etc. 1`] = `
395
- "import { $, createComponent, createEffect, createSignal, escapeText, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, mapArray, patchLeaf } from '@barefootjs/client/runtime'
395
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeText, mapArray, patchLeaf } from '@barefootjs/client/runtime'
396
396
 
397
397
  export function initTodoItem(__scope, _p = {}) {
398
398
  if (!__scope) return
@@ -464,7 +464,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
464
464
  `;
465
465
 
466
466
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L74 — ✅ Sort then render 1`] = `
467
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, mapArray, renderChild } from '@barefootjs/client/runtime'
467
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, initChild, mapArray, renderChild } from '@barefootjs/client/runtime'
468
468
 
469
469
  export function initTodoItem(__scope, _p = {}) {
470
470
  if (!__scope) return
@@ -523,7 +523,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
523
523
  `;
524
524
 
525
525
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L79 — ✅ Filter, sort, then render 1`] = `
526
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, mapArray, renderChild } from '@barefootjs/client/runtime'
526
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, initChild, mapArray, renderChild } from '@barefootjs/client/runtime'
527
527
 
528
528
  export function initTodoItem(__scope, _p = {}) {
529
529
  if (!__scope) return
@@ -582,7 +582,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
582
582
  `;
583
583
 
584
584
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L84 — ✅ Multi-key: sort by price, break ties by name 1`] = `
585
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, mapArray, renderChild } from '@barefootjs/client/runtime'
585
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, initChild, mapArray, renderChild } from '@barefootjs/client/runtime'
586
586
 
587
587
  export function initTodoItem(__scope, _p = {}) {
588
588
  if (!__scope) return
@@ -641,7 +641,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
641
641
  `;
642
642
 
643
643
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L89 — ✅ Relational ternary 1`] = `
644
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, mapArray, renderChild } from '@barefootjs/client/runtime'
644
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, initChild, mapArray, renderChild } from '@barefootjs/client/runtime'
645
645
 
646
646
  export function initTodoItem(__scope, _p = {}) {
647
647
  if (!__scope) return
@@ -700,7 +700,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
700
700
  `;
701
701
 
702
702
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L100 — (no label) 1`] = `
703
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots } from '@barefootjs/client/runtime'
703
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $ } from '@barefootjs/client/runtime'
704
704
 
705
705
  export function initTodoItem(__scope, _p = {}) {
706
706
  if (!__scope) return
@@ -1264,7 +1264,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
1264
1264
  `;
1265
1265
 
1266
1266
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L229 — ✅ Value-producing block bodies normalize (let-inline) and lower everywhere 1`] = `
1267
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, mapArray, renderChild } from '@barefootjs/client/runtime'
1267
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, initChild, mapArray, renderChild } from '@barefootjs/client/runtime'
1268
1268
 
1269
1269
  export function initTodoItem(__scope, _p = {}) {
1270
1270
  if (!__scope) return
@@ -1323,7 +1323,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
1323
1323
  `;
1324
1324
 
1325
1325
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L239 — ❌ BF021 on Go/Mojo — a JS-runtime target (Hono, CSR) runs the comparator 1`] = `
1326
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, mapArray, renderChild } from '@barefootjs/client/runtime'
1326
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, initChild, mapArray, renderChild } from '@barefootjs/client/runtime'
1327
1327
 
1328
1328
  export function initTodoItem(__scope, _p = {}) {
1329
1329
  if (!__scope) return
@@ -1382,7 +1382,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
1382
1382
  `;
1383
1383
 
1384
1384
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L244 — ✅ Use /* @client */ 1`] = `
1385
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, mapArray, renderChild } from '@barefootjs/client/runtime'
1385
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, initChild, mapArray, renderChild } from '@barefootjs/client/runtime'
1386
1386
 
1387
1387
  export function initTodoItem(__scope, _p = {}) {
1388
1388
  if (!__scope) return
@@ -1469,7 +1469,7 @@ export function SortedList(_p, __bfKey) { return createComponent('SortedList__b3
1469
1469
  `;
1470
1470
 
1471
1471
  exports[`docs/core/rendering/jsx-compatibility.md doc-examples L262 — ✅ Use /* @client */, or inline / re-declare the comparator locally 1`] = `
1472
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, mapArray, renderChild } from '@barefootjs/client/runtime'
1472
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, initChild, mapArray, renderChild } from '@barefootjs/client/runtime'
1473
1473
 
1474
1474
  export function initTodoItem(__scope, _p = {}) {
1475
1475
  if (!__scope) return
@@ -1754,7 +1754,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
1754
1754
  `;
1755
1755
 
1756
1756
  exports[`docs/core/rendering/fragment.md doc-examples L23 — (no label) 1`] = `
1757
- "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots } from '@barefootjs/client/runtime'
1757
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, markupOrEmpty } from '@barefootjs/client/runtime'
1758
1758
 
1759
1759
  export function initTodoItem(__scope, _p = {}) {
1760
1760
  if (!__scope) return
@@ -1801,7 +1801,7 @@ export function initExample(__scope, _p = {}) {
1801
1801
 
1802
1802
  }
1803
1803
 
1804
- hydrate('Example', { init: initExample, template: (_p) => \`<div>\${_p.children}\${_p.children}</div>\` })
1804
+ hydrate('Example', { init: initExample, template: (_p) => \`<div>\${markupOrEmpty(_p.children)}\${markupOrEmpty(_p.children)}</div>\` })
1805
1805
  export function Example(_p, __bfKey) { return createComponent('Example', _p, __bfKey) }"
1806
1806
  `;
1807
1807
 
@@ -2578,7 +2578,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
2578
2578
  `;
2579
2579
 
2580
2580
  exports[`docs/core/reactivity/props-reactivity.md doc-examples L82 — Parent 1`] = `
2581
- "import { $c, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, renderChild } from '@barefootjs/client/runtime'
2581
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $c, initChild, renderChild } from '@barefootjs/client/runtime'
2582
2582
  import '/* @bf-child:Child */'
2583
2583
 
2584
2584
  export function initTodoItem(__scope, _p = {}) {
@@ -2833,7 +2833,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
2833
2833
  `;
2834
2834
 
2835
2835
  exports[`docs/core/components/children-slots.md doc-examples L14 — (no label) 1`] = `
2836
- "import { $c, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, renderChild } from '@barefootjs/client/runtime'
2836
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $c, initChild, renderChild } from '@barefootjs/client/runtime'
2837
2837
  import '/* @bf-child:Card */'
2838
2838
 
2839
2839
  export function initTodoItem(__scope, _p = {}) {
@@ -2909,7 +2909,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
2909
2909
  `;
2910
2910
 
2911
2911
  exports[`docs/core/components/children-slots.md doc-examples L68 — Input 1`] = `
2912
- "import { $c, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, renderChild } from '@barefootjs/client/runtime'
2912
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $c, initChild, renderChild } from '@barefootjs/client/runtime'
2913
2913
  import '/* @bf-child:Slot */'
2914
2914
 
2915
2915
  export function initTodoItem(__scope, _p = {}) {
@@ -2967,7 +2967,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
2967
2967
  `;
2968
2968
 
2969
2969
  exports[`docs/core/components/children-slots.md doc-examples L73 — Output 1`] = `
2970
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots } from '@barefootjs/client/runtime'
2970
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $ } from '@barefootjs/client/runtime'
2971
2971
 
2972
2972
  export function initTodoItem(__scope, _p = {}) {
2973
2973
  if (!__scope) return
@@ -3022,7 +3022,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
3022
3022
  `;
3023
3023
 
3024
3024
  exports[`docs/core/components/children-slots.md doc-examples L86 — (no label) 1`] = `
3025
- "import { $c, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, renderChild } from '@barefootjs/client/runtime'
3025
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $c, initChild, renderChild } from '@barefootjs/client/runtime'
3026
3026
  import '/* @bf-child:Button */'
3027
3027
 
3028
3028
  export function initTodoItem(__scope, _p = {}) {
@@ -3080,7 +3080,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
3080
3080
  `;
3081
3081
 
3082
3082
  exports[`docs/core/components/children-slots.md doc-examples L93 — (no label) 1`] = `
3083
- "import { $c, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, renderChild } from '@barefootjs/client/runtime'
3083
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $c, initChild, renderChild } from '@barefootjs/client/runtime'
3084
3084
  import '/* @bf-child:Button */'
3085
3085
 
3086
3086
  export function initTodoItem(__scope, _p = {}) {
@@ -3138,7 +3138,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
3138
3138
  `;
3139
3139
 
3140
3140
  exports[`docs/core/components/children-slots.md doc-examples L109 — Dialog trigger as a custom element 1`] = `
3141
- "import { $c, createComponent, createEffect, createSignal, escapeAttr, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, renderChild } from '@barefootjs/client/runtime'
3141
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $c, escapeAttr, initChild, renderChild } from '@barefootjs/client/runtime'
3142
3142
  import '/* @bf-child:DialogTrigger */'
3143
3143
 
3144
3144
  export function initTodoItem(__scope, _p = {}) {
@@ -3196,7 +3196,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
3196
3196
  `;
3197
3197
 
3198
3198
  exports[`docs/core/components/children-slots.md doc-examples L118 — (no label) 1`] = `
3199
- "import { $c, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, renderChild } from '@barefootjs/client/runtime'
3199
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $c, initChild, renderChild } from '@barefootjs/client/runtime'
3200
3200
  import '/* @bf-child:Dialog */'
3201
3201
  import '/* @bf-child:DialogTrigger */'
3202
3202
  import '/* @bf-child:DialogOverlay */'
@@ -3280,7 +3280,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
3280
3280
  `;
3281
3281
 
3282
3282
  exports[`docs/core/components/children-slots.md doc-examples L140 — (no label) 1`] = `
3283
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, mapArray, renderChild } from '@barefootjs/client/runtime'
3283
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, initChild, mapArray, renderChild } from '@barefootjs/client/runtime'
3284
3284
 
3285
3285
  export function initTodoItem(__scope, _p = {}) {
3286
3286
  if (!__scope) return
@@ -3348,7 +3348,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
3348
3348
  `;
3349
3349
 
3350
3350
  exports[`docs/core/components/context-api.md doc-examples L40 — (no label) 1`] = `
3351
- "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, provideContext } from '@barefootjs/client/runtime'
3351
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, markupOrEmpty, provideContext } from '@barefootjs/client/runtime'
3352
3352
 
3353
3353
  export function initTodoItem(__scope, _p = {}) {
3354
3354
  if (!__scope) return
@@ -3398,7 +3398,7 @@ export function initExample(__scope, _p = {}) {
3398
3398
  provideContext(MyContext, someValue)
3399
3399
  }
3400
3400
 
3401
- hydrate('Example', { init: initExample, template: (_p) => \`<div>\${_p.children}</div>\` })
3401
+ hydrate('Example', { init: initExample, template: (_p) => \`<div>\${markupOrEmpty(_p.children)}</div>\` })
3402
3402
  export function Example(_p, __bfKey) { return createComponent('Example', _p, __bfKey) }"
3403
3403
  `;
3404
3404
 
@@ -3421,7 +3421,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
3421
3421
  `;
3422
3422
 
3423
3423
  exports[`docs/core/components/context-api.md doc-examples L73 — 2. Provider component 1`] = `
3424
- "import { createComponent, hydrate, provideContext } from '@barefootjs/client/runtime'
3424
+ "import { createComponent, hydrate, markupOrEmpty, provideContext } from '@barefootjs/client/runtime'
3425
3425
 
3426
3426
 
3427
3427
  export function initThemeProvider(__scope, _p = {}) {
@@ -3433,12 +3433,12 @@ export function initThemeProvider(__scope, _p = {}) {
3433
3433
  provideContext(ThemeContext, _p.theme)
3434
3434
  }
3435
3435
 
3436
- hydrate('ThemeProvider', { init: initThemeProvider, template: (_p) => \`<div style="display:contents">\${_p.children}</div>\` })
3436
+ hydrate('ThemeProvider', { init: initThemeProvider, template: (_p) => \`<div style="display:contents">\${markupOrEmpty(_p.children)}</div>\` })
3437
3437
  export function ThemeProvider(_p, __bfKey) { return createComponent('ThemeProvider', _p, __bfKey) }"
3438
3438
  `;
3439
3439
 
3440
3440
  exports[`docs/core/components/context-api.md doc-examples L88 — (no label) 1`] = `
3441
- "import { $, createComponent, createEffect, createMemo, createSignal, hydrate, onCleanup, onMount, untrack } from '@barefootjs/client/runtime'
3441
+ "import { $, createComponent, createEffect, createMemo, createSignal, hydrate, markupOrEmpty, onCleanup, onMount, untrack } from '@barefootjs/client/runtime'
3442
3442
 
3443
3443
 
3444
3444
  export function initStatementExample(__scope, _p = {}) {
@@ -3450,12 +3450,12 @@ export function initStatementExample(__scope, _p = {}) {
3450
3450
  if (_s0) (handleMount)(_s0)
3451
3451
  }
3452
3452
 
3453
- hydrate('StatementExample', { init: initStatementExample, template: (_p) => \`<button bf="s0">\${props.children}</button>\` })
3453
+ hydrate('StatementExample', { init: initStatementExample, template: (_p) => \`<button bf="s0">\${markupOrEmpty(props.children)}</button>\` })
3454
3454
  export function StatementExample(_p, __bfKey) { return createComponent('StatementExample', _p, __bfKey) }"
3455
3455
  `;
3456
3456
 
3457
3457
  exports[`docs/core/components/context-api.md doc-examples L94 — Usage 1`] = `
3458
- "import { $c, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, renderChild } from '@barefootjs/client/runtime'
3458
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $c, initChild, renderChild } from '@barefootjs/client/runtime'
3459
3459
  import '/* @bf-child:ThemeProvider */'
3460
3460
  import '/* @bf-child:ThemedButton */'
3461
3461
 
@@ -3533,7 +3533,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
3533
3533
  `;
3534
3534
 
3535
3535
  exports[`docs/core/components/context-api.md doc-examples L127 — (no label) 1`] = `
3536
- "import { createComponent, createEffect, createMemo, createSignal, hydrate, onCleanup, onMount, provideContext, untrack } from '@barefootjs/client/runtime'
3536
+ "import { createComponent, createEffect, createMemo, createSignal, hydrate, markupOrEmpty, onCleanup, onMount, provideContext, untrack } from '@barefootjs/client/runtime'
3537
3537
 
3538
3538
 
3539
3539
  export function initStatementExample(__scope, _p = {}) {
@@ -3545,7 +3545,7 @@ export function initStatementExample(__scope, _p = {}) {
3545
3545
  provideContext(AccordionContext, { activeItem, toggle })
3546
3546
  }
3547
3547
 
3548
- hydrate('StatementExample', { init: initStatementExample, template: (_p) => \`<div data-slot="accordion">\${props.children}</div>\` })
3548
+ hydrate('StatementExample', { init: initStatementExample, template: (_p) => \`<div data-slot="accordion">\${markupOrEmpty(props.children)}</div>\` })
3549
3549
  export function StatementExample(_p, __bfKey) { return createComponent('StatementExample', _p, __bfKey) }"
3550
3550
  `;
3551
3551
 
@@ -3568,7 +3568,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
3568
3568
  `;
3569
3569
 
3570
3570
  exports[`docs/core/components/context-api.md doc-examples L149 — (no label) 1`] = `
3571
- "import { $, createComponent, createEffect, createMemo, createSignal, hydrate, onCleanup, onMount, untrack } from '@barefootjs/client/runtime'
3571
+ "import { $, createComponent, createEffect, createMemo, createSignal, hydrate, markupOrEmpty, onCleanup, onMount, untrack } from '@barefootjs/client/runtime'
3572
3572
 
3573
3573
 
3574
3574
  export function initStatementExample(__scope, _p = {}) {
@@ -3580,12 +3580,12 @@ export function initStatementExample(__scope, _p = {}) {
3580
3580
  if (_s0) (handleMount)(_s0)
3581
3581
  }
3582
3582
 
3583
- hydrate('StatementExample', { init: initStatementExample, template: (_p) => \`<button bf="s0">\${props.children}</button>\` })
3583
+ hydrate('StatementExample', { init: initStatementExample, template: (_p) => \`<button bf="s0">\${markupOrEmpty(props.children)}</button>\` })
3584
3584
  export function StatementExample(_p, __bfKey) { return createComponent('StatementExample', _p, __bfKey) }"
3585
3585
  `;
3586
3586
 
3587
3587
  exports[`docs/core/components/context-api.md doc-examples L163 — (no label) 1`] = `
3588
- "import { $, createComponent, createEffect, createMemo, createSignal, hydrate, onCleanup, onMount, untrack } from '@barefootjs/client/runtime'
3588
+ "import { $, createComponent, createEffect, createMemo, createSignal, hydrate, markupOrEmpty, onCleanup, onMount, untrack } from '@barefootjs/client/runtime'
3589
3589
 
3590
3590
 
3591
3591
  export function initStatementExample(__scope, _p = {}) {
@@ -3597,12 +3597,12 @@ export function initStatementExample(__scope, _p = {}) {
3597
3597
  if (_s0) (handleMount)(_s0)
3598
3598
  }
3599
3599
 
3600
- hydrate('StatementExample', { init: initStatementExample, template: (_p) => \`<div bf="s0">\${props.children}</div>\` })
3600
+ hydrate('StatementExample', { init: initStatementExample, template: (_p) => \`<div bf="s0">\${markupOrEmpty(props.children)}</div>\` })
3601
3601
  export function StatementExample(_p, __bfKey) { return createComponent('StatementExample', _p, __bfKey) }"
3602
3602
  `;
3603
3603
 
3604
3604
  exports[`docs/core/components/context-api.md doc-examples L170 — (no label) 1`] = `
3605
- "import { $c, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, renderChild } from '@barefootjs/client/runtime'
3605
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $c, initChild, renderChild } from '@barefootjs/client/runtime'
3606
3606
  import '/* @bf-child:Accordion */'
3607
3607
  import '/* @bf-child:AccordionTrigger */'
3608
3608
  import '/* @bf-child:AccordionContent */'
@@ -3777,7 +3777,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
3777
3777
  `;
3778
3778
 
3779
3779
  exports[`docs/core/components/portals.md doc-examples L53 — (no label) 1`] = `
3780
- "import { $, createComponent, createEffect, createPortal, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, isSSRPortal, lazySlots } from '@barefootjs/client/runtime'
3780
+ "import { $, createComponent, createEffect, createPortal, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, isSSRPortal, lazySlots, markupOrEmpty } from '@barefootjs/client/runtime'
3781
3781
 
3782
3782
 
3783
3783
  export function initTooltip(__scope, _p = {}) {
@@ -3810,7 +3810,7 @@ export function initTooltip(__scope, _p = {}) {
3810
3810
  if (_s2) (handleMount)(_s2)
3811
3811
  }
3812
3812
 
3813
- hydrate('Tooltip', { init: initTooltip, template: (_p) => \`<div><span bf="s0">\${_p.children}</span><div class="tooltip" bf="s2"><!--bf:s1-->\${escapeTextOrMarkup(_p.text)}<!--/--></div></div>\` })
3813
+ hydrate('Tooltip', { init: initTooltip, template: (_p) => \`<div><span bf="s0">\${markupOrEmpty(_p.children)}</span><div class="tooltip" bf="s2"><!--bf:s1-->\${escapeTextOrMarkup(_p.text)}<!--/--></div></div>\` })
3814
3814
  export function Tooltip(_p, __bfKey) { return createComponent('Tooltip', _p, __bfKey) }"
3815
3815
  `;
3816
3816
 
@@ -3925,7 +3925,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
3925
3925
  `;
3926
3926
 
3927
3927
  exports[`docs/core/components/props-type-safety.md doc-examples L54 — (no label) 1`] = `
3928
- "import { $, applyRestAttrs, createComponent, createEffect, escapeAttr, hydrate } from '@barefootjs/client/runtime'
3928
+ "import { $, applyRestAttrs, createComponent, createEffect, escapeAttr, hydrate, markupOrEmpty } from '@barefootjs/client/runtime'
3929
3929
 
3930
3930
 
3931
3931
  export function initButton(__scope, _p = {}) {
@@ -3948,7 +3948,7 @@ export function initButton(__scope, _p = {}) {
3948
3948
 
3949
3949
  }
3950
3950
 
3951
- hydrate('Button__b3c36eee', { init: initButton, template: (_p) => \`<button \${((\`btn btn-\${(_p.variant ?? 'default')} btn-\${(_p.size ?? 'md')} \${_p.className ?? ''}\`)) != null ? 'class="' + escapeAttr((\`btn btn-\${(_p.variant ?? 'default')} btn-\${(_p.size ?? 'md')} \${_p.className ?? ''}\`)) + '"' : ''} bf="s0">\${_p.children}</button>\`, name: 'Button' })
3951
+ hydrate('Button__b3c36eee', { init: initButton, template: (_p) => \`<button \${((\`btn btn-\${(_p.variant ?? 'default')} btn-\${(_p.size ?? 'md')} \${_p.className ?? ''}\`)) != null ? 'class="' + escapeAttr((\`btn btn-\${(_p.variant ?? 'default')} btn-\${(_p.size ?? 'md')} \${_p.className ?? ''}\`)) + '"' : ''} bf="s0">\${markupOrEmpty(_p.children)}</button>\`, name: 'Button' })
3952
3952
  export function Button(_p, __bfKey) { return createComponent('Button__b3c36eee', _p, __bfKey) }"
3953
3953
  `;
3954
3954
 
@@ -3962,7 +3962,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
3962
3962
  `;
3963
3963
 
3964
3964
  exports[`docs/core/components/props-type-safety.md doc-examples L89 — (no label) 1`] = `
3965
- "import { $c, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, initChild, lazySlots, renderChild } from '@barefootjs/client/runtime'
3965
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $c, initChild, renderChild } from '@barefootjs/client/runtime'
3966
3966
  import '/* @bf-child:Card */'
3967
3967
 
3968
3968
  export function initTodoItem(__scope, _p = {}) {
@@ -4189,7 +4189,7 @@ export function Counter(_p, __bfKey) { return createComponent('Counter', _p, __b
4189
4189
  `;
4190
4190
 
4191
4191
  exports[`docs/core/adapters/hono-adapter.md doc-examples L129 — (no label) 1`] = `
4192
- "import { $c, createComponent, hydrate, initChild, renderChild } from '@barefootjs/client/runtime'
4192
+ "import { $c, createComponent, hydrate, initChild, markupOrEmpty, renderChild } from '@barefootjs/client/runtime'
4193
4193
  import '/* @bf-child:BfScripts */'
4194
4194
 
4195
4195
 
@@ -4204,12 +4204,12 @@ export function initLayout(__scope, _p = {}) {
4204
4204
  initChild('BfScripts', _s0, {})
4205
4205
  }
4206
4206
 
4207
- hydrate('Layout', { init: initLayout, template: (_p) => \`<html><body>\${_p.children}\${renderChild('BfScripts', {}, undefined, 's0')}</body></html>\` })
4207
+ hydrate('Layout', { init: initLayout, template: (_p) => \`<html><body>\${markupOrEmpty(_p.children)}\${renderChild('BfScripts', {}, undefined, 's0')}</body></html>\` })
4208
4208
  export function Layout(_p, __bfKey) { return createComponent('Layout', _p, __bfKey) }"
4209
4209
  `;
4210
4210
 
4211
4211
  exports[`docs/core/adapters/hono-adapter.md doc-examples L167 — (no label) 1`] = `
4212
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, insert, lazySlots } from '@barefootjs/client/runtime'
4212
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, insert } from '@barefootjs/client/runtime'
4213
4213
 
4214
4214
  export function initTodoItem(__scope, _p = {}) {
4215
4215
  if (!__scope) return
@@ -4273,7 +4273,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
4273
4273
  `;
4274
4274
 
4275
4275
  exports[`docs/core/adapters/hono-adapter.md doc-examples L171 — (no label) 1`] = `
4276
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, insert, lazySlots } from '@barefootjs/client/runtime'
4276
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, insert } from '@barefootjs/client/runtime'
4277
4277
 
4278
4278
  export function initTodoItem(__scope, _p = {}) {
4279
4279
  if (!__scope) return
@@ -4337,7 +4337,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
4337
4337
  `;
4338
4338
 
4339
4339
  exports[`docs/core/adapters/hono-adapter.md doc-examples L177 — (no label) 1`] = `
4340
- "import { $, __bfSlot, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, insert, lazySlots } from '@barefootjs/client/runtime'
4340
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, __bfSlot, insert } from '@barefootjs/client/runtime'
4341
4341
 
4342
4342
  export function initTodoItem(__scope, _p = {}) {
4343
4343
  if (!__scope) return
@@ -4401,7 +4401,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
4401
4401
  `;
4402
4402
 
4403
4403
  exports[`docs/core/adapters/hono-adapter.md doc-examples L190 — (no label) 1`] = `
4404
- "import { $, createComponent, createEffect, createSignal, escapeAttr, escapeText, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
4404
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
4405
4405
 
4406
4406
  export function initTodoItem(__scope, _p = {}) {
4407
4407
  if (!__scope) return
@@ -4531,7 +4531,7 @@ export function Counter(_p, __bfKey) { return createComponent('Counter', _p, __b
4531
4531
  `;
4532
4532
 
4533
4533
  exports[`docs/core/adapters/go-template-adapter.md doc-examples L168 — (no label) 1`] = `
4534
- "import { $, createComponent, createEffect, createSignal, escapeAttr, escapeText, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
4534
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
4535
4535
 
4536
4536
  export function initTodoItem(__scope, _p = {}) {
4537
4537
  if (!__scope) return
@@ -4612,7 +4612,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
4612
4612
  `;
4613
4613
 
4614
4614
  exports[`docs/core/adapters/go-template-adapter.md doc-examples L180 — (no label) 1`] = `
4615
- "import { $, createComponent, createEffect, createSignal, escapeAttr, escapeText, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
4615
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
4616
4616
 
4617
4617
  export function initTodoItem(__scope, _p = {}) {
4618
4618
  if (!__scope) return
@@ -4693,7 +4693,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
4693
4693
  `;
4694
4694
 
4695
4695
  exports[`docs/core/adapters/go-template-adapter.md doc-examples L194 — (no label) 1`] = `
4696
- "import { $, createComponent, createEffect, createSignal, escapeAttr, escapeText, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots } from '@barefootjs/client/runtime'
4696
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
4697
4697
 
4698
4698
  export function initTodoItem(__scope, _p = {}) {
4699
4699
  if (!__scope) return
@@ -4740,20 +4740,36 @@ export function initExample(__scope, _p = {}) {
4740
4740
 
4741
4741
  const [_s1] = $(__scope, 's1')
4742
4742
 
4743
- // Reactive texts in static array children
4744
- if (_s1) {
4745
- items.forEach((t, __idx) => {
4746
- let __iterEl = _s1.children[__idx]
4747
- if (__iterEl) {
4748
- const __bfw_s0 = lazySlots(__iterEl, [{ id: 's0', kind: 'text', path: [] }])
4749
- createEffect(() => { __bfw_s0('s0', String(t.name)) })
4750
- }
4751
- })
4752
- }
4743
+ const __tpl_l0 = document.createElement('template')
4744
+ __tpl_l0.innerHTML = \`<li data-key=""><!--bf:s0--><!--/--></li>\`
4745
+ const __lzp_l0 = [[0]]
4746
+ const __lzs_l0 = [{ id: 's0', kind: 'text', path: [] }]
4747
+ const __lzsc_l0 = [{ id: 's0', kind: 'text', path: __lzp_l0[0] }]
4748
+ mapArrayLazy(() => items().toSorted((a, b) => a.priority - b.priority), _s1, (t) => String(t.id), {
4749
+ createRow: (__e, __idx) => {
4750
+ const t = () => __e.item
4751
+ const __el = __tpl_l0.content.firstElementChild.cloneNode(true)
4752
+ const __r = __e.refs = [lazySlots(__el, __lzsc_l0)]
4753
+ const __l = __e.last = []
4754
+ { const __x = t().name
4755
+ __r[0]('s0', textOrNode(__x))
4756
+ __l[0] = __x }
4757
+ return __el
4758
+ },
4759
+ applyItem: (__e) => {
4760
+ const t = () => __e.item
4761
+ const __r = __e.refs ?? (__e.refs = [])
4762
+ const __l = __e.last ?? (__e.last = [])
4763
+ const __d = __r[0] ?? (__r[0] = lazySlots(__e.primaryEl, __lzs_l0))
4764
+ { const __x = t().name
4765
+ if (!(0 in __l) || !Object.is(__l[0], __x)) __d('s0', textOrNode(__x))
4766
+ __l[0] = __x }
4767
+ },
4768
+ }, 'l0')
4753
4769
 
4754
4770
  }
4755
4771
 
4756
- hydrate('Example', { init: initExample, template: (_p) => \`<div bf="s1"><!--bf-loop:l0-->\${items.toSorted((a, b) => a.priority - b.priority).map((t) => \`<li data-key="\${escapeAttr(t.id)}"><!--bf:s0-->\${escapeText(t.name)}<!--/--></li>\`).join('')}<!--bf-/loop:l0--></div>\` })
4772
+ hydrate('Example', { init: initExample, template: (_p) => \`<div bf="s1"><!--bf-loop:l0-->\${([]).toSorted((a, b) => a.priority - b.priority).map((t) => \`<li data-key="\${escapeAttr(t.id)}"><!--bf:s0-->\${escapeText(t.name)}<!--/--></li>\`).join('')}<!--bf-/loop:l0--></div>\` })
4757
4773
  export function Example(_p, __bfKey) { return createComponent('Example', _p, __bfKey) }"
4758
4774
  `;
4759
4775
 
@@ -4782,7 +4798,7 @@ export function TodoList(_p, __bfKey) { return createComponent('TodoList', _p, _
4782
4798
  `;
4783
4799
 
4784
4800
  exports[`docs/core/adapters/go-template-adapter.md doc-examples L260 — (no label) 1`] = `
4785
- "import { $, createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, insert, lazySlots } from '@barefootjs/client/runtime'
4801
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, insert } from '@barefootjs/client/runtime'
4786
4802
 
4787
4803
  export function initTodoItem(__scope, _p = {}) {
4788
4804
  if (!__scope) return
@@ -4950,7 +4966,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
4950
4966
  `;
4951
4967
 
4952
4968
  exports[`docs/core/adapters/custom-adapter.md doc-examples L195 — (no label) 1`] = `
4953
- "import { $, createComponent, createEffect, createSignal, escapeAttr, escapeText, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots } from '@barefootjs/client/runtime'
4969
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
4954
4970
 
4955
4971
  export function initTodoItem(__scope, _p = {}) {
4956
4972
  if (!__scope) return
@@ -4997,25 +5013,41 @@ export function initExample(__scope, _p = {}) {
4997
5013
 
4998
5014
  const [_s1] = $(__scope, 's1')
4999
5015
 
5000
- // Reactive texts in static array children
5001
- if (_s1) {
5002
- items.forEach((item, __idx) => {
5003
- let __iterEl = _s1.children[__idx]
5004
- if (__iterEl) {
5005
- const __bfw_s0 = lazySlots(__iterEl, [{ id: 's0', kind: 'text', path: [] }])
5006
- createEffect(() => { __bfw_s0('s0', String(item.name)) })
5007
- }
5008
- })
5009
- }
5016
+ const __tpl_l0 = document.createElement('template')
5017
+ __tpl_l0.innerHTML = \`<li data-key=""><!--bf:s0--><!--/--></li>\`
5018
+ const __lzp_l0 = [[0]]
5019
+ const __lzs_l0 = [{ id: 's0', kind: 'text', path: [] }]
5020
+ const __lzsc_l0 = [{ id: 's0', kind: 'text', path: __lzp_l0[0] }]
5021
+ mapArrayLazy(() => items(), _s1, (item) => String(item.id), {
5022
+ createRow: (__e, __idx) => {
5023
+ const item = () => __e.item
5024
+ const __el = __tpl_l0.content.firstElementChild.cloneNode(true)
5025
+ const __r = __e.refs = [lazySlots(__el, __lzsc_l0)]
5026
+ const __l = __e.last = []
5027
+ { const __x = item().name
5028
+ __r[0]('s0', textOrNode(__x))
5029
+ __l[0] = __x }
5030
+ return __el
5031
+ },
5032
+ applyItem: (__e) => {
5033
+ const item = () => __e.item
5034
+ const __r = __e.refs ?? (__e.refs = [])
5035
+ const __l = __e.last ?? (__e.last = [])
5036
+ const __d = __r[0] ?? (__r[0] = lazySlots(__e.primaryEl, __lzs_l0))
5037
+ { const __x = item().name
5038
+ if (!(0 in __l) || !Object.is(__l[0], __x)) __d('s0', textOrNode(__x))
5039
+ __l[0] = __x }
5040
+ },
5041
+ }, 'l0')
5010
5042
 
5011
5043
  }
5012
5044
 
5013
- hydrate('Example', { init: initExample, template: (_p) => \`<div bf="s1"><!--bf-loop:l0-->\${items.map((item) => \`<li data-key="\${escapeAttr(item.id)}"><!--bf:s0-->\${escapeText(item.name)}<!--/--></li>\`).join('')}<!--bf-/loop:l0--></div>\` })
5045
+ hydrate('Example', { init: initExample, template: (_p) => \`<div bf="s1"><!--bf-loop:l0-->\${([]).map((item) => \`<li data-key="\${escapeAttr(item.id)}"><!--bf:s0-->\${escapeText(item.name)}<!--/--></li>\`).join('')}<!--bf-/loop:l0--></div>\` })
5014
5046
  export function Example(_p, __bfKey) { return createComponent('Example', _p, __bfKey) }"
5015
5047
  `;
5016
5048
 
5017
5049
  exports[`docs/core/adapters/custom-adapter.md doc-examples L200 — (no label) 1`] = `
5018
- "import { $, createComponent, createEffect, createSignal, escapeAttr, escapeText, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots } from '@barefootjs/client/runtime'
5050
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
5019
5051
 
5020
5052
  export function initTodoItem(__scope, _p = {}) {
5021
5053
  if (!__scope) return
@@ -5062,25 +5094,41 @@ export function initExample(__scope, _p = {}) {
5062
5094
 
5063
5095
  const [_s1] = $(__scope, 's1')
5064
5096
 
5065
- // Reactive texts in static array children
5066
- if (_s1) {
5067
- items.forEach((item, __idx) => {
5068
- let __iterEl = _s1.children[__idx]
5069
- if (__iterEl) {
5070
- const __bfw_s0 = lazySlots(__iterEl, [{ id: 's0', kind: 'text', path: [] }])
5071
- createEffect(() => { __bfw_s0('s0', String(item.name)) })
5072
- }
5073
- })
5074
- }
5097
+ const __tpl_l0 = document.createElement('template')
5098
+ __tpl_l0.innerHTML = \`<li data-key=""><!--bf:s0--><!--/--></li>\`
5099
+ const __lzp_l0 = [[0]]
5100
+ const __lzs_l0 = [{ id: 's0', kind: 'text', path: [] }]
5101
+ const __lzsc_l0 = [{ id: 's0', kind: 'text', path: __lzp_l0[0] }]
5102
+ mapArrayLazy(() => items(), _s1, (item) => String(item.id), {
5103
+ createRow: (__e, __idx) => {
5104
+ const item = () => __e.item
5105
+ const __el = __tpl_l0.content.firstElementChild.cloneNode(true)
5106
+ const __r = __e.refs = [lazySlots(__el, __lzsc_l0)]
5107
+ const __l = __e.last = []
5108
+ { const __x = item().name
5109
+ __r[0]('s0', textOrNode(__x))
5110
+ __l[0] = __x }
5111
+ return __el
5112
+ },
5113
+ applyItem: (__e) => {
5114
+ const item = () => __e.item
5115
+ const __r = __e.refs ?? (__e.refs = [])
5116
+ const __l = __e.last ?? (__e.last = [])
5117
+ const __d = __r[0] ?? (__r[0] = lazySlots(__e.primaryEl, __lzs_l0))
5118
+ { const __x = item().name
5119
+ if (!(0 in __l) || !Object.is(__l[0], __x)) __d('s0', textOrNode(__x))
5120
+ __l[0] = __x }
5121
+ },
5122
+ }, 'l0')
5075
5123
 
5076
5124
  }
5077
5125
 
5078
- hydrate('Example', { init: initExample, template: (_p) => \`<div bf="s1"><!--bf-loop:l0-->\${items.map((item) => \`<li data-key="\${escapeAttr(item.id)}"><!--bf:s0-->\${escapeText(item.name)}<!--/--></li>\`).join('')}<!--bf-/loop:l0--></div>\` })
5126
+ hydrate('Example', { init: initExample, template: (_p) => \`<div bf="s1"><!--bf-loop:l0-->\${([]).map((item) => \`<li data-key="\${escapeAttr(item.id)}"><!--bf:s0-->\${escapeText(item.name)}<!--/--></li>\`).join('')}<!--bf-/loop:l0--></div>\` })
5079
5127
  export function Example(_p, __bfKey) { return createComponent('Example', _p, __bfKey) }"
5080
5128
  `;
5081
5129
 
5082
5130
  exports[`docs/core/advanced/compiler-internals.md doc-examples L126 — (no label) 1`] = `
5083
- "import { $, createComponent, createEffect, createSignal, escapeAttr, escapeText, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
5131
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
5084
5132
 
5085
5133
  export function initTodoItem(__scope, _p = {}) {
5086
5134
  if (!__scope) return
@@ -5223,7 +5271,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
5223
5271
  `;
5224
5272
 
5225
5273
  exports[`docs/core/advanced/performance.md doc-examples L67 — ✅ Stable key — DOM nodes reused when list changes 1`] = `
5226
- "import { $, createComponent, createEffect, createSignal, escapeAttr, escapeText, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
5274
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
5227
5275
 
5228
5276
  export function initTodoItem(__scope, _p = {}) {
5229
5277
  if (!__scope) return
@@ -5304,7 +5352,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
5304
5352
  `;
5305
5353
 
5306
5354
  exports[`docs/core/advanced/performance.md doc-examples L70 — ❌ Index key — DOM nodes recreated on reorder 1`] = `
5307
- "import { $, createComponent, createEffect, createSignal, escapeAttr, escapeText, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
5355
+ "import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
5308
5356
 
5309
5357
  export function initTodoItem(__scope, _p = {}) {
5310
5358
  if (!__scope) return
@@ -5457,7 +5505,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
5457
5505
  `;
5458
5506
 
5459
5507
  exports[`docs/core/reactivity/shared-state.md doc-examples L31 — (no label) 1`] = `
5460
- "import { $, createComponent, createContext, createEffect, createSignal, hydrate, provideContext, useContext } from '@barefootjs/client/runtime'
5508
+ "import { createComponent, createContext, createEffect, createSignal, hydrate, markupOrEmpty, provideContext, useContext, $ } from '@barefootjs/client/runtime'
5461
5509
 
5462
5510
  var PlaybackContext = PlaybackContext ?? createContext()
5463
5511
 
@@ -5475,7 +5523,7 @@ export function initPlaybackProvider(__scope, _p = {}) {
5475
5523
  provideContext(PlaybackContext, { elapsedMs, playing, seek, toggle })
5476
5524
  }
5477
5525
 
5478
- hydrate('PlaybackProvider', { init: initPlaybackProvider, template: (_p) => \`<div style="display:contents">\${_p.children}</div>\` })
5526
+ hydrate('PlaybackProvider', { init: initPlaybackProvider, template: (_p) => \`<div style="display:contents">\${markupOrEmpty(_p.children)}</div>\` })
5479
5527
  export function PlaybackProvider(_p, __bfKey) { return createComponent('PlaybackProvider', _p, __bfKey) }
5480
5528
  var PlaybackContext = PlaybackContext ?? createContext()
5481
5529
 
@@ -5495,7 +5543,7 @@ export function initPlayer(__scope, _p = {}) {
5495
5543
  if (_s0) (handleMount)(_s0)
5496
5544
  }
5497
5545
 
5498
- hydrate('Player', { init: initPlayer, template: (_p) => \`<div bf="s0">\${_p.children}</div>\` })
5546
+ hydrate('Player', { init: initPlayer, template: (_p) => \`<div bf="s0">\${markupOrEmpty(_p.children)}</div>\` })
5499
5547
  export function Player(_p, __bfKey) { return createComponent('Player', _p, __bfKey) }
5500
5548
  var PlaybackContext = PlaybackContext ?? createContext()
5501
5549