solid-js 1.3.13 → 1.3.16

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
@@ -388,7 +388,7 @@ function createSelector(source, fn = equalFn, options) {
388
388
  const subs = new Map();
389
389
  const node = createComputation(p => {
390
390
  const v = source();
391
- for (const key of subs.keys()) if (fn(key, v) !== (p !== undefined && fn(key, p))) {
391
+ for (const key of subs.keys()) if (fn(key, v) !== fn(key, p)) {
392
392
  const l = subs.get(key);
393
393
  for (const c of l.values()) {
394
394
  c.state = STALE;
@@ -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) {
@@ -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
@@ -384,7 +384,7 @@ function createSelector(source, fn = equalFn, options) {
384
384
  const subs = new Map();
385
385
  const node = createComputation(p => {
386
386
  const v = source();
387
- for (const key of subs.keys()) if (fn(key, v) !== (p !== undefined && fn(key, p))) {
387
+ for (const key of subs.keys()) if (fn(key, v) !== fn(key, p)) {
388
388
  const l = subs.get(key);
389
389
  for (const c of l.values()) {
390
390
  c.state = STALE;
@@ -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) {
@@ -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
@@ -385,7 +385,7 @@ function createSelector(source, fn = equalFn, options) {
385
385
  const subs = new Map();
386
386
  const node = createComputation(p => {
387
387
  const v = source();
388
- for (const key of subs.keys()) if (fn(key, v) !== (p !== undefined && fn(key, p))) {
388
+ for (const key of subs.keys()) if (fn(key, v) !== fn(key, p)) {
389
389
  const l = subs.get(key);
390
390
  for (const c of l.values()) {
391
391
  c.state = STALE;
@@ -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) {
@@ -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
@@ -381,7 +381,7 @@ function createSelector(source, fn = equalFn, options) {
381
381
  const subs = new Map();
382
382
  const node = createComputation(p => {
383
383
  const v = source();
384
- for (const key of subs.keys()) if (fn(key, v) !== (p !== undefined && fn(key, p))) {
384
+ for (const key of subs.keys()) if (fn(key, v) !== fn(key, p)) {
385
385
  const l = subs.get(key);
386
386
  for (const c of l.values()) {
387
387
  c.state = STALE;
@@ -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) {
@@ -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.13",
4
+ "version": "1.3.16",
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": "dfacd34d443f9cdf1958445756e7317bd8e3632c"
147
+ "gitHead": "616d2f521e70f3c4f6c0ef6944d1763a0cf6a73b"
148
148
  }
@@ -18,10 +18,10 @@ export declare function createDataNode(): Accessor<void> & {
18
18
  export declare function setProperty(state: StoreNode, property: PropertyKey, value: any): void;
19
19
  export declare function updatePath(current: StoreNode, path: any[], traversed?: PropertyKey[]): void;
20
20
  export declare type DeepReadonly<T> = 0 extends 1 & T ? T : T extends NotWrappable ? T : {
21
- readonly [K in keyof T]: T[K];
21
+ readonly [K in keyof T]: DeepReadonly<T[K]>;
22
22
  };
23
23
  export declare type DeepMutable<T> = 0 extends 1 & T ? T : T extends NotWrappable ? T : {
24
- -readonly [K in keyof T]: T[K];
24
+ -readonly [K in keyof T]: DeepMutable<T[K]>;
25
25
  };
26
26
  export declare type StorePathRange = {
27
27
  from?: number;
package/types/jsx.d.ts CHANGED
@@ -21,9 +21,12 @@ 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
+ interface ElementAttributesProperty {
28
+ // empty, libs can define requirements downstream
29
+ }
27
30
  interface ElementChildrenAttribute {
28
31
  children: {};
29
32
  }
@@ -1997,6 +2000,7 @@ export namespace JSX {
1997
2000
  | "treegrid"
1998
2001
  | "treeitem";
1999
2002
  autocapitalize?: HTMLAutocapitalize;
2003
+ slot?: string;
2000
2004
  color?: string;
2001
2005
  itemprop?: string;
2002
2006
  itemscope?: boolean;
@@ -3112,7 +3116,7 @@ export namespace JSX {
3112
3116
  ZoomAndPanSVGAttributes,
3113
3117
  PresentationSVGAttributes {
3114
3118
  version?: string;
3115
- "base-profile"?: string;
3119
+ baseProfile?: string;
3116
3120
  x?: number | string;
3117
3121
  y?: number | string;
3118
3122
  width?: number | string;
@@ -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
@@ -29,6 +29,7 @@ const SVGNamespace = {
29
29
  xlink: "http://www.w3.org/1999/xlink",
30
30
  xml: "http://www.w3.org/XML/1998/namespace"
31
31
  };
32
+ const DOMElements = new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input"]);
32
33
 
33
34
  function memo(fn, equals) {
34
35
  return solidJs.createMemo(fn, undefined, !equals ? {
@@ -166,8 +167,10 @@ function classList(node, value, prev = {}) {
166
167
  }
167
168
  function style(node, value, prev = {}) {
168
169
  const nodeStyle = node.style;
169
- if (value == null || typeof value === "string") return nodeStyle.cssText = value;
170
- typeof prev === "string" && (prev = {});
170
+ const prevString = typeof prev === "string";
171
+ if (value == null && prevString || typeof value === "string") return nodeStyle.cssText = value;
172
+ prevString && (nodeStyle.cssText = undefined, prev = {});
173
+ value || (value = {});
171
174
  let v, s;
172
175
  for (s in prev) {
173
176
  value[s] == null && nodeStyle.removeProperty(s);
@@ -205,11 +208,12 @@ function insert(parent, accessor, marker, initial) {
205
208
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
206
209
  solidJs.createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);
207
210
  }
208
- function assign(node, props, isSVG, skipChildren, prevProps = {}) {
211
+ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
212
+ props || (props = {});
209
213
  for (const prop in prevProps) {
210
214
  if (!(prop in props)) {
211
215
  if (prop === "children") continue;
212
- assignProp(node, prop, null, prevProps[prop], isSVG);
216
+ assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
213
217
  }
214
218
  }
215
219
  for (const prop in props) {
@@ -218,7 +222,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}) {
218
222
  continue;
219
223
  }
220
224
  const value = props[prop];
221
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG);
225
+ prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
222
226
  }
223
227
  }
224
228
  function hydrate$1(code, element, options = {}) {
@@ -293,13 +297,15 @@ function toggleClassKey(node, key, value) {
293
297
  const classNames = key.trim().split(/\s+/);
294
298
  for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
295
299
  }
296
- function assignProp(node, prop, value, prev, isSVG) {
300
+ function assignProp(node, prop, value, prev, isSVG, skipRef) {
297
301
  let isCE, isProp, isChildProp;
298
302
  if (prop === "style") return style(node, value, prev);
299
303
  if (prop === "classList") return classList(node, value, prev);
300
304
  if (value === prev) return prev;
301
305
  if (prop === "ref") {
302
- value(node);
306
+ if (!skipRef) {
307
+ value(node);
308
+ }
303
309
  } else if (prop.slice(0, 3) === "on:") {
304
310
  node.addEventListener(prop.slice(3), value);
305
311
  } else if (prop.slice(0, 10) === "oncapture:") {
@@ -332,6 +338,10 @@ function eventHandler(e) {
332
338
  return node || document;
333
339
  }
334
340
  });
341
+ if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) {
342
+ solidJs.sharedConfig.done = true;
343
+ document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
344
+ }
335
345
  while (node !== null) {
336
346
  const handler = node[key];
337
347
  if (handler && !node.disabled) {
@@ -343,10 +353,12 @@ function eventHandler(e) {
343
353
  }
344
354
  }
345
355
  function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
356
+ props || (props = {});
346
357
  if (!skipChildren && "children" in props) {
347
358
  solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
348
359
  }
349
- solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps));
360
+ props.ref && props.ref(node);
361
+ solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
350
362
  return prevProps;
351
363
  }
352
364
  function insertExpression(parent, value, current, marker, unwrapArray) {
@@ -461,7 +473,7 @@ function gatherHydratable(element, root) {
461
473
  for (let i = 0; i < templates.length; i++) {
462
474
  const node = templates[i];
463
475
  const key = node.getAttribute("data-hk");
464
- if (!root || key.startsWith(root)) solidJs.sharedConfig.registry.set(key, node);
476
+ if ((!root || key.startsWith(root)) && !solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
465
477
  }
466
478
  }
467
479
  function getHydrationKey() {
@@ -614,6 +626,7 @@ Object.defineProperty(exports, 'mergeProps', {
614
626
  exports.Aliases = Aliases;
615
627
  exports.Assets = Assets;
616
628
  exports.ChildProperties = ChildProperties;
629
+ exports.DOMElements = DOMElements;
617
630
  exports.DelegatedEvents = DelegatedEvents;
618
631
  exports.Dynamic = Dynamic;
619
632
  exports.HydrationScript = Assets;
package/web/dist/dev.js CHANGED
@@ -26,6 +26,7 @@ const SVGNamespace = {
26
26
  xlink: "http://www.w3.org/1999/xlink",
27
27
  xml: "http://www.w3.org/XML/1998/namespace"
28
28
  };
29
+ const DOMElements = new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input"]);
29
30
 
30
31
  function memo(fn, equals) {
31
32
  return createMemo(fn, undefined, !equals ? {
@@ -163,8 +164,10 @@ function classList(node, value, prev = {}) {
163
164
  }
164
165
  function style(node, value, prev = {}) {
165
166
  const nodeStyle = node.style;
166
- if (value == null || typeof value === "string") return nodeStyle.cssText = value;
167
- typeof prev === "string" && (prev = {});
167
+ const prevString = typeof prev === "string";
168
+ if (value == null && prevString || typeof value === "string") return nodeStyle.cssText = value;
169
+ prevString && (nodeStyle.cssText = undefined, prev = {});
170
+ value || (value = {});
168
171
  let v, s;
169
172
  for (s in prev) {
170
173
  value[s] == null && nodeStyle.removeProperty(s);
@@ -202,11 +205,12 @@ function insert(parent, accessor, marker, initial) {
202
205
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
203
206
  createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);
204
207
  }
205
- function assign(node, props, isSVG, skipChildren, prevProps = {}) {
208
+ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
209
+ props || (props = {});
206
210
  for (const prop in prevProps) {
207
211
  if (!(prop in props)) {
208
212
  if (prop === "children") continue;
209
- assignProp(node, prop, null, prevProps[prop], isSVG);
213
+ assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
210
214
  }
211
215
  }
212
216
  for (const prop in props) {
@@ -215,7 +219,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}) {
215
219
  continue;
216
220
  }
217
221
  const value = props[prop];
218
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG);
222
+ prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
219
223
  }
220
224
  }
221
225
  function hydrate$1(code, element, options = {}) {
@@ -290,13 +294,15 @@ function toggleClassKey(node, key, value) {
290
294
  const classNames = key.trim().split(/\s+/);
291
295
  for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
292
296
  }
293
- function assignProp(node, prop, value, prev, isSVG) {
297
+ function assignProp(node, prop, value, prev, isSVG, skipRef) {
294
298
  let isCE, isProp, isChildProp;
295
299
  if (prop === "style") return style(node, value, prev);
296
300
  if (prop === "classList") return classList(node, value, prev);
297
301
  if (value === prev) return prev;
298
302
  if (prop === "ref") {
299
- value(node);
303
+ if (!skipRef) {
304
+ value(node);
305
+ }
300
306
  } else if (prop.slice(0, 3) === "on:") {
301
307
  node.addEventListener(prop.slice(3), value);
302
308
  } else if (prop.slice(0, 10) === "oncapture:") {
@@ -329,6 +335,10 @@ function eventHandler(e) {
329
335
  return node || document;
330
336
  }
331
337
  });
338
+ if (sharedConfig.registry && !sharedConfig.done) {
339
+ sharedConfig.done = true;
340
+ document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
341
+ }
332
342
  while (node !== null) {
333
343
  const handler = node[key];
334
344
  if (handler && !node.disabled) {
@@ -340,10 +350,12 @@ function eventHandler(e) {
340
350
  }
341
351
  }
342
352
  function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
353
+ props || (props = {});
343
354
  if (!skipChildren && "children" in props) {
344
355
  createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
345
356
  }
346
- createRenderEffect(() => assign(node, props, isSVG, true, prevProps));
357
+ props.ref && props.ref(node);
358
+ createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
347
359
  return prevProps;
348
360
  }
349
361
  function insertExpression(parent, value, current, marker, unwrapArray) {
@@ -458,7 +470,7 @@ function gatherHydratable(element, root) {
458
470
  for (let i = 0; i < templates.length; i++) {
459
471
  const node = templates[i];
460
472
  const key = node.getAttribute("data-hk");
461
- if (!root || key.startsWith(root)) sharedConfig.registry.set(key, node);
473
+ if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
462
474
  }
463
475
  }
464
476
  function getHydrationKey() {
@@ -560,4 +572,4 @@ function Dynamic(props) {
560
572
  });
561
573
  }
562
574
 
563
- export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
575
+ export { Aliases, Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
@@ -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 = "";
@@ -499,6 +499,7 @@ function ssrSpread(props, isSVG, skipChildren) {
499
499
  if (typeof props === "function") props = props();
500
500
  const keys = Object.keys(props);
501
501
  let result = "";
502
+ let classResolved;
502
503
  for (let i = 0; i < keys.length; i++) {
503
504
  const prop = keys[i];
504
505
  if (prop === "children") {
@@ -508,8 +509,11 @@ function ssrSpread(props, isSVG, skipChildren) {
508
509
  const value = props[prop];
509
510
  if (prop === "style") {
510
511
  result += `style="${ssrStyle(value)}"`;
511
- } else if (prop === "classList") {
512
- result += `class="${ssrClassList(value)}"`;
512
+ } else if (prop === "class" || prop === "className" || prop === "classList") {
513
+ if (classResolved) continue;
514
+ let n;
515
+ result += `class="${(n = props.class) ? n + " " : ""}${(n = props.className) ? n + " " : ""}${ssrClassList(props.classList)}"`;
516
+ classResolved = true;
513
517
  } else if (BooleanAttributes.has(prop)) {
514
518
  if (value) result += prop;else continue;
515
519
  } else if (prop === "ref" || prop.slice(0, 2) === "on") {
@@ -675,7 +679,7 @@ function Dynamic(props) {
675
679
  if (comp) {
676
680
  if (t === "function") return comp(others);else if (t === "string") {
677
681
  const [local, sOthers] = solidJs.splitProps(others, ["children"]);
678
- return ssr([`<${comp}`, ' ', ">", `</${comp}>`], ssrHydrationKey(), ssrSpread(sOthers), local.children || "");
682
+ return ssr([`<${comp}`, ' ', ">", `</${comp}>`], ssrHydrationKey(), ssrSpread(sOthers), escape(local.children || ""));
679
683
  }
680
684
  }
681
685
  }
@@ -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 = "";
@@ -496,6 +496,7 @@ function ssrSpread(props, isSVG, skipChildren) {
496
496
  if (typeof props === "function") props = props();
497
497
  const keys = Object.keys(props);
498
498
  let result = "";
499
+ let classResolved;
499
500
  for (let i = 0; i < keys.length; i++) {
500
501
  const prop = keys[i];
501
502
  if (prop === "children") {
@@ -505,8 +506,11 @@ function ssrSpread(props, isSVG, skipChildren) {
505
506
  const value = props[prop];
506
507
  if (prop === "style") {
507
508
  result += `style="${ssrStyle(value)}"`;
508
- } else if (prop === "classList") {
509
- result += `class="${ssrClassList(value)}"`;
509
+ } else if (prop === "class" || prop === "className" || prop === "classList") {
510
+ if (classResolved) continue;
511
+ let n;
512
+ result += `class="${(n = props.class) ? n + " " : ""}${(n = props.className) ? n + " " : ""}${ssrClassList(props.classList)}"`;
513
+ classResolved = true;
510
514
  } else if (BooleanAttributes.has(prop)) {
511
515
  if (value) result += prop;else continue;
512
516
  } else if (prop === "ref" || prop.slice(0, 2) === "on") {
@@ -672,7 +676,7 @@ function Dynamic(props) {
672
676
  if (comp) {
673
677
  if (t === "function") return comp(others);else if (t === "string") {
674
678
  const [local, sOthers] = splitProps(others, ["children"]);
675
- return ssr([`<${comp}`, ' ', ">", `</${comp}>`], ssrHydrationKey(), ssrSpread(sOthers), local.children || "");
679
+ return ssr([`<${comp}`, ' ', ">", `</${comp}>`], ssrHydrationKey(), ssrSpread(sOthers), escape(local.children || ""));
676
680
  }
677
681
  }
678
682
  }
package/web/dist/web.cjs CHANGED
@@ -29,6 +29,7 @@ const SVGNamespace = {
29
29
  xlink: "http://www.w3.org/1999/xlink",
30
30
  xml: "http://www.w3.org/XML/1998/namespace"
31
31
  };
32
+ const DOMElements = new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input"]);
32
33
 
33
34
  function memo(fn, equals) {
34
35
  return solidJs.createMemo(fn, undefined, !equals ? {
@@ -165,8 +166,10 @@ function classList(node, value, prev = {}) {
165
166
  }
166
167
  function style(node, value, prev = {}) {
167
168
  const nodeStyle = node.style;
168
- if (value == null || typeof value === "string") return nodeStyle.cssText = value;
169
- 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 = {});
170
173
  let v, s;
171
174
  for (s in prev) {
172
175
  value[s] == null && nodeStyle.removeProperty(s);
@@ -204,11 +207,12 @@ function insert(parent, accessor, marker, initial) {
204
207
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
205
208
  solidJs.createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);
206
209
  }
207
- function assign(node, props, isSVG, skipChildren, prevProps = {}) {
210
+ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
211
+ props || (props = {});
208
212
  for (const prop in prevProps) {
209
213
  if (!(prop in props)) {
210
214
  if (prop === "children") continue;
211
- assignProp(node, prop, null, prevProps[prop], isSVG);
215
+ assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
212
216
  }
213
217
  }
214
218
  for (const prop in props) {
@@ -217,7 +221,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}) {
217
221
  continue;
218
222
  }
219
223
  const value = props[prop];
220
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG);
224
+ prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
221
225
  }
222
226
  }
223
227
  function hydrate$1(code, element, options = {}) {
@@ -292,13 +296,15 @@ function toggleClassKey(node, key, value) {
292
296
  const classNames = key.trim().split(/\s+/);
293
297
  for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
294
298
  }
295
- function assignProp(node, prop, value, prev, isSVG) {
299
+ function assignProp(node, prop, value, prev, isSVG, skipRef) {
296
300
  let isCE, isProp, isChildProp;
297
301
  if (prop === "style") return style(node, value, prev);
298
302
  if (prop === "classList") return classList(node, value, prev);
299
303
  if (value === prev) return prev;
300
304
  if (prop === "ref") {
301
- value(node);
305
+ if (!skipRef) {
306
+ value(node);
307
+ }
302
308
  } else if (prop.slice(0, 3) === "on:") {
303
309
  node.addEventListener(prop.slice(3), value);
304
310
  } else if (prop.slice(0, 10) === "oncapture:") {
@@ -331,6 +337,10 @@ function eventHandler(e) {
331
337
  return node || document;
332
338
  }
333
339
  });
340
+ if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) {
341
+ solidJs.sharedConfig.done = true;
342
+ document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
343
+ }
334
344
  while (node !== null) {
335
345
  const handler = node[key];
336
346
  if (handler && !node.disabled) {
@@ -342,10 +352,12 @@ function eventHandler(e) {
342
352
  }
343
353
  }
344
354
  function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
355
+ props || (props = {});
345
356
  if (!skipChildren && "children" in props) {
346
357
  solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
347
358
  }
348
- solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps));
359
+ props.ref && props.ref(node);
360
+ solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
349
361
  return prevProps;
350
362
  }
351
363
  function insertExpression(parent, value, current, marker, unwrapArray) {
@@ -460,7 +472,7 @@ function gatherHydratable(element, root) {
460
472
  for (let i = 0; i < templates.length; i++) {
461
473
  const node = templates[i];
462
474
  const key = node.getAttribute("data-hk");
463
- 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);
464
476
  }
465
477
  }
466
478
  function getHydrationKey() {
@@ -610,6 +622,7 @@ Object.defineProperty(exports, 'mergeProps', {
610
622
  exports.Aliases = Aliases;
611
623
  exports.Assets = Assets;
612
624
  exports.ChildProperties = ChildProperties;
625
+ exports.DOMElements = DOMElements;
613
626
  exports.DelegatedEvents = DelegatedEvents;
614
627
  exports.Dynamic = Dynamic;
615
628
  exports.HydrationScript = Assets;
package/web/dist/web.js CHANGED
@@ -26,6 +26,7 @@ const SVGNamespace = {
26
26
  xlink: "http://www.w3.org/1999/xlink",
27
27
  xml: "http://www.w3.org/XML/1998/namespace"
28
28
  };
29
+ const DOMElements = new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input"]);
29
30
 
30
31
  function memo(fn, equals) {
31
32
  return createMemo(fn, undefined, !equals ? {
@@ -162,8 +163,10 @@ function classList(node, value, prev = {}) {
162
163
  }
163
164
  function style(node, value, prev = {}) {
164
165
  const nodeStyle = node.style;
165
- if (value == null || typeof value === "string") return nodeStyle.cssText = value;
166
- 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 = {});
167
170
  let v, s;
168
171
  for (s in prev) {
169
172
  value[s] == null && nodeStyle.removeProperty(s);
@@ -201,11 +204,12 @@ function insert(parent, accessor, marker, initial) {
201
204
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
202
205
  createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);
203
206
  }
204
- function assign(node, props, isSVG, skipChildren, prevProps = {}) {
207
+ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
208
+ props || (props = {});
205
209
  for (const prop in prevProps) {
206
210
  if (!(prop in props)) {
207
211
  if (prop === "children") continue;
208
- assignProp(node, prop, null, prevProps[prop], isSVG);
212
+ assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
209
213
  }
210
214
  }
211
215
  for (const prop in props) {
@@ -214,7 +218,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}) {
214
218
  continue;
215
219
  }
216
220
  const value = props[prop];
217
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG);
221
+ prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
218
222
  }
219
223
  }
220
224
  function hydrate$1(code, element, options = {}) {
@@ -289,13 +293,15 @@ function toggleClassKey(node, key, value) {
289
293
  const classNames = key.trim().split(/\s+/);
290
294
  for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
291
295
  }
292
- function assignProp(node, prop, value, prev, isSVG) {
296
+ function assignProp(node, prop, value, prev, isSVG, skipRef) {
293
297
  let isCE, isProp, isChildProp;
294
298
  if (prop === "style") return style(node, value, prev);
295
299
  if (prop === "classList") return classList(node, value, prev);
296
300
  if (value === prev) return prev;
297
301
  if (prop === "ref") {
298
- value(node);
302
+ if (!skipRef) {
303
+ value(node);
304
+ }
299
305
  } else if (prop.slice(0, 3) === "on:") {
300
306
  node.addEventListener(prop.slice(3), value);
301
307
  } else if (prop.slice(0, 10) === "oncapture:") {
@@ -328,6 +334,10 @@ function eventHandler(e) {
328
334
  return node || document;
329
335
  }
330
336
  });
337
+ if (sharedConfig.registry && !sharedConfig.done) {
338
+ sharedConfig.done = true;
339
+ document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
340
+ }
331
341
  while (node !== null) {
332
342
  const handler = node[key];
333
343
  if (handler && !node.disabled) {
@@ -339,10 +349,12 @@ function eventHandler(e) {
339
349
  }
340
350
  }
341
351
  function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
352
+ props || (props = {});
342
353
  if (!skipChildren && "children" in props) {
343
354
  createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
344
355
  }
345
- createRenderEffect(() => assign(node, props, isSVG, true, prevProps));
356
+ props.ref && props.ref(node);
357
+ createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
346
358
  return prevProps;
347
359
  }
348
360
  function insertExpression(parent, value, current, marker, unwrapArray) {
@@ -457,7 +469,7 @@ function gatherHydratable(element, root) {
457
469
  for (let i = 0; i < templates.length; i++) {
458
470
  const node = templates[i];
459
471
  const key = node.getAttribute("data-hk");
460
- 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);
461
473
  }
462
474
  }
463
475
  function getHydrationKey() {
@@ -556,4 +568,4 @@ function Dynamic(props) {
556
568
  });
557
569
  }
558
570
 
559
- export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
571
+ export { Aliases, Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
@@ -4,6 +4,7 @@ export const PropAliases: Record<string, string>;
4
4
  export const Properties: Set<string>;
5
5
  export const ChildProperties: Set<string>;
6
6
  export const DelegatedEvents: Set<string>;
7
+ export const DOMElements: Set<string>;
7
8
  export const SVGElements: Set<string>;
8
9
  export const SVGNamespace: Record<string, string>;
9
10