solid-js 1.9.6 → 1.9.7
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 +18 -8
- package/dist/dev.js +326 -557
- package/dist/server.js +81 -178
- package/dist/solid.cjs +18 -8
- package/dist/solid.js +282 -486
- package/h/dist/h.js +9 -40
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +8 -11
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +94 -219
- package/html/types/lit.d.ts +33 -52
- package/package.json +3 -3
- package/store/dist/dev.js +43 -123
- package/store/dist/server.js +8 -20
- package/store/dist/store.js +40 -114
- package/store/types/index.d.ts +7 -21
- package/store/types/modifiers.d.ts +3 -6
- package/store/types/mutable.d.ts +2 -5
- package/store/types/server.d.ts +5 -25
- package/store/types/store.d.ts +61 -218
- package/types/index.d.ts +11 -78
- package/types/reactive/array.d.ts +4 -12
- package/types/reactive/observable.d.ts +16 -22
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +145 -236
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +37 -73
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +15 -15
- package/types/server/index.d.ts +2 -57
- package/types/server/reactive.d.ts +45 -76
- package/types/server/rendering.d.ts +98 -169
- package/universal/dist/dev.js +12 -28
- package/universal/dist/universal.js +12 -28
- package/universal/types/index.d.ts +1 -3
- package/universal/types/universal.d.ts +1 -0
- package/web/dist/dev.js +90 -644
- package/web/dist/server.cjs +1 -1
- package/web/dist/server.js +110 -647
- package/web/dist/web.js +88 -632
- package/web/storage/dist/storage.js +3 -3
- package/web/types/core.d.ts +1 -9
- package/web/types/index.d.ts +11 -31
- package/web/types/server-mock.d.ts +32 -47
package/dist/solid.js
CHANGED
|
@@ -52,11 +52,9 @@ function enqueue(taskQueue, task) {
|
|
|
52
52
|
let m = 0;
|
|
53
53
|
let n = taskQueue.length - 1;
|
|
54
54
|
while (m <= n) {
|
|
55
|
-
const k =
|
|
55
|
+
const k = n + m >> 1;
|
|
56
56
|
const cmp = task.expirationTime - taskQueue[k].expirationTime;
|
|
57
|
-
if (cmp > 0) m = k + 1;
|
|
58
|
-
else if (cmp < 0) n = k - 1;
|
|
59
|
-
else return k;
|
|
57
|
+
if (cmp > 0) m = k + 1;else if (cmp < 0) n = k - 1;else return k;
|
|
60
58
|
}
|
|
61
59
|
return m;
|
|
62
60
|
}
|
|
@@ -177,14 +175,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
177
175
|
owner = Owner,
|
|
178
176
|
unowned = fn.length === 0,
|
|
179
177
|
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
180
|
-
root = unowned
|
|
181
|
-
|
|
182
|
-
:
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
owner: current
|
|
187
|
-
},
|
|
178
|
+
root = unowned ? UNOWNED : {
|
|
179
|
+
owned: null,
|
|
180
|
+
cleanups: null,
|
|
181
|
+
context: current ? current.context : null,
|
|
182
|
+
owner: current
|
|
183
|
+
},
|
|
188
184
|
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
189
185
|
Owner = root;
|
|
190
186
|
Listener = null;
|
|
@@ -205,8 +201,7 @@ function createSignal(value, options) {
|
|
|
205
201
|
};
|
|
206
202
|
const setter = value => {
|
|
207
203
|
if (typeof value === "function") {
|
|
208
|
-
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
209
|
-
else value = value(s.value);
|
|
204
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
|
|
210
205
|
}
|
|
211
206
|
return writeSignal(s, value);
|
|
212
207
|
};
|
|
@@ -214,13 +209,11 @@ function createSignal(value, options) {
|
|
|
214
209
|
}
|
|
215
210
|
function createComputed(fn, value, options) {
|
|
216
211
|
const c = createComputation(fn, value, true, STALE);
|
|
217
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
218
|
-
else updateComputation(c);
|
|
212
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
219
213
|
}
|
|
220
214
|
function createRenderEffect(fn, value, options) {
|
|
221
215
|
const c = createComputation(fn, value, false, STALE);
|
|
222
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
223
|
-
else updateComputation(c);
|
|
216
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
224
217
|
}
|
|
225
218
|
function createEffect(fn, value, options) {
|
|
226
219
|
runEffects = runUserEffects;
|
|
@@ -232,15 +225,10 @@ function createEffect(fn, value, options) {
|
|
|
232
225
|
}
|
|
233
226
|
function createReaction(onInvalidate, options) {
|
|
234
227
|
let fn;
|
|
235
|
-
const c = createComputation(
|
|
236
|
-
()
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
},
|
|
240
|
-
undefined,
|
|
241
|
-
false,
|
|
242
|
-
0
|
|
243
|
-
),
|
|
228
|
+
const c = createComputation(() => {
|
|
229
|
+
fn ? fn() : untrack(onInvalidate);
|
|
230
|
+
fn = undefined;
|
|
231
|
+
}, undefined, false, 0),
|
|
244
232
|
s = SuspenseContext && useContext(SuspenseContext);
|
|
245
233
|
if (s) c.suspense = s;
|
|
246
234
|
c.user = true;
|
|
@@ -293,19 +281,15 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
293
281
|
[state, setState] = createSignal(resolved ? "ready" : "unresolved");
|
|
294
282
|
if (sharedConfig.context) {
|
|
295
283
|
id = sharedConfig.getNextContextId();
|
|
296
|
-
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
297
|
-
else if (sharedConfig.load && sharedConfig.has(id)) initP = sharedConfig.load(id);
|
|
284
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && sharedConfig.has(id)) initP = sharedConfig.load(id);
|
|
298
285
|
}
|
|
299
286
|
function loadEnd(p, v, error, key) {
|
|
300
287
|
if (pr === p) {
|
|
301
288
|
pr = null;
|
|
302
289
|
key !== undefined && (resolved = true);
|
|
303
|
-
if ((p === initP || v === initP) && options.onHydrated)
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
value: v
|
|
307
|
-
})
|
|
308
|
-
);
|
|
290
|
+
if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
|
|
291
|
+
value: v
|
|
292
|
+
}));
|
|
309
293
|
initP = NO_INIT;
|
|
310
294
|
if (Transition && p && loadedUnderTransition) {
|
|
311
295
|
Transition.promises.delete(p);
|
|
@@ -336,8 +320,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
336
320
|
createComputed(() => {
|
|
337
321
|
track();
|
|
338
322
|
if (pr) {
|
|
339
|
-
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
340
|
-
else if (!contexts.has(c)) {
|
|
323
|
+
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
|
|
341
324
|
c.increment();
|
|
342
325
|
contexts.add(c);
|
|
343
326
|
}
|
|
@@ -356,35 +339,36 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
356
339
|
return;
|
|
357
340
|
}
|
|
358
341
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
342
|
+
let error;
|
|
343
|
+
const p = initP !== NO_INIT ? initP : untrack(() => {
|
|
344
|
+
try {
|
|
345
|
+
return fetcher(lookup, {
|
|
346
|
+
value: value(),
|
|
347
|
+
refetching
|
|
348
|
+
});
|
|
349
|
+
} catch (fetcherError) {
|
|
350
|
+
error = fetcherError;
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
if (error !== undefined) {
|
|
354
|
+
loadEnd(pr, undefined, castError(error), lookup);
|
|
355
|
+
return;
|
|
356
|
+
} else if (!isPromise(p)) {
|
|
369
357
|
loadEnd(pr, p, undefined, lookup);
|
|
370
358
|
return p;
|
|
371
359
|
}
|
|
372
360
|
pr = p;
|
|
373
|
-
if ("
|
|
374
|
-
if (p.
|
|
375
|
-
else loadEnd(pr, undefined, castError(p.value), lookup);
|
|
361
|
+
if ("v" in p) {
|
|
362
|
+
if (p.s === 1) loadEnd(pr, p.v, undefined, lookup);else loadEnd(pr, undefined, castError(p.v), lookup);
|
|
376
363
|
return p;
|
|
377
364
|
}
|
|
378
365
|
scheduled = true;
|
|
379
|
-
queueMicrotask(() =>
|
|
366
|
+
queueMicrotask(() => scheduled = false);
|
|
380
367
|
runUpdates(() => {
|
|
381
368
|
setState(resolved ? "refreshing" : "pending");
|
|
382
369
|
trigger();
|
|
383
370
|
}, false);
|
|
384
|
-
return p.then(
|
|
385
|
-
v => loadEnd(p, v, undefined, lookup),
|
|
386
|
-
e => loadEnd(p, undefined, castError(e), lookup)
|
|
387
|
-
);
|
|
371
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
|
|
388
372
|
}
|
|
389
373
|
Object.defineProperties(read, {
|
|
390
374
|
state: {
|
|
@@ -409,80 +393,50 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
409
393
|
}
|
|
410
394
|
});
|
|
411
395
|
let owner = Owner;
|
|
412
|
-
if (dynamic) createComputed(() => (
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
refetch: info => runWithOwner(owner, () => load(info)),
|
|
418
|
-
mutate: setValue
|
|
419
|
-
}
|
|
420
|
-
];
|
|
396
|
+
if (dynamic) createComputed(() => (owner = Owner, load(false)));else load(false);
|
|
397
|
+
return [read, {
|
|
398
|
+
refetch: info => runWithOwner(owner, () => load(info)),
|
|
399
|
+
mutate: setValue
|
|
400
|
+
}];
|
|
421
401
|
}
|
|
422
402
|
function createDeferred(source, options) {
|
|
423
403
|
let t,
|
|
424
404
|
timeout = options ? options.timeoutMs : undefined;
|
|
425
|
-
const node = createComputation(
|
|
426
|
-
() => {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
timeout
|
|
433
|
-
}
|
|
434
|
-
: undefined
|
|
435
|
-
);
|
|
436
|
-
return source();
|
|
437
|
-
},
|
|
438
|
-
undefined,
|
|
439
|
-
true
|
|
440
|
-
);
|
|
441
|
-
const [deferred, setDeferred] = createSignal(
|
|
442
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
443
|
-
options
|
|
444
|
-
);
|
|
405
|
+
const node = createComputation(() => {
|
|
406
|
+
if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
|
|
407
|
+
timeout
|
|
408
|
+
} : undefined);
|
|
409
|
+
return source();
|
|
410
|
+
}, undefined, true);
|
|
411
|
+
const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);
|
|
445
412
|
updateComputation(node);
|
|
446
|
-
setDeferred(() =>
|
|
447
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
448
|
-
);
|
|
413
|
+
setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
449
414
|
return deferred;
|
|
450
415
|
}
|
|
451
416
|
function createSelector(source, fn = equalFn, options) {
|
|
452
417
|
const subs = new Map();
|
|
453
|
-
const node = createComputation(
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
for (const
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
return v;
|
|
465
|
-
},
|
|
466
|
-
undefined,
|
|
467
|
-
true,
|
|
468
|
-
STALE
|
|
469
|
-
);
|
|
418
|
+
const node = createComputation(p => {
|
|
419
|
+
const v = source();
|
|
420
|
+
for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
|
|
421
|
+
for (const c of val.values()) {
|
|
422
|
+
c.state = STALE;
|
|
423
|
+
if (c.pure) Updates.push(c);else Effects.push(c);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return v;
|
|
427
|
+
}, undefined, true, STALE);
|
|
470
428
|
updateComputation(node);
|
|
471
429
|
return key => {
|
|
472
430
|
const listener = Listener;
|
|
473
431
|
if (listener) {
|
|
474
432
|
let l;
|
|
475
|
-
if (
|
|
476
|
-
else subs.set(key, (l = new Set([listener])));
|
|
433
|
+
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
477
434
|
onCleanup(() => {
|
|
478
435
|
l.delete(listener);
|
|
479
436
|
!l.size && subs.delete(key);
|
|
480
437
|
});
|
|
481
438
|
}
|
|
482
|
-
return fn(
|
|
483
|
-
key,
|
|
484
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
485
|
-
);
|
|
439
|
+
return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
486
440
|
};
|
|
487
441
|
}
|
|
488
442
|
function batch(fn) {
|
|
@@ -522,9 +476,7 @@ function onMount(fn) {
|
|
|
522
476
|
createEffect(() => untrack(fn));
|
|
523
477
|
}
|
|
524
478
|
function onCleanup(fn) {
|
|
525
|
-
if (Owner === null);
|
|
526
|
-
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
527
|
-
else Owner.cleanups.push(fn);
|
|
479
|
+
if (Owner === null) ;else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
|
|
528
480
|
return fn;
|
|
529
481
|
}
|
|
530
482
|
function catchError(fn, handler) {
|
|
@@ -578,17 +530,15 @@ function startTransition(fn) {
|
|
|
578
530
|
Owner = o;
|
|
579
531
|
let t;
|
|
580
532
|
if (Scheduler || SuspenseContext) {
|
|
581
|
-
t =
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
});
|
|
591
|
-
t.done || (t.done = new Promise(res => (t.resolve = res)));
|
|
533
|
+
t = Transition || (Transition = {
|
|
534
|
+
sources: new Set(),
|
|
535
|
+
effects: [],
|
|
536
|
+
promises: new Set(),
|
|
537
|
+
disposed: new Set(),
|
|
538
|
+
queue: new Set(),
|
|
539
|
+
running: true
|
|
540
|
+
});
|
|
541
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
592
542
|
t.running = true;
|
|
593
543
|
}
|
|
594
544
|
runUpdates(fn, false);
|
|
@@ -596,7 +546,7 @@ function startTransition(fn) {
|
|
|
596
546
|
return t ? t.done : undefined;
|
|
597
547
|
});
|
|
598
548
|
}
|
|
599
|
-
const [transPending, setTransPending] = /*@__PURE__*/
|
|
549
|
+
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
600
550
|
function useTransition() {
|
|
601
551
|
return [transPending, startTransition];
|
|
602
552
|
}
|
|
@@ -614,9 +564,7 @@ function createContext(defaultValue, options) {
|
|
|
614
564
|
}
|
|
615
565
|
function useContext(context) {
|
|
616
566
|
let value;
|
|
617
|
-
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined
|
|
618
|
-
? value
|
|
619
|
-
: context.defaultValue;
|
|
567
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
|
|
620
568
|
}
|
|
621
569
|
function children(fn) {
|
|
622
570
|
const children = createMemo(fn);
|
|
@@ -633,7 +581,10 @@ function getSuspenseContext() {
|
|
|
633
581
|
}
|
|
634
582
|
function enableExternalSource(factory, untrack = fn => fn()) {
|
|
635
583
|
if (ExternalSourceConfig) {
|
|
636
|
-
const {
|
|
584
|
+
const {
|
|
585
|
+
factory: oldFactory,
|
|
586
|
+
untrack: oldUntrack
|
|
587
|
+
} = ExternalSourceConfig;
|
|
637
588
|
ExternalSourceConfig = {
|
|
638
589
|
factory: (fn, trigger) => {
|
|
639
590
|
const oldSource = oldFactory(fn, trigger);
|
|
@@ -658,8 +609,7 @@ function enableExternalSource(factory, untrack = fn => fn()) {
|
|
|
658
609
|
function readSignal() {
|
|
659
610
|
const runningTransition = Transition && Transition.running;
|
|
660
611
|
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
661
|
-
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
662
|
-
else {
|
|
612
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
|
|
663
613
|
const updates = Updates;
|
|
664
614
|
Updates = null;
|
|
665
615
|
runUpdates(() => lookUpstream(this), false);
|
|
@@ -687,12 +637,11 @@ function readSignal() {
|
|
|
687
637
|
return this.value;
|
|
688
638
|
}
|
|
689
639
|
function writeSignal(node, value, isComp) {
|
|
690
|
-
let current =
|
|
691
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
640
|
+
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
692
641
|
if (!node.comparator || !node.comparator(current, value)) {
|
|
693
642
|
if (Transition) {
|
|
694
643
|
const TransitionRunning = Transition.running;
|
|
695
|
-
if (TransitionRunning ||
|
|
644
|
+
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
696
645
|
Transition.sources.add(node);
|
|
697
646
|
node.tValue = value;
|
|
698
647
|
}
|
|
@@ -705,16 +654,14 @@ function writeSignal(node, value, isComp) {
|
|
|
705
654
|
const TransitionRunning = Transition && Transition.running;
|
|
706
655
|
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
707
656
|
if (TransitionRunning ? !o.tState : !o.state) {
|
|
708
|
-
if (o.pure) Updates.push(o);
|
|
709
|
-
else Effects.push(o);
|
|
657
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
710
658
|
if (o.observers) markDownstream(o);
|
|
711
659
|
}
|
|
712
|
-
if (!TransitionRunning) o.state = STALE;
|
|
713
|
-
else o.tState = STALE;
|
|
660
|
+
if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
|
|
714
661
|
}
|
|
715
662
|
if (Updates.length > 10e5) {
|
|
716
663
|
Updates = [];
|
|
717
|
-
if (IS_DEV);
|
|
664
|
+
if (IS_DEV) ;
|
|
718
665
|
throw new Error();
|
|
719
666
|
}
|
|
720
667
|
}, false);
|
|
@@ -726,11 +673,7 @@ function updateComputation(node) {
|
|
|
726
673
|
if (!node.fn) return;
|
|
727
674
|
cleanNode(node);
|
|
728
675
|
const time = ExecCount;
|
|
729
|
-
runComputation(
|
|
730
|
-
node,
|
|
731
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
732
|
-
time
|
|
733
|
-
);
|
|
676
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
734
677
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
735
678
|
queueMicrotask(() => {
|
|
736
679
|
runUpdates(() => {
|
|
@@ -795,14 +738,11 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
795
738
|
c.state = 0;
|
|
796
739
|
c.tState = state;
|
|
797
740
|
}
|
|
798
|
-
if (Owner === null);
|
|
799
|
-
else if (Owner !== UNOWNED) {
|
|
741
|
+
if (Owner === null) ;else if (Owner !== UNOWNED) {
|
|
800
742
|
if (Transition && Transition.running && Owner.pure) {
|
|
801
|
-
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
802
|
-
else Owner.tOwned.push(c);
|
|
743
|
+
if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
|
|
803
744
|
} else {
|
|
804
|
-
if (!Owner.owned) Owner.owned = [c];
|
|
805
|
-
else Owner.owned.push(c);
|
|
745
|
+
if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
|
|
806
746
|
}
|
|
807
747
|
}
|
|
808
748
|
if (ExternalSourceConfig && c.fn) {
|
|
@@ -853,8 +793,7 @@ function runUpdates(fn, init) {
|
|
|
853
793
|
if (Updates) return fn();
|
|
854
794
|
let wait = false;
|
|
855
795
|
if (!init) Updates = [];
|
|
856
|
-
if (Effects) wait = true;
|
|
857
|
-
else Effects = [];
|
|
796
|
+
if (Effects) wait = true;else Effects = [];
|
|
858
797
|
ExecCount++;
|
|
859
798
|
try {
|
|
860
799
|
const res = fn();
|
|
@@ -868,8 +807,7 @@ function runUpdates(fn, init) {
|
|
|
868
807
|
}
|
|
869
808
|
function completeUpdates(wait) {
|
|
870
809
|
if (Updates) {
|
|
871
|
-
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
872
|
-
else runQueue(Updates);
|
|
810
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
|
|
873
811
|
Updates = null;
|
|
874
812
|
}
|
|
875
813
|
if (wait) return;
|
|
@@ -937,8 +875,7 @@ function runUserEffects(queue) {
|
|
|
937
875
|
userLength = 0;
|
|
938
876
|
for (i = 0; i < queue.length; i++) {
|
|
939
877
|
const e = queue[i];
|
|
940
|
-
if (!e.user) runTop(e);
|
|
941
|
-
else queue[userLength++] = e;
|
|
878
|
+
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
942
879
|
}
|
|
943
880
|
if (sharedConfig.context) {
|
|
944
881
|
if (sharedConfig.count) {
|
|
@@ -957,15 +894,13 @@ function runUserEffects(queue) {
|
|
|
957
894
|
}
|
|
958
895
|
function lookUpstream(node, ignore) {
|
|
959
896
|
const runningTransition = Transition && Transition.running;
|
|
960
|
-
if (runningTransition) node.tState = 0;
|
|
961
|
-
else node.state = 0;
|
|
897
|
+
if (runningTransition) node.tState = 0;else node.state = 0;
|
|
962
898
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
963
899
|
const source = node.sources[i];
|
|
964
900
|
if (source.sources) {
|
|
965
901
|
const state = runningTransition ? source.tState : source.state;
|
|
966
902
|
if (state === STALE) {
|
|
967
|
-
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
968
|
-
runTop(source);
|
|
903
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
|
|
969
904
|
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
970
905
|
}
|
|
971
906
|
}
|
|
@@ -975,10 +910,8 @@ function markDownstream(node) {
|
|
|
975
910
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
976
911
|
const o = node.observers[i];
|
|
977
912
|
if (runningTransition ? !o.tState : !o.state) {
|
|
978
|
-
if (runningTransition) o.tState = PENDING;
|
|
979
|
-
|
|
980
|
-
if (o.pure) Updates.push(o);
|
|
981
|
-
else Effects.push(o);
|
|
913
|
+
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
914
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
982
915
|
o.observers && markDownstream(o);
|
|
983
916
|
}
|
|
984
917
|
}
|
|
@@ -1015,8 +948,7 @@ function cleanNode(node) {
|
|
|
1015
948
|
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
1016
949
|
node.cleanups = null;
|
|
1017
950
|
}
|
|
1018
|
-
if (Transition && Transition.running) node.tState = 0;
|
|
1019
|
-
else node.state = 0;
|
|
951
|
+
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
1020
952
|
}
|
|
1021
953
|
function reset(node, top) {
|
|
1022
954
|
if (!top) {
|
|
@@ -1037,21 +969,19 @@ function runErrors(err, fns, owner) {
|
|
|
1037
969
|
try {
|
|
1038
970
|
for (const f of fns) f(err);
|
|
1039
971
|
} catch (e) {
|
|
1040
|
-
handleError(e,
|
|
972
|
+
handleError(e, owner && owner.owner || null);
|
|
1041
973
|
}
|
|
1042
974
|
}
|
|
1043
975
|
function handleError(err, owner = Owner) {
|
|
1044
976
|
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
1045
977
|
const error = castError(err);
|
|
1046
978
|
if (!fns) throw error;
|
|
1047
|
-
if (Effects)
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
});
|
|
1054
|
-
else runErrors(error, fns, owner);
|
|
979
|
+
if (Effects) Effects.push({
|
|
980
|
+
fn() {
|
|
981
|
+
runErrors(error, fns, owner);
|
|
982
|
+
},
|
|
983
|
+
state: STALE
|
|
984
|
+
});else runErrors(error, fns, owner);
|
|
1055
985
|
}
|
|
1056
986
|
function resolveChildren(children) {
|
|
1057
987
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1068,24 +998,19 @@ function resolveChildren(children) {
|
|
|
1068
998
|
function createProvider(id, options) {
|
|
1069
999
|
return function provider(props) {
|
|
1070
1000
|
let res;
|
|
1071
|
-
createRenderEffect(
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
return children(() => props.children);
|
|
1079
|
-
})),
|
|
1080
|
-
undefined
|
|
1081
|
-
);
|
|
1001
|
+
createRenderEffect(() => res = untrack(() => {
|
|
1002
|
+
Owner.context = {
|
|
1003
|
+
...Owner.context,
|
|
1004
|
+
[id]: props.value
|
|
1005
|
+
};
|
|
1006
|
+
return children(() => props.children);
|
|
1007
|
+
}), undefined);
|
|
1082
1008
|
return res;
|
|
1083
1009
|
};
|
|
1084
1010
|
}
|
|
1085
1011
|
function onError(fn) {
|
|
1086
1012
|
ERROR || (ERROR = Symbol("error"));
|
|
1087
|
-
if (Owner === null);
|
|
1088
|
-
else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1013
|
+
if (Owner === null) ;else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1089
1014
|
Owner.context = {
|
|
1090
1015
|
...Owner.context,
|
|
1091
1016
|
[ERROR]: [fn]
|
|
@@ -1114,8 +1039,7 @@ function observable(input) {
|
|
|
1114
1039
|
if (!(observer instanceof Object) || observer == null) {
|
|
1115
1040
|
throw new TypeError("Expected the observer to be an object.");
|
|
1116
1041
|
}
|
|
1117
|
-
const handler =
|
|
1118
|
-
typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1042
|
+
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1119
1043
|
if (!handler) {
|
|
1120
1044
|
return {
|
|
1121
1045
|
unsubscribe() {}
|
|
@@ -1146,7 +1070,7 @@ function from(producer, initalValue = undefined) {
|
|
|
1146
1070
|
});
|
|
1147
1071
|
if ("subscribe" in producer) {
|
|
1148
1072
|
const unsub = producer.subscribe(v => set(() => v));
|
|
1149
|
-
onCleanup(() =>
|
|
1073
|
+
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
1150
1074
|
} else {
|
|
1151
1075
|
const clean = producer(set);
|
|
1152
1076
|
onCleanup(clean);
|
|
@@ -1190,7 +1114,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1190
1114
|
});
|
|
1191
1115
|
len = 1;
|
|
1192
1116
|
}
|
|
1193
|
-
}
|
|
1117
|
+
}
|
|
1118
|
+
else if (len === 0) {
|
|
1194
1119
|
mapped = new Array(newLen);
|
|
1195
1120
|
for (j = 0; j < newLen; j++) {
|
|
1196
1121
|
items[j] = newItems[j];
|
|
@@ -1201,16 +1126,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1201
1126
|
temp = new Array(newLen);
|
|
1202
1127
|
tempdisposers = new Array(newLen);
|
|
1203
1128
|
indexes && (tempIndexes = new Array(newLen));
|
|
1204
|
-
for (
|
|
1205
|
-
|
|
1206
|
-
start < end && items[start] === newItems[start];
|
|
1207
|
-
start++
|
|
1208
|
-
);
|
|
1209
|
-
for (
|
|
1210
|
-
end = len - 1, newEnd = newLen - 1;
|
|
1211
|
-
end >= start && newEnd >= start && items[end] === newItems[newEnd];
|
|
1212
|
-
end--, newEnd--
|
|
1213
|
-
) {
|
|
1129
|
+
for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
|
|
1130
|
+
for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
|
|
1214
1131
|
temp[newEnd] = mapped[end];
|
|
1215
1132
|
tempdisposers[newEnd] = disposers[end];
|
|
1216
1133
|
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
@@ -1244,7 +1161,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1244
1161
|
}
|
|
1245
1162
|
} else mapped[j] = createRoot(mapper);
|
|
1246
1163
|
}
|
|
1247
|
-
mapped = mapped.slice(0,
|
|
1164
|
+
mapped = mapped.slice(0, len = newLen);
|
|
1248
1165
|
items = newItems.slice(0);
|
|
1249
1166
|
}
|
|
1250
1167
|
return mapped;
|
|
@@ -1311,7 +1228,7 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1311
1228
|
}
|
|
1312
1229
|
len = signals.length = disposers.length = newLen;
|
|
1313
1230
|
items = newItems.slice(0);
|
|
1314
|
-
return
|
|
1231
|
+
return mapped = mapped.slice(0, len);
|
|
1315
1232
|
});
|
|
1316
1233
|
function mapper(disposer) {
|
|
1317
1234
|
disposers[i] = disposer;
|
|
@@ -1380,33 +1297,29 @@ function mergeProps(...sources) {
|
|
|
1380
1297
|
let proxy = false;
|
|
1381
1298
|
for (let i = 0; i < sources.length; i++) {
|
|
1382
1299
|
const s = sources[i];
|
|
1383
|
-
proxy = proxy ||
|
|
1384
|
-
sources[i] = typeof s === "function" ? (
|
|
1300
|
+
proxy = proxy || !!s && $PROXY in s;
|
|
1301
|
+
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
1385
1302
|
}
|
|
1386
1303
|
if (SUPPORTS_PROXY && proxy) {
|
|
1387
|
-
return new Proxy(
|
|
1388
|
-
{
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
if (v !== undefined) return v;
|
|
1393
|
-
}
|
|
1394
|
-
},
|
|
1395
|
-
has(property) {
|
|
1396
|
-
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1397
|
-
if (property in resolveSource(sources[i])) return true;
|
|
1398
|
-
}
|
|
1399
|
-
return false;
|
|
1400
|
-
},
|
|
1401
|
-
keys() {
|
|
1402
|
-
const keys = [];
|
|
1403
|
-
for (let i = 0; i < sources.length; i++)
|
|
1404
|
-
keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1405
|
-
return [...new Set(keys)];
|
|
1304
|
+
return new Proxy({
|
|
1305
|
+
get(property) {
|
|
1306
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1307
|
+
const v = resolveSource(sources[i])[property];
|
|
1308
|
+
if (v !== undefined) return v;
|
|
1406
1309
|
}
|
|
1407
1310
|
},
|
|
1408
|
-
|
|
1409
|
-
|
|
1311
|
+
has(property) {
|
|
1312
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1313
|
+
if (property in resolveSource(sources[i])) return true;
|
|
1314
|
+
}
|
|
1315
|
+
return false;
|
|
1316
|
+
},
|
|
1317
|
+
keys() {
|
|
1318
|
+
const keys = [];
|
|
1319
|
+
for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1320
|
+
return [...new Set(keys)];
|
|
1321
|
+
}
|
|
1322
|
+
}, propTraps);
|
|
1410
1323
|
}
|
|
1411
1324
|
const sourcesMap = {};
|
|
1412
1325
|
const defined = Object.create(null);
|
|
@@ -1419,20 +1332,15 @@ function mergeProps(...sources) {
|
|
|
1419
1332
|
if (key === "__proto__" || key === "constructor") continue;
|
|
1420
1333
|
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
1421
1334
|
if (!defined[key]) {
|
|
1422
|
-
defined[key] = desc.get
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
}
|
|
1428
|
-
: desc.value !== undefined
|
|
1429
|
-
? desc
|
|
1430
|
-
: undefined;
|
|
1335
|
+
defined[key] = desc.get ? {
|
|
1336
|
+
enumerable: true,
|
|
1337
|
+
configurable: true,
|
|
1338
|
+
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
1339
|
+
} : desc.value !== undefined ? desc : undefined;
|
|
1431
1340
|
} else {
|
|
1432
1341
|
const sources = sourcesMap[key];
|
|
1433
1342
|
if (sources) {
|
|
1434
|
-
if (desc.get) sources.push(desc.get.bind(source));
|
|
1435
|
-
else if (desc.value !== undefined) sources.push(() => desc.value);
|
|
1343
|
+
if (desc.get) sources.push(desc.get.bind(source));else if (desc.value !== undefined) sources.push(() => desc.value);
|
|
1436
1344
|
}
|
|
1437
1345
|
}
|
|
1438
1346
|
}
|
|
@@ -1442,8 +1350,7 @@ function mergeProps(...sources) {
|
|
|
1442
1350
|
for (let i = definedKeys.length - 1; i >= 0; i--) {
|
|
1443
1351
|
const key = definedKeys[i],
|
|
1444
1352
|
desc = defined[key];
|
|
1445
|
-
if (desc && desc.get) Object.defineProperty(target, key, desc);
|
|
1446
|
-
else target[key] = desc ? desc.value : undefined;
|
|
1353
|
+
if (desc && desc.get) Object.defineProperty(target, key, desc);else target[key] = desc ? desc.value : undefined;
|
|
1447
1354
|
}
|
|
1448
1355
|
return target;
|
|
1449
1356
|
}
|
|
@@ -1451,60 +1358,47 @@ function splitProps(props, ...keys) {
|
|
|
1451
1358
|
if (SUPPORTS_PROXY && $PROXY in props) {
|
|
1452
1359
|
const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
|
|
1453
1360
|
const res = keys.map(k => {
|
|
1454
|
-
return new Proxy(
|
|
1455
|
-
{
|
|
1456
|
-
|
|
1457
|
-
return k.includes(property) ? props[property] : undefined;
|
|
1458
|
-
},
|
|
1459
|
-
has(property) {
|
|
1460
|
-
return k.includes(property) && property in props;
|
|
1461
|
-
},
|
|
1462
|
-
keys() {
|
|
1463
|
-
return k.filter(property => property in props);
|
|
1464
|
-
}
|
|
1361
|
+
return new Proxy({
|
|
1362
|
+
get(property) {
|
|
1363
|
+
return k.includes(property) ? props[property] : undefined;
|
|
1465
1364
|
},
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
});
|
|
1469
|
-
res.push(
|
|
1470
|
-
new Proxy(
|
|
1471
|
-
{
|
|
1472
|
-
get(property) {
|
|
1473
|
-
return blocked.has(property) ? undefined : props[property];
|
|
1474
|
-
},
|
|
1475
|
-
has(property) {
|
|
1476
|
-
return blocked.has(property) ? false : property in props;
|
|
1477
|
-
},
|
|
1478
|
-
keys() {
|
|
1479
|
-
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1480
|
-
}
|
|
1365
|
+
has(property) {
|
|
1366
|
+
return k.includes(property) && property in props;
|
|
1481
1367
|
},
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1368
|
+
keys() {
|
|
1369
|
+
return k.filter(property => property in props);
|
|
1370
|
+
}
|
|
1371
|
+
}, propTraps);
|
|
1372
|
+
});
|
|
1373
|
+
res.push(new Proxy({
|
|
1374
|
+
get(property) {
|
|
1375
|
+
return blocked.has(property) ? undefined : props[property];
|
|
1376
|
+
},
|
|
1377
|
+
has(property) {
|
|
1378
|
+
return blocked.has(property) ? false : property in props;
|
|
1379
|
+
},
|
|
1380
|
+
keys() {
|
|
1381
|
+
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1382
|
+
}
|
|
1383
|
+
}, propTraps));
|
|
1485
1384
|
return res;
|
|
1486
1385
|
}
|
|
1487
1386
|
const otherObject = {};
|
|
1488
1387
|
const objects = keys.map(() => ({}));
|
|
1489
1388
|
for (const propName of Object.getOwnPropertyNames(props)) {
|
|
1490
1389
|
const desc = Object.getOwnPropertyDescriptor(props, propName);
|
|
1491
|
-
const isDefaultDesc =
|
|
1492
|
-
!desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1390
|
+
const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1493
1391
|
let blocked = false;
|
|
1494
1392
|
let objectIndex = 0;
|
|
1495
1393
|
for (const k of keys) {
|
|
1496
1394
|
if (k.includes(propName)) {
|
|
1497
1395
|
blocked = true;
|
|
1498
|
-
isDefaultDesc
|
|
1499
|
-
? (objects[objectIndex][propName] = desc.value)
|
|
1500
|
-
: Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1396
|
+
isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1501
1397
|
}
|
|
1502
1398
|
++objectIndex;
|
|
1503
1399
|
}
|
|
1504
1400
|
if (!blocked) {
|
|
1505
|
-
isDefaultDesc
|
|
1506
|
-
? (otherObject[propName] = desc.value)
|
|
1507
|
-
: Object.defineProperty(otherObject, propName, desc);
|
|
1401
|
+
isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
|
|
1508
1402
|
}
|
|
1509
1403
|
}
|
|
1510
1404
|
return [...objects, otherObject];
|
|
@@ -1530,21 +1424,17 @@ function lazy(fn) {
|
|
|
1530
1424
|
comp = s;
|
|
1531
1425
|
}
|
|
1532
1426
|
let Comp;
|
|
1533
|
-
return createMemo(() =>
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
return r;
|
|
1543
|
-
})
|
|
1544
|
-
: ""
|
|
1545
|
-
);
|
|
1427
|
+
return createMemo(() => (Comp = comp()) ? untrack(() => {
|
|
1428
|
+
if (IS_DEV) ;
|
|
1429
|
+
if (!ctx || sharedConfig.done) return Comp(props);
|
|
1430
|
+
const c = sharedConfig.context;
|
|
1431
|
+
setHydrateContext(ctx);
|
|
1432
|
+
const r = Comp(props);
|
|
1433
|
+
setHydrateContext(c);
|
|
1434
|
+
return r;
|
|
1435
|
+
}) : "");
|
|
1546
1436
|
};
|
|
1547
|
-
wrap.preload = () => p || ((p = fn()).then(mod =>
|
|
1437
|
+
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
1548
1438
|
return wrap;
|
|
1549
1439
|
}
|
|
1550
1440
|
let counter = 0;
|
|
@@ -1569,35 +1459,21 @@ function Index(props) {
|
|
|
1569
1459
|
function Show(props) {
|
|
1570
1460
|
const keyed = props.keyed;
|
|
1571
1461
|
const conditionValue = createMemo(() => props.when, undefined, undefined);
|
|
1572
|
-
const condition = keyed
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
const
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
? c
|
|
1588
|
-
: () => {
|
|
1589
|
-
if (!untrack(condition)) throw narrowedError("Show");
|
|
1590
|
-
return conditionValue();
|
|
1591
|
-
}
|
|
1592
|
-
)
|
|
1593
|
-
)
|
|
1594
|
-
: child;
|
|
1595
|
-
}
|
|
1596
|
-
return props.fallback;
|
|
1597
|
-
},
|
|
1598
|
-
undefined,
|
|
1599
|
-
undefined
|
|
1600
|
-
);
|
|
1462
|
+
const condition = keyed ? conditionValue : createMemo(conditionValue, undefined, {
|
|
1463
|
+
equals: (a, b) => !a === !b
|
|
1464
|
+
});
|
|
1465
|
+
return createMemo(() => {
|
|
1466
|
+
const c = condition();
|
|
1467
|
+
if (c) {
|
|
1468
|
+
const child = props.children;
|
|
1469
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1470
|
+
return fn ? untrack(() => child(keyed ? c : () => {
|
|
1471
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
1472
|
+
return conditionValue();
|
|
1473
|
+
})) : child;
|
|
1474
|
+
}
|
|
1475
|
+
return props.fallback;
|
|
1476
|
+
}, undefined, undefined);
|
|
1601
1477
|
}
|
|
1602
1478
|
function Switch(props) {
|
|
1603
1479
|
const chs = children(() => props.children);
|
|
@@ -1609,43 +1485,25 @@ function Switch(props) {
|
|
|
1609
1485
|
const index = i;
|
|
1610
1486
|
const mp = mps[i];
|
|
1611
1487
|
const prevFunc = func;
|
|
1612
|
-
const conditionValue = createMemo(
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
);
|
|
1617
|
-
const condition = mp.keyed
|
|
1618
|
-
? conditionValue
|
|
1619
|
-
: createMemo(conditionValue, undefined, {
|
|
1620
|
-
equals: (a, b) => !a === !b
|
|
1621
|
-
});
|
|
1488
|
+
const conditionValue = createMemo(() => prevFunc() ? undefined : mp.when, undefined, undefined);
|
|
1489
|
+
const condition = mp.keyed ? conditionValue : createMemo(conditionValue, undefined, {
|
|
1490
|
+
equals: (a, b) => !a === !b
|
|
1491
|
+
});
|
|
1622
1492
|
func = () => prevFunc() || (condition() ? [index, conditionValue, mp] : undefined);
|
|
1623
1493
|
}
|
|
1624
1494
|
return func;
|
|
1625
1495
|
});
|
|
1626
|
-
return createMemo(
|
|
1627
|
-
()
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
? conditionValue()
|
|
1638
|
-
: () => {
|
|
1639
|
-
if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
|
|
1640
|
-
return conditionValue();
|
|
1641
|
-
}
|
|
1642
|
-
)
|
|
1643
|
-
)
|
|
1644
|
-
: child;
|
|
1645
|
-
},
|
|
1646
|
-
undefined,
|
|
1647
|
-
undefined
|
|
1648
|
-
);
|
|
1496
|
+
return createMemo(() => {
|
|
1497
|
+
const sel = switchFunc()();
|
|
1498
|
+
if (!sel) return props.fallback;
|
|
1499
|
+
const [index, conditionValue, mp] = sel;
|
|
1500
|
+
const child = mp.children;
|
|
1501
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1502
|
+
return fn ? untrack(() => child(mp.keyed ? conditionValue() : () => {
|
|
1503
|
+
if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
|
|
1504
|
+
return conditionValue();
|
|
1505
|
+
})) : child;
|
|
1506
|
+
}, undefined, undefined);
|
|
1649
1507
|
}
|
|
1650
1508
|
function Match(props) {
|
|
1651
1509
|
return props;
|
|
@@ -1656,29 +1514,23 @@ function resetErrorBoundaries() {
|
|
|
1656
1514
|
}
|
|
1657
1515
|
function ErrorBoundary(props) {
|
|
1658
1516
|
let err;
|
|
1659
|
-
if (sharedConfig.context && sharedConfig.load)
|
|
1660
|
-
err = sharedConfig.load(sharedConfig.getContextId());
|
|
1517
|
+
if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.getContextId());
|
|
1661
1518
|
const [errored, setErrored] = createSignal(err, undefined);
|
|
1662
1519
|
Errors || (Errors = new Set());
|
|
1663
1520
|
Errors.add(setErrored);
|
|
1664
1521
|
onCleanup(() => Errors.delete(setErrored));
|
|
1665
|
-
return createMemo(
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
},
|
|
1674
|
-
undefined,
|
|
1675
|
-
undefined
|
|
1676
|
-
);
|
|
1522
|
+
return createMemo(() => {
|
|
1523
|
+
let e;
|
|
1524
|
+
if (e = errored()) {
|
|
1525
|
+
const f = props.fallback;
|
|
1526
|
+
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1527
|
+
}
|
|
1528
|
+
return catchError(() => props.children, setErrored);
|
|
1529
|
+
}, undefined, undefined);
|
|
1677
1530
|
}
|
|
1678
1531
|
|
|
1679
|
-
const suspenseListEquals = (a, b) =>
|
|
1680
|
-
|
|
1681
|
-
const SuspenseListContext = /* #__PURE__ */ createContext();
|
|
1532
|
+
const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1533
|
+
const SuspenseListContext = /* #__PURE__ */createContext();
|
|
1682
1534
|
function SuspenseList(props) {
|
|
1683
1535
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
1684
1536
|
inFallback: false
|
|
@@ -1689,51 +1541,51 @@ function SuspenseList(props) {
|
|
|
1689
1541
|
if (listContext) {
|
|
1690
1542
|
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1691
1543
|
}
|
|
1692
|
-
const resolved = createMemo(
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1544
|
+
const resolved = createMemo(prev => {
|
|
1545
|
+
const reveal = props.revealOrder,
|
|
1546
|
+
tail = props.tail,
|
|
1547
|
+
{
|
|
1548
|
+
showContent = true,
|
|
1549
|
+
showFallback = true
|
|
1550
|
+
} = show ? show() : {},
|
|
1551
|
+
reg = registry(),
|
|
1552
|
+
reverse = reveal === "backwards";
|
|
1553
|
+
if (reveal === "together") {
|
|
1554
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1555
|
+
const res = reg.map(() => ({
|
|
1556
|
+
showContent: all && showContent,
|
|
1557
|
+
showFallback
|
|
1558
|
+
}));
|
|
1559
|
+
res.inFallback = !all;
|
|
1560
|
+
return res;
|
|
1561
|
+
}
|
|
1562
|
+
let stop = false;
|
|
1563
|
+
let inFallback = prev.inFallback;
|
|
1564
|
+
const res = [];
|
|
1565
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1566
|
+
const n = reverse ? len - i - 1 : i,
|
|
1567
|
+
s = reg[n]();
|
|
1568
|
+
if (!stop && !s) {
|
|
1569
|
+
res[n] = {
|
|
1570
|
+
showContent,
|
|
1703
1571
|
showFallback
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
s = reg[n]();
|
|
1714
|
-
if (!stop && !s) {
|
|
1715
|
-
res[n] = {
|
|
1716
|
-
showContent,
|
|
1717
|
-
showFallback
|
|
1718
|
-
};
|
|
1719
|
-
} else {
|
|
1720
|
-
const next = !stop;
|
|
1721
|
-
if (next) inFallback = true;
|
|
1722
|
-
res[n] = {
|
|
1723
|
-
showContent: next,
|
|
1724
|
-
showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
|
|
1725
|
-
};
|
|
1726
|
-
stop = true;
|
|
1727
|
-
}
|
|
1572
|
+
};
|
|
1573
|
+
} else {
|
|
1574
|
+
const next = !stop;
|
|
1575
|
+
if (next) inFallback = true;
|
|
1576
|
+
res[n] = {
|
|
1577
|
+
showContent: next,
|
|
1578
|
+
showFallback: !tail || next && tail === "collapsed" ? showFallback : false
|
|
1579
|
+
};
|
|
1580
|
+
stop = true;
|
|
1728
1581
|
}
|
|
1729
|
-
if (!stop) inFallback = false;
|
|
1730
|
-
res.inFallback = inFallback;
|
|
1731
|
-
return res;
|
|
1732
|
-
},
|
|
1733
|
-
{
|
|
1734
|
-
inFallback: false
|
|
1735
1582
|
}
|
|
1736
|
-
|
|
1583
|
+
if (!stop) inFallback = false;
|
|
1584
|
+
res.inFallback = inFallback;
|
|
1585
|
+
return res;
|
|
1586
|
+
}, {
|
|
1587
|
+
inFallback: false
|
|
1588
|
+
});
|
|
1737
1589
|
setWrapper(() => resolved);
|
|
1738
1590
|
return createComponent(SuspenseListContext.Provider, {
|
|
1739
1591
|
value: {
|
|
@@ -1778,27 +1630,23 @@ function Suspense(props) {
|
|
|
1778
1630
|
const key = sharedConfig.getContextId();
|
|
1779
1631
|
let ref = sharedConfig.load(key);
|
|
1780
1632
|
if (ref) {
|
|
1781
|
-
if (typeof ref !== "object" || ref.
|
|
1782
|
-
else sharedConfig.gather(key);
|
|
1633
|
+
if (typeof ref !== "object" || ref.s !== 1) p = ref;else sharedConfig.gather(key);
|
|
1783
1634
|
}
|
|
1784
1635
|
if (p && p !== "$$f") {
|
|
1785
1636
|
const [s, set] = createSignal(undefined, {
|
|
1786
1637
|
equals: false
|
|
1787
1638
|
});
|
|
1788
1639
|
flicker = s;
|
|
1789
|
-
p.then(
|
|
1790
|
-
()
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
set();
|
|
1800
|
-
}
|
|
1801
|
-
);
|
|
1640
|
+
p.then(() => {
|
|
1641
|
+
if (sharedConfig.done) return set();
|
|
1642
|
+
sharedConfig.gather(key);
|
|
1643
|
+
setHydrateContext(ctx);
|
|
1644
|
+
set();
|
|
1645
|
+
setHydrateContext();
|
|
1646
|
+
}, err => {
|
|
1647
|
+
error = err;
|
|
1648
|
+
set();
|
|
1649
|
+
});
|
|
1802
1650
|
}
|
|
1803
1651
|
}
|
|
1804
1652
|
const listContext = useContext(SuspenseListContext);
|
|
@@ -1813,14 +1661,17 @@ function Suspense(props) {
|
|
|
1813
1661
|
ctx = sharedConfig.context;
|
|
1814
1662
|
if (flicker) {
|
|
1815
1663
|
flicker();
|
|
1816
|
-
return
|
|
1664
|
+
return flicker = undefined;
|
|
1817
1665
|
}
|
|
1818
1666
|
if (ctx && p === "$$f") setHydrateContext();
|
|
1819
1667
|
const rendered = createMemo(() => props.children);
|
|
1820
1668
|
return createMemo(prev => {
|
|
1821
1669
|
const inFallback = store.inFallback(),
|
|
1822
|
-
{
|
|
1823
|
-
|
|
1670
|
+
{
|
|
1671
|
+
showContent = true,
|
|
1672
|
+
showFallback = true
|
|
1673
|
+
} = show ? show() : {};
|
|
1674
|
+
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1824
1675
|
store.resolved = true;
|
|
1825
1676
|
dispose && dispose();
|
|
1826
1677
|
dispose = ctx = p = undefined;
|
|
@@ -1848,59 +1699,4 @@ function Suspense(props) {
|
|
|
1848
1699
|
|
|
1849
1700
|
const DEV = undefined;
|
|
1850
1701
|
|
|
1851
|
-
export {
|
|
1852
|
-
$DEVCOMP,
|
|
1853
|
-
$PROXY,
|
|
1854
|
-
$TRACK,
|
|
1855
|
-
DEV,
|
|
1856
|
-
ErrorBoundary,
|
|
1857
|
-
For,
|
|
1858
|
-
Index,
|
|
1859
|
-
Match,
|
|
1860
|
-
Show,
|
|
1861
|
-
Suspense,
|
|
1862
|
-
SuspenseList,
|
|
1863
|
-
Switch,
|
|
1864
|
-
batch,
|
|
1865
|
-
cancelCallback,
|
|
1866
|
-
catchError,
|
|
1867
|
-
children,
|
|
1868
|
-
createComponent,
|
|
1869
|
-
createComputed,
|
|
1870
|
-
createContext,
|
|
1871
|
-
createDeferred,
|
|
1872
|
-
createEffect,
|
|
1873
|
-
createMemo,
|
|
1874
|
-
createReaction,
|
|
1875
|
-
createRenderEffect,
|
|
1876
|
-
createResource,
|
|
1877
|
-
createRoot,
|
|
1878
|
-
createSelector,
|
|
1879
|
-
createSignal,
|
|
1880
|
-
createUniqueId,
|
|
1881
|
-
enableExternalSource,
|
|
1882
|
-
enableHydration,
|
|
1883
|
-
enableScheduling,
|
|
1884
|
-
equalFn,
|
|
1885
|
-
from,
|
|
1886
|
-
getListener,
|
|
1887
|
-
getOwner,
|
|
1888
|
-
indexArray,
|
|
1889
|
-
lazy,
|
|
1890
|
-
mapArray,
|
|
1891
|
-
mergeProps,
|
|
1892
|
-
observable,
|
|
1893
|
-
on,
|
|
1894
|
-
onCleanup,
|
|
1895
|
-
onError,
|
|
1896
|
-
onMount,
|
|
1897
|
-
requestCallback,
|
|
1898
|
-
resetErrorBoundaries,
|
|
1899
|
-
runWithOwner,
|
|
1900
|
-
sharedConfig,
|
|
1901
|
-
splitProps,
|
|
1902
|
-
startTransition,
|
|
1903
|
-
untrack,
|
|
1904
|
-
useContext,
|
|
1905
|
-
useTransition
|
|
1906
|
-
};
|
|
1702
|
+
export { $DEVCOMP, $PROXY, $TRACK, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, catchError, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|