@barefootjs/jsx 0.33.1 → 0.33.3
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.
- package/dist/analyzer.d.ts +17 -0
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/compiler.d.ts +21 -5
- package/dist/compiler.d.ts.map +1 -1
- package/dist/expression-parser.d.ts +14 -0
- package/dist/expression-parser.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +817 -457
- package/dist/ir-to-client-js/collect-elements.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/loop-child-arm.d.ts.map +1 -1
- package/dist/ir-to-client-js/emit-registration.d.ts.map +1 -1
- package/dist/ir-to-client-js/html-template.d.ts +7 -7
- package/dist/ir-to-client-js/html-template.d.ts.map +1 -1
- package/dist/ir-to-client-js/imports.d.ts +60 -2
- package/dist/ir-to-client-js/imports.d.ts.map +1 -1
- package/dist/ir-to-client-js/index.d.ts.map +1 -1
- package/dist/ir-to-client-js/prop-handling.d.ts +30 -0
- package/dist/ir-to-client-js/prop-handling.d.ts.map +1 -1
- package/dist/ir-to-client-js/reactivity.d.ts +5 -0
- package/dist/ir-to-client-js/reactivity.d.ts.map +1 -1
- package/dist/ir-to-client-js/rewrite-props-object.d.ts +36 -8
- package/dist/ir-to-client-js/rewrite-props-object.d.ts.map +1 -1
- package/dist/ir-to-client-js/utils.d.ts +26 -2
- package/dist/ir-to-client-js/utils.d.ts.map +1 -1
- package/dist/jsx-to-ir.d.ts.map +1 -1
- package/dist/props-binding.d.ts +35 -0
- package/dist/props-binding.d.ts.map +1 -1
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +165 -98
- package/src/__tests__/binding-scope-ratchet.test.ts +5 -1
- package/src/__tests__/child-component-ref-not-mirrored.test.ts +90 -0
- package/src/__tests__/client-js-generation.test.ts +11 -0
- package/src/__tests__/ir-to-client-js/imports.test.ts +107 -0
- package/src/__tests__/ir-to-client-js/merge-compiled-client-js-imports.test.ts +138 -0
- package/src/__tests__/issue-2723-prop-alias-reactivity.test.ts +124 -0
- package/src/__tests__/issue-2754-rest-spread-needs-slot.test.ts +85 -0
- package/src/__tests__/issue-2756-loop-row-honors-client-only.test.ts +173 -0
- package/src/__tests__/merge-template-imports.test.ts +41 -1
- package/src/__tests__/multi-component-shared-default-import.test.ts +55 -0
- package/src/__tests__/rewrite-props-object.test.ts +41 -4
- package/src/__tests__/root-key-relay.test.ts +170 -0
- package/src/__tests__/signal-getter-not-called.test.ts +149 -0
- package/src/__tests__/state-only-file-default-import.test.ts +47 -0
- package/src/analyzer.ts +36 -0
- package/src/compiler.ts +94 -104
- package/src/expression-parser.ts +26 -0
- package/src/index.ts +2 -2
- package/src/ir-to-client-js/collect-elements.ts +45 -30
- package/src/ir-to-client-js/control-flow/stringify/inner-loop.ts +6 -2
- package/src/ir-to-client-js/control-flow/stringify/loop-child-arm.ts +5 -2
- package/src/ir-to-client-js/emit-registration.ts +26 -7
- package/src/ir-to-client-js/generate-init.ts +1 -1
- package/src/ir-to-client-js/html-template.ts +130 -20
- package/src/ir-to-client-js/imports.ts +178 -5
- package/src/ir-to-client-js/index.ts +11 -4
- package/src/ir-to-client-js/prop-handling.ts +83 -0
- package/src/ir-to-client-js/reactivity.ts +59 -0
- package/src/ir-to-client-js/rewrite-props-object.ts +50 -10
- package/src/ir-to-client-js/utils.ts +30 -2
- package/src/jsx-to-ir.ts +523 -49
- package/src/props-binding.ts +51 -0
- package/src/types.ts +48 -0
|
@@ -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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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,11 +3925,30 @@ 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 { createComponent, escapeAttr, hydrate } from '@barefootjs/client/runtime'
|
|
3928
|
+
"import { $, applyRestAttrs, createComponent, createEffect, escapeAttr, hydrate, markupOrEmpty } from '@barefootjs/client/runtime'
|
|
3929
|
+
|
|
3930
|
+
|
|
3931
|
+
export function initButton(__scope, _p = {}) {
|
|
3932
|
+
if (!__scope) return
|
|
3933
|
+
const __scopeId = __scope.getAttribute('bf-s')
|
|
3934
|
+
|
|
3935
|
+
const variant = _p.variant ?? 'default'
|
|
3936
|
+
const size = _p.size ?? 'md'
|
|
3937
|
+
const classes = \`btn btn-\${variant} btn-\${size} \${_p.className ?? ''}\`
|
|
3938
|
+
|
|
3939
|
+
const [_s0] = $(__scope, 's0')
|
|
3940
|
+
|
|
3941
|
+
createEffect(() => {
|
|
3942
|
+
if (_s0) {
|
|
3943
|
+
{ const __v = classes; if (__v != null) _s0.setAttribute('class', String(__v)); else _s0.removeAttribute('class') }
|
|
3944
|
+
}
|
|
3945
|
+
})
|
|
3929
3946
|
|
|
3930
|
-
|
|
3947
|
+
if (_s0) applyRestAttrs(_s0, _p, ["class"])
|
|
3948
|
+
|
|
3949
|
+
}
|
|
3931
3950
|
|
|
3932
|
-
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' })
|
|
3933
3952
|
export function Button(_p, __bfKey) { return createComponent('Button__b3c36eee', _p, __bfKey) }"
|
|
3934
3953
|
`;
|
|
3935
3954
|
|
|
@@ -3943,7 +3962,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
|
|
|
3943
3962
|
`;
|
|
3944
3963
|
|
|
3945
3964
|
exports[`docs/core/components/props-type-safety.md doc-examples L89 — (no label) 1`] = `
|
|
3946
|
-
"import {
|
|
3965
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $c, initChild, renderChild } from '@barefootjs/client/runtime'
|
|
3947
3966
|
import '/* @bf-child:Card */'
|
|
3948
3967
|
|
|
3949
3968
|
export function initTodoItem(__scope, _p = {}) {
|
|
@@ -4170,7 +4189,7 @@ export function Counter(_p, __bfKey) { return createComponent('Counter', _p, __b
|
|
|
4170
4189
|
`;
|
|
4171
4190
|
|
|
4172
4191
|
exports[`docs/core/adapters/hono-adapter.md doc-examples L129 — (no label) 1`] = `
|
|
4173
|
-
"import { $c, createComponent, hydrate, initChild, renderChild } from '@barefootjs/client/runtime'
|
|
4192
|
+
"import { $c, createComponent, hydrate, initChild, markupOrEmpty, renderChild } from '@barefootjs/client/runtime'
|
|
4174
4193
|
import '/* @bf-child:BfScripts */'
|
|
4175
4194
|
|
|
4176
4195
|
|
|
@@ -4185,12 +4204,12 @@ export function initLayout(__scope, _p = {}) {
|
|
|
4185
4204
|
initChild('BfScripts', _s0, {})
|
|
4186
4205
|
}
|
|
4187
4206
|
|
|
4188
|
-
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>\` })
|
|
4189
4208
|
export function Layout(_p, __bfKey) { return createComponent('Layout', _p, __bfKey) }"
|
|
4190
4209
|
`;
|
|
4191
4210
|
|
|
4192
4211
|
exports[`docs/core/adapters/hono-adapter.md doc-examples L167 — (no label) 1`] = `
|
|
4193
|
-
"import {
|
|
4212
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, insert } from '@barefootjs/client/runtime'
|
|
4194
4213
|
|
|
4195
4214
|
export function initTodoItem(__scope, _p = {}) {
|
|
4196
4215
|
if (!__scope) return
|
|
@@ -4254,7 +4273,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
|
|
|
4254
4273
|
`;
|
|
4255
4274
|
|
|
4256
4275
|
exports[`docs/core/adapters/hono-adapter.md doc-examples L171 — (no label) 1`] = `
|
|
4257
|
-
"import {
|
|
4276
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, insert } from '@barefootjs/client/runtime'
|
|
4258
4277
|
|
|
4259
4278
|
export function initTodoItem(__scope, _p = {}) {
|
|
4260
4279
|
if (!__scope) return
|
|
@@ -4318,7 +4337,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
|
|
|
4318
4337
|
`;
|
|
4319
4338
|
|
|
4320
4339
|
exports[`docs/core/adapters/hono-adapter.md doc-examples L177 — (no label) 1`] = `
|
|
4321
|
-
"import {
|
|
4340
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, __bfSlot, insert } from '@barefootjs/client/runtime'
|
|
4322
4341
|
|
|
4323
4342
|
export function initTodoItem(__scope, _p = {}) {
|
|
4324
4343
|
if (!__scope) return
|
|
@@ -4382,7 +4401,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
|
|
|
4382
4401
|
`;
|
|
4383
4402
|
|
|
4384
4403
|
exports[`docs/core/adapters/hono-adapter.md doc-examples L190 — (no label) 1`] = `
|
|
4385
|
-
"import {
|
|
4404
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
|
|
4386
4405
|
|
|
4387
4406
|
export function initTodoItem(__scope, _p = {}) {
|
|
4388
4407
|
if (!__scope) return
|
|
@@ -4512,7 +4531,7 @@ export function Counter(_p, __bfKey) { return createComponent('Counter', _p, __b
|
|
|
4512
4531
|
`;
|
|
4513
4532
|
|
|
4514
4533
|
exports[`docs/core/adapters/go-template-adapter.md doc-examples L168 — (no label) 1`] = `
|
|
4515
|
-
"import {
|
|
4534
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
|
|
4516
4535
|
|
|
4517
4536
|
export function initTodoItem(__scope, _p = {}) {
|
|
4518
4537
|
if (!__scope) return
|
|
@@ -4593,7 +4612,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
|
|
|
4593
4612
|
`;
|
|
4594
4613
|
|
|
4595
4614
|
exports[`docs/core/adapters/go-template-adapter.md doc-examples L180 — (no label) 1`] = `
|
|
4596
|
-
"import {
|
|
4615
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
|
|
4597
4616
|
|
|
4598
4617
|
export function initTodoItem(__scope, _p = {}) {
|
|
4599
4618
|
if (!__scope) return
|
|
@@ -4674,7 +4693,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
|
|
|
4674
4693
|
`;
|
|
4675
4694
|
|
|
4676
4695
|
exports[`docs/core/adapters/go-template-adapter.md doc-examples L194 — (no label) 1`] = `
|
|
4677
|
-
"import {
|
|
4696
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
|
|
4678
4697
|
|
|
4679
4698
|
export function initTodoItem(__scope, _p = {}) {
|
|
4680
4699
|
if (!__scope) return
|
|
@@ -4721,20 +4740,36 @@ export function initExample(__scope, _p = {}) {
|
|
|
4721
4740
|
|
|
4722
4741
|
const [_s1] = $(__scope, 's1')
|
|
4723
4742
|
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
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')
|
|
4734
4769
|
|
|
4735
4770
|
}
|
|
4736
4771
|
|
|
4737
|
-
hydrate('Example', { init: initExample, template: (_p) => \`<div bf="s1"><!--bf-loop:l0-->\${
|
|
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>\` })
|
|
4738
4773
|
export function Example(_p, __bfKey) { return createComponent('Example', _p, __bfKey) }"
|
|
4739
4774
|
`;
|
|
4740
4775
|
|
|
@@ -4763,7 +4798,7 @@ export function TodoList(_p, __bfKey) { return createComponent('TodoList', _p, _
|
|
|
4763
4798
|
`;
|
|
4764
4799
|
|
|
4765
4800
|
exports[`docs/core/adapters/go-template-adapter.md doc-examples L260 — (no label) 1`] = `
|
|
4766
|
-
"import {
|
|
4801
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, insert } from '@barefootjs/client/runtime'
|
|
4767
4802
|
|
|
4768
4803
|
export function initTodoItem(__scope, _p = {}) {
|
|
4769
4804
|
if (!__scope) return
|
|
@@ -4931,7 +4966,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
|
|
|
4931
4966
|
`;
|
|
4932
4967
|
|
|
4933
4968
|
exports[`docs/core/adapters/custom-adapter.md doc-examples L195 — (no label) 1`] = `
|
|
4934
|
-
"import {
|
|
4969
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
|
|
4935
4970
|
|
|
4936
4971
|
export function initTodoItem(__scope, _p = {}) {
|
|
4937
4972
|
if (!__scope) return
|
|
@@ -4978,25 +5013,41 @@ export function initExample(__scope, _p = {}) {
|
|
|
4978
5013
|
|
|
4979
5014
|
const [_s1] = $(__scope, 's1')
|
|
4980
5015
|
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
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')
|
|
4991
5042
|
|
|
4992
5043
|
}
|
|
4993
5044
|
|
|
4994
|
-
hydrate('Example', { init: initExample, template: (_p) => \`<div bf="s1"><!--bf-loop:l0-->\${
|
|
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>\` })
|
|
4995
5046
|
export function Example(_p, __bfKey) { return createComponent('Example', _p, __bfKey) }"
|
|
4996
5047
|
`;
|
|
4997
5048
|
|
|
4998
5049
|
exports[`docs/core/adapters/custom-adapter.md doc-examples L200 — (no label) 1`] = `
|
|
4999
|
-
"import {
|
|
5050
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
|
|
5000
5051
|
|
|
5001
5052
|
export function initTodoItem(__scope, _p = {}) {
|
|
5002
5053
|
if (!__scope) return
|
|
@@ -5043,25 +5094,41 @@ export function initExample(__scope, _p = {}) {
|
|
|
5043
5094
|
|
|
5044
5095
|
const [_s1] = $(__scope, 's1')
|
|
5045
5096
|
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
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')
|
|
5056
5123
|
|
|
5057
5124
|
}
|
|
5058
5125
|
|
|
5059
|
-
hydrate('Example', { init: initExample, template: (_p) => \`<div bf="s1"><!--bf-loop:l0-->\${
|
|
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>\` })
|
|
5060
5127
|
export function Example(_p, __bfKey) { return createComponent('Example', _p, __bfKey) }"
|
|
5061
5128
|
`;
|
|
5062
5129
|
|
|
5063
5130
|
exports[`docs/core/advanced/compiler-internals.md doc-examples L126 — (no label) 1`] = `
|
|
5064
|
-
"import {
|
|
5131
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
|
|
5065
5132
|
|
|
5066
5133
|
export function initTodoItem(__scope, _p = {}) {
|
|
5067
5134
|
if (!__scope) return
|
|
@@ -5204,7 +5271,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
|
|
|
5204
5271
|
`;
|
|
5205
5272
|
|
|
5206
5273
|
exports[`docs/core/advanced/performance.md doc-examples L67 — ✅ Stable key — DOM nodes reused when list changes 1`] = `
|
|
5207
|
-
"import {
|
|
5274
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
|
|
5208
5275
|
|
|
5209
5276
|
export function initTodoItem(__scope, _p = {}) {
|
|
5210
5277
|
if (!__scope) return
|
|
@@ -5285,7 +5352,7 @@ export function Example(_p, __bfKey) { return createComponent('Example', _p, __b
|
|
|
5285
5352
|
`;
|
|
5286
5353
|
|
|
5287
5354
|
exports[`docs/core/advanced/performance.md doc-examples L70 — ❌ Index key — DOM nodes recreated on reorder 1`] = `
|
|
5288
|
-
"import {
|
|
5355
|
+
"import { createComponent, createEffect, createSignal, escapeTextOrMarkup, escapeTextOrNode, hydrate, lazySlots, $, escapeAttr, escapeText, mapArrayLazy, textOrNode } from '@barefootjs/client/runtime'
|
|
5289
5356
|
|
|
5290
5357
|
export function initTodoItem(__scope, _p = {}) {
|
|
5291
5358
|
if (!__scope) return
|
|
@@ -5438,7 +5505,7 @@ export function StatementExample(_p, __bfKey) { return createComponent('Statemen
|
|
|
5438
5505
|
`;
|
|
5439
5506
|
|
|
5440
5507
|
exports[`docs/core/reactivity/shared-state.md doc-examples L31 — (no label) 1`] = `
|
|
5441
|
-
"import {
|
|
5508
|
+
"import { createComponent, createContext, createEffect, createSignal, hydrate, markupOrEmpty, provideContext, useContext, $ } from '@barefootjs/client/runtime'
|
|
5442
5509
|
|
|
5443
5510
|
var PlaybackContext = PlaybackContext ?? createContext()
|
|
5444
5511
|
|
|
@@ -5456,7 +5523,7 @@ export function initPlaybackProvider(__scope, _p = {}) {
|
|
|
5456
5523
|
provideContext(PlaybackContext, { elapsedMs, playing, seek, toggle })
|
|
5457
5524
|
}
|
|
5458
5525
|
|
|
5459
|
-
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>\` })
|
|
5460
5527
|
export function PlaybackProvider(_p, __bfKey) { return createComponent('PlaybackProvider', _p, __bfKey) }
|
|
5461
5528
|
var PlaybackContext = PlaybackContext ?? createContext()
|
|
5462
5529
|
|
|
@@ -5476,7 +5543,7 @@ export function initPlayer(__scope, _p = {}) {
|
|
|
5476
5543
|
if (_s0) (handleMount)(_s0)
|
|
5477
5544
|
}
|
|
5478
5545
|
|
|
5479
|
-
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>\` })
|
|
5480
5547
|
export function Player(_p, __bfKey) { return createComponent('Player', _p, __bfKey) }
|
|
5481
5548
|
var PlaybackContext = PlaybackContext ?? createContext()
|
|
5482
5549
|
|