solid-js 1.4.4 → 1.4.5

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 {
@@ -828,14 +831,16 @@ function completeUpdates(wait) {
828
831
  return;
829
832
  }
830
833
  const sources = Transition.sources;
834
+ const disposed = Transition.disposed;
831
835
  res = Transition.resolve;
832
- Effects.forEach(e => {
836
+ for (const e of Effects) {
833
837
  "tState" in e && (e.state = e.tState);
834
838
  delete e.tState;
835
- });
839
+ }
836
840
  Transition = null;
837
841
  batch(() => {
838
- sources.forEach(v => {
842
+ for (const d of disposed) cleanNode(d);
843
+ for (const v of sources) {
839
844
  v.value = v.tValue;
840
845
  if (v.owned) {
841
846
  for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
@@ -844,7 +849,7 @@ function completeUpdates(wait) {
844
849
  delete v.tValue;
845
850
  delete v.tOwned;
846
851
  v.tState = 0;
847
- });
852
+ }
848
853
  setTransPending(false);
849
854
  });
850
855
  }
@@ -964,7 +969,7 @@ function reset(node, top) {
964
969
  function handleError(err) {
965
970
  const fns = ERROR && lookup(Owner, ERROR);
966
971
  if (!fns) throw err;
967
- fns.forEach(f => f(err));
972
+ for (const f of fns) f(err);
968
973
  }
969
974
  function lookup(owner, key) {
970
975
  return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
@@ -1447,27 +1452,24 @@ function ErrorBoundary(props) {
1447
1452
 
1448
1453
  const SuspenseListContext = createContext();
1449
1454
  function SuspenseList(props) {
1450
- let index = 0,
1451
- suspenseSetter,
1452
- showContent,
1453
- showFallback;
1455
+ let suspenseSetter, showContent, showFallback;
1454
1456
  const listContext = useContext(SuspenseListContext);
1455
1457
  if (listContext) {
1456
1458
  const [inFallback, setFallback] = createSignal(false);
1457
1459
  suspenseSetter = setFallback;
1458
1460
  [showContent, showFallback] = listContext.register(inFallback);
1459
1461
  }
1460
- const registry = [],
1462
+ const [registry, setRegistry] = createSignal([]),
1461
1463
  comp = createComponent(SuspenseListContext.Provider, {
1462
1464
  value: {
1463
1465
  register: inFallback => {
1464
1466
  const [showingContent, showContent] = createSignal(false),
1465
1467
  [showingFallback, showFallback] = createSignal(false);
1466
- registry[index++] = {
1468
+ setRegistry(registry => [...registry, {
1467
1469
  inFallback,
1468
1470
  showContent,
1469
1471
  showFallback
1470
- };
1472
+ }]);
1471
1473
  return [showingContent, showingFallback];
1472
1474
  }
1473
1475
  },
@@ -1480,31 +1482,32 @@ function SuspenseList(props) {
1480
1482
  tail = props.tail,
1481
1483
  visibleContent = showContent ? showContent() : true,
1482
1484
  visibleFallback = showFallback ? showFallback() : true,
1485
+ reg = registry(),
1483
1486
  reverse = reveal === "backwards";
1484
1487
  if (reveal === "together") {
1485
- const all = registry.every(i => !i.inFallback());
1488
+ const all = reg.every(i => !i.inFallback());
1486
1489
  suspenseSetter && suspenseSetter(!all);
1487
- registry.forEach(i => {
1490
+ reg.forEach(i => {
1488
1491
  i.showContent(all && visibleContent);
1489
1492
  i.showFallback(visibleFallback);
1490
1493
  });
1491
1494
  return;
1492
1495
  }
1493
1496
  let stop = false;
1494
- for (let i = 0, len = registry.length; i < len; i++) {
1497
+ for (let i = 0, len = reg.length; i < len; i++) {
1495
1498
  const n = reverse ? len - i - 1 : i,
1496
- s = registry[n].inFallback();
1499
+ s = reg[n].inFallback();
1497
1500
  if (!stop && !s) {
1498
- registry[n].showContent(visibleContent);
1499
- registry[n].showFallback(visibleFallback);
1501
+ reg[n].showContent(visibleContent);
1502
+ reg[n].showFallback(visibleFallback);
1500
1503
  } else {
1501
1504
  const next = !stop;
1502
1505
  if (next && suspenseSetter) suspenseSetter(true);
1503
1506
  if (!tail || next && tail === "collapsed") {
1504
- registry[n].showFallback(visibleFallback);
1505
- } else registry[n].showFallback(false);
1507
+ reg[n].showFallback(visibleFallback);
1508
+ } else reg[n].showFallback(false);
1506
1509
  stop = true;
1507
- registry[n].showContent(next);
1510
+ reg[n].showContent(next);
1508
1511
  }
1509
1512
  }
1510
1513
  if (!stop && suspenseSetter) suspenseSetter(false);
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 {
@@ -824,14 +827,16 @@ function completeUpdates(wait) {
824
827
  return;
825
828
  }
826
829
  const sources = Transition.sources;
830
+ const disposed = Transition.disposed;
827
831
  res = Transition.resolve;
828
- Effects.forEach(e => {
832
+ for (const e of Effects) {
829
833
  "tState" in e && (e.state = e.tState);
830
834
  delete e.tState;
831
- });
835
+ }
832
836
  Transition = null;
833
837
  batch(() => {
834
- sources.forEach(v => {
838
+ for (const d of disposed) cleanNode(d);
839
+ for (const v of sources) {
835
840
  v.value = v.tValue;
836
841
  if (v.owned) {
837
842
  for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
@@ -840,7 +845,7 @@ function completeUpdates(wait) {
840
845
  delete v.tValue;
841
846
  delete v.tOwned;
842
847
  v.tState = 0;
843
- });
848
+ }
844
849
  setTransPending(false);
845
850
  });
846
851
  }
@@ -960,7 +965,7 @@ function reset(node, top) {
960
965
  function handleError(err) {
961
966
  const fns = ERROR && lookup(Owner, ERROR);
962
967
  if (!fns) throw err;
963
- fns.forEach(f => f(err));
968
+ for (const f of fns) f(err);
964
969
  }
965
970
  function lookup(owner, key) {
966
971
  return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
@@ -1443,27 +1448,24 @@ function ErrorBoundary(props) {
1443
1448
 
1444
1449
  const SuspenseListContext = createContext();
1445
1450
  function SuspenseList(props) {
1446
- let index = 0,
1447
- suspenseSetter,
1448
- showContent,
1449
- showFallback;
1451
+ let suspenseSetter, showContent, showFallback;
1450
1452
  const listContext = useContext(SuspenseListContext);
1451
1453
  if (listContext) {
1452
1454
  const [inFallback, setFallback] = createSignal(false);
1453
1455
  suspenseSetter = setFallback;
1454
1456
  [showContent, showFallback] = listContext.register(inFallback);
1455
1457
  }
1456
- const registry = [],
1458
+ const [registry, setRegistry] = createSignal([]),
1457
1459
  comp = createComponent(SuspenseListContext.Provider, {
1458
1460
  value: {
1459
1461
  register: inFallback => {
1460
1462
  const [showingContent, showContent] = createSignal(false),
1461
1463
  [showingFallback, showFallback] = createSignal(false);
1462
- registry[index++] = {
1464
+ setRegistry(registry => [...registry, {
1463
1465
  inFallback,
1464
1466
  showContent,
1465
1467
  showFallback
1466
- };
1468
+ }]);
1467
1469
  return [showingContent, showingFallback];
1468
1470
  }
1469
1471
  },
@@ -1476,31 +1478,32 @@ function SuspenseList(props) {
1476
1478
  tail = props.tail,
1477
1479
  visibleContent = showContent ? showContent() : true,
1478
1480
  visibleFallback = showFallback ? showFallback() : true,
1481
+ reg = registry(),
1479
1482
  reverse = reveal === "backwards";
1480
1483
  if (reveal === "together") {
1481
- const all = registry.every(i => !i.inFallback());
1484
+ const all = reg.every(i => !i.inFallback());
1482
1485
  suspenseSetter && suspenseSetter(!all);
1483
- registry.forEach(i => {
1486
+ reg.forEach(i => {
1484
1487
  i.showContent(all && visibleContent);
1485
1488
  i.showFallback(visibleFallback);
1486
1489
  });
1487
1490
  return;
1488
1491
  }
1489
1492
  let stop = false;
1490
- for (let i = 0, len = registry.length; i < len; i++) {
1493
+ for (let i = 0, len = reg.length; i < len; i++) {
1491
1494
  const n = reverse ? len - i - 1 : i,
1492
- s = registry[n].inFallback();
1495
+ s = reg[n].inFallback();
1493
1496
  if (!stop && !s) {
1494
- registry[n].showContent(visibleContent);
1495
- registry[n].showFallback(visibleFallback);
1497
+ reg[n].showContent(visibleContent);
1498
+ reg[n].showFallback(visibleFallback);
1496
1499
  } else {
1497
1500
  const next = !stop;
1498
1501
  if (next && suspenseSetter) suspenseSetter(true);
1499
1502
  if (!tail || next && tail === "collapsed") {
1500
- registry[n].showFallback(visibleFallback);
1501
- } else registry[n].showFallback(false);
1503
+ reg[n].showFallback(visibleFallback);
1504
+ } else reg[n].showFallback(false);
1502
1505
  stop = true;
1503
- registry[n].showContent(next);
1506
+ reg[n].showContent(next);
1504
1507
  }
1505
1508
  }
1506
1509
  if (!stop && suspenseSetter) suspenseSetter(false);
package/dist/solid.cjs CHANGED
@@ -769,14 +769,16 @@ function completeUpdates(wait) {
769
769
  return;
770
770
  }
771
771
  const sources = Transition.sources;
772
+ const disposed = Transition.disposed;
772
773
  res = Transition.resolve;
773
- Effects.forEach(e => {
774
+ for (const e of Effects) {
774
775
  "tState" in e && (e.state = e.tState);
775
776
  delete e.tState;
776
- });
777
+ }
777
778
  Transition = null;
778
779
  batch(() => {
779
- sources.forEach(v => {
780
+ for (const d of disposed) cleanNode(d);
781
+ for (const v of sources) {
780
782
  v.value = v.tValue;
781
783
  if (v.owned) {
782
784
  for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
@@ -785,7 +787,7 @@ function completeUpdates(wait) {
785
787
  delete v.tValue;
786
788
  delete v.tOwned;
787
789
  v.tState = 0;
788
- });
790
+ }
789
791
  setTransPending(false);
790
792
  });
791
793
  }
@@ -903,7 +905,7 @@ function reset(node, top) {
903
905
  function handleError(err) {
904
906
  const fns = ERROR && lookup(Owner, ERROR);
905
907
  if (!fns) throw err;
906
- fns.forEach(f => f(err));
908
+ for (const f of fns) f(err);
907
909
  }
908
910
  function lookup(owner, key) {
909
911
  return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
@@ -1359,27 +1361,24 @@ function ErrorBoundary(props) {
1359
1361
 
1360
1362
  const SuspenseListContext = createContext();
1361
1363
  function SuspenseList(props) {
1362
- let index = 0,
1363
- suspenseSetter,
1364
- showContent,
1365
- showFallback;
1364
+ let suspenseSetter, showContent, showFallback;
1366
1365
  const listContext = useContext(SuspenseListContext);
1367
1366
  if (listContext) {
1368
1367
  const [inFallback, setFallback] = createSignal(false);
1369
1368
  suspenseSetter = setFallback;
1370
1369
  [showContent, showFallback] = listContext.register(inFallback);
1371
1370
  }
1372
- const registry = [],
1371
+ const [registry, setRegistry] = createSignal([]),
1373
1372
  comp = createComponent(SuspenseListContext.Provider, {
1374
1373
  value: {
1375
1374
  register: inFallback => {
1376
1375
  const [showingContent, showContent] = createSignal(false),
1377
1376
  [showingFallback, showFallback] = createSignal(false);
1378
- registry[index++] = {
1377
+ setRegistry(registry => [...registry, {
1379
1378
  inFallback,
1380
1379
  showContent,
1381
1380
  showFallback
1382
- };
1381
+ }]);
1383
1382
  return [showingContent, showingFallback];
1384
1383
  }
1385
1384
  },
@@ -1392,31 +1391,32 @@ function SuspenseList(props) {
1392
1391
  tail = props.tail,
1393
1392
  visibleContent = showContent ? showContent() : true,
1394
1393
  visibleFallback = showFallback ? showFallback() : true,
1394
+ reg = registry(),
1395
1395
  reverse = reveal === "backwards";
1396
1396
  if (reveal === "together") {
1397
- const all = registry.every(i => !i.inFallback());
1397
+ const all = reg.every(i => !i.inFallback());
1398
1398
  suspenseSetter && suspenseSetter(!all);
1399
- registry.forEach(i => {
1399
+ reg.forEach(i => {
1400
1400
  i.showContent(all && visibleContent);
1401
1401
  i.showFallback(visibleFallback);
1402
1402
  });
1403
1403
  return;
1404
1404
  }
1405
1405
  let stop = false;
1406
- for (let i = 0, len = registry.length; i < len; i++) {
1406
+ for (let i = 0, len = reg.length; i < len; i++) {
1407
1407
  const n = reverse ? len - i - 1 : i,
1408
- s = registry[n].inFallback();
1408
+ s = reg[n].inFallback();
1409
1409
  if (!stop && !s) {
1410
- registry[n].showContent(visibleContent);
1411
- registry[n].showFallback(visibleFallback);
1410
+ reg[n].showContent(visibleContent);
1411
+ reg[n].showFallback(visibleFallback);
1412
1412
  } else {
1413
1413
  const next = !stop;
1414
1414
  if (next && suspenseSetter) suspenseSetter(true);
1415
1415
  if (!tail || next && tail === "collapsed") {
1416
- registry[n].showFallback(visibleFallback);
1417
- } else registry[n].showFallback(false);
1416
+ reg[n].showFallback(visibleFallback);
1417
+ } else reg[n].showFallback(false);
1418
1418
  stop = true;
1419
- registry[n].showContent(next);
1419
+ reg[n].showContent(next);
1420
1420
  }
1421
1421
  }
1422
1422
  if (!stop && suspenseSetter) suspenseSetter(false);
package/dist/solid.js CHANGED
@@ -765,14 +765,16 @@ function completeUpdates(wait) {
765
765
  return;
766
766
  }
767
767
  const sources = Transition.sources;
768
+ const disposed = Transition.disposed;
768
769
  res = Transition.resolve;
769
- Effects.forEach(e => {
770
+ for (const e of Effects) {
770
771
  "tState" in e && (e.state = e.tState);
771
772
  delete e.tState;
772
- });
773
+ }
773
774
  Transition = null;
774
775
  batch(() => {
775
- sources.forEach(v => {
776
+ for (const d of disposed) cleanNode(d);
777
+ for (const v of sources) {
776
778
  v.value = v.tValue;
777
779
  if (v.owned) {
778
780
  for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
@@ -781,7 +783,7 @@ function completeUpdates(wait) {
781
783
  delete v.tValue;
782
784
  delete v.tOwned;
783
785
  v.tState = 0;
784
- });
786
+ }
785
787
  setTransPending(false);
786
788
  });
787
789
  }
@@ -899,7 +901,7 @@ function reset(node, top) {
899
901
  function handleError(err) {
900
902
  const fns = ERROR && lookup(Owner, ERROR);
901
903
  if (!fns) throw err;
902
- fns.forEach(f => f(err));
904
+ for (const f of fns) f(err);
903
905
  }
904
906
  function lookup(owner, key) {
905
907
  return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
@@ -1355,27 +1357,24 @@ function ErrorBoundary(props) {
1355
1357
 
1356
1358
  const SuspenseListContext = createContext();
1357
1359
  function SuspenseList(props) {
1358
- let index = 0,
1359
- suspenseSetter,
1360
- showContent,
1361
- showFallback;
1360
+ let suspenseSetter, showContent, showFallback;
1362
1361
  const listContext = useContext(SuspenseListContext);
1363
1362
  if (listContext) {
1364
1363
  const [inFallback, setFallback] = createSignal(false);
1365
1364
  suspenseSetter = setFallback;
1366
1365
  [showContent, showFallback] = listContext.register(inFallback);
1367
1366
  }
1368
- const registry = [],
1367
+ const [registry, setRegistry] = createSignal([]),
1369
1368
  comp = createComponent(SuspenseListContext.Provider, {
1370
1369
  value: {
1371
1370
  register: inFallback => {
1372
1371
  const [showingContent, showContent] = createSignal(false),
1373
1372
  [showingFallback, showFallback] = createSignal(false);
1374
- registry[index++] = {
1373
+ setRegistry(registry => [...registry, {
1375
1374
  inFallback,
1376
1375
  showContent,
1377
1376
  showFallback
1378
- };
1377
+ }]);
1379
1378
  return [showingContent, showingFallback];
1380
1379
  }
1381
1380
  },
@@ -1388,31 +1387,32 @@ function SuspenseList(props) {
1388
1387
  tail = props.tail,
1389
1388
  visibleContent = showContent ? showContent() : true,
1390
1389
  visibleFallback = showFallback ? showFallback() : true,
1390
+ reg = registry(),
1391
1391
  reverse = reveal === "backwards";
1392
1392
  if (reveal === "together") {
1393
- const all = registry.every(i => !i.inFallback());
1393
+ const all = reg.every(i => !i.inFallback());
1394
1394
  suspenseSetter && suspenseSetter(!all);
1395
- registry.forEach(i => {
1395
+ reg.forEach(i => {
1396
1396
  i.showContent(all && visibleContent);
1397
1397
  i.showFallback(visibleFallback);
1398
1398
  });
1399
1399
  return;
1400
1400
  }
1401
1401
  let stop = false;
1402
- for (let i = 0, len = registry.length; i < len; i++) {
1402
+ for (let i = 0, len = reg.length; i < len; i++) {
1403
1403
  const n = reverse ? len - i - 1 : i,
1404
- s = registry[n].inFallback();
1404
+ s = reg[n].inFallback();
1405
1405
  if (!stop && !s) {
1406
- registry[n].showContent(visibleContent);
1407
- registry[n].showFallback(visibleFallback);
1406
+ reg[n].showContent(visibleContent);
1407
+ reg[n].showFallback(visibleFallback);
1408
1408
  } else {
1409
1409
  const next = !stop;
1410
1410
  if (next && suspenseSetter) suspenseSetter(true);
1411
1411
  if (!tail || next && tail === "collapsed") {
1412
- registry[n].showFallback(visibleFallback);
1413
- } else registry[n].showFallback(false);
1412
+ reg[n].showFallback(visibleFallback);
1413
+ } else reg[n].showFallback(false);
1414
1414
  stop = true;
1415
- registry[n].showContent(next);
1415
+ reg[n].showContent(next);
1416
1416
  }
1417
1417
  }
1418
1418
  if (!stop && suspenseSetter) suspenseSetter(false);
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.5",
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": "2c2252d6e4bd0d59f9164da32d6b6afc65dd4220"
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.`);
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.`);
@@ -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);
@@ -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);
@@ -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 {};
@@ -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,30 @@ 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],
449
+ prev = current && current[i],
448
450
  t;
449
451
  if (item instanceof Node) {
450
452
  normalized.push(item);
451
453
  } 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") {
454
+ dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
455
+ } else if ((t = typeof item) === "function") {
456
456
  if (unwrap) {
457
457
  while (typeof item === "function") item = item();
458
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
458
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
459
459
  } else {
460
460
  normalized.push(item);
461
461
  dynamic = true;
462
462
  }
463
- } else normalized.push(document.createTextNode(item.toString()));
463
+ } else {
464
+ const value = t === "string" ? item : item.string();
465
+ if (prev && prev.nodeType === 3 && prev.data === value) {
466
+ normalized.push(prev);
467
+ } else normalized.push(document.createTextNode(value));
468
+ }
464
469
  }
465
470
  return dynamic;
466
471
  }
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,30 @@ 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],
446
+ prev = current && current[i],
445
447
  t;
446
448
  if (item instanceof Node) {
447
449
  normalized.push(item);
448
450
  } 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") {
451
+ dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
452
+ } else if ((t = typeof item) === "function") {
453
453
  if (unwrap) {
454
454
  while (typeof item === "function") item = item();
455
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
455
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
456
456
  } else {
457
457
  normalized.push(item);
458
458
  dynamic = true;
459
459
  }
460
- } else normalized.push(document.createTextNode(item.toString()));
460
+ } else {
461
+ const value = t === "string" ? item : item.string();
462
+ if (prev && prev.nodeType === 3 && prev.data === value) {
463
+ normalized.push(prev);
464
+ } else normalized.push(document.createTextNode(value));
465
+ }
461
466
  }
462
467
  return dynamic;
463
468
  }
@@ -273,7 +273,10 @@ 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
282
  const registry = new Set();
@@ -304,6 +307,7 @@ function renderToStringAsync(code, options = {}) {
304
307
  });
305
308
  }
306
309
  return Promise.race([asyncWrap(() => escape(code())), timeout]).then(res => {
310
+ clearTimeout(timeoutHandle);
307
311
  let html = injectAssets(context.assets, resolveSSRNode(res));
308
312
  if (scripts.length) html = injectScripts(html, scripts, nonce);
309
313
  return html;
@@ -270,7 +270,10 @@ 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
279
  const registry = new Set();
@@ -301,6 +304,7 @@ function renderToStringAsync(code, options = {}) {
301
304
  });
302
305
  }
303
306
  return Promise.race([asyncWrap(() => escape(code())), timeout]).then(res => {
307
+ clearTimeout(timeoutHandle);
304
308
  let html = injectAssets(context.assets, resolveSSRNode(res));
305
309
  if (scripts.length) html = injectScripts(html, scripts, nonce);
306
310
  return html;
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,30 @@ 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],
448
+ prev = current && current[i],
447
449
  t;
448
450
  if (item instanceof Node) {
449
451
  normalized.push(item);
450
452
  } 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") {
453
+ dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
454
+ } else if ((t = typeof item) === "function") {
455
455
  if (unwrap) {
456
456
  while (typeof item === "function") item = item();
457
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
457
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
458
458
  } else {
459
459
  normalized.push(item);
460
460
  dynamic = true;
461
461
  }
462
- } else normalized.push(document.createTextNode(item.toString()));
462
+ } else {
463
+ const value = t === "string" ? item : item.string();
464
+ if (prev && prev.nodeType === 3 && prev.data === value) {
465
+ normalized.push(prev);
466
+ } else normalized.push(document.createTextNode(value));
467
+ }
463
468
  }
464
469
  return dynamic;
465
470
  }
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,30 @@ 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],
445
+ prev = current && current[i],
444
446
  t;
445
447
  if (item instanceof Node) {
446
448
  normalized.push(item);
447
449
  } 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") {
450
+ dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
451
+ } else if ((t = typeof item) === "function") {
452
452
  if (unwrap) {
453
453
  while (typeof item === "function") item = item();
454
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
454
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
455
455
  } else {
456
456
  normalized.push(item);
457
457
  dynamic = true;
458
458
  }
459
- } else normalized.push(document.createTextNode(item.toString()));
459
+ } else {
460
+ const value = t === "string" ? item : item.string();
461
+ if (prev && prev.nodeType === 3 && prev.data === value) {
462
+ normalized.push(prev);
463
+ } else normalized.push(document.createTextNode(value));
464
+ }
460
465
  }
461
466
  return dynamic;
462
467
  }