solid-js 1.7.0-beta.3 → 1.7.0-beta.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
@@ -116,7 +116,10 @@ function workLoop(hasTimeRemaining, initialTime) {
116
116
  return currentTask !== null;
117
117
  }
118
118
 
119
- const sharedConfig = {};
119
+ const sharedConfig = {
120
+ context: undefined,
121
+ registry: undefined
122
+ };
120
123
  function setHydrateContext(context) {
121
124
  sharedConfig.context = context;
122
125
  }
@@ -606,8 +609,8 @@ function enableExternalSource(factory) {
606
609
  }
607
610
  function readSignal() {
608
611
  const runningTransition = Transition && Transition.running;
609
- if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
610
- if (!runningTransition && this.state === STALE || runningTransition && this.tState === STALE) updateComputation(this);else {
612
+ if (this.sources && (runningTransition ? this.tState : this.state)) {
613
+ if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
611
614
  const updates = Updates;
612
615
  Updates = null;
613
616
  runUpdates(() => lookUpstream(this), false);
@@ -651,11 +654,11 @@ function writeSignal(node, value, isComp) {
651
654
  const o = node.observers[i];
652
655
  const TransitionRunning = Transition && Transition.running;
653
656
  if (TransitionRunning && Transition.disposed.has(o)) continue;
654
- if (TransitionRunning && !o.tState || !TransitionRunning && !o.state) {
657
+ if (TransitionRunning ? !o.tState : !o.state) {
655
658
  if (o.pure) Updates.push(o);else Effects.push(o);
656
659
  if (o.observers) markDownstream(o);
657
660
  }
658
- if (TransitionRunning) o.tState = STALE;else o.state = STALE;
661
+ if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
659
662
  }
660
663
  if (Updates.length > 10e5) {
661
664
  Updates = [];
@@ -761,13 +764,13 @@ function createComputation(fn, init, pure, state = STALE, options) {
761
764
  }
762
765
  function runTop(node) {
763
766
  const runningTransition = Transition && Transition.running;
764
- if (!runningTransition && node.state === 0 || runningTransition && node.tState === 0) return;
765
- if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) return lookUpstream(node);
767
+ if ((runningTransition ? node.tState : node.state) === 0) return;
768
+ if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);
766
769
  if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
767
770
  const ancestors = [node];
768
771
  while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
769
772
  if (runningTransition && Transition.disposed.has(node)) return;
770
- if (!runningTransition && node.state || runningTransition && node.tState) ancestors.push(node);
773
+ if (runningTransition ? node.tState : node.state) ancestors.push(node);
771
774
  }
772
775
  for (let i = ancestors.length - 1; i >= 0; i--) {
773
776
  node = ancestors[i];
@@ -778,9 +781,9 @@ function runTop(node) {
778
781
  if (Transition.disposed.has(top)) return;
779
782
  }
780
783
  }
781
- if (!runningTransition && node.state === STALE || runningTransition && node.tState === STALE) {
784
+ if ((runningTransition ? node.tState : node.state) === STALE) {
782
785
  updateComputation(node);
783
- } else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
786
+ } else if ((runningTransition ? node.tState : node.state) === PENDING) {
784
787
  const updates = Updates;
785
788
  Updates = null;
786
789
  runUpdates(() => lookUpstream(node, ancestors[0]), false);
@@ -885,9 +888,10 @@ function lookUpstream(node, ignore) {
885
888
  for (let i = 0; i < node.sources.length; i += 1) {
886
889
  const source = node.sources[i];
887
890
  if (source.sources) {
888
- if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
891
+ const state = runningTransition ? source.tState : source.state;
892
+ if (state === STALE) {
889
893
  if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
890
- } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookUpstream(source, ignore);
894
+ } else if (state === PENDING) lookUpstream(source, ignore);
891
895
  }
892
896
  }
893
897
  }
@@ -895,7 +899,7 @@ function markDownstream(node) {
895
899
  const runningTransition = Transition && Transition.running;
896
900
  for (let i = 0; i < node.observers.length; i += 1) {
897
901
  const o = node.observers[i];
898
- if (!runningTransition && !o.state || runningTransition && !o.tState) {
902
+ if (runningTransition ? !o.tState : !o.state) {
899
903
  if (runningTransition) o.tState = PENDING;else o.state = PENDING;
900
904
  if (o.pure) Updates.push(o);else Effects.push(o);
901
905
  o.observers && markDownstream(o);
@@ -1396,6 +1400,7 @@ function createUniqueId() {
1396
1400
  return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1397
1401
  }
1398
1402
 
1403
+ const narrowedError = name => `Attempting to access a stale value from <${name}> that could possibly be undefined. This may occur because you are reading the accessor returned from the component at a time where it has already been unmounted. We recommend cleaning up any stale timers or async, or reading from the initial condition.` ;
1399
1404
  function For(props) {
1400
1405
  const fallback = "fallback" in props && {
1401
1406
  fallback: () => props.fallback
@@ -1424,7 +1429,7 @@ function Show(props) {
1424
1429
  const child = props.children;
1425
1430
  const fn = typeof child === "function" && child.length > 0;
1426
1431
  return fn ? untrack(() => child(keyed ? c : () => {
1427
- if (true && !untrack(condition)) console.warn("Accessing stale value from Show.");
1432
+ if (!untrack(condition)) throw narrowedError("Show");
1428
1433
  return props.when;
1429
1434
  })) : child;
1430
1435
  }
@@ -1458,7 +1463,7 @@ function Switch(props) {
1458
1463
  const c = cond.children;
1459
1464
  const fn = typeof c === "function" && c.length > 0;
1460
1465
  return fn ? untrack(() => c(keyed ? when : () => {
1461
- if (true && untrack(evalConditions)[0] !== index) console.warn("Accessing stale value from Match.");
1466
+ if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1462
1467
  return cond.when;
1463
1468
  })) : c;
1464
1469
  }, undefined, {
package/dist/dev.js CHANGED
@@ -114,7 +114,10 @@ function workLoop(hasTimeRemaining, initialTime) {
114
114
  return currentTask !== null;
115
115
  }
116
116
 
117
- const sharedConfig = {};
117
+ const sharedConfig = {
118
+ context: undefined,
119
+ registry: undefined
120
+ };
118
121
  function setHydrateContext(context) {
119
122
  sharedConfig.context = context;
120
123
  }
@@ -604,8 +607,8 @@ function enableExternalSource(factory) {
604
607
  }
605
608
  function readSignal() {
606
609
  const runningTransition = Transition && Transition.running;
607
- if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
608
- if (!runningTransition && this.state === STALE || runningTransition && this.tState === STALE) updateComputation(this);else {
610
+ if (this.sources && (runningTransition ? this.tState : this.state)) {
611
+ if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
609
612
  const updates = Updates;
610
613
  Updates = null;
611
614
  runUpdates(() => lookUpstream(this), false);
@@ -649,11 +652,11 @@ function writeSignal(node, value, isComp) {
649
652
  const o = node.observers[i];
650
653
  const TransitionRunning = Transition && Transition.running;
651
654
  if (TransitionRunning && Transition.disposed.has(o)) continue;
652
- if (TransitionRunning && !o.tState || !TransitionRunning && !o.state) {
655
+ if (TransitionRunning ? !o.tState : !o.state) {
653
656
  if (o.pure) Updates.push(o);else Effects.push(o);
654
657
  if (o.observers) markDownstream(o);
655
658
  }
656
- if (TransitionRunning) o.tState = STALE;else o.state = STALE;
659
+ if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
657
660
  }
658
661
  if (Updates.length > 10e5) {
659
662
  Updates = [];
@@ -759,13 +762,13 @@ function createComputation(fn, init, pure, state = STALE, options) {
759
762
  }
760
763
  function runTop(node) {
761
764
  const runningTransition = Transition && Transition.running;
762
- if (!runningTransition && node.state === 0 || runningTransition && node.tState === 0) return;
763
- if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) return lookUpstream(node);
765
+ if ((runningTransition ? node.tState : node.state) === 0) return;
766
+ if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);
764
767
  if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
765
768
  const ancestors = [node];
766
769
  while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
767
770
  if (runningTransition && Transition.disposed.has(node)) return;
768
- if (!runningTransition && node.state || runningTransition && node.tState) ancestors.push(node);
771
+ if (runningTransition ? node.tState : node.state) ancestors.push(node);
769
772
  }
770
773
  for (let i = ancestors.length - 1; i >= 0; i--) {
771
774
  node = ancestors[i];
@@ -776,9 +779,9 @@ function runTop(node) {
776
779
  if (Transition.disposed.has(top)) return;
777
780
  }
778
781
  }
779
- if (!runningTransition && node.state === STALE || runningTransition && node.tState === STALE) {
782
+ if ((runningTransition ? node.tState : node.state) === STALE) {
780
783
  updateComputation(node);
781
- } else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
784
+ } else if ((runningTransition ? node.tState : node.state) === PENDING) {
782
785
  const updates = Updates;
783
786
  Updates = null;
784
787
  runUpdates(() => lookUpstream(node, ancestors[0]), false);
@@ -883,9 +886,10 @@ function lookUpstream(node, ignore) {
883
886
  for (let i = 0; i < node.sources.length; i += 1) {
884
887
  const source = node.sources[i];
885
888
  if (source.sources) {
886
- if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
889
+ const state = runningTransition ? source.tState : source.state;
890
+ if (state === STALE) {
887
891
  if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
888
- } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookUpstream(source, ignore);
892
+ } else if (state === PENDING) lookUpstream(source, ignore);
889
893
  }
890
894
  }
891
895
  }
@@ -893,7 +897,7 @@ function markDownstream(node) {
893
897
  const runningTransition = Transition && Transition.running;
894
898
  for (let i = 0; i < node.observers.length; i += 1) {
895
899
  const o = node.observers[i];
896
- if (!runningTransition && !o.state || runningTransition && !o.tState) {
900
+ if (runningTransition ? !o.tState : !o.state) {
897
901
  if (runningTransition) o.tState = PENDING;else o.state = PENDING;
898
902
  if (o.pure) Updates.push(o);else Effects.push(o);
899
903
  o.observers && markDownstream(o);
@@ -1394,6 +1398,7 @@ function createUniqueId() {
1394
1398
  return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1395
1399
  }
1396
1400
 
1401
+ const narrowedError = name => `Attempting to access a stale value from <${name}> that could possibly be undefined. This may occur because you are reading the accessor returned from the component at a time where it has already been unmounted. We recommend cleaning up any stale timers or async, or reading from the initial condition.` ;
1397
1402
  function For(props) {
1398
1403
  const fallback = "fallback" in props && {
1399
1404
  fallback: () => props.fallback
@@ -1422,7 +1427,7 @@ function Show(props) {
1422
1427
  const child = props.children;
1423
1428
  const fn = typeof child === "function" && child.length > 0;
1424
1429
  return fn ? untrack(() => child(keyed ? c : () => {
1425
- if (true && !untrack(condition)) console.warn("Accessing stale value from Show.");
1430
+ if (!untrack(condition)) throw narrowedError("Show");
1426
1431
  return props.when;
1427
1432
  })) : child;
1428
1433
  }
@@ -1456,7 +1461,7 @@ function Switch(props) {
1456
1461
  const c = cond.children;
1457
1462
  const fn = typeof c === "function" && c.length > 0;
1458
1463
  return fn ? untrack(() => c(keyed ? when : () => {
1459
- if (true && untrack(evalConditions)[0] !== index) console.warn("Accessing stale value from Match.");
1464
+ if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1460
1465
  return cond.when;
1461
1466
  })) : c;
1462
1467
  }, undefined, {
package/dist/server.cjs CHANGED
@@ -601,9 +601,9 @@ function Suspense(props) {
601
601
  });
602
602
  function suspenseError(err) {
603
603
  if (!done || !done(undefined, err)) {
604
- if (o) runWithOwner(o.owner, () => {
604
+ runWithOwner(o.owner, () => {
605
605
  throw err;
606
- });else throw err;
606
+ });
607
607
  }
608
608
  }
609
609
  function runSuspense() {
@@ -611,7 +611,7 @@ function Suspense(props) {
611
611
  ...ctx,
612
612
  count: 0
613
613
  });
614
- o && cleanNode(o);
614
+ cleanNode(o);
615
615
  return runWithOwner(o, () => createComponent(SuspenseContext.Provider, {
616
616
  value,
617
617
  get children() {
package/dist/server.js CHANGED
@@ -599,9 +599,9 @@ function Suspense(props) {
599
599
  });
600
600
  function suspenseError(err) {
601
601
  if (!done || !done(undefined, err)) {
602
- if (o) runWithOwner(o.owner, () => {
602
+ runWithOwner(o.owner, () => {
603
603
  throw err;
604
- });else throw err;
604
+ });
605
605
  }
606
606
  }
607
607
  function runSuspense() {
@@ -609,7 +609,7 @@ function Suspense(props) {
609
609
  ...ctx,
610
610
  count: 0
611
611
  });
612
- o && cleanNode(o);
612
+ cleanNode(o);
613
613
  return runWithOwner(o, () => createComponent(SuspenseContext.Provider, {
614
614
  value,
615
615
  get children() {
package/dist/solid.cjs CHANGED
@@ -116,7 +116,10 @@ function workLoop(hasTimeRemaining, initialTime) {
116
116
  return currentTask !== null;
117
117
  }
118
118
 
119
- const sharedConfig = {};
119
+ const sharedConfig = {
120
+ context: undefined,
121
+ registry: undefined
122
+ };
120
123
  function setHydrateContext(context) {
121
124
  sharedConfig.context = context;
122
125
  }
@@ -568,8 +571,8 @@ function enableExternalSource(factory) {
568
571
  }
569
572
  function readSignal() {
570
573
  const runningTransition = Transition && Transition.running;
571
- if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
572
- if (!runningTransition && this.state === STALE || runningTransition && this.tState === STALE) updateComputation(this);else {
574
+ if (this.sources && (runningTransition ? this.tState : this.state)) {
575
+ if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
573
576
  const updates = Updates;
574
577
  Updates = null;
575
578
  runUpdates(() => lookUpstream(this), false);
@@ -613,11 +616,11 @@ function writeSignal(node, value, isComp) {
613
616
  const o = node.observers[i];
614
617
  const TransitionRunning = Transition && Transition.running;
615
618
  if (TransitionRunning && Transition.disposed.has(o)) continue;
616
- if (TransitionRunning && !o.tState || !TransitionRunning && !o.state) {
619
+ if (TransitionRunning ? !o.tState : !o.state) {
617
620
  if (o.pure) Updates.push(o);else Effects.push(o);
618
621
  if (o.observers) markDownstream(o);
619
622
  }
620
- if (TransitionRunning) o.tState = STALE;else o.state = STALE;
623
+ if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
621
624
  }
622
625
  if (Updates.length > 10e5) {
623
626
  Updates = [];
@@ -721,13 +724,13 @@ function createComputation(fn, init, pure, state = STALE, options) {
721
724
  }
722
725
  function runTop(node) {
723
726
  const runningTransition = Transition && Transition.running;
724
- if (!runningTransition && node.state === 0 || runningTransition && node.tState === 0) return;
725
- if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) return lookUpstream(node);
727
+ if ((runningTransition ? node.tState : node.state) === 0) return;
728
+ if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);
726
729
  if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
727
730
  const ancestors = [node];
728
731
  while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
729
732
  if (runningTransition && Transition.disposed.has(node)) return;
730
- if (!runningTransition && node.state || runningTransition && node.tState) ancestors.push(node);
733
+ if (runningTransition ? node.tState : node.state) ancestors.push(node);
731
734
  }
732
735
  for (let i = ancestors.length - 1; i >= 0; i--) {
733
736
  node = ancestors[i];
@@ -738,9 +741,9 @@ function runTop(node) {
738
741
  if (Transition.disposed.has(top)) return;
739
742
  }
740
743
  }
741
- if (!runningTransition && node.state === STALE || runningTransition && node.tState === STALE) {
744
+ if ((runningTransition ? node.tState : node.state) === STALE) {
742
745
  updateComputation(node);
743
- } else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
746
+ } else if ((runningTransition ? node.tState : node.state) === PENDING) {
744
747
  const updates = Updates;
745
748
  Updates = null;
746
749
  runUpdates(() => lookUpstream(node, ancestors[0]), false);
@@ -845,9 +848,10 @@ function lookUpstream(node, ignore) {
845
848
  for (let i = 0; i < node.sources.length; i += 1) {
846
849
  const source = node.sources[i];
847
850
  if (source.sources) {
848
- if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
851
+ const state = runningTransition ? source.tState : source.state;
852
+ if (state === STALE) {
849
853
  if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
850
- } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookUpstream(source, ignore);
854
+ } else if (state === PENDING) lookUpstream(source, ignore);
851
855
  }
852
856
  }
853
857
  }
@@ -855,7 +859,7 @@ function markDownstream(node) {
855
859
  const runningTransition = Transition && Transition.running;
856
860
  for (let i = 0; i < node.observers.length; i += 1) {
857
861
  const o = node.observers[i];
858
- if (!runningTransition && !o.state || runningTransition && !o.tState) {
862
+ if (runningTransition ? !o.tState : !o.state) {
859
863
  if (runningTransition) o.tState = PENDING;else o.state = PENDING;
860
864
  if (o.pure) Updates.push(o);else Effects.push(o);
861
865
  o.observers && markDownstream(o);
@@ -1349,6 +1353,7 @@ function createUniqueId() {
1349
1353
  return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1350
1354
  }
1351
1355
 
1356
+ const narrowedError = name => `Stale read from <${name}>.`;
1352
1357
  function For(props) {
1353
1358
  const fallback = "fallback" in props && {
1354
1359
  fallback: () => props.fallback
@@ -1372,7 +1377,7 @@ function Show(props) {
1372
1377
  const child = props.children;
1373
1378
  const fn = typeof child === "function" && child.length > 0;
1374
1379
  return fn ? untrack(() => child(keyed ? c : () => {
1375
- if (false && !untrack(condition)) ;
1380
+ if (!untrack(condition)) throw narrowedError("Show");
1376
1381
  return props.when;
1377
1382
  })) : child;
1378
1383
  }
@@ -1403,7 +1408,7 @@ function Switch(props) {
1403
1408
  const c = cond.children;
1404
1409
  const fn = typeof c === "function" && c.length > 0;
1405
1410
  return fn ? untrack(() => c(keyed ? when : () => {
1406
- if (false && untrack(evalConditions)[0] !== index) ;
1411
+ if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1407
1412
  return cond.when;
1408
1413
  })) : c;
1409
1414
  }, undefined, undefined);
package/dist/solid.js CHANGED
@@ -114,7 +114,10 @@ function workLoop(hasTimeRemaining, initialTime) {
114
114
  return currentTask !== null;
115
115
  }
116
116
 
117
- const sharedConfig = {};
117
+ const sharedConfig = {
118
+ context: undefined,
119
+ registry: undefined
120
+ };
118
121
  function setHydrateContext(context) {
119
122
  sharedConfig.context = context;
120
123
  }
@@ -566,8 +569,8 @@ function enableExternalSource(factory) {
566
569
  }
567
570
  function readSignal() {
568
571
  const runningTransition = Transition && Transition.running;
569
- if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
570
- if (!runningTransition && this.state === STALE || runningTransition && this.tState === STALE) updateComputation(this);else {
572
+ if (this.sources && (runningTransition ? this.tState : this.state)) {
573
+ if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
571
574
  const updates = Updates;
572
575
  Updates = null;
573
576
  runUpdates(() => lookUpstream(this), false);
@@ -611,11 +614,11 @@ function writeSignal(node, value, isComp) {
611
614
  const o = node.observers[i];
612
615
  const TransitionRunning = Transition && Transition.running;
613
616
  if (TransitionRunning && Transition.disposed.has(o)) continue;
614
- if (TransitionRunning && !o.tState || !TransitionRunning && !o.state) {
617
+ if (TransitionRunning ? !o.tState : !o.state) {
615
618
  if (o.pure) Updates.push(o);else Effects.push(o);
616
619
  if (o.observers) markDownstream(o);
617
620
  }
618
- if (TransitionRunning) o.tState = STALE;else o.state = STALE;
621
+ if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
619
622
  }
620
623
  if (Updates.length > 10e5) {
621
624
  Updates = [];
@@ -719,13 +722,13 @@ function createComputation(fn, init, pure, state = STALE, options) {
719
722
  }
720
723
  function runTop(node) {
721
724
  const runningTransition = Transition && Transition.running;
722
- if (!runningTransition && node.state === 0 || runningTransition && node.tState === 0) return;
723
- if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) return lookUpstream(node);
725
+ if ((runningTransition ? node.tState : node.state) === 0) return;
726
+ if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);
724
727
  if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
725
728
  const ancestors = [node];
726
729
  while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
727
730
  if (runningTransition && Transition.disposed.has(node)) return;
728
- if (!runningTransition && node.state || runningTransition && node.tState) ancestors.push(node);
731
+ if (runningTransition ? node.tState : node.state) ancestors.push(node);
729
732
  }
730
733
  for (let i = ancestors.length - 1; i >= 0; i--) {
731
734
  node = ancestors[i];
@@ -736,9 +739,9 @@ function runTop(node) {
736
739
  if (Transition.disposed.has(top)) return;
737
740
  }
738
741
  }
739
- if (!runningTransition && node.state === STALE || runningTransition && node.tState === STALE) {
742
+ if ((runningTransition ? node.tState : node.state) === STALE) {
740
743
  updateComputation(node);
741
- } else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
744
+ } else if ((runningTransition ? node.tState : node.state) === PENDING) {
742
745
  const updates = Updates;
743
746
  Updates = null;
744
747
  runUpdates(() => lookUpstream(node, ancestors[0]), false);
@@ -843,9 +846,10 @@ function lookUpstream(node, ignore) {
843
846
  for (let i = 0; i < node.sources.length; i += 1) {
844
847
  const source = node.sources[i];
845
848
  if (source.sources) {
846
- if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
849
+ const state = runningTransition ? source.tState : source.state;
850
+ if (state === STALE) {
847
851
  if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
848
- } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookUpstream(source, ignore);
852
+ } else if (state === PENDING) lookUpstream(source, ignore);
849
853
  }
850
854
  }
851
855
  }
@@ -853,7 +857,7 @@ function markDownstream(node) {
853
857
  const runningTransition = Transition && Transition.running;
854
858
  for (let i = 0; i < node.observers.length; i += 1) {
855
859
  const o = node.observers[i];
856
- if (!runningTransition && !o.state || runningTransition && !o.tState) {
860
+ if (runningTransition ? !o.tState : !o.state) {
857
861
  if (runningTransition) o.tState = PENDING;else o.state = PENDING;
858
862
  if (o.pure) Updates.push(o);else Effects.push(o);
859
863
  o.observers && markDownstream(o);
@@ -1347,6 +1351,7 @@ function createUniqueId() {
1347
1351
  return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1348
1352
  }
1349
1353
 
1354
+ const narrowedError = name => `Stale read from <${name}>.`;
1350
1355
  function For(props) {
1351
1356
  const fallback = "fallback" in props && {
1352
1357
  fallback: () => props.fallback
@@ -1370,7 +1375,7 @@ function Show(props) {
1370
1375
  const child = props.children;
1371
1376
  const fn = typeof child === "function" && child.length > 0;
1372
1377
  return fn ? untrack(() => child(keyed ? c : () => {
1373
- if (false && !untrack(condition)) ;
1378
+ if (!untrack(condition)) throw narrowedError("Show");
1374
1379
  return props.when;
1375
1380
  })) : child;
1376
1381
  }
@@ -1401,7 +1406,7 @@ function Switch(props) {
1401
1406
  const c = cond.children;
1402
1407
  const fn = typeof c === "function" && c.length > 0;
1403
1408
  return fn ? untrack(() => c(keyed ? when : () => {
1404
- if (false && untrack(evalConditions)[0] !== index) ;
1409
+ if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1405
1410
  return cond.when;
1406
1411
  })) : c;
1407
1412
  }, undefined, undefined);
@@ -763,6 +763,7 @@ export namespace JSX {
763
763
  src?: FunctionMaybe<string>;
764
764
  srcdoc?: FunctionMaybe<string>;
765
765
  width?: FunctionMaybe<number | string>;
766
+ loading?: FunctionMaybe<"eager" | "lazy">;
766
767
  referrerPolicy?: FunctionMaybe<HTMLReferrerPolicy>;
767
768
  }
768
769
  interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
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.7.0-beta.3",
4
+ "version": "1.7.0-beta.5",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -279,8 +279,8 @@
279
279
  "types:universal": "tsc --project ./universal/tsconfig.json && ncp ../../node_modules/dom-expressions/src/universal.d.ts ./universal/types/universal.d.ts",
280
280
  "bench": "node --allow-natives-syntax bench/bench.cjs",
281
281
  "link": "symlink-dir . node_modules/solid-js",
282
- "test": "jest",
283
- "coverage": "jest --coverage",
282
+ "test": "vitest run",
283
+ "coverage": "vitest run --coverage",
284
284
  "test-types": "tsc --project tsconfig.test.json"
285
285
  }
286
286
  }
package/types/jsx.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as csstype from 'csstype';
1
+ import * as csstype from "csstype";
2
2
 
3
3
  /**
4
4
  * Based on JSX types for Surplus and Inferno and adapted for `dom-expressions`.
@@ -9,14 +9,7 @@ import * as csstype from 'csstype';
9
9
  type DOMElement = Element;
10
10
 
11
11
  export namespace JSX {
12
- type Element =
13
- | Node
14
- | ArrayElement
15
- | (string & {})
16
- | number
17
- | boolean
18
- | null
19
- | undefined;
12
+ type Element = Node | ArrayElement | (string & {}) | number | boolean | null | undefined;
20
13
  interface ArrayElement extends Array<Element> {}
21
14
  interface ElementClass {
22
15
  // empty, libs can define requirements downstream
@@ -46,6 +39,85 @@ export namespace JSX {
46
39
  1: any;
47
40
  }
48
41
  type EventHandlerUnion<T, E extends Event> = EventHandler<T, E> | BoundEventHandler<T, E>;
42
+
43
+ interface InputEventHandler<T, E extends InputEvent> {
44
+ (
45
+ e: E & {
46
+ currentTarget: T;
47
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
48
+ ? T
49
+ : DOMElement;
50
+ }
51
+ ): void;
52
+ }
53
+ interface BoundInputEventHandler<T, E extends InputEvent> {
54
+ 0: (
55
+ data: any,
56
+ e: E & {
57
+ currentTarget: T;
58
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
59
+ ? T
60
+ : DOMElement;
61
+ }
62
+ ) => void;
63
+ 1: any;
64
+ }
65
+ type InputEventHandlerUnion<T, E extends InputEvent> =
66
+ | InputEventHandler<T, E>
67
+ | BoundInputEventHandler<T, E>;
68
+
69
+ interface ChangeEventHandler<T, E extends Event> {
70
+ (
71
+ e: E & {
72
+ currentTarget: T;
73
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
74
+ ? T
75
+ : DOMElement;
76
+ }
77
+ ): void;
78
+ }
79
+ interface BoundChangeEventHandler<T, E extends Event> {
80
+ 0: (
81
+ data: any,
82
+ e: E & {
83
+ currentTarget: T;
84
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
85
+ ? T
86
+ : DOMElement;
87
+ }
88
+ ) => void;
89
+ 1: any;
90
+ }
91
+ type ChangeEventHandlerUnion<T, E extends Event> =
92
+ | ChangeEventHandler<T, E>
93
+ | BoundChangeEventHandler<T, E>;
94
+
95
+ interface FocusEventHandler<T, E extends FocusEvent> {
96
+ (
97
+ e: E & {
98
+ currentTarget: T;
99
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
100
+ ? T
101
+ : DOMElement;
102
+ }
103
+ ): void;
104
+ }
105
+ interface BoundFocusEventHandler<T, E extends FocusEvent> {
106
+ 0: (
107
+ data: any,
108
+ e: E & {
109
+ currentTarget: T;
110
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
111
+ ? T
112
+ : DOMElement;
113
+ }
114
+ ) => void;
115
+ 1: any;
116
+ }
117
+ type FocusEventHandlerUnion<T, E extends FocusEvent> =
118
+ | FocusEventHandler<T, E>
119
+ | BoundFocusEventHandler<T, E>;
120
+
49
121
  interface IntrinsicAttributes {
50
122
  ref?: unknown | ((e: unknown) => void);
51
123
  }
@@ -56,7 +128,7 @@ export namespace JSX {
56
128
  };
57
129
  $ServerOnly?: boolean;
58
130
  }
59
- type Accessor<T> = () => T
131
+ type Accessor<T> = () => T;
60
132
  interface Directives {}
61
133
  interface DirectiveFunctions {
62
134
  [x: string]: (el: Element, accessor: Accessor<any>) => void;
@@ -69,7 +141,9 @@ export namespace JSX {
69
141
  [Key in keyof Directives as `use:${Key}`]?: Directives[Key];
70
142
  };
71
143
  type DirectiveFunctionAttributes<T> = {
72
- [K in keyof DirectiveFunctions as string extends K ? never : `use:${K}`]?: DirectiveFunctions[K] extends (
144
+ [K in keyof DirectiveFunctions as string extends K
145
+ ? never
146
+ : `use:${K}`]?: DirectiveFunctions[K] extends (
73
147
  el: infer E, // will be unknown if not provided
74
148
  ...rest: infer R // use rest so that we can check whether it's provided or not
75
149
  ) => void
@@ -90,13 +164,23 @@ export namespace JSX {
90
164
  };
91
165
  type OnAttributes<T> = {
92
166
  [Key in keyof CustomEvents as `on:${Key}`]?: EventHandler<T, CustomEvents[Key]>;
93
- }
167
+ };
94
168
  type OnCaptureAttributes<T> = {
95
- [Key in keyof CustomCaptureEvents as `oncapture:${Key}`]?: EventHandler<T, CustomCaptureEvents[Key]>;
96
- }
97
- interface DOMAttributes<T> extends CustomAttributes<T>, DirectiveAttributes, DirectiveFunctionAttributes<T>,
98
- PropAttributes, AttrAttributes, OnAttributes<T>, OnCaptureAttributes<T>,
99
- CustomEventHandlersCamelCase<T>, CustomEventHandlersLowerCase<T> {
169
+ [Key in keyof CustomCaptureEvents as `oncapture:${Key}`]?: EventHandler<
170
+ T,
171
+ CustomCaptureEvents[Key]
172
+ >;
173
+ };
174
+ interface DOMAttributes<T>
175
+ extends CustomAttributes<T>,
176
+ DirectiveAttributes,
177
+ DirectiveFunctionAttributes<T>,
178
+ PropAttributes,
179
+ AttrAttributes,
180
+ OnAttributes<T>,
181
+ OnCaptureAttributes<T>,
182
+ CustomEventHandlersCamelCase<T>,
183
+ CustomEventHandlersLowerCase<T> {
100
184
  children?: Element;
101
185
  innerHTML?: string;
102
186
  innerText?: string | number;
@@ -108,8 +192,8 @@ export namespace JSX {
108
192
  onCompositionEnd?: EventHandlerUnion<T, CompositionEvent>;
109
193
  onCompositionStart?: EventHandlerUnion<T, CompositionEvent>;
110
194
  onCompositionUpdate?: EventHandlerUnion<T, CompositionEvent>;
111
- onFocusOut?: EventHandlerUnion<T, FocusEvent>;
112
- onFocusIn?: EventHandlerUnion<T, FocusEvent>;
195
+ onFocusOut?: FocusEventHandlerUnion<T, FocusEvent>;
196
+ onFocusIn?: FocusEventHandlerUnion<T, FocusEvent>;
113
197
  onEncrypted?: EventHandlerUnion<T, Event>;
114
198
  onDragExit?: EventHandlerUnion<T, DragEvent>;
115
199
  // lower case events
@@ -119,8 +203,8 @@ export namespace JSX {
119
203
  oncompositionend?: EventHandlerUnion<T, CompositionEvent>;
120
204
  oncompositionstart?: EventHandlerUnion<T, CompositionEvent>;
121
205
  oncompositionupdate?: EventHandlerUnion<T, CompositionEvent>;
122
- onfocusout?: EventHandlerUnion<T, FocusEvent>;
123
- onfocusin?: EventHandlerUnion<T, FocusEvent>;
206
+ onfocusout?: FocusEventHandlerUnion<T, FocusEvent>;
207
+ onfocusin?: FocusEventHandlerUnion<T, FocusEvent>;
124
208
  onencrypted?: EventHandlerUnion<T, Event>;
125
209
  ondragexit?: EventHandlerUnion<T, DragEvent>;
126
210
  }
@@ -130,11 +214,11 @@ export namespace JSX {
130
214
  onAnimationIteration?: EventHandlerUnion<T, AnimationEvent>;
131
215
  onAnimationStart?: EventHandlerUnion<T, AnimationEvent>;
132
216
  onAuxClick?: EventHandlerUnion<T, MouseEvent>;
133
- onBeforeInput?: EventHandlerUnion<T, InputEvent>;
134
- onBlur?: EventHandlerUnion<T, FocusEvent>;
217
+ onBeforeInput?: InputEventHandlerUnion<T, InputEvent>;
218
+ onBlur?: FocusEventHandlerUnion<T, FocusEvent>;
135
219
  onCanPlay?: EventHandlerUnion<T, Event>;
136
220
  onCanPlayThrough?: EventHandlerUnion<T, Event>;
137
- onChange?: EventHandlerUnion<T, Event>;
221
+ onChange?: ChangeEventHandlerUnion<T, Event>;
138
222
  onClick?: EventHandlerUnion<T, MouseEvent>;
139
223
  onContextMenu?: EventHandlerUnion<T, MouseEvent>;
140
224
  onDblClick?: EventHandlerUnion<T, MouseEvent>;
@@ -149,9 +233,9 @@ export namespace JSX {
149
233
  onEmptied?: EventHandlerUnion<T, Event>;
150
234
  onEnded?: EventHandlerUnion<T, Event>;
151
235
  onError?: EventHandlerUnion<T, Event>;
152
- onFocus?: EventHandlerUnion<T, FocusEvent>;
236
+ onFocus?: FocusEventHandlerUnion<T, FocusEvent>;
153
237
  onGotPointerCapture?: EventHandlerUnion<T, PointerEvent>;
154
- onInput?: EventHandlerUnion<T, InputEvent>;
238
+ onInput?: InputEventHandlerUnion<T, InputEvent>;
155
239
  onInvalid?: EventHandlerUnion<T, Event>;
156
240
  onKeyDown?: EventHandlerUnion<T, KeyboardEvent>;
157
241
  onKeyPress?: EventHandlerUnion<T, KeyboardEvent>;
@@ -213,11 +297,11 @@ export namespace JSX {
213
297
  onanimationiteration?: EventHandlerUnion<T, AnimationEvent>;
214
298
  onanimationstart?: EventHandlerUnion<T, AnimationEvent>;
215
299
  onauxclick?: EventHandlerUnion<T, MouseEvent>;
216
- onbeforeinput?: EventHandlerUnion<T, InputEvent>;
217
- onblur?: EventHandlerUnion<T, FocusEvent>;
300
+ onbeforeinput?: InputEventHandlerUnion<T, InputEvent>;
301
+ onblur?: FocusEventHandlerUnion<T, FocusEvent>;
218
302
  oncanplay?: EventHandlerUnion<T, Event>;
219
303
  oncanplaythrough?: EventHandlerUnion<T, Event>;
220
- onchange?: EventHandlerUnion<T, Event>;
304
+ onchange?: ChangeEventHandlerUnion<T, Event>;
221
305
  onclick?: EventHandlerUnion<T, MouseEvent>;
222
306
  oncontextmenu?: EventHandlerUnion<T, MouseEvent>;
223
307
  ondblclick?: EventHandlerUnion<T, MouseEvent>;
@@ -232,9 +316,9 @@ export namespace JSX {
232
316
  onemptied?: EventHandlerUnion<T, Event>;
233
317
  onended?: EventHandlerUnion<T, Event>;
234
318
  onerror?: EventHandlerUnion<T, Event>;
235
- onfocus?: EventHandlerUnion<T, FocusEvent>;
319
+ onfocus?: FocusEventHandlerUnion<T, FocusEvent>;
236
320
  ongotpointercapture?: EventHandlerUnion<T, PointerEvent>;
237
- oninput?: EventHandlerUnion<T, InputEvent>;
321
+ oninput?: InputEventHandlerUnion<T, InputEvent>;
238
322
  oninvalid?: EventHandlerUnion<T, Event>;
239
323
  onkeydown?: EventHandlerUnion<T, KeyboardEvent>;
240
324
  onkeypress?: EventHandlerUnion<T, KeyboardEvent>;
@@ -290,7 +374,7 @@ export namespace JSX {
290
374
 
291
375
  interface CSSProperties extends csstype.PropertiesHyphen {
292
376
  // Override
293
- [key: `-${string}`]: string | number | undefined
377
+ [key: `-${string}`]: string | number | undefined;
294
378
  }
295
379
 
296
380
  type HTMLAutocapitalize = "off" | "none" | "on" | "sentences" | "words" | "characters";
@@ -769,6 +853,7 @@ export namespace JSX {
769
853
  src?: string;
770
854
  srcdoc?: string;
771
855
  width?: number | string;
856
+ loading?: "eager" | "lazy";
772
857
  referrerPolicy?: HTMLReferrerPolicy;
773
858
  }
774
859
  interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -794,12 +879,13 @@ export namespace JSX {
794
879
  accept?: string;
795
880
  alt?: string;
796
881
  autocomplete?: string;
882
+ autocorrect?: "on" | "off";
797
883
  autofocus?: boolean;
798
884
  capture?: boolean | string;
799
885
  checked?: boolean;
800
886
  crossorigin?: HTMLCrossorigin;
801
887
  disabled?: boolean;
802
- enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
888
+ enterkeyhint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send";
803
889
  form?: string;
804
890
  formaction?: string;
805
891
  formenctype?: HTMLFormEncType;
@@ -807,6 +893,7 @@ export namespace JSX {
807
893
  formnovalidate?: boolean;
808
894
  formtarget?: string;
809
895
  height?: number | string;
896
+ incremental?: boolean;
810
897
  list?: string;
811
898
  max?: number | string;
812
899
  maxlength?: number | string;
@@ -817,6 +904,7 @@ export namespace JSX {
817
904
  pattern?: string;
818
905
  placeholder?: string;
819
906
  readonly?: boolean;
907
+ results?: number;
820
908
  required?: boolean;
821
909
  size?: number | string;
822
910
  src?: string;
@@ -1023,7 +1111,7 @@ export namespace JSX {
1023
1111
  rowspan?: number | string;
1024
1112
  colSpan?: number | string;
1025
1113
  rowSpan?: number | string;
1026
- scope?: 'col' | 'row' | 'rowgroup' | 'colgroup';
1114
+ scope?: "col" | "row" | "rowgroup" | "colgroup";
1027
1115
  }
1028
1116
  interface TimeHTMLAttributes<T> extends HTMLAttributes<T> {
1029
1117
  datetime?: string;
@@ -1299,7 +1387,7 @@ export namespace JSX {
1299
1387
  gradientUnits?: SVGUnits;
1300
1388
  gradientTransform?: string;
1301
1389
  spreadMethod?: "pad" | "reflect" | "repeat";
1302
- href?: string
1390
+ href?: string;
1303
1391
  }
1304
1392
  interface GraphicsElementSVGAttributes<T>
1305
1393
  extends CoreSVGAttributes<T>,
@@ -23,6 +23,7 @@ export interface Renderer<NodeType> {
23
23
  spread<T>(node: any, accessor: (() => T) | T, skipChildren?: Boolean): void;
24
24
  setProp<T>(node: NodeType, name: string, value: T, prev?: T): T;
25
25
  mergeProps(...sources: unknown[]): unknown;
26
+ use<A, T>(fn: (element: NodeType, arg: A) => T, element: NodeType, arg: A): T;
26
27
  }
27
28
 
28
29
  export function createRenderer<NodeType>(options: RendererOptions<NodeType>): Renderer<NodeType>;
package/web/dist/dev.cjs CHANGED
@@ -126,7 +126,9 @@ function template(html, isCE, isSVG) {
126
126
  t.innerHTML = html;
127
127
  return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
128
128
  };
129
- return isCE ? () => (node || (node = create())).cloneNode(true) : () => solidJs.untrack(() => document.importNode(node || (node = create()), true));
129
+ const fn = isCE ? () => (node || (node = create())).cloneNode(true) : () => solidJs.untrack(() => document.importNode(node || (node = create()), true));
130
+ fn.cloneNode = fn;
131
+ return fn;
130
132
  }
131
133
  function delegateEvents(eventNames, document = window.document) {
132
134
  const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
package/web/dist/dev.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createRoot, untrack, createRenderEffect, sharedConfig, enableHydration, createMemo, createSignal, onMount, onCleanup, splitProps, $DEVCOMP } from 'solid-js';
1
+ import { createRoot, createRenderEffect, sharedConfig, untrack, enableHydration, createMemo, createSignal, onMount, onCleanup, splitProps, $DEVCOMP } from 'solid-js';
2
2
  export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, createMemo as memo, mergeProps, untrack } from 'solid-js';
3
3
 
4
4
  const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
@@ -125,7 +125,9 @@ function template(html, isCE, isSVG) {
125
125
  t.innerHTML = html;
126
126
  return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
127
127
  };
128
- return isCE ? () => (node || (node = create())).cloneNode(true) : () => untrack(() => document.importNode(node || (node = create()), true));
128
+ const fn = isCE ? () => (node || (node = create())).cloneNode(true) : () => untrack(() => document.importNode(node || (node = create()), true));
129
+ fn.cloneNode = fn;
130
+ return fn;
129
131
  }
130
132
  function delegateEvents(eventNames, document = window.document) {
131
133
  const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
package/web/dist/web.cjs CHANGED
@@ -126,7 +126,9 @@ function template(html, isCE, isSVG) {
126
126
  t.innerHTML = html;
127
127
  return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
128
128
  };
129
- return isCE ? () => (node || (node = create())).cloneNode(true) : () => solidJs.untrack(() => document.importNode(node || (node = create()), true));
129
+ const fn = isCE ? () => (node || (node = create())).cloneNode(true) : () => solidJs.untrack(() => document.importNode(node || (node = create()), true));
130
+ fn.cloneNode = fn;
131
+ return fn;
130
132
  }
131
133
  function delegateEvents(eventNames, document = window.document) {
132
134
  const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
package/web/dist/web.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createRoot, untrack, createRenderEffect, sharedConfig, enableHydration, createMemo, createSignal, onMount, onCleanup, splitProps, $DEVCOMP } from 'solid-js';
1
+ import { createRoot, createRenderEffect, sharedConfig, untrack, enableHydration, createMemo, createSignal, onMount, onCleanup, splitProps, $DEVCOMP } from 'solid-js';
2
2
  export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, createMemo as memo, mergeProps, untrack } from 'solid-js';
3
3
 
4
4
  const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
@@ -125,7 +125,9 @@ function template(html, isCE, isSVG) {
125
125
  t.innerHTML = html;
126
126
  return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
127
127
  };
128
- return isCE ? () => (node || (node = create())).cloneNode(true) : () => untrack(() => document.importNode(node || (node = create()), true));
128
+ const fn = isCE ? () => (node || (node = create())).cloneNode(true) : () => untrack(() => document.importNode(node || (node = create()), true));
129
+ fn.cloneNode = fn;
130
+ return fn;
129
131
  }
130
132
  function delegateEvents(eventNames, document = window.document) {
131
133
  const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());