@getforma/core 1.0.6 → 1.0.8
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/README.md +4 -4
- package/dist/{chunk-V732ZBCU.cjs → chunk-7L3KHGEA.cjs} +95 -50
- package/dist/chunk-7L3KHGEA.cjs.map +1 -0
- package/dist/{chunk-VTPFK5TJ.js → chunk-7Q7LIV23.js} +59 -14
- package/dist/chunk-7Q7LIV23.js.map +1 -0
- package/dist/{chunk-DCTOXHPF.cjs → chunk-BARF67I6.cjs} +8 -8
- package/dist/chunk-BARF67I6.cjs.map +1 -0
- package/dist/{chunk-OZCHIVAZ.js → chunk-HLM5BZZQ.js} +2 -2
- package/dist/chunk-HLM5BZZQ.js.map +1 -0
- package/dist/{chunk-3U57L2TY.cjs → chunk-QLPCVK7C.cjs} +2 -2
- package/dist/chunk-QLPCVK7C.cjs.map +1 -0
- package/dist/{chunk-OUVOAYIO.js → chunk-TBWZZ3SI.js} +3 -3
- package/dist/chunk-TBWZZ3SI.js.map +1 -0
- package/dist/formajs-runtime-hardened.global.js.map +1 -1
- package/dist/formajs-runtime.global.js.map +1 -1
- package/dist/formajs.global.js +55 -10
- package/dist/formajs.global.js.map +1 -1
- package/dist/http.cjs +13 -13
- package/dist/http.cjs.map +1 -1
- package/dist/http.js +4 -4
- package/dist/http.js.map +1 -1
- package/dist/index.cjs +61 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +141 -10
- package/dist/index.d.ts +141 -10
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/{resource-Cd0cGOxS.d.ts → resource-BHsgURy0.d.ts} +3 -1
- package/dist/{resource-DK98lW5e.d.cts → resource-DeEzxUz6.d.cts} +3 -1
- package/dist/runtime-hardened.cjs.map +1 -1
- package/dist/runtime-hardened.js.map +1 -1
- package/dist/runtime.cjs +29 -29
- package/dist/runtime.js +3 -3
- package/dist/server.cjs +7 -7
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/{signal-YlS1kgfh.d.cts → signal-C9v4akyJ.d.cts} +2 -0
- package/dist/{signal-YlS1kgfh.d.ts → signal-C9v4akyJ.d.ts} +2 -0
- package/dist/tc39-compat.cjs +3 -3
- package/dist/tc39-compat.d.cts +1 -1
- package/dist/tc39-compat.d.ts +1 -1
- package/dist/tc39-compat.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3U57L2TY.cjs.map +0 -1
- package/dist/chunk-DCTOXHPF.cjs.map +0 -1
- package/dist/chunk-OUVOAYIO.js.map +0 -1
- package/dist/chunk-OZCHIVAZ.js.map +0 -1
- package/dist/chunk-V732ZBCU.cjs.map +0 -1
- package/dist/chunk-VTPFK5TJ.js.map +0 -1
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ Or use a CDN — no build step, no bundler:
|
|
|
43
43
|
<script src="https://unpkg.com/@getforma/core/dist/formajs-runtime.global.js"></script>
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
> **Production:** Pin the version (e.g., `@getforma/core@1.0.
|
|
46
|
+
> **Production:** Pin the version (e.g., `@getforma/core@1.0.7`) instead of `@latest`.
|
|
47
47
|
|
|
48
48
|
---
|
|
49
49
|
|
|
@@ -701,17 +701,17 @@ deactivateIsland(islandElement);
|
|
|
701
701
|
|
|
702
702
|
```html
|
|
703
703
|
<!-- jsDelivr (recommended) -->
|
|
704
|
-
<script src="https://cdn.jsdelivr.net/npm/@getforma/core@1.0.
|
|
704
|
+
<script src="https://cdn.jsdelivr.net/npm/@getforma/core@1.0.7/dist/formajs-runtime.global.js"></script>
|
|
705
705
|
|
|
706
706
|
<!-- unpkg -->
|
|
707
|
-
<script src="https://unpkg.com/@getforma/core@1.0.
|
|
707
|
+
<script src="https://unpkg.com/@getforma/core@1.0.7/dist/formajs-runtime.global.js"></script>
|
|
708
708
|
```
|
|
709
709
|
|
|
710
710
|
### ESM import (modern browsers, no bundler)
|
|
711
711
|
|
|
712
712
|
```html
|
|
713
713
|
<script type="module">
|
|
714
|
-
import { createSignal, h, mount } from "https://cdn.jsdelivr.net/npm/@getforma/core@1.0.
|
|
714
|
+
import { createSignal, h, mount } from "https://cdn.jsdelivr.net/npm/@getforma/core@1.0.7/dist/index.js";
|
|
715
715
|
|
|
716
716
|
const [count, setCount] = createSignal(0);
|
|
717
717
|
mount(() => h("button", { onClick: () => setCount((c) => c + 1) }, () => `${count()}`), "#app");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkBARF67I6_cjs = require('./chunk-BARF67I6.cjs');
|
|
4
|
+
var chunkQLPCVK7C_cjs = require('./chunk-QLPCVK7C.cjs');
|
|
5
5
|
|
|
6
6
|
// src/dom/element.ts
|
|
7
7
|
var Fragment = /* @__PURE__ */ Symbol.for("forma.fragment");
|
|
@@ -156,7 +156,7 @@ function getCache(el) {
|
|
|
156
156
|
}
|
|
157
157
|
function handleClass(el, _key, value) {
|
|
158
158
|
if (typeof value === "function") {
|
|
159
|
-
|
|
159
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
160
160
|
const v = value();
|
|
161
161
|
const cache = getCache(el);
|
|
162
162
|
if (cache["class"] === v) return;
|
|
@@ -181,7 +181,7 @@ function handleClass(el, _key, value) {
|
|
|
181
181
|
function handleStyle(el, _key, value) {
|
|
182
182
|
if (typeof value === "function") {
|
|
183
183
|
let prevKeys = [];
|
|
184
|
-
|
|
184
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
185
185
|
const v = value();
|
|
186
186
|
if (typeof v === "string") {
|
|
187
187
|
const cache = getCache(el);
|
|
@@ -220,7 +220,7 @@ function handleEvent(el, key, value) {
|
|
|
220
220
|
}
|
|
221
221
|
function handleInnerHTML(el, _key, value) {
|
|
222
222
|
if (typeof value === "function") {
|
|
223
|
-
|
|
223
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
224
224
|
const resolved = value();
|
|
225
225
|
if (resolved == null) {
|
|
226
226
|
el.innerHTML = "";
|
|
@@ -264,7 +264,7 @@ function handleInnerHTML(el, _key, value) {
|
|
|
264
264
|
function handleXLink(el, key, value) {
|
|
265
265
|
const localName = key.slice(6);
|
|
266
266
|
if (typeof value === "function") {
|
|
267
|
-
|
|
267
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
268
268
|
const v = value();
|
|
269
269
|
if (v == null || v === false) {
|
|
270
270
|
el.removeAttributeNS(XLINK_NS, localName);
|
|
@@ -282,7 +282,7 @@ function handleXLink(el, key, value) {
|
|
|
282
282
|
}
|
|
283
283
|
function handleBooleanAttr(el, key, value) {
|
|
284
284
|
if (typeof value === "function") {
|
|
285
|
-
|
|
285
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
286
286
|
const v = value();
|
|
287
287
|
const cache = getCache(el);
|
|
288
288
|
if (cache[key] === v) return;
|
|
@@ -306,7 +306,7 @@ function handleBooleanAttr(el, key, value) {
|
|
|
306
306
|
}
|
|
307
307
|
function handleGenericAttr(el, key, value) {
|
|
308
308
|
if (typeof value === "function") {
|
|
309
|
-
|
|
309
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
310
310
|
const v = value();
|
|
311
311
|
if (v == null || v === false) {
|
|
312
312
|
const cache = getCache(el);
|
|
@@ -369,7 +369,11 @@ function applyProp(el, key, value) {
|
|
|
369
369
|
function applyStaticProp(el, key, value) {
|
|
370
370
|
if (value == null || value === false) return;
|
|
371
371
|
if (key === "class" || key === "className") {
|
|
372
|
-
el
|
|
372
|
+
if (el instanceof HTMLElement) {
|
|
373
|
+
el.className = value;
|
|
374
|
+
} else {
|
|
375
|
+
el.setAttribute("class", value);
|
|
376
|
+
}
|
|
373
377
|
return;
|
|
374
378
|
}
|
|
375
379
|
if (key === "style") {
|
|
@@ -430,17 +434,58 @@ function appendChild(parent, child) {
|
|
|
430
434
|
parent[DYNAMIC_CHILD_SYM] = true;
|
|
431
435
|
}
|
|
432
436
|
let currentNode = null;
|
|
433
|
-
|
|
437
|
+
let currentFragChildren = null;
|
|
438
|
+
let warnedArray = false;
|
|
439
|
+
const DEBUG = typeof globalThis.__FORMA_DEBUG__ !== "undefined";
|
|
440
|
+
const clearCurrent = () => {
|
|
441
|
+
if (currentFragChildren) {
|
|
442
|
+
for (const c of currentFragChildren) {
|
|
443
|
+
if (c.parentNode === parent) parent.removeChild(c);
|
|
444
|
+
}
|
|
445
|
+
currentFragChildren = null;
|
|
446
|
+
}
|
|
447
|
+
if (currentNode && currentNode.parentNode === parent) {
|
|
448
|
+
parent.removeChild(currentNode);
|
|
449
|
+
}
|
|
450
|
+
currentNode = null;
|
|
451
|
+
};
|
|
452
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
434
453
|
const v = child();
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
454
|
+
let resolved = v;
|
|
455
|
+
if (Array.isArray(v)) {
|
|
456
|
+
const frag = document.createDocumentFragment();
|
|
457
|
+
for (const item of v) {
|
|
458
|
+
if (item instanceof Node) frag.appendChild(item);
|
|
459
|
+
else if (Array.isArray(item)) {
|
|
460
|
+
if (DEBUG) console.warn("[forma] Nested arrays in function children are not supported. Flatten the array or use createList().");
|
|
461
|
+
} else if (item != null && item !== false && item !== true) {
|
|
462
|
+
frag.appendChild(new Text(String(item)));
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
resolved = frag.childNodes.length > 0 ? frag : null;
|
|
466
|
+
if (DEBUG && !warnedArray) {
|
|
467
|
+
warnedArray = true;
|
|
468
|
+
console.warn("[forma] Function child returned an array \u2014 auto-wrapped in DocumentFragment. Consider using createList() or wrapping in a container element for better performance.");
|
|
440
469
|
}
|
|
441
|
-
|
|
470
|
+
}
|
|
471
|
+
if (resolved instanceof Node) {
|
|
472
|
+
clearCurrent();
|
|
473
|
+
const isNewFrag = resolved instanceof DocumentFragment;
|
|
474
|
+
if (isNewFrag) {
|
|
475
|
+
currentFragChildren = Array.from(resolved.childNodes);
|
|
476
|
+
}
|
|
477
|
+
parent.appendChild(resolved);
|
|
478
|
+
currentNode = isNewFrag ? null : resolved;
|
|
479
|
+
} else if (resolved == null || resolved === false || resolved === true) {
|
|
480
|
+
clearCurrent();
|
|
442
481
|
} else {
|
|
443
|
-
|
|
482
|
+
if (currentFragChildren) {
|
|
483
|
+
for (const c of currentFragChildren) {
|
|
484
|
+
if (c.parentNode === parent) parent.removeChild(c);
|
|
485
|
+
}
|
|
486
|
+
currentFragChildren = null;
|
|
487
|
+
}
|
|
488
|
+
const text = typeof resolved === "symbol" ? String(resolved) : String(resolved ?? "");
|
|
444
489
|
if (!currentNode) {
|
|
445
490
|
currentNode = new Text(text);
|
|
446
491
|
parent.appendChild(currentNode);
|
|
@@ -535,9 +580,9 @@ function fragment(...children) {
|
|
|
535
580
|
}
|
|
536
581
|
|
|
537
582
|
// src/dom/show.ts
|
|
538
|
-
function createShow(when, thenFn, elseFn) {
|
|
583
|
+
function createShow(when, thenFn, elseFn = () => null) {
|
|
539
584
|
if (hydrating) {
|
|
540
|
-
const branch = when() ? thenFn() : elseFn
|
|
585
|
+
const branch = when() ? thenFn() : elseFn();
|
|
541
586
|
return {
|
|
542
587
|
type: "show",
|
|
543
588
|
condition: when,
|
|
@@ -554,7 +599,7 @@ function createShow(when, thenFn, elseFn) {
|
|
|
554
599
|
let currentNode = null;
|
|
555
600
|
let lastTruthy = null;
|
|
556
601
|
let currentDispose = null;
|
|
557
|
-
const showDispose =
|
|
602
|
+
const showDispose = chunkBARF67I6_cjs.internalEffect(() => {
|
|
558
603
|
const truthy = !!when();
|
|
559
604
|
const DEBUG = typeof globalThis.__FORMA_DEBUG__ !== "undefined";
|
|
560
605
|
const DEBUG_LABEL = DEBUG ? thenFn.toString().slice(0, 60) : "";
|
|
@@ -586,9 +631,9 @@ function createShow(when, thenFn, elseFn) {
|
|
|
586
631
|
const branchFn = truthy ? thenFn : elseFn;
|
|
587
632
|
if (branchFn) {
|
|
588
633
|
let branchDispose;
|
|
589
|
-
currentNode =
|
|
634
|
+
currentNode = chunkBARF67I6_cjs.createRoot((dispose) => {
|
|
590
635
|
branchDispose = dispose;
|
|
591
|
-
return
|
|
636
|
+
return chunkBARF67I6_cjs.untrack(() => branchFn());
|
|
592
637
|
});
|
|
593
638
|
currentDispose = branchDispose;
|
|
594
639
|
} else {
|
|
@@ -639,7 +684,7 @@ function applyDynamicProps(el, props) {
|
|
|
639
684
|
}
|
|
640
685
|
const fn = value;
|
|
641
686
|
const attrKey = key;
|
|
642
|
-
|
|
687
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
643
688
|
const v = fn();
|
|
644
689
|
if (v === false || v == null) {
|
|
645
690
|
el.removeAttribute(attrKey);
|
|
@@ -751,13 +796,13 @@ function setupShowEffect(desc, marker) {
|
|
|
751
796
|
let elseFragment = null;
|
|
752
797
|
const hasSSRContent = marker.start.nextSibling !== marker.end;
|
|
753
798
|
if (!hasSSRContent && currentCondition) {
|
|
754
|
-
if (
|
|
799
|
+
if (chunkBARF67I6_cjs.__DEV__) console.warn("[forma] Hydration: show condition mismatch \u2014 SSR empty but client condition is true");
|
|
755
800
|
const trueBranch = desc.whenTrue();
|
|
756
801
|
if (trueBranch instanceof Node) {
|
|
757
802
|
marker.start.parentNode.insertBefore(trueBranch, marker.end);
|
|
758
803
|
}
|
|
759
804
|
}
|
|
760
|
-
|
|
805
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
761
806
|
const next = !!desc.condition();
|
|
762
807
|
if (next === currentCondition) return;
|
|
763
808
|
currentCondition = next;
|
|
@@ -804,7 +849,7 @@ function adoptBranchContent(desc, regionStart, regionEnd) {
|
|
|
804
849
|
}
|
|
805
850
|
function adoptNode(desc, ssrEl) {
|
|
806
851
|
if (!ssrEl || ssrEl.tagName !== desc.tag.toUpperCase()) {
|
|
807
|
-
if (
|
|
852
|
+
if (chunkBARF67I6_cjs.__DEV__) console.warn(`Hydration mismatch: expected <${desc.tag}>, got <${ssrEl?.tagName?.toLowerCase() ?? "nothing"}>`);
|
|
808
853
|
const fresh = descriptorToElement(desc);
|
|
809
854
|
if (ssrEl) ssrEl.replaceWith(fresh);
|
|
810
855
|
return;
|
|
@@ -878,7 +923,7 @@ function adoptNode(desc, ssrEl) {
|
|
|
878
923
|
}
|
|
879
924
|
node = node.nextSibling;
|
|
880
925
|
}
|
|
881
|
-
const currentItems =
|
|
926
|
+
const currentItems = chunkBARF67I6_cjs.untrack(() => child.items());
|
|
882
927
|
const listKeyFn = child.keyFn;
|
|
883
928
|
const listRenderFn = child.renderFn;
|
|
884
929
|
const useIndexFallback = ssrKeyMap.size === 0 && ssrElements.length > 0;
|
|
@@ -902,11 +947,11 @@ function adoptNode(desc, ssrEl) {
|
|
|
902
947
|
adoptedNodes.push(ssrNode);
|
|
903
948
|
adoptedItems.push(item);
|
|
904
949
|
} else {
|
|
905
|
-
if (
|
|
950
|
+
if (chunkBARF67I6_cjs.__DEV__) console.warn(`[FormaJS] Hydration: list item key "${key}" not found in SSR \u2014 rendering fresh`);
|
|
906
951
|
const prevHydrating = hydrating;
|
|
907
952
|
hydrating = false;
|
|
908
953
|
try {
|
|
909
|
-
const [getIndex] =
|
|
954
|
+
const [getIndex] = chunkQLPCVK7C_cjs.createSignal(i);
|
|
910
955
|
const fresh = listRenderFn(item, getIndex);
|
|
911
956
|
end.parentNode.insertBefore(fresh, end);
|
|
912
957
|
adoptedNodes.push(fresh);
|
|
@@ -924,7 +969,7 @@ function adoptNode(desc, ssrEl) {
|
|
|
924
969
|
}
|
|
925
970
|
} else {
|
|
926
971
|
for (const [unusedKey, unusedNode] of ssrKeyMap) {
|
|
927
|
-
if (
|
|
972
|
+
if (chunkBARF67I6_cjs.__DEV__) console.warn(`[FormaJS] Hydration: removing extra SSR list item with key "${unusedKey}"`);
|
|
928
973
|
if (unusedNode.parentNode) {
|
|
929
974
|
unusedNode.parentNode.removeChild(unusedNode);
|
|
930
975
|
}
|
|
@@ -938,7 +983,7 @@ function adoptNode(desc, ssrEl) {
|
|
|
938
983
|
for (let i = 0; i < adoptedItems.length; i++) {
|
|
939
984
|
const item = adoptedItems[i];
|
|
940
985
|
const key = listKeyFn(item);
|
|
941
|
-
const [getIndex, setIndex] =
|
|
986
|
+
const [getIndex, setIndex] = chunkQLPCVK7C_cjs.createSignal(i);
|
|
942
987
|
cache.set(key, {
|
|
943
988
|
element: adoptedNodes[i],
|
|
944
989
|
item,
|
|
@@ -948,7 +993,7 @@ function adoptNode(desc, ssrEl) {
|
|
|
948
993
|
}
|
|
949
994
|
let reconcileNodes = adoptedNodes.slice();
|
|
950
995
|
let reconcileItems = adoptedItems.slice();
|
|
951
|
-
|
|
996
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
952
997
|
const newItems = child.items();
|
|
953
998
|
const parent2 = start.parentNode;
|
|
954
999
|
if (!parent2) return;
|
|
@@ -963,8 +1008,8 @@ function adoptNode(desc, ssrEl) {
|
|
|
963
1008
|
hydrating = false;
|
|
964
1009
|
try {
|
|
965
1010
|
const key = listKeyFn(item);
|
|
966
|
-
const [getIndex, setIndex] =
|
|
967
|
-
const element =
|
|
1011
|
+
const [getIndex, setIndex] = chunkQLPCVK7C_cjs.createSignal(0);
|
|
1012
|
+
const element = chunkBARF67I6_cjs.untrack(() => listRenderFn(item, getIndex));
|
|
968
1013
|
cache.set(key, { element, item, getIndex, setIndex });
|
|
969
1014
|
return element;
|
|
970
1015
|
} finally {
|
|
@@ -1013,12 +1058,12 @@ function adoptNode(desc, ssrEl) {
|
|
|
1013
1058
|
const endMarker = findClosingMarker(cursor);
|
|
1014
1059
|
let textNode = cursor.nextSibling;
|
|
1015
1060
|
if (!textNode || textNode.nodeType !== 3) {
|
|
1016
|
-
if (
|
|
1061
|
+
if (chunkBARF67I6_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for marker ${data} \u2014 SSR walker should emit content between markers`);
|
|
1017
1062
|
const created = document.createTextNode("");
|
|
1018
1063
|
cursor.parentNode.insertBefore(created, endMarker || cursor.nextSibling);
|
|
1019
1064
|
textNode = created;
|
|
1020
1065
|
}
|
|
1021
|
-
|
|
1066
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
1022
1067
|
textNode.data = String(child());
|
|
1023
1068
|
});
|
|
1024
1069
|
cursor = endMarker ? endMarker.nextSibling : textNode.nextSibling;
|
|
@@ -1028,11 +1073,11 @@ function adoptNode(desc, ssrEl) {
|
|
|
1028
1073
|
if (end) {
|
|
1029
1074
|
let textNode = findTextBetween(start, end);
|
|
1030
1075
|
if (!textNode) {
|
|
1031
|
-
if (
|
|
1076
|
+
if (chunkBARF67I6_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for show marker ${start.data} \u2014 SSR walker should emit content between markers`);
|
|
1032
1077
|
textNode = document.createTextNode("");
|
|
1033
1078
|
start.parentNode.insertBefore(textNode, end);
|
|
1034
1079
|
}
|
|
1035
|
-
|
|
1080
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
1036
1081
|
textNode.data = String(child());
|
|
1037
1082
|
});
|
|
1038
1083
|
cursor = end.nextSibling;
|
|
@@ -1045,14 +1090,14 @@ function adoptNode(desc, ssrEl) {
|
|
|
1045
1090
|
} else if (cursor && cursor.nodeType === 3) {
|
|
1046
1091
|
const textNode = cursor;
|
|
1047
1092
|
cursor = cursor.nextSibling;
|
|
1048
|
-
|
|
1093
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
1049
1094
|
textNode.data = String(child());
|
|
1050
1095
|
});
|
|
1051
1096
|
} else {
|
|
1052
|
-
if (
|
|
1097
|
+
if (chunkBARF67I6_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node in empty <${ssrEl.tagName.toLowerCase()}> \u2014 IR may not cover this component`);
|
|
1053
1098
|
const textNode = document.createTextNode("");
|
|
1054
1099
|
ssrEl.appendChild(textNode);
|
|
1055
|
-
|
|
1100
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
1056
1101
|
textNode.data = String(child());
|
|
1057
1102
|
});
|
|
1058
1103
|
}
|
|
@@ -1066,7 +1111,7 @@ function adoptNode(desc, ssrEl) {
|
|
|
1066
1111
|
function hydrateIsland(component, target) {
|
|
1067
1112
|
const hasSSRContent = target.childElementCount > 0 || target.childNodes.length > 0 && Array.from(target.childNodes).some((n) => n.nodeType === 1 || n.nodeType === 3 && n.data.trim());
|
|
1068
1113
|
if (!hasSSRContent) {
|
|
1069
|
-
if (
|
|
1114
|
+
if (chunkBARF67I6_cjs.__DEV__) {
|
|
1070
1115
|
const name = target.getAttribute("data-forma-component") || "unknown";
|
|
1071
1116
|
console.warn(
|
|
1072
1117
|
`[forma] Island "${name}" has no SSR content \u2014 falling back to CSR. This means the IR walker did not render content between ISLAND_START and ISLAND_END.`
|
|
@@ -1382,14 +1427,14 @@ function createList(items, keyFn, renderFn, options) {
|
|
|
1382
1427
|
let currentNodes = [];
|
|
1383
1428
|
let currentItems = [];
|
|
1384
1429
|
const updateOnItemChange = options?.updateOnItemChange ?? "none";
|
|
1385
|
-
|
|
1430
|
+
chunkBARF67I6_cjs.internalEffect(() => {
|
|
1386
1431
|
const newItems = items();
|
|
1387
1432
|
const parent = startMarker.parentNode;
|
|
1388
1433
|
if (!parent) {
|
|
1389
1434
|
return;
|
|
1390
1435
|
}
|
|
1391
1436
|
if (!Array.isArray(newItems)) {
|
|
1392
|
-
if (
|
|
1437
|
+
if (chunkBARF67I6_cjs.__DEV__) {
|
|
1393
1438
|
console.warn("[forma] createList: value is not an array, treating as empty");
|
|
1394
1439
|
}
|
|
1395
1440
|
for (const node of currentNodes) {
|
|
@@ -1407,7 +1452,7 @@ function createList(items, keyFn, renderFn, options) {
|
|
|
1407
1452
|
break;
|
|
1408
1453
|
}
|
|
1409
1454
|
}
|
|
1410
|
-
if (
|
|
1455
|
+
if (chunkBARF67I6_cjs.__DEV__) {
|
|
1411
1456
|
const seen = /* @__PURE__ */ new Set();
|
|
1412
1457
|
for (const item of cleanItems) {
|
|
1413
1458
|
const key = keyFn(item);
|
|
@@ -1427,7 +1472,7 @@ function createList(items, keyFn, renderFn, options) {
|
|
|
1427
1472
|
if (node[ABORT_SYM3] || node[CACHE_SYM2] || node[DYNAMIC_CHILD_SYM2]) {
|
|
1428
1473
|
return;
|
|
1429
1474
|
}
|
|
1430
|
-
const next =
|
|
1475
|
+
const next = chunkBARF67I6_cjs.untrack(() => renderFn(item, cached.getIndex));
|
|
1431
1476
|
if (canPatchStaticElement(node, next)) {
|
|
1432
1477
|
patchStaticElement(node, next);
|
|
1433
1478
|
cached.element = node;
|
|
@@ -1446,8 +1491,8 @@ function createList(items, keyFn, renderFn, options) {
|
|
|
1446
1491
|
// createFn: create element + cache entry
|
|
1447
1492
|
(item) => {
|
|
1448
1493
|
const key = keyFn(item);
|
|
1449
|
-
const [getIndex, setIndex] =
|
|
1450
|
-
const element =
|
|
1494
|
+
const [getIndex, setIndex] = chunkQLPCVK7C_cjs.createSignal(0);
|
|
1495
|
+
const element = chunkBARF67I6_cjs.untrack(() => renderFn(item, getIndex));
|
|
1451
1496
|
cache.set(key, { element, item, getIndex, setIndex });
|
|
1452
1497
|
return element;
|
|
1453
1498
|
},
|
|
@@ -1479,5 +1524,5 @@ exports.fragment = fragment;
|
|
|
1479
1524
|
exports.h = h;
|
|
1480
1525
|
exports.hydrateIsland = hydrateIsland;
|
|
1481
1526
|
exports.reconcileList = reconcileList;
|
|
1482
|
-
//# sourceMappingURL=chunk-
|
|
1483
|
-
//# sourceMappingURL=chunk-
|
|
1527
|
+
//# sourceMappingURL=chunk-7L3KHGEA.cjs.map
|
|
1528
|
+
//# sourceMappingURL=chunk-7L3KHGEA.cjs.map
|