solid-js 1.6.7 → 1.6.9
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 +140 -127
- package/dist/dev.js +140 -127
- package/dist/server.cjs +35 -40
- package/dist/server.js +35 -40
- package/dist/solid.cjs +126 -115
- package/dist/solid.js +126 -115
- package/h/dist/h.cjs +4 -4
- package/h/dist/h.js +4 -4
- package/h/types/hyperscript.d.ts +3 -3
- package/html/dist/html.cjs +34 -35
- package/html/dist/html.js +34 -35
- package/html/types/lit.d.ts +2 -2
- package/package.json +1 -1
- package/store/dist/dev.cjs +16 -16
- package/store/dist/dev.js +16 -16
- package/store/dist/server.cjs +3 -3
- package/store/dist/server.js +3 -3
- package/store/dist/store.cjs +16 -16
- package/store/dist/store.js +16 -16
- package/types/reactive/signal.d.ts +9 -8
- package/types/server/rendering.d.ts +1 -0
- package/universal/dist/dev.cjs +10 -10
- package/universal/dist/dev.js +10 -10
- package/universal/dist/universal.cjs +10 -10
- package/universal/dist/universal.js +10 -10
- package/web/dist/dev.cjs +29 -22
- package/web/dist/dev.js +29 -22
- package/web/dist/server.cjs +14 -20
- package/web/dist/server.js +14 -20
- package/web/dist/web.cjs +29 -22
- package/web/dist/web.js +29 -22
package/dist/server.js
CHANGED
|
@@ -23,10 +23,10 @@ let Owner = null;
|
|
|
23
23
|
function createRoot(fn, detachedOwner) {
|
|
24
24
|
detachedOwner && (Owner = detachedOwner);
|
|
25
25
|
const owner = Owner,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
root = fn.length === 0 ? UNOWNED : {
|
|
27
|
+
context: null,
|
|
28
|
+
owner
|
|
29
|
+
};
|
|
30
30
|
Owner = root;
|
|
31
31
|
let result;
|
|
32
32
|
try {
|
|
@@ -262,7 +262,8 @@ function setHydrateContext(context) {
|
|
|
262
262
|
sharedConfig.context = context;
|
|
263
263
|
}
|
|
264
264
|
function nextHydrateContext() {
|
|
265
|
-
return sharedConfig.context ? {
|
|
265
|
+
return sharedConfig.context ? {
|
|
266
|
+
...sharedConfig.context,
|
|
266
267
|
id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
|
|
267
268
|
count: 0
|
|
268
269
|
} : undefined;
|
|
@@ -309,23 +310,23 @@ function mergeProps(...sources) {
|
|
|
309
310
|
}
|
|
310
311
|
function splitProps(props, ...keys) {
|
|
311
312
|
const descriptors = Object.getOwnPropertyDescriptors(props),
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
313
|
+
split = k => {
|
|
314
|
+
const clone = {};
|
|
315
|
+
for (let i = 0; i < k.length; i++) {
|
|
316
|
+
const key = k[i];
|
|
317
|
+
if (descriptors[key]) {
|
|
318
|
+
Object.defineProperty(clone, key, descriptors[key]);
|
|
319
|
+
delete descriptors[key];
|
|
320
|
+
}
|
|
319
321
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
};
|
|
322
|
+
return clone;
|
|
323
|
+
};
|
|
323
324
|
return keys.map(split).concat(split(Object.keys(descriptors)));
|
|
324
325
|
}
|
|
325
326
|
function simpleMap(props, wrap) {
|
|
326
327
|
const list = props.each || [],
|
|
327
|
-
|
|
328
|
-
|
|
328
|
+
len = list.length,
|
|
329
|
+
fn = props.children;
|
|
329
330
|
if (len) {
|
|
330
331
|
let mapped = Array(len);
|
|
331
332
|
for (let i = 0; i < len; i++) mapped[i] = wrap(fn, list[i], i);
|
|
@@ -361,15 +362,16 @@ function Match(props) {
|
|
|
361
362
|
function resetErrorBoundaries() {}
|
|
362
363
|
function ErrorBoundary(props) {
|
|
363
364
|
let error,
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
res,
|
|
366
|
+
clean,
|
|
367
|
+
sync = true;
|
|
367
368
|
const ctx = sharedConfig.context;
|
|
368
369
|
const id = ctx.id + ctx.count;
|
|
369
370
|
function displayFallback() {
|
|
370
371
|
cleanNode(clean);
|
|
371
372
|
ctx.writeResource(id, error, true);
|
|
372
|
-
setHydrateContext({
|
|
373
|
+
setHydrateContext({
|
|
374
|
+
...ctx,
|
|
373
375
|
count: 0
|
|
374
376
|
});
|
|
375
377
|
const f = props.fallback;
|
|
@@ -492,31 +494,21 @@ function createResource(source, fetcher, options = {}) {
|
|
|
492
494
|
}];
|
|
493
495
|
}
|
|
494
496
|
function lazy(fn) {
|
|
495
|
-
let resolved;
|
|
496
497
|
let p;
|
|
497
498
|
let load = id => {
|
|
498
499
|
if (!p) {
|
|
499
|
-
if (id) {
|
|
500
|
-
let ref = sharedConfig.context.resources[id] = {
|
|
501
|
-
ref: p = fn()
|
|
502
|
-
};
|
|
503
|
-
p.then(mod => ref.data = resolved = mod.default);
|
|
504
|
-
return p;
|
|
505
|
-
}
|
|
506
500
|
p = fn();
|
|
507
|
-
p.then(mod => resolved = mod.default);
|
|
501
|
+
p.then(mod => p.resolved = mod.default);
|
|
502
|
+
if (id) sharedConfig.context.lazy[id] = p;
|
|
508
503
|
}
|
|
509
504
|
return p;
|
|
510
505
|
};
|
|
511
506
|
const contexts = new Set();
|
|
512
507
|
const wrap = props => {
|
|
513
508
|
const id = sharedConfig.context.id.slice(0, -1);
|
|
514
|
-
let ref = sharedConfig.context.
|
|
515
|
-
if (ref)
|
|
516
|
-
|
|
517
|
-
resolved = ref.data;
|
|
518
|
-
} else load(id);
|
|
519
|
-
if (resolved) return resolved(props);
|
|
509
|
+
let ref = sharedConfig.context.lazy[id];
|
|
510
|
+
if (ref) p = ref;else load(id);
|
|
511
|
+
if (p.resolved) return p.resolved(props);
|
|
520
512
|
const ctx = useContext(SuspenseContext);
|
|
521
513
|
const track = {
|
|
522
514
|
loading: true,
|
|
@@ -586,7 +578,8 @@ function Suspense(props) {
|
|
|
586
578
|
}
|
|
587
579
|
});
|
|
588
580
|
function runSuspense() {
|
|
589
|
-
setHydrateContext({
|
|
581
|
+
setHydrateContext({
|
|
582
|
+
...ctx,
|
|
590
583
|
count: 0
|
|
591
584
|
});
|
|
592
585
|
return runWithOwner(o, () => {
|
|
@@ -610,18 +603,20 @@ function Suspense(props) {
|
|
|
610
603
|
});
|
|
611
604
|
done = ctx.async ? ctx.registerFragment(id) : undefined;
|
|
612
605
|
if (ctx.async) {
|
|
613
|
-
setHydrateContext({
|
|
606
|
+
setHydrateContext({
|
|
607
|
+
...ctx,
|
|
614
608
|
count: 0,
|
|
615
609
|
id: ctx.id + "0.f",
|
|
616
610
|
noHydrate: true
|
|
617
611
|
});
|
|
618
612
|
const res = {
|
|
619
|
-
t: `<
|
|
613
|
+
t: `<template id="pl-${id}"></template>${resolveSSRNode(props.fallback)}<!pl-${id}>`
|
|
620
614
|
};
|
|
621
615
|
setHydrateContext(ctx);
|
|
622
616
|
return res;
|
|
623
617
|
}
|
|
624
|
-
setHydrateContext({
|
|
618
|
+
setHydrateContext({
|
|
619
|
+
...ctx,
|
|
625
620
|
count: 0,
|
|
626
621
|
id: ctx.id + "0.f"
|
|
627
622
|
});
|
package/dist/solid.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
let taskIdCounter = 1,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
isCallbackScheduled = false,
|
|
5
|
+
isPerformingWork = false,
|
|
6
|
+
taskQueue = [],
|
|
7
|
+
currentTask = null,
|
|
8
|
+
shouldYieldToHost = null,
|
|
9
|
+
yieldInterval = 5,
|
|
10
|
+
deadline = 0,
|
|
11
|
+
maxYieldInterval = 300,
|
|
12
|
+
scheduleCallback = null,
|
|
13
|
+
scheduledCallback = null;
|
|
14
14
|
const maxSigned31BitInt = 1073741823;
|
|
15
15
|
function setupScheduler() {
|
|
16
16
|
const channel = new MessageChannel(),
|
|
17
|
-
|
|
17
|
+
port = channel.port2;
|
|
18
18
|
scheduleCallback = () => port.postMessage(null);
|
|
19
19
|
channel.port1.onmessage = () => {
|
|
20
20
|
if (scheduledCallback !== null) {
|
|
@@ -65,7 +65,7 @@ function enqueue(taskQueue, task) {
|
|
|
65
65
|
function requestCallback(fn, options) {
|
|
66
66
|
if (!scheduleCallback) setupScheduler();
|
|
67
67
|
let startTime = performance.now(),
|
|
68
|
-
|
|
68
|
+
timeout = maxSigned31BitInt;
|
|
69
69
|
if (options && options.timeout) timeout = options.timeout;
|
|
70
70
|
const newTask = {
|
|
71
71
|
id: taskIdCounter++,
|
|
@@ -121,7 +121,8 @@ function setHydrateContext(context) {
|
|
|
121
121
|
sharedConfig.context = context;
|
|
122
122
|
}
|
|
123
123
|
function nextHydrateContext() {
|
|
124
|
-
return {
|
|
124
|
+
return {
|
|
125
|
+
...sharedConfig.context,
|
|
125
126
|
id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
|
|
126
127
|
count: 0
|
|
127
128
|
};
|
|
@@ -156,15 +157,15 @@ let ExecCount = 0;
|
|
|
156
157
|
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
157
158
|
function createRoot(fn, detachedOwner) {
|
|
158
159
|
const listener = Listener,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
160
|
+
owner = Owner,
|
|
161
|
+
unowned = fn.length === 0,
|
|
162
|
+
root = unowned ? UNOWNED : {
|
|
163
|
+
owned: null,
|
|
164
|
+
cleanups: null,
|
|
165
|
+
context: null,
|
|
166
|
+
owner: detachedOwner || owner
|
|
167
|
+
},
|
|
168
|
+
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
168
169
|
Owner = root;
|
|
169
170
|
Listener = null;
|
|
170
171
|
try {
|
|
@@ -201,7 +202,7 @@ function createRenderEffect(fn, value, options) {
|
|
|
201
202
|
function createEffect(fn, value, options) {
|
|
202
203
|
runEffects = runUserEffects;
|
|
203
204
|
const c = createComputation(fn, value, false, STALE),
|
|
204
|
-
|
|
205
|
+
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
205
206
|
if (s) c.suspense = s;
|
|
206
207
|
c.user = true;
|
|
207
208
|
Effects ? Effects.push(c) : updateComputation(c);
|
|
@@ -209,10 +210,10 @@ function createEffect(fn, value, options) {
|
|
|
209
210
|
function createReaction(onInvalidate, options) {
|
|
210
211
|
let fn;
|
|
211
212
|
const c = createComputation(() => {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
fn ? fn() : untrack(onInvalidate);
|
|
214
|
+
fn = undefined;
|
|
215
|
+
}, undefined, false, 0),
|
|
216
|
+
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
216
217
|
if (s) c.suspense = s;
|
|
217
218
|
c.user = true;
|
|
218
219
|
return tracking => {
|
|
@@ -246,19 +247,19 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
246
247
|
options = pOptions || {};
|
|
247
248
|
}
|
|
248
249
|
let pr = null,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
250
|
+
initP = NO_INIT,
|
|
251
|
+
id = null,
|
|
252
|
+
loadedUnderTransition = false,
|
|
253
|
+
scheduled = false,
|
|
254
|
+
resolved = ("initialValue" in options),
|
|
255
|
+
dynamic = typeof source === "function" && createMemo(source);
|
|
255
256
|
const contexts = new Set(),
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
257
|
+
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
258
|
+
[error, setError] = createSignal(undefined),
|
|
259
|
+
[track, trigger] = createSignal(undefined, {
|
|
260
|
+
equals: false
|
|
261
|
+
}),
|
|
262
|
+
[state, setState] = createSignal(resolved ? "ready" : "unresolved");
|
|
262
263
|
if (sharedConfig.context) {
|
|
263
264
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
264
265
|
let v;
|
|
@@ -294,8 +295,8 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
294
295
|
}
|
|
295
296
|
function read() {
|
|
296
297
|
const c = SuspenseContext && lookup(Owner, SuspenseContext.id),
|
|
297
|
-
|
|
298
|
-
|
|
298
|
+
v = value(),
|
|
299
|
+
err = error();
|
|
299
300
|
if (err && !pr) throw err;
|
|
300
301
|
if (Listener && !Listener.user && c) {
|
|
301
302
|
createComputed(() => {
|
|
@@ -367,7 +368,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
367
368
|
}
|
|
368
369
|
function createDeferred(source, options) {
|
|
369
370
|
let t,
|
|
370
|
-
|
|
371
|
+
timeout = options ? options.timeoutMs : undefined;
|
|
371
372
|
const node = createComputation(() => {
|
|
372
373
|
if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
|
|
373
374
|
timeout
|
|
@@ -614,8 +615,8 @@ function updateComputation(node) {
|
|
|
614
615
|
if (!node.fn) return;
|
|
615
616
|
cleanNode(node);
|
|
616
617
|
const owner = Owner,
|
|
617
|
-
|
|
618
|
-
|
|
618
|
+
listener = Listener,
|
|
619
|
+
time = ExecCount;
|
|
619
620
|
Listener = Owner = node;
|
|
620
621
|
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
621
622
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
@@ -636,7 +637,17 @@ function runComputation(node, value, time) {
|
|
|
636
637
|
try {
|
|
637
638
|
nextValue = node.fn(value);
|
|
638
639
|
} catch (err) {
|
|
639
|
-
if (node.pure)
|
|
640
|
+
if (node.pure) {
|
|
641
|
+
if (Transition && Transition.running) {
|
|
642
|
+
node.tState = STALE;
|
|
643
|
+
node.tOwned && node.tOwned.forEach(cleanNode);
|
|
644
|
+
node.tOwned = undefined;
|
|
645
|
+
} else {
|
|
646
|
+
node.state = STALE;
|
|
647
|
+
node.owned && node.owned.forEach(cleanNode);
|
|
648
|
+
node.owned = null;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
640
651
|
handleError(err);
|
|
641
652
|
}
|
|
642
653
|
if (!node.updatedAt || node.updatedAt <= time) {
|
|
@@ -703,7 +714,7 @@ function runTop(node) {
|
|
|
703
714
|
node = ancestors[i];
|
|
704
715
|
if (runningTransition) {
|
|
705
716
|
let top = node,
|
|
706
|
-
|
|
717
|
+
prev = ancestors[i + 1];
|
|
707
718
|
while ((top = top.owner) && top !== prev) {
|
|
708
719
|
if (Transition.disposed.has(top)) return;
|
|
709
720
|
}
|
|
@@ -800,7 +811,7 @@ function scheduleQueue(queue) {
|
|
|
800
811
|
}
|
|
801
812
|
function runUserEffects(queue) {
|
|
802
813
|
let i,
|
|
803
|
-
|
|
814
|
+
userLength = 0;
|
|
804
815
|
for (i = 0; i < queue.length; i++) {
|
|
805
816
|
const e = queue[i];
|
|
806
817
|
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
@@ -836,11 +847,11 @@ function cleanNode(node) {
|
|
|
836
847
|
if (node.sources) {
|
|
837
848
|
while (node.sources.length) {
|
|
838
849
|
const source = node.sources.pop(),
|
|
839
|
-
|
|
840
|
-
|
|
850
|
+
index = node.sourceSlots.pop(),
|
|
851
|
+
obs = source.observers;
|
|
841
852
|
if (obs && obs.length) {
|
|
842
853
|
const n = obs.pop(),
|
|
843
|
-
|
|
854
|
+
s = source.observerSlots.pop();
|
|
844
855
|
if (index < obs.length) {
|
|
845
856
|
n.sourceSlots[s] = index;
|
|
846
857
|
obs[index] = n;
|
|
@@ -964,27 +975,27 @@ function dispose(d) {
|
|
|
964
975
|
}
|
|
965
976
|
function mapArray(list, mapFn, options = {}) {
|
|
966
977
|
let items = [],
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
978
|
+
mapped = [],
|
|
979
|
+
disposers = [],
|
|
980
|
+
len = 0,
|
|
981
|
+
indexes = mapFn.length > 1 ? [] : null;
|
|
971
982
|
onCleanup(() => dispose(disposers));
|
|
972
983
|
return () => {
|
|
973
984
|
let newItems = list() || [],
|
|
974
|
-
|
|
975
|
-
|
|
985
|
+
i,
|
|
986
|
+
j;
|
|
976
987
|
newItems[$TRACK];
|
|
977
988
|
return untrack(() => {
|
|
978
989
|
let newLen = newItems.length,
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
990
|
+
newIndices,
|
|
991
|
+
newIndicesNext,
|
|
992
|
+
temp,
|
|
993
|
+
tempdisposers,
|
|
994
|
+
tempIndexes,
|
|
995
|
+
start,
|
|
996
|
+
end,
|
|
997
|
+
newEnd,
|
|
998
|
+
item;
|
|
988
999
|
if (newLen === 0) {
|
|
989
1000
|
if (len !== 0) {
|
|
990
1001
|
dispose(disposers);
|
|
@@ -1067,11 +1078,11 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1067
1078
|
}
|
|
1068
1079
|
function indexArray(list, mapFn, options = {}) {
|
|
1069
1080
|
let items = [],
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1081
|
+
mapped = [],
|
|
1082
|
+
disposers = [],
|
|
1083
|
+
signals = [],
|
|
1084
|
+
len = 0,
|
|
1085
|
+
i;
|
|
1075
1086
|
onCleanup(() => dispose(disposers));
|
|
1076
1087
|
return () => {
|
|
1077
1088
|
const newItems = list() || [];
|
|
@@ -1342,20 +1353,20 @@ function Switch(props) {
|
|
|
1342
1353
|
let keyed = false;
|
|
1343
1354
|
const equals = (a, b) => a[0] === b[0] && (strictEqual ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1344
1355
|
const conditions = children(() => props.children),
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1356
|
+
evalConditions = createMemo(() => {
|
|
1357
|
+
let conds = conditions();
|
|
1358
|
+
if (!Array.isArray(conds)) conds = [conds];
|
|
1359
|
+
for (let i = 0; i < conds.length; i++) {
|
|
1360
|
+
const c = conds[i].when;
|
|
1361
|
+
if (c) {
|
|
1362
|
+
keyed = !!conds[i].keyed;
|
|
1363
|
+
return [i, c, conds[i]];
|
|
1364
|
+
}
|
|
1353
1365
|
}
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
});
|
|
1366
|
+
return [-1];
|
|
1367
|
+
}, undefined, {
|
|
1368
|
+
equals
|
|
1369
|
+
});
|
|
1359
1370
|
return createMemo(() => {
|
|
1360
1371
|
const [index, when, cond] = evalConditions();
|
|
1361
1372
|
if (index < 0) return props.fallback;
|
|
@@ -1397,9 +1408,9 @@ const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFa
|
|
|
1397
1408
|
const SuspenseListContext = createContext();
|
|
1398
1409
|
function SuspenseList(props) {
|
|
1399
1410
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1411
|
+
inFallback: false
|
|
1412
|
+
})),
|
|
1413
|
+
show;
|
|
1403
1414
|
const listContext = useContext(SuspenseListContext);
|
|
1404
1415
|
const [registry, setRegistry] = createSignal([]);
|
|
1405
1416
|
if (listContext) {
|
|
@@ -1407,13 +1418,13 @@ function SuspenseList(props) {
|
|
|
1407
1418
|
}
|
|
1408
1419
|
const resolved = createMemo(prev => {
|
|
1409
1420
|
const reveal = props.revealOrder,
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1421
|
+
tail = props.tail,
|
|
1422
|
+
{
|
|
1423
|
+
showContent = true,
|
|
1424
|
+
showFallback = true
|
|
1425
|
+
} = show ? show() : {},
|
|
1426
|
+
reg = registry(),
|
|
1427
|
+
reverse = reveal === "backwards";
|
|
1417
1428
|
if (reveal === "together") {
|
|
1418
1429
|
const all = reg.every(inFallback => !inFallback());
|
|
1419
1430
|
const res = reg.map(() => ({
|
|
@@ -1428,7 +1439,7 @@ function SuspenseList(props) {
|
|
|
1428
1439
|
const res = [];
|
|
1429
1440
|
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1430
1441
|
const n = reverse ? len - i - 1 : i,
|
|
1431
|
-
|
|
1442
|
+
s = reg[n]();
|
|
1432
1443
|
if (!stop && !s) {
|
|
1433
1444
|
res[n] = {
|
|
1434
1445
|
showContent,
|
|
@@ -1471,25 +1482,25 @@ function SuspenseList(props) {
|
|
|
1471
1482
|
}
|
|
1472
1483
|
function Suspense(props) {
|
|
1473
1484
|
let counter = 0,
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1485
|
+
show,
|
|
1486
|
+
ctx,
|
|
1487
|
+
p,
|
|
1488
|
+
flicker,
|
|
1489
|
+
error;
|
|
1479
1490
|
const [inFallback, setFallback] = createSignal(false),
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1491
|
+
SuspenseContext = getSuspenseContext(),
|
|
1492
|
+
store = {
|
|
1493
|
+
increment: () => {
|
|
1494
|
+
if (++counter === 1) setFallback(true);
|
|
1495
|
+
},
|
|
1496
|
+
decrement: () => {
|
|
1497
|
+
if (--counter === 0) setFallback(false);
|
|
1498
|
+
},
|
|
1499
|
+
inFallback,
|
|
1500
|
+
effects: [],
|
|
1501
|
+
resolved: false
|
|
1487
1502
|
},
|
|
1488
|
-
|
|
1489
|
-
effects: [],
|
|
1490
|
-
resolved: false
|
|
1491
|
-
},
|
|
1492
|
-
owner = getOwner();
|
|
1503
|
+
owner = getOwner();
|
|
1493
1504
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1494
1505
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1495
1506
|
let ref = sharedConfig.load(key);
|
|
@@ -1529,10 +1540,10 @@ function Suspense(props) {
|
|
|
1529
1540
|
const rendered = createMemo(() => props.children);
|
|
1530
1541
|
return createMemo(prev => {
|
|
1531
1542
|
const inFallback = store.inFallback(),
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1543
|
+
{
|
|
1544
|
+
showContent = true,
|
|
1545
|
+
showFallback = true
|
|
1546
|
+
} = show ? show() : {};
|
|
1536
1547
|
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1537
1548
|
store.resolved = true;
|
|
1538
1549
|
dispose && dispose();
|