solid-js 1.9.1 → 1.9.2
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/README.md +1 -1
- package/dist/dev.cjs +1 -1
- package/dist/dev.js +318 -559
- package/dist/server.js +74 -168
- package/dist/solid.cjs +1 -1
- package/dist/solid.js +276 -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/jsx-runtime/types/jsx.d.ts +196 -59
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.cjs +1 -1
- package/html/dist/html.js +94 -219
- package/html/types/lit.d.ts +33 -52
- package/package.json +1 -1
- 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 +10 -75
- package/types/jsx.d.ts +195 -47
- package/types/reactive/array.d.ts +4 -12
- package/types/reactive/observable.d.ts +17 -25
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +142 -233
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +35 -71
- 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 +42 -73
- 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.cjs +14 -14
- package/web/dist/dev.js +89 -639
- package/web/dist/server.cjs +14 -14
- package/web/dist/server.js +108 -635
- package/web/dist/web.cjs +14 -14
- package/web/dist/web.js +87 -627
- package/web/storage/dist/storage.js +3 -3
- package/web/types/core.d.ts +1 -10
- package/web/types/index.d.ts +10 -27
- 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
|
}
|
|
@@ -176,14 +174,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
176
174
|
owner = Owner,
|
|
177
175
|
unowned = fn.length === 0,
|
|
178
176
|
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
179
|
-
root = unowned
|
|
180
|
-
|
|
181
|
-
:
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
owner: current
|
|
186
|
-
},
|
|
177
|
+
root = unowned ? UNOWNED : {
|
|
178
|
+
owned: null,
|
|
179
|
+
cleanups: null,
|
|
180
|
+
context: current ? current.context : null,
|
|
181
|
+
owner: current
|
|
182
|
+
},
|
|
187
183
|
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
188
184
|
Owner = root;
|
|
189
185
|
Listener = null;
|
|
@@ -204,8 +200,7 @@ function createSignal(value, options) {
|
|
|
204
200
|
};
|
|
205
201
|
const setter = value => {
|
|
206
202
|
if (typeof value === "function") {
|
|
207
|
-
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
208
|
-
else value = value(s.value);
|
|
203
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
|
|
209
204
|
}
|
|
210
205
|
return writeSignal(s, value);
|
|
211
206
|
};
|
|
@@ -213,13 +208,11 @@ function createSignal(value, options) {
|
|
|
213
208
|
}
|
|
214
209
|
function createComputed(fn, value, options) {
|
|
215
210
|
const c = createComputation(fn, value, true, STALE);
|
|
216
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
217
|
-
else updateComputation(c);
|
|
211
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
218
212
|
}
|
|
219
213
|
function createRenderEffect(fn, value, options) {
|
|
220
214
|
const c = createComputation(fn, value, false, STALE);
|
|
221
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
222
|
-
else updateComputation(c);
|
|
215
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
223
216
|
}
|
|
224
217
|
function createEffect(fn, value, options) {
|
|
225
218
|
runEffects = runUserEffects;
|
|
@@ -231,15 +224,10 @@ function createEffect(fn, value, options) {
|
|
|
231
224
|
}
|
|
232
225
|
function createReaction(onInvalidate, options) {
|
|
233
226
|
let fn;
|
|
234
|
-
const c = createComputation(
|
|
235
|
-
()
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
},
|
|
239
|
-
undefined,
|
|
240
|
-
false,
|
|
241
|
-
0
|
|
242
|
-
),
|
|
227
|
+
const c = createComputation(() => {
|
|
228
|
+
fn ? fn() : untrack(onInvalidate);
|
|
229
|
+
fn = undefined;
|
|
230
|
+
}, undefined, false, 0),
|
|
243
231
|
s = SuspenseContext && useContext(SuspenseContext);
|
|
244
232
|
if (s) c.suspense = s;
|
|
245
233
|
c.user = true;
|
|
@@ -267,7 +255,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
267
255
|
let source;
|
|
268
256
|
let fetcher;
|
|
269
257
|
let options;
|
|
270
|
-
if (
|
|
258
|
+
if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
|
|
271
259
|
source = true;
|
|
272
260
|
fetcher = pSource;
|
|
273
261
|
options = pFetcher || {};
|
|
@@ -292,19 +280,15 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
292
280
|
[state, setState] = createSignal(resolved ? "ready" : "unresolved");
|
|
293
281
|
if (sharedConfig.context) {
|
|
294
282
|
id = sharedConfig.getNextContextId();
|
|
295
|
-
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
296
|
-
else if (sharedConfig.load && sharedConfig.has(id)) initP = sharedConfig.load(id);
|
|
283
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && sharedConfig.has(id)) initP = sharedConfig.load(id);
|
|
297
284
|
}
|
|
298
285
|
function loadEnd(p, v, error, key) {
|
|
299
286
|
if (pr === p) {
|
|
300
287
|
pr = null;
|
|
301
288
|
key !== undefined && (resolved = true);
|
|
302
|
-
if ((p === initP || v === initP) && options.onHydrated)
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
value: v
|
|
306
|
-
})
|
|
307
|
-
);
|
|
289
|
+
if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
|
|
290
|
+
value: v
|
|
291
|
+
}));
|
|
308
292
|
initP = NO_INIT;
|
|
309
293
|
if (Transition && p && loadedUnderTransition) {
|
|
310
294
|
Transition.promises.delete(p);
|
|
@@ -335,8 +319,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
335
319
|
createComputed(() => {
|
|
336
320
|
track();
|
|
337
321
|
if (pr) {
|
|
338
|
-
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
339
|
-
else if (!contexts.has(c)) {
|
|
322
|
+
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
|
|
340
323
|
c.increment();
|
|
341
324
|
contexts.add(c);
|
|
342
325
|
}
|
|
@@ -355,35 +338,26 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
355
338
|
return;
|
|
356
339
|
}
|
|
357
340
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
358
|
-
const p =
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
fetcher(lookup, {
|
|
363
|
-
value: value(),
|
|
364
|
-
refetching
|
|
365
|
-
})
|
|
366
|
-
);
|
|
341
|
+
const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
|
|
342
|
+
value: value(),
|
|
343
|
+
refetching
|
|
344
|
+
}));
|
|
367
345
|
if (!isPromise(p)) {
|
|
368
346
|
loadEnd(pr, p, undefined, lookup);
|
|
369
347
|
return p;
|
|
370
348
|
}
|
|
371
349
|
pr = p;
|
|
372
350
|
if ("value" in p) {
|
|
373
|
-
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
|
|
374
|
-
else loadEnd(pr, undefined, castError(p.value), lookup);
|
|
351
|
+
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, castError(p.value), lookup);
|
|
375
352
|
return p;
|
|
376
353
|
}
|
|
377
354
|
scheduled = true;
|
|
378
|
-
queueMicrotask(() =>
|
|
355
|
+
queueMicrotask(() => scheduled = false);
|
|
379
356
|
runUpdates(() => {
|
|
380
357
|
setState(resolved ? "refreshing" : "pending");
|
|
381
358
|
trigger();
|
|
382
359
|
}, false);
|
|
383
|
-
return p.then(
|
|
384
|
-
v => loadEnd(p, v, undefined, lookup),
|
|
385
|
-
e => loadEnd(p, undefined, castError(e), lookup)
|
|
386
|
-
);
|
|
360
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
|
|
387
361
|
}
|
|
388
362
|
Object.defineProperties(read, {
|
|
389
363
|
state: {
|
|
@@ -407,80 +381,50 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
407
381
|
}
|
|
408
382
|
}
|
|
409
383
|
});
|
|
410
|
-
if (dynamic) createComputed(() => load(false));
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
refetch: load,
|
|
416
|
-
mutate: setValue
|
|
417
|
-
}
|
|
418
|
-
];
|
|
384
|
+
if (dynamic) createComputed(() => load(false));else load(false);
|
|
385
|
+
return [read, {
|
|
386
|
+
refetch: load,
|
|
387
|
+
mutate: setValue
|
|
388
|
+
}];
|
|
419
389
|
}
|
|
420
390
|
function createDeferred(source, options) {
|
|
421
391
|
let t,
|
|
422
392
|
timeout = options ? options.timeoutMs : undefined;
|
|
423
|
-
const node = createComputation(
|
|
424
|
-
() => {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
timeout
|
|
431
|
-
}
|
|
432
|
-
: undefined
|
|
433
|
-
);
|
|
434
|
-
return source();
|
|
435
|
-
},
|
|
436
|
-
undefined,
|
|
437
|
-
true
|
|
438
|
-
);
|
|
439
|
-
const [deferred, setDeferred] = createSignal(
|
|
440
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
441
|
-
options
|
|
442
|
-
);
|
|
393
|
+
const node = createComputation(() => {
|
|
394
|
+
if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
|
|
395
|
+
timeout
|
|
396
|
+
} : undefined);
|
|
397
|
+
return source();
|
|
398
|
+
}, undefined, true);
|
|
399
|
+
const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);
|
|
443
400
|
updateComputation(node);
|
|
444
|
-
setDeferred(() =>
|
|
445
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
446
|
-
);
|
|
401
|
+
setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
447
402
|
return deferred;
|
|
448
403
|
}
|
|
449
404
|
function createSelector(source, fn = equalFn, options) {
|
|
450
405
|
const subs = new Map();
|
|
451
|
-
const node = createComputation(
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
for (const
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
return v;
|
|
463
|
-
},
|
|
464
|
-
undefined,
|
|
465
|
-
true,
|
|
466
|
-
STALE
|
|
467
|
-
);
|
|
406
|
+
const node = createComputation(p => {
|
|
407
|
+
const v = source();
|
|
408
|
+
for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
|
|
409
|
+
for (const c of val.values()) {
|
|
410
|
+
c.state = STALE;
|
|
411
|
+
if (c.pure) Updates.push(c);else Effects.push(c);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return v;
|
|
415
|
+
}, undefined, true, STALE);
|
|
468
416
|
updateComputation(node);
|
|
469
417
|
return key => {
|
|
470
418
|
const listener = Listener;
|
|
471
419
|
if (listener) {
|
|
472
420
|
let l;
|
|
473
|
-
if (
|
|
474
|
-
else subs.set(key, (l = new Set([listener])));
|
|
421
|
+
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
475
422
|
onCleanup(() => {
|
|
476
423
|
l.delete(listener);
|
|
477
424
|
!l.size && subs.delete(key);
|
|
478
425
|
});
|
|
479
426
|
}
|
|
480
|
-
return fn(
|
|
481
|
-
key,
|
|
482
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
483
|
-
);
|
|
427
|
+
return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
484
428
|
};
|
|
485
429
|
}
|
|
486
430
|
function batch(fn) {
|
|
@@ -520,9 +464,7 @@ function onMount(fn) {
|
|
|
520
464
|
createEffect(() => untrack(fn));
|
|
521
465
|
}
|
|
522
466
|
function onCleanup(fn) {
|
|
523
|
-
if (Owner === null);
|
|
524
|
-
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
525
|
-
else Owner.cleanups.push(fn);
|
|
467
|
+
if (Owner === null) ;else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
|
|
526
468
|
return fn;
|
|
527
469
|
}
|
|
528
470
|
function catchError(fn, handler) {
|
|
@@ -576,17 +518,15 @@ function startTransition(fn) {
|
|
|
576
518
|
Owner = o;
|
|
577
519
|
let t;
|
|
578
520
|
if (Scheduler || SuspenseContext) {
|
|
579
|
-
t =
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
});
|
|
589
|
-
t.done || (t.done = new Promise(res => (t.resolve = res)));
|
|
521
|
+
t = Transition || (Transition = {
|
|
522
|
+
sources: new Set(),
|
|
523
|
+
effects: [],
|
|
524
|
+
promises: new Set(),
|
|
525
|
+
disposed: new Set(),
|
|
526
|
+
queue: new Set(),
|
|
527
|
+
running: true
|
|
528
|
+
});
|
|
529
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
590
530
|
t.running = true;
|
|
591
531
|
}
|
|
592
532
|
runUpdates(fn, false);
|
|
@@ -594,7 +534,7 @@ function startTransition(fn) {
|
|
|
594
534
|
return t ? t.done : undefined;
|
|
595
535
|
});
|
|
596
536
|
}
|
|
597
|
-
const [transPending, setTransPending] = /*@__PURE__*/
|
|
537
|
+
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
598
538
|
function useTransition() {
|
|
599
539
|
return [transPending, startTransition];
|
|
600
540
|
}
|
|
@@ -612,9 +552,7 @@ function createContext(defaultValue, options) {
|
|
|
612
552
|
}
|
|
613
553
|
function useContext(context) {
|
|
614
554
|
let value;
|
|
615
|
-
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined
|
|
616
|
-
? value
|
|
617
|
-
: context.defaultValue;
|
|
555
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
|
|
618
556
|
}
|
|
619
557
|
function children(fn) {
|
|
620
558
|
const children = createMemo(fn);
|
|
@@ -631,7 +569,10 @@ function getSuspenseContext() {
|
|
|
631
569
|
}
|
|
632
570
|
function enableExternalSource(factory, untrack = fn => fn()) {
|
|
633
571
|
if (ExternalSourceConfig) {
|
|
634
|
-
const {
|
|
572
|
+
const {
|
|
573
|
+
factory: oldFactory,
|
|
574
|
+
untrack: oldUntrack
|
|
575
|
+
} = ExternalSourceConfig;
|
|
635
576
|
ExternalSourceConfig = {
|
|
636
577
|
factory: (fn, trigger) => {
|
|
637
578
|
const oldSource = oldFactory(fn, trigger);
|
|
@@ -656,8 +597,7 @@ function enableExternalSource(factory, untrack = fn => fn()) {
|
|
|
656
597
|
function readSignal() {
|
|
657
598
|
const runningTransition = Transition && Transition.running;
|
|
658
599
|
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
659
|
-
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
660
|
-
else {
|
|
600
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
|
|
661
601
|
const updates = Updates;
|
|
662
602
|
Updates = null;
|
|
663
603
|
runUpdates(() => lookUpstream(this), false);
|
|
@@ -685,12 +625,11 @@ function readSignal() {
|
|
|
685
625
|
return this.value;
|
|
686
626
|
}
|
|
687
627
|
function writeSignal(node, value, isComp) {
|
|
688
|
-
let current =
|
|
689
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
628
|
+
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
690
629
|
if (!node.comparator || !node.comparator(current, value)) {
|
|
691
630
|
if (Transition) {
|
|
692
631
|
const TransitionRunning = Transition.running;
|
|
693
|
-
if (TransitionRunning ||
|
|
632
|
+
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
694
633
|
Transition.sources.add(node);
|
|
695
634
|
node.tValue = value;
|
|
696
635
|
}
|
|
@@ -703,16 +642,14 @@ function writeSignal(node, value, isComp) {
|
|
|
703
642
|
const TransitionRunning = Transition && Transition.running;
|
|
704
643
|
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
705
644
|
if (TransitionRunning ? !o.tState : !o.state) {
|
|
706
|
-
if (o.pure) Updates.push(o);
|
|
707
|
-
else Effects.push(o);
|
|
645
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
708
646
|
if (o.observers) markDownstream(o);
|
|
709
647
|
}
|
|
710
|
-
if (!TransitionRunning) o.state = STALE;
|
|
711
|
-
else o.tState = STALE;
|
|
648
|
+
if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
|
|
712
649
|
}
|
|
713
650
|
if (Updates.length > 10e5) {
|
|
714
651
|
Updates = [];
|
|
715
|
-
if (false);
|
|
652
|
+
if (false) ;
|
|
716
653
|
throw new Error();
|
|
717
654
|
}
|
|
718
655
|
}, false);
|
|
@@ -724,11 +661,7 @@ function updateComputation(node) {
|
|
|
724
661
|
if (!node.fn) return;
|
|
725
662
|
cleanNode(node);
|
|
726
663
|
const time = ExecCount;
|
|
727
|
-
runComputation(
|
|
728
|
-
node,
|
|
729
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
730
|
-
time
|
|
731
|
-
);
|
|
664
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
732
665
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
733
666
|
queueMicrotask(() => {
|
|
734
667
|
runUpdates(() => {
|
|
@@ -793,14 +726,11 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
793
726
|
c.state = 0;
|
|
794
727
|
c.tState = state;
|
|
795
728
|
}
|
|
796
|
-
if (Owner === null);
|
|
797
|
-
else if (Owner !== UNOWNED) {
|
|
729
|
+
if (Owner === null) ;else if (Owner !== UNOWNED) {
|
|
798
730
|
if (Transition && Transition.running && Owner.pure) {
|
|
799
|
-
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
800
|
-
else Owner.tOwned.push(c);
|
|
731
|
+
if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
|
|
801
732
|
} else {
|
|
802
|
-
if (!Owner.owned) Owner.owned = [c];
|
|
803
|
-
else Owner.owned.push(c);
|
|
733
|
+
if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
|
|
804
734
|
}
|
|
805
735
|
}
|
|
806
736
|
if (ExternalSourceConfig && c.fn) {
|
|
@@ -851,8 +781,7 @@ function runUpdates(fn, init) {
|
|
|
851
781
|
if (Updates) return fn();
|
|
852
782
|
let wait = false;
|
|
853
783
|
if (!init) Updates = [];
|
|
854
|
-
if (Effects) wait = true;
|
|
855
|
-
else Effects = [];
|
|
784
|
+
if (Effects) wait = true;else Effects = [];
|
|
856
785
|
ExecCount++;
|
|
857
786
|
try {
|
|
858
787
|
const res = fn();
|
|
@@ -866,8 +795,7 @@ function runUpdates(fn, init) {
|
|
|
866
795
|
}
|
|
867
796
|
function completeUpdates(wait) {
|
|
868
797
|
if (Updates) {
|
|
869
|
-
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
870
|
-
else runQueue(Updates);
|
|
798
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
|
|
871
799
|
Updates = null;
|
|
872
800
|
}
|
|
873
801
|
if (wait) return;
|
|
@@ -935,8 +863,7 @@ function runUserEffects(queue) {
|
|
|
935
863
|
userLength = 0;
|
|
936
864
|
for (i = 0; i < queue.length; i++) {
|
|
937
865
|
const e = queue[i];
|
|
938
|
-
if (!e.user) runTop(e);
|
|
939
|
-
else queue[userLength++] = e;
|
|
866
|
+
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
940
867
|
}
|
|
941
868
|
if (sharedConfig.context) {
|
|
942
869
|
if (sharedConfig.count) {
|
|
@@ -955,15 +882,13 @@ function runUserEffects(queue) {
|
|
|
955
882
|
}
|
|
956
883
|
function lookUpstream(node, ignore) {
|
|
957
884
|
const runningTransition = Transition && Transition.running;
|
|
958
|
-
if (runningTransition) node.tState = 0;
|
|
959
|
-
else node.state = 0;
|
|
885
|
+
if (runningTransition) node.tState = 0;else node.state = 0;
|
|
960
886
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
961
887
|
const source = node.sources[i];
|
|
962
888
|
if (source.sources) {
|
|
963
889
|
const state = runningTransition ? source.tState : source.state;
|
|
964
890
|
if (state === STALE) {
|
|
965
|
-
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
966
|
-
runTop(source);
|
|
891
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
|
|
967
892
|
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
968
893
|
}
|
|
969
894
|
}
|
|
@@ -973,10 +898,8 @@ function markDownstream(node) {
|
|
|
973
898
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
974
899
|
const o = node.observers[i];
|
|
975
900
|
if (runningTransition ? !o.tState : !o.state) {
|
|
976
|
-
if (runningTransition) o.tState = PENDING;
|
|
977
|
-
|
|
978
|
-
if (o.pure) Updates.push(o);
|
|
979
|
-
else Effects.push(o);
|
|
901
|
+
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
902
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
980
903
|
o.observers && markDownstream(o);
|
|
981
904
|
}
|
|
982
905
|
}
|
|
@@ -1013,8 +936,7 @@ function cleanNode(node) {
|
|
|
1013
936
|
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
1014
937
|
node.cleanups = null;
|
|
1015
938
|
}
|
|
1016
|
-
if (Transition && Transition.running) node.tState = 0;
|
|
1017
|
-
else node.state = 0;
|
|
939
|
+
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
1018
940
|
}
|
|
1019
941
|
function reset(node, top) {
|
|
1020
942
|
if (!top) {
|
|
@@ -1035,21 +957,19 @@ function runErrors(err, fns, owner) {
|
|
|
1035
957
|
try {
|
|
1036
958
|
for (const f of fns) f(err);
|
|
1037
959
|
} catch (e) {
|
|
1038
|
-
handleError(e,
|
|
960
|
+
handleError(e, owner && owner.owner || null);
|
|
1039
961
|
}
|
|
1040
962
|
}
|
|
1041
963
|
function handleError(err, owner = Owner) {
|
|
1042
964
|
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
1043
965
|
const error = castError(err);
|
|
1044
966
|
if (!fns) throw error;
|
|
1045
|
-
if (Effects)
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
});
|
|
1052
|
-
else runErrors(error, fns, owner);
|
|
967
|
+
if (Effects) Effects.push({
|
|
968
|
+
fn() {
|
|
969
|
+
runErrors(error, fns, owner);
|
|
970
|
+
},
|
|
971
|
+
state: STALE
|
|
972
|
+
});else runErrors(error, fns, owner);
|
|
1053
973
|
}
|
|
1054
974
|
function resolveChildren(children) {
|
|
1055
975
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1066,24 +986,19 @@ function resolveChildren(children) {
|
|
|
1066
986
|
function createProvider(id, options) {
|
|
1067
987
|
return function provider(props) {
|
|
1068
988
|
let res;
|
|
1069
|
-
createRenderEffect(
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
return children(() => props.children);
|
|
1077
|
-
})),
|
|
1078
|
-
undefined
|
|
1079
|
-
);
|
|
989
|
+
createRenderEffect(() => res = untrack(() => {
|
|
990
|
+
Owner.context = {
|
|
991
|
+
...Owner.context,
|
|
992
|
+
[id]: props.value
|
|
993
|
+
};
|
|
994
|
+
return children(() => props.children);
|
|
995
|
+
}), undefined);
|
|
1080
996
|
return res;
|
|
1081
997
|
};
|
|
1082
998
|
}
|
|
1083
999
|
function onError(fn) {
|
|
1084
1000
|
ERROR || (ERROR = Symbol("error"));
|
|
1085
|
-
if (Owner === null);
|
|
1086
|
-
else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1001
|
+
if (Owner === null) ;else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1087
1002
|
Owner.context = {
|
|
1088
1003
|
...Owner.context,
|
|
1089
1004
|
[ERROR]: [fn]
|
|
@@ -1112,8 +1027,7 @@ function observable(input) {
|
|
|
1112
1027
|
if (!(observer instanceof Object) || observer == null) {
|
|
1113
1028
|
throw new TypeError("Expected the observer to be an object.");
|
|
1114
1029
|
}
|
|
1115
|
-
const handler =
|
|
1116
|
-
typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1030
|
+
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1117
1031
|
if (!handler) {
|
|
1118
1032
|
return {
|
|
1119
1033
|
unsubscribe() {}
|
|
@@ -1144,7 +1058,7 @@ function from(producer) {
|
|
|
1144
1058
|
});
|
|
1145
1059
|
if ("subscribe" in producer) {
|
|
1146
1060
|
const unsub = producer.subscribe(v => set(() => v));
|
|
1147
|
-
onCleanup(() =>
|
|
1061
|
+
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
1148
1062
|
} else {
|
|
1149
1063
|
const clean = producer(set);
|
|
1150
1064
|
onCleanup(clean);
|
|
@@ -1188,7 +1102,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1188
1102
|
});
|
|
1189
1103
|
len = 1;
|
|
1190
1104
|
}
|
|
1191
|
-
}
|
|
1105
|
+
}
|
|
1106
|
+
else if (len === 0) {
|
|
1192
1107
|
mapped = new Array(newLen);
|
|
1193
1108
|
for (j = 0; j < newLen; j++) {
|
|
1194
1109
|
items[j] = newItems[j];
|
|
@@ -1199,16 +1114,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1199
1114
|
temp = new Array(newLen);
|
|
1200
1115
|
tempdisposers = new Array(newLen);
|
|
1201
1116
|
indexes && (tempIndexes = new Array(newLen));
|
|
1202
|
-
for (
|
|
1203
|
-
|
|
1204
|
-
start < end && items[start] === newItems[start];
|
|
1205
|
-
start++
|
|
1206
|
-
);
|
|
1207
|
-
for (
|
|
1208
|
-
end = len - 1, newEnd = newLen - 1;
|
|
1209
|
-
end >= start && newEnd >= start && items[end] === newItems[newEnd];
|
|
1210
|
-
end--, newEnd--
|
|
1211
|
-
) {
|
|
1117
|
+
for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
|
|
1118
|
+
for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
|
|
1212
1119
|
temp[newEnd] = mapped[end];
|
|
1213
1120
|
tempdisposers[newEnd] = disposers[end];
|
|
1214
1121
|
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
@@ -1242,7 +1149,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1242
1149
|
}
|
|
1243
1150
|
} else mapped[j] = createRoot(mapper);
|
|
1244
1151
|
}
|
|
1245
|
-
mapped = mapped.slice(0,
|
|
1152
|
+
mapped = mapped.slice(0, len = newLen);
|
|
1246
1153
|
items = newItems.slice(0);
|
|
1247
1154
|
}
|
|
1248
1155
|
return mapped;
|
|
@@ -1309,7 +1216,7 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1309
1216
|
}
|
|
1310
1217
|
len = signals.length = disposers.length = newLen;
|
|
1311
1218
|
items = newItems.slice(0);
|
|
1312
|
-
return
|
|
1219
|
+
return mapped = mapped.slice(0, len);
|
|
1313
1220
|
});
|
|
1314
1221
|
function mapper(disposer) {
|
|
1315
1222
|
disposers[i] = disposer;
|
|
@@ -1378,33 +1285,29 @@ function mergeProps(...sources) {
|
|
|
1378
1285
|
let proxy = false;
|
|
1379
1286
|
for (let i = 0; i < sources.length; i++) {
|
|
1380
1287
|
const s = sources[i];
|
|
1381
|
-
proxy = proxy ||
|
|
1382
|
-
sources[i] = typeof s === "function" ? (
|
|
1288
|
+
proxy = proxy || !!s && $PROXY in s;
|
|
1289
|
+
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
1383
1290
|
}
|
|
1384
1291
|
if (SUPPORTS_PROXY && proxy) {
|
|
1385
|
-
return new Proxy(
|
|
1386
|
-
{
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
if (property in resolveSource(sources[i])) return true;
|
|
1396
|
-
}
|
|
1397
|
-
return false;
|
|
1398
|
-
},
|
|
1399
|
-
keys() {
|
|
1400
|
-
const keys = [];
|
|
1401
|
-
for (let i = 0; i < sources.length; i++)
|
|
1402
|
-
keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1403
|
-
return [...new Set(keys)];
|
|
1292
|
+
return new Proxy({
|
|
1293
|
+
get(property) {
|
|
1294
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1295
|
+
const v = resolveSource(sources[i])[property];
|
|
1296
|
+
if (v !== undefined) return v;
|
|
1297
|
+
}
|
|
1298
|
+
},
|
|
1299
|
+
has(property) {
|
|
1300
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1301
|
+
if (property in resolveSource(sources[i])) return true;
|
|
1404
1302
|
}
|
|
1303
|
+
return false;
|
|
1405
1304
|
},
|
|
1406
|
-
|
|
1407
|
-
|
|
1305
|
+
keys() {
|
|
1306
|
+
const keys = [];
|
|
1307
|
+
for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1308
|
+
return [...new Set(keys)];
|
|
1309
|
+
}
|
|
1310
|
+
}, propTraps);
|
|
1408
1311
|
}
|
|
1409
1312
|
const sourcesMap = {};
|
|
1410
1313
|
const defined = Object.create(null);
|
|
@@ -1417,20 +1320,15 @@ function mergeProps(...sources) {
|
|
|
1417
1320
|
if (key === "__proto__" || key === "constructor") continue;
|
|
1418
1321
|
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
1419
1322
|
if (!defined[key]) {
|
|
1420
|
-
defined[key] = desc.get
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
}
|
|
1426
|
-
: desc.value !== undefined
|
|
1427
|
-
? desc
|
|
1428
|
-
: undefined;
|
|
1323
|
+
defined[key] = desc.get ? {
|
|
1324
|
+
enumerable: true,
|
|
1325
|
+
configurable: true,
|
|
1326
|
+
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
1327
|
+
} : desc.value !== undefined ? desc : undefined;
|
|
1429
1328
|
} else {
|
|
1430
1329
|
const sources = sourcesMap[key];
|
|
1431
1330
|
if (sources) {
|
|
1432
|
-
if (desc.get) sources.push(desc.get.bind(source));
|
|
1433
|
-
else if (desc.value !== undefined) sources.push(() => desc.value);
|
|
1331
|
+
if (desc.get) sources.push(desc.get.bind(source));else if (desc.value !== undefined) sources.push(() => desc.value);
|
|
1434
1332
|
}
|
|
1435
1333
|
}
|
|
1436
1334
|
}
|
|
@@ -1440,8 +1338,7 @@ function mergeProps(...sources) {
|
|
|
1440
1338
|
for (let i = definedKeys.length - 1; i >= 0; i--) {
|
|
1441
1339
|
const key = definedKeys[i],
|
|
1442
1340
|
desc = defined[key];
|
|
1443
|
-
if (desc && desc.get) Object.defineProperty(target, key, desc);
|
|
1444
|
-
else target[key] = desc ? desc.value : undefined;
|
|
1341
|
+
if (desc && desc.get) Object.defineProperty(target, key, desc);else target[key] = desc ? desc.value : undefined;
|
|
1445
1342
|
}
|
|
1446
1343
|
return target;
|
|
1447
1344
|
}
|
|
@@ -1449,60 +1346,47 @@ function splitProps(props, ...keys) {
|
|
|
1449
1346
|
if (SUPPORTS_PROXY && $PROXY in props) {
|
|
1450
1347
|
const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
|
|
1451
1348
|
const res = keys.map(k => {
|
|
1452
|
-
return new Proxy(
|
|
1453
|
-
{
|
|
1454
|
-
|
|
1455
|
-
return k.includes(property) ? props[property] : undefined;
|
|
1456
|
-
},
|
|
1457
|
-
has(property) {
|
|
1458
|
-
return k.includes(property) && property in props;
|
|
1459
|
-
},
|
|
1460
|
-
keys() {
|
|
1461
|
-
return k.filter(property => property in props);
|
|
1462
|
-
}
|
|
1349
|
+
return new Proxy({
|
|
1350
|
+
get(property) {
|
|
1351
|
+
return k.includes(property) ? props[property] : undefined;
|
|
1463
1352
|
},
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
});
|
|
1467
|
-
res.push(
|
|
1468
|
-
new Proxy(
|
|
1469
|
-
{
|
|
1470
|
-
get(property) {
|
|
1471
|
-
return blocked.has(property) ? undefined : props[property];
|
|
1472
|
-
},
|
|
1473
|
-
has(property) {
|
|
1474
|
-
return blocked.has(property) ? false : property in props;
|
|
1475
|
-
},
|
|
1476
|
-
keys() {
|
|
1477
|
-
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1478
|
-
}
|
|
1353
|
+
has(property) {
|
|
1354
|
+
return k.includes(property) && property in props;
|
|
1479
1355
|
},
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1356
|
+
keys() {
|
|
1357
|
+
return k.filter(property => property in props);
|
|
1358
|
+
}
|
|
1359
|
+
}, propTraps);
|
|
1360
|
+
});
|
|
1361
|
+
res.push(new Proxy({
|
|
1362
|
+
get(property) {
|
|
1363
|
+
return blocked.has(property) ? undefined : props[property];
|
|
1364
|
+
},
|
|
1365
|
+
has(property) {
|
|
1366
|
+
return blocked.has(property) ? false : property in props;
|
|
1367
|
+
},
|
|
1368
|
+
keys() {
|
|
1369
|
+
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1370
|
+
}
|
|
1371
|
+
}, propTraps));
|
|
1483
1372
|
return res;
|
|
1484
1373
|
}
|
|
1485
1374
|
const otherObject = {};
|
|
1486
1375
|
const objects = keys.map(() => ({}));
|
|
1487
1376
|
for (const propName of Object.getOwnPropertyNames(props)) {
|
|
1488
1377
|
const desc = Object.getOwnPropertyDescriptor(props, propName);
|
|
1489
|
-
const isDefaultDesc =
|
|
1490
|
-
!desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1378
|
+
const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1491
1379
|
let blocked = false;
|
|
1492
1380
|
let objectIndex = 0;
|
|
1493
1381
|
for (const k of keys) {
|
|
1494
1382
|
if (k.includes(propName)) {
|
|
1495
1383
|
blocked = true;
|
|
1496
|
-
isDefaultDesc
|
|
1497
|
-
? (objects[objectIndex][propName] = desc.value)
|
|
1498
|
-
: Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1384
|
+
isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1499
1385
|
}
|
|
1500
1386
|
++objectIndex;
|
|
1501
1387
|
}
|
|
1502
1388
|
if (!blocked) {
|
|
1503
|
-
isDefaultDesc
|
|
1504
|
-
? (otherObject[propName] = desc.value)
|
|
1505
|
-
: Object.defineProperty(otherObject, propName, desc);
|
|
1389
|
+
isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
|
|
1506
1390
|
}
|
|
1507
1391
|
}
|
|
1508
1392
|
return [...objects, otherObject];
|
|
@@ -1528,21 +1412,17 @@ function lazy(fn) {
|
|
|
1528
1412
|
comp = s;
|
|
1529
1413
|
}
|
|
1530
1414
|
let Comp;
|
|
1531
|
-
return createMemo(() =>
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
return r;
|
|
1541
|
-
})
|
|
1542
|
-
: ""
|
|
1543
|
-
);
|
|
1415
|
+
return createMemo(() => (Comp = comp()) ? untrack(() => {
|
|
1416
|
+
if (false) ;
|
|
1417
|
+
if (!ctx || sharedConfig.done) return Comp(props);
|
|
1418
|
+
const c = sharedConfig.context;
|
|
1419
|
+
setHydrateContext(ctx);
|
|
1420
|
+
const r = Comp(props);
|
|
1421
|
+
setHydrateContext(c);
|
|
1422
|
+
return r;
|
|
1423
|
+
}) : "");
|
|
1544
1424
|
};
|
|
1545
|
-
wrap.preload = () => p || ((p = fn()).then(mod =>
|
|
1425
|
+
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
1546
1426
|
return wrap;
|
|
1547
1427
|
}
|
|
1548
1428
|
let counter = 0;
|
|
@@ -1567,77 +1447,49 @@ function Index(props) {
|
|
|
1567
1447
|
function Show(props) {
|
|
1568
1448
|
const keyed = props.keyed;
|
|
1569
1449
|
const condition = createMemo(() => props.when, undefined, {
|
|
1570
|
-
equals: (a, b) =>
|
|
1450
|
+
equals: (a, b) => keyed ? a === b : !a === !b
|
|
1571
1451
|
});
|
|
1572
|
-
return createMemo(
|
|
1573
|
-
()
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
if (!untrack(condition)) throw narrowedError("Show");
|
|
1585
|
-
return props.when;
|
|
1586
|
-
}
|
|
1587
|
-
)
|
|
1588
|
-
)
|
|
1589
|
-
: child;
|
|
1590
|
-
}
|
|
1591
|
-
return props.fallback;
|
|
1592
|
-
},
|
|
1593
|
-
undefined,
|
|
1594
|
-
undefined
|
|
1595
|
-
);
|
|
1452
|
+
return createMemo(() => {
|
|
1453
|
+
const c = condition();
|
|
1454
|
+
if (c) {
|
|
1455
|
+
const child = props.children;
|
|
1456
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1457
|
+
return fn ? untrack(() => child(keyed ? c : () => {
|
|
1458
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
1459
|
+
return props.when;
|
|
1460
|
+
})) : child;
|
|
1461
|
+
}
|
|
1462
|
+
return props.fallback;
|
|
1463
|
+
}, undefined, undefined);
|
|
1596
1464
|
}
|
|
1597
1465
|
function Switch(props) {
|
|
1598
1466
|
let keyed = false;
|
|
1599
1467
|
const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1600
1468
|
const conditions = children(() => props.children),
|
|
1601
|
-
evalConditions = createMemo(
|
|
1602
|
-
()
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
return [i, c, conds[i]];
|
|
1610
|
-
}
|
|
1469
|
+
evalConditions = createMemo(() => {
|
|
1470
|
+
let conds = conditions();
|
|
1471
|
+
if (!Array.isArray(conds)) conds = [conds];
|
|
1472
|
+
for (let i = 0; i < conds.length; i++) {
|
|
1473
|
+
const c = conds[i].when;
|
|
1474
|
+
if (c) {
|
|
1475
|
+
keyed = !!conds[i].keyed;
|
|
1476
|
+
return [i, c, conds[i]];
|
|
1611
1477
|
}
|
|
1612
|
-
return [-1];
|
|
1613
|
-
},
|
|
1614
|
-
undefined,
|
|
1615
|
-
{
|
|
1616
|
-
equals
|
|
1617
1478
|
}
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
return cond.when;
|
|
1633
|
-
}
|
|
1634
|
-
)
|
|
1635
|
-
)
|
|
1636
|
-
: c;
|
|
1637
|
-
},
|
|
1638
|
-
undefined,
|
|
1639
|
-
undefined
|
|
1640
|
-
);
|
|
1479
|
+
return [-1];
|
|
1480
|
+
}, undefined, {
|
|
1481
|
+
equals
|
|
1482
|
+
});
|
|
1483
|
+
return createMemo(() => {
|
|
1484
|
+
const [index, when, cond] = evalConditions();
|
|
1485
|
+
if (index < 0) return props.fallback;
|
|
1486
|
+
const c = cond.children;
|
|
1487
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
1488
|
+
return fn ? untrack(() => c(keyed ? when : () => {
|
|
1489
|
+
if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
|
|
1490
|
+
return cond.when;
|
|
1491
|
+
})) : c;
|
|
1492
|
+
}, undefined, undefined);
|
|
1641
1493
|
}
|
|
1642
1494
|
function Match(props) {
|
|
1643
1495
|
return props;
|
|
@@ -1648,29 +1500,23 @@ function resetErrorBoundaries() {
|
|
|
1648
1500
|
}
|
|
1649
1501
|
function ErrorBoundary(props) {
|
|
1650
1502
|
let err;
|
|
1651
|
-
if (sharedConfig.context && sharedConfig.load)
|
|
1652
|
-
err = sharedConfig.load(sharedConfig.getContextId());
|
|
1503
|
+
if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.getContextId());
|
|
1653
1504
|
const [errored, setErrored] = createSignal(err, undefined);
|
|
1654
1505
|
Errors || (Errors = new Set());
|
|
1655
1506
|
Errors.add(setErrored);
|
|
1656
1507
|
onCleanup(() => Errors.delete(setErrored));
|
|
1657
|
-
return createMemo(
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
},
|
|
1666
|
-
undefined,
|
|
1667
|
-
undefined
|
|
1668
|
-
);
|
|
1508
|
+
return createMemo(() => {
|
|
1509
|
+
let e;
|
|
1510
|
+
if (e = errored()) {
|
|
1511
|
+
const f = props.fallback;
|
|
1512
|
+
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1513
|
+
}
|
|
1514
|
+
return catchError(() => props.children, setErrored);
|
|
1515
|
+
}, undefined, undefined);
|
|
1669
1516
|
}
|
|
1670
1517
|
|
|
1671
|
-
const suspenseListEquals = (a, b) =>
|
|
1672
|
-
|
|
1673
|
-
const SuspenseListContext = /* #__PURE__ */ createContext();
|
|
1518
|
+
const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1519
|
+
const SuspenseListContext = /* #__PURE__ */createContext();
|
|
1674
1520
|
function SuspenseList(props) {
|
|
1675
1521
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
1676
1522
|
inFallback: false
|
|
@@ -1681,51 +1527,51 @@ function SuspenseList(props) {
|
|
|
1681
1527
|
if (listContext) {
|
|
1682
1528
|
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1683
1529
|
}
|
|
1684
|
-
const resolved = createMemo(
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1530
|
+
const resolved = createMemo(prev => {
|
|
1531
|
+
const reveal = props.revealOrder,
|
|
1532
|
+
tail = props.tail,
|
|
1533
|
+
{
|
|
1534
|
+
showContent = true,
|
|
1535
|
+
showFallback = true
|
|
1536
|
+
} = show ? show() : {},
|
|
1537
|
+
reg = registry(),
|
|
1538
|
+
reverse = reveal === "backwards";
|
|
1539
|
+
if (reveal === "together") {
|
|
1540
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1541
|
+
const res = reg.map(() => ({
|
|
1542
|
+
showContent: all && showContent,
|
|
1543
|
+
showFallback
|
|
1544
|
+
}));
|
|
1545
|
+
res.inFallback = !all;
|
|
1546
|
+
return res;
|
|
1547
|
+
}
|
|
1548
|
+
let stop = false;
|
|
1549
|
+
let inFallback = prev.inFallback;
|
|
1550
|
+
const res = [];
|
|
1551
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1552
|
+
const n = reverse ? len - i - 1 : i,
|
|
1553
|
+
s = reg[n]();
|
|
1554
|
+
if (!stop && !s) {
|
|
1555
|
+
res[n] = {
|
|
1556
|
+
showContent,
|
|
1695
1557
|
showFallback
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
s = reg[n]();
|
|
1706
|
-
if (!stop && !s) {
|
|
1707
|
-
res[n] = {
|
|
1708
|
-
showContent,
|
|
1709
|
-
showFallback
|
|
1710
|
-
};
|
|
1711
|
-
} else {
|
|
1712
|
-
const next = !stop;
|
|
1713
|
-
if (next) inFallback = true;
|
|
1714
|
-
res[n] = {
|
|
1715
|
-
showContent: next,
|
|
1716
|
-
showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
|
|
1717
|
-
};
|
|
1718
|
-
stop = true;
|
|
1719
|
-
}
|
|
1558
|
+
};
|
|
1559
|
+
} else {
|
|
1560
|
+
const next = !stop;
|
|
1561
|
+
if (next) inFallback = true;
|
|
1562
|
+
res[n] = {
|
|
1563
|
+
showContent: next,
|
|
1564
|
+
showFallback: !tail || next && tail === "collapsed" ? showFallback : false
|
|
1565
|
+
};
|
|
1566
|
+
stop = true;
|
|
1720
1567
|
}
|
|
1721
|
-
if (!stop) inFallback = false;
|
|
1722
|
-
res.inFallback = inFallback;
|
|
1723
|
-
return res;
|
|
1724
|
-
},
|
|
1725
|
-
{
|
|
1726
|
-
inFallback: false
|
|
1727
1568
|
}
|
|
1728
|
-
|
|
1569
|
+
if (!stop) inFallback = false;
|
|
1570
|
+
res.inFallback = inFallback;
|
|
1571
|
+
return res;
|
|
1572
|
+
}, {
|
|
1573
|
+
inFallback: false
|
|
1574
|
+
});
|
|
1729
1575
|
setWrapper(() => resolved);
|
|
1730
1576
|
return createComponent(SuspenseListContext.Provider, {
|
|
1731
1577
|
value: {
|
|
@@ -1770,27 +1616,23 @@ function Suspense(props) {
|
|
|
1770
1616
|
const key = sharedConfig.getContextId();
|
|
1771
1617
|
let ref = sharedConfig.load(key);
|
|
1772
1618
|
if (ref) {
|
|
1773
|
-
if (typeof ref !== "object" || ref.status !== "success") p = ref;
|
|
1774
|
-
else sharedConfig.gather(key);
|
|
1619
|
+
if (typeof ref !== "object" || ref.status !== "success") p = ref;else sharedConfig.gather(key);
|
|
1775
1620
|
}
|
|
1776
1621
|
if (p && p !== "$$f") {
|
|
1777
1622
|
const [s, set] = createSignal(undefined, {
|
|
1778
1623
|
equals: false
|
|
1779
1624
|
});
|
|
1780
1625
|
flicker = s;
|
|
1781
|
-
p.then(
|
|
1782
|
-
()
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
set();
|
|
1792
|
-
}
|
|
1793
|
-
);
|
|
1626
|
+
p.then(() => {
|
|
1627
|
+
if (sharedConfig.done) return set();
|
|
1628
|
+
sharedConfig.gather(key);
|
|
1629
|
+
setHydrateContext(ctx);
|
|
1630
|
+
set();
|
|
1631
|
+
setHydrateContext();
|
|
1632
|
+
}, err => {
|
|
1633
|
+
error = err;
|
|
1634
|
+
set();
|
|
1635
|
+
});
|
|
1794
1636
|
}
|
|
1795
1637
|
}
|
|
1796
1638
|
const listContext = useContext(SuspenseListContext);
|
|
@@ -1805,14 +1647,17 @@ function Suspense(props) {
|
|
|
1805
1647
|
ctx = sharedConfig.context;
|
|
1806
1648
|
if (flicker) {
|
|
1807
1649
|
flicker();
|
|
1808
|
-
return
|
|
1650
|
+
return flicker = undefined;
|
|
1809
1651
|
}
|
|
1810
1652
|
if (ctx && p === "$$f") setHydrateContext();
|
|
1811
1653
|
const rendered = createMemo(() => props.children);
|
|
1812
1654
|
return createMemo(prev => {
|
|
1813
1655
|
const inFallback = store.inFallback(),
|
|
1814
|
-
{
|
|
1815
|
-
|
|
1656
|
+
{
|
|
1657
|
+
showContent = true,
|
|
1658
|
+
showFallback = true
|
|
1659
|
+
} = show ? show() : {};
|
|
1660
|
+
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1816
1661
|
store.resolved = true;
|
|
1817
1662
|
dispose && dispose();
|
|
1818
1663
|
dispose = ctx = p = undefined;
|
|
@@ -1840,59 +1685,4 @@ function Suspense(props) {
|
|
|
1840
1685
|
|
|
1841
1686
|
const DEV = undefined;
|
|
1842
1687
|
|
|
1843
|
-
export {
|
|
1844
|
-
$DEVCOMP,
|
|
1845
|
-
$PROXY,
|
|
1846
|
-
$TRACK,
|
|
1847
|
-
DEV,
|
|
1848
|
-
ErrorBoundary,
|
|
1849
|
-
For,
|
|
1850
|
-
Index,
|
|
1851
|
-
Match,
|
|
1852
|
-
Show,
|
|
1853
|
-
Suspense,
|
|
1854
|
-
SuspenseList,
|
|
1855
|
-
Switch,
|
|
1856
|
-
batch,
|
|
1857
|
-
cancelCallback,
|
|
1858
|
-
catchError,
|
|
1859
|
-
children,
|
|
1860
|
-
createComponent,
|
|
1861
|
-
createComputed,
|
|
1862
|
-
createContext,
|
|
1863
|
-
createDeferred,
|
|
1864
|
-
createEffect,
|
|
1865
|
-
createMemo,
|
|
1866
|
-
createReaction,
|
|
1867
|
-
createRenderEffect,
|
|
1868
|
-
createResource,
|
|
1869
|
-
createRoot,
|
|
1870
|
-
createSelector,
|
|
1871
|
-
createSignal,
|
|
1872
|
-
createUniqueId,
|
|
1873
|
-
enableExternalSource,
|
|
1874
|
-
enableHydration,
|
|
1875
|
-
enableScheduling,
|
|
1876
|
-
equalFn,
|
|
1877
|
-
from,
|
|
1878
|
-
getListener,
|
|
1879
|
-
getOwner,
|
|
1880
|
-
indexArray,
|
|
1881
|
-
lazy,
|
|
1882
|
-
mapArray,
|
|
1883
|
-
mergeProps,
|
|
1884
|
-
observable,
|
|
1885
|
-
on,
|
|
1886
|
-
onCleanup,
|
|
1887
|
-
onError,
|
|
1888
|
-
onMount,
|
|
1889
|
-
requestCallback,
|
|
1890
|
-
resetErrorBoundaries,
|
|
1891
|
-
runWithOwner,
|
|
1892
|
-
sharedConfig,
|
|
1893
|
-
splitProps,
|
|
1894
|
-
startTransition,
|
|
1895
|
-
untrack,
|
|
1896
|
-
useContext,
|
|
1897
|
-
useTransition
|
|
1898
|
-
};
|
|
1688
|
+
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 };
|