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/dev.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
let taskIdCounter = 1,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
isCallbackScheduled = false,
|
|
3
|
+
isPerformingWork = false,
|
|
4
|
+
taskQueue = [],
|
|
5
|
+
currentTask = null,
|
|
6
|
+
shouldYieldToHost = null,
|
|
7
|
+
yieldInterval = 5,
|
|
8
|
+
deadline = 0,
|
|
9
|
+
maxYieldInterval = 300,
|
|
10
|
+
scheduleCallback = null,
|
|
11
|
+
scheduledCallback = null;
|
|
12
12
|
const maxSigned31BitInt = 1073741823;
|
|
13
13
|
function setupScheduler() {
|
|
14
14
|
const channel = new MessageChannel(),
|
|
15
|
-
|
|
15
|
+
port = channel.port2;
|
|
16
16
|
scheduleCallback = () => port.postMessage(null);
|
|
17
17
|
channel.port1.onmessage = () => {
|
|
18
18
|
if (scheduledCallback !== null) {
|
|
@@ -63,7 +63,7 @@ function enqueue(taskQueue, task) {
|
|
|
63
63
|
function requestCallback(fn, options) {
|
|
64
64
|
if (!scheduleCallback) setupScheduler();
|
|
65
65
|
let startTime = performance.now(),
|
|
66
|
-
|
|
66
|
+
timeout = maxSigned31BitInt;
|
|
67
67
|
if (options && options.timeout) timeout = options.timeout;
|
|
68
68
|
const newTask = {
|
|
69
69
|
id: taskIdCounter++,
|
|
@@ -119,7 +119,8 @@ function setHydrateContext(context) {
|
|
|
119
119
|
sharedConfig.context = context;
|
|
120
120
|
}
|
|
121
121
|
function nextHydrateContext() {
|
|
122
|
-
return {
|
|
122
|
+
return {
|
|
123
|
+
...sharedConfig.context,
|
|
123
124
|
id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
|
|
124
125
|
count: 0
|
|
125
126
|
};
|
|
@@ -155,22 +156,22 @@ let rootCount = 0;
|
|
|
155
156
|
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
156
157
|
function createRoot(fn, detachedOwner) {
|
|
157
158
|
const listener = Listener,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
159
|
+
owner = Owner,
|
|
160
|
+
unowned = fn.length === 0,
|
|
161
|
+
root = unowned ? {
|
|
162
|
+
owned: null,
|
|
163
|
+
cleanups: null,
|
|
164
|
+
context: null,
|
|
165
|
+
owner: null
|
|
166
|
+
} : {
|
|
167
|
+
owned: null,
|
|
168
|
+
cleanups: null,
|
|
169
|
+
context: null,
|
|
170
|
+
owner: detachedOwner || owner
|
|
171
|
+
},
|
|
172
|
+
updateFn = unowned ? () => fn(() => {
|
|
173
|
+
throw new Error("Dispose method must be an explicit argument to createRoot function");
|
|
174
|
+
}) : () => fn(() => untrack(() => cleanNode(root)));
|
|
174
175
|
{
|
|
175
176
|
if (owner) root.name = `${owner.name}-r${rootCount++}`;
|
|
176
177
|
globalThis._$afterCreateRoot && globalThis._$afterCreateRoot(root);
|
|
@@ -212,7 +213,7 @@ function createRenderEffect(fn, value, options) {
|
|
|
212
213
|
function createEffect(fn, value, options) {
|
|
213
214
|
runEffects = runUserEffects;
|
|
214
215
|
const c = createComputation(fn, value, false, STALE, options ),
|
|
215
|
-
|
|
216
|
+
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
216
217
|
if (s) c.suspense = s;
|
|
217
218
|
c.user = true;
|
|
218
219
|
Effects ? Effects.push(c) : updateComputation(c);
|
|
@@ -220,10 +221,10 @@ function createEffect(fn, value, options) {
|
|
|
220
221
|
function createReaction(onInvalidate, options) {
|
|
221
222
|
let fn;
|
|
222
223
|
const c = createComputation(() => {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
fn ? fn() : untrack(onInvalidate);
|
|
225
|
+
fn = undefined;
|
|
226
|
+
}, undefined, false, 0, options ),
|
|
227
|
+
s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
227
228
|
if (s) c.suspense = s;
|
|
228
229
|
c.user = true;
|
|
229
230
|
return tracking => {
|
|
@@ -257,19 +258,19 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
257
258
|
options = pOptions || {};
|
|
258
259
|
}
|
|
259
260
|
let pr = null,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
261
|
+
initP = NO_INIT,
|
|
262
|
+
id = null,
|
|
263
|
+
loadedUnderTransition = false,
|
|
264
|
+
scheduled = false,
|
|
265
|
+
resolved = ("initialValue" in options),
|
|
266
|
+
dynamic = typeof source === "function" && createMemo(source);
|
|
266
267
|
const contexts = new Set(),
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
268
|
+
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
269
|
+
[error, setError] = createSignal(undefined),
|
|
270
|
+
[track, trigger] = createSignal(undefined, {
|
|
271
|
+
equals: false
|
|
272
|
+
}),
|
|
273
|
+
[state, setState] = createSignal(resolved ? "ready" : "unresolved");
|
|
273
274
|
if (sharedConfig.context) {
|
|
274
275
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
275
276
|
let v;
|
|
@@ -305,8 +306,8 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
305
306
|
}
|
|
306
307
|
function read() {
|
|
307
308
|
const c = SuspenseContext && lookup(Owner, SuspenseContext.id),
|
|
308
|
-
|
|
309
|
-
|
|
309
|
+
v = value(),
|
|
310
|
+
err = error();
|
|
310
311
|
if (err && !pr) throw err;
|
|
311
312
|
if (Listener && !Listener.user && c) {
|
|
312
313
|
createComputed(() => {
|
|
@@ -378,7 +379,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
378
379
|
}
|
|
379
380
|
function createDeferred(source, options) {
|
|
380
381
|
let t,
|
|
381
|
-
|
|
382
|
+
timeout = options ? options.timeoutMs : undefined;
|
|
382
383
|
const node = createComputation(() => {
|
|
383
384
|
if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
|
|
384
385
|
timeout
|
|
@@ -468,13 +469,16 @@ function getOwner() {
|
|
|
468
469
|
}
|
|
469
470
|
function runWithOwner(o, fn) {
|
|
470
471
|
const prev = Owner;
|
|
472
|
+
const prevListener = Listener;
|
|
471
473
|
Owner = o;
|
|
474
|
+
Listener = null;
|
|
472
475
|
try {
|
|
473
476
|
return runUpdates(fn, true);
|
|
474
477
|
} catch (err) {
|
|
475
478
|
handleError(err);
|
|
476
479
|
} finally {
|
|
477
480
|
Owner = prev;
|
|
481
|
+
Listener = prevListener;
|
|
478
482
|
}
|
|
479
483
|
}
|
|
480
484
|
function enableScheduling(scheduler = requestCallback) {
|
|
@@ -521,11 +525,10 @@ function devComponent(Comp, props) {
|
|
|
521
525
|
[$DEVCOMP]: true
|
|
522
526
|
});
|
|
523
527
|
return Comp(props);
|
|
524
|
-
}), undefined, true);
|
|
528
|
+
}), undefined, true, 0);
|
|
525
529
|
c.props = props;
|
|
526
530
|
c.observers = null;
|
|
527
531
|
c.observerSlots = null;
|
|
528
|
-
c.state = 0;
|
|
529
532
|
c.componentName = Comp.name;
|
|
530
533
|
updateComputation(c);
|
|
531
534
|
return c.tValue !== undefined ? c.tValue : c.value;
|
|
@@ -558,13 +561,15 @@ function registerGraph(name, value) {
|
|
|
558
561
|
Owner.sourceMap || (Owner.sourceMap = {});
|
|
559
562
|
while (Owner.sourceMap[tryName]) tryName = `${name}-${++i}`;
|
|
560
563
|
Owner.sourceMap[tryName] = value;
|
|
564
|
+
value.graph = Owner;
|
|
561
565
|
}
|
|
562
566
|
return tryName;
|
|
563
567
|
}
|
|
564
568
|
function serializeGraph(owner) {
|
|
565
569
|
owner || (owner = Owner);
|
|
566
570
|
if (!owner) return {};
|
|
567
|
-
return {
|
|
571
|
+
return {
|
|
572
|
+
...serializeValues(owner.sourceMap),
|
|
568
573
|
...(owner.owned ? serializeChildren(owner) : {})
|
|
569
574
|
};
|
|
570
575
|
}
|
|
@@ -680,8 +685,8 @@ function updateComputation(node) {
|
|
|
680
685
|
if (!node.fn) return;
|
|
681
686
|
cleanNode(node);
|
|
682
687
|
const owner = Owner,
|
|
683
|
-
|
|
684
|
-
|
|
688
|
+
listener = Listener,
|
|
689
|
+
time = ExecCount;
|
|
685
690
|
Listener = Owner = node;
|
|
686
691
|
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
687
692
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
@@ -702,7 +707,17 @@ function runComputation(node, value, time) {
|
|
|
702
707
|
try {
|
|
703
708
|
nextValue = node.fn(value);
|
|
704
709
|
} catch (err) {
|
|
705
|
-
if (node.pure)
|
|
710
|
+
if (node.pure) {
|
|
711
|
+
if (Transition && Transition.running) {
|
|
712
|
+
node.tState = STALE;
|
|
713
|
+
node.tOwned && node.tOwned.forEach(cleanNode);
|
|
714
|
+
node.tOwned = undefined;
|
|
715
|
+
} else {
|
|
716
|
+
node.state = STALE;
|
|
717
|
+
node.owned && node.owned.forEach(cleanNode);
|
|
718
|
+
node.owned = null;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
706
721
|
handleError(err);
|
|
707
722
|
}
|
|
708
723
|
if (!node.updatedAt || node.updatedAt <= time) {
|
|
@@ -770,7 +785,7 @@ function runTop(node) {
|
|
|
770
785
|
node = ancestors[i];
|
|
771
786
|
if (runningTransition) {
|
|
772
787
|
let top = node,
|
|
773
|
-
|
|
788
|
+
prev = ancestors[i + 1];
|
|
774
789
|
while ((top = top.owner) && top !== prev) {
|
|
775
790
|
if (Transition.disposed.has(top)) return;
|
|
776
791
|
}
|
|
@@ -797,6 +812,7 @@ function runUpdates(fn, init) {
|
|
|
797
812
|
return res;
|
|
798
813
|
} catch (err) {
|
|
799
814
|
if (!Updates) Effects = null;
|
|
815
|
+
Updates = null;
|
|
800
816
|
handleError(err);
|
|
801
817
|
}
|
|
802
818
|
}
|
|
@@ -867,7 +883,7 @@ function scheduleQueue(queue) {
|
|
|
867
883
|
}
|
|
868
884
|
function runUserEffects(queue) {
|
|
869
885
|
let i,
|
|
870
|
-
|
|
886
|
+
userLength = 0;
|
|
871
887
|
for (i = 0; i < queue.length; i++) {
|
|
872
888
|
const e = queue[i];
|
|
873
889
|
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
@@ -903,11 +919,11 @@ function cleanNode(node) {
|
|
|
903
919
|
if (node.sources) {
|
|
904
920
|
while (node.sources.length) {
|
|
905
921
|
const source = node.sources.pop(),
|
|
906
|
-
|
|
907
|
-
|
|
922
|
+
index = node.sourceSlots.pop(),
|
|
923
|
+
obs = source.observers;
|
|
908
924
|
if (obs && obs.length) {
|
|
909
925
|
const n = obs.pop(),
|
|
910
|
-
|
|
926
|
+
s = source.observerSlots.pop();
|
|
911
927
|
if (index < obs.length) {
|
|
912
928
|
n.sourceSlots[s] = index;
|
|
913
929
|
obs[index] = n;
|
|
@@ -997,7 +1013,8 @@ function serializeChildren(root) {
|
|
|
997
1013
|
const result = {};
|
|
998
1014
|
for (let i = 0, len = root.owned.length; i < len; i++) {
|
|
999
1015
|
const node = root.owned[i];
|
|
1000
|
-
result[node.componentName ? `${node.componentName}:${node.name}` : node.name] = {
|
|
1016
|
+
result[node.componentName ? `${node.componentName}:${node.name}` : node.name] = {
|
|
1017
|
+
...serializeValues(node.sourceMap),
|
|
1001
1018
|
...(node.owned ? serializeChildren(node) : {})
|
|
1002
1019
|
};
|
|
1003
1020
|
}
|
|
@@ -1055,27 +1072,27 @@ function dispose(d) {
|
|
|
1055
1072
|
}
|
|
1056
1073
|
function mapArray(list, mapFn, options = {}) {
|
|
1057
1074
|
let items = [],
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1075
|
+
mapped = [],
|
|
1076
|
+
disposers = [],
|
|
1077
|
+
len = 0,
|
|
1078
|
+
indexes = mapFn.length > 1 ? [] : null;
|
|
1062
1079
|
onCleanup(() => dispose(disposers));
|
|
1063
1080
|
return () => {
|
|
1064
1081
|
let newItems = list() || [],
|
|
1065
|
-
|
|
1066
|
-
|
|
1082
|
+
i,
|
|
1083
|
+
j;
|
|
1067
1084
|
newItems[$TRACK];
|
|
1068
1085
|
return untrack(() => {
|
|
1069
1086
|
let newLen = newItems.length,
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1087
|
+
newIndices,
|
|
1088
|
+
newIndicesNext,
|
|
1089
|
+
temp,
|
|
1090
|
+
tempdisposers,
|
|
1091
|
+
tempIndexes,
|
|
1092
|
+
start,
|
|
1093
|
+
end,
|
|
1094
|
+
newEnd,
|
|
1095
|
+
item;
|
|
1079
1096
|
if (newLen === 0) {
|
|
1080
1097
|
if (len !== 0) {
|
|
1081
1098
|
dispose(disposers);
|
|
@@ -1160,11 +1177,11 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1160
1177
|
}
|
|
1161
1178
|
function indexArray(list, mapFn, options = {}) {
|
|
1162
1179
|
let items = [],
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1180
|
+
mapped = [],
|
|
1181
|
+
disposers = [],
|
|
1182
|
+
signals = [],
|
|
1183
|
+
len = 0,
|
|
1184
|
+
i;
|
|
1168
1185
|
onCleanup(() => dispose(disposers));
|
|
1169
1186
|
return () => {
|
|
1170
1187
|
const newItems = list() || [];
|
|
@@ -1446,21 +1463,21 @@ function Switch(props) {
|
|
|
1446
1463
|
let keyed = false;
|
|
1447
1464
|
const equals = (a, b) => a[0] === b[0] && (strictEqual ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1448
1465
|
const conditions = children(() => props.children),
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1466
|
+
evalConditions = createMemo(() => {
|
|
1467
|
+
let conds = conditions();
|
|
1468
|
+
if (!Array.isArray(conds)) conds = [conds];
|
|
1469
|
+
for (let i = 0; i < conds.length; i++) {
|
|
1470
|
+
const c = conds[i].when;
|
|
1471
|
+
if (c) {
|
|
1472
|
+
keyed = !!conds[i].keyed;
|
|
1473
|
+
return [i, c, conds[i]];
|
|
1474
|
+
}
|
|
1457
1475
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
} );
|
|
1476
|
+
return [-1];
|
|
1477
|
+
}, undefined, {
|
|
1478
|
+
equals,
|
|
1479
|
+
name: "eval conditions"
|
|
1480
|
+
} );
|
|
1464
1481
|
return createMemo(() => {
|
|
1465
1482
|
const [index, when, cond] = evalConditions();
|
|
1466
1483
|
if (index < 0) return props.fallback;
|
|
@@ -1509,9 +1526,9 @@ const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFa
|
|
|
1509
1526
|
const SuspenseListContext = createContext();
|
|
1510
1527
|
function SuspenseList(props) {
|
|
1511
1528
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1529
|
+
inFallback: false
|
|
1530
|
+
})),
|
|
1531
|
+
show;
|
|
1515
1532
|
const listContext = useContext(SuspenseListContext);
|
|
1516
1533
|
const [registry, setRegistry] = createSignal([]);
|
|
1517
1534
|
if (listContext) {
|
|
@@ -1519,13 +1536,13 @@ function SuspenseList(props) {
|
|
|
1519
1536
|
}
|
|
1520
1537
|
const resolved = createMemo(prev => {
|
|
1521
1538
|
const reveal = props.revealOrder,
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1539
|
+
tail = props.tail,
|
|
1540
|
+
{
|
|
1541
|
+
showContent = true,
|
|
1542
|
+
showFallback = true
|
|
1543
|
+
} = show ? show() : {},
|
|
1544
|
+
reg = registry(),
|
|
1545
|
+
reverse = reveal === "backwards";
|
|
1529
1546
|
if (reveal === "together") {
|
|
1530
1547
|
const all = reg.every(inFallback => !inFallback());
|
|
1531
1548
|
const res = reg.map(() => ({
|
|
@@ -1540,7 +1557,7 @@ function SuspenseList(props) {
|
|
|
1540
1557
|
const res = [];
|
|
1541
1558
|
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1542
1559
|
const n = reverse ? len - i - 1 : i,
|
|
1543
|
-
|
|
1560
|
+
s = reg[n]();
|
|
1544
1561
|
if (!stop && !s) {
|
|
1545
1562
|
res[n] = {
|
|
1546
1563
|
showContent,
|
|
@@ -1583,25 +1600,25 @@ function SuspenseList(props) {
|
|
|
1583
1600
|
}
|
|
1584
1601
|
function Suspense(props) {
|
|
1585
1602
|
let counter = 0,
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1603
|
+
show,
|
|
1604
|
+
ctx,
|
|
1605
|
+
p,
|
|
1606
|
+
flicker,
|
|
1607
|
+
error;
|
|
1591
1608
|
const [inFallback, setFallback] = createSignal(false),
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1609
|
+
SuspenseContext = getSuspenseContext(),
|
|
1610
|
+
store = {
|
|
1611
|
+
increment: () => {
|
|
1612
|
+
if (++counter === 1) setFallback(true);
|
|
1613
|
+
},
|
|
1614
|
+
decrement: () => {
|
|
1615
|
+
if (--counter === 0) setFallback(false);
|
|
1616
|
+
},
|
|
1617
|
+
inFallback,
|
|
1618
|
+
effects: [],
|
|
1619
|
+
resolved: false
|
|
1599
1620
|
},
|
|
1600
|
-
|
|
1601
|
-
effects: [],
|
|
1602
|
-
resolved: false
|
|
1603
|
-
},
|
|
1604
|
-
owner = getOwner();
|
|
1621
|
+
owner = getOwner();
|
|
1605
1622
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1606
1623
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1607
1624
|
let ref = sharedConfig.load(key);
|
|
@@ -1641,10 +1658,10 @@ function Suspense(props) {
|
|
|
1641
1658
|
const rendered = createMemo(() => props.children);
|
|
1642
1659
|
return createMemo(prev => {
|
|
1643
1660
|
const inFallback = store.inFallback(),
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1661
|
+
{
|
|
1662
|
+
showContent = true,
|
|
1663
|
+
showFallback = true
|
|
1664
|
+
} = show ? show() : {};
|
|
1648
1665
|
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1649
1666
|
store.resolved = true;
|
|
1650
1667
|
dispose && dispose();
|
package/dist/server.cjs
CHANGED
|
@@ -25,10 +25,10 @@ let Owner = null;
|
|
|
25
25
|
function createRoot(fn, detachedOwner) {
|
|
26
26
|
detachedOwner && (Owner = detachedOwner);
|
|
27
27
|
const owner = Owner,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
root = fn.length === 0 ? UNOWNED : {
|
|
29
|
+
context: null,
|
|
30
|
+
owner
|
|
31
|
+
};
|
|
32
32
|
Owner = root;
|
|
33
33
|
let result;
|
|
34
34
|
try {
|
|
@@ -264,7 +264,8 @@ function setHydrateContext(context) {
|
|
|
264
264
|
sharedConfig.context = context;
|
|
265
265
|
}
|
|
266
266
|
function nextHydrateContext() {
|
|
267
|
-
return sharedConfig.context ? {
|
|
267
|
+
return sharedConfig.context ? {
|
|
268
|
+
...sharedConfig.context,
|
|
268
269
|
id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
|
|
269
270
|
count: 0
|
|
270
271
|
} : undefined;
|
|
@@ -311,23 +312,23 @@ function mergeProps(...sources) {
|
|
|
311
312
|
}
|
|
312
313
|
function splitProps(props, ...keys) {
|
|
313
314
|
const descriptors = Object.getOwnPropertyDescriptors(props),
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
315
|
+
split = k => {
|
|
316
|
+
const clone = {};
|
|
317
|
+
for (let i = 0; i < k.length; i++) {
|
|
318
|
+
const key = k[i];
|
|
319
|
+
if (descriptors[key]) {
|
|
320
|
+
Object.defineProperty(clone, key, descriptors[key]);
|
|
321
|
+
delete descriptors[key];
|
|
322
|
+
}
|
|
321
323
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
};
|
|
324
|
+
return clone;
|
|
325
|
+
};
|
|
325
326
|
return keys.map(split).concat(split(Object.keys(descriptors)));
|
|
326
327
|
}
|
|
327
328
|
function simpleMap(props, wrap) {
|
|
328
329
|
const list = props.each || [],
|
|
329
|
-
|
|
330
|
-
|
|
330
|
+
len = list.length,
|
|
331
|
+
fn = props.children;
|
|
331
332
|
if (len) {
|
|
332
333
|
let mapped = Array(len);
|
|
333
334
|
for (let i = 0; i < len; i++) mapped[i] = wrap(fn, list[i], i);
|
|
@@ -363,15 +364,16 @@ function Match(props) {
|
|
|
363
364
|
function resetErrorBoundaries() {}
|
|
364
365
|
function ErrorBoundary(props) {
|
|
365
366
|
let error,
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
res,
|
|
368
|
+
clean,
|
|
369
|
+
sync = true;
|
|
369
370
|
const ctx = sharedConfig.context;
|
|
370
371
|
const id = ctx.id + ctx.count;
|
|
371
372
|
function displayFallback() {
|
|
372
373
|
cleanNode(clean);
|
|
373
374
|
ctx.writeResource(id, error, true);
|
|
374
|
-
setHydrateContext({
|
|
375
|
+
setHydrateContext({
|
|
376
|
+
...ctx,
|
|
375
377
|
count: 0
|
|
376
378
|
});
|
|
377
379
|
const f = props.fallback;
|
|
@@ -578,7 +580,8 @@ function Suspense(props) {
|
|
|
578
580
|
}
|
|
579
581
|
});
|
|
580
582
|
function runSuspense() {
|
|
581
|
-
setHydrateContext({
|
|
583
|
+
setHydrateContext({
|
|
584
|
+
...ctx,
|
|
582
585
|
count: 0
|
|
583
586
|
});
|
|
584
587
|
return runWithOwner(o, () => {
|
|
@@ -602,18 +605,20 @@ function Suspense(props) {
|
|
|
602
605
|
});
|
|
603
606
|
done = ctx.async ? ctx.registerFragment(id) : undefined;
|
|
604
607
|
if (ctx.async) {
|
|
605
|
-
setHydrateContext({
|
|
608
|
+
setHydrateContext({
|
|
609
|
+
...ctx,
|
|
606
610
|
count: 0,
|
|
607
611
|
id: ctx.id + "0.f",
|
|
608
612
|
noHydrate: true
|
|
609
613
|
});
|
|
610
614
|
const res = {
|
|
611
|
-
t: `<
|
|
615
|
+
t: `<template id="pl-${id}"></template>${resolveSSRNode(props.fallback)}<!pl-${id}>`
|
|
612
616
|
};
|
|
613
617
|
setHydrateContext(ctx);
|
|
614
618
|
return res;
|
|
615
619
|
}
|
|
616
|
-
setHydrateContext({
|
|
620
|
+
setHydrateContext({
|
|
621
|
+
...ctx,
|
|
617
622
|
count: 0,
|
|
618
623
|
id: ctx.id + "0.f"
|
|
619
624
|
});
|