solid-js 1.8.18 → 1.8.19
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 +28 -23
- package/dist/dev.js +344 -580
- package/dist/server.cjs +33 -11
- package/dist/server.js +105 -176
- package/dist/solid.cjs +28 -23
- package/dist/solid.js +302 -507
- package/h/dist/h.js +9 -38
- 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 +33 -47
- package/package.json +3 -3
- package/store/dist/dev.js +43 -122
- package/store/dist/server.js +8 -19
- package/store/dist/store.js +40 -113
- 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 +10 -75
- 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 +33 -64
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +15 -13
- package/types/server/index.d.ts +2 -57
- package/types/server/reactive.d.ts +42 -73
- package/types/server/rendering.d.ts +98 -167
- 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 +2 -3
- package/web/dist/dev.js +84 -629
- package/web/dist/server.cjs +3 -3
- package/web/dist/server.js +99 -213
- package/web/dist/web.cjs +2 -3
- package/web/dist/web.js +82 -620
- package/web/storage/dist/storage.js +3 -3
- 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
|
}
|
|
@@ -118,15 +116,26 @@ function workLoop(hasTimeRemaining, initialTime) {
|
|
|
118
116
|
|
|
119
117
|
const sharedConfig = {
|
|
120
118
|
context: undefined,
|
|
121
|
-
registry: undefined
|
|
119
|
+
registry: undefined,
|
|
120
|
+
getContextId() {
|
|
121
|
+
return getContextId(this.context.count);
|
|
122
|
+
},
|
|
123
|
+
getNextContextId() {
|
|
124
|
+
return getContextId(this.context.count++);
|
|
125
|
+
}
|
|
122
126
|
};
|
|
127
|
+
function getContextId(count) {
|
|
128
|
+
const num = String(count),
|
|
129
|
+
len = num.length - 1;
|
|
130
|
+
return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
|
|
131
|
+
}
|
|
123
132
|
function setHydrateContext(context) {
|
|
124
133
|
sharedConfig.context = context;
|
|
125
134
|
}
|
|
126
135
|
function nextHydrateContext() {
|
|
127
136
|
return {
|
|
128
137
|
...sharedConfig.context,
|
|
129
|
-
id:
|
|
138
|
+
id: sharedConfig.getNextContextId(),
|
|
130
139
|
count: 0
|
|
131
140
|
};
|
|
132
141
|
}
|
|
@@ -162,14 +171,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
162
171
|
owner = Owner,
|
|
163
172
|
unowned = fn.length === 0,
|
|
164
173
|
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
165
|
-
root = unowned
|
|
166
|
-
|
|
167
|
-
:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
owner: current
|
|
172
|
-
},
|
|
174
|
+
root = unowned ? UNOWNED : {
|
|
175
|
+
owned: null,
|
|
176
|
+
cleanups: null,
|
|
177
|
+
context: current ? current.context : null,
|
|
178
|
+
owner: current
|
|
179
|
+
},
|
|
173
180
|
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
174
181
|
Owner = root;
|
|
175
182
|
Listener = null;
|
|
@@ -190,8 +197,7 @@ function createSignal(value, options) {
|
|
|
190
197
|
};
|
|
191
198
|
const setter = value => {
|
|
192
199
|
if (typeof value === "function") {
|
|
193
|
-
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
194
|
-
else value = value(s.value);
|
|
200
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
|
|
195
201
|
}
|
|
196
202
|
return writeSignal(s, value);
|
|
197
203
|
};
|
|
@@ -199,13 +205,11 @@ function createSignal(value, options) {
|
|
|
199
205
|
}
|
|
200
206
|
function createComputed(fn, value, options) {
|
|
201
207
|
const c = createComputation(fn, value, true, STALE);
|
|
202
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
203
|
-
else updateComputation(c);
|
|
208
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
204
209
|
}
|
|
205
210
|
function createRenderEffect(fn, value, options) {
|
|
206
211
|
const c = createComputation(fn, value, false, STALE);
|
|
207
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
208
|
-
else updateComputation(c);
|
|
212
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
209
213
|
}
|
|
210
214
|
function createEffect(fn, value, options) {
|
|
211
215
|
runEffects = runUserEffects;
|
|
@@ -217,15 +221,10 @@ function createEffect(fn, value, options) {
|
|
|
217
221
|
}
|
|
218
222
|
function createReaction(onInvalidate, options) {
|
|
219
223
|
let fn;
|
|
220
|
-
const c = createComputation(
|
|
221
|
-
()
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
},
|
|
225
|
-
undefined,
|
|
226
|
-
false,
|
|
227
|
-
0
|
|
228
|
-
),
|
|
224
|
+
const c = createComputation(() => {
|
|
225
|
+
fn ? fn() : untrack(onInvalidate);
|
|
226
|
+
fn = undefined;
|
|
227
|
+
}, undefined, false, 0),
|
|
229
228
|
s = SuspenseContext && useContext(SuspenseContext);
|
|
230
229
|
if (s) c.suspense = s;
|
|
231
230
|
c.user = true;
|
|
@@ -253,7 +252,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
253
252
|
let source;
|
|
254
253
|
let fetcher;
|
|
255
254
|
let options;
|
|
256
|
-
if (
|
|
255
|
+
if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
|
|
257
256
|
source = true;
|
|
258
257
|
fetcher = pSource;
|
|
259
258
|
options = pFetcher || {};
|
|
@@ -267,7 +266,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
267
266
|
id = null,
|
|
268
267
|
loadedUnderTransition = false,
|
|
269
268
|
scheduled = false,
|
|
270
|
-
resolved = "initialValue" in options,
|
|
269
|
+
resolved = ("initialValue" in options),
|
|
271
270
|
dynamic = typeof source === "function" && createMemo(source);
|
|
272
271
|
const contexts = new Set(),
|
|
273
272
|
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
@@ -277,21 +276,17 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
277
276
|
}),
|
|
278
277
|
[state, setState] = createSignal(resolved ? "ready" : "unresolved");
|
|
279
278
|
if (sharedConfig.context) {
|
|
280
|
-
id =
|
|
279
|
+
id = sharedConfig.getNextContextId();
|
|
281
280
|
let v;
|
|
282
|
-
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
283
|
-
else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
|
|
281
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
|
|
284
282
|
}
|
|
285
283
|
function loadEnd(p, v, error, key) {
|
|
286
284
|
if (pr === p) {
|
|
287
285
|
pr = null;
|
|
288
286
|
key !== undefined && (resolved = true);
|
|
289
|
-
if ((p === initP || v === initP) && options.onHydrated)
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
value: v
|
|
293
|
-
})
|
|
294
|
-
);
|
|
287
|
+
if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
|
|
288
|
+
value: v
|
|
289
|
+
}));
|
|
295
290
|
initP = NO_INIT;
|
|
296
291
|
if (Transition && p && loadedUnderTransition) {
|
|
297
292
|
Transition.promises.delete(p);
|
|
@@ -322,8 +317,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
322
317
|
createComputed(() => {
|
|
323
318
|
track();
|
|
324
319
|
if (pr) {
|
|
325
|
-
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
326
|
-
else if (!contexts.has(c)) {
|
|
320
|
+
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
|
|
327
321
|
c.increment();
|
|
328
322
|
contexts.add(c);
|
|
329
323
|
}
|
|
@@ -342,35 +336,26 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
342
336
|
return;
|
|
343
337
|
}
|
|
344
338
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
345
|
-
const p =
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
fetcher(lookup, {
|
|
350
|
-
value: value(),
|
|
351
|
-
refetching
|
|
352
|
-
})
|
|
353
|
-
);
|
|
339
|
+
const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
|
|
340
|
+
value: value(),
|
|
341
|
+
refetching
|
|
342
|
+
}));
|
|
354
343
|
if (!isPromise(p)) {
|
|
355
344
|
loadEnd(pr, p, undefined, lookup);
|
|
356
345
|
return p;
|
|
357
346
|
}
|
|
358
347
|
pr = p;
|
|
359
348
|
if ("value" in p) {
|
|
360
|
-
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
|
|
361
|
-
else loadEnd(pr, undefined, castError(p.value), lookup);
|
|
349
|
+
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, castError(p.value), lookup);
|
|
362
350
|
return p;
|
|
363
351
|
}
|
|
364
352
|
scheduled = true;
|
|
365
|
-
queueMicrotask(() =>
|
|
353
|
+
queueMicrotask(() => scheduled = false);
|
|
366
354
|
runUpdates(() => {
|
|
367
355
|
setState(resolved ? "refreshing" : "pending");
|
|
368
356
|
trigger();
|
|
369
357
|
}, false);
|
|
370
|
-
return p.then(
|
|
371
|
-
v => loadEnd(p, v, undefined, lookup),
|
|
372
|
-
e => loadEnd(p, undefined, castError(e), lookup)
|
|
373
|
-
);
|
|
358
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
|
|
374
359
|
}
|
|
375
360
|
Object.defineProperties(read, {
|
|
376
361
|
state: {
|
|
@@ -394,80 +379,50 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
394
379
|
}
|
|
395
380
|
}
|
|
396
381
|
});
|
|
397
|
-
if (dynamic) createComputed(() => load(false));
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
refetch: load,
|
|
403
|
-
mutate: setValue
|
|
404
|
-
}
|
|
405
|
-
];
|
|
382
|
+
if (dynamic) createComputed(() => load(false));else load(false);
|
|
383
|
+
return [read, {
|
|
384
|
+
refetch: load,
|
|
385
|
+
mutate: setValue
|
|
386
|
+
}];
|
|
406
387
|
}
|
|
407
388
|
function createDeferred(source, options) {
|
|
408
389
|
let t,
|
|
409
390
|
timeout = options ? options.timeoutMs : undefined;
|
|
410
|
-
const node = createComputation(
|
|
411
|
-
() => {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
timeout
|
|
418
|
-
}
|
|
419
|
-
: undefined
|
|
420
|
-
);
|
|
421
|
-
return source();
|
|
422
|
-
},
|
|
423
|
-
undefined,
|
|
424
|
-
true
|
|
425
|
-
);
|
|
426
|
-
const [deferred, setDeferred] = createSignal(
|
|
427
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
428
|
-
options
|
|
429
|
-
);
|
|
391
|
+
const node = createComputation(() => {
|
|
392
|
+
if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
|
|
393
|
+
timeout
|
|
394
|
+
} : undefined);
|
|
395
|
+
return source();
|
|
396
|
+
}, undefined, true);
|
|
397
|
+
const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);
|
|
430
398
|
updateComputation(node);
|
|
431
|
-
setDeferred(() =>
|
|
432
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
433
|
-
);
|
|
399
|
+
setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
434
400
|
return deferred;
|
|
435
401
|
}
|
|
436
402
|
function createSelector(source, fn = equalFn, options) {
|
|
437
403
|
const subs = new Map();
|
|
438
|
-
const node = createComputation(
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
for (const
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
}
|
|
449
|
-
return v;
|
|
450
|
-
},
|
|
451
|
-
undefined,
|
|
452
|
-
true,
|
|
453
|
-
STALE
|
|
454
|
-
);
|
|
404
|
+
const node = createComputation(p => {
|
|
405
|
+
const v = source();
|
|
406
|
+
for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
|
|
407
|
+
for (const c of val.values()) {
|
|
408
|
+
c.state = STALE;
|
|
409
|
+
if (c.pure) Updates.push(c);else Effects.push(c);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return v;
|
|
413
|
+
}, undefined, true, STALE);
|
|
455
414
|
updateComputation(node);
|
|
456
415
|
return key => {
|
|
457
416
|
const listener = Listener;
|
|
458
417
|
if (listener) {
|
|
459
418
|
let l;
|
|
460
|
-
if (
|
|
461
|
-
else subs.set(key, (l = new Set([listener])));
|
|
419
|
+
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
462
420
|
onCleanup(() => {
|
|
463
421
|
l.delete(listener);
|
|
464
422
|
!l.size && subs.delete(key);
|
|
465
423
|
});
|
|
466
424
|
}
|
|
467
|
-
return fn(
|
|
468
|
-
key,
|
|
469
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
470
|
-
);
|
|
425
|
+
return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
471
426
|
};
|
|
472
427
|
}
|
|
473
428
|
function batch(fn) {
|
|
@@ -507,9 +462,7 @@ function onMount(fn) {
|
|
|
507
462
|
createEffect(() => untrack(fn));
|
|
508
463
|
}
|
|
509
464
|
function onCleanup(fn) {
|
|
510
|
-
if (Owner === null);
|
|
511
|
-
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
512
|
-
else Owner.cleanups.push(fn);
|
|
465
|
+
if (Owner === null) ;else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
|
|
513
466
|
return fn;
|
|
514
467
|
}
|
|
515
468
|
function catchError(fn, handler) {
|
|
@@ -563,17 +516,15 @@ function startTransition(fn) {
|
|
|
563
516
|
Owner = o;
|
|
564
517
|
let t;
|
|
565
518
|
if (Scheduler || SuspenseContext) {
|
|
566
|
-
t =
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
});
|
|
576
|
-
t.done || (t.done = new Promise(res => (t.resolve = res)));
|
|
519
|
+
t = Transition || (Transition = {
|
|
520
|
+
sources: new Set(),
|
|
521
|
+
effects: [],
|
|
522
|
+
promises: new Set(),
|
|
523
|
+
disposed: new Set(),
|
|
524
|
+
queue: new Set(),
|
|
525
|
+
running: true
|
|
526
|
+
});
|
|
527
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
577
528
|
t.running = true;
|
|
578
529
|
}
|
|
579
530
|
runUpdates(fn, false);
|
|
@@ -581,7 +532,7 @@ function startTransition(fn) {
|
|
|
581
532
|
return t ? t.done : undefined;
|
|
582
533
|
});
|
|
583
534
|
}
|
|
584
|
-
const [transPending, setTransPending] = /*@__PURE__*/
|
|
535
|
+
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
585
536
|
function useTransition() {
|
|
586
537
|
return [transPending, startTransition];
|
|
587
538
|
}
|
|
@@ -598,9 +549,8 @@ function createContext(defaultValue, options) {
|
|
|
598
549
|
};
|
|
599
550
|
}
|
|
600
551
|
function useContext(context) {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
: context.defaultValue;
|
|
552
|
+
let value;
|
|
553
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
|
|
604
554
|
}
|
|
605
555
|
function children(fn) {
|
|
606
556
|
const children = createMemo(fn);
|
|
@@ -617,7 +567,10 @@ function getSuspenseContext() {
|
|
|
617
567
|
}
|
|
618
568
|
function enableExternalSource(factory, untrack = fn => fn()) {
|
|
619
569
|
if (ExternalSourceConfig) {
|
|
620
|
-
const {
|
|
570
|
+
const {
|
|
571
|
+
factory: oldFactory,
|
|
572
|
+
untrack: oldUntrack
|
|
573
|
+
} = ExternalSourceConfig;
|
|
621
574
|
ExternalSourceConfig = {
|
|
622
575
|
factory: (fn, trigger) => {
|
|
623
576
|
const oldSource = oldFactory(fn, trigger);
|
|
@@ -642,8 +595,7 @@ function enableExternalSource(factory, untrack = fn => fn()) {
|
|
|
642
595
|
function readSignal() {
|
|
643
596
|
const runningTransition = Transition && Transition.running;
|
|
644
597
|
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
645
|
-
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
646
|
-
else {
|
|
598
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
|
|
647
599
|
const updates = Updates;
|
|
648
600
|
Updates = null;
|
|
649
601
|
runUpdates(() => lookUpstream(this), false);
|
|
@@ -671,12 +623,11 @@ function readSignal() {
|
|
|
671
623
|
return this.value;
|
|
672
624
|
}
|
|
673
625
|
function writeSignal(node, value, isComp) {
|
|
674
|
-
let current =
|
|
675
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
626
|
+
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
676
627
|
if (!node.comparator || !node.comparator(current, value)) {
|
|
677
628
|
if (Transition) {
|
|
678
629
|
const TransitionRunning = Transition.running;
|
|
679
|
-
if (TransitionRunning ||
|
|
630
|
+
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
680
631
|
Transition.sources.add(node);
|
|
681
632
|
node.tValue = value;
|
|
682
633
|
}
|
|
@@ -689,16 +640,14 @@ function writeSignal(node, value, isComp) {
|
|
|
689
640
|
const TransitionRunning = Transition && Transition.running;
|
|
690
641
|
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
691
642
|
if (TransitionRunning ? !o.tState : !o.state) {
|
|
692
|
-
if (o.pure) Updates.push(o);
|
|
693
|
-
else Effects.push(o);
|
|
643
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
694
644
|
if (o.observers) markDownstream(o);
|
|
695
645
|
}
|
|
696
|
-
if (!TransitionRunning) o.state = STALE;
|
|
697
|
-
else o.tState = STALE;
|
|
646
|
+
if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
|
|
698
647
|
}
|
|
699
648
|
if (Updates.length > 10e5) {
|
|
700
649
|
Updates = [];
|
|
701
|
-
if (false);
|
|
650
|
+
if (false) ;
|
|
702
651
|
throw new Error();
|
|
703
652
|
}
|
|
704
653
|
}, false);
|
|
@@ -710,11 +659,7 @@ function updateComputation(node) {
|
|
|
710
659
|
if (!node.fn) return;
|
|
711
660
|
cleanNode(node);
|
|
712
661
|
const time = ExecCount;
|
|
713
|
-
runComputation(
|
|
714
|
-
node,
|
|
715
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
716
|
-
time
|
|
717
|
-
);
|
|
662
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
718
663
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
719
664
|
queueMicrotask(() => {
|
|
720
665
|
runUpdates(() => {
|
|
@@ -779,14 +724,11 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
779
724
|
c.state = 0;
|
|
780
725
|
c.tState = state;
|
|
781
726
|
}
|
|
782
|
-
if (Owner === null);
|
|
783
|
-
else if (Owner !== UNOWNED) {
|
|
727
|
+
if (Owner === null) ;else if (Owner !== UNOWNED) {
|
|
784
728
|
if (Transition && Transition.running && Owner.pure) {
|
|
785
|
-
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
786
|
-
else Owner.tOwned.push(c);
|
|
729
|
+
if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
|
|
787
730
|
} else {
|
|
788
|
-
if (!Owner.owned) Owner.owned = [c];
|
|
789
|
-
else Owner.owned.push(c);
|
|
731
|
+
if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
|
|
790
732
|
}
|
|
791
733
|
}
|
|
792
734
|
if (ExternalSourceConfig && c.fn) {
|
|
@@ -837,8 +779,7 @@ function runUpdates(fn, init) {
|
|
|
837
779
|
if (Updates) return fn();
|
|
838
780
|
let wait = false;
|
|
839
781
|
if (!init) Updates = [];
|
|
840
|
-
if (Effects) wait = true;
|
|
841
|
-
else Effects = [];
|
|
782
|
+
if (Effects) wait = true;else Effects = [];
|
|
842
783
|
ExecCount++;
|
|
843
784
|
try {
|
|
844
785
|
const res = fn();
|
|
@@ -852,8 +793,7 @@ function runUpdates(fn, init) {
|
|
|
852
793
|
}
|
|
853
794
|
function completeUpdates(wait) {
|
|
854
795
|
if (Updates) {
|
|
855
|
-
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
856
|
-
else runQueue(Updates);
|
|
796
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
|
|
857
797
|
Updates = null;
|
|
858
798
|
}
|
|
859
799
|
if (wait) return;
|
|
@@ -921,8 +861,7 @@ function runUserEffects(queue) {
|
|
|
921
861
|
userLength = 0;
|
|
922
862
|
for (i = 0; i < queue.length; i++) {
|
|
923
863
|
const e = queue[i];
|
|
924
|
-
if (!e.user) runTop(e);
|
|
925
|
-
else queue[userLength++] = e;
|
|
864
|
+
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
926
865
|
}
|
|
927
866
|
if (sharedConfig.context) {
|
|
928
867
|
if (sharedConfig.count) {
|
|
@@ -940,15 +879,13 @@ function runUserEffects(queue) {
|
|
|
940
879
|
}
|
|
941
880
|
function lookUpstream(node, ignore) {
|
|
942
881
|
const runningTransition = Transition && Transition.running;
|
|
943
|
-
if (runningTransition) node.tState = 0;
|
|
944
|
-
else node.state = 0;
|
|
882
|
+
if (runningTransition) node.tState = 0;else node.state = 0;
|
|
945
883
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
946
884
|
const source = node.sources[i];
|
|
947
885
|
if (source.sources) {
|
|
948
886
|
const state = runningTransition ? source.tState : source.state;
|
|
949
887
|
if (state === STALE) {
|
|
950
|
-
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
951
|
-
runTop(source);
|
|
888
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
|
|
952
889
|
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
953
890
|
}
|
|
954
891
|
}
|
|
@@ -958,10 +895,8 @@ function markDownstream(node) {
|
|
|
958
895
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
959
896
|
const o = node.observers[i];
|
|
960
897
|
if (runningTransition ? !o.tState : !o.state) {
|
|
961
|
-
if (runningTransition) o.tState = PENDING;
|
|
962
|
-
|
|
963
|
-
if (o.pure) Updates.push(o);
|
|
964
|
-
else Effects.push(o);
|
|
898
|
+
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
899
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
965
900
|
o.observers && markDownstream(o);
|
|
966
901
|
}
|
|
967
902
|
}
|
|
@@ -998,8 +933,7 @@ function cleanNode(node) {
|
|
|
998
933
|
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
999
934
|
node.cleanups = null;
|
|
1000
935
|
}
|
|
1001
|
-
if (Transition && Transition.running) node.tState = 0;
|
|
1002
|
-
else node.state = 0;
|
|
936
|
+
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
1003
937
|
}
|
|
1004
938
|
function reset(node, top) {
|
|
1005
939
|
if (!top) {
|
|
@@ -1020,21 +954,19 @@ function runErrors(err, fns, owner) {
|
|
|
1020
954
|
try {
|
|
1021
955
|
for (const f of fns) f(err);
|
|
1022
956
|
} catch (e) {
|
|
1023
|
-
handleError(e,
|
|
957
|
+
handleError(e, owner && owner.owner || null);
|
|
1024
958
|
}
|
|
1025
959
|
}
|
|
1026
960
|
function handleError(err, owner = Owner) {
|
|
1027
961
|
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
1028
962
|
const error = castError(err);
|
|
1029
963
|
if (!fns) throw error;
|
|
1030
|
-
if (Effects)
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
});
|
|
1037
|
-
else runErrors(error, fns, owner);
|
|
964
|
+
if (Effects) Effects.push({
|
|
965
|
+
fn() {
|
|
966
|
+
runErrors(error, fns, owner);
|
|
967
|
+
},
|
|
968
|
+
state: STALE
|
|
969
|
+
});else runErrors(error, fns, owner);
|
|
1038
970
|
}
|
|
1039
971
|
function resolveChildren(children) {
|
|
1040
972
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1051,24 +983,19 @@ function resolveChildren(children) {
|
|
|
1051
983
|
function createProvider(id, options) {
|
|
1052
984
|
return function provider(props) {
|
|
1053
985
|
let res;
|
|
1054
|
-
createRenderEffect(
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
return children(() => props.children);
|
|
1062
|
-
})),
|
|
1063
|
-
undefined
|
|
1064
|
-
);
|
|
986
|
+
createRenderEffect(() => res = untrack(() => {
|
|
987
|
+
Owner.context = {
|
|
988
|
+
...Owner.context,
|
|
989
|
+
[id]: props.value
|
|
990
|
+
};
|
|
991
|
+
return children(() => props.children);
|
|
992
|
+
}), undefined);
|
|
1065
993
|
return res;
|
|
1066
994
|
};
|
|
1067
995
|
}
|
|
1068
996
|
function onError(fn) {
|
|
1069
997
|
ERROR || (ERROR = Symbol("error"));
|
|
1070
|
-
if (Owner === null);
|
|
1071
|
-
else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
998
|
+
if (Owner === null) ;else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1072
999
|
Owner.context = {
|
|
1073
1000
|
...Owner.context,
|
|
1074
1001
|
[ERROR]: [fn]
|
|
@@ -1097,8 +1024,7 @@ function observable(input) {
|
|
|
1097
1024
|
if (!(observer instanceof Object) || observer == null) {
|
|
1098
1025
|
throw new TypeError("Expected the observer to be an object.");
|
|
1099
1026
|
}
|
|
1100
|
-
const handler =
|
|
1101
|
-
typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1027
|
+
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1102
1028
|
if (!handler) {
|
|
1103
1029
|
return {
|
|
1104
1030
|
unsubscribe() {}
|
|
@@ -1129,7 +1055,7 @@ function from(producer) {
|
|
|
1129
1055
|
});
|
|
1130
1056
|
if ("subscribe" in producer) {
|
|
1131
1057
|
const unsub = producer.subscribe(v => set(() => v));
|
|
1132
|
-
onCleanup(() =>
|
|
1058
|
+
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
1133
1059
|
} else {
|
|
1134
1060
|
const clean = producer(set);
|
|
1135
1061
|
onCleanup(clean);
|
|
@@ -1150,20 +1076,12 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1150
1076
|
onCleanup(() => dispose(disposers));
|
|
1151
1077
|
return () => {
|
|
1152
1078
|
let newItems = list() || [],
|
|
1079
|
+
newLen = newItems.length,
|
|
1153
1080
|
i,
|
|
1154
1081
|
j;
|
|
1155
1082
|
newItems[$TRACK];
|
|
1156
1083
|
return untrack(() => {
|
|
1157
|
-
let
|
|
1158
|
-
newIndices,
|
|
1159
|
-
newIndicesNext,
|
|
1160
|
-
temp,
|
|
1161
|
-
tempdisposers,
|
|
1162
|
-
tempIndexes,
|
|
1163
|
-
start,
|
|
1164
|
-
end,
|
|
1165
|
-
newEnd,
|
|
1166
|
-
item;
|
|
1084
|
+
let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
|
|
1167
1085
|
if (newLen === 0) {
|
|
1168
1086
|
if (len !== 0) {
|
|
1169
1087
|
dispose(disposers);
|
|
@@ -1181,7 +1099,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1181
1099
|
});
|
|
1182
1100
|
len = 1;
|
|
1183
1101
|
}
|
|
1184
|
-
}
|
|
1102
|
+
}
|
|
1103
|
+
else if (len === 0) {
|
|
1185
1104
|
mapped = new Array(newLen);
|
|
1186
1105
|
for (j = 0; j < newLen; j++) {
|
|
1187
1106
|
items[j] = newItems[j];
|
|
@@ -1192,16 +1111,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1192
1111
|
temp = new Array(newLen);
|
|
1193
1112
|
tempdisposers = new Array(newLen);
|
|
1194
1113
|
indexes && (tempIndexes = new Array(newLen));
|
|
1195
|
-
for (
|
|
1196
|
-
|
|
1197
|
-
start < end && items[start] === newItems[start];
|
|
1198
|
-
start++
|
|
1199
|
-
);
|
|
1200
|
-
for (
|
|
1201
|
-
end = len - 1, newEnd = newLen - 1;
|
|
1202
|
-
end >= start && newEnd >= start && items[end] === newItems[newEnd];
|
|
1203
|
-
end--, newEnd--
|
|
1204
|
-
) {
|
|
1114
|
+
for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
|
|
1115
|
+
for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
|
|
1205
1116
|
temp[newEnd] = mapped[end];
|
|
1206
1117
|
tempdisposers[newEnd] = disposers[end];
|
|
1207
1118
|
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
@@ -1235,7 +1146,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1235
1146
|
}
|
|
1236
1147
|
} else mapped[j] = createRoot(mapper);
|
|
1237
1148
|
}
|
|
1238
|
-
mapped = mapped.slice(0,
|
|
1149
|
+
mapped = mapped.slice(0, len = newLen);
|
|
1239
1150
|
items = newItems.slice(0);
|
|
1240
1151
|
}
|
|
1241
1152
|
return mapped;
|
|
@@ -1260,10 +1171,11 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1260
1171
|
i;
|
|
1261
1172
|
onCleanup(() => dispose(disposers));
|
|
1262
1173
|
return () => {
|
|
1263
|
-
const newItems = list() || []
|
|
1174
|
+
const newItems = list() || [],
|
|
1175
|
+
newLen = newItems.length;
|
|
1264
1176
|
newItems[$TRACK];
|
|
1265
1177
|
return untrack(() => {
|
|
1266
|
-
if (
|
|
1178
|
+
if (newLen === 0) {
|
|
1267
1179
|
if (len !== 0) {
|
|
1268
1180
|
dispose(disposers);
|
|
1269
1181
|
disposers = [];
|
|
@@ -1289,7 +1201,7 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1289
1201
|
mapped = [];
|
|
1290
1202
|
len = 0;
|
|
1291
1203
|
}
|
|
1292
|
-
for (i = 0; i <
|
|
1204
|
+
for (i = 0; i < newLen; i++) {
|
|
1293
1205
|
if (i < items.length && items[i] !== newItems[i]) {
|
|
1294
1206
|
signals[i](() => newItems[i]);
|
|
1295
1207
|
} else if (i >= items.length) {
|
|
@@ -1299,9 +1211,9 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1299
1211
|
for (; i < items.length; i++) {
|
|
1300
1212
|
disposers[i]();
|
|
1301
1213
|
}
|
|
1302
|
-
len = signals.length = disposers.length =
|
|
1214
|
+
len = signals.length = disposers.length = newLen;
|
|
1303
1215
|
items = newItems.slice(0);
|
|
1304
|
-
return
|
|
1216
|
+
return mapped = mapped.slice(0, len);
|
|
1305
1217
|
});
|
|
1306
1218
|
function mapper(disposer) {
|
|
1307
1219
|
disposers[i] = disposer;
|
|
@@ -1370,33 +1282,29 @@ function mergeProps(...sources) {
|
|
|
1370
1282
|
let proxy = false;
|
|
1371
1283
|
for (let i = 0; i < sources.length; i++) {
|
|
1372
1284
|
const s = sources[i];
|
|
1373
|
-
proxy = proxy ||
|
|
1374
|
-
sources[i] = typeof s === "function" ? (
|
|
1285
|
+
proxy = proxy || !!s && $PROXY in s;
|
|
1286
|
+
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
1375
1287
|
}
|
|
1376
1288
|
if (proxy) {
|
|
1377
|
-
return new Proxy(
|
|
1378
|
-
{
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
if (v !== undefined) return v;
|
|
1383
|
-
}
|
|
1384
|
-
},
|
|
1385
|
-
has(property) {
|
|
1386
|
-
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1387
|
-
if (property in resolveSource(sources[i])) return true;
|
|
1388
|
-
}
|
|
1389
|
-
return false;
|
|
1390
|
-
},
|
|
1391
|
-
keys() {
|
|
1392
|
-
const keys = [];
|
|
1393
|
-
for (let i = 0; i < sources.length; i++)
|
|
1394
|
-
keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1395
|
-
return [...new Set(keys)];
|
|
1289
|
+
return new Proxy({
|
|
1290
|
+
get(property) {
|
|
1291
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1292
|
+
const v = resolveSource(sources[i])[property];
|
|
1293
|
+
if (v !== undefined) return v;
|
|
1396
1294
|
}
|
|
1397
1295
|
},
|
|
1398
|
-
|
|
1399
|
-
|
|
1296
|
+
has(property) {
|
|
1297
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1298
|
+
if (property in resolveSource(sources[i])) return true;
|
|
1299
|
+
}
|
|
1300
|
+
return false;
|
|
1301
|
+
},
|
|
1302
|
+
keys() {
|
|
1303
|
+
const keys = [];
|
|
1304
|
+
for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1305
|
+
return [...new Set(keys)];
|
|
1306
|
+
}
|
|
1307
|
+
}, propTraps);
|
|
1400
1308
|
}
|
|
1401
1309
|
const sourcesMap = {};
|
|
1402
1310
|
const defined = Object.create(null);
|
|
@@ -1409,20 +1317,15 @@ function mergeProps(...sources) {
|
|
|
1409
1317
|
if (key === "__proto__" || key === "constructor") continue;
|
|
1410
1318
|
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
1411
1319
|
if (!defined[key]) {
|
|
1412
|
-
defined[key] = desc.get
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
}
|
|
1418
|
-
: desc.value !== undefined
|
|
1419
|
-
? desc
|
|
1420
|
-
: undefined;
|
|
1320
|
+
defined[key] = desc.get ? {
|
|
1321
|
+
enumerable: true,
|
|
1322
|
+
configurable: true,
|
|
1323
|
+
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
1324
|
+
} : desc.value !== undefined ? desc : undefined;
|
|
1421
1325
|
} else {
|
|
1422
1326
|
const sources = sourcesMap[key];
|
|
1423
1327
|
if (sources) {
|
|
1424
|
-
if (desc.get) sources.push(desc.get.bind(source));
|
|
1425
|
-
else if (desc.value !== undefined) sources.push(() => desc.value);
|
|
1328
|
+
if (desc.get) sources.push(desc.get.bind(source));else if (desc.value !== undefined) sources.push(() => desc.value);
|
|
1426
1329
|
}
|
|
1427
1330
|
}
|
|
1428
1331
|
}
|
|
@@ -1432,8 +1335,7 @@ function mergeProps(...sources) {
|
|
|
1432
1335
|
for (let i = definedKeys.length - 1; i >= 0; i--) {
|
|
1433
1336
|
const key = definedKeys[i],
|
|
1434
1337
|
desc = defined[key];
|
|
1435
|
-
if (desc && desc.get) Object.defineProperty(target, key, desc);
|
|
1436
|
-
else target[key] = desc ? desc.value : undefined;
|
|
1338
|
+
if (desc && desc.get) Object.defineProperty(target, key, desc);else target[key] = desc ? desc.value : undefined;
|
|
1437
1339
|
}
|
|
1438
1340
|
return target;
|
|
1439
1341
|
}
|
|
@@ -1441,60 +1343,47 @@ function splitProps(props, ...keys) {
|
|
|
1441
1343
|
if ($PROXY in props) {
|
|
1442
1344
|
const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
|
|
1443
1345
|
const res = keys.map(k => {
|
|
1444
|
-
return new Proxy(
|
|
1445
|
-
{
|
|
1446
|
-
|
|
1447
|
-
return k.includes(property) ? props[property] : undefined;
|
|
1448
|
-
},
|
|
1449
|
-
has(property) {
|
|
1450
|
-
return k.includes(property) && property in props;
|
|
1451
|
-
},
|
|
1452
|
-
keys() {
|
|
1453
|
-
return k.filter(property => property in props);
|
|
1454
|
-
}
|
|
1346
|
+
return new Proxy({
|
|
1347
|
+
get(property) {
|
|
1348
|
+
return k.includes(property) ? props[property] : undefined;
|
|
1455
1349
|
},
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
});
|
|
1459
|
-
res.push(
|
|
1460
|
-
new Proxy(
|
|
1461
|
-
{
|
|
1462
|
-
get(property) {
|
|
1463
|
-
return blocked.has(property) ? undefined : props[property];
|
|
1464
|
-
},
|
|
1465
|
-
has(property) {
|
|
1466
|
-
return blocked.has(property) ? false : property in props;
|
|
1467
|
-
},
|
|
1468
|
-
keys() {
|
|
1469
|
-
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1470
|
-
}
|
|
1350
|
+
has(property) {
|
|
1351
|
+
return k.includes(property) && property in props;
|
|
1471
1352
|
},
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1353
|
+
keys() {
|
|
1354
|
+
return k.filter(property => property in props);
|
|
1355
|
+
}
|
|
1356
|
+
}, propTraps);
|
|
1357
|
+
});
|
|
1358
|
+
res.push(new Proxy({
|
|
1359
|
+
get(property) {
|
|
1360
|
+
return blocked.has(property) ? undefined : props[property];
|
|
1361
|
+
},
|
|
1362
|
+
has(property) {
|
|
1363
|
+
return blocked.has(property) ? false : property in props;
|
|
1364
|
+
},
|
|
1365
|
+
keys() {
|
|
1366
|
+
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1367
|
+
}
|
|
1368
|
+
}, propTraps));
|
|
1475
1369
|
return res;
|
|
1476
1370
|
}
|
|
1477
1371
|
const otherObject = {};
|
|
1478
1372
|
const objects = keys.map(() => ({}));
|
|
1479
1373
|
for (const propName of Object.getOwnPropertyNames(props)) {
|
|
1480
1374
|
const desc = Object.getOwnPropertyDescriptor(props, propName);
|
|
1481
|
-
const isDefaultDesc =
|
|
1482
|
-
!desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1375
|
+
const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1483
1376
|
let blocked = false;
|
|
1484
1377
|
let objectIndex = 0;
|
|
1485
1378
|
for (const k of keys) {
|
|
1486
1379
|
if (k.includes(propName)) {
|
|
1487
1380
|
blocked = true;
|
|
1488
|
-
isDefaultDesc
|
|
1489
|
-
? (objects[objectIndex][propName] = desc.value)
|
|
1490
|
-
: Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1381
|
+
isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1491
1382
|
}
|
|
1492
1383
|
++objectIndex;
|
|
1493
1384
|
}
|
|
1494
1385
|
if (!blocked) {
|
|
1495
|
-
isDefaultDesc
|
|
1496
|
-
? (otherObject[propName] = desc.value)
|
|
1497
|
-
: Object.defineProperty(otherObject, propName, desc);
|
|
1386
|
+
isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
|
|
1498
1387
|
}
|
|
1499
1388
|
}
|
|
1500
1389
|
return [...objects, otherObject];
|
|
@@ -1520,27 +1409,23 @@ function lazy(fn) {
|
|
|
1520
1409
|
comp = s;
|
|
1521
1410
|
}
|
|
1522
1411
|
let Comp;
|
|
1523
|
-
return createMemo(
|
|
1524
|
-
()
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
setHydrateContext(c);
|
|
1533
|
-
return r;
|
|
1534
|
-
})
|
|
1535
|
-
);
|
|
1412
|
+
return createMemo(() => (Comp = comp()) && untrack(() => {
|
|
1413
|
+
if (false) ;
|
|
1414
|
+
if (!ctx) return Comp(props);
|
|
1415
|
+
const c = sharedConfig.context;
|
|
1416
|
+
setHydrateContext(ctx);
|
|
1417
|
+
const r = Comp(props);
|
|
1418
|
+
setHydrateContext(c);
|
|
1419
|
+
return r;
|
|
1420
|
+
}));
|
|
1536
1421
|
};
|
|
1537
|
-
wrap.preload = () => p || ((p = fn()).then(mod =>
|
|
1422
|
+
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
1538
1423
|
return wrap;
|
|
1539
1424
|
}
|
|
1540
1425
|
let counter = 0;
|
|
1541
1426
|
function createUniqueId() {
|
|
1542
1427
|
const ctx = sharedConfig.context;
|
|
1543
|
-
return ctx ?
|
|
1428
|
+
return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
|
|
1544
1429
|
}
|
|
1545
1430
|
|
|
1546
1431
|
const narrowedError = name => `Stale read from <${name}>.`;
|
|
@@ -1559,77 +1444,49 @@ function Index(props) {
|
|
|
1559
1444
|
function Show(props) {
|
|
1560
1445
|
const keyed = props.keyed;
|
|
1561
1446
|
const condition = createMemo(() => props.when, undefined, {
|
|
1562
|
-
equals: (a, b) =>
|
|
1447
|
+
equals: (a, b) => keyed ? a === b : !a === !b
|
|
1563
1448
|
});
|
|
1564
|
-
return createMemo(
|
|
1565
|
-
()
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
if (!untrack(condition)) throw narrowedError("Show");
|
|
1577
|
-
return props.when;
|
|
1578
|
-
}
|
|
1579
|
-
)
|
|
1580
|
-
)
|
|
1581
|
-
: child;
|
|
1582
|
-
}
|
|
1583
|
-
return props.fallback;
|
|
1584
|
-
},
|
|
1585
|
-
undefined,
|
|
1586
|
-
undefined
|
|
1587
|
-
);
|
|
1449
|
+
return createMemo(() => {
|
|
1450
|
+
const c = condition();
|
|
1451
|
+
if (c) {
|
|
1452
|
+
const child = props.children;
|
|
1453
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1454
|
+
return fn ? untrack(() => child(keyed ? c : () => {
|
|
1455
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
1456
|
+
return props.when;
|
|
1457
|
+
})) : child;
|
|
1458
|
+
}
|
|
1459
|
+
return props.fallback;
|
|
1460
|
+
}, undefined, undefined);
|
|
1588
1461
|
}
|
|
1589
1462
|
function Switch(props) {
|
|
1590
1463
|
let keyed = false;
|
|
1591
1464
|
const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1592
1465
|
const conditions = children(() => props.children),
|
|
1593
|
-
evalConditions = createMemo(
|
|
1594
|
-
()
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
return [i, c, conds[i]];
|
|
1602
|
-
}
|
|
1466
|
+
evalConditions = createMemo(() => {
|
|
1467
|
+
let conds = conditions();
|
|
1468
|
+
if (!Array.isArray(conds)) conds = [conds];
|
|
1469
|
+
for (let i = 0; i < conds.length; i++) {
|
|
1470
|
+
const c = conds[i].when;
|
|
1471
|
+
if (c) {
|
|
1472
|
+
keyed = !!conds[i].keyed;
|
|
1473
|
+
return [i, c, conds[i]];
|
|
1603
1474
|
}
|
|
1604
|
-
return [-1];
|
|
1605
|
-
},
|
|
1606
|
-
undefined,
|
|
1607
|
-
{
|
|
1608
|
-
equals
|
|
1609
1475
|
}
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
return cond.when;
|
|
1625
|
-
}
|
|
1626
|
-
)
|
|
1627
|
-
)
|
|
1628
|
-
: c;
|
|
1629
|
-
},
|
|
1630
|
-
undefined,
|
|
1631
|
-
undefined
|
|
1632
|
-
);
|
|
1476
|
+
return [-1];
|
|
1477
|
+
}, undefined, {
|
|
1478
|
+
equals
|
|
1479
|
+
});
|
|
1480
|
+
return createMemo(() => {
|
|
1481
|
+
const [index, when, cond] = evalConditions();
|
|
1482
|
+
if (index < 0) return props.fallback;
|
|
1483
|
+
const c = cond.children;
|
|
1484
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
1485
|
+
return fn ? untrack(() => c(keyed ? when : () => {
|
|
1486
|
+
if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
|
|
1487
|
+
return cond.when;
|
|
1488
|
+
})) : c;
|
|
1489
|
+
}, undefined, undefined);
|
|
1633
1490
|
}
|
|
1634
1491
|
function Match(props) {
|
|
1635
1492
|
return props;
|
|
@@ -1640,29 +1497,23 @@ function resetErrorBoundaries() {
|
|
|
1640
1497
|
}
|
|
1641
1498
|
function ErrorBoundary(props) {
|
|
1642
1499
|
let err;
|
|
1643
|
-
if (sharedConfig.context && sharedConfig.load)
|
|
1644
|
-
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1500
|
+
if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.getContextId());
|
|
1645
1501
|
const [errored, setErrored] = createSignal(err, undefined);
|
|
1646
1502
|
Errors || (Errors = new Set());
|
|
1647
1503
|
Errors.add(setErrored);
|
|
1648
1504
|
onCleanup(() => Errors.delete(setErrored));
|
|
1649
|
-
return createMemo(
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
},
|
|
1658
|
-
undefined,
|
|
1659
|
-
undefined
|
|
1660
|
-
);
|
|
1505
|
+
return createMemo(() => {
|
|
1506
|
+
let e;
|
|
1507
|
+
if (e = errored()) {
|
|
1508
|
+
const f = props.fallback;
|
|
1509
|
+
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1510
|
+
}
|
|
1511
|
+
return catchError(() => props.children, setErrored);
|
|
1512
|
+
}, undefined, undefined);
|
|
1661
1513
|
}
|
|
1662
1514
|
|
|
1663
|
-
const suspenseListEquals = (a, b) =>
|
|
1664
|
-
|
|
1665
|
-
const SuspenseListContext = createContext();
|
|
1515
|
+
const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1516
|
+
const SuspenseListContext = /* #__PURE__ */createContext();
|
|
1666
1517
|
function SuspenseList(props) {
|
|
1667
1518
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
1668
1519
|
inFallback: false
|
|
@@ -1673,51 +1524,51 @@ function SuspenseList(props) {
|
|
|
1673
1524
|
if (listContext) {
|
|
1674
1525
|
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1675
1526
|
}
|
|
1676
|
-
const resolved = createMemo(
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1527
|
+
const resolved = createMemo(prev => {
|
|
1528
|
+
const reveal = props.revealOrder,
|
|
1529
|
+
tail = props.tail,
|
|
1530
|
+
{
|
|
1531
|
+
showContent = true,
|
|
1532
|
+
showFallback = true
|
|
1533
|
+
} = show ? show() : {},
|
|
1534
|
+
reg = registry(),
|
|
1535
|
+
reverse = reveal === "backwards";
|
|
1536
|
+
if (reveal === "together") {
|
|
1537
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1538
|
+
const res = reg.map(() => ({
|
|
1539
|
+
showContent: all && showContent,
|
|
1540
|
+
showFallback
|
|
1541
|
+
}));
|
|
1542
|
+
res.inFallback = !all;
|
|
1543
|
+
return res;
|
|
1544
|
+
}
|
|
1545
|
+
let stop = false;
|
|
1546
|
+
let inFallback = prev.inFallback;
|
|
1547
|
+
const res = [];
|
|
1548
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1549
|
+
const n = reverse ? len - i - 1 : i,
|
|
1550
|
+
s = reg[n]();
|
|
1551
|
+
if (!stop && !s) {
|
|
1552
|
+
res[n] = {
|
|
1553
|
+
showContent,
|
|
1687
1554
|
showFallback
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
s = reg[n]();
|
|
1698
|
-
if (!stop && !s) {
|
|
1699
|
-
res[n] = {
|
|
1700
|
-
showContent,
|
|
1701
|
-
showFallback
|
|
1702
|
-
};
|
|
1703
|
-
} else {
|
|
1704
|
-
const next = !stop;
|
|
1705
|
-
if (next) inFallback = true;
|
|
1706
|
-
res[n] = {
|
|
1707
|
-
showContent: next,
|
|
1708
|
-
showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
|
|
1709
|
-
};
|
|
1710
|
-
stop = true;
|
|
1711
|
-
}
|
|
1555
|
+
};
|
|
1556
|
+
} else {
|
|
1557
|
+
const next = !stop;
|
|
1558
|
+
if (next) inFallback = true;
|
|
1559
|
+
res[n] = {
|
|
1560
|
+
showContent: next,
|
|
1561
|
+
showFallback: !tail || next && tail === "collapsed" ? showFallback : false
|
|
1562
|
+
};
|
|
1563
|
+
stop = true;
|
|
1712
1564
|
}
|
|
1713
|
-
if (!stop) inFallback = false;
|
|
1714
|
-
res.inFallback = inFallback;
|
|
1715
|
-
return res;
|
|
1716
|
-
},
|
|
1717
|
-
{
|
|
1718
|
-
inFallback: false
|
|
1719
1565
|
}
|
|
1720
|
-
|
|
1566
|
+
if (!stop) inFallback = false;
|
|
1567
|
+
res.inFallback = inFallback;
|
|
1568
|
+
return res;
|
|
1569
|
+
}, {
|
|
1570
|
+
inFallback: false
|
|
1571
|
+
});
|
|
1721
1572
|
setWrapper(() => resolved);
|
|
1722
1573
|
return createComponent(SuspenseListContext.Provider, {
|
|
1723
1574
|
value: {
|
|
@@ -1759,30 +1610,26 @@ function Suspense(props) {
|
|
|
1759
1610
|
},
|
|
1760
1611
|
owner = getOwner();
|
|
1761
1612
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1762
|
-
const key = sharedConfig.
|
|
1613
|
+
const key = sharedConfig.getContextId();
|
|
1763
1614
|
let ref = sharedConfig.load(key);
|
|
1764
1615
|
if (ref) {
|
|
1765
|
-
if (typeof ref !== "object" || ref.status !== "success") p = ref;
|
|
1766
|
-
else sharedConfig.gather(key);
|
|
1616
|
+
if (typeof ref !== "object" || ref.status !== "success") p = ref;else sharedConfig.gather(key);
|
|
1767
1617
|
}
|
|
1768
1618
|
if (p && p !== "$$f") {
|
|
1769
1619
|
const [s, set] = createSignal(undefined, {
|
|
1770
1620
|
equals: false
|
|
1771
1621
|
});
|
|
1772
1622
|
flicker = s;
|
|
1773
|
-
p.then(
|
|
1774
|
-
()
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
set();
|
|
1784
|
-
}
|
|
1785
|
-
);
|
|
1623
|
+
p.then(() => {
|
|
1624
|
+
if (sharedConfig.done) return set();
|
|
1625
|
+
sharedConfig.gather(key);
|
|
1626
|
+
setHydrateContext(ctx);
|
|
1627
|
+
set();
|
|
1628
|
+
setHydrateContext();
|
|
1629
|
+
}, err => {
|
|
1630
|
+
error = err;
|
|
1631
|
+
set();
|
|
1632
|
+
});
|
|
1786
1633
|
}
|
|
1787
1634
|
}
|
|
1788
1635
|
const listContext = useContext(SuspenseListContext);
|
|
@@ -1797,14 +1644,17 @@ function Suspense(props) {
|
|
|
1797
1644
|
ctx = sharedConfig.context;
|
|
1798
1645
|
if (flicker) {
|
|
1799
1646
|
flicker();
|
|
1800
|
-
return
|
|
1647
|
+
return flicker = undefined;
|
|
1801
1648
|
}
|
|
1802
1649
|
if (ctx && p === "$$f") setHydrateContext();
|
|
1803
1650
|
const rendered = createMemo(() => props.children);
|
|
1804
1651
|
return createMemo(prev => {
|
|
1805
1652
|
const inFallback = store.inFallback(),
|
|
1806
|
-
{
|
|
1807
|
-
|
|
1653
|
+
{
|
|
1654
|
+
showContent = true,
|
|
1655
|
+
showFallback = true
|
|
1656
|
+
} = show ? show() : {};
|
|
1657
|
+
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1808
1658
|
store.resolved = true;
|
|
1809
1659
|
dispose && dispose();
|
|
1810
1660
|
dispose = ctx = p = undefined;
|
|
@@ -1817,7 +1667,7 @@ function Suspense(props) {
|
|
|
1817
1667
|
dispose = disposer;
|
|
1818
1668
|
if (ctx) {
|
|
1819
1669
|
setHydrateContext({
|
|
1820
|
-
id: ctx.id + "
|
|
1670
|
+
id: ctx.id + "F",
|
|
1821
1671
|
count: 0
|
|
1822
1672
|
});
|
|
1823
1673
|
ctx = undefined;
|
|
@@ -1832,59 +1682,4 @@ function Suspense(props) {
|
|
|
1832
1682
|
|
|
1833
1683
|
const DEV = undefined;
|
|
1834
1684
|
|
|
1835
|
-
export {
|
|
1836
|
-
$DEVCOMP,
|
|
1837
|
-
$PROXY,
|
|
1838
|
-
$TRACK,
|
|
1839
|
-
DEV,
|
|
1840
|
-
ErrorBoundary,
|
|
1841
|
-
For,
|
|
1842
|
-
Index,
|
|
1843
|
-
Match,
|
|
1844
|
-
Show,
|
|
1845
|
-
Suspense,
|
|
1846
|
-
SuspenseList,
|
|
1847
|
-
Switch,
|
|
1848
|
-
batch,
|
|
1849
|
-
cancelCallback,
|
|
1850
|
-
catchError,
|
|
1851
|
-
children,
|
|
1852
|
-
createComponent,
|
|
1853
|
-
createComputed,
|
|
1854
|
-
createContext,
|
|
1855
|
-
createDeferred,
|
|
1856
|
-
createEffect,
|
|
1857
|
-
createMemo,
|
|
1858
|
-
createReaction,
|
|
1859
|
-
createRenderEffect,
|
|
1860
|
-
createResource,
|
|
1861
|
-
createRoot,
|
|
1862
|
-
createSelector,
|
|
1863
|
-
createSignal,
|
|
1864
|
-
createUniqueId,
|
|
1865
|
-
enableExternalSource,
|
|
1866
|
-
enableHydration,
|
|
1867
|
-
enableScheduling,
|
|
1868
|
-
equalFn,
|
|
1869
|
-
from,
|
|
1870
|
-
getListener,
|
|
1871
|
-
getOwner,
|
|
1872
|
-
indexArray,
|
|
1873
|
-
lazy,
|
|
1874
|
-
mapArray,
|
|
1875
|
-
mergeProps,
|
|
1876
|
-
observable,
|
|
1877
|
-
on,
|
|
1878
|
-
onCleanup,
|
|
1879
|
-
onError,
|
|
1880
|
-
onMount,
|
|
1881
|
-
requestCallback,
|
|
1882
|
-
resetErrorBoundaries,
|
|
1883
|
-
runWithOwner,
|
|
1884
|
-
sharedConfig,
|
|
1885
|
-
splitProps,
|
|
1886
|
-
startTransition,
|
|
1887
|
-
untrack,
|
|
1888
|
-
useContext,
|
|
1889
|
-
useTransition
|
|
1890
|
-
};
|
|
1685
|
+
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 };
|