solid-js 1.8.5 → 1.8.6
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 +12 -9
- package/dist/dev.js +545 -307
- package/dist/server.js +170 -75
- package/dist/solid.cjs +7 -6
- package/dist/solid.js +467 -262
- package/h/dist/h.js +34 -8
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +11 -8
- package/h/jsx-runtime/types/jsx.d.ts +12 -5
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +216 -94
- package/html/types/lit.d.ts +47 -33
- package/package.json +7 -2
- package/store/dist/dev.js +114 -42
- package/store/dist/server.js +19 -8
- package/store/dist/store.js +105 -39
- package/store/types/index.d.ts +21 -7
- package/store/types/modifiers.d.ts +6 -3
- package/store/types/mutable.d.ts +5 -2
- package/store/types/server.d.ts +12 -4
- package/store/types/store.d.ts +218 -61
- package/types/index.d.ts +75 -9
- package/types/jsx.d.ts +11 -5
- package/types/reactive/array.d.ts +12 -4
- package/types/reactive/observable.d.ts +25 -17
- package/types/reactive/scheduler.d.ts +9 -6
- package/types/reactive/signal.d.ts +229 -140
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +62 -31
- package/types/render/flow.d.ts +43 -31
- package/types/render/hydration.d.ts +13 -13
- package/types/server/index.d.ts +57 -2
- package/types/server/reactive.d.ts +73 -42
- package/types/server/rendering.d.ts +166 -95
- package/universal/dist/dev.js +28 -12
- package/universal/dist/universal.js +28 -12
- package/universal/types/index.d.ts +3 -1
- package/universal/types/universal.d.ts +0 -1
- package/web/dist/dev.cjs +1 -1
- package/web/dist/dev.js +620 -81
- package/web/dist/server.cjs +22 -10
- package/web/dist/server.js +195 -101
- package/web/dist/storage.js +3 -3
- package/web/dist/web.cjs +1 -1
- package/web/dist/web.js +614 -80
- package/web/types/client.d.ts +2 -2
- package/web/types/core.d.ts +10 -1
- package/web/types/index.d.ts +27 -10
- package/web/types/server-mock.d.ts +47 -32
package/dist/solid.js
CHANGED
|
@@ -52,9 +52,11 @@ function enqueue(taskQueue, task) {
|
|
|
52
52
|
let m = 0;
|
|
53
53
|
let n = taskQueue.length - 1;
|
|
54
54
|
while (m <= n) {
|
|
55
|
-
const k = n + m >> 1;
|
|
55
|
+
const k = (n + m) >> 1;
|
|
56
56
|
const cmp = task.expirationTime - taskQueue[k].expirationTime;
|
|
57
|
-
if (cmp > 0) m = k + 1;
|
|
57
|
+
if (cmp > 0) m = k + 1;
|
|
58
|
+
else if (cmp < 0) n = k - 1;
|
|
59
|
+
else return k;
|
|
58
60
|
}
|
|
59
61
|
return m;
|
|
60
62
|
}
|
|
@@ -155,18 +157,20 @@ let Listener = null;
|
|
|
155
157
|
let Updates = null;
|
|
156
158
|
let Effects = null;
|
|
157
159
|
let ExecCount = 0;
|
|
158
|
-
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
160
|
+
const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);
|
|
159
161
|
function createRoot(fn, detachedOwner) {
|
|
160
162
|
const listener = Listener,
|
|
161
163
|
owner = Owner,
|
|
162
164
|
unowned = fn.length === 0,
|
|
163
165
|
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
164
|
-
root = unowned
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
root = unowned
|
|
167
|
+
? UNOWNED
|
|
168
|
+
: {
|
|
169
|
+
owned: null,
|
|
170
|
+
cleanups: null,
|
|
171
|
+
context: current ? current.context : null,
|
|
172
|
+
owner: current
|
|
173
|
+
},
|
|
170
174
|
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
171
175
|
Owner = root;
|
|
172
176
|
Listener = null;
|
|
@@ -187,7 +191,8 @@ function createSignal(value, options) {
|
|
|
187
191
|
};
|
|
188
192
|
const setter = value => {
|
|
189
193
|
if (typeof value === "function") {
|
|
190
|
-
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
194
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
195
|
+
else value = value(s.value);
|
|
191
196
|
}
|
|
192
197
|
return writeSignal(s, value);
|
|
193
198
|
};
|
|
@@ -195,11 +200,13 @@ function createSignal(value, options) {
|
|
|
195
200
|
}
|
|
196
201
|
function createComputed(fn, value, options) {
|
|
197
202
|
const c = createComputation(fn, value, true, STALE);
|
|
198
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
203
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
204
|
+
else updateComputation(c);
|
|
199
205
|
}
|
|
200
206
|
function createRenderEffect(fn, value, options) {
|
|
201
207
|
const c = createComputation(fn, value, false, STALE);
|
|
202
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
208
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
209
|
+
else updateComputation(c);
|
|
203
210
|
}
|
|
204
211
|
function createEffect(fn, value, options) {
|
|
205
212
|
runEffects = runUserEffects;
|
|
@@ -211,10 +218,15 @@ function createEffect(fn, value, options) {
|
|
|
211
218
|
}
|
|
212
219
|
function createReaction(onInvalidate, options) {
|
|
213
220
|
let fn;
|
|
214
|
-
const c = createComputation(
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
221
|
+
const c = createComputation(
|
|
222
|
+
() => {
|
|
223
|
+
fn ? fn() : untrack(onInvalidate);
|
|
224
|
+
fn = undefined;
|
|
225
|
+
},
|
|
226
|
+
undefined,
|
|
227
|
+
false,
|
|
228
|
+
0
|
|
229
|
+
),
|
|
218
230
|
s = SuspenseContext && useContext(SuspenseContext);
|
|
219
231
|
if (s) c.suspense = s;
|
|
220
232
|
c.user = true;
|
|
@@ -242,7 +254,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
242
254
|
let source;
|
|
243
255
|
let fetcher;
|
|
244
256
|
let options;
|
|
245
|
-
if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
|
|
257
|
+
if ((arguments.length === 2 && typeof pFetcher === "object") || arguments.length === 1) {
|
|
246
258
|
source = true;
|
|
247
259
|
fetcher = pSource;
|
|
248
260
|
options = pFetcher || {};
|
|
@@ -256,7 +268,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
256
268
|
id = null,
|
|
257
269
|
loadedUnderTransition = false,
|
|
258
270
|
scheduled = false,
|
|
259
|
-
resolved =
|
|
271
|
+
resolved = "initialValue" in options,
|
|
260
272
|
dynamic = typeof source === "function" && createMemo(source);
|
|
261
273
|
const contexts = new Set(),
|
|
262
274
|
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
@@ -268,15 +280,19 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
268
280
|
if (sharedConfig.context) {
|
|
269
281
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
270
282
|
let v;
|
|
271
|
-
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
283
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
284
|
+
else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
|
|
272
285
|
}
|
|
273
286
|
function loadEnd(p, v, error, key) {
|
|
274
287
|
if (pr === p) {
|
|
275
288
|
pr = null;
|
|
276
289
|
key !== undefined && (resolved = true);
|
|
277
|
-
if ((p === initP || v === initP) && options.onHydrated)
|
|
278
|
-
|
|
279
|
-
|
|
290
|
+
if ((p === initP || v === initP) && options.onHydrated)
|
|
291
|
+
queueMicrotask(() =>
|
|
292
|
+
options.onHydrated(key, {
|
|
293
|
+
value: v
|
|
294
|
+
})
|
|
295
|
+
);
|
|
280
296
|
initP = NO_INIT;
|
|
281
297
|
if (Transition && p && loadedUnderTransition) {
|
|
282
298
|
Transition.promises.delete(p);
|
|
@@ -307,7 +323,8 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
307
323
|
createComputed(() => {
|
|
308
324
|
track();
|
|
309
325
|
if (pr) {
|
|
310
|
-
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
326
|
+
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
327
|
+
else if (!contexts.has(c)) {
|
|
311
328
|
c.increment();
|
|
312
329
|
contexts.add(c);
|
|
313
330
|
}
|
|
@@ -326,26 +343,35 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
326
343
|
return;
|
|
327
344
|
}
|
|
328
345
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
329
|
-
const p =
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
346
|
+
const p =
|
|
347
|
+
initP !== NO_INIT
|
|
348
|
+
? initP
|
|
349
|
+
: untrack(() =>
|
|
350
|
+
fetcher(lookup, {
|
|
351
|
+
value: value(),
|
|
352
|
+
refetching
|
|
353
|
+
})
|
|
354
|
+
);
|
|
333
355
|
if (!isPromise(p)) {
|
|
334
356
|
loadEnd(pr, p, undefined, lookup);
|
|
335
357
|
return p;
|
|
336
358
|
}
|
|
337
359
|
pr = p;
|
|
338
360
|
if ("value" in p) {
|
|
339
|
-
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
|
|
361
|
+
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
|
|
362
|
+
else loadEnd(pr, undefined, undefined, lookup);
|
|
340
363
|
return p;
|
|
341
364
|
}
|
|
342
365
|
scheduled = true;
|
|
343
|
-
queueMicrotask(() => scheduled = false);
|
|
366
|
+
queueMicrotask(() => (scheduled = false));
|
|
344
367
|
runUpdates(() => {
|
|
345
368
|
setState(resolved ? "refreshing" : "pending");
|
|
346
369
|
trigger();
|
|
347
370
|
}, false);
|
|
348
|
-
return p.then(
|
|
371
|
+
return p.then(
|
|
372
|
+
v => loadEnd(p, v, undefined, lookup),
|
|
373
|
+
e => loadEnd(p, undefined, castError(e), lookup)
|
|
374
|
+
);
|
|
349
375
|
}
|
|
350
376
|
Object.defineProperties(read, {
|
|
351
377
|
state: {
|
|
@@ -369,50 +395,80 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
369
395
|
}
|
|
370
396
|
}
|
|
371
397
|
});
|
|
372
|
-
if (dynamic) createComputed(() => load(false));
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
398
|
+
if (dynamic) createComputed(() => load(false));
|
|
399
|
+
else load(false);
|
|
400
|
+
return [
|
|
401
|
+
read,
|
|
402
|
+
{
|
|
403
|
+
refetch: load,
|
|
404
|
+
mutate: setValue
|
|
405
|
+
}
|
|
406
|
+
];
|
|
377
407
|
}
|
|
378
408
|
function createDeferred(source, options) {
|
|
379
409
|
let t,
|
|
380
410
|
timeout = options ? options.timeoutMs : undefined;
|
|
381
|
-
const node = createComputation(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
411
|
+
const node = createComputation(
|
|
412
|
+
() => {
|
|
413
|
+
if (!t || !t.fn)
|
|
414
|
+
t = requestCallback(
|
|
415
|
+
() => setDeferred(() => node.value),
|
|
416
|
+
timeout !== undefined
|
|
417
|
+
? {
|
|
418
|
+
timeout
|
|
419
|
+
}
|
|
420
|
+
: undefined
|
|
421
|
+
);
|
|
422
|
+
return source();
|
|
423
|
+
},
|
|
424
|
+
undefined,
|
|
425
|
+
true
|
|
426
|
+
);
|
|
427
|
+
const [deferred, setDeferred] = createSignal(
|
|
428
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
429
|
+
options
|
|
430
|
+
);
|
|
388
431
|
updateComputation(node);
|
|
389
|
-
setDeferred(() =>
|
|
432
|
+
setDeferred(() =>
|
|
433
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
434
|
+
);
|
|
390
435
|
return deferred;
|
|
391
436
|
}
|
|
392
437
|
function createSelector(source, fn = equalFn, options) {
|
|
393
438
|
const subs = new Map();
|
|
394
|
-
const node = createComputation(
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
for (const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
439
|
+
const node = createComputation(
|
|
440
|
+
p => {
|
|
441
|
+
const v = source();
|
|
442
|
+
for (const [key, val] of subs.entries())
|
|
443
|
+
if (fn(key, v) !== fn(key, p)) {
|
|
444
|
+
for (const c of val.values()) {
|
|
445
|
+
c.state = STALE;
|
|
446
|
+
if (c.pure) Updates.push(c);
|
|
447
|
+
else Effects.push(c);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return v;
|
|
451
|
+
},
|
|
452
|
+
undefined,
|
|
453
|
+
true,
|
|
454
|
+
STALE
|
|
455
|
+
);
|
|
404
456
|
updateComputation(node);
|
|
405
457
|
return key => {
|
|
406
458
|
const listener = Listener;
|
|
407
459
|
if (listener) {
|
|
408
460
|
let l;
|
|
409
|
-
if (l = subs.get(key)) l.add(listener);
|
|
461
|
+
if ((l = subs.get(key))) l.add(listener);
|
|
462
|
+
else subs.set(key, (l = new Set([listener])));
|
|
410
463
|
onCleanup(() => {
|
|
411
464
|
l.delete(listener);
|
|
412
465
|
!l.size && subs.delete(key);
|
|
413
466
|
});
|
|
414
467
|
}
|
|
415
|
-
return fn(
|
|
468
|
+
return fn(
|
|
469
|
+
key,
|
|
470
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
471
|
+
);
|
|
416
472
|
};
|
|
417
473
|
}
|
|
418
474
|
function batch(fn) {
|
|
@@ -451,7 +507,9 @@ function onMount(fn) {
|
|
|
451
507
|
createEffect(() => untrack(fn));
|
|
452
508
|
}
|
|
453
509
|
function onCleanup(fn) {
|
|
454
|
-
if (Owner === null)
|
|
510
|
+
if (Owner === null);
|
|
511
|
+
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
512
|
+
else Owner.cleanups.push(fn);
|
|
455
513
|
return fn;
|
|
456
514
|
}
|
|
457
515
|
function catchError(fn, handler) {
|
|
@@ -505,15 +563,17 @@ function startTransition(fn) {
|
|
|
505
563
|
Owner = o;
|
|
506
564
|
let t;
|
|
507
565
|
if (Scheduler || SuspenseContext) {
|
|
508
|
-
t =
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
566
|
+
t =
|
|
567
|
+
Transition ||
|
|
568
|
+
(Transition = {
|
|
569
|
+
sources: new Set(),
|
|
570
|
+
effects: [],
|
|
571
|
+
promises: new Set(),
|
|
572
|
+
disposed: new Set(),
|
|
573
|
+
queue: new Set(),
|
|
574
|
+
running: true
|
|
575
|
+
});
|
|
576
|
+
t.done || (t.done = new Promise(res => (t.resolve = res)));
|
|
517
577
|
t.running = true;
|
|
518
578
|
}
|
|
519
579
|
runUpdates(fn, false);
|
|
@@ -537,7 +597,9 @@ function createContext(defaultValue, options) {
|
|
|
537
597
|
};
|
|
538
598
|
}
|
|
539
599
|
function useContext(context) {
|
|
540
|
-
return Owner && Owner.context && Owner.context[context.id] !== undefined
|
|
600
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined
|
|
601
|
+
? Owner.context[context.id]
|
|
602
|
+
: context.defaultValue;
|
|
541
603
|
}
|
|
542
604
|
function children(fn) {
|
|
543
605
|
const children = createMemo(fn);
|
|
@@ -573,7 +635,8 @@ function enableExternalSource(factory) {
|
|
|
573
635
|
function readSignal() {
|
|
574
636
|
const runningTransition = Transition && Transition.running;
|
|
575
637
|
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
576
|
-
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
638
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
639
|
+
else {
|
|
577
640
|
const updates = Updates;
|
|
578
641
|
Updates = null;
|
|
579
642
|
runUpdates(() => lookUpstream(this), false);
|
|
@@ -601,11 +664,12 @@ function readSignal() {
|
|
|
601
664
|
return this.value;
|
|
602
665
|
}
|
|
603
666
|
function writeSignal(node, value, isComp) {
|
|
604
|
-
let current =
|
|
667
|
+
let current =
|
|
668
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
605
669
|
if (!node.comparator || !node.comparator(current, value)) {
|
|
606
670
|
if (Transition) {
|
|
607
671
|
const TransitionRunning = Transition.running;
|
|
608
|
-
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
672
|
+
if (TransitionRunning || (!isComp && Transition.sources.has(node))) {
|
|
609
673
|
Transition.sources.add(node);
|
|
610
674
|
node.tValue = value;
|
|
611
675
|
}
|
|
@@ -618,14 +682,16 @@ function writeSignal(node, value, isComp) {
|
|
|
618
682
|
const TransitionRunning = Transition && Transition.running;
|
|
619
683
|
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
620
684
|
if (TransitionRunning ? !o.tState : !o.state) {
|
|
621
|
-
if (o.pure) Updates.push(o);
|
|
685
|
+
if (o.pure) Updates.push(o);
|
|
686
|
+
else Effects.push(o);
|
|
622
687
|
if (o.observers) markDownstream(o);
|
|
623
688
|
}
|
|
624
|
-
if (!TransitionRunning) o.state = STALE;
|
|
689
|
+
if (!TransitionRunning) o.state = STALE;
|
|
690
|
+
else o.tState = STALE;
|
|
625
691
|
}
|
|
626
692
|
if (Updates.length > 10e5) {
|
|
627
693
|
Updates = [];
|
|
628
|
-
if (false)
|
|
694
|
+
if (false);
|
|
629
695
|
throw new Error();
|
|
630
696
|
}
|
|
631
697
|
}, false);
|
|
@@ -636,11 +702,12 @@ function writeSignal(node, value, isComp) {
|
|
|
636
702
|
function updateComputation(node) {
|
|
637
703
|
if (!node.fn) return;
|
|
638
704
|
cleanNode(node);
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
705
|
+
const time = ExecCount;
|
|
706
|
+
runComputation(
|
|
707
|
+
node,
|
|
708
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
709
|
+
time
|
|
710
|
+
);
|
|
644
711
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
645
712
|
queueMicrotask(() => {
|
|
646
713
|
runUpdates(() => {
|
|
@@ -651,11 +718,12 @@ function updateComputation(node) {
|
|
|
651
718
|
}, false);
|
|
652
719
|
});
|
|
653
720
|
}
|
|
654
|
-
Listener = listener;
|
|
655
|
-
Owner = owner;
|
|
656
721
|
}
|
|
657
722
|
function runComputation(node, value, time) {
|
|
658
723
|
let nextValue;
|
|
724
|
+
const owner = Owner,
|
|
725
|
+
listener = Listener;
|
|
726
|
+
Listener = Owner = node;
|
|
659
727
|
try {
|
|
660
728
|
nextValue = node.fn(value);
|
|
661
729
|
} catch (err) {
|
|
@@ -672,6 +740,9 @@ function runComputation(node, value, time) {
|
|
|
672
740
|
}
|
|
673
741
|
node.updatedAt = time + 1;
|
|
674
742
|
return handleError(err);
|
|
743
|
+
} finally {
|
|
744
|
+
Listener = listener;
|
|
745
|
+
Owner = owner;
|
|
675
746
|
}
|
|
676
747
|
if (!node.updatedAt || node.updatedAt <= time) {
|
|
677
748
|
if (node.updatedAt != null && "observers" in node) {
|
|
@@ -701,11 +772,14 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
701
772
|
c.state = 0;
|
|
702
773
|
c.tState = state;
|
|
703
774
|
}
|
|
704
|
-
if (Owner === null)
|
|
775
|
+
if (Owner === null);
|
|
776
|
+
else if (Owner !== UNOWNED) {
|
|
705
777
|
if (Transition && Transition.running && Owner.pure) {
|
|
706
|
-
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
778
|
+
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
779
|
+
else Owner.tOwned.push(c);
|
|
707
780
|
} else {
|
|
708
|
-
if (!Owner.owned) Owner.owned = [c];
|
|
781
|
+
if (!Owner.owned) Owner.owned = [c];
|
|
782
|
+
else Owner.owned.push(c);
|
|
709
783
|
}
|
|
710
784
|
}
|
|
711
785
|
if (ExternalSourceFactory) {
|
|
@@ -756,7 +830,8 @@ function runUpdates(fn, init) {
|
|
|
756
830
|
if (Updates) return fn();
|
|
757
831
|
let wait = false;
|
|
758
832
|
if (!init) Updates = [];
|
|
759
|
-
if (Effects) wait = true;
|
|
833
|
+
if (Effects) wait = true;
|
|
834
|
+
else Effects = [];
|
|
760
835
|
ExecCount++;
|
|
761
836
|
try {
|
|
762
837
|
const res = fn();
|
|
@@ -770,7 +845,8 @@ function runUpdates(fn, init) {
|
|
|
770
845
|
}
|
|
771
846
|
function completeUpdates(wait) {
|
|
772
847
|
if (Updates) {
|
|
773
|
-
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
848
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
849
|
+
else runQueue(Updates);
|
|
774
850
|
Updates = null;
|
|
775
851
|
}
|
|
776
852
|
if (wait) return;
|
|
@@ -838,7 +914,8 @@ function runUserEffects(queue) {
|
|
|
838
914
|
userLength = 0;
|
|
839
915
|
for (i = 0; i < queue.length; i++) {
|
|
840
916
|
const e = queue[i];
|
|
841
|
-
if (!e.user) runTop(e);
|
|
917
|
+
if (!e.user) runTop(e);
|
|
918
|
+
else queue[userLength++] = e;
|
|
842
919
|
}
|
|
843
920
|
if (sharedConfig.context) {
|
|
844
921
|
if (sharedConfig.count) {
|
|
@@ -856,13 +933,15 @@ function runUserEffects(queue) {
|
|
|
856
933
|
}
|
|
857
934
|
function lookUpstream(node, ignore) {
|
|
858
935
|
const runningTransition = Transition && Transition.running;
|
|
859
|
-
if (runningTransition) node.tState = 0;
|
|
936
|
+
if (runningTransition) node.tState = 0;
|
|
937
|
+
else node.state = 0;
|
|
860
938
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
861
939
|
const source = node.sources[i];
|
|
862
940
|
if (source.sources) {
|
|
863
941
|
const state = runningTransition ? source.tState : source.state;
|
|
864
942
|
if (state === STALE) {
|
|
865
|
-
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
943
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
944
|
+
runTop(source);
|
|
866
945
|
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
867
946
|
}
|
|
868
947
|
}
|
|
@@ -872,8 +951,10 @@ function markDownstream(node) {
|
|
|
872
951
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
873
952
|
const o = node.observers[i];
|
|
874
953
|
if (runningTransition ? !o.tState : !o.state) {
|
|
875
|
-
if (runningTransition) o.tState = PENDING;
|
|
876
|
-
|
|
954
|
+
if (runningTransition) o.tState = PENDING;
|
|
955
|
+
else o.state = PENDING;
|
|
956
|
+
if (o.pure) Updates.push(o);
|
|
957
|
+
else Effects.push(o);
|
|
877
958
|
o.observers && markDownstream(o);
|
|
878
959
|
}
|
|
879
960
|
}
|
|
@@ -910,7 +991,8 @@ function cleanNode(node) {
|
|
|
910
991
|
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
911
992
|
node.cleanups = null;
|
|
912
993
|
}
|
|
913
|
-
if (Transition && Transition.running) node.tState = 0;
|
|
994
|
+
if (Transition && Transition.running) node.tState = 0;
|
|
995
|
+
else node.state = 0;
|
|
914
996
|
}
|
|
915
997
|
function reset(node, top) {
|
|
916
998
|
if (!top) {
|
|
@@ -931,19 +1013,21 @@ function runErrors(err, fns, owner) {
|
|
|
931
1013
|
try {
|
|
932
1014
|
for (const f of fns) f(err);
|
|
933
1015
|
} catch (e) {
|
|
934
|
-
handleError(e, owner && owner.owner || null);
|
|
1016
|
+
handleError(e, (owner && owner.owner) || null);
|
|
935
1017
|
}
|
|
936
1018
|
}
|
|
937
1019
|
function handleError(err, owner = Owner) {
|
|
938
1020
|
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
939
1021
|
const error = castError(err);
|
|
940
1022
|
if (!fns) throw error;
|
|
941
|
-
if (Effects)
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1023
|
+
if (Effects)
|
|
1024
|
+
Effects.push({
|
|
1025
|
+
fn() {
|
|
1026
|
+
runErrors(error, fns, owner);
|
|
1027
|
+
},
|
|
1028
|
+
state: STALE
|
|
1029
|
+
});
|
|
1030
|
+
else runErrors(error, fns, owner);
|
|
947
1031
|
}
|
|
948
1032
|
function resolveChildren(children) {
|
|
949
1033
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -960,19 +1044,24 @@ function resolveChildren(children) {
|
|
|
960
1044
|
function createProvider(id, options) {
|
|
961
1045
|
return function provider(props) {
|
|
962
1046
|
let res;
|
|
963
|
-
createRenderEffect(
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
1047
|
+
createRenderEffect(
|
|
1048
|
+
() =>
|
|
1049
|
+
(res = untrack(() => {
|
|
1050
|
+
Owner.context = {
|
|
1051
|
+
...Owner.context,
|
|
1052
|
+
[id]: props.value
|
|
1053
|
+
};
|
|
1054
|
+
return children(() => props.children);
|
|
1055
|
+
})),
|
|
1056
|
+
undefined
|
|
1057
|
+
);
|
|
970
1058
|
return res;
|
|
971
1059
|
};
|
|
972
1060
|
}
|
|
973
1061
|
function onError(fn) {
|
|
974
1062
|
ERROR || (ERROR = Symbol("error"));
|
|
975
|
-
if (Owner === null)
|
|
1063
|
+
if (Owner === null);
|
|
1064
|
+
else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
976
1065
|
Owner.context = {
|
|
977
1066
|
...Owner.context,
|
|
978
1067
|
[ERROR]: [fn]
|
|
@@ -1001,7 +1090,8 @@ function observable(input) {
|
|
|
1001
1090
|
if (!(observer instanceof Object) || observer == null) {
|
|
1002
1091
|
throw new TypeError("Expected the observer to be an object.");
|
|
1003
1092
|
}
|
|
1004
|
-
const handler =
|
|
1093
|
+
const handler =
|
|
1094
|
+
typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1005
1095
|
if (!handler) {
|
|
1006
1096
|
return {
|
|
1007
1097
|
unsubscribe() {}
|
|
@@ -1032,7 +1122,7 @@ function from(producer) {
|
|
|
1032
1122
|
});
|
|
1033
1123
|
if ("subscribe" in producer) {
|
|
1034
1124
|
const unsub = producer.subscribe(v => set(() => v));
|
|
1035
|
-
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
1125
|
+
onCleanup(() => ("unsubscribe" in unsub ? unsub.unsubscribe() : unsub()));
|
|
1036
1126
|
} else {
|
|
1037
1127
|
const clean = producer(set);
|
|
1038
1128
|
onCleanup(clean);
|
|
@@ -1084,8 +1174,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1084
1174
|
});
|
|
1085
1175
|
len = 1;
|
|
1086
1176
|
}
|
|
1087
|
-
}
|
|
1088
|
-
else if (len === 0) {
|
|
1177
|
+
} else if (len === 0) {
|
|
1089
1178
|
mapped = new Array(newLen);
|
|
1090
1179
|
for (j = 0; j < newLen; j++) {
|
|
1091
1180
|
items[j] = newItems[j];
|
|
@@ -1096,8 +1185,16 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1096
1185
|
temp = new Array(newLen);
|
|
1097
1186
|
tempdisposers = new Array(newLen);
|
|
1098
1187
|
indexes && (tempIndexes = new Array(newLen));
|
|
1099
|
-
for (
|
|
1100
|
-
|
|
1188
|
+
for (
|
|
1189
|
+
start = 0, end = Math.min(len, newLen);
|
|
1190
|
+
start < end && items[start] === newItems[start];
|
|
1191
|
+
start++
|
|
1192
|
+
);
|
|
1193
|
+
for (
|
|
1194
|
+
end = len - 1, newEnd = newLen - 1;
|
|
1195
|
+
end >= start && newEnd >= start && items[end] === newItems[newEnd];
|
|
1196
|
+
end--, newEnd--
|
|
1197
|
+
) {
|
|
1101
1198
|
temp[newEnd] = mapped[end];
|
|
1102
1199
|
tempdisposers[newEnd] = disposers[end];
|
|
1103
1200
|
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
@@ -1131,7 +1228,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1131
1228
|
}
|
|
1132
1229
|
} else mapped[j] = createRoot(mapper);
|
|
1133
1230
|
}
|
|
1134
|
-
mapped = mapped.slice(0, len = newLen);
|
|
1231
|
+
mapped = mapped.slice(0, (len = newLen));
|
|
1135
1232
|
items = newItems.slice(0);
|
|
1136
1233
|
}
|
|
1137
1234
|
return mapped;
|
|
@@ -1197,7 +1294,7 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1197
1294
|
}
|
|
1198
1295
|
len = signals.length = disposers.length = newItems.length;
|
|
1199
1296
|
items = newItems.slice(0);
|
|
1200
|
-
return mapped = mapped.slice(0, len);
|
|
1297
|
+
return (mapped = mapped.slice(0, len));
|
|
1201
1298
|
});
|
|
1202
1299
|
function mapper(disposer) {
|
|
1203
1300
|
disposers[i] = disposer;
|
|
@@ -1266,29 +1363,33 @@ function mergeProps(...sources) {
|
|
|
1266
1363
|
let proxy = false;
|
|
1267
1364
|
for (let i = 0; i < sources.length; i++) {
|
|
1268
1365
|
const s = sources[i];
|
|
1269
|
-
proxy = proxy || !!s && $PROXY in s;
|
|
1270
|
-
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
1366
|
+
proxy = proxy || (!!s && $PROXY in s);
|
|
1367
|
+
sources[i] = typeof s === "function" ? ((proxy = true), createMemo(s)) : s;
|
|
1271
1368
|
}
|
|
1272
1369
|
if (proxy) {
|
|
1273
|
-
return new Proxy(
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1370
|
+
return new Proxy(
|
|
1371
|
+
{
|
|
1372
|
+
get(property) {
|
|
1373
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1374
|
+
const v = resolveSource(sources[i])[property];
|
|
1375
|
+
if (v !== undefined) return v;
|
|
1376
|
+
}
|
|
1377
|
+
},
|
|
1378
|
+
has(property) {
|
|
1379
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1380
|
+
if (property in resolveSource(sources[i])) return true;
|
|
1381
|
+
}
|
|
1382
|
+
return false;
|
|
1383
|
+
},
|
|
1384
|
+
keys() {
|
|
1385
|
+
const keys = [];
|
|
1386
|
+
for (let i = 0; i < sources.length; i++)
|
|
1387
|
+
keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1388
|
+
return [...new Set(keys)];
|
|
1283
1389
|
}
|
|
1284
|
-
return false;
|
|
1285
1390
|
},
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1289
|
-
return [...new Set(keys)];
|
|
1290
|
-
}
|
|
1291
|
-
}, propTraps);
|
|
1391
|
+
propTraps
|
|
1392
|
+
);
|
|
1292
1393
|
}
|
|
1293
1394
|
const target = {};
|
|
1294
1395
|
const sourcesMap = {};
|
|
@@ -1307,7 +1408,7 @@ function mergeProps(...sources) {
|
|
|
1307
1408
|
Object.defineProperty(target, key, {
|
|
1308
1409
|
enumerable: true,
|
|
1309
1410
|
configurable: true,
|
|
1310
|
-
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
1411
|
+
get: resolveSources.bind((sourcesMap[key] = [desc.get.bind(source)]))
|
|
1311
1412
|
});
|
|
1312
1413
|
} else {
|
|
1313
1414
|
if (desc.value !== undefined) defined.add(key);
|
|
@@ -1331,47 +1432,60 @@ function splitProps(props, ...keys) {
|
|
|
1331
1432
|
if ($PROXY in props) {
|
|
1332
1433
|
const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
|
|
1333
1434
|
const res = keys.map(k => {
|
|
1334
|
-
return new Proxy(
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1435
|
+
return new Proxy(
|
|
1436
|
+
{
|
|
1437
|
+
get(property) {
|
|
1438
|
+
return k.includes(property) ? props[property] : undefined;
|
|
1439
|
+
},
|
|
1440
|
+
has(property) {
|
|
1441
|
+
return k.includes(property) && property in props;
|
|
1442
|
+
},
|
|
1443
|
+
keys() {
|
|
1444
|
+
return k.filter(property => property in props);
|
|
1445
|
+
}
|
|
1340
1446
|
},
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
}
|
|
1344
|
-
}, propTraps);
|
|
1447
|
+
propTraps
|
|
1448
|
+
);
|
|
1345
1449
|
});
|
|
1346
|
-
res.push(
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1450
|
+
res.push(
|
|
1451
|
+
new Proxy(
|
|
1452
|
+
{
|
|
1453
|
+
get(property) {
|
|
1454
|
+
return blocked.has(property) ? undefined : props[property];
|
|
1455
|
+
},
|
|
1456
|
+
has(property) {
|
|
1457
|
+
return blocked.has(property) ? false : property in props;
|
|
1458
|
+
},
|
|
1459
|
+
keys() {
|
|
1460
|
+
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1461
|
+
}
|
|
1462
|
+
},
|
|
1463
|
+
propTraps
|
|
1464
|
+
)
|
|
1465
|
+
);
|
|
1357
1466
|
return res;
|
|
1358
1467
|
}
|
|
1359
1468
|
const otherObject = {};
|
|
1360
1469
|
const objects = keys.map(() => ({}));
|
|
1361
1470
|
for (const propName of Object.getOwnPropertyNames(props)) {
|
|
1362
1471
|
const desc = Object.getOwnPropertyDescriptor(props, propName);
|
|
1363
|
-
const isDefaultDesc =
|
|
1472
|
+
const isDefaultDesc =
|
|
1473
|
+
!desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1364
1474
|
let blocked = false;
|
|
1365
1475
|
let objectIndex = 0;
|
|
1366
1476
|
for (const k of keys) {
|
|
1367
1477
|
if (k.includes(propName)) {
|
|
1368
1478
|
blocked = true;
|
|
1369
|
-
isDefaultDesc
|
|
1479
|
+
isDefaultDesc
|
|
1480
|
+
? (objects[objectIndex][propName] = desc.value)
|
|
1481
|
+
: Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1370
1482
|
}
|
|
1371
1483
|
++objectIndex;
|
|
1372
1484
|
}
|
|
1373
1485
|
if (!blocked) {
|
|
1374
|
-
isDefaultDesc
|
|
1486
|
+
isDefaultDesc
|
|
1487
|
+
? (otherObject[propName] = desc.value)
|
|
1488
|
+
: Object.defineProperty(otherObject, propName, desc);
|
|
1375
1489
|
}
|
|
1376
1490
|
}
|
|
1377
1491
|
return [...objects, otherObject];
|
|
@@ -1397,17 +1511,21 @@ function lazy(fn) {
|
|
|
1397
1511
|
comp = s;
|
|
1398
1512
|
}
|
|
1399
1513
|
let Comp;
|
|
1400
|
-
return createMemo(
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1514
|
+
return createMemo(
|
|
1515
|
+
() =>
|
|
1516
|
+
(Comp = comp()) &&
|
|
1517
|
+
untrack(() => {
|
|
1518
|
+
if (false);
|
|
1519
|
+
if (!ctx) return Comp(props);
|
|
1520
|
+
const c = sharedConfig.context;
|
|
1521
|
+
setHydrateContext(ctx);
|
|
1522
|
+
const r = Comp(props);
|
|
1523
|
+
setHydrateContext(c);
|
|
1524
|
+
return r;
|
|
1525
|
+
})
|
|
1526
|
+
);
|
|
1409
1527
|
};
|
|
1410
|
-
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
1528
|
+
wrap.preload = () => p || ((p = fn()).then(mod => (comp = () => mod.default)), p);
|
|
1411
1529
|
return wrap;
|
|
1412
1530
|
}
|
|
1413
1531
|
let counter = 0;
|
|
@@ -1432,49 +1550,78 @@ function Index(props) {
|
|
|
1432
1550
|
function Show(props) {
|
|
1433
1551
|
const keyed = props.keyed;
|
|
1434
1552
|
const condition = createMemo(() => props.when, undefined, {
|
|
1435
|
-
equals: (a, b) => keyed ? a === b : !a === !b
|
|
1553
|
+
equals: (a, b) => (keyed ? a === b : !a === !b)
|
|
1436
1554
|
});
|
|
1437
|
-
return createMemo(
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1555
|
+
return createMemo(
|
|
1556
|
+
() => {
|
|
1557
|
+
const c = condition();
|
|
1558
|
+
if (c) {
|
|
1559
|
+
const child = props.children;
|
|
1560
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1561
|
+
return fn
|
|
1562
|
+
? untrack(() =>
|
|
1563
|
+
child(
|
|
1564
|
+
keyed
|
|
1565
|
+
? c
|
|
1566
|
+
: () => {
|
|
1567
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
1568
|
+
return props.when;
|
|
1569
|
+
}
|
|
1570
|
+
)
|
|
1571
|
+
)
|
|
1572
|
+
: child;
|
|
1573
|
+
}
|
|
1574
|
+
return props.fallback;
|
|
1575
|
+
},
|
|
1576
|
+
undefined,
|
|
1577
|
+
undefined
|
|
1578
|
+
);
|
|
1449
1579
|
}
|
|
1450
1580
|
function Switch(props) {
|
|
1451
1581
|
let keyed = false;
|
|
1452
|
-
const equals = (a, b) =>
|
|
1582
|
+
const equals = (a, b) =>
|
|
1583
|
+
a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1453
1584
|
const conditions = children(() => props.children),
|
|
1454
|
-
evalConditions = createMemo(
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1585
|
+
evalConditions = createMemo(
|
|
1586
|
+
() => {
|
|
1587
|
+
let conds = conditions();
|
|
1588
|
+
if (!Array.isArray(conds)) conds = [conds];
|
|
1589
|
+
for (let i = 0; i < conds.length; i++) {
|
|
1590
|
+
const c = conds[i].when;
|
|
1591
|
+
if (c) {
|
|
1592
|
+
keyed = !!conds[i].keyed;
|
|
1593
|
+
return [i, c, conds[i]];
|
|
1594
|
+
}
|
|
1462
1595
|
}
|
|
1596
|
+
return [-1];
|
|
1597
|
+
},
|
|
1598
|
+
undefined,
|
|
1599
|
+
{
|
|
1600
|
+
equals
|
|
1463
1601
|
}
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1602
|
+
);
|
|
1603
|
+
return createMemo(
|
|
1604
|
+
() => {
|
|
1605
|
+
const [index, when, cond] = evalConditions();
|
|
1606
|
+
if (index < 0) return props.fallback;
|
|
1607
|
+
const c = cond.children;
|
|
1608
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
1609
|
+
return fn
|
|
1610
|
+
? untrack(() =>
|
|
1611
|
+
c(
|
|
1612
|
+
keyed
|
|
1613
|
+
? when
|
|
1614
|
+
: () => {
|
|
1615
|
+
if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
|
|
1616
|
+
return cond.when;
|
|
1617
|
+
}
|
|
1618
|
+
)
|
|
1619
|
+
)
|
|
1620
|
+
: c;
|
|
1621
|
+
},
|
|
1622
|
+
undefined,
|
|
1623
|
+
undefined
|
|
1624
|
+
);
|
|
1478
1625
|
}
|
|
1479
1626
|
function Match(props) {
|
|
1480
1627
|
return props;
|
|
@@ -1485,22 +1632,28 @@ function resetErrorBoundaries() {
|
|
|
1485
1632
|
}
|
|
1486
1633
|
function ErrorBoundary(props) {
|
|
1487
1634
|
let err;
|
|
1488
|
-
if (sharedConfig.context && sharedConfig.load)
|
|
1635
|
+
if (sharedConfig.context && sharedConfig.load)
|
|
1636
|
+
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1489
1637
|
const [errored, setErrored] = createSignal(err, undefined);
|
|
1490
1638
|
Errors || (Errors = new Set());
|
|
1491
1639
|
Errors.add(setErrored);
|
|
1492
1640
|
onCleanup(() => Errors.delete(setErrored));
|
|
1493
|
-
return createMemo(
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1641
|
+
return createMemo(
|
|
1642
|
+
() => {
|
|
1643
|
+
let e;
|
|
1644
|
+
if ((e = errored())) {
|
|
1645
|
+
const f = props.fallback;
|
|
1646
|
+
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1647
|
+
}
|
|
1648
|
+
return catchError(() => props.children, setErrored);
|
|
1649
|
+
},
|
|
1650
|
+
undefined,
|
|
1651
|
+
undefined
|
|
1652
|
+
);
|
|
1501
1653
|
}
|
|
1502
1654
|
|
|
1503
|
-
const suspenseListEquals = (a, b) =>
|
|
1655
|
+
const suspenseListEquals = (a, b) =>
|
|
1656
|
+
a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1504
1657
|
const SuspenseListContext = createContext();
|
|
1505
1658
|
function SuspenseList(props) {
|
|
1506
1659
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
@@ -1512,51 +1665,51 @@ function SuspenseList(props) {
|
|
|
1512
1665
|
if (listContext) {
|
|
1513
1666
|
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1514
1667
|
}
|
|
1515
|
-
const resolved = createMemo(
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
showContent = true,
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
const res = reg.map(() => ({
|
|
1527
|
-
showContent: all && showContent,
|
|
1528
|
-
showFallback
|
|
1529
|
-
}));
|
|
1530
|
-
res.inFallback = !all;
|
|
1531
|
-
return res;
|
|
1532
|
-
}
|
|
1533
|
-
let stop = false;
|
|
1534
|
-
let inFallback = prev.inFallback;
|
|
1535
|
-
const res = [];
|
|
1536
|
-
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1537
|
-
const n = reverse ? len - i - 1 : i,
|
|
1538
|
-
s = reg[n]();
|
|
1539
|
-
if (!stop && !s) {
|
|
1540
|
-
res[n] = {
|
|
1541
|
-
showContent,
|
|
1668
|
+
const resolved = createMemo(
|
|
1669
|
+
prev => {
|
|
1670
|
+
const reveal = props.revealOrder,
|
|
1671
|
+
tail = props.tail,
|
|
1672
|
+
{ showContent = true, showFallback = true } = show ? show() : {},
|
|
1673
|
+
reg = registry(),
|
|
1674
|
+
reverse = reveal === "backwards";
|
|
1675
|
+
if (reveal === "together") {
|
|
1676
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1677
|
+
const res = reg.map(() => ({
|
|
1678
|
+
showContent: all && showContent,
|
|
1542
1679
|
showFallback
|
|
1543
|
-
};
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
if (next) inFallback = true;
|
|
1547
|
-
res[n] = {
|
|
1548
|
-
showContent: next,
|
|
1549
|
-
showFallback: !tail || next && tail === "collapsed" ? showFallback : false
|
|
1550
|
-
};
|
|
1551
|
-
stop = true;
|
|
1680
|
+
}));
|
|
1681
|
+
res.inFallback = !all;
|
|
1682
|
+
return res;
|
|
1552
1683
|
}
|
|
1684
|
+
let stop = false;
|
|
1685
|
+
let inFallback = prev.inFallback;
|
|
1686
|
+
const res = [];
|
|
1687
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1688
|
+
const n = reverse ? len - i - 1 : i,
|
|
1689
|
+
s = reg[n]();
|
|
1690
|
+
if (!stop && !s) {
|
|
1691
|
+
res[n] = {
|
|
1692
|
+
showContent,
|
|
1693
|
+
showFallback
|
|
1694
|
+
};
|
|
1695
|
+
} else {
|
|
1696
|
+
const next = !stop;
|
|
1697
|
+
if (next) inFallback = true;
|
|
1698
|
+
res[n] = {
|
|
1699
|
+
showContent: next,
|
|
1700
|
+
showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
|
|
1701
|
+
};
|
|
1702
|
+
stop = true;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
if (!stop) inFallback = false;
|
|
1706
|
+
res.inFallback = inFallback;
|
|
1707
|
+
return res;
|
|
1708
|
+
},
|
|
1709
|
+
{
|
|
1710
|
+
inFallback: false
|
|
1553
1711
|
}
|
|
1554
|
-
|
|
1555
|
-
res.inFallback = inFallback;
|
|
1556
|
-
return res;
|
|
1557
|
-
}, {
|
|
1558
|
-
inFallback: false
|
|
1559
|
-
});
|
|
1712
|
+
);
|
|
1560
1713
|
setWrapper(() => resolved);
|
|
1561
1714
|
return createComponent(SuspenseListContext.Provider, {
|
|
1562
1715
|
value: {
|
|
@@ -1631,17 +1784,14 @@ function Suspense(props) {
|
|
|
1631
1784
|
ctx = sharedConfig.context;
|
|
1632
1785
|
if (flicker) {
|
|
1633
1786
|
flicker();
|
|
1634
|
-
return flicker = undefined;
|
|
1787
|
+
return (flicker = undefined);
|
|
1635
1788
|
}
|
|
1636
1789
|
if (ctx && p === "$$f") setHydrateContext();
|
|
1637
1790
|
const rendered = createMemo(() => props.children);
|
|
1638
1791
|
return createMemo(prev => {
|
|
1639
1792
|
const inFallback = store.inFallback(),
|
|
1640
|
-
{
|
|
1641
|
-
|
|
1642
|
-
showFallback = true
|
|
1643
|
-
} = show ? show() : {};
|
|
1644
|
-
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1793
|
+
{ showContent = true, showFallback = true } = show ? show() : {};
|
|
1794
|
+
if ((!inFallback || (p && p !== "$$f")) && showContent) {
|
|
1645
1795
|
store.resolved = true;
|
|
1646
1796
|
dispose && dispose();
|
|
1647
1797
|
dispose = ctx = p = undefined;
|
|
@@ -1669,4 +1819,59 @@ function Suspense(props) {
|
|
|
1669
1819
|
|
|
1670
1820
|
const DEV = undefined;
|
|
1671
1821
|
|
|
1672
|
-
export {
|
|
1822
|
+
export {
|
|
1823
|
+
$DEVCOMP,
|
|
1824
|
+
$PROXY,
|
|
1825
|
+
$TRACK,
|
|
1826
|
+
DEV,
|
|
1827
|
+
ErrorBoundary,
|
|
1828
|
+
For,
|
|
1829
|
+
Index,
|
|
1830
|
+
Match,
|
|
1831
|
+
Show,
|
|
1832
|
+
Suspense,
|
|
1833
|
+
SuspenseList,
|
|
1834
|
+
Switch,
|
|
1835
|
+
batch,
|
|
1836
|
+
cancelCallback,
|
|
1837
|
+
catchError,
|
|
1838
|
+
children,
|
|
1839
|
+
createComponent,
|
|
1840
|
+
createComputed,
|
|
1841
|
+
createContext,
|
|
1842
|
+
createDeferred,
|
|
1843
|
+
createEffect,
|
|
1844
|
+
createMemo,
|
|
1845
|
+
createReaction,
|
|
1846
|
+
createRenderEffect,
|
|
1847
|
+
createResource,
|
|
1848
|
+
createRoot,
|
|
1849
|
+
createSelector,
|
|
1850
|
+
createSignal,
|
|
1851
|
+
createUniqueId,
|
|
1852
|
+
enableExternalSource,
|
|
1853
|
+
enableHydration,
|
|
1854
|
+
enableScheduling,
|
|
1855
|
+
equalFn,
|
|
1856
|
+
from,
|
|
1857
|
+
getListener,
|
|
1858
|
+
getOwner,
|
|
1859
|
+
indexArray,
|
|
1860
|
+
lazy,
|
|
1861
|
+
mapArray,
|
|
1862
|
+
mergeProps,
|
|
1863
|
+
observable,
|
|
1864
|
+
on,
|
|
1865
|
+
onCleanup,
|
|
1866
|
+
onError,
|
|
1867
|
+
onMount,
|
|
1868
|
+
requestCallback,
|
|
1869
|
+
resetErrorBoundaries,
|
|
1870
|
+
runWithOwner,
|
|
1871
|
+
sharedConfig,
|
|
1872
|
+
splitProps,
|
|
1873
|
+
startTransition,
|
|
1874
|
+
untrack,
|
|
1875
|
+
useContext,
|
|
1876
|
+
useTransition
|
|
1877
|
+
};
|