solid-js 1.4.4 → 1.4.7

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/dev.cjs CHANGED
@@ -171,7 +171,10 @@ function createRoot(fn, detachedOwner) {
171
171
  updateFn = unowned ? () => fn(() => {
172
172
  throw new Error("Dispose method must be an explicit argument to createRoot function");
173
173
  }) : () => fn(() => cleanNode(root));
174
- if (owner) root.name = `${owner.name}-r${rootCount++}`;
174
+ {
175
+ if (owner) root.name = `${owner.name}-r${rootCount++}`;
176
+ globalThis._$afterCreateRoot && globalThis._$afterCreateRoot(root);
177
+ }
175
178
  Owner = root;
176
179
  Listener = null;
177
180
  try {
@@ -806,10 +809,8 @@ function runUpdates(fn, init) {
806
809
  completeUpdates(wait);
807
810
  return res;
808
811
  } catch (err) {
812
+ if (!Updates) Effects = null;
809
813
  handleError(err);
810
- } finally {
811
- Updates = null;
812
- if (!wait) Effects = null;
813
814
  }
814
815
  }
815
816
  function completeUpdates(wait) {
@@ -828,14 +829,16 @@ function completeUpdates(wait) {
828
829
  return;
829
830
  }
830
831
  const sources = Transition.sources;
832
+ const disposed = Transition.disposed;
831
833
  res = Transition.resolve;
832
- Effects.forEach(e => {
834
+ for (const e of Effects) {
833
835
  "tState" in e && (e.state = e.tState);
834
836
  delete e.tState;
835
- });
837
+ }
836
838
  Transition = null;
837
839
  batch(() => {
838
- sources.forEach(v => {
840
+ for (const d of disposed) cleanNode(d);
841
+ for (const v of sources) {
839
842
  v.value = v.tValue;
840
843
  if (v.owned) {
841
844
  for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
@@ -844,7 +847,7 @@ function completeUpdates(wait) {
844
847
  delete v.tValue;
845
848
  delete v.tOwned;
846
849
  v.tState = 0;
847
- });
850
+ }
848
851
  setTransPending(false);
849
852
  });
850
853
  }
@@ -964,7 +967,7 @@ function reset(node, top) {
964
967
  function handleError(err) {
965
968
  const fns = ERROR && lookup(Owner, ERROR);
966
969
  if (!fns) throw err;
967
- fns.forEach(f => f(err));
970
+ for (const f of fns) f(err);
968
971
  }
969
972
  function lookup(owner, key) {
970
973
  return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
@@ -1447,27 +1450,24 @@ function ErrorBoundary(props) {
1447
1450
 
1448
1451
  const SuspenseListContext = createContext();
1449
1452
  function SuspenseList(props) {
1450
- let index = 0,
1451
- suspenseSetter,
1452
- showContent,
1453
- showFallback;
1453
+ let suspenseSetter, showContent, showFallback;
1454
1454
  const listContext = useContext(SuspenseListContext);
1455
1455
  if (listContext) {
1456
1456
  const [inFallback, setFallback] = createSignal(false);
1457
1457
  suspenseSetter = setFallback;
1458
1458
  [showContent, showFallback] = listContext.register(inFallback);
1459
1459
  }
1460
- const registry = [],
1460
+ const [registry, setRegistry] = createSignal([]),
1461
1461
  comp = createComponent(SuspenseListContext.Provider, {
1462
1462
  value: {
1463
1463
  register: inFallback => {
1464
1464
  const [showingContent, showContent] = createSignal(false),
1465
1465
  [showingFallback, showFallback] = createSignal(false);
1466
- registry[index++] = {
1466
+ setRegistry(registry => [...registry, {
1467
1467
  inFallback,
1468
1468
  showContent,
1469
1469
  showFallback
1470
- };
1470
+ }]);
1471
1471
  return [showingContent, showingFallback];
1472
1472
  }
1473
1473
  },
@@ -1480,31 +1480,32 @@ function SuspenseList(props) {
1480
1480
  tail = props.tail,
1481
1481
  visibleContent = showContent ? showContent() : true,
1482
1482
  visibleFallback = showFallback ? showFallback() : true,
1483
+ reg = registry(),
1483
1484
  reverse = reveal === "backwards";
1484
1485
  if (reveal === "together") {
1485
- const all = registry.every(i => !i.inFallback());
1486
+ const all = reg.every(i => !i.inFallback());
1486
1487
  suspenseSetter && suspenseSetter(!all);
1487
- registry.forEach(i => {
1488
+ reg.forEach(i => {
1488
1489
  i.showContent(all && visibleContent);
1489
1490
  i.showFallback(visibleFallback);
1490
1491
  });
1491
1492
  return;
1492
1493
  }
1493
1494
  let stop = false;
1494
- for (let i = 0, len = registry.length; i < len; i++) {
1495
+ for (let i = 0, len = reg.length; i < len; i++) {
1495
1496
  const n = reverse ? len - i - 1 : i,
1496
- s = registry[n].inFallback();
1497
+ s = reg[n].inFallback();
1497
1498
  if (!stop && !s) {
1498
- registry[n].showContent(visibleContent);
1499
- registry[n].showFallback(visibleFallback);
1499
+ reg[n].showContent(visibleContent);
1500
+ reg[n].showFallback(visibleFallback);
1500
1501
  } else {
1501
1502
  const next = !stop;
1502
1503
  if (next && suspenseSetter) suspenseSetter(true);
1503
1504
  if (!tail || next && tail === "collapsed") {
1504
- registry[n].showFallback(visibleFallback);
1505
- } else registry[n].showFallback(false);
1505
+ reg[n].showFallback(visibleFallback);
1506
+ } else reg[n].showFallback(false);
1506
1507
  stop = true;
1507
- registry[n].showContent(next);
1508
+ reg[n].showContent(next);
1508
1509
  }
1509
1510
  }
1510
1511
  if (!stop && suspenseSetter) suspenseSetter(false);
@@ -1549,7 +1550,7 @@ function Suspense(props) {
1549
1550
  set();
1550
1551
  setHydrateContext();
1551
1552
  });
1552
- }
1553
+ } else if (p === null) sharedConfig.gather(key);
1553
1554
  }
1554
1555
  const listContext = useContext(SuspenseListContext);
1555
1556
  if (listContext) [showContent, showFallback] = listContext.register(store.inFallback);
package/dist/dev.js CHANGED
@@ -167,7 +167,10 @@ function createRoot(fn, detachedOwner) {
167
167
  updateFn = unowned ? () => fn(() => {
168
168
  throw new Error("Dispose method must be an explicit argument to createRoot function");
169
169
  }) : () => fn(() => cleanNode(root));
170
- if (owner) root.name = `${owner.name}-r${rootCount++}`;
170
+ {
171
+ if (owner) root.name = `${owner.name}-r${rootCount++}`;
172
+ globalThis._$afterCreateRoot && globalThis._$afterCreateRoot(root);
173
+ }
171
174
  Owner = root;
172
175
  Listener = null;
173
176
  try {
@@ -802,10 +805,8 @@ function runUpdates(fn, init) {
802
805
  completeUpdates(wait);
803
806
  return res;
804
807
  } catch (err) {
808
+ if (!Updates) Effects = null;
805
809
  handleError(err);
806
- } finally {
807
- Updates = null;
808
- if (!wait) Effects = null;
809
810
  }
810
811
  }
811
812
  function completeUpdates(wait) {
@@ -824,14 +825,16 @@ function completeUpdates(wait) {
824
825
  return;
825
826
  }
826
827
  const sources = Transition.sources;
828
+ const disposed = Transition.disposed;
827
829
  res = Transition.resolve;
828
- Effects.forEach(e => {
830
+ for (const e of Effects) {
829
831
  "tState" in e && (e.state = e.tState);
830
832
  delete e.tState;
831
- });
833
+ }
832
834
  Transition = null;
833
835
  batch(() => {
834
- sources.forEach(v => {
836
+ for (const d of disposed) cleanNode(d);
837
+ for (const v of sources) {
835
838
  v.value = v.tValue;
836
839
  if (v.owned) {
837
840
  for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
@@ -840,7 +843,7 @@ function completeUpdates(wait) {
840
843
  delete v.tValue;
841
844
  delete v.tOwned;
842
845
  v.tState = 0;
843
- });
846
+ }
844
847
  setTransPending(false);
845
848
  });
846
849
  }
@@ -960,7 +963,7 @@ function reset(node, top) {
960
963
  function handleError(err) {
961
964
  const fns = ERROR && lookup(Owner, ERROR);
962
965
  if (!fns) throw err;
963
- fns.forEach(f => f(err));
966
+ for (const f of fns) f(err);
964
967
  }
965
968
  function lookup(owner, key) {
966
969
  return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
@@ -1443,27 +1446,24 @@ function ErrorBoundary(props) {
1443
1446
 
1444
1447
  const SuspenseListContext = createContext();
1445
1448
  function SuspenseList(props) {
1446
- let index = 0,
1447
- suspenseSetter,
1448
- showContent,
1449
- showFallback;
1449
+ let suspenseSetter, showContent, showFallback;
1450
1450
  const listContext = useContext(SuspenseListContext);
1451
1451
  if (listContext) {
1452
1452
  const [inFallback, setFallback] = createSignal(false);
1453
1453
  suspenseSetter = setFallback;
1454
1454
  [showContent, showFallback] = listContext.register(inFallback);
1455
1455
  }
1456
- const registry = [],
1456
+ const [registry, setRegistry] = createSignal([]),
1457
1457
  comp = createComponent(SuspenseListContext.Provider, {
1458
1458
  value: {
1459
1459
  register: inFallback => {
1460
1460
  const [showingContent, showContent] = createSignal(false),
1461
1461
  [showingFallback, showFallback] = createSignal(false);
1462
- registry[index++] = {
1462
+ setRegistry(registry => [...registry, {
1463
1463
  inFallback,
1464
1464
  showContent,
1465
1465
  showFallback
1466
- };
1466
+ }]);
1467
1467
  return [showingContent, showingFallback];
1468
1468
  }
1469
1469
  },
@@ -1476,31 +1476,32 @@ function SuspenseList(props) {
1476
1476
  tail = props.tail,
1477
1477
  visibleContent = showContent ? showContent() : true,
1478
1478
  visibleFallback = showFallback ? showFallback() : true,
1479
+ reg = registry(),
1479
1480
  reverse = reveal === "backwards";
1480
1481
  if (reveal === "together") {
1481
- const all = registry.every(i => !i.inFallback());
1482
+ const all = reg.every(i => !i.inFallback());
1482
1483
  suspenseSetter && suspenseSetter(!all);
1483
- registry.forEach(i => {
1484
+ reg.forEach(i => {
1484
1485
  i.showContent(all && visibleContent);
1485
1486
  i.showFallback(visibleFallback);
1486
1487
  });
1487
1488
  return;
1488
1489
  }
1489
1490
  let stop = false;
1490
- for (let i = 0, len = registry.length; i < len; i++) {
1491
+ for (let i = 0, len = reg.length; i < len; i++) {
1491
1492
  const n = reverse ? len - i - 1 : i,
1492
- s = registry[n].inFallback();
1493
+ s = reg[n].inFallback();
1493
1494
  if (!stop && !s) {
1494
- registry[n].showContent(visibleContent);
1495
- registry[n].showFallback(visibleFallback);
1495
+ reg[n].showContent(visibleContent);
1496
+ reg[n].showFallback(visibleFallback);
1496
1497
  } else {
1497
1498
  const next = !stop;
1498
1499
  if (next && suspenseSetter) suspenseSetter(true);
1499
1500
  if (!tail || next && tail === "collapsed") {
1500
- registry[n].showFallback(visibleFallback);
1501
- } else registry[n].showFallback(false);
1501
+ reg[n].showFallback(visibleFallback);
1502
+ } else reg[n].showFallback(false);
1502
1503
  stop = true;
1503
- registry[n].showContent(next);
1504
+ reg[n].showContent(next);
1504
1505
  }
1505
1506
  }
1506
1507
  if (!stop && suspenseSetter) suspenseSetter(false);
@@ -1545,7 +1546,7 @@ function Suspense(props) {
1545
1546
  set();
1546
1547
  setHydrateContext();
1547
1548
  });
1548
- }
1549
+ } else if (p === null) sharedConfig.gather(key);
1549
1550
  }
1550
1551
  const listContext = useContext(SuspenseListContext);
1551
1552
  if (listContext) [showContent, showFallback] = listContext.register(store.inFallback);
package/dist/solid.cjs CHANGED
@@ -747,10 +747,8 @@ function runUpdates(fn, init) {
747
747
  completeUpdates(wait);
748
748
  return res;
749
749
  } catch (err) {
750
+ if (!Updates) Effects = null;
750
751
  handleError(err);
751
- } finally {
752
- Updates = null;
753
- if (!wait) Effects = null;
754
752
  }
755
753
  }
756
754
  function completeUpdates(wait) {
@@ -769,14 +767,16 @@ function completeUpdates(wait) {
769
767
  return;
770
768
  }
771
769
  const sources = Transition.sources;
770
+ const disposed = Transition.disposed;
772
771
  res = Transition.resolve;
773
- Effects.forEach(e => {
772
+ for (const e of Effects) {
774
773
  "tState" in e && (e.state = e.tState);
775
774
  delete e.tState;
776
- });
775
+ }
777
776
  Transition = null;
778
777
  batch(() => {
779
- sources.forEach(v => {
778
+ for (const d of disposed) cleanNode(d);
779
+ for (const v of sources) {
780
780
  v.value = v.tValue;
781
781
  if (v.owned) {
782
782
  for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
@@ -785,7 +785,7 @@ function completeUpdates(wait) {
785
785
  delete v.tValue;
786
786
  delete v.tOwned;
787
787
  v.tState = 0;
788
- });
788
+ }
789
789
  setTransPending(false);
790
790
  });
791
791
  }
@@ -903,7 +903,7 @@ function reset(node, top) {
903
903
  function handleError(err) {
904
904
  const fns = ERROR && lookup(Owner, ERROR);
905
905
  if (!fns) throw err;
906
- fns.forEach(f => f(err));
906
+ for (const f of fns) f(err);
907
907
  }
908
908
  function lookup(owner, key) {
909
909
  return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
@@ -1359,27 +1359,24 @@ function ErrorBoundary(props) {
1359
1359
 
1360
1360
  const SuspenseListContext = createContext();
1361
1361
  function SuspenseList(props) {
1362
- let index = 0,
1363
- suspenseSetter,
1364
- showContent,
1365
- showFallback;
1362
+ let suspenseSetter, showContent, showFallback;
1366
1363
  const listContext = useContext(SuspenseListContext);
1367
1364
  if (listContext) {
1368
1365
  const [inFallback, setFallback] = createSignal(false);
1369
1366
  suspenseSetter = setFallback;
1370
1367
  [showContent, showFallback] = listContext.register(inFallback);
1371
1368
  }
1372
- const registry = [],
1369
+ const [registry, setRegistry] = createSignal([]),
1373
1370
  comp = createComponent(SuspenseListContext.Provider, {
1374
1371
  value: {
1375
1372
  register: inFallback => {
1376
1373
  const [showingContent, showContent] = createSignal(false),
1377
1374
  [showingFallback, showFallback] = createSignal(false);
1378
- registry[index++] = {
1375
+ setRegistry(registry => [...registry, {
1379
1376
  inFallback,
1380
1377
  showContent,
1381
1378
  showFallback
1382
- };
1379
+ }]);
1383
1380
  return [showingContent, showingFallback];
1384
1381
  }
1385
1382
  },
@@ -1392,31 +1389,32 @@ function SuspenseList(props) {
1392
1389
  tail = props.tail,
1393
1390
  visibleContent = showContent ? showContent() : true,
1394
1391
  visibleFallback = showFallback ? showFallback() : true,
1392
+ reg = registry(),
1395
1393
  reverse = reveal === "backwards";
1396
1394
  if (reveal === "together") {
1397
- const all = registry.every(i => !i.inFallback());
1395
+ const all = reg.every(i => !i.inFallback());
1398
1396
  suspenseSetter && suspenseSetter(!all);
1399
- registry.forEach(i => {
1397
+ reg.forEach(i => {
1400
1398
  i.showContent(all && visibleContent);
1401
1399
  i.showFallback(visibleFallback);
1402
1400
  });
1403
1401
  return;
1404
1402
  }
1405
1403
  let stop = false;
1406
- for (let i = 0, len = registry.length; i < len; i++) {
1404
+ for (let i = 0, len = reg.length; i < len; i++) {
1407
1405
  const n = reverse ? len - i - 1 : i,
1408
- s = registry[n].inFallback();
1406
+ s = reg[n].inFallback();
1409
1407
  if (!stop && !s) {
1410
- registry[n].showContent(visibleContent);
1411
- registry[n].showFallback(visibleFallback);
1408
+ reg[n].showContent(visibleContent);
1409
+ reg[n].showFallback(visibleFallback);
1412
1410
  } else {
1413
1411
  const next = !stop;
1414
1412
  if (next && suspenseSetter) suspenseSetter(true);
1415
1413
  if (!tail || next && tail === "collapsed") {
1416
- registry[n].showFallback(visibleFallback);
1417
- } else registry[n].showFallback(false);
1414
+ reg[n].showFallback(visibleFallback);
1415
+ } else reg[n].showFallback(false);
1418
1416
  stop = true;
1419
- registry[n].showContent(next);
1417
+ reg[n].showContent(next);
1420
1418
  }
1421
1419
  }
1422
1420
  if (!stop && suspenseSetter) suspenseSetter(false);
@@ -1461,7 +1459,7 @@ function Suspense(props) {
1461
1459
  set();
1462
1460
  setHydrateContext();
1463
1461
  });
1464
- }
1462
+ } else if (p === null) sharedConfig.gather(key);
1465
1463
  }
1466
1464
  const listContext = useContext(SuspenseListContext);
1467
1465
  if (listContext) [showContent, showFallback] = listContext.register(store.inFallback);
package/dist/solid.js CHANGED
@@ -743,10 +743,8 @@ function runUpdates(fn, init) {
743
743
  completeUpdates(wait);
744
744
  return res;
745
745
  } catch (err) {
746
+ if (!Updates) Effects = null;
746
747
  handleError(err);
747
- } finally {
748
- Updates = null;
749
- if (!wait) Effects = null;
750
748
  }
751
749
  }
752
750
  function completeUpdates(wait) {
@@ -765,14 +763,16 @@ function completeUpdates(wait) {
765
763
  return;
766
764
  }
767
765
  const sources = Transition.sources;
766
+ const disposed = Transition.disposed;
768
767
  res = Transition.resolve;
769
- Effects.forEach(e => {
768
+ for (const e of Effects) {
770
769
  "tState" in e && (e.state = e.tState);
771
770
  delete e.tState;
772
- });
771
+ }
773
772
  Transition = null;
774
773
  batch(() => {
775
- sources.forEach(v => {
774
+ for (const d of disposed) cleanNode(d);
775
+ for (const v of sources) {
776
776
  v.value = v.tValue;
777
777
  if (v.owned) {
778
778
  for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
@@ -781,7 +781,7 @@ function completeUpdates(wait) {
781
781
  delete v.tValue;
782
782
  delete v.tOwned;
783
783
  v.tState = 0;
784
- });
784
+ }
785
785
  setTransPending(false);
786
786
  });
787
787
  }
@@ -899,7 +899,7 @@ function reset(node, top) {
899
899
  function handleError(err) {
900
900
  const fns = ERROR && lookup(Owner, ERROR);
901
901
  if (!fns) throw err;
902
- fns.forEach(f => f(err));
902
+ for (const f of fns) f(err);
903
903
  }
904
904
  function lookup(owner, key) {
905
905
  return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
@@ -1355,27 +1355,24 @@ function ErrorBoundary(props) {
1355
1355
 
1356
1356
  const SuspenseListContext = createContext();
1357
1357
  function SuspenseList(props) {
1358
- let index = 0,
1359
- suspenseSetter,
1360
- showContent,
1361
- showFallback;
1358
+ let suspenseSetter, showContent, showFallback;
1362
1359
  const listContext = useContext(SuspenseListContext);
1363
1360
  if (listContext) {
1364
1361
  const [inFallback, setFallback] = createSignal(false);
1365
1362
  suspenseSetter = setFallback;
1366
1363
  [showContent, showFallback] = listContext.register(inFallback);
1367
1364
  }
1368
- const registry = [],
1365
+ const [registry, setRegistry] = createSignal([]),
1369
1366
  comp = createComponent(SuspenseListContext.Provider, {
1370
1367
  value: {
1371
1368
  register: inFallback => {
1372
1369
  const [showingContent, showContent] = createSignal(false),
1373
1370
  [showingFallback, showFallback] = createSignal(false);
1374
- registry[index++] = {
1371
+ setRegistry(registry => [...registry, {
1375
1372
  inFallback,
1376
1373
  showContent,
1377
1374
  showFallback
1378
- };
1375
+ }]);
1379
1376
  return [showingContent, showingFallback];
1380
1377
  }
1381
1378
  },
@@ -1388,31 +1385,32 @@ function SuspenseList(props) {
1388
1385
  tail = props.tail,
1389
1386
  visibleContent = showContent ? showContent() : true,
1390
1387
  visibleFallback = showFallback ? showFallback() : true,
1388
+ reg = registry(),
1391
1389
  reverse = reveal === "backwards";
1392
1390
  if (reveal === "together") {
1393
- const all = registry.every(i => !i.inFallback());
1391
+ const all = reg.every(i => !i.inFallback());
1394
1392
  suspenseSetter && suspenseSetter(!all);
1395
- registry.forEach(i => {
1393
+ reg.forEach(i => {
1396
1394
  i.showContent(all && visibleContent);
1397
1395
  i.showFallback(visibleFallback);
1398
1396
  });
1399
1397
  return;
1400
1398
  }
1401
1399
  let stop = false;
1402
- for (let i = 0, len = registry.length; i < len; i++) {
1400
+ for (let i = 0, len = reg.length; i < len; i++) {
1403
1401
  const n = reverse ? len - i - 1 : i,
1404
- s = registry[n].inFallback();
1402
+ s = reg[n].inFallback();
1405
1403
  if (!stop && !s) {
1406
- registry[n].showContent(visibleContent);
1407
- registry[n].showFallback(visibleFallback);
1404
+ reg[n].showContent(visibleContent);
1405
+ reg[n].showFallback(visibleFallback);
1408
1406
  } else {
1409
1407
  const next = !stop;
1410
1408
  if (next && suspenseSetter) suspenseSetter(true);
1411
1409
  if (!tail || next && tail === "collapsed") {
1412
- registry[n].showFallback(visibleFallback);
1413
- } else registry[n].showFallback(false);
1410
+ reg[n].showFallback(visibleFallback);
1411
+ } else reg[n].showFallback(false);
1414
1412
  stop = true;
1415
- registry[n].showContent(next);
1413
+ reg[n].showContent(next);
1416
1414
  }
1417
1415
  }
1418
1416
  if (!stop && suspenseSetter) suspenseSetter(false);
@@ -1457,7 +1455,7 @@ function Suspense(props) {
1457
1455
  set();
1458
1456
  setHydrateContext();
1459
1457
  });
1460
- }
1458
+ } else if (p === null) sharedConfig.gather(key);
1461
1459
  }
1462
1460
  const listContext = useContext(SuspenseListContext);
1463
1461
  if (listContext) [showContent, showFallback] = listContext.register(store.inFallback);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solid-js",
3
3
  "description": "A declarative JavaScript library for building user interfaces.",
4
- "version": "1.4.4",
4
+ "version": "1.4.7",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -151,5 +151,5 @@
151
151
  "compiler",
152
152
  "performance"
153
153
  ],
154
- "gitHead": "9f1de6b3cea905aa0857789a0e4738cae73cb1b1"
154
+ "gitHead": "b2873ffbbb73ef76214d32db86a8f676722fb1c2"
155
155
  }
@@ -200,7 +200,7 @@ function updatePath(current, path, traversed = []) {
200
200
  mergeStoreNode(prev, value);
201
201
  } else setProperty(current, part, value);
202
202
  }
203
- function createStore(store, options) {
203
+ function createStore(...[store, options]) {
204
204
  const unwrappedStore = unwrap(store || {});
205
205
  const isArray = Array.isArray(unwrappedStore);
206
206
  if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createStore'. Expected an object.`);
@@ -238,11 +238,11 @@ const proxyTraps = {
238
238
  return isWrappable(value) ? wrap(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value;
239
239
  },
240
240
  set(target, property, value) {
241
- setProperty(target, property, unwrap(value));
241
+ solidJs.batch(() => setProperty(target, property, unwrap(value)));
242
242
  return true;
243
243
  },
244
244
  deleteProperty(target, property) {
245
- setProperty(target, property, undefined);
245
+ solidJs.batch(() => setProperty(target, property, undefined));
246
246
  return true;
247
247
  },
248
248
  ownKeys: ownKeys,
package/store/dist/dev.js CHANGED
@@ -196,7 +196,7 @@ function updatePath(current, path, traversed = []) {
196
196
  mergeStoreNode(prev, value);
197
197
  } else setProperty(current, part, value);
198
198
  }
199
- function createStore(store, options) {
199
+ function createStore(...[store, options]) {
200
200
  const unwrappedStore = unwrap(store || {});
201
201
  const isArray = Array.isArray(unwrappedStore);
202
202
  if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createStore'. Expected an object.`);
@@ -234,11 +234,11 @@ const proxyTraps = {
234
234
  return isWrappable(value) ? wrap(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value;
235
235
  },
236
236
  set(target, property, value) {
237
- setProperty(target, property, unwrap(value));
237
+ batch(() => setProperty(target, property, unwrap(value)));
238
238
  return true;
239
239
  },
240
240
  deleteProperty(target, property) {
241
- setProperty(target, property, undefined);
241
+ batch(() => setProperty(target, property, undefined));
242
242
  return true;
243
243
  },
244
244
  ownKeys: ownKeys,
@@ -195,7 +195,7 @@ function updatePath(current, path, traversed = []) {
195
195
  mergeStoreNode(prev, value);
196
196
  } else setProperty(current, part, value);
197
197
  }
198
- function createStore(store, options) {
198
+ function createStore(...[store, options]) {
199
199
  const unwrappedStore = unwrap(store || {});
200
200
  const isArray = Array.isArray(unwrappedStore);
201
201
  const wrappedStore = wrap$1(unwrappedStore);
@@ -226,11 +226,11 @@ const proxyTraps = {
226
226
  return isWrappable(value) ? wrap(value) : value;
227
227
  },
228
228
  set(target, property, value) {
229
- setProperty(target, property, unwrap(value));
229
+ solidJs.batch(() => setProperty(target, property, unwrap(value)));
230
230
  return true;
231
231
  },
232
232
  deleteProperty(target, property) {
233
- setProperty(target, property, undefined);
233
+ solidJs.batch(() => setProperty(target, property, undefined));
234
234
  return true;
235
235
  },
236
236
  ownKeys: ownKeys,
@@ -191,7 +191,7 @@ function updatePath(current, path, traversed = []) {
191
191
  mergeStoreNode(prev, value);
192
192
  } else setProperty(current, part, value);
193
193
  }
194
- function createStore(store, options) {
194
+ function createStore(...[store, options]) {
195
195
  const unwrappedStore = unwrap(store || {});
196
196
  const isArray = Array.isArray(unwrappedStore);
197
197
  const wrappedStore = wrap$1(unwrappedStore);
@@ -222,11 +222,11 @@ const proxyTraps = {
222
222
  return isWrappable(value) ? wrap(value) : value;
223
223
  },
224
224
  set(target, property, value) {
225
- setProperty(target, property, unwrap(value));
225
+ batch(() => setProperty(target, property, unwrap(value)));
226
226
  return true;
227
227
  },
228
228
  deleteProperty(target, property) {
229
- setProperty(target, property, undefined);
229
+ batch(() => setProperty(target, property, undefined));
230
230
  return true;
231
231
  },
232
232
  ownKeys: ownKeys,
@@ -34,8 +34,8 @@ export declare type StorePathRange = {
34
34
  by?: number;
35
35
  };
36
36
  export declare type ArrayFilterFn<T> = (item: T, index: number) => boolean;
37
- export declare type StoreSetter<T, U extends PropertyKey[] = []> = ((prevState: T, traversed: U) => T | CustomPartial<T> | void) | T | CustomPartial<T>;
38
- export declare type Part<T, K extends KeyOf<T> = KeyOf<T>> = [K] extends [never] ? never : K | readonly K[] | ([T] extends [readonly unknown[]] ? ArrayFilterFn<T[number]> | StorePathRange : never);
37
+ export declare type StoreSetter<T, U extends PropertyKey[] = []> = ((prevState: T, traversed: U) => T | CustomPartial<T>) | T | CustomPartial<T>;
38
+ export declare type Part<T, K extends KeyOf<T> = KeyOf<T>> = K | ([K] extends [never] ? never : readonly K[]) | ([T] extends [readonly unknown[]] ? ArrayFilterFn<T[number]> | StorePathRange : never);
39
39
  declare type W<T> = Exclude<T, NotWrappable>;
40
40
  declare type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [readonly unknown[]] ? number : [T] extends [never] ? never : keyof T : keyof T;
41
41
  declare type Rest<T, U extends PropertyKey[]> = [StoreSetter<T, U>] | (0 extends 1 & T ? [...Part<any>[], StoreSetter<any, PropertyKey[]>] : DistributeRest<W<T>, KeyOf<W<T>>, U>);
@@ -55,7 +55,9 @@ export interface SetStoreFunction<T> {
55
55
  *
56
56
  * @description https://www.solidjs.com/docs/latest/api#createstore
57
57
  */
58
- export declare function createStore<T extends StoreNode>(store: T | Store<T>, options?: {
58
+ export declare function createStore<T extends {}>(...[store, options]: {} extends T ? [store?: T | Store<T>, options?: {
59
59
  name?: string;
60
- }): [get: Store<T>, set: SetStoreFunction<T>];
60
+ }] : [store: object & (T | Store<T>), options?: {
61
+ name?: string;
62
+ }]): [get: Store<T>, set: SetStoreFunction<T>];
61
63
  export {};
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { createRoot, createSignal, createEffect, createRenderEffect, createComputed, createReaction, createDeferred, createSelector, createMemo, createResource, onMount, onCleanup, onError, untrack, batch, on, enableScheduling, enableExternalSource, startTransition, useTransition, createContext, useContext, children, getListener, getOwner, runWithOwner, equalFn, $DEVCOMP, $PROXY, $TRACK } from "./reactive/signal";
2
- export type { Accessor, Setter, Signal, Resource, ResourceReturn, ResourceFetcher, ResourceFetcherInfo, Context, ReturnTypes } from "./reactive/signal";
2
+ export type { Accessor, Setter, Signal, Resource, ResourceOptions, ResourceReturn, ResourceFetcher, ResourceFetcherInfo, Context, ReturnTypes, Owner } from "./reactive/signal";
3
3
  export * from "./reactive/observable";
4
4
  export * from "./reactive/scheduler";
5
5
  export * from "./reactive/array";
@@ -11,6 +11,7 @@ export declare let Transition: TransitionState | null;
11
11
  declare let ExternalSourceFactory: ExternalSourceFactory | null;
12
12
  declare global {
13
13
  var _$afterUpdate: () => void;
14
+ var _$afterCreateRoot: (root: Owner) => void;
14
15
  }
15
16
  export interface SignalState<T> {
16
17
  value?: T;
package/web/dist/dev.cjs CHANGED
@@ -408,7 +408,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
408
408
  return () => current;
409
409
  } else if (Array.isArray(value)) {
410
410
  const array = [];
411
- if (normalizeIncomingArray(array, value, unwrapArray)) {
411
+ const currentArray = current && Array.isArray(current);
412
+ if (normalizeIncomingArray(array, value, current, unwrapArray)) {
412
413
  solidJs.createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
413
414
  return () => current;
414
415
  }
@@ -420,7 +421,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
420
421
  if (array.length === 0) {
421
422
  current = cleanChildren(parent, current, marker);
422
423
  if (multi) return current;
423
- } else if (Array.isArray(current)) {
424
+ } else if (currentArray) {
424
425
  if (current.length === 0) {
425
426
  appendNodes(parent, array, marker);
426
427
  } else reconcileArrays(parent, current, array);
@@ -441,26 +442,29 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
441
442
  } else console.warn(`Unrecognized value. Skipped inserting`, value);
442
443
  return current;
443
444
  }
444
- function normalizeIncomingArray(normalized, array, unwrap) {
445
+ function normalizeIncomingArray(normalized, array, current, unwrap) {
445
446
  let dynamic = false;
446
447
  for (let i = 0, len = array.length; i < len; i++) {
447
448
  let item = array[i],
448
- t;
449
+ prev = current && current[i];
449
450
  if (item instanceof Node) {
450
451
  normalized.push(item);
451
452
  } else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
452
- dynamic = normalizeIncomingArray(normalized, item) || dynamic;
453
- } else if ((t = typeof item) === "string") {
454
- normalized.push(document.createTextNode(item));
455
- } else if (t === "function") {
453
+ dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
454
+ } else if ((typeof item) === "function") {
456
455
  if (unwrap) {
457
456
  while (typeof item === "function") item = item();
458
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
457
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
459
458
  } else {
460
459
  normalized.push(item);
461
460
  dynamic = true;
462
461
  }
463
- } else normalized.push(document.createTextNode(item.toString()));
462
+ } else {
463
+ const value = String(item);
464
+ if (prev && prev.nodeType === 3 && prev.data === value) {
465
+ normalized.push(prev);
466
+ } else normalized.push(document.createTextNode(value));
467
+ }
464
468
  }
465
469
  return dynamic;
466
470
  }
package/web/dist/dev.js CHANGED
@@ -405,7 +405,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
405
405
  return () => current;
406
406
  } else if (Array.isArray(value)) {
407
407
  const array = [];
408
- if (normalizeIncomingArray(array, value, unwrapArray)) {
408
+ const currentArray = current && Array.isArray(current);
409
+ if (normalizeIncomingArray(array, value, current, unwrapArray)) {
409
410
  createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
410
411
  return () => current;
411
412
  }
@@ -417,7 +418,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
417
418
  if (array.length === 0) {
418
419
  current = cleanChildren(parent, current, marker);
419
420
  if (multi) return current;
420
- } else if (Array.isArray(current)) {
421
+ } else if (currentArray) {
421
422
  if (current.length === 0) {
422
423
  appendNodes(parent, array, marker);
423
424
  } else reconcileArrays(parent, current, array);
@@ -438,26 +439,29 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
438
439
  } else console.warn(`Unrecognized value. Skipped inserting`, value);
439
440
  return current;
440
441
  }
441
- function normalizeIncomingArray(normalized, array, unwrap) {
442
+ function normalizeIncomingArray(normalized, array, current, unwrap) {
442
443
  let dynamic = false;
443
444
  for (let i = 0, len = array.length; i < len; i++) {
444
445
  let item = array[i],
445
- t;
446
+ prev = current && current[i];
446
447
  if (item instanceof Node) {
447
448
  normalized.push(item);
448
449
  } else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
449
- dynamic = normalizeIncomingArray(normalized, item) || dynamic;
450
- } else if ((t = typeof item) === "string") {
451
- normalized.push(document.createTextNode(item));
452
- } else if (t === "function") {
450
+ dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
451
+ } else if ((typeof item) === "function") {
453
452
  if (unwrap) {
454
453
  while (typeof item === "function") item = item();
455
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
454
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
456
455
  } else {
457
456
  normalized.push(item);
458
457
  dynamic = true;
459
458
  }
460
- } else normalized.push(document.createTextNode(item.toString()));
459
+ } else {
460
+ const value = String(item);
461
+ if (prev && prev.nodeType === 3 && prev.data === value) {
462
+ normalized.push(prev);
463
+ } else normalized.push(document.createTextNode(value));
464
+ }
461
465
  }
462
466
  return dynamic;
463
467
  }
@@ -273,20 +273,24 @@ function renderToStringAsync(code, options = {}) {
273
273
  p.then(d => scripts += serializeSet(dedupe, id, d) + ";").catch(() => scripts += `_$HY.set("${id}", {});`);
274
274
  }
275
275
  };
276
- const timeout = new Promise((_, reject) => setTimeout(() => reject("renderToString timed out"), timeoutMs));
276
+ let timeoutHandle;
277
+ const timeout = new Promise((_, reject) => {
278
+ timeoutHandle = setTimeout(() => reject("renderToString timed out"), timeoutMs);
279
+ });
277
280
  function asyncWrap(fn) {
278
281
  return new Promise(resolve => {
279
- const registry = new Set();
282
+ const registry = new Map();
280
283
  const cache = Object.create(null);
281
284
  solidJs.sharedConfig.context.registerFragment = register;
282
285
  const rendered = fn();
283
286
  if (!registry.size) resolve(rendered);
284
287
  function register(key) {
285
- registry.add(key);
288
+ if (!registry.has(key)) registry.set(key, []);
286
289
  return (value = "", error) => {
287
290
  if (!registry.has(key)) return;
288
291
  cache[key] = value;
289
292
  registry.delete(key);
293
+ if (waitForFragments(registry, key)) return;
290
294
  if (error) scripts += `_$HY.set("${key}", Promise.resolve(${serializeError(error)}));`;else scripts += `_$HY.set("${key}", null);`;
291
295
  if (!registry.size) Promise.resolve().then(() => {
292
296
  let source = resolveSSRNode(rendered);
@@ -304,6 +308,7 @@ function renderToStringAsync(code, options = {}) {
304
308
  });
305
309
  }
306
310
  return Promise.race([asyncWrap(() => escape(code())), timeout]).then(res => {
311
+ clearTimeout(timeoutHandle);
307
312
  let html = injectAssets(context.assets, resolveSSRNode(res));
308
313
  if (scripts.length) html = injectScripts(html, scripts, nonce);
309
314
  return html;
@@ -392,7 +397,7 @@ function renderToStream(code, options = {}) {
392
397
  pushTask(`${keys.length ? keys.map(k => `_$HY.unset("${k}");`) : ""}_$HY.set("${key}",${error ? serializeError(error) : "null"})`);
393
398
  } else {
394
399
  buffer.write(`<div hidden id="${key}">${value !== undefined ? value : " "}</div>`);
395
- pushTask(`${keys.length ? keys.map(k => `_$HY.unset("${k}")`).join(";") : ""}$df("${key}"${error ? "," + serializeError(error) : ""})${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
400
+ pushTask(`${keys.length ? keys.map(k => `_$HY.unset("${k}")`).join(";") + ";" : ""}$df("${key}"${error ? "," + serializeError(error) : ""})${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
396
401
  scriptFlushed = true;
397
402
  }
398
403
  }
@@ -270,20 +270,24 @@ function renderToStringAsync(code, options = {}) {
270
270
  p.then(d => scripts += serializeSet(dedupe, id, d) + ";").catch(() => scripts += `_$HY.set("${id}", {});`);
271
271
  }
272
272
  };
273
- const timeout = new Promise((_, reject) => setTimeout(() => reject("renderToString timed out"), timeoutMs));
273
+ let timeoutHandle;
274
+ const timeout = new Promise((_, reject) => {
275
+ timeoutHandle = setTimeout(() => reject("renderToString timed out"), timeoutMs);
276
+ });
274
277
  function asyncWrap(fn) {
275
278
  return new Promise(resolve => {
276
- const registry = new Set();
279
+ const registry = new Map();
277
280
  const cache = Object.create(null);
278
281
  sharedConfig.context.registerFragment = register;
279
282
  const rendered = fn();
280
283
  if (!registry.size) resolve(rendered);
281
284
  function register(key) {
282
- registry.add(key);
285
+ if (!registry.has(key)) registry.set(key, []);
283
286
  return (value = "", error) => {
284
287
  if (!registry.has(key)) return;
285
288
  cache[key] = value;
286
289
  registry.delete(key);
290
+ if (waitForFragments(registry, key)) return;
287
291
  if (error) scripts += `_$HY.set("${key}", Promise.resolve(${serializeError(error)}));`;else scripts += `_$HY.set("${key}", null);`;
288
292
  if (!registry.size) Promise.resolve().then(() => {
289
293
  let source = resolveSSRNode(rendered);
@@ -301,6 +305,7 @@ function renderToStringAsync(code, options = {}) {
301
305
  });
302
306
  }
303
307
  return Promise.race([asyncWrap(() => escape(code())), timeout]).then(res => {
308
+ clearTimeout(timeoutHandle);
304
309
  let html = injectAssets(context.assets, resolveSSRNode(res));
305
310
  if (scripts.length) html = injectScripts(html, scripts, nonce);
306
311
  return html;
@@ -389,7 +394,7 @@ function renderToStream(code, options = {}) {
389
394
  pushTask(`${keys.length ? keys.map(k => `_$HY.unset("${k}");`) : ""}_$HY.set("${key}",${error ? serializeError(error) : "null"})`);
390
395
  } else {
391
396
  buffer.write(`<div hidden id="${key}">${value !== undefined ? value : " "}</div>`);
392
- pushTask(`${keys.length ? keys.map(k => `_$HY.unset("${k}")`).join(";") : ""}$df("${key}"${error ? "," + serializeError(error) : ""})${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
397
+ pushTask(`${keys.length ? keys.map(k => `_$HY.unset("${k}")`).join(";") + ";" : ""}$df("${key}"${error ? "," + serializeError(error) : ""})${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
393
398
  scriptFlushed = true;
394
399
  }
395
400
  }
package/web/dist/web.cjs CHANGED
@@ -407,7 +407,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
407
407
  return () => current;
408
408
  } else if (Array.isArray(value)) {
409
409
  const array = [];
410
- if (normalizeIncomingArray(array, value, unwrapArray)) {
410
+ const currentArray = current && Array.isArray(current);
411
+ if (normalizeIncomingArray(array, value, current, unwrapArray)) {
411
412
  solidJs.createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
412
413
  return () => current;
413
414
  }
@@ -419,7 +420,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
419
420
  if (array.length === 0) {
420
421
  current = cleanChildren(parent, current, marker);
421
422
  if (multi) return current;
422
- } else if (Array.isArray(current)) {
423
+ } else if (currentArray) {
423
424
  if (current.length === 0) {
424
425
  appendNodes(parent, array, marker);
425
426
  } else reconcileArrays(parent, current, array);
@@ -440,26 +441,29 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
440
441
  } else ;
441
442
  return current;
442
443
  }
443
- function normalizeIncomingArray(normalized, array, unwrap) {
444
+ function normalizeIncomingArray(normalized, array, current, unwrap) {
444
445
  let dynamic = false;
445
446
  for (let i = 0, len = array.length; i < len; i++) {
446
447
  let item = array[i],
447
- t;
448
+ prev = current && current[i];
448
449
  if (item instanceof Node) {
449
450
  normalized.push(item);
450
451
  } else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
451
- dynamic = normalizeIncomingArray(normalized, item) || dynamic;
452
- } else if ((t = typeof item) === "string") {
453
- normalized.push(document.createTextNode(item));
454
- } else if (t === "function") {
452
+ dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
453
+ } else if ((typeof item) === "function") {
455
454
  if (unwrap) {
456
455
  while (typeof item === "function") item = item();
457
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
456
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
458
457
  } else {
459
458
  normalized.push(item);
460
459
  dynamic = true;
461
460
  }
462
- } else normalized.push(document.createTextNode(item.toString()));
461
+ } else {
462
+ const value = String(item);
463
+ if (prev && prev.nodeType === 3 && prev.data === value) {
464
+ normalized.push(prev);
465
+ } else normalized.push(document.createTextNode(value));
466
+ }
463
467
  }
464
468
  return dynamic;
465
469
  }
package/web/dist/web.js CHANGED
@@ -404,7 +404,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
404
404
  return () => current;
405
405
  } else if (Array.isArray(value)) {
406
406
  const array = [];
407
- if (normalizeIncomingArray(array, value, unwrapArray)) {
407
+ const currentArray = current && Array.isArray(current);
408
+ if (normalizeIncomingArray(array, value, current, unwrapArray)) {
408
409
  createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
409
410
  return () => current;
410
411
  }
@@ -416,7 +417,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
416
417
  if (array.length === 0) {
417
418
  current = cleanChildren(parent, current, marker);
418
419
  if (multi) return current;
419
- } else if (Array.isArray(current)) {
420
+ } else if (currentArray) {
420
421
  if (current.length === 0) {
421
422
  appendNodes(parent, array, marker);
422
423
  } else reconcileArrays(parent, current, array);
@@ -437,26 +438,29 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
437
438
  } else ;
438
439
  return current;
439
440
  }
440
- function normalizeIncomingArray(normalized, array, unwrap) {
441
+ function normalizeIncomingArray(normalized, array, current, unwrap) {
441
442
  let dynamic = false;
442
443
  for (let i = 0, len = array.length; i < len; i++) {
443
444
  let item = array[i],
444
- t;
445
+ prev = current && current[i];
445
446
  if (item instanceof Node) {
446
447
  normalized.push(item);
447
448
  } else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
448
- dynamic = normalizeIncomingArray(normalized, item) || dynamic;
449
- } else if ((t = typeof item) === "string") {
450
- normalized.push(document.createTextNode(item));
451
- } else if (t === "function") {
449
+ dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
450
+ } else if ((typeof item) === "function") {
452
451
  if (unwrap) {
453
452
  while (typeof item === "function") item = item();
454
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
453
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
455
454
  } else {
456
455
  normalized.push(item);
457
456
  dynamic = true;
458
457
  }
459
- } else normalized.push(document.createTextNode(item.toString()));
458
+ } else {
459
+ const value = String(item);
460
+ if (prev && prev.nodeType === 3 && prev.data === value) {
461
+ normalized.push(prev);
462
+ } else normalized.push(document.createTextNode(value));
463
+ }
460
464
  }
461
465
  return dynamic;
462
466
  }