solid-js 1.6.8 → 1.6.10
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 +144 -127
- package/dist/dev.js +144 -127
- package/dist/server.cjs +30 -25
- package/dist/server.js +30 -25
- package/dist/solid.cjs +130 -115
- package/dist/solid.js +130 -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/index.d.ts +1 -1
- package/types/reactive/observable.d.ts +8 -6
- package/types/reactive/signal.d.ts +12 -9
- package/types/render/Suspense.d.ts +2 -2
- package/types/render/flow.d.ts +6 -6
- 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 +12 -20
- package/web/dist/server.js +12 -20
- package/web/dist/web.cjs +29 -22
- package/web/dist/web.js +29 -22
- package/web/types/index.d.ts +3 -3
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;
|
|
@@ -576,7 +578,8 @@ function Suspense(props) {
|
|
|
576
578
|
}
|
|
577
579
|
});
|
|
578
580
|
function runSuspense() {
|
|
579
|
-
setHydrateContext({
|
|
581
|
+
setHydrateContext({
|
|
582
|
+
...ctx,
|
|
580
583
|
count: 0
|
|
581
584
|
});
|
|
582
585
|
return runWithOwner(o, () => {
|
|
@@ -600,18 +603,20 @@ function Suspense(props) {
|
|
|
600
603
|
});
|
|
601
604
|
done = ctx.async ? ctx.registerFragment(id) : undefined;
|
|
602
605
|
if (ctx.async) {
|
|
603
|
-
setHydrateContext({
|
|
606
|
+
setHydrateContext({
|
|
607
|
+
...ctx,
|
|
604
608
|
count: 0,
|
|
605
609
|
id: ctx.id + "0.f",
|
|
606
610
|
noHydrate: true
|
|
607
611
|
});
|
|
608
612
|
const res = {
|
|
609
|
-
t: `<
|
|
613
|
+
t: `<template id="pl-${id}"></template>${resolveSSRNode(props.fallback)}<!pl-${id}>`
|
|
610
614
|
};
|
|
611
615
|
setHydrateContext(ctx);
|
|
612
616
|
return res;
|
|
613
617
|
}
|
|
614
|
-
setHydrateContext({
|
|
618
|
+
setHydrateContext({
|
|
619
|
+
...ctx,
|
|
615
620
|
count: 0,
|
|
616
621
|
id: ctx.id + "0.f"
|
|
617
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
|
|
@@ -457,13 +458,16 @@ function getOwner() {
|
|
|
457
458
|
}
|
|
458
459
|
function runWithOwner(o, fn) {
|
|
459
460
|
const prev = Owner;
|
|
461
|
+
const prevListener = Listener;
|
|
460
462
|
Owner = o;
|
|
463
|
+
Listener = null;
|
|
461
464
|
try {
|
|
462
465
|
return runUpdates(fn, true);
|
|
463
466
|
} catch (err) {
|
|
464
467
|
handleError(err);
|
|
465
468
|
} finally {
|
|
466
469
|
Owner = prev;
|
|
470
|
+
Listener = prevListener;
|
|
467
471
|
}
|
|
468
472
|
}
|
|
469
473
|
function enableScheduling(scheduler = requestCallback) {
|
|
@@ -614,8 +618,8 @@ function updateComputation(node) {
|
|
|
614
618
|
if (!node.fn) return;
|
|
615
619
|
cleanNode(node);
|
|
616
620
|
const owner = Owner,
|
|
617
|
-
|
|
618
|
-
|
|
621
|
+
listener = Listener,
|
|
622
|
+
time = ExecCount;
|
|
619
623
|
Listener = Owner = node;
|
|
620
624
|
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
621
625
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
@@ -636,7 +640,17 @@ function runComputation(node, value, time) {
|
|
|
636
640
|
try {
|
|
637
641
|
nextValue = node.fn(value);
|
|
638
642
|
} catch (err) {
|
|
639
|
-
if (node.pure)
|
|
643
|
+
if (node.pure) {
|
|
644
|
+
if (Transition && Transition.running) {
|
|
645
|
+
node.tState = STALE;
|
|
646
|
+
node.tOwned && node.tOwned.forEach(cleanNode);
|
|
647
|
+
node.tOwned = undefined;
|
|
648
|
+
} else {
|
|
649
|
+
node.state = STALE;
|
|
650
|
+
node.owned && node.owned.forEach(cleanNode);
|
|
651
|
+
node.owned = null;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
640
654
|
handleError(err);
|
|
641
655
|
}
|
|
642
656
|
if (!node.updatedAt || node.updatedAt <= time) {
|
|
@@ -703,7 +717,7 @@ function runTop(node) {
|
|
|
703
717
|
node = ancestors[i];
|
|
704
718
|
if (runningTransition) {
|
|
705
719
|
let top = node,
|
|
706
|
-
|
|
720
|
+
prev = ancestors[i + 1];
|
|
707
721
|
while ((top = top.owner) && top !== prev) {
|
|
708
722
|
if (Transition.disposed.has(top)) return;
|
|
709
723
|
}
|
|
@@ -730,6 +744,7 @@ function runUpdates(fn, init) {
|
|
|
730
744
|
return res;
|
|
731
745
|
} catch (err) {
|
|
732
746
|
if (!Updates) Effects = null;
|
|
747
|
+
Updates = null;
|
|
733
748
|
handleError(err);
|
|
734
749
|
}
|
|
735
750
|
}
|
|
@@ -800,7 +815,7 @@ function scheduleQueue(queue) {
|
|
|
800
815
|
}
|
|
801
816
|
function runUserEffects(queue) {
|
|
802
817
|
let i,
|
|
803
|
-
|
|
818
|
+
userLength = 0;
|
|
804
819
|
for (i = 0; i < queue.length; i++) {
|
|
805
820
|
const e = queue[i];
|
|
806
821
|
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
@@ -836,11 +851,11 @@ function cleanNode(node) {
|
|
|
836
851
|
if (node.sources) {
|
|
837
852
|
while (node.sources.length) {
|
|
838
853
|
const source = node.sources.pop(),
|
|
839
|
-
|
|
840
|
-
|
|
854
|
+
index = node.sourceSlots.pop(),
|
|
855
|
+
obs = source.observers;
|
|
841
856
|
if (obs && obs.length) {
|
|
842
857
|
const n = obs.pop(),
|
|
843
|
-
|
|
858
|
+
s = source.observerSlots.pop();
|
|
844
859
|
if (index < obs.length) {
|
|
845
860
|
n.sourceSlots[s] = index;
|
|
846
861
|
obs[index] = n;
|
|
@@ -964,27 +979,27 @@ function dispose(d) {
|
|
|
964
979
|
}
|
|
965
980
|
function mapArray(list, mapFn, options = {}) {
|
|
966
981
|
let items = [],
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
982
|
+
mapped = [],
|
|
983
|
+
disposers = [],
|
|
984
|
+
len = 0,
|
|
985
|
+
indexes = mapFn.length > 1 ? [] : null;
|
|
971
986
|
onCleanup(() => dispose(disposers));
|
|
972
987
|
return () => {
|
|
973
988
|
let newItems = list() || [],
|
|
974
|
-
|
|
975
|
-
|
|
989
|
+
i,
|
|
990
|
+
j;
|
|
976
991
|
newItems[$TRACK];
|
|
977
992
|
return untrack(() => {
|
|
978
993
|
let newLen = newItems.length,
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
994
|
+
newIndices,
|
|
995
|
+
newIndicesNext,
|
|
996
|
+
temp,
|
|
997
|
+
tempdisposers,
|
|
998
|
+
tempIndexes,
|
|
999
|
+
start,
|
|
1000
|
+
end,
|
|
1001
|
+
newEnd,
|
|
1002
|
+
item;
|
|
988
1003
|
if (newLen === 0) {
|
|
989
1004
|
if (len !== 0) {
|
|
990
1005
|
dispose(disposers);
|
|
@@ -1067,11 +1082,11 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1067
1082
|
}
|
|
1068
1083
|
function indexArray(list, mapFn, options = {}) {
|
|
1069
1084
|
let items = [],
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1085
|
+
mapped = [],
|
|
1086
|
+
disposers = [],
|
|
1087
|
+
signals = [],
|
|
1088
|
+
len = 0,
|
|
1089
|
+
i;
|
|
1075
1090
|
onCleanup(() => dispose(disposers));
|
|
1076
1091
|
return () => {
|
|
1077
1092
|
const newItems = list() || [];
|
|
@@ -1342,20 +1357,20 @@ function Switch(props) {
|
|
|
1342
1357
|
let keyed = false;
|
|
1343
1358
|
const equals = (a, b) => a[0] === b[0] && (strictEqual ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1344
1359
|
const conditions = children(() => props.children),
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1360
|
+
evalConditions = createMemo(() => {
|
|
1361
|
+
let conds = conditions();
|
|
1362
|
+
if (!Array.isArray(conds)) conds = [conds];
|
|
1363
|
+
for (let i = 0; i < conds.length; i++) {
|
|
1364
|
+
const c = conds[i].when;
|
|
1365
|
+
if (c) {
|
|
1366
|
+
keyed = !!conds[i].keyed;
|
|
1367
|
+
return [i, c, conds[i]];
|
|
1368
|
+
}
|
|
1353
1369
|
}
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
});
|
|
1370
|
+
return [-1];
|
|
1371
|
+
}, undefined, {
|
|
1372
|
+
equals
|
|
1373
|
+
});
|
|
1359
1374
|
return createMemo(() => {
|
|
1360
1375
|
const [index, when, cond] = evalConditions();
|
|
1361
1376
|
if (index < 0) return props.fallback;
|
|
@@ -1397,9 +1412,9 @@ const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFa
|
|
|
1397
1412
|
const SuspenseListContext = createContext();
|
|
1398
1413
|
function SuspenseList(props) {
|
|
1399
1414
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1415
|
+
inFallback: false
|
|
1416
|
+
})),
|
|
1417
|
+
show;
|
|
1403
1418
|
const listContext = useContext(SuspenseListContext);
|
|
1404
1419
|
const [registry, setRegistry] = createSignal([]);
|
|
1405
1420
|
if (listContext) {
|
|
@@ -1407,13 +1422,13 @@ function SuspenseList(props) {
|
|
|
1407
1422
|
}
|
|
1408
1423
|
const resolved = createMemo(prev => {
|
|
1409
1424
|
const reveal = props.revealOrder,
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1425
|
+
tail = props.tail,
|
|
1426
|
+
{
|
|
1427
|
+
showContent = true,
|
|
1428
|
+
showFallback = true
|
|
1429
|
+
} = show ? show() : {},
|
|
1430
|
+
reg = registry(),
|
|
1431
|
+
reverse = reveal === "backwards";
|
|
1417
1432
|
if (reveal === "together") {
|
|
1418
1433
|
const all = reg.every(inFallback => !inFallback());
|
|
1419
1434
|
const res = reg.map(() => ({
|
|
@@ -1428,7 +1443,7 @@ function SuspenseList(props) {
|
|
|
1428
1443
|
const res = [];
|
|
1429
1444
|
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1430
1445
|
const n = reverse ? len - i - 1 : i,
|
|
1431
|
-
|
|
1446
|
+
s = reg[n]();
|
|
1432
1447
|
if (!stop && !s) {
|
|
1433
1448
|
res[n] = {
|
|
1434
1449
|
showContent,
|
|
@@ -1471,25 +1486,25 @@ function SuspenseList(props) {
|
|
|
1471
1486
|
}
|
|
1472
1487
|
function Suspense(props) {
|
|
1473
1488
|
let counter = 0,
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1489
|
+
show,
|
|
1490
|
+
ctx,
|
|
1491
|
+
p,
|
|
1492
|
+
flicker,
|
|
1493
|
+
error;
|
|
1479
1494
|
const [inFallback, setFallback] = createSignal(false),
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1495
|
+
SuspenseContext = getSuspenseContext(),
|
|
1496
|
+
store = {
|
|
1497
|
+
increment: () => {
|
|
1498
|
+
if (++counter === 1) setFallback(true);
|
|
1499
|
+
},
|
|
1500
|
+
decrement: () => {
|
|
1501
|
+
if (--counter === 0) setFallback(false);
|
|
1502
|
+
},
|
|
1503
|
+
inFallback,
|
|
1504
|
+
effects: [],
|
|
1505
|
+
resolved: false
|
|
1487
1506
|
},
|
|
1488
|
-
|
|
1489
|
-
effects: [],
|
|
1490
|
-
resolved: false
|
|
1491
|
-
},
|
|
1492
|
-
owner = getOwner();
|
|
1507
|
+
owner = getOwner();
|
|
1493
1508
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1494
1509
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1495
1510
|
let ref = sharedConfig.load(key);
|
|
@@ -1529,10 +1544,10 @@ function Suspense(props) {
|
|
|
1529
1544
|
const rendered = createMemo(() => props.children);
|
|
1530
1545
|
return createMemo(prev => {
|
|
1531
1546
|
const inFallback = store.inFallback(),
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1547
|
+
{
|
|
1548
|
+
showContent = true,
|
|
1549
|
+
showFallback = true
|
|
1550
|
+
} = show ? show() : {};
|
|
1536
1551
|
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1537
1552
|
store.resolved = true;
|
|
1538
1553
|
dispose && dispose();
|