solid-js 1.3.12 → 1.3.15

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
@@ -448,8 +448,8 @@ options) {
448
448
  return prevValue => {
449
449
  let input;
450
450
  if (isArray) {
451
- input = [];
452
- for (let i = 0; i < deps.length; i++) input.push(deps[i]());
451
+ input = Array(deps.length);
452
+ for (let i = 0; i < deps.length; i++) input[i] = deps[i]();
453
453
  } else input = deps();
454
454
  if (defer) {
455
455
  defer = false;
@@ -621,7 +621,7 @@ function readSignal() {
621
621
  if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
622
622
  const updates = Updates;
623
623
  Updates = null;
624
- !runningTransition && this.state === STALE || runningTransition && this.tState === STALE ? updateComputation(this) : lookDownstream(this);
624
+ !runningTransition && this.state === STALE || runningTransition && this.tState === STALE ? updateComputation(this) : lookUpstream(this);
625
625
  Updates = updates;
626
626
  }
627
627
  if (Listener) {
@@ -645,16 +645,16 @@ function readSignal() {
645
645
  return this.value;
646
646
  }
647
647
  function writeSignal(node, value, isComp) {
648
- if (node.comparator) {
649
- if (Transition && Transition.running && Transition.sources.has(node)) {
650
- if (node.comparator(node.tValue, value)) return value;
651
- } else if (node.comparator(node.value, value)) return value;
652
- }
653
648
  if (Pending) {
654
649
  if (node.pending === NOTPENDING) Pending.push(node);
655
650
  node.pending = value;
656
651
  return value;
657
652
  }
653
+ if (node.comparator) {
654
+ if (Transition && Transition.running && Transition.sources.has(node)) {
655
+ if (node.comparator(node.tValue, value)) return value;
656
+ } else if (node.comparator(node.value, value)) return value;
657
+ }
658
658
  let TransitionRunning = false;
659
659
  if (Transition) {
660
660
  TransitionRunning = Transition.running;
@@ -671,7 +671,7 @@ function writeSignal(node, value, isComp) {
671
671
  if (TransitionRunning && Transition.disposed.has(o)) continue;
672
672
  if (TransitionRunning && !o.tState || !TransitionRunning && !o.state) {
673
673
  if (o.pure) Updates.push(o);else Effects.push(o);
674
- if (o.observers) markUpstream(o);
674
+ if (o.observers) markDownstream(o);
675
675
  }
676
676
  if (TransitionRunning) o.tState = STALE;else o.state = STALE;
677
677
  }
@@ -764,7 +764,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
764
764
  function runTop(node) {
765
765
  const runningTransition = Transition && Transition.running;
766
766
  if (!runningTransition && node.state === 0 || runningTransition && node.tState === 0) return;
767
- if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) return lookDownstream(node);
767
+ if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) return lookUpstream(node);
768
768
  if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
769
769
  const ancestors = [node];
770
770
  while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
@@ -785,7 +785,7 @@ function runTop(node) {
785
785
  } else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
786
786
  const updates = Updates;
787
787
  Updates = null;
788
- lookDownstream(node, ancestors[0]);
788
+ lookUpstream(node, ancestors[0]);
789
789
  Updates = updates;
790
790
  }
791
791
  }
@@ -880,11 +880,12 @@ function runUserEffects(queue) {
880
880
  const e = queue[i];
881
881
  if (!e.user) runTop(e);else queue[userLength++] = e;
882
882
  }
883
+ if (sharedConfig.context) setHydrateContext();
883
884
  const resume = queue.length;
884
885
  for (i = 0; i < userLength; i++) runTop(queue[i]);
885
886
  for (i = resume; i < queue.length; i++) runTop(queue[i]);
886
887
  }
887
- function lookDownstream(node, ignore) {
888
+ function lookUpstream(node, ignore) {
888
889
  const runningTransition = Transition && Transition.running;
889
890
  if (runningTransition) node.tState = 0;else node.state = 0;
890
891
  for (let i = 0; i < node.sources.length; i += 1) {
@@ -892,18 +893,18 @@ function lookDownstream(node, ignore) {
892
893
  if (source.sources) {
893
894
  if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
894
895
  if (source !== ignore) runTop(source);
895
- } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookDownstream(source, ignore);
896
+ } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookUpstream(source, ignore);
896
897
  }
897
898
  }
898
899
  }
899
- function markUpstream(node) {
900
+ function markDownstream(node) {
900
901
  const runningTransition = Transition && Transition.running;
901
902
  for (let i = 0; i < node.observers.length; i += 1) {
902
903
  const o = node.observers[i];
903
904
  if (!runningTransition && !o.state || runningTransition && !o.tState) {
904
905
  if (runningTransition) o.tState = PENDING;else o.state = PENDING;
905
906
  if (o.pure) Updates.push(o);else Effects.push(o);
906
- o.observers && markUpstream(o);
907
+ o.observers && markDownstream(o);
907
908
  }
908
909
  }
909
910
  }
@@ -1426,6 +1427,7 @@ function ErrorBoundary(props) {
1426
1427
  return createMemo(() => {
1427
1428
  if ((e = errored()) != null) {
1428
1429
  const f = props.fallback;
1430
+ if ((typeof f !== "function" || f.length == 0)) console.error(e);
1429
1431
  return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored(null))) : f;
1430
1432
  }
1431
1433
  onError(setErrored);
@@ -1531,7 +1533,7 @@ function Suspense(props) {
1531
1533
  });
1532
1534
  flicker = s;
1533
1535
  p.then(err => {
1534
- if (error = err) return set();
1536
+ if ((error = err) || sharedConfig.done) return set();
1535
1537
  sharedConfig.gather(key);
1536
1538
  setHydrateContext(ctx);
1537
1539
  set();
package/dist/dev.js CHANGED
@@ -444,8 +444,8 @@ options) {
444
444
  return prevValue => {
445
445
  let input;
446
446
  if (isArray) {
447
- input = [];
448
- for (let i = 0; i < deps.length; i++) input.push(deps[i]());
447
+ input = Array(deps.length);
448
+ for (let i = 0; i < deps.length; i++) input[i] = deps[i]();
449
449
  } else input = deps();
450
450
  if (defer) {
451
451
  defer = false;
@@ -617,7 +617,7 @@ function readSignal() {
617
617
  if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
618
618
  const updates = Updates;
619
619
  Updates = null;
620
- !runningTransition && this.state === STALE || runningTransition && this.tState === STALE ? updateComputation(this) : lookDownstream(this);
620
+ !runningTransition && this.state === STALE || runningTransition && this.tState === STALE ? updateComputation(this) : lookUpstream(this);
621
621
  Updates = updates;
622
622
  }
623
623
  if (Listener) {
@@ -641,16 +641,16 @@ function readSignal() {
641
641
  return this.value;
642
642
  }
643
643
  function writeSignal(node, value, isComp) {
644
- if (node.comparator) {
645
- if (Transition && Transition.running && Transition.sources.has(node)) {
646
- if (node.comparator(node.tValue, value)) return value;
647
- } else if (node.comparator(node.value, value)) return value;
648
- }
649
644
  if (Pending) {
650
645
  if (node.pending === NOTPENDING) Pending.push(node);
651
646
  node.pending = value;
652
647
  return value;
653
648
  }
649
+ if (node.comparator) {
650
+ if (Transition && Transition.running && Transition.sources.has(node)) {
651
+ if (node.comparator(node.tValue, value)) return value;
652
+ } else if (node.comparator(node.value, value)) return value;
653
+ }
654
654
  let TransitionRunning = false;
655
655
  if (Transition) {
656
656
  TransitionRunning = Transition.running;
@@ -667,7 +667,7 @@ function writeSignal(node, value, isComp) {
667
667
  if (TransitionRunning && Transition.disposed.has(o)) continue;
668
668
  if (TransitionRunning && !o.tState || !TransitionRunning && !o.state) {
669
669
  if (o.pure) Updates.push(o);else Effects.push(o);
670
- if (o.observers) markUpstream(o);
670
+ if (o.observers) markDownstream(o);
671
671
  }
672
672
  if (TransitionRunning) o.tState = STALE;else o.state = STALE;
673
673
  }
@@ -760,7 +760,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
760
760
  function runTop(node) {
761
761
  const runningTransition = Transition && Transition.running;
762
762
  if (!runningTransition && node.state === 0 || runningTransition && node.tState === 0) return;
763
- if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) return lookDownstream(node);
763
+ if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) return lookUpstream(node);
764
764
  if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
765
765
  const ancestors = [node];
766
766
  while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
@@ -781,7 +781,7 @@ function runTop(node) {
781
781
  } else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
782
782
  const updates = Updates;
783
783
  Updates = null;
784
- lookDownstream(node, ancestors[0]);
784
+ lookUpstream(node, ancestors[0]);
785
785
  Updates = updates;
786
786
  }
787
787
  }
@@ -876,11 +876,12 @@ function runUserEffects(queue) {
876
876
  const e = queue[i];
877
877
  if (!e.user) runTop(e);else queue[userLength++] = e;
878
878
  }
879
+ if (sharedConfig.context) setHydrateContext();
879
880
  const resume = queue.length;
880
881
  for (i = 0; i < userLength; i++) runTop(queue[i]);
881
882
  for (i = resume; i < queue.length; i++) runTop(queue[i]);
882
883
  }
883
- function lookDownstream(node, ignore) {
884
+ function lookUpstream(node, ignore) {
884
885
  const runningTransition = Transition && Transition.running;
885
886
  if (runningTransition) node.tState = 0;else node.state = 0;
886
887
  for (let i = 0; i < node.sources.length; i += 1) {
@@ -888,18 +889,18 @@ function lookDownstream(node, ignore) {
888
889
  if (source.sources) {
889
890
  if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
890
891
  if (source !== ignore) runTop(source);
891
- } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookDownstream(source, ignore);
892
+ } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookUpstream(source, ignore);
892
893
  }
893
894
  }
894
895
  }
895
- function markUpstream(node) {
896
+ function markDownstream(node) {
896
897
  const runningTransition = Transition && Transition.running;
897
898
  for (let i = 0; i < node.observers.length; i += 1) {
898
899
  const o = node.observers[i];
899
900
  if (!runningTransition && !o.state || runningTransition && !o.tState) {
900
901
  if (runningTransition) o.tState = PENDING;else o.state = PENDING;
901
902
  if (o.pure) Updates.push(o);else Effects.push(o);
902
- o.observers && markUpstream(o);
903
+ o.observers && markDownstream(o);
903
904
  }
904
905
  }
905
906
  }
@@ -1422,6 +1423,7 @@ function ErrorBoundary(props) {
1422
1423
  return createMemo(() => {
1423
1424
  if ((e = errored()) != null) {
1424
1425
  const f = props.fallback;
1426
+ if ((typeof f !== "function" || f.length == 0)) console.error(e);
1425
1427
  return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored(null))) : f;
1426
1428
  }
1427
1429
  onError(setErrored);
@@ -1527,7 +1529,7 @@ function Suspense(props) {
1527
1529
  });
1528
1530
  flicker = s;
1529
1531
  p.then(err => {
1530
- if (error = err) return set();
1532
+ if ((error = err) || sharedConfig.done) return set();
1531
1533
  sharedConfig.gather(key);
1532
1534
  setHydrateContext(ctx);
1533
1535
  set();
package/dist/server.cjs CHANGED
@@ -508,7 +508,7 @@ function Suspense(props) {
508
508
  if (ctx.streaming) {
509
509
  setHydrateContext(undefined);
510
510
  const res = {
511
- t: `<span id="pl${id}">${resolveSSRNode(props.fallback)}</span>`
511
+ t: `<span id="pl-${id}">${resolveSSRNode(props.fallback)}</span>`
512
512
  };
513
513
  setHydrateContext(ctx);
514
514
  return res;
package/dist/server.js CHANGED
@@ -504,7 +504,7 @@ function Suspense(props) {
504
504
  if (ctx.streaming) {
505
505
  setHydrateContext(undefined);
506
506
  const res = {
507
- t: `<span id="pl${id}">${resolveSSRNode(props.fallback)}</span>`
507
+ t: `<span id="pl-${id}">${resolveSSRNode(props.fallback)}</span>`
508
508
  };
509
509
  setHydrateContext(ctx);
510
510
  return res;
package/dist/solid.cjs CHANGED
@@ -445,8 +445,8 @@ options) {
445
445
  return prevValue => {
446
446
  let input;
447
447
  if (isArray) {
448
- input = [];
449
- for (let i = 0; i < deps.length; i++) input.push(deps[i]());
448
+ input = Array(deps.length);
449
+ for (let i = 0; i < deps.length; i++) input[i] = deps[i]();
450
450
  } else input = deps();
451
451
  if (defer) {
452
452
  defer = false;
@@ -565,7 +565,7 @@ function readSignal() {
565
565
  if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
566
566
  const updates = Updates;
567
567
  Updates = null;
568
- !runningTransition && this.state === STALE || runningTransition && this.tState === STALE ? updateComputation(this) : lookDownstream(this);
568
+ !runningTransition && this.state === STALE || runningTransition && this.tState === STALE ? updateComputation(this) : lookUpstream(this);
569
569
  Updates = updates;
570
570
  }
571
571
  if (Listener) {
@@ -589,16 +589,16 @@ function readSignal() {
589
589
  return this.value;
590
590
  }
591
591
  function writeSignal(node, value, isComp) {
592
- if (node.comparator) {
593
- if (Transition && Transition.running && Transition.sources.has(node)) {
594
- if (node.comparator(node.tValue, value)) return value;
595
- } else if (node.comparator(node.value, value)) return value;
596
- }
597
592
  if (Pending) {
598
593
  if (node.pending === NOTPENDING) Pending.push(node);
599
594
  node.pending = value;
600
595
  return value;
601
596
  }
597
+ if (node.comparator) {
598
+ if (Transition && Transition.running && Transition.sources.has(node)) {
599
+ if (node.comparator(node.tValue, value)) return value;
600
+ } else if (node.comparator(node.value, value)) return value;
601
+ }
602
602
  let TransitionRunning = false;
603
603
  if (Transition) {
604
604
  TransitionRunning = Transition.running;
@@ -615,7 +615,7 @@ function writeSignal(node, value, isComp) {
615
615
  if (TransitionRunning && Transition.disposed.has(o)) continue;
616
616
  if (TransitionRunning && !o.tState || !TransitionRunning && !o.state) {
617
617
  if (o.pure) Updates.push(o);else Effects.push(o);
618
- if (o.observers) markUpstream(o);
618
+ if (o.observers) markDownstream(o);
619
619
  }
620
620
  if (TransitionRunning) o.tState = STALE;else o.state = STALE;
621
621
  }
@@ -707,7 +707,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
707
707
  function runTop(node) {
708
708
  const runningTransition = Transition && Transition.running;
709
709
  if (!runningTransition && node.state === 0 || runningTransition && node.tState === 0) return;
710
- if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) return lookDownstream(node);
710
+ if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) return lookUpstream(node);
711
711
  if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
712
712
  const ancestors = [node];
713
713
  while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
@@ -728,7 +728,7 @@ function runTop(node) {
728
728
  } else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
729
729
  const updates = Updates;
730
730
  Updates = null;
731
- lookDownstream(node, ancestors[0]);
731
+ lookUpstream(node, ancestors[0]);
732
732
  Updates = updates;
733
733
  }
734
734
  }
@@ -822,11 +822,12 @@ function runUserEffects(queue) {
822
822
  const e = queue[i];
823
823
  if (!e.user) runTop(e);else queue[userLength++] = e;
824
824
  }
825
+ if (sharedConfig.context) setHydrateContext();
825
826
  const resume = queue.length;
826
827
  for (i = 0; i < userLength; i++) runTop(queue[i]);
827
828
  for (i = resume; i < queue.length; i++) runTop(queue[i]);
828
829
  }
829
- function lookDownstream(node, ignore) {
830
+ function lookUpstream(node, ignore) {
830
831
  const runningTransition = Transition && Transition.running;
831
832
  if (runningTransition) node.tState = 0;else node.state = 0;
832
833
  for (let i = 0; i < node.sources.length; i += 1) {
@@ -834,18 +835,18 @@ function lookDownstream(node, ignore) {
834
835
  if (source.sources) {
835
836
  if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
836
837
  if (source !== ignore) runTop(source);
837
- } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookDownstream(source, ignore);
838
+ } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookUpstream(source, ignore);
838
839
  }
839
840
  }
840
841
  }
841
- function markUpstream(node) {
842
+ function markDownstream(node) {
842
843
  const runningTransition = Transition && Transition.running;
843
844
  for (let i = 0; i < node.observers.length; i += 1) {
844
845
  const o = node.observers[i];
845
846
  if (!runningTransition && !o.state || runningTransition && !o.tState) {
846
847
  if (runningTransition) o.tState = PENDING;else o.state = PENDING;
847
848
  if (o.pure) Updates.push(o);else Effects.push(o);
848
- o.observers && markUpstream(o);
849
+ o.observers && markDownstream(o);
849
850
  }
850
851
  }
851
852
  }
@@ -1447,7 +1448,7 @@ function Suspense(props) {
1447
1448
  });
1448
1449
  flicker = s;
1449
1450
  p.then(err => {
1450
- if (error = err) return set();
1451
+ if ((error = err) || sharedConfig.done) return set();
1451
1452
  sharedConfig.gather(key);
1452
1453
  setHydrateContext(ctx);
1453
1454
  set();
package/dist/solid.js CHANGED
@@ -441,8 +441,8 @@ options) {
441
441
  return prevValue => {
442
442
  let input;
443
443
  if (isArray) {
444
- input = [];
445
- for (let i = 0; i < deps.length; i++) input.push(deps[i]());
444
+ input = Array(deps.length);
445
+ for (let i = 0; i < deps.length; i++) input[i] = deps[i]();
446
446
  } else input = deps();
447
447
  if (defer) {
448
448
  defer = false;
@@ -561,7 +561,7 @@ function readSignal() {
561
561
  if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
562
562
  const updates = Updates;
563
563
  Updates = null;
564
- !runningTransition && this.state === STALE || runningTransition && this.tState === STALE ? updateComputation(this) : lookDownstream(this);
564
+ !runningTransition && this.state === STALE || runningTransition && this.tState === STALE ? updateComputation(this) : lookUpstream(this);
565
565
  Updates = updates;
566
566
  }
567
567
  if (Listener) {
@@ -585,16 +585,16 @@ function readSignal() {
585
585
  return this.value;
586
586
  }
587
587
  function writeSignal(node, value, isComp) {
588
- if (node.comparator) {
589
- if (Transition && Transition.running && Transition.sources.has(node)) {
590
- if (node.comparator(node.tValue, value)) return value;
591
- } else if (node.comparator(node.value, value)) return value;
592
- }
593
588
  if (Pending) {
594
589
  if (node.pending === NOTPENDING) Pending.push(node);
595
590
  node.pending = value;
596
591
  return value;
597
592
  }
593
+ if (node.comparator) {
594
+ if (Transition && Transition.running && Transition.sources.has(node)) {
595
+ if (node.comparator(node.tValue, value)) return value;
596
+ } else if (node.comparator(node.value, value)) return value;
597
+ }
598
598
  let TransitionRunning = false;
599
599
  if (Transition) {
600
600
  TransitionRunning = Transition.running;
@@ -611,7 +611,7 @@ function writeSignal(node, value, isComp) {
611
611
  if (TransitionRunning && Transition.disposed.has(o)) continue;
612
612
  if (TransitionRunning && !o.tState || !TransitionRunning && !o.state) {
613
613
  if (o.pure) Updates.push(o);else Effects.push(o);
614
- if (o.observers) markUpstream(o);
614
+ if (o.observers) markDownstream(o);
615
615
  }
616
616
  if (TransitionRunning) o.tState = STALE;else o.state = STALE;
617
617
  }
@@ -703,7 +703,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
703
703
  function runTop(node) {
704
704
  const runningTransition = Transition && Transition.running;
705
705
  if (!runningTransition && node.state === 0 || runningTransition && node.tState === 0) return;
706
- if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) return lookDownstream(node);
706
+ if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) return lookUpstream(node);
707
707
  if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
708
708
  const ancestors = [node];
709
709
  while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
@@ -724,7 +724,7 @@ function runTop(node) {
724
724
  } else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
725
725
  const updates = Updates;
726
726
  Updates = null;
727
- lookDownstream(node, ancestors[0]);
727
+ lookUpstream(node, ancestors[0]);
728
728
  Updates = updates;
729
729
  }
730
730
  }
@@ -818,11 +818,12 @@ function runUserEffects(queue) {
818
818
  const e = queue[i];
819
819
  if (!e.user) runTop(e);else queue[userLength++] = e;
820
820
  }
821
+ if (sharedConfig.context) setHydrateContext();
821
822
  const resume = queue.length;
822
823
  for (i = 0; i < userLength; i++) runTop(queue[i]);
823
824
  for (i = resume; i < queue.length; i++) runTop(queue[i]);
824
825
  }
825
- function lookDownstream(node, ignore) {
826
+ function lookUpstream(node, ignore) {
826
827
  const runningTransition = Transition && Transition.running;
827
828
  if (runningTransition) node.tState = 0;else node.state = 0;
828
829
  for (let i = 0; i < node.sources.length; i += 1) {
@@ -830,18 +831,18 @@ function lookDownstream(node, ignore) {
830
831
  if (source.sources) {
831
832
  if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
832
833
  if (source !== ignore) runTop(source);
833
- } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookDownstream(source, ignore);
834
+ } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookUpstream(source, ignore);
834
835
  }
835
836
  }
836
837
  }
837
- function markUpstream(node) {
838
+ function markDownstream(node) {
838
839
  const runningTransition = Transition && Transition.running;
839
840
  for (let i = 0; i < node.observers.length; i += 1) {
840
841
  const o = node.observers[i];
841
842
  if (!runningTransition && !o.state || runningTransition && !o.tState) {
842
843
  if (runningTransition) o.tState = PENDING;else o.state = PENDING;
843
844
  if (o.pure) Updates.push(o);else Effects.push(o);
844
- o.observers && markUpstream(o);
845
+ o.observers && markDownstream(o);
845
846
  }
846
847
  }
847
848
  }
@@ -1443,7 +1444,7 @@ function Suspense(props) {
1443
1444
  });
1444
1445
  flicker = s;
1445
1446
  p.then(err => {
1446
- if (error = err) return set();
1447
+ if ((error = err) || sharedConfig.done) return set();
1447
1448
  sharedConfig.gather(key);
1448
1449
  setHydrateContext(ctx);
1449
1450
  set();
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.3.12",
4
+ "version": "1.3.15",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -144,5 +144,5 @@
144
144
  "compiler",
145
145
  "performance"
146
146
  ],
147
- "gitHead": "e7671349791bd239fbe20c54c266ae085a7f09f2"
147
+ "gitHead": "0a6fc7bbeebf14f1a9297358801acf365dfbb716"
148
148
  }
@@ -1,4 +1,4 @@
1
1
  export { createStore, unwrap, $RAW } from "./store";
2
- export type { Store, SetStoreFunction, NotWrappable, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, Part, DeepReadonly, DeepMutable } from "./store";
2
+ export type { Store, SetStoreFunction, NotWrappable, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, Part, DeepReadonly, DeepMutable } from "./store";
3
3
  export * from "./mutable";
4
4
  export * from "./modifiers";
@@ -1,7 +1,7 @@
1
- import { DeepMutable, NotWrappable } from "./store";
1
+ import { DeepMutable } from "./store";
2
2
  export declare type ReconcileOptions = {
3
3
  key?: string | null;
4
4
  merge?: boolean;
5
5
  };
6
6
  export declare function reconcile<T extends U, U>(value: T, options?: ReconcileOptions): (state: U) => T;
7
- export declare function produce<T>(fn: (state: DeepMutable<Exclude<T, NotWrappable>>) => void): (state: T) => T;
7
+ export declare function produce<T>(fn: (state: DeepMutable<T>) => void): (state: T) => T;
@@ -1,7 +1,11 @@
1
1
  import { Accessor } from "../..";
2
2
  export declare const $RAW: unique symbol, $NODE: unique symbol, $NAME: unique symbol;
3
3
  export declare type StoreNode = Record<PropertyKey, any>;
4
- export declare type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined;
4
+ export declare namespace SolidStore {
5
+ interface Unwrappable {
6
+ }
7
+ }
8
+ export declare type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined | SolidStore.Unwrappable[keyof SolidStore.Unwrappable];
5
9
  export declare type Store<T> = DeepReadonly<T>;
6
10
  export declare function isWrappable(obj: any): any;
7
11
  export declare function unwrap<T extends StoreNode>(item: any, set?: Set<unknown>): T;
@@ -13,11 +17,11 @@ export declare function createDataNode(): Accessor<void> & {
13
17
  };
14
18
  export declare function setProperty(state: StoreNode, property: PropertyKey, value: any): void;
15
19
  export declare function updatePath(current: StoreNode, path: any[], traversed?: PropertyKey[]): void;
16
- export declare type DeepReadonly<T> = 0 extends 1 & T ? T : {
17
- readonly [K in keyof T]: T[K] extends NotWrappable ? T[K] : DeepReadonly<T[K]>;
20
+ export declare type DeepReadonly<T> = 0 extends 1 & T ? T : T extends NotWrappable ? T : {
21
+ readonly [K in keyof T]: DeepReadonly<T[K]>;
18
22
  };
19
- export declare type DeepMutable<T> = 0 extends 1 & T ? T : {
20
- -readonly [K in keyof T]: T[K] extends NotWrappable ? T[K] : DeepMutable<T[K]>;
23
+ export declare type DeepMutable<T> = 0 extends 1 & T ? T : T extends NotWrappable ? T : {
24
+ -readonly [K in keyof T]: DeepMutable<T[K]>;
21
25
  };
22
26
  export declare type StorePathRange = {
23
27
  from?: number;
@@ -25,10 +29,10 @@ export declare type StorePathRange = {
25
29
  by?: number;
26
30
  };
27
31
  export declare type ArrayFilterFn<T> = (item: DeepReadonly<T>, index: number) => boolean;
28
- export declare type StoreSetter<T, U extends PropertyKey[] = []> = ((prevState: DeepReadonly<T>, traversed: U) => DeepReadonly<T> | Partial<DeepReadonly<T>> | void) | DeepReadonly<T> | Partial<DeepReadonly<T>>;
29
- export declare type Part<T, K extends KeyOf<T> = KeyOf<T>> = [K] extends [never] ? never : K | readonly K[] | (number extends K ? ArrayFilterFn<T[number]> | StorePathRange : never);
32
+ export declare type StoreSetter<T, U extends PropertyKey[] = []> = ((prevState: DeepReadonly<T>, traversed: U) => T | Partial<T> | DeepReadonly<T> | Partial<DeepReadonly<T>> | void) | T | Partial<T> | DeepReadonly<T> | Partial<DeepReadonly<T>>;
33
+ 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);
30
34
  declare type W<T> = Exclude<T, NotWrappable>;
31
- declare type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [never] ? never : number : keyof T;
35
+ 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;
32
36
  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>);
33
37
  declare type DistributeRest<T, K, U extends PropertyKey[]> = [T] extends [never] ? never : K extends KeyOf<T> ? [Part<T, K>, ...Rest<T[K], [K, ...U]>] : never;
34
38
  export interface SetStoreFunction<T> {
package/types/jsx.d.ts CHANGED
@@ -21,7 +21,7 @@ export namespace JSX {
21
21
  (): Element;
22
22
  }
23
23
  interface ElementClass {
24
- render(props: any): Element;
24
+ // empty, libs can define requirements downstream
25
25
  }
26
26
  type LibraryManagedAttributes<Component, Props> = Props;
27
27
  interface ElementChildrenAttribute {
@@ -3112,7 +3112,7 @@ export namespace JSX {
3112
3112
  ZoomAndPanSVGAttributes,
3113
3113
  PresentationSVGAttributes {
3114
3114
  version?: string;
3115
- "base-profile"?: string;
3115
+ baseProfile?: string;
3116
3116
  x?: number | string;
3117
3117
  y?: number | string;
3118
3118
  width?: number | string;
@@ -70,7 +70,7 @@ export declare type RootFunction<T> = (dispose: () => void) => T;
70
70
  */
71
71
  export declare function createRoot<T>(fn: RootFunction<T>, detachedOwner?: Owner): T;
72
72
  export declare type Accessor<T> = () => T;
73
- export declare type Setter<T> = undefined extends T ? <U extends T>(value?: (U extends Function ? never : U) | ((prev?: T) => U)) => U : <U extends T>(value: (U extends Function ? never : U) | ((prev: T) => U)) => U;
73
+ export declare type Setter<T> = (undefined extends T ? (value?: undefined) => undefined : {}) & (<U extends T>(value: Exclude<U, Function> | ((prev: T) => U)) => U);
74
74
  export declare type Signal<T> = [get: Accessor<T>, set: Setter<T>];
75
75
  export interface SignalOptions<T> extends MemoOptions<T> {
76
76
  internal?: boolean;
@@ -201,7 +201,7 @@ export interface Resource<T> extends Accessor<T> {
201
201
  }
202
202
  export declare type ResourceActions<T> = {
203
203
  mutate: Setter<T>;
204
- refetch: (info?: unknown) => void;
204
+ refetch: (info?: unknown) => T | Promise<T> | undefined | null;
205
205
  };
206
206
  export declare type ResourceReturn<T> = [Resource<T>, ResourceActions<T>];
207
207
  export declare type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
@@ -10,6 +10,7 @@ declare type SharedConfig = {
10
10
  load?: (id: string) => Promise<any> | undefined;
11
11
  gather?: (key: string) => void;
12
12
  registry?: Map<string, Element>;
13
+ done?: boolean;
13
14
  };
14
15
  export declare const sharedConfig: SharedConfig;
15
16
  export declare function setHydrateContext(context?: HydrationContext): void;
@@ -194,18 +194,18 @@ function createRenderer$1({
194
194
  removeNode(parent, oldNode);
195
195
  }
196
196
  function spreadExpression(node, props, prevProps = {}, skipChildren) {
197
+ props || (props = {});
197
198
  if (!skipChildren && "children" in props) {
198
199
  solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
199
200
  }
201
+ props.ref && props.ref(node);
200
202
  solidJs.createRenderEffect(() => {
201
203
  for (const prop in props) {
202
- if (prop === "children") continue;
204
+ if (prop === "children" || prop === "ref") continue;
203
205
  const value = props[prop];
204
206
  if (value === prevProps[prop]) continue;
205
- if (prop === "ref") value(node);else {
206
- setProperty(node, prop, value, prevProps[prop]);
207
- prevProps[prop] = value;
208
- }
207
+ setProperty(node, prop, value, prevProps[prop]);
208
+ prevProps[prop] = value;
209
209
  }
210
210
  });
211
211
  return prevProps;
@@ -190,18 +190,18 @@ function createRenderer$1({
190
190
  removeNode(parent, oldNode);
191
191
  }
192
192
  function spreadExpression(node, props, prevProps = {}, skipChildren) {
193
+ props || (props = {});
193
194
  if (!skipChildren && "children" in props) {
194
195
  createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
195
196
  }
197
+ props.ref && props.ref(node);
196
198
  createRenderEffect(() => {
197
199
  for (const prop in props) {
198
- if (prop === "children") continue;
200
+ if (prop === "children" || prop === "ref") continue;
199
201
  const value = props[prop];
200
202
  if (value === prevProps[prop]) continue;
201
- if (prop === "ref") value(node);else {
202
- setProperty(node, prop, value, prevProps[prop]);
203
- prevProps[prop] = value;
204
- }
203
+ setProperty(node, prop, value, prevProps[prop]);
204
+ prevProps[prop] = value;
205
205
  }
206
206
  });
207
207
  return prevProps;
@@ -194,18 +194,18 @@ function createRenderer$1({
194
194
  removeNode(parent, oldNode);
195
195
  }
196
196
  function spreadExpression(node, props, prevProps = {}, skipChildren) {
197
+ props || (props = {});
197
198
  if (!skipChildren && "children" in props) {
198
199
  solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
199
200
  }
201
+ props.ref && props.ref(node);
200
202
  solidJs.createRenderEffect(() => {
201
203
  for (const prop in props) {
202
- if (prop === "children") continue;
204
+ if (prop === "children" || prop === "ref") continue;
203
205
  const value = props[prop];
204
206
  if (value === prevProps[prop]) continue;
205
- if (prop === "ref") value(node);else {
206
- setProperty(node, prop, value, prevProps[prop]);
207
- prevProps[prop] = value;
208
- }
207
+ setProperty(node, prop, value, prevProps[prop]);
208
+ prevProps[prop] = value;
209
209
  }
210
210
  });
211
211
  return prevProps;
@@ -190,18 +190,18 @@ function createRenderer$1({
190
190
  removeNode(parent, oldNode);
191
191
  }
192
192
  function spreadExpression(node, props, prevProps = {}, skipChildren) {
193
+ props || (props = {});
193
194
  if (!skipChildren && "children" in props) {
194
195
  createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
195
196
  }
197
+ props.ref && props.ref(node);
196
198
  createRenderEffect(() => {
197
199
  for (const prop in props) {
198
- if (prop === "children") continue;
200
+ if (prop === "children" || prop === "ref") continue;
199
201
  const value = props[prop];
200
202
  if (value === prevProps[prop]) continue;
201
- if (prop === "ref") value(node);else {
202
- setProperty(node, prop, value, prevProps[prop]);
203
- prevProps[prop] = value;
204
- }
203
+ setProperty(node, prop, value, prevProps[prop]);
204
+ prevProps[prop] = value;
205
205
  }
206
206
  });
207
207
  return prevProps;
package/web/dist/dev.cjs CHANGED
@@ -166,8 +166,10 @@ function classList(node, value, prev = {}) {
166
166
  }
167
167
  function style(node, value, prev = {}) {
168
168
  const nodeStyle = node.style;
169
- if (value == null || typeof value === "string") return nodeStyle.cssText = value;
170
- typeof prev === "string" && (prev = {});
169
+ const prevString = typeof prev === "string";
170
+ if (value == null && prevString || typeof value === "string") return nodeStyle.cssText = value;
171
+ prevString && (nodeStyle.cssText = undefined, prev = {});
172
+ value || (value = {});
171
173
  let v, s;
172
174
  for (s in prev) {
173
175
  value[s] == null && nodeStyle.removeProperty(s);
@@ -205,11 +207,12 @@ function insert(parent, accessor, marker, initial) {
205
207
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
206
208
  solidJs.createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);
207
209
  }
208
- function assign(node, props, isSVG, skipChildren, prevProps = {}) {
210
+ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
211
+ props || (props = {});
209
212
  for (const prop in prevProps) {
210
213
  if (!(prop in props)) {
211
214
  if (prop === "children") continue;
212
- assignProp(node, prop, null, prevProps[prop], isSVG);
215
+ assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
213
216
  }
214
217
  }
215
218
  for (const prop in props) {
@@ -218,7 +221,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}) {
218
221
  continue;
219
222
  }
220
223
  const value = props[prop];
221
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG);
224
+ prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
222
225
  }
223
226
  }
224
227
  function hydrate$1(code, element, options = {}) {
@@ -293,13 +296,15 @@ function toggleClassKey(node, key, value) {
293
296
  const classNames = key.trim().split(/\s+/);
294
297
  for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
295
298
  }
296
- function assignProp(node, prop, value, prev, isSVG) {
299
+ function assignProp(node, prop, value, prev, isSVG, skipRef) {
297
300
  let isCE, isProp, isChildProp;
298
301
  if (prop === "style") return style(node, value, prev);
299
302
  if (prop === "classList") return classList(node, value, prev);
300
303
  if (value === prev) return prev;
301
304
  if (prop === "ref") {
302
- value(node);
305
+ if (!skipRef) {
306
+ value(node);
307
+ }
303
308
  } else if (prop.slice(0, 3) === "on:") {
304
309
  node.addEventListener(prop.slice(3), value);
305
310
  } else if (prop.slice(0, 10) === "oncapture:") {
@@ -332,6 +337,10 @@ function eventHandler(e) {
332
337
  return node || document;
333
338
  }
334
339
  });
340
+ if (window._$HY && !solidJs.sharedConfig.done) {
341
+ solidJs.sharedConfig.done = true;
342
+ document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
343
+ }
335
344
  while (node !== null) {
336
345
  const handler = node[key];
337
346
  if (handler && !node.disabled) {
@@ -343,10 +352,12 @@ function eventHandler(e) {
343
352
  }
344
353
  }
345
354
  function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
355
+ props || (props = {});
346
356
  if (!skipChildren && "children" in props) {
347
357
  solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
348
358
  }
349
- solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps));
359
+ props.ref && props.ref(node);
360
+ solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
350
361
  return prevProps;
351
362
  }
352
363
  function insertExpression(parent, value, current, marker, unwrapArray) {
@@ -461,7 +472,7 @@ function gatherHydratable(element, root) {
461
472
  for (let i = 0; i < templates.length; i++) {
462
473
  const node = templates[i];
463
474
  const key = node.getAttribute("data-hk");
464
- if (!root || key.startsWith(root)) solidJs.sharedConfig.registry.set(key, node);
475
+ if ((!root || key.startsWith(root)) && !solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
465
476
  }
466
477
  }
467
478
  function getHydrationKey() {
package/web/dist/dev.js CHANGED
@@ -163,8 +163,10 @@ function classList(node, value, prev = {}) {
163
163
  }
164
164
  function style(node, value, prev = {}) {
165
165
  const nodeStyle = node.style;
166
- if (value == null || typeof value === "string") return nodeStyle.cssText = value;
167
- typeof prev === "string" && (prev = {});
166
+ const prevString = typeof prev === "string";
167
+ if (value == null && prevString || typeof value === "string") return nodeStyle.cssText = value;
168
+ prevString && (nodeStyle.cssText = undefined, prev = {});
169
+ value || (value = {});
168
170
  let v, s;
169
171
  for (s in prev) {
170
172
  value[s] == null && nodeStyle.removeProperty(s);
@@ -202,11 +204,12 @@ function insert(parent, accessor, marker, initial) {
202
204
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
203
205
  createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);
204
206
  }
205
- function assign(node, props, isSVG, skipChildren, prevProps = {}) {
207
+ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
208
+ props || (props = {});
206
209
  for (const prop in prevProps) {
207
210
  if (!(prop in props)) {
208
211
  if (prop === "children") continue;
209
- assignProp(node, prop, null, prevProps[prop], isSVG);
212
+ assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
210
213
  }
211
214
  }
212
215
  for (const prop in props) {
@@ -215,7 +218,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}) {
215
218
  continue;
216
219
  }
217
220
  const value = props[prop];
218
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG);
221
+ prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
219
222
  }
220
223
  }
221
224
  function hydrate$1(code, element, options = {}) {
@@ -290,13 +293,15 @@ function toggleClassKey(node, key, value) {
290
293
  const classNames = key.trim().split(/\s+/);
291
294
  for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
292
295
  }
293
- function assignProp(node, prop, value, prev, isSVG) {
296
+ function assignProp(node, prop, value, prev, isSVG, skipRef) {
294
297
  let isCE, isProp, isChildProp;
295
298
  if (prop === "style") return style(node, value, prev);
296
299
  if (prop === "classList") return classList(node, value, prev);
297
300
  if (value === prev) return prev;
298
301
  if (prop === "ref") {
299
- value(node);
302
+ if (!skipRef) {
303
+ value(node);
304
+ }
300
305
  } else if (prop.slice(0, 3) === "on:") {
301
306
  node.addEventListener(prop.slice(3), value);
302
307
  } else if (prop.slice(0, 10) === "oncapture:") {
@@ -329,6 +334,10 @@ function eventHandler(e) {
329
334
  return node || document;
330
335
  }
331
336
  });
337
+ if (window._$HY && !sharedConfig.done) {
338
+ sharedConfig.done = true;
339
+ document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
340
+ }
332
341
  while (node !== null) {
333
342
  const handler = node[key];
334
343
  if (handler && !node.disabled) {
@@ -340,10 +349,12 @@ function eventHandler(e) {
340
349
  }
341
350
  }
342
351
  function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
352
+ props || (props = {});
343
353
  if (!skipChildren && "children" in props) {
344
354
  createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
345
355
  }
346
- createRenderEffect(() => assign(node, props, isSVG, true, prevProps));
356
+ props.ref && props.ref(node);
357
+ createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
347
358
  return prevProps;
348
359
  }
349
360
  function insertExpression(parent, value, current, marker, unwrapArray) {
@@ -458,7 +469,7 @@ function gatherHydratable(element, root) {
458
469
  for (let i = 0; i < templates.length; i++) {
459
470
  const node = templates[i];
460
471
  const key = node.getAttribute("data-hk");
461
- if (!root || key.startsWith(root)) sharedConfig.registry.set(key, node);
472
+ if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
462
473
  }
463
474
  }
464
475
  function getHydrationKey() {
@@ -232,7 +232,7 @@ function stringifyString(str) {
232
232
  return result;
233
233
  }
234
234
 
235
- const REPLACE_SCRIPT = `function $df(e,y,t,g){t=document.getElementById(e),g=document.getElementById("pl"+e),g&&g.replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
235
+ const REPLACE_SCRIPT = `function $df(e,t,d,l){d=document.getElementById(e),(l=document.getElementById("pl-"+e))&&l.replaceWith(...d.childNodes),d.remove(),_$HY.set(e,t||null)}`;
236
236
  const FRAGMENT_REPLACE = /<!\[([\d-]+)\]>/;
237
237
  function renderToString(code, options = {}) {
238
238
  let scripts = "";
@@ -604,7 +604,19 @@ function injectScripts(html, scripts, nonce) {
604
604
  return html + tag;
605
605
  }
606
606
  function serializeError(error) {
607
- return error.message ? `new Error(${devalue(error.message)})` : devalue(error);
607
+ if (error.message) {
608
+ const fields = {};
609
+ const keys = Object.getOwnPropertyNames(error);
610
+ for (let i = 0; i < keys.length; i++) {
611
+ const key = keys[i];
612
+ const value = error[key];
613
+ if (!value || key !== "message" && typeof value !== "function") {
614
+ fields[key] = value;
615
+ }
616
+ }
617
+ return `Object.assign(new Error(${devalue(error.message)}), ${devalue(fields)})`;
618
+ }
619
+ return devalue(error);
608
620
  }
609
621
  function waitForFragments(registry, key) {
610
622
  for (const k of [...registry.keys()].reverse()) {
@@ -663,7 +675,7 @@ function Dynamic(props) {
663
675
  if (comp) {
664
676
  if (t === "function") return comp(others);else if (t === "string") {
665
677
  const [local, sOthers] = solidJs.splitProps(others, ["children"]);
666
- return ssr([`<${comp}`, ' ', ">", `</${comp}>`], ssrHydrationKey(), ssrSpread(sOthers), local.children || "");
678
+ return ssr([`<${comp}`, ' ', ">", `</${comp}>`], ssrHydrationKey(), ssrSpread(sOthers), escape(local.children || ""));
667
679
  }
668
680
  }
669
681
  }
@@ -229,7 +229,7 @@ function stringifyString(str) {
229
229
  return result;
230
230
  }
231
231
 
232
- const REPLACE_SCRIPT = `function $df(e,y,t,g){t=document.getElementById(e),g=document.getElementById("pl"+e),g&&g.replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
232
+ const REPLACE_SCRIPT = `function $df(e,t,d,l){d=document.getElementById(e),(l=document.getElementById("pl-"+e))&&l.replaceWith(...d.childNodes),d.remove(),_$HY.set(e,t||null)}`;
233
233
  const FRAGMENT_REPLACE = /<!\[([\d-]+)\]>/;
234
234
  function renderToString(code, options = {}) {
235
235
  let scripts = "";
@@ -601,7 +601,19 @@ function injectScripts(html, scripts, nonce) {
601
601
  return html + tag;
602
602
  }
603
603
  function serializeError(error) {
604
- return error.message ? `new Error(${devalue(error.message)})` : devalue(error);
604
+ if (error.message) {
605
+ const fields = {};
606
+ const keys = Object.getOwnPropertyNames(error);
607
+ for (let i = 0; i < keys.length; i++) {
608
+ const key = keys[i];
609
+ const value = error[key];
610
+ if (!value || key !== "message" && typeof value !== "function") {
611
+ fields[key] = value;
612
+ }
613
+ }
614
+ return `Object.assign(new Error(${devalue(error.message)}), ${devalue(fields)})`;
615
+ }
616
+ return devalue(error);
605
617
  }
606
618
  function waitForFragments(registry, key) {
607
619
  for (const k of [...registry.keys()].reverse()) {
@@ -660,7 +672,7 @@ function Dynamic(props) {
660
672
  if (comp) {
661
673
  if (t === "function") return comp(others);else if (t === "string") {
662
674
  const [local, sOthers] = splitProps(others, ["children"]);
663
- return ssr([`<${comp}`, ' ', ">", `</${comp}>`], ssrHydrationKey(), ssrSpread(sOthers), local.children || "");
675
+ return ssr([`<${comp}`, ' ', ">", `</${comp}>`], ssrHydrationKey(), ssrSpread(sOthers), escape(local.children || ""));
664
676
  }
665
677
  }
666
678
  }
package/web/dist/web.cjs CHANGED
@@ -165,8 +165,10 @@ function classList(node, value, prev = {}) {
165
165
  }
166
166
  function style(node, value, prev = {}) {
167
167
  const nodeStyle = node.style;
168
- if (value == null || typeof value === "string") return nodeStyle.cssText = value;
169
- typeof prev === "string" && (prev = {});
168
+ const prevString = typeof prev === "string";
169
+ if (value == null && prevString || typeof value === "string") return nodeStyle.cssText = value;
170
+ prevString && (nodeStyle.cssText = undefined, prev = {});
171
+ value || (value = {});
170
172
  let v, s;
171
173
  for (s in prev) {
172
174
  value[s] == null && nodeStyle.removeProperty(s);
@@ -204,11 +206,12 @@ function insert(parent, accessor, marker, initial) {
204
206
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
205
207
  solidJs.createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);
206
208
  }
207
- function assign(node, props, isSVG, skipChildren, prevProps = {}) {
209
+ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
210
+ props || (props = {});
208
211
  for (const prop in prevProps) {
209
212
  if (!(prop in props)) {
210
213
  if (prop === "children") continue;
211
- assignProp(node, prop, null, prevProps[prop], isSVG);
214
+ assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
212
215
  }
213
216
  }
214
217
  for (const prop in props) {
@@ -217,7 +220,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}) {
217
220
  continue;
218
221
  }
219
222
  const value = props[prop];
220
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG);
223
+ prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
221
224
  }
222
225
  }
223
226
  function hydrate$1(code, element, options = {}) {
@@ -292,13 +295,15 @@ function toggleClassKey(node, key, value) {
292
295
  const classNames = key.trim().split(/\s+/);
293
296
  for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
294
297
  }
295
- function assignProp(node, prop, value, prev, isSVG) {
298
+ function assignProp(node, prop, value, prev, isSVG, skipRef) {
296
299
  let isCE, isProp, isChildProp;
297
300
  if (prop === "style") return style(node, value, prev);
298
301
  if (prop === "classList") return classList(node, value, prev);
299
302
  if (value === prev) return prev;
300
303
  if (prop === "ref") {
301
- value(node);
304
+ if (!skipRef) {
305
+ value(node);
306
+ }
302
307
  } else if (prop.slice(0, 3) === "on:") {
303
308
  node.addEventListener(prop.slice(3), value);
304
309
  } else if (prop.slice(0, 10) === "oncapture:") {
@@ -331,6 +336,10 @@ function eventHandler(e) {
331
336
  return node || document;
332
337
  }
333
338
  });
339
+ if (window._$HY && !solidJs.sharedConfig.done) {
340
+ solidJs.sharedConfig.done = true;
341
+ document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
342
+ }
334
343
  while (node !== null) {
335
344
  const handler = node[key];
336
345
  if (handler && !node.disabled) {
@@ -342,10 +351,12 @@ function eventHandler(e) {
342
351
  }
343
352
  }
344
353
  function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
354
+ props || (props = {});
345
355
  if (!skipChildren && "children" in props) {
346
356
  solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
347
357
  }
348
- solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps));
358
+ props.ref && props.ref(node);
359
+ solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
349
360
  return prevProps;
350
361
  }
351
362
  function insertExpression(parent, value, current, marker, unwrapArray) {
@@ -460,7 +471,7 @@ function gatherHydratable(element, root) {
460
471
  for (let i = 0; i < templates.length; i++) {
461
472
  const node = templates[i];
462
473
  const key = node.getAttribute("data-hk");
463
- if (!root || key.startsWith(root)) solidJs.sharedConfig.registry.set(key, node);
474
+ if ((!root || key.startsWith(root)) && !solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
464
475
  }
465
476
  }
466
477
  function getHydrationKey() {
package/web/dist/web.js CHANGED
@@ -162,8 +162,10 @@ function classList(node, value, prev = {}) {
162
162
  }
163
163
  function style(node, value, prev = {}) {
164
164
  const nodeStyle = node.style;
165
- if (value == null || typeof value === "string") return nodeStyle.cssText = value;
166
- typeof prev === "string" && (prev = {});
165
+ const prevString = typeof prev === "string";
166
+ if (value == null && prevString || typeof value === "string") return nodeStyle.cssText = value;
167
+ prevString && (nodeStyle.cssText = undefined, prev = {});
168
+ value || (value = {});
167
169
  let v, s;
168
170
  for (s in prev) {
169
171
  value[s] == null && nodeStyle.removeProperty(s);
@@ -201,11 +203,12 @@ function insert(parent, accessor, marker, initial) {
201
203
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
202
204
  createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);
203
205
  }
204
- function assign(node, props, isSVG, skipChildren, prevProps = {}) {
206
+ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
207
+ props || (props = {});
205
208
  for (const prop in prevProps) {
206
209
  if (!(prop in props)) {
207
210
  if (prop === "children") continue;
208
- assignProp(node, prop, null, prevProps[prop], isSVG);
211
+ assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
209
212
  }
210
213
  }
211
214
  for (const prop in props) {
@@ -214,7 +217,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}) {
214
217
  continue;
215
218
  }
216
219
  const value = props[prop];
217
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG);
220
+ prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
218
221
  }
219
222
  }
220
223
  function hydrate$1(code, element, options = {}) {
@@ -289,13 +292,15 @@ function toggleClassKey(node, key, value) {
289
292
  const classNames = key.trim().split(/\s+/);
290
293
  for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
291
294
  }
292
- function assignProp(node, prop, value, prev, isSVG) {
295
+ function assignProp(node, prop, value, prev, isSVG, skipRef) {
293
296
  let isCE, isProp, isChildProp;
294
297
  if (prop === "style") return style(node, value, prev);
295
298
  if (prop === "classList") return classList(node, value, prev);
296
299
  if (value === prev) return prev;
297
300
  if (prop === "ref") {
298
- value(node);
301
+ if (!skipRef) {
302
+ value(node);
303
+ }
299
304
  } else if (prop.slice(0, 3) === "on:") {
300
305
  node.addEventListener(prop.slice(3), value);
301
306
  } else if (prop.slice(0, 10) === "oncapture:") {
@@ -328,6 +333,10 @@ function eventHandler(e) {
328
333
  return node || document;
329
334
  }
330
335
  });
336
+ if (window._$HY && !sharedConfig.done) {
337
+ sharedConfig.done = true;
338
+ document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
339
+ }
331
340
  while (node !== null) {
332
341
  const handler = node[key];
333
342
  if (handler && !node.disabled) {
@@ -339,10 +348,12 @@ function eventHandler(e) {
339
348
  }
340
349
  }
341
350
  function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
351
+ props || (props = {});
342
352
  if (!skipChildren && "children" in props) {
343
353
  createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
344
354
  }
345
- createRenderEffect(() => assign(node, props, isSVG, true, prevProps));
355
+ props.ref && props.ref(node);
356
+ createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
346
357
  return prevProps;
347
358
  }
348
359
  function insertExpression(parent, value, current, marker, unwrapArray) {
@@ -457,7 +468,7 @@ function gatherHydratable(element, root) {
457
468
  for (let i = 0; i < templates.length; i++) {
458
469
  const node = templates[i];
459
470
  const key = node.getAttribute("data-hk");
460
- if (!root || key.startsWith(root)) sharedConfig.registry.set(key, node);
471
+ if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
461
472
  }
462
473
  }
463
474
  function getHydrationKey() {