solid-js 1.3.11 → 1.3.14
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 +14 -13
- package/dist/dev.js +14 -13
- package/dist/server.cjs +15 -11
- package/dist/server.js +15 -11
- package/dist/solid.cjs +13 -13
- package/dist/solid.js +13 -13
- package/package.json +2 -2
- package/store/types/index.d.ts +1 -1
- package/store/types/modifiers.d.ts +2 -2
- package/store/types/store.d.ts +12 -8
- package/types/jsx.d.ts +2 -2
- package/types/reactive/signal.d.ts +1 -1
- package/types/server/reactive.d.ts +2 -1
- package/types/server/rendering.d.ts +26 -12
- package/universal/dist/dev.cjs +5 -5
- package/universal/dist/dev.js +5 -5
- package/universal/dist/universal.cjs +5 -5
- package/universal/dist/universal.js +5 -5
- package/web/dist/dev.cjs +30 -12
- package/web/dist/dev.js +30 -12
- package/web/dist/server.cjs +14 -2
- package/web/dist/server.js +14 -2
- package/web/dist/web.cjs +30 -12
- package/web/dist/web.js +30 -12
- package/web/types/server-mock.d.ts +6 -2
package/dist/dev.cjs
CHANGED
|
@@ -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) :
|
|
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)
|
|
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
|
|
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
|
-
|
|
788
|
+
lookUpstream(node, ancestors[0]);
|
|
789
789
|
Updates = updates;
|
|
790
790
|
}
|
|
791
791
|
}
|
|
@@ -884,7 +884,7 @@ function runUserEffects(queue) {
|
|
|
884
884
|
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
885
885
|
for (i = resume; i < queue.length; i++) runTop(queue[i]);
|
|
886
886
|
}
|
|
887
|
-
function
|
|
887
|
+
function lookUpstream(node, ignore) {
|
|
888
888
|
const runningTransition = Transition && Transition.running;
|
|
889
889
|
if (runningTransition) node.tState = 0;else node.state = 0;
|
|
890
890
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
@@ -892,18 +892,18 @@ function lookDownstream(node, ignore) {
|
|
|
892
892
|
if (source.sources) {
|
|
893
893
|
if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
|
|
894
894
|
if (source !== ignore) runTop(source);
|
|
895
|
-
} else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING)
|
|
895
|
+
} else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookUpstream(source, ignore);
|
|
896
896
|
}
|
|
897
897
|
}
|
|
898
898
|
}
|
|
899
|
-
function
|
|
899
|
+
function markDownstream(node) {
|
|
900
900
|
const runningTransition = Transition && Transition.running;
|
|
901
901
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
902
902
|
const o = node.observers[i];
|
|
903
903
|
if (!runningTransition && !o.state || runningTransition && !o.tState) {
|
|
904
904
|
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
905
905
|
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
906
|
-
o.observers &&
|
|
906
|
+
o.observers && markDownstream(o);
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
909
|
}
|
|
@@ -1426,6 +1426,7 @@ function ErrorBoundary(props) {
|
|
|
1426
1426
|
return createMemo(() => {
|
|
1427
1427
|
if ((e = errored()) != null) {
|
|
1428
1428
|
const f = props.fallback;
|
|
1429
|
+
if ((typeof f !== "function" || f.length == 0)) console.error(e);
|
|
1429
1430
|
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored(null))) : f;
|
|
1430
1431
|
}
|
|
1431
1432
|
onError(setErrored);
|
package/dist/dev.js
CHANGED
|
@@ -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) :
|
|
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)
|
|
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
|
|
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
|
-
|
|
784
|
+
lookUpstream(node, ancestors[0]);
|
|
785
785
|
Updates = updates;
|
|
786
786
|
}
|
|
787
787
|
}
|
|
@@ -880,7 +880,7 @@ function runUserEffects(queue) {
|
|
|
880
880
|
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
881
881
|
for (i = resume; i < queue.length; i++) runTop(queue[i]);
|
|
882
882
|
}
|
|
883
|
-
function
|
|
883
|
+
function lookUpstream(node, ignore) {
|
|
884
884
|
const runningTransition = Transition && Transition.running;
|
|
885
885
|
if (runningTransition) node.tState = 0;else node.state = 0;
|
|
886
886
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
@@ -888,18 +888,18 @@ function lookDownstream(node, ignore) {
|
|
|
888
888
|
if (source.sources) {
|
|
889
889
|
if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
|
|
890
890
|
if (source !== ignore) runTop(source);
|
|
891
|
-
} else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING)
|
|
891
|
+
} else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookUpstream(source, ignore);
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
894
|
}
|
|
895
|
-
function
|
|
895
|
+
function markDownstream(node) {
|
|
896
896
|
const runningTransition = Transition && Transition.running;
|
|
897
897
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
898
898
|
const o = node.observers[i];
|
|
899
899
|
if (!runningTransition && !o.state || runningTransition && !o.tState) {
|
|
900
900
|
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
901
901
|
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
902
|
-
o.observers &&
|
|
902
|
+
o.observers && markDownstream(o);
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
905
|
}
|
|
@@ -1422,6 +1422,7 @@ function ErrorBoundary(props) {
|
|
|
1422
1422
|
return createMemo(() => {
|
|
1423
1423
|
if ((e = errored()) != null) {
|
|
1424
1424
|
const f = props.fallback;
|
|
1425
|
+
if ((typeof f !== "function" || f.length == 0)) console.error(e);
|
|
1425
1426
|
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored(null))) : f;
|
|
1426
1427
|
}
|
|
1427
1428
|
onError(setErrored);
|
package/dist/server.cjs
CHANGED
|
@@ -331,16 +331,16 @@ function ErrorBoundary(props) {
|
|
|
331
331
|
}
|
|
332
332
|
const SuspenseContext = createContext();
|
|
333
333
|
let resourceContext = null;
|
|
334
|
-
function createResource(
|
|
334
|
+
function createResource(source, fetcher, options = {}) {
|
|
335
335
|
if (arguments.length === 2) {
|
|
336
336
|
if (typeof fetcher === "object") {
|
|
337
337
|
options = fetcher;
|
|
338
|
-
fetcher =
|
|
339
|
-
|
|
338
|
+
fetcher = source;
|
|
339
|
+
source = true;
|
|
340
340
|
}
|
|
341
341
|
} else if (arguments.length === 1) {
|
|
342
|
-
fetcher =
|
|
343
|
-
|
|
342
|
+
fetcher = source;
|
|
343
|
+
source = true;
|
|
344
344
|
}
|
|
345
345
|
const contexts = new Set();
|
|
346
346
|
const id = sharedConfig.context.id + sharedConfig.context.count++;
|
|
@@ -372,23 +372,27 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
372
372
|
read.error = undefined;
|
|
373
373
|
function load() {
|
|
374
374
|
const ctx = sharedConfig.context;
|
|
375
|
-
if (!ctx.async) return read.loading = !!(typeof
|
|
375
|
+
if (!ctx.async) return read.loading = !!(typeof source === "function" ? source() : source);
|
|
376
376
|
if (ctx.resources && id in ctx.resources && ctx.resources[id].data) {
|
|
377
377
|
value = ctx.resources[id].data;
|
|
378
378
|
return;
|
|
379
379
|
}
|
|
380
380
|
resourceContext = [];
|
|
381
|
-
const lookup = typeof
|
|
381
|
+
const lookup = typeof source === "function" ? source() : source;
|
|
382
382
|
if (resourceContext.length) {
|
|
383
|
-
p = Promise.all(resourceContext).then(() => fetcher(
|
|
383
|
+
p = Promise.all(resourceContext).then(() => fetcher(source(), {
|
|
384
|
+
value
|
|
385
|
+
}));
|
|
384
386
|
}
|
|
385
387
|
resourceContext = null;
|
|
386
388
|
if (!p) {
|
|
387
389
|
if (lookup == null || lookup === false) return;
|
|
388
|
-
p = fetcher(lookup,
|
|
390
|
+
p = fetcher(lookup, {
|
|
391
|
+
value
|
|
392
|
+
});
|
|
389
393
|
}
|
|
390
|
-
|
|
391
|
-
|
|
394
|
+
if (p && "then" in p) {
|
|
395
|
+
read.loading = true;
|
|
392
396
|
if (ctx.writeResource) ctx.writeResource(id, p);
|
|
393
397
|
return p.then(res => {
|
|
394
398
|
read.loading = false;
|
package/dist/server.js
CHANGED
|
@@ -327,16 +327,16 @@ function ErrorBoundary(props) {
|
|
|
327
327
|
}
|
|
328
328
|
const SuspenseContext = createContext();
|
|
329
329
|
let resourceContext = null;
|
|
330
|
-
function createResource(
|
|
330
|
+
function createResource(source, fetcher, options = {}) {
|
|
331
331
|
if (arguments.length === 2) {
|
|
332
332
|
if (typeof fetcher === "object") {
|
|
333
333
|
options = fetcher;
|
|
334
|
-
fetcher =
|
|
335
|
-
|
|
334
|
+
fetcher = source;
|
|
335
|
+
source = true;
|
|
336
336
|
}
|
|
337
337
|
} else if (arguments.length === 1) {
|
|
338
|
-
fetcher =
|
|
339
|
-
|
|
338
|
+
fetcher = source;
|
|
339
|
+
source = true;
|
|
340
340
|
}
|
|
341
341
|
const contexts = new Set();
|
|
342
342
|
const id = sharedConfig.context.id + sharedConfig.context.count++;
|
|
@@ -368,23 +368,27 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
368
368
|
read.error = undefined;
|
|
369
369
|
function load() {
|
|
370
370
|
const ctx = sharedConfig.context;
|
|
371
|
-
if (!ctx.async) return read.loading = !!(typeof
|
|
371
|
+
if (!ctx.async) return read.loading = !!(typeof source === "function" ? source() : source);
|
|
372
372
|
if (ctx.resources && id in ctx.resources && ctx.resources[id].data) {
|
|
373
373
|
value = ctx.resources[id].data;
|
|
374
374
|
return;
|
|
375
375
|
}
|
|
376
376
|
resourceContext = [];
|
|
377
|
-
const lookup = typeof
|
|
377
|
+
const lookup = typeof source === "function" ? source() : source;
|
|
378
378
|
if (resourceContext.length) {
|
|
379
|
-
p = Promise.all(resourceContext).then(() => fetcher(
|
|
379
|
+
p = Promise.all(resourceContext).then(() => fetcher(source(), {
|
|
380
|
+
value
|
|
381
|
+
}));
|
|
380
382
|
}
|
|
381
383
|
resourceContext = null;
|
|
382
384
|
if (!p) {
|
|
383
385
|
if (lookup == null || lookup === false) return;
|
|
384
|
-
p = fetcher(lookup,
|
|
386
|
+
p = fetcher(lookup, {
|
|
387
|
+
value
|
|
388
|
+
});
|
|
385
389
|
}
|
|
386
|
-
|
|
387
|
-
|
|
390
|
+
if (p && "then" in p) {
|
|
391
|
+
read.loading = true;
|
|
388
392
|
if (ctx.writeResource) ctx.writeResource(id, p);
|
|
389
393
|
return p.then(res => {
|
|
390
394
|
read.loading = false;
|
package/dist/solid.cjs
CHANGED
|
@@ -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) :
|
|
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)
|
|
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
|
|
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
|
-
|
|
731
|
+
lookUpstream(node, ancestors[0]);
|
|
732
732
|
Updates = updates;
|
|
733
733
|
}
|
|
734
734
|
}
|
|
@@ -826,7 +826,7 @@ function runUserEffects(queue) {
|
|
|
826
826
|
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
827
827
|
for (i = resume; i < queue.length; i++) runTop(queue[i]);
|
|
828
828
|
}
|
|
829
|
-
function
|
|
829
|
+
function lookUpstream(node, ignore) {
|
|
830
830
|
const runningTransition = Transition && Transition.running;
|
|
831
831
|
if (runningTransition) node.tState = 0;else node.state = 0;
|
|
832
832
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
@@ -834,18 +834,18 @@ function lookDownstream(node, ignore) {
|
|
|
834
834
|
if (source.sources) {
|
|
835
835
|
if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
|
|
836
836
|
if (source !== ignore) runTop(source);
|
|
837
|
-
} else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING)
|
|
837
|
+
} else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookUpstream(source, ignore);
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
840
|
}
|
|
841
|
-
function
|
|
841
|
+
function markDownstream(node) {
|
|
842
842
|
const runningTransition = Transition && Transition.running;
|
|
843
843
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
844
844
|
const o = node.observers[i];
|
|
845
845
|
if (!runningTransition && !o.state || runningTransition && !o.tState) {
|
|
846
846
|
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
847
847
|
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
848
|
-
o.observers &&
|
|
848
|
+
o.observers && markDownstream(o);
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
851
|
}
|
package/dist/solid.js
CHANGED
|
@@ -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) :
|
|
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)
|
|
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
|
|
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
|
-
|
|
727
|
+
lookUpstream(node, ancestors[0]);
|
|
728
728
|
Updates = updates;
|
|
729
729
|
}
|
|
730
730
|
}
|
|
@@ -822,7 +822,7 @@ function runUserEffects(queue) {
|
|
|
822
822
|
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
823
823
|
for (i = resume; i < queue.length; i++) runTop(queue[i]);
|
|
824
824
|
}
|
|
825
|
-
function
|
|
825
|
+
function lookUpstream(node, ignore) {
|
|
826
826
|
const runningTransition = Transition && Transition.running;
|
|
827
827
|
if (runningTransition) node.tState = 0;else node.state = 0;
|
|
828
828
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
@@ -830,18 +830,18 @@ function lookDownstream(node, ignore) {
|
|
|
830
830
|
if (source.sources) {
|
|
831
831
|
if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
|
|
832
832
|
if (source !== ignore) runTop(source);
|
|
833
|
-
} else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING)
|
|
833
|
+
} else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookUpstream(source, ignore);
|
|
834
834
|
}
|
|
835
835
|
}
|
|
836
836
|
}
|
|
837
|
-
function
|
|
837
|
+
function markDownstream(node) {
|
|
838
838
|
const runningTransition = Transition && Transition.running;
|
|
839
839
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
840
840
|
const o = node.observers[i];
|
|
841
841
|
if (!runningTransition && !o.state || runningTransition && !o.tState) {
|
|
842
842
|
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
843
843
|
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
844
|
-
o.observers &&
|
|
844
|
+
o.observers && markDownstream(o);
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
847
|
}
|
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.
|
|
4
|
+
"version": "1.3.14",
|
|
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": "
|
|
147
|
+
"gitHead": "9a41feafea10717e785c603eadb96c6133cd2988"
|
|
148
148
|
}
|
package/store/types/index.d.ts
CHANGED
|
@@ -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
|
|
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<
|
|
7
|
+
export declare function produce<T>(fn: (state: DeepMutable<T>) => void): (state: T) => T;
|
package/store/types/store.d.ts
CHANGED
|
@@ -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
|
|
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]:
|
|
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]:
|
|
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[] | (
|
|
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 :
|
|
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
|
-
|
|
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
|
-
|
|
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 ?
|
|
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;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { Accessor, Setter } from "../reactive/signal";
|
|
2
1
|
export declare const equalFn: <T>(a: T, b: T) => boolean;
|
|
3
2
|
export declare const $PROXY: unique symbol;
|
|
4
3
|
export declare const $DEVCOMP: unique symbol;
|
|
5
4
|
export declare const DEV: {};
|
|
5
|
+
export declare type Accessor<T> = () => T;
|
|
6
|
+
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;
|
|
6
7
|
export declare let Owner: Owner | null;
|
|
7
8
|
interface Owner {
|
|
8
9
|
owner: Owner | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Setter } from "./reactive";
|
|
1
2
|
import type { JSX } from "../jsx";
|
|
2
3
|
declare type PropsWithChildren<P> = P & {
|
|
3
4
|
children?: JSX.Element;
|
|
@@ -72,19 +73,32 @@ declare type SuspenseContextType = {
|
|
|
72
73
|
}>;
|
|
73
74
|
completed: () => void;
|
|
74
75
|
};
|
|
75
|
-
declare type
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export declare
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
export declare type ResourceActions<T> = {
|
|
77
|
+
mutate: Setter<T>;
|
|
78
|
+
refetch: (info?: unknown) => void;
|
|
79
|
+
};
|
|
80
|
+
export declare type ResourceReturn<T> = [Resource<T>, ResourceActions<T>];
|
|
81
|
+
export declare type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
|
|
82
|
+
export declare type ResourceFetcher<S, T> = (k: S, info: ResourceFetcherInfo<T>) => T | Promise<T>;
|
|
83
|
+
export declare type ResourceFetcherInfo<T> = {
|
|
84
|
+
value: T | undefined;
|
|
85
|
+
refetching?: unknown;
|
|
86
|
+
};
|
|
87
|
+
export declare type ResourceOptions<T> = undefined extends T ? {
|
|
86
88
|
initialValue?: T;
|
|
87
|
-
|
|
89
|
+
name?: string;
|
|
90
|
+
globalRefetch?: boolean;
|
|
91
|
+
onHydrated?: <S, T>(k: S, info: ResourceFetcherInfo<T>) => void;
|
|
92
|
+
} : {
|
|
93
|
+
initialValue: T;
|
|
94
|
+
name?: string;
|
|
95
|
+
globalRefetch?: boolean;
|
|
96
|
+
onHydrated?: <S, T>(k: S, info: ResourceFetcherInfo<T>) => void;
|
|
97
|
+
};
|
|
98
|
+
export declare function createResource<T, S = true>(fetcher: ResourceFetcher<S, T>, options?: ResourceOptions<undefined>): ResourceReturn<T | undefined>;
|
|
99
|
+
export declare function createResource<T, S = true>(fetcher: ResourceFetcher<S, T>, options: ResourceOptions<T>): ResourceReturn<T>;
|
|
100
|
+
export declare function createResource<T, S>(source: ResourceSource<S>, fetcher: ResourceFetcher<S, T>, options?: ResourceOptions<undefined>): ResourceReturn<T | undefined>;
|
|
101
|
+
export declare function createResource<T, S>(source: ResourceSource<S>, fetcher: ResourceFetcher<S, T>, options: ResourceOptions<T>): ResourceReturn<T>;
|
|
88
102
|
export declare function refetchResources(info?: unknown): void;
|
|
89
103
|
export declare function lazy(fn: () => Promise<{
|
|
90
104
|
default: any;
|
package/universal/dist/dev.cjs
CHANGED
|
@@ -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
|
-
|
|
206
|
-
|
|
207
|
-
prevProps[prop] = value;
|
|
208
|
-
}
|
|
207
|
+
setProperty(node, prop, value, prevProps[prop]);
|
|
208
|
+
prevProps[prop] = value;
|
|
209
209
|
}
|
|
210
210
|
});
|
|
211
211
|
return prevProps;
|
package/universal/dist/dev.js
CHANGED
|
@@ -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
|
-
|
|
202
|
-
|
|
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
|
-
|
|
206
|
-
|
|
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
|
-
|
|
202
|
-
|
|
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
|
-
|
|
170
|
-
typeof
|
|
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
|
-
|
|
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:") {
|
|
@@ -343,10 +348,12 @@ function eventHandler(e) {
|
|
|
343
348
|
}
|
|
344
349
|
}
|
|
345
350
|
function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
351
|
+
props || (props = {});
|
|
346
352
|
if (!skipChildren && "children" in props) {
|
|
347
353
|
solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
348
354
|
}
|
|
349
|
-
|
|
355
|
+
props.ref && props.ref(node);
|
|
356
|
+
solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
350
357
|
return prevProps;
|
|
351
358
|
}
|
|
352
359
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
@@ -357,6 +364,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
357
364
|
multi = marker !== undefined;
|
|
358
365
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
359
366
|
if (t === "string" || t === "number") {
|
|
367
|
+
if (solidJs.sharedConfig.context) return current;
|
|
360
368
|
if (t === "number") value = value.toString();
|
|
361
369
|
if (multi) {
|
|
362
370
|
let node = current[0];
|
|
@@ -460,7 +468,7 @@ function gatherHydratable(element, root) {
|
|
|
460
468
|
for (let i = 0; i < templates.length; i++) {
|
|
461
469
|
const node = templates[i];
|
|
462
470
|
const key = node.getAttribute("data-hk");
|
|
463
|
-
if (!root || key.startsWith(root)) solidJs.sharedConfig.registry.set(key, node);
|
|
471
|
+
if ((!root || key.startsWith(root)) && !solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
|
|
464
472
|
}
|
|
465
473
|
}
|
|
466
474
|
function getHydrationKey() {
|
|
@@ -474,9 +482,19 @@ function NoHydration(props) {
|
|
|
474
482
|
return solidJs.sharedConfig.context ? undefined : props.children;
|
|
475
483
|
}
|
|
476
484
|
|
|
477
|
-
function
|
|
478
|
-
|
|
479
|
-
|
|
485
|
+
function throwInBrowser(func) {
|
|
486
|
+
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
487
|
+
console.error(err);
|
|
488
|
+
}
|
|
489
|
+
function renderToString(fn, options) {
|
|
490
|
+
throwInBrowser(renderToString);
|
|
491
|
+
}
|
|
492
|
+
function renderToStringAsync(fn, options) {
|
|
493
|
+
throwInBrowser(renderToStringAsync);
|
|
494
|
+
}
|
|
495
|
+
function renderToStream(fn, options) {
|
|
496
|
+
throwInBrowser(renderToStream);
|
|
497
|
+
}
|
|
480
498
|
function ssr(template, ...nodes) {}
|
|
481
499
|
function resolveSSRNode(node) {}
|
|
482
500
|
function ssrClassList(value) {}
|
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
|
-
|
|
167
|
-
typeof
|
|
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
|
-
|
|
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:") {
|
|
@@ -340,10 +345,12 @@ function eventHandler(e) {
|
|
|
340
345
|
}
|
|
341
346
|
}
|
|
342
347
|
function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
348
|
+
props || (props = {});
|
|
343
349
|
if (!skipChildren && "children" in props) {
|
|
344
350
|
createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
345
351
|
}
|
|
346
|
-
|
|
352
|
+
props.ref && props.ref(node);
|
|
353
|
+
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
347
354
|
return prevProps;
|
|
348
355
|
}
|
|
349
356
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
@@ -354,6 +361,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
354
361
|
multi = marker !== undefined;
|
|
355
362
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
356
363
|
if (t === "string" || t === "number") {
|
|
364
|
+
if (sharedConfig.context) return current;
|
|
357
365
|
if (t === "number") value = value.toString();
|
|
358
366
|
if (multi) {
|
|
359
367
|
let node = current[0];
|
|
@@ -457,7 +465,7 @@ function gatherHydratable(element, root) {
|
|
|
457
465
|
for (let i = 0; i < templates.length; i++) {
|
|
458
466
|
const node = templates[i];
|
|
459
467
|
const key = node.getAttribute("data-hk");
|
|
460
|
-
if (!root || key.startsWith(root)) sharedConfig.registry.set(key, node);
|
|
468
|
+
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
|
|
461
469
|
}
|
|
462
470
|
}
|
|
463
471
|
function getHydrationKey() {
|
|
@@ -471,9 +479,19 @@ function NoHydration(props) {
|
|
|
471
479
|
return sharedConfig.context ? undefined : props.children;
|
|
472
480
|
}
|
|
473
481
|
|
|
474
|
-
function
|
|
475
|
-
|
|
476
|
-
|
|
482
|
+
function throwInBrowser(func) {
|
|
483
|
+
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
484
|
+
console.error(err);
|
|
485
|
+
}
|
|
486
|
+
function renderToString(fn, options) {
|
|
487
|
+
throwInBrowser(renderToString);
|
|
488
|
+
}
|
|
489
|
+
function renderToStringAsync(fn, options) {
|
|
490
|
+
throwInBrowser(renderToStringAsync);
|
|
491
|
+
}
|
|
492
|
+
function renderToStream(fn, options) {
|
|
493
|
+
throwInBrowser(renderToStream);
|
|
494
|
+
}
|
|
477
495
|
function ssr(template, ...nodes) {}
|
|
478
496
|
function resolveSSRNode(node) {}
|
|
479
497
|
function ssrClassList(value) {}
|
package/web/dist/server.cjs
CHANGED
|
@@ -233,7 +233,7 @@ function stringifyString(str) {
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
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)}`;
|
|
236
|
-
const FRAGMENT_REPLACE = /<!\[([\d
|
|
236
|
+
const FRAGMENT_REPLACE = /<!\[([\d-]+)\]>/;
|
|
237
237
|
function renderToString(code, options = {}) {
|
|
238
238
|
let scripts = "";
|
|
239
239
|
solidJs.sharedConfig.context = {
|
|
@@ -604,7 +604,19 @@ function injectScripts(html, scripts, nonce) {
|
|
|
604
604
|
return html + tag;
|
|
605
605
|
}
|
|
606
606
|
function serializeError(error) {
|
|
607
|
-
|
|
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()) {
|
package/web/dist/server.js
CHANGED
|
@@ -230,7 +230,7 @@ function stringifyString(str) {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
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)}`;
|
|
233
|
-
const FRAGMENT_REPLACE = /<!\[([\d
|
|
233
|
+
const FRAGMENT_REPLACE = /<!\[([\d-]+)\]>/;
|
|
234
234
|
function renderToString(code, options = {}) {
|
|
235
235
|
let scripts = "";
|
|
236
236
|
sharedConfig.context = {
|
|
@@ -601,7 +601,19 @@ function injectScripts(html, scripts, nonce) {
|
|
|
601
601
|
return html + tag;
|
|
602
602
|
}
|
|
603
603
|
function serializeError(error) {
|
|
604
|
-
|
|
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()) {
|
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
|
-
|
|
169
|
-
typeof
|
|
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
|
-
|
|
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:") {
|
|
@@ -342,10 +347,12 @@ function eventHandler(e) {
|
|
|
342
347
|
}
|
|
343
348
|
}
|
|
344
349
|
function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
350
|
+
props || (props = {});
|
|
345
351
|
if (!skipChildren && "children" in props) {
|
|
346
352
|
solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
347
353
|
}
|
|
348
|
-
|
|
354
|
+
props.ref && props.ref(node);
|
|
355
|
+
solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
349
356
|
return prevProps;
|
|
350
357
|
}
|
|
351
358
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
@@ -356,6 +363,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
356
363
|
multi = marker !== undefined;
|
|
357
364
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
358
365
|
if (t === "string" || t === "number") {
|
|
366
|
+
if (solidJs.sharedConfig.context) return current;
|
|
359
367
|
if (t === "number") value = value.toString();
|
|
360
368
|
if (multi) {
|
|
361
369
|
let node = current[0];
|
|
@@ -459,7 +467,7 @@ function gatherHydratable(element, root) {
|
|
|
459
467
|
for (let i = 0; i < templates.length; i++) {
|
|
460
468
|
const node = templates[i];
|
|
461
469
|
const key = node.getAttribute("data-hk");
|
|
462
|
-
if (!root || key.startsWith(root)) solidJs.sharedConfig.registry.set(key, node);
|
|
470
|
+
if ((!root || key.startsWith(root)) && !solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
|
|
463
471
|
}
|
|
464
472
|
}
|
|
465
473
|
function getHydrationKey() {
|
|
@@ -473,9 +481,19 @@ function NoHydration(props) {
|
|
|
473
481
|
return solidJs.sharedConfig.context ? undefined : props.children;
|
|
474
482
|
}
|
|
475
483
|
|
|
476
|
-
function
|
|
477
|
-
|
|
478
|
-
|
|
484
|
+
function throwInBrowser(func) {
|
|
485
|
+
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
486
|
+
console.error(err);
|
|
487
|
+
}
|
|
488
|
+
function renderToString(fn, options) {
|
|
489
|
+
throwInBrowser(renderToString);
|
|
490
|
+
}
|
|
491
|
+
function renderToStringAsync(fn, options) {
|
|
492
|
+
throwInBrowser(renderToStringAsync);
|
|
493
|
+
}
|
|
494
|
+
function renderToStream(fn, options) {
|
|
495
|
+
throwInBrowser(renderToStream);
|
|
496
|
+
}
|
|
479
497
|
function ssr(template, ...nodes) {}
|
|
480
498
|
function resolveSSRNode(node) {}
|
|
481
499
|
function ssrClassList(value) {}
|
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
|
-
|
|
166
|
-
typeof
|
|
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
|
-
|
|
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:") {
|
|
@@ -339,10 +344,12 @@ function eventHandler(e) {
|
|
|
339
344
|
}
|
|
340
345
|
}
|
|
341
346
|
function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
347
|
+
props || (props = {});
|
|
342
348
|
if (!skipChildren && "children" in props) {
|
|
343
349
|
createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
344
350
|
}
|
|
345
|
-
|
|
351
|
+
props.ref && props.ref(node);
|
|
352
|
+
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
346
353
|
return prevProps;
|
|
347
354
|
}
|
|
348
355
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
@@ -353,6 +360,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
353
360
|
multi = marker !== undefined;
|
|
354
361
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
355
362
|
if (t === "string" || t === "number") {
|
|
363
|
+
if (sharedConfig.context) return current;
|
|
356
364
|
if (t === "number") value = value.toString();
|
|
357
365
|
if (multi) {
|
|
358
366
|
let node = current[0];
|
|
@@ -456,7 +464,7 @@ function gatherHydratable(element, root) {
|
|
|
456
464
|
for (let i = 0; i < templates.length; i++) {
|
|
457
465
|
const node = templates[i];
|
|
458
466
|
const key = node.getAttribute("data-hk");
|
|
459
|
-
if (!root || key.startsWith(root)) sharedConfig.registry.set(key, node);
|
|
467
|
+
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
|
|
460
468
|
}
|
|
461
469
|
}
|
|
462
470
|
function getHydrationKey() {
|
|
@@ -470,9 +478,19 @@ function NoHydration(props) {
|
|
|
470
478
|
return sharedConfig.context ? undefined : props.children;
|
|
471
479
|
}
|
|
472
480
|
|
|
473
|
-
function
|
|
474
|
-
|
|
475
|
-
|
|
481
|
+
function throwInBrowser(func) {
|
|
482
|
+
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
483
|
+
console.error(err);
|
|
484
|
+
}
|
|
485
|
+
function renderToString(fn, options) {
|
|
486
|
+
throwInBrowser(renderToString);
|
|
487
|
+
}
|
|
488
|
+
function renderToStringAsync(fn, options) {
|
|
489
|
+
throwInBrowser(renderToStringAsync);
|
|
490
|
+
}
|
|
491
|
+
function renderToStream(fn, options) {
|
|
492
|
+
throwInBrowser(renderToStream);
|
|
493
|
+
}
|
|
476
494
|
function ssr(template, ...nodes) {}
|
|
477
495
|
function resolveSSRNode(node) {}
|
|
478
496
|
function ssrClassList(value) {}
|
|
@@ -10,8 +10,12 @@ export declare function renderToStringAsync<T>(fn: () => T, options?: {
|
|
|
10
10
|
export declare function renderToStream<T>(fn: () => T, options?: {
|
|
11
11
|
nonce?: string;
|
|
12
12
|
renderId?: string;
|
|
13
|
-
onCompleteShell?: (
|
|
14
|
-
|
|
13
|
+
onCompleteShell?: (info: {
|
|
14
|
+
write: (v: string) => void;
|
|
15
|
+
}) => void;
|
|
16
|
+
onCompleteAll?: (info: {
|
|
17
|
+
write: (v: string) => void;
|
|
18
|
+
}) => void;
|
|
15
19
|
}): {
|
|
16
20
|
pipe: (writable: {
|
|
17
21
|
write: (v: string) => void;
|