solid-js 1.7.10 → 1.7.11
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 +1 -1
- package/dist/dev.js +296 -529
- package/dist/server.js +74 -168
- package/dist/solid.cjs +1 -1
- package/dist/solid.js +254 -456
- package/h/dist/h.js +8 -34
- 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 -216
- package/html/types/lit.d.ts +31 -45
- package/package.json +1 -1
- package/store/dist/dev.js +42 -114
- package/store/dist/server.js +8 -19
- package/store/dist/store.js +39 -105
- 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 +4 -12
- package/store/types/store.d.ts +61 -218
- package/types/index.d.ts +9 -72
- 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 +140 -226
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +31 -62
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +12 -12
- package/types/server/index.d.ts +2 -56
- package/types/server/reactive.d.ts +40 -67
- package/types/server/rendering.d.ts +95 -171
- 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 +79 -610
- package/web/dist/server.js +78 -177
- package/web/dist/web.js +79 -610
- package/web/types/client.d.ts +2 -2
- 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
|
}
|
|
@@ -157,20 +155,18 @@ let Listener = null;
|
|
|
157
155
|
let Updates = null;
|
|
158
156
|
let Effects = null;
|
|
159
157
|
let ExecCount = 0;
|
|
160
|
-
const [transPending, setTransPending] = /*@__PURE__*/
|
|
158
|
+
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
161
159
|
function createRoot(fn, detachedOwner) {
|
|
162
160
|
const listener = Listener,
|
|
163
161
|
owner = Owner,
|
|
164
162
|
unowned = fn.length === 0,
|
|
165
163
|
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
166
|
-
root = unowned
|
|
167
|
-
|
|
168
|
-
:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
owner: current
|
|
173
|
-
},
|
|
164
|
+
root = unowned ? UNOWNED : {
|
|
165
|
+
owned: null,
|
|
166
|
+
cleanups: null,
|
|
167
|
+
context: current ? current.context : null,
|
|
168
|
+
owner: current
|
|
169
|
+
},
|
|
174
170
|
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
175
171
|
Owner = root;
|
|
176
172
|
Listener = null;
|
|
@@ -191,8 +187,7 @@ function createSignal(value, options) {
|
|
|
191
187
|
};
|
|
192
188
|
const setter = value => {
|
|
193
189
|
if (typeof value === "function") {
|
|
194
|
-
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
195
|
-
else value = value(s.value);
|
|
190
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
|
|
196
191
|
}
|
|
197
192
|
return writeSignal(s, value);
|
|
198
193
|
};
|
|
@@ -200,13 +195,11 @@ function createSignal(value, options) {
|
|
|
200
195
|
}
|
|
201
196
|
function createComputed(fn, value, options) {
|
|
202
197
|
const c = createComputation(fn, value, true, STALE);
|
|
203
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
204
|
-
else updateComputation(c);
|
|
198
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
205
199
|
}
|
|
206
200
|
function createRenderEffect(fn, value, options) {
|
|
207
201
|
const c = createComputation(fn, value, false, STALE);
|
|
208
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
209
|
-
else updateComputation(c);
|
|
202
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
210
203
|
}
|
|
211
204
|
function createEffect(fn, value, options) {
|
|
212
205
|
runEffects = runUserEffects;
|
|
@@ -218,15 +211,10 @@ function createEffect(fn, value, options) {
|
|
|
218
211
|
}
|
|
219
212
|
function createReaction(onInvalidate, options) {
|
|
220
213
|
let fn;
|
|
221
|
-
const c = createComputation(
|
|
222
|
-
()
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
},
|
|
226
|
-
undefined,
|
|
227
|
-
false,
|
|
228
|
-
0
|
|
229
|
-
),
|
|
214
|
+
const c = createComputation(() => {
|
|
215
|
+
fn ? fn() : untrack(onInvalidate);
|
|
216
|
+
fn = undefined;
|
|
217
|
+
}, undefined, false, 0),
|
|
230
218
|
s = SuspenseContext && useContext(SuspenseContext);
|
|
231
219
|
if (s) c.suspense = s;
|
|
232
220
|
c.user = true;
|
|
@@ -251,7 +239,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
251
239
|
let source;
|
|
252
240
|
let fetcher;
|
|
253
241
|
let options;
|
|
254
|
-
if (
|
|
242
|
+
if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
|
|
255
243
|
source = true;
|
|
256
244
|
fetcher = pSource;
|
|
257
245
|
options = pFetcher || {};
|
|
@@ -265,7 +253,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
265
253
|
id = null,
|
|
266
254
|
loadedUnderTransition = false,
|
|
267
255
|
scheduled = false,
|
|
268
|
-
resolved = "initialValue" in options,
|
|
256
|
+
resolved = ("initialValue" in options),
|
|
269
257
|
dynamic = typeof source === "function" && createMemo(source);
|
|
270
258
|
const contexts = new Set(),
|
|
271
259
|
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
@@ -277,19 +265,15 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
277
265
|
if (sharedConfig.context) {
|
|
278
266
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
279
267
|
let v;
|
|
280
|
-
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
281
|
-
else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
268
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
282
269
|
}
|
|
283
270
|
function loadEnd(p, v, error, key) {
|
|
284
271
|
if (pr === p) {
|
|
285
272
|
pr = null;
|
|
286
273
|
key !== undefined && (resolved = true);
|
|
287
|
-
if ((p === initP || v === initP) && options.onHydrated)
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
value: v
|
|
291
|
-
})
|
|
292
|
-
);
|
|
274
|
+
if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
|
|
275
|
+
value: v
|
|
276
|
+
}));
|
|
293
277
|
initP = NO_INIT;
|
|
294
278
|
if (Transition && p && loadedUnderTransition) {
|
|
295
279
|
Transition.promises.delete(p);
|
|
@@ -320,8 +304,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
320
304
|
createComputed(() => {
|
|
321
305
|
track();
|
|
322
306
|
if (pr) {
|
|
323
|
-
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
324
|
-
else if (!contexts.has(c)) {
|
|
307
|
+
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
|
|
325
308
|
c.increment();
|
|
326
309
|
contexts.add(c);
|
|
327
310
|
}
|
|
@@ -340,30 +323,22 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
340
323
|
return;
|
|
341
324
|
}
|
|
342
325
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
343
|
-
const p =
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
fetcher(lookup, {
|
|
348
|
-
value: value(),
|
|
349
|
-
refetching
|
|
350
|
-
})
|
|
351
|
-
);
|
|
326
|
+
const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
|
|
327
|
+
value: value(),
|
|
328
|
+
refetching
|
|
329
|
+
}));
|
|
352
330
|
if (typeof p !== "object" || !(p && "then" in p)) {
|
|
353
331
|
loadEnd(pr, p, undefined, lookup);
|
|
354
332
|
return p;
|
|
355
333
|
}
|
|
356
334
|
pr = p;
|
|
357
335
|
scheduled = true;
|
|
358
|
-
queueMicrotask(() =>
|
|
336
|
+
queueMicrotask(() => scheduled = false);
|
|
359
337
|
runUpdates(() => {
|
|
360
338
|
setState(resolved ? "refreshing" : "pending");
|
|
361
339
|
trigger();
|
|
362
340
|
}, false);
|
|
363
|
-
return p.then(
|
|
364
|
-
v => loadEnd(p, v, undefined, lookup),
|
|
365
|
-
e => loadEnd(p, undefined, castError(e), lookup)
|
|
366
|
-
);
|
|
341
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
|
|
367
342
|
}
|
|
368
343
|
Object.defineProperties(read, {
|
|
369
344
|
state: {
|
|
@@ -387,35 +362,21 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
387
362
|
}
|
|
388
363
|
}
|
|
389
364
|
});
|
|
390
|
-
if (dynamic) createComputed(() => load(false));
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
refetch: load,
|
|
396
|
-
mutate: setValue
|
|
397
|
-
}
|
|
398
|
-
];
|
|
365
|
+
if (dynamic) createComputed(() => load(false));else load(false);
|
|
366
|
+
return [read, {
|
|
367
|
+
refetch: load,
|
|
368
|
+
mutate: setValue
|
|
369
|
+
}];
|
|
399
370
|
}
|
|
400
371
|
function createDeferred(source, options) {
|
|
401
372
|
let t,
|
|
402
373
|
timeout = options ? options.timeoutMs : undefined;
|
|
403
|
-
const node = createComputation(
|
|
404
|
-
() => {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
? {
|
|
410
|
-
timeout
|
|
411
|
-
}
|
|
412
|
-
: undefined
|
|
413
|
-
);
|
|
414
|
-
return source();
|
|
415
|
-
},
|
|
416
|
-
undefined,
|
|
417
|
-
true
|
|
418
|
-
);
|
|
374
|
+
const node = createComputation(() => {
|
|
375
|
+
if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
|
|
376
|
+
timeout
|
|
377
|
+
} : undefined);
|
|
378
|
+
return source();
|
|
379
|
+
}, undefined, true);
|
|
419
380
|
const [deferred, setDeferred] = createSignal(node.value, options);
|
|
420
381
|
updateComputation(node);
|
|
421
382
|
setDeferred(() => node.value);
|
|
@@ -423,39 +384,28 @@ function createDeferred(source, options) {
|
|
|
423
384
|
}
|
|
424
385
|
function createSelector(source, fn = equalFn, options) {
|
|
425
386
|
const subs = new Map();
|
|
426
|
-
const node = createComputation(
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
for (const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
437
|
-
return v;
|
|
438
|
-
},
|
|
439
|
-
undefined,
|
|
440
|
-
true,
|
|
441
|
-
STALE
|
|
442
|
-
);
|
|
387
|
+
const node = createComputation(p => {
|
|
388
|
+
const v = source();
|
|
389
|
+
for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
|
|
390
|
+
for (const c of val.values()) {
|
|
391
|
+
c.state = STALE;
|
|
392
|
+
if (c.pure) Updates.push(c);else Effects.push(c);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return v;
|
|
396
|
+
}, undefined, true, STALE);
|
|
443
397
|
updateComputation(node);
|
|
444
398
|
return key => {
|
|
445
399
|
const listener = Listener;
|
|
446
400
|
if (listener) {
|
|
447
401
|
let l;
|
|
448
|
-
if (
|
|
449
|
-
else subs.set(key, (l = new Set([listener])));
|
|
402
|
+
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
450
403
|
onCleanup(() => {
|
|
451
404
|
l.delete(listener);
|
|
452
405
|
!l.size && subs.delete(key);
|
|
453
406
|
});
|
|
454
407
|
}
|
|
455
|
-
return fn(
|
|
456
|
-
key,
|
|
457
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
458
|
-
);
|
|
408
|
+
return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
459
409
|
};
|
|
460
410
|
}
|
|
461
411
|
function batch(fn) {
|
|
@@ -494,9 +444,7 @@ function onMount(fn) {
|
|
|
494
444
|
createEffect(() => untrack(fn));
|
|
495
445
|
}
|
|
496
446
|
function onCleanup(fn) {
|
|
497
|
-
if (Owner === null);
|
|
498
|
-
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
499
|
-
else Owner.cleanups.push(fn);
|
|
447
|
+
if (Owner === null) ;else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
|
|
500
448
|
return fn;
|
|
501
449
|
}
|
|
502
450
|
function catchError(fn, handler) {
|
|
@@ -550,17 +498,15 @@ function startTransition(fn) {
|
|
|
550
498
|
Owner = o;
|
|
551
499
|
let t;
|
|
552
500
|
if (Scheduler || SuspenseContext) {
|
|
553
|
-
t =
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
});
|
|
563
|
-
t.done || (t.done = new Promise(res => (t.resolve = res)));
|
|
501
|
+
t = Transition || (Transition = {
|
|
502
|
+
sources: new Set(),
|
|
503
|
+
effects: [],
|
|
504
|
+
promises: new Set(),
|
|
505
|
+
disposed: new Set(),
|
|
506
|
+
queue: new Set(),
|
|
507
|
+
running: true
|
|
508
|
+
});
|
|
509
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
564
510
|
t.running = true;
|
|
565
511
|
}
|
|
566
512
|
runUpdates(fn, false);
|
|
@@ -584,9 +530,7 @@ function createContext(defaultValue, options) {
|
|
|
584
530
|
};
|
|
585
531
|
}
|
|
586
532
|
function useContext(context) {
|
|
587
|
-
return Owner && Owner.context && Owner.context[context.id] !== undefined
|
|
588
|
-
? Owner.context[context.id]
|
|
589
|
-
: context.defaultValue;
|
|
533
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
|
|
590
534
|
}
|
|
591
535
|
function children(fn) {
|
|
592
536
|
const children = createMemo(fn);
|
|
@@ -599,7 +543,7 @@ function children(fn) {
|
|
|
599
543
|
}
|
|
600
544
|
let SuspenseContext;
|
|
601
545
|
function getSuspenseContext() {
|
|
602
|
-
return SuspenseContext || (SuspenseContext = createContext(
|
|
546
|
+
return SuspenseContext || (SuspenseContext = createContext());
|
|
603
547
|
}
|
|
604
548
|
function enableExternalSource(factory) {
|
|
605
549
|
if (ExternalSourceFactory) {
|
|
@@ -622,8 +566,7 @@ function enableExternalSource(factory) {
|
|
|
622
566
|
function readSignal() {
|
|
623
567
|
const runningTransition = Transition && Transition.running;
|
|
624
568
|
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
625
|
-
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
626
|
-
else {
|
|
569
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
|
|
627
570
|
const updates = Updates;
|
|
628
571
|
Updates = null;
|
|
629
572
|
runUpdates(() => lookUpstream(this), false);
|
|
@@ -651,12 +594,11 @@ function readSignal() {
|
|
|
651
594
|
return this.value;
|
|
652
595
|
}
|
|
653
596
|
function writeSignal(node, value, isComp) {
|
|
654
|
-
let current =
|
|
655
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
597
|
+
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
656
598
|
if (!node.comparator || !node.comparator(current, value)) {
|
|
657
599
|
if (Transition) {
|
|
658
600
|
const TransitionRunning = Transition.running;
|
|
659
|
-
if (TransitionRunning ||
|
|
601
|
+
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
660
602
|
Transition.sources.add(node);
|
|
661
603
|
node.tValue = value;
|
|
662
604
|
}
|
|
@@ -669,16 +611,14 @@ function writeSignal(node, value, isComp) {
|
|
|
669
611
|
const TransitionRunning = Transition && Transition.running;
|
|
670
612
|
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
671
613
|
if (TransitionRunning ? !o.tState : !o.state) {
|
|
672
|
-
if (o.pure) Updates.push(o);
|
|
673
|
-
else Effects.push(o);
|
|
614
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
674
615
|
if (o.observers) markDownstream(o);
|
|
675
616
|
}
|
|
676
|
-
if (!TransitionRunning) o.state = STALE;
|
|
677
|
-
else o.tState = STALE;
|
|
617
|
+
if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
|
|
678
618
|
}
|
|
679
619
|
if (Updates.length > 10e5) {
|
|
680
620
|
Updates = [];
|
|
681
|
-
if (false);
|
|
621
|
+
if (false) ;
|
|
682
622
|
throw new Error();
|
|
683
623
|
}
|
|
684
624
|
}, false);
|
|
@@ -693,11 +633,7 @@ function updateComputation(node) {
|
|
|
693
633
|
listener = Listener,
|
|
694
634
|
time = ExecCount;
|
|
695
635
|
Listener = Owner = node;
|
|
696
|
-
runComputation(
|
|
697
|
-
node,
|
|
698
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
699
|
-
time
|
|
700
|
-
);
|
|
636
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
701
637
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
702
638
|
queueMicrotask(() => {
|
|
703
639
|
runUpdates(() => {
|
|
@@ -758,14 +694,11 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
758
694
|
c.state = 0;
|
|
759
695
|
c.tState = state;
|
|
760
696
|
}
|
|
761
|
-
if (Owner === null);
|
|
762
|
-
else if (Owner !== UNOWNED) {
|
|
697
|
+
if (Owner === null) ;else if (Owner !== UNOWNED) {
|
|
763
698
|
if (Transition && Transition.running && Owner.pure) {
|
|
764
|
-
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
765
|
-
else Owner.tOwned.push(c);
|
|
699
|
+
if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
|
|
766
700
|
} else {
|
|
767
|
-
if (!Owner.owned) Owner.owned = [c];
|
|
768
|
-
else Owner.owned.push(c);
|
|
701
|
+
if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
|
|
769
702
|
}
|
|
770
703
|
}
|
|
771
704
|
if (ExternalSourceFactory) {
|
|
@@ -816,8 +749,7 @@ function runUpdates(fn, init) {
|
|
|
816
749
|
if (Updates) return fn();
|
|
817
750
|
let wait = false;
|
|
818
751
|
if (!init) Updates = [];
|
|
819
|
-
if (Effects) wait = true;
|
|
820
|
-
else Effects = [];
|
|
752
|
+
if (Effects) wait = true;else Effects = [];
|
|
821
753
|
ExecCount++;
|
|
822
754
|
try {
|
|
823
755
|
const res = fn();
|
|
@@ -831,8 +763,7 @@ function runUpdates(fn, init) {
|
|
|
831
763
|
}
|
|
832
764
|
function completeUpdates(wait) {
|
|
833
765
|
if (Updates) {
|
|
834
|
-
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
835
|
-
else runQueue(Updates);
|
|
766
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
|
|
836
767
|
Updates = null;
|
|
837
768
|
}
|
|
838
769
|
if (wait) return;
|
|
@@ -900,8 +831,7 @@ function runUserEffects(queue) {
|
|
|
900
831
|
userLength = 0;
|
|
901
832
|
for (i = 0; i < queue.length; i++) {
|
|
902
833
|
const e = queue[i];
|
|
903
|
-
if (!e.user) runTop(e);
|
|
904
|
-
else queue[userLength++] = e;
|
|
834
|
+
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
905
835
|
}
|
|
906
836
|
if (sharedConfig.context) {
|
|
907
837
|
if (sharedConfig.count) {
|
|
@@ -919,15 +849,13 @@ function runUserEffects(queue) {
|
|
|
919
849
|
}
|
|
920
850
|
function lookUpstream(node, ignore) {
|
|
921
851
|
const runningTransition = Transition && Transition.running;
|
|
922
|
-
if (runningTransition) node.tState = 0;
|
|
923
|
-
else node.state = 0;
|
|
852
|
+
if (runningTransition) node.tState = 0;else node.state = 0;
|
|
924
853
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
925
854
|
const source = node.sources[i];
|
|
926
855
|
if (source.sources) {
|
|
927
856
|
const state = runningTransition ? source.tState : source.state;
|
|
928
857
|
if (state === STALE) {
|
|
929
|
-
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
930
|
-
runTop(source);
|
|
858
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
|
|
931
859
|
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
932
860
|
}
|
|
933
861
|
}
|
|
@@ -937,10 +865,8 @@ function markDownstream(node) {
|
|
|
937
865
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
938
866
|
const o = node.observers[i];
|
|
939
867
|
if (runningTransition ? !o.tState : !o.state) {
|
|
940
|
-
if (runningTransition) o.tState = PENDING;
|
|
941
|
-
|
|
942
|
-
if (o.pure) Updates.push(o);
|
|
943
|
-
else Effects.push(o);
|
|
868
|
+
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
869
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
944
870
|
o.observers && markDownstream(o);
|
|
945
871
|
}
|
|
946
872
|
}
|
|
@@ -977,8 +903,7 @@ function cleanNode(node) {
|
|
|
977
903
|
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
978
904
|
node.cleanups = null;
|
|
979
905
|
}
|
|
980
|
-
if (Transition && Transition.running) node.tState = 0;
|
|
981
|
-
else node.state = 0;
|
|
906
|
+
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
982
907
|
}
|
|
983
908
|
function reset(node, top) {
|
|
984
909
|
if (!top) {
|
|
@@ -999,21 +924,19 @@ function runErrors(err, fns, owner) {
|
|
|
999
924
|
try {
|
|
1000
925
|
for (const f of fns) f(err);
|
|
1001
926
|
} catch (e) {
|
|
1002
|
-
handleError(e,
|
|
927
|
+
handleError(e, owner && owner.owner || null);
|
|
1003
928
|
}
|
|
1004
929
|
}
|
|
1005
930
|
function handleError(err, owner = Owner) {
|
|
1006
931
|
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
1007
932
|
const error = castError(err);
|
|
1008
933
|
if (!fns) throw error;
|
|
1009
|
-
if (Effects)
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
});
|
|
1016
|
-
else runErrors(error, fns, owner);
|
|
934
|
+
if (Effects) Effects.push({
|
|
935
|
+
fn() {
|
|
936
|
+
runErrors(error, fns, owner);
|
|
937
|
+
},
|
|
938
|
+
state: STALE
|
|
939
|
+
});else runErrors(error, fns, owner);
|
|
1017
940
|
}
|
|
1018
941
|
function resolveChildren(children) {
|
|
1019
942
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1030,24 +953,19 @@ function resolveChildren(children) {
|
|
|
1030
953
|
function createProvider(id, options) {
|
|
1031
954
|
return function provider(props) {
|
|
1032
955
|
let res;
|
|
1033
|
-
createRenderEffect(
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
return children(() => props.children);
|
|
1041
|
-
})),
|
|
1042
|
-
undefined
|
|
1043
|
-
);
|
|
956
|
+
createRenderEffect(() => res = untrack(() => {
|
|
957
|
+
Owner.context = {
|
|
958
|
+
...Owner.context,
|
|
959
|
+
[id]: props.value
|
|
960
|
+
};
|
|
961
|
+
return children(() => props.children);
|
|
962
|
+
}), undefined);
|
|
1044
963
|
return res;
|
|
1045
964
|
};
|
|
1046
965
|
}
|
|
1047
966
|
function onError(fn) {
|
|
1048
967
|
ERROR || (ERROR = Symbol("error"));
|
|
1049
|
-
if (Owner === null);
|
|
1050
|
-
else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
968
|
+
if (Owner === null) ;else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1051
969
|
Owner.context = {
|
|
1052
970
|
...Owner.context,
|
|
1053
971
|
[ERROR]: [fn]
|
|
@@ -1076,8 +994,7 @@ function observable(input) {
|
|
|
1076
994
|
if (!(observer instanceof Object) || observer == null) {
|
|
1077
995
|
throw new TypeError("Expected the observer to be an object.");
|
|
1078
996
|
}
|
|
1079
|
-
const handler =
|
|
1080
|
-
typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
997
|
+
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1081
998
|
if (!handler) {
|
|
1082
999
|
return {
|
|
1083
1000
|
unsubscribe() {}
|
|
@@ -1108,7 +1025,7 @@ function from(producer) {
|
|
|
1108
1025
|
});
|
|
1109
1026
|
if ("subscribe" in producer) {
|
|
1110
1027
|
const unsub = producer.subscribe(v => set(() => v));
|
|
1111
|
-
onCleanup(() =>
|
|
1028
|
+
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
1112
1029
|
} else {
|
|
1113
1030
|
const clean = producer(set);
|
|
1114
1031
|
onCleanup(clean);
|
|
@@ -1160,7 +1077,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1160
1077
|
});
|
|
1161
1078
|
len = 1;
|
|
1162
1079
|
}
|
|
1163
|
-
}
|
|
1080
|
+
}
|
|
1081
|
+
else if (len === 0) {
|
|
1164
1082
|
mapped = new Array(newLen);
|
|
1165
1083
|
for (j = 0; j < newLen; j++) {
|
|
1166
1084
|
items[j] = newItems[j];
|
|
@@ -1171,16 +1089,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1171
1089
|
temp = new Array(newLen);
|
|
1172
1090
|
tempdisposers = new Array(newLen);
|
|
1173
1091
|
indexes && (tempIndexes = new Array(newLen));
|
|
1174
|
-
for (
|
|
1175
|
-
|
|
1176
|
-
start < end && items[start] === newItems[start];
|
|
1177
|
-
start++
|
|
1178
|
-
);
|
|
1179
|
-
for (
|
|
1180
|
-
end = len - 1, newEnd = newLen - 1;
|
|
1181
|
-
end >= start && newEnd >= start && items[end] === newItems[newEnd];
|
|
1182
|
-
end--, newEnd--
|
|
1183
|
-
) {
|
|
1092
|
+
for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
|
|
1093
|
+
for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
|
|
1184
1094
|
temp[newEnd] = mapped[end];
|
|
1185
1095
|
tempdisposers[newEnd] = disposers[end];
|
|
1186
1096
|
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
@@ -1214,7 +1124,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1214
1124
|
}
|
|
1215
1125
|
} else mapped[j] = createRoot(mapper);
|
|
1216
1126
|
}
|
|
1217
|
-
mapped = mapped.slice(0,
|
|
1127
|
+
mapped = mapped.slice(0, len = newLen);
|
|
1218
1128
|
items = newItems.slice(0);
|
|
1219
1129
|
}
|
|
1220
1130
|
return mapped;
|
|
@@ -1280,7 +1190,7 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1280
1190
|
}
|
|
1281
1191
|
len = signals.length = disposers.length = newItems.length;
|
|
1282
1192
|
items = newItems.slice(0);
|
|
1283
|
-
return
|
|
1193
|
+
return mapped = mapped.slice(0, len);
|
|
1284
1194
|
});
|
|
1285
1195
|
function mapper(disposer) {
|
|
1286
1196
|
disposers[i] = disposer;
|
|
@@ -1349,33 +1259,29 @@ function mergeProps(...sources) {
|
|
|
1349
1259
|
let proxy = false;
|
|
1350
1260
|
for (let i = 0; i < sources.length; i++) {
|
|
1351
1261
|
const s = sources[i];
|
|
1352
|
-
proxy = proxy ||
|
|
1353
|
-
sources[i] = typeof s === "function" ? (
|
|
1262
|
+
proxy = proxy || !!s && $PROXY in s;
|
|
1263
|
+
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
1354
1264
|
}
|
|
1355
1265
|
if (proxy) {
|
|
1356
|
-
return new Proxy(
|
|
1357
|
-
{
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
if (v !== undefined) return v;
|
|
1362
|
-
}
|
|
1363
|
-
},
|
|
1364
|
-
has(property) {
|
|
1365
|
-
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1366
|
-
if (property in resolveSource(sources[i])) return true;
|
|
1367
|
-
}
|
|
1368
|
-
return false;
|
|
1369
|
-
},
|
|
1370
|
-
keys() {
|
|
1371
|
-
const keys = [];
|
|
1372
|
-
for (let i = 0; i < sources.length; i++)
|
|
1373
|
-
keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1374
|
-
return [...new Set(keys)];
|
|
1266
|
+
return new Proxy({
|
|
1267
|
+
get(property) {
|
|
1268
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1269
|
+
const v = resolveSource(sources[i])[property];
|
|
1270
|
+
if (v !== undefined) return v;
|
|
1375
1271
|
}
|
|
1376
1272
|
},
|
|
1377
|
-
|
|
1378
|
-
|
|
1273
|
+
has(property) {
|
|
1274
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1275
|
+
if (property in resolveSource(sources[i])) return true;
|
|
1276
|
+
}
|
|
1277
|
+
return false;
|
|
1278
|
+
},
|
|
1279
|
+
keys() {
|
|
1280
|
+
const keys = [];
|
|
1281
|
+
for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1282
|
+
return [...new Set(keys)];
|
|
1283
|
+
}
|
|
1284
|
+
}, propTraps);
|
|
1379
1285
|
}
|
|
1380
1286
|
const target = {};
|
|
1381
1287
|
const sourcesMap = {};
|
|
@@ -1394,7 +1300,7 @@ function mergeProps(...sources) {
|
|
|
1394
1300
|
Object.defineProperty(target, key, {
|
|
1395
1301
|
enumerable: true,
|
|
1396
1302
|
configurable: true,
|
|
1397
|
-
get: resolveSources.bind(
|
|
1303
|
+
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
1398
1304
|
});
|
|
1399
1305
|
} else {
|
|
1400
1306
|
if (desc.value !== undefined) defined.add(key);
|
|
@@ -1418,60 +1324,47 @@ function splitProps(props, ...keys) {
|
|
|
1418
1324
|
if ($PROXY in props) {
|
|
1419
1325
|
const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
|
|
1420
1326
|
const res = keys.map(k => {
|
|
1421
|
-
return new Proxy(
|
|
1422
|
-
{
|
|
1423
|
-
|
|
1424
|
-
return k.includes(property) ? props[property] : undefined;
|
|
1425
|
-
},
|
|
1426
|
-
has(property) {
|
|
1427
|
-
return k.includes(property) && property in props;
|
|
1428
|
-
},
|
|
1429
|
-
keys() {
|
|
1430
|
-
return k.filter(property => property in props);
|
|
1431
|
-
}
|
|
1327
|
+
return new Proxy({
|
|
1328
|
+
get(property) {
|
|
1329
|
+
return k.includes(property) ? props[property] : undefined;
|
|
1432
1330
|
},
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
});
|
|
1436
|
-
res.push(
|
|
1437
|
-
new Proxy(
|
|
1438
|
-
{
|
|
1439
|
-
get(property) {
|
|
1440
|
-
return blocked.has(property) ? undefined : props[property];
|
|
1441
|
-
},
|
|
1442
|
-
has(property) {
|
|
1443
|
-
return blocked.has(property) ? false : property in props;
|
|
1444
|
-
},
|
|
1445
|
-
keys() {
|
|
1446
|
-
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1447
|
-
}
|
|
1331
|
+
has(property) {
|
|
1332
|
+
return k.includes(property) && property in props;
|
|
1448
1333
|
},
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1334
|
+
keys() {
|
|
1335
|
+
return k.filter(property => property in props);
|
|
1336
|
+
}
|
|
1337
|
+
}, propTraps);
|
|
1338
|
+
});
|
|
1339
|
+
res.push(new Proxy({
|
|
1340
|
+
get(property) {
|
|
1341
|
+
return blocked.has(property) ? undefined : props[property];
|
|
1342
|
+
},
|
|
1343
|
+
has(property) {
|
|
1344
|
+
return blocked.has(property) ? false : property in props;
|
|
1345
|
+
},
|
|
1346
|
+
keys() {
|
|
1347
|
+
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1348
|
+
}
|
|
1349
|
+
}, propTraps));
|
|
1452
1350
|
return res;
|
|
1453
1351
|
}
|
|
1454
1352
|
const otherObject = {};
|
|
1455
1353
|
const objects = keys.map(() => ({}));
|
|
1456
1354
|
for (const propName of Object.getOwnPropertyNames(props)) {
|
|
1457
1355
|
const desc = Object.getOwnPropertyDescriptor(props, propName);
|
|
1458
|
-
const isDefaultDesc =
|
|
1459
|
-
!desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1356
|
+
const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1460
1357
|
let blocked = false;
|
|
1461
1358
|
let objectIndex = 0;
|
|
1462
1359
|
for (const k of keys) {
|
|
1463
1360
|
if (k.includes(propName)) {
|
|
1464
1361
|
blocked = true;
|
|
1465
|
-
isDefaultDesc
|
|
1466
|
-
? (objects[objectIndex][propName] = desc.value)
|
|
1467
|
-
: Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1362
|
+
isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1468
1363
|
}
|
|
1469
1364
|
++objectIndex;
|
|
1470
1365
|
}
|
|
1471
1366
|
if (!blocked) {
|
|
1472
|
-
isDefaultDesc
|
|
1473
|
-
? (otherObject[propName] = desc.value)
|
|
1474
|
-
: Object.defineProperty(otherObject, propName, desc);
|
|
1367
|
+
isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
|
|
1475
1368
|
}
|
|
1476
1369
|
}
|
|
1477
1370
|
return [...objects, otherObject];
|
|
@@ -1497,21 +1390,17 @@ function lazy(fn) {
|
|
|
1497
1390
|
comp = s;
|
|
1498
1391
|
}
|
|
1499
1392
|
let Comp;
|
|
1500
|
-
return createMemo(
|
|
1501
|
-
()
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
setHydrateContext(c);
|
|
1510
|
-
return r;
|
|
1511
|
-
})
|
|
1512
|
-
);
|
|
1393
|
+
return createMemo(() => (Comp = comp()) && untrack(() => {
|
|
1394
|
+
if (false) ;
|
|
1395
|
+
if (!ctx) return Comp(props);
|
|
1396
|
+
const c = sharedConfig.context;
|
|
1397
|
+
setHydrateContext(ctx);
|
|
1398
|
+
const r = Comp(props);
|
|
1399
|
+
setHydrateContext(c);
|
|
1400
|
+
return r;
|
|
1401
|
+
}));
|
|
1513
1402
|
};
|
|
1514
|
-
wrap.preload = () => p || ((p = fn()).then(mod =>
|
|
1403
|
+
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
1515
1404
|
return wrap;
|
|
1516
1405
|
}
|
|
1517
1406
|
let counter = 0;
|
|
@@ -1536,78 +1425,49 @@ function Index(props) {
|
|
|
1536
1425
|
function Show(props) {
|
|
1537
1426
|
const keyed = props.keyed;
|
|
1538
1427
|
const condition = createMemo(() => props.when, undefined, {
|
|
1539
|
-
equals: (a, b) =>
|
|
1428
|
+
equals: (a, b) => keyed ? a === b : !a === !b
|
|
1540
1429
|
});
|
|
1541
|
-
return createMemo(
|
|
1542
|
-
()
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
if (!untrack(condition)) throw narrowedError("Show");
|
|
1554
|
-
return props.when;
|
|
1555
|
-
}
|
|
1556
|
-
)
|
|
1557
|
-
)
|
|
1558
|
-
: child;
|
|
1559
|
-
}
|
|
1560
|
-
return props.fallback;
|
|
1561
|
-
},
|
|
1562
|
-
undefined,
|
|
1563
|
-
undefined
|
|
1564
|
-
);
|
|
1430
|
+
return createMemo(() => {
|
|
1431
|
+
const c = condition();
|
|
1432
|
+
if (c) {
|
|
1433
|
+
const child = props.children;
|
|
1434
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1435
|
+
return fn ? untrack(() => child(keyed ? c : () => {
|
|
1436
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
1437
|
+
return props.when;
|
|
1438
|
+
})) : child;
|
|
1439
|
+
}
|
|
1440
|
+
return props.fallback;
|
|
1441
|
+
}, undefined, undefined);
|
|
1565
1442
|
}
|
|
1566
1443
|
function Switch(props) {
|
|
1567
1444
|
let keyed = false;
|
|
1568
|
-
const equals = (a, b) =>
|
|
1569
|
-
a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1445
|
+
const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1570
1446
|
const conditions = children(() => props.children),
|
|
1571
|
-
evalConditions = createMemo(
|
|
1572
|
-
()
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
return [i, c, conds[i]];
|
|
1580
|
-
}
|
|
1447
|
+
evalConditions = createMemo(() => {
|
|
1448
|
+
let conds = conditions();
|
|
1449
|
+
if (!Array.isArray(conds)) conds = [conds];
|
|
1450
|
+
for (let i = 0; i < conds.length; i++) {
|
|
1451
|
+
const c = conds[i].when;
|
|
1452
|
+
if (c) {
|
|
1453
|
+
keyed = !!conds[i].keyed;
|
|
1454
|
+
return [i, c, conds[i]];
|
|
1581
1455
|
}
|
|
1582
|
-
return [-1];
|
|
1583
|
-
},
|
|
1584
|
-
undefined,
|
|
1585
|
-
{
|
|
1586
|
-
equals
|
|
1587
1456
|
}
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
return cond.when;
|
|
1603
|
-
}
|
|
1604
|
-
)
|
|
1605
|
-
)
|
|
1606
|
-
: c;
|
|
1607
|
-
},
|
|
1608
|
-
undefined,
|
|
1609
|
-
undefined
|
|
1610
|
-
);
|
|
1457
|
+
return [-1];
|
|
1458
|
+
}, undefined, {
|
|
1459
|
+
equals
|
|
1460
|
+
});
|
|
1461
|
+
return createMemo(() => {
|
|
1462
|
+
const [index, when, cond] = evalConditions();
|
|
1463
|
+
if (index < 0) return props.fallback;
|
|
1464
|
+
const c = cond.children;
|
|
1465
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
1466
|
+
return fn ? untrack(() => c(keyed ? when : () => {
|
|
1467
|
+
if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
|
|
1468
|
+
return cond.when;
|
|
1469
|
+
})) : c;
|
|
1470
|
+
}, undefined, undefined);
|
|
1611
1471
|
}
|
|
1612
1472
|
function Match(props) {
|
|
1613
1473
|
return props;
|
|
@@ -1619,32 +1479,22 @@ function resetErrorBoundaries() {
|
|
|
1619
1479
|
function ErrorBoundary(props) {
|
|
1620
1480
|
let err;
|
|
1621
1481
|
let v;
|
|
1622
|
-
if (
|
|
1623
|
-
sharedConfig.context &&
|
|
1624
|
-
sharedConfig.load &&
|
|
1625
|
-
(v = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count))
|
|
1626
|
-
)
|
|
1627
|
-
err = v[0];
|
|
1482
|
+
if (sharedConfig.context && sharedConfig.load && (v = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count))) err = v[0];
|
|
1628
1483
|
const [errored, setErrored] = createSignal(err, undefined);
|
|
1629
1484
|
Errors || (Errors = new Set());
|
|
1630
1485
|
Errors.add(setErrored);
|
|
1631
1486
|
onCleanup(() => Errors.delete(setErrored));
|
|
1632
|
-
return createMemo(
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
},
|
|
1641
|
-
undefined,
|
|
1642
|
-
undefined
|
|
1643
|
-
);
|
|
1487
|
+
return createMemo(() => {
|
|
1488
|
+
let e;
|
|
1489
|
+
if (e = errored()) {
|
|
1490
|
+
const f = props.fallback;
|
|
1491
|
+
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1492
|
+
}
|
|
1493
|
+
return catchError(() => props.children, setErrored);
|
|
1494
|
+
}, undefined, undefined);
|
|
1644
1495
|
}
|
|
1645
1496
|
|
|
1646
|
-
const suspenseListEquals = (a, b) =>
|
|
1647
|
-
a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1497
|
+
const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1648
1498
|
const SuspenseListContext = createContext();
|
|
1649
1499
|
function SuspenseList(props) {
|
|
1650
1500
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
@@ -1656,51 +1506,51 @@ function SuspenseList(props) {
|
|
|
1656
1506
|
if (listContext) {
|
|
1657
1507
|
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1658
1508
|
}
|
|
1659
|
-
const resolved = createMemo(
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1509
|
+
const resolved = createMemo(prev => {
|
|
1510
|
+
const reveal = props.revealOrder,
|
|
1511
|
+
tail = props.tail,
|
|
1512
|
+
{
|
|
1513
|
+
showContent = true,
|
|
1514
|
+
showFallback = true
|
|
1515
|
+
} = show ? show() : {},
|
|
1516
|
+
reg = registry(),
|
|
1517
|
+
reverse = reveal === "backwards";
|
|
1518
|
+
if (reveal === "together") {
|
|
1519
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1520
|
+
const res = reg.map(() => ({
|
|
1521
|
+
showContent: all && showContent,
|
|
1522
|
+
showFallback
|
|
1523
|
+
}));
|
|
1524
|
+
res.inFallback = !all;
|
|
1525
|
+
return res;
|
|
1526
|
+
}
|
|
1527
|
+
let stop = false;
|
|
1528
|
+
let inFallback = prev.inFallback;
|
|
1529
|
+
const res = [];
|
|
1530
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1531
|
+
const n = reverse ? len - i - 1 : i,
|
|
1532
|
+
s = reg[n]();
|
|
1533
|
+
if (!stop && !s) {
|
|
1534
|
+
res[n] = {
|
|
1535
|
+
showContent,
|
|
1670
1536
|
showFallback
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
s = reg[n]();
|
|
1681
|
-
if (!stop && !s) {
|
|
1682
|
-
res[n] = {
|
|
1683
|
-
showContent,
|
|
1684
|
-
showFallback
|
|
1685
|
-
};
|
|
1686
|
-
} else {
|
|
1687
|
-
const next = !stop;
|
|
1688
|
-
if (next) inFallback = true;
|
|
1689
|
-
res[n] = {
|
|
1690
|
-
showContent: next,
|
|
1691
|
-
showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
|
|
1692
|
-
};
|
|
1693
|
-
stop = true;
|
|
1694
|
-
}
|
|
1537
|
+
};
|
|
1538
|
+
} else {
|
|
1539
|
+
const next = !stop;
|
|
1540
|
+
if (next) inFallback = true;
|
|
1541
|
+
res[n] = {
|
|
1542
|
+
showContent: next,
|
|
1543
|
+
showFallback: !tail || next && tail === "collapsed" ? showFallback : false
|
|
1544
|
+
};
|
|
1545
|
+
stop = true;
|
|
1695
1546
|
}
|
|
1696
|
-
if (!stop) inFallback = false;
|
|
1697
|
-
res.inFallback = inFallback;
|
|
1698
|
-
return res;
|
|
1699
|
-
},
|
|
1700
|
-
{
|
|
1701
|
-
inFallback: false
|
|
1702
1547
|
}
|
|
1703
|
-
|
|
1548
|
+
if (!stop) inFallback = false;
|
|
1549
|
+
res.inFallback = inFallback;
|
|
1550
|
+
return res;
|
|
1551
|
+
}, {
|
|
1552
|
+
inFallback: false
|
|
1553
|
+
});
|
|
1704
1554
|
setWrapper(() => resolved);
|
|
1705
1555
|
return createComponent(SuspenseListContext.Provider, {
|
|
1706
1556
|
value: {
|
|
@@ -1774,14 +1624,17 @@ function Suspense(props) {
|
|
|
1774
1624
|
ctx = sharedConfig.context;
|
|
1775
1625
|
if (flicker) {
|
|
1776
1626
|
flicker();
|
|
1777
|
-
return
|
|
1627
|
+
return flicker = undefined;
|
|
1778
1628
|
}
|
|
1779
1629
|
if (ctx && p === "$$f") setHydrateContext();
|
|
1780
1630
|
const rendered = createMemo(() => props.children);
|
|
1781
1631
|
return createMemo(prev => {
|
|
1782
1632
|
const inFallback = store.inFallback(),
|
|
1783
|
-
{
|
|
1784
|
-
|
|
1633
|
+
{
|
|
1634
|
+
showContent = true,
|
|
1635
|
+
showFallback = true
|
|
1636
|
+
} = show ? show() : {};
|
|
1637
|
+
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1785
1638
|
store.resolved = true;
|
|
1786
1639
|
dispose && dispose();
|
|
1787
1640
|
dispose = ctx = p = undefined;
|
|
@@ -1809,59 +1662,4 @@ function Suspense(props) {
|
|
|
1809
1662
|
|
|
1810
1663
|
const DEV = undefined;
|
|
1811
1664
|
|
|
1812
|
-
export {
|
|
1813
|
-
$DEVCOMP,
|
|
1814
|
-
$PROXY,
|
|
1815
|
-
$TRACK,
|
|
1816
|
-
DEV,
|
|
1817
|
-
ErrorBoundary,
|
|
1818
|
-
For,
|
|
1819
|
-
Index,
|
|
1820
|
-
Match,
|
|
1821
|
-
Show,
|
|
1822
|
-
Suspense,
|
|
1823
|
-
SuspenseList,
|
|
1824
|
-
Switch,
|
|
1825
|
-
batch,
|
|
1826
|
-
cancelCallback,
|
|
1827
|
-
catchError,
|
|
1828
|
-
children,
|
|
1829
|
-
createComponent,
|
|
1830
|
-
createComputed,
|
|
1831
|
-
createContext,
|
|
1832
|
-
createDeferred,
|
|
1833
|
-
createEffect,
|
|
1834
|
-
createMemo,
|
|
1835
|
-
createReaction,
|
|
1836
|
-
createRenderEffect,
|
|
1837
|
-
createResource,
|
|
1838
|
-
createRoot,
|
|
1839
|
-
createSelector,
|
|
1840
|
-
createSignal,
|
|
1841
|
-
createUniqueId,
|
|
1842
|
-
enableExternalSource,
|
|
1843
|
-
enableHydration,
|
|
1844
|
-
enableScheduling,
|
|
1845
|
-
equalFn,
|
|
1846
|
-
from,
|
|
1847
|
-
getListener,
|
|
1848
|
-
getOwner,
|
|
1849
|
-
indexArray,
|
|
1850
|
-
lazy,
|
|
1851
|
-
mapArray,
|
|
1852
|
-
mergeProps,
|
|
1853
|
-
observable,
|
|
1854
|
-
on,
|
|
1855
|
-
onCleanup,
|
|
1856
|
-
onError,
|
|
1857
|
-
onMount,
|
|
1858
|
-
requestCallback,
|
|
1859
|
-
resetErrorBoundaries,
|
|
1860
|
-
runWithOwner,
|
|
1861
|
-
sharedConfig,
|
|
1862
|
-
splitProps,
|
|
1863
|
-
startTransition,
|
|
1864
|
-
untrack,
|
|
1865
|
-
useContext,
|
|
1866
|
-
useTransition
|
|
1867
|
-
};
|
|
1665
|
+
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 };
|