solid-js 1.8.3 → 1.8.5
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 +2 -2
- package/dist/dev.js +299 -534
- package/dist/server.js +75 -170
- package/dist/solid.cjs +2 -2
- package/dist/solid.js +257 -461
- 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 +33 -45
- package/package.json +7 -3
- 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 -228
- 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 +13 -13
- package/types/server/index.d.ts +2 -57
- package/types/server/reactive.d.ts +42 -73
- package/types/server/rendering.d.ts +95 -166
- 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 +3 -0
- package/web/dist/dev.js +82 -617
- package/web/dist/server.cjs +17 -5
- package/web/dist/server.js +105 -178
- package/web/dist/storage.cjs +12 -0
- package/web/dist/storage.js +10 -0
- package/web/dist/web.cjs +3 -0
- package/web/dist/web.js +81 -611
- package/web/types/client.d.ts +7 -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/web/types/server.d.ts +10 -1
- package/web/types/storage.d.ts +2 -0
package/dist/dev.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
|
}
|
|
@@ -161,31 +159,26 @@ const DevHooks = {
|
|
|
161
159
|
afterUpdate: null,
|
|
162
160
|
afterCreateOwner: null
|
|
163
161
|
};
|
|
164
|
-
const [transPending, setTransPending] = /*@__PURE__*/
|
|
162
|
+
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
165
163
|
function createRoot(fn, detachedOwner) {
|
|
166
164
|
const listener = Listener,
|
|
167
165
|
owner = Owner,
|
|
168
166
|
unowned = fn.length === 0,
|
|
169
167
|
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
170
|
-
root = unowned
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
? () =>
|
|
185
|
-
fn(() => {
|
|
186
|
-
throw new Error("Dispose method must be an explicit argument to createRoot function");
|
|
187
|
-
})
|
|
188
|
-
: () => fn(() => untrack(() => cleanNode(root)));
|
|
168
|
+
root = unowned ? {
|
|
169
|
+
owned: null,
|
|
170
|
+
cleanups: null,
|
|
171
|
+
context: null,
|
|
172
|
+
owner: null
|
|
173
|
+
} : {
|
|
174
|
+
owned: null,
|
|
175
|
+
cleanups: null,
|
|
176
|
+
context: current ? current.context : null,
|
|
177
|
+
owner: current
|
|
178
|
+
},
|
|
179
|
+
updateFn = unowned ? () => fn(() => {
|
|
180
|
+
throw new Error("Dispose method must be an explicit argument to createRoot function");
|
|
181
|
+
}) : () => fn(() => untrack(() => cleanNode(root)));
|
|
189
182
|
DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(root);
|
|
190
183
|
Owner = root;
|
|
191
184
|
Listener = null;
|
|
@@ -210,26 +203,23 @@ function createSignal(value, options) {
|
|
|
210
203
|
}
|
|
211
204
|
const setter = value => {
|
|
212
205
|
if (typeof value === "function") {
|
|
213
|
-
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
214
|
-
else value = value(s.value);
|
|
206
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
|
|
215
207
|
}
|
|
216
208
|
return writeSignal(s, value);
|
|
217
209
|
};
|
|
218
210
|
return [readSignal.bind(s), setter];
|
|
219
211
|
}
|
|
220
212
|
function createComputed(fn, value, options) {
|
|
221
|
-
const c = createComputation(fn, value, true, STALE, options);
|
|
222
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
223
|
-
else updateComputation(c);
|
|
213
|
+
const c = createComputation(fn, value, true, STALE, options );
|
|
214
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
224
215
|
}
|
|
225
216
|
function createRenderEffect(fn, value, options) {
|
|
226
|
-
const c = createComputation(fn, value, false, STALE, options);
|
|
227
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
228
|
-
else updateComputation(c);
|
|
217
|
+
const c = createComputation(fn, value, false, STALE, options );
|
|
218
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
229
219
|
}
|
|
230
220
|
function createEffect(fn, value, options) {
|
|
231
221
|
runEffects = runUserEffects;
|
|
232
|
-
const c = createComputation(fn, value, false, STALE, options),
|
|
222
|
+
const c = createComputation(fn, value, false, STALE, options ),
|
|
233
223
|
s = SuspenseContext && useContext(SuspenseContext);
|
|
234
224
|
if (s) c.suspense = s;
|
|
235
225
|
if (!options || !options.render) c.user = true;
|
|
@@ -237,16 +227,10 @@ function createEffect(fn, value, options) {
|
|
|
237
227
|
}
|
|
238
228
|
function createReaction(onInvalidate, options) {
|
|
239
229
|
let fn;
|
|
240
|
-
const c = createComputation(
|
|
241
|
-
()
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
},
|
|
245
|
-
undefined,
|
|
246
|
-
false,
|
|
247
|
-
0,
|
|
248
|
-
options
|
|
249
|
-
),
|
|
230
|
+
const c = createComputation(() => {
|
|
231
|
+
fn ? fn() : untrack(onInvalidate);
|
|
232
|
+
fn = undefined;
|
|
233
|
+
}, undefined, false, 0, options ),
|
|
250
234
|
s = SuspenseContext && useContext(SuspenseContext);
|
|
251
235
|
if (s) c.suspense = s;
|
|
252
236
|
c.user = true;
|
|
@@ -257,7 +241,7 @@ function createReaction(onInvalidate, options) {
|
|
|
257
241
|
}
|
|
258
242
|
function createMemo(fn, value, options) {
|
|
259
243
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
260
|
-
const c = createComputation(fn, value, true, 0, options);
|
|
244
|
+
const c = createComputation(fn, value, true, 0, options );
|
|
261
245
|
c.observers = null;
|
|
262
246
|
c.observerSlots = null;
|
|
263
247
|
c.comparator = options.equals || undefined;
|
|
@@ -274,7 +258,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
274
258
|
let source;
|
|
275
259
|
let fetcher;
|
|
276
260
|
let options;
|
|
277
|
-
if (
|
|
261
|
+
if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
|
|
278
262
|
source = true;
|
|
279
263
|
fetcher = pSource;
|
|
280
264
|
options = pFetcher || {};
|
|
@@ -288,7 +272,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
288
272
|
id = null,
|
|
289
273
|
loadedUnderTransition = false,
|
|
290
274
|
scheduled = false,
|
|
291
|
-
resolved = "initialValue" in options,
|
|
275
|
+
resolved = ("initialValue" in options),
|
|
292
276
|
dynamic = typeof source === "function" && createMemo(source);
|
|
293
277
|
const contexts = new Set(),
|
|
294
278
|
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
@@ -300,19 +284,15 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
300
284
|
if (sharedConfig.context) {
|
|
301
285
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
302
286
|
let v;
|
|
303
|
-
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
304
|
-
else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
|
|
287
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
|
|
305
288
|
}
|
|
306
289
|
function loadEnd(p, v, error, key) {
|
|
307
290
|
if (pr === p) {
|
|
308
291
|
pr = null;
|
|
309
292
|
key !== undefined && (resolved = true);
|
|
310
|
-
if ((p === initP || v === initP) && options.onHydrated)
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
value: v
|
|
314
|
-
})
|
|
315
|
-
);
|
|
293
|
+
if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
|
|
294
|
+
value: v
|
|
295
|
+
}));
|
|
316
296
|
initP = NO_INIT;
|
|
317
297
|
if (Transition && p && loadedUnderTransition) {
|
|
318
298
|
Transition.promises.delete(p);
|
|
@@ -343,8 +323,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
343
323
|
createComputed(() => {
|
|
344
324
|
track();
|
|
345
325
|
if (pr) {
|
|
346
|
-
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
347
|
-
else if (!contexts.has(c)) {
|
|
326
|
+
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
|
|
348
327
|
c.increment();
|
|
349
328
|
contexts.add(c);
|
|
350
329
|
}
|
|
@@ -363,35 +342,26 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
363
342
|
return;
|
|
364
343
|
}
|
|
365
344
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
366
|
-
const p =
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
fetcher(lookup, {
|
|
371
|
-
value: value(),
|
|
372
|
-
refetching
|
|
373
|
-
})
|
|
374
|
-
);
|
|
345
|
+
const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
|
|
346
|
+
value: value(),
|
|
347
|
+
refetching
|
|
348
|
+
}));
|
|
375
349
|
if (!isPromise(p)) {
|
|
376
350
|
loadEnd(pr, p, undefined, lookup);
|
|
377
351
|
return p;
|
|
378
352
|
}
|
|
353
|
+
pr = p;
|
|
379
354
|
if ("value" in p) {
|
|
380
|
-
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
|
|
381
|
-
else loadEnd(pr, undefined, undefined, lookup);
|
|
355
|
+
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, undefined, lookup);
|
|
382
356
|
return p;
|
|
383
357
|
}
|
|
384
|
-
pr = p;
|
|
385
358
|
scheduled = true;
|
|
386
|
-
queueMicrotask(() =>
|
|
359
|
+
queueMicrotask(() => scheduled = false);
|
|
387
360
|
runUpdates(() => {
|
|
388
361
|
setState(resolved ? "refreshing" : "pending");
|
|
389
362
|
trigger();
|
|
390
363
|
}, false);
|
|
391
|
-
return p.then(
|
|
392
|
-
v => loadEnd(p, v, undefined, lookup),
|
|
393
|
-
e => loadEnd(p, undefined, castError(e), lookup)
|
|
394
|
-
);
|
|
364
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
|
|
395
365
|
}
|
|
396
366
|
Object.defineProperties(read, {
|
|
397
367
|
state: {
|
|
@@ -415,81 +385,50 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
415
385
|
}
|
|
416
386
|
}
|
|
417
387
|
});
|
|
418
|
-
if (dynamic) createComputed(() => load(false));
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
refetch: load,
|
|
424
|
-
mutate: setValue
|
|
425
|
-
}
|
|
426
|
-
];
|
|
388
|
+
if (dynamic) createComputed(() => load(false));else load(false);
|
|
389
|
+
return [read, {
|
|
390
|
+
refetch: load,
|
|
391
|
+
mutate: setValue
|
|
392
|
+
}];
|
|
427
393
|
}
|
|
428
394
|
function createDeferred(source, options) {
|
|
429
395
|
let t,
|
|
430
396
|
timeout = options ? options.timeoutMs : undefined;
|
|
431
|
-
const node = createComputation(
|
|
432
|
-
() => {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
timeout
|
|
439
|
-
}
|
|
440
|
-
: undefined
|
|
441
|
-
);
|
|
442
|
-
return source();
|
|
443
|
-
},
|
|
444
|
-
undefined,
|
|
445
|
-
true
|
|
446
|
-
);
|
|
447
|
-
const [deferred, setDeferred] = createSignal(
|
|
448
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
449
|
-
options
|
|
450
|
-
);
|
|
397
|
+
const node = createComputation(() => {
|
|
398
|
+
if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
|
|
399
|
+
timeout
|
|
400
|
+
} : undefined);
|
|
401
|
+
return source();
|
|
402
|
+
}, undefined, true);
|
|
403
|
+
const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);
|
|
451
404
|
updateComputation(node);
|
|
452
|
-
setDeferred(() =>
|
|
453
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
454
|
-
);
|
|
405
|
+
setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
455
406
|
return deferred;
|
|
456
407
|
}
|
|
457
408
|
function createSelector(source, fn = equalFn, options) {
|
|
458
409
|
const subs = new Map();
|
|
459
|
-
const node = createComputation(
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
for (const
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
470
|
-
return v;
|
|
471
|
-
},
|
|
472
|
-
undefined,
|
|
473
|
-
true,
|
|
474
|
-
STALE,
|
|
475
|
-
options
|
|
476
|
-
);
|
|
410
|
+
const node = createComputation(p => {
|
|
411
|
+
const v = source();
|
|
412
|
+
for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
|
|
413
|
+
for (const c of val.values()) {
|
|
414
|
+
c.state = STALE;
|
|
415
|
+
if (c.pure) Updates.push(c);else Effects.push(c);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return v;
|
|
419
|
+
}, undefined, true, STALE, options );
|
|
477
420
|
updateComputation(node);
|
|
478
421
|
return key => {
|
|
479
422
|
const listener = Listener;
|
|
480
423
|
if (listener) {
|
|
481
424
|
let l;
|
|
482
|
-
if (
|
|
483
|
-
else subs.set(key, (l = new Set([listener])));
|
|
425
|
+
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
484
426
|
onCleanup(() => {
|
|
485
427
|
l.delete(listener);
|
|
486
428
|
!l.size && subs.delete(key);
|
|
487
429
|
});
|
|
488
430
|
}
|
|
489
|
-
return fn(
|
|
490
|
-
key,
|
|
491
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
492
|
-
);
|
|
431
|
+
return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
493
432
|
};
|
|
494
433
|
}
|
|
495
434
|
function batch(fn) {
|
|
@@ -528,10 +467,7 @@ function onMount(fn) {
|
|
|
528
467
|
createEffect(() => untrack(fn));
|
|
529
468
|
}
|
|
530
469
|
function onCleanup(fn) {
|
|
531
|
-
if (Owner === null)
|
|
532
|
-
console.warn("cleanups created outside a `createRoot` or `render` will never be run");
|
|
533
|
-
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
534
|
-
else Owner.cleanups.push(fn);
|
|
470
|
+
if (Owner === null) console.warn("cleanups created outside a `createRoot` or `render` will never be run");else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
|
|
535
471
|
return fn;
|
|
536
472
|
}
|
|
537
473
|
function catchError(fn, handler) {
|
|
@@ -585,17 +521,15 @@ function startTransition(fn) {
|
|
|
585
521
|
Owner = o;
|
|
586
522
|
let t;
|
|
587
523
|
if (Scheduler || SuspenseContext) {
|
|
588
|
-
t =
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
});
|
|
598
|
-
t.done || (t.done = new Promise(res => (t.resolve = res)));
|
|
524
|
+
t = Transition || (Transition = {
|
|
525
|
+
sources: new Set(),
|
|
526
|
+
effects: [],
|
|
527
|
+
promises: new Set(),
|
|
528
|
+
disposed: new Set(),
|
|
529
|
+
queue: new Set(),
|
|
530
|
+
running: true
|
|
531
|
+
});
|
|
532
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
599
533
|
t.running = true;
|
|
600
534
|
}
|
|
601
535
|
runUpdates(fn, false);
|
|
@@ -611,18 +545,12 @@ function resumeEffects(e) {
|
|
|
611
545
|
e.length = 0;
|
|
612
546
|
}
|
|
613
547
|
function devComponent(Comp, props) {
|
|
614
|
-
const c = createComputation(
|
|
615
|
-
(
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
return Comp(props);
|
|
621
|
-
}),
|
|
622
|
-
undefined,
|
|
623
|
-
true,
|
|
624
|
-
0
|
|
625
|
-
);
|
|
548
|
+
const c = createComputation(() => untrack(() => {
|
|
549
|
+
Object.assign(Comp, {
|
|
550
|
+
[$DEVCOMP]: true
|
|
551
|
+
});
|
|
552
|
+
return Comp(props);
|
|
553
|
+
}), undefined, true, 0);
|
|
626
554
|
c.props = props;
|
|
627
555
|
c.observers = null;
|
|
628
556
|
c.observerSlots = null;
|
|
@@ -633,8 +561,7 @@ function devComponent(Comp, props) {
|
|
|
633
561
|
}
|
|
634
562
|
function registerGraph(value) {
|
|
635
563
|
if (!Owner) return;
|
|
636
|
-
if (Owner.sourceMap) Owner.sourceMap.push(value);
|
|
637
|
-
else Owner.sourceMap = [value];
|
|
564
|
+
if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
|
|
638
565
|
value.graph = Owner;
|
|
639
566
|
}
|
|
640
567
|
function createContext(defaultValue, options) {
|
|
@@ -646,15 +573,13 @@ function createContext(defaultValue, options) {
|
|
|
646
573
|
};
|
|
647
574
|
}
|
|
648
575
|
function useContext(context) {
|
|
649
|
-
return Owner && Owner.context && Owner.context[context.id] !== undefined
|
|
650
|
-
? Owner.context[context.id]
|
|
651
|
-
: context.defaultValue;
|
|
576
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
|
|
652
577
|
}
|
|
653
578
|
function children(fn) {
|
|
654
579
|
const children = createMemo(fn);
|
|
655
580
|
const memo = createMemo(() => resolveChildren(children()), undefined, {
|
|
656
581
|
name: "children"
|
|
657
|
-
});
|
|
582
|
+
}) ;
|
|
658
583
|
memo.toArray = () => {
|
|
659
584
|
const c = memo();
|
|
660
585
|
return Array.isArray(c) ? c : c != null ? [c] : [];
|
|
@@ -686,8 +611,7 @@ function enableExternalSource(factory) {
|
|
|
686
611
|
function readSignal() {
|
|
687
612
|
const runningTransition = Transition && Transition.running;
|
|
688
613
|
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
689
|
-
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
690
|
-
else {
|
|
614
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
|
|
691
615
|
const updates = Updates;
|
|
692
616
|
Updates = null;
|
|
693
617
|
runUpdates(() => lookUpstream(this), false);
|
|
@@ -715,12 +639,11 @@ function readSignal() {
|
|
|
715
639
|
return this.value;
|
|
716
640
|
}
|
|
717
641
|
function writeSignal(node, value, isComp) {
|
|
718
|
-
let current =
|
|
719
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
642
|
+
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
720
643
|
if (!node.comparator || !node.comparator(current, value)) {
|
|
721
644
|
if (Transition) {
|
|
722
645
|
const TransitionRunning = Transition.running;
|
|
723
|
-
if (TransitionRunning ||
|
|
646
|
+
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
724
647
|
Transition.sources.add(node);
|
|
725
648
|
node.tValue = value;
|
|
726
649
|
}
|
|
@@ -733,12 +656,10 @@ function writeSignal(node, value, isComp) {
|
|
|
733
656
|
const TransitionRunning = Transition && Transition.running;
|
|
734
657
|
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
735
658
|
if (TransitionRunning ? !o.tState : !o.state) {
|
|
736
|
-
if (o.pure) Updates.push(o);
|
|
737
|
-
else Effects.push(o);
|
|
659
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
738
660
|
if (o.observers) markDownstream(o);
|
|
739
661
|
}
|
|
740
|
-
if (!TransitionRunning) o.state = STALE;
|
|
741
|
-
else o.tState = STALE;
|
|
662
|
+
if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
|
|
742
663
|
}
|
|
743
664
|
if (Updates.length > 10e5) {
|
|
744
665
|
Updates = [];
|
|
@@ -757,11 +678,7 @@ function updateComputation(node) {
|
|
|
757
678
|
listener = Listener,
|
|
758
679
|
time = ExecCount;
|
|
759
680
|
Listener = Owner = node;
|
|
760
|
-
runComputation(
|
|
761
|
-
node,
|
|
762
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
763
|
-
time
|
|
764
|
-
);
|
|
681
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
765
682
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
766
683
|
queueMicrotask(() => {
|
|
767
684
|
runUpdates(() => {
|
|
@@ -822,15 +739,11 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
822
739
|
c.state = 0;
|
|
823
740
|
c.tState = state;
|
|
824
741
|
}
|
|
825
|
-
if (Owner === null)
|
|
826
|
-
console.warn("computations created outside a `createRoot` or `render` will never be disposed");
|
|
827
|
-
else if (Owner !== UNOWNED) {
|
|
742
|
+
if (Owner === null) console.warn("computations created outside a `createRoot` or `render` will never be disposed");else if (Owner !== UNOWNED) {
|
|
828
743
|
if (Transition && Transition.running && Owner.pure) {
|
|
829
|
-
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
830
|
-
else Owner.tOwned.push(c);
|
|
744
|
+
if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
|
|
831
745
|
} else {
|
|
832
|
-
if (!Owner.owned) Owner.owned = [c];
|
|
833
|
-
else Owner.owned.push(c);
|
|
746
|
+
if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
|
|
834
747
|
}
|
|
835
748
|
}
|
|
836
749
|
if (options && options.name) c.name = options.name;
|
|
@@ -883,8 +796,7 @@ function runUpdates(fn, init) {
|
|
|
883
796
|
if (Updates) return fn();
|
|
884
797
|
let wait = false;
|
|
885
798
|
if (!init) Updates = [];
|
|
886
|
-
if (Effects) wait = true;
|
|
887
|
-
else Effects = [];
|
|
799
|
+
if (Effects) wait = true;else Effects = [];
|
|
888
800
|
ExecCount++;
|
|
889
801
|
try {
|
|
890
802
|
const res = fn();
|
|
@@ -898,8 +810,7 @@ function runUpdates(fn, init) {
|
|
|
898
810
|
}
|
|
899
811
|
function completeUpdates(wait) {
|
|
900
812
|
if (Updates) {
|
|
901
|
-
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
902
|
-
else runQueue(Updates);
|
|
813
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
|
|
903
814
|
Updates = null;
|
|
904
815
|
}
|
|
905
816
|
if (wait) return;
|
|
@@ -939,8 +850,7 @@ function completeUpdates(wait) {
|
|
|
939
850
|
}
|
|
940
851
|
const e = Effects;
|
|
941
852
|
Effects = null;
|
|
942
|
-
if (e.length) runUpdates(() => runEffects(e), false);
|
|
943
|
-
else DevHooks.afterUpdate && DevHooks.afterUpdate();
|
|
853
|
+
if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
|
|
944
854
|
if (res) res();
|
|
945
855
|
}
|
|
946
856
|
function runQueue(queue) {
|
|
@@ -968,8 +878,7 @@ function runUserEffects(queue) {
|
|
|
968
878
|
userLength = 0;
|
|
969
879
|
for (i = 0; i < queue.length; i++) {
|
|
970
880
|
const e = queue[i];
|
|
971
|
-
if (!e.user) runTop(e);
|
|
972
|
-
else queue[userLength++] = e;
|
|
881
|
+
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
973
882
|
}
|
|
974
883
|
if (sharedConfig.context) {
|
|
975
884
|
if (sharedConfig.count) {
|
|
@@ -987,15 +896,13 @@ function runUserEffects(queue) {
|
|
|
987
896
|
}
|
|
988
897
|
function lookUpstream(node, ignore) {
|
|
989
898
|
const runningTransition = Transition && Transition.running;
|
|
990
|
-
if (runningTransition) node.tState = 0;
|
|
991
|
-
else node.state = 0;
|
|
899
|
+
if (runningTransition) node.tState = 0;else node.state = 0;
|
|
992
900
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
993
901
|
const source = node.sources[i];
|
|
994
902
|
if (source.sources) {
|
|
995
903
|
const state = runningTransition ? source.tState : source.state;
|
|
996
904
|
if (state === STALE) {
|
|
997
|
-
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
998
|
-
runTop(source);
|
|
905
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
|
|
999
906
|
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
1000
907
|
}
|
|
1001
908
|
}
|
|
@@ -1005,10 +912,8 @@ function markDownstream(node) {
|
|
|
1005
912
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
1006
913
|
const o = node.observers[i];
|
|
1007
914
|
if (runningTransition ? !o.tState : !o.state) {
|
|
1008
|
-
if (runningTransition) o.tState = PENDING;
|
|
1009
|
-
|
|
1010
|
-
if (o.pure) Updates.push(o);
|
|
1011
|
-
else Effects.push(o);
|
|
915
|
+
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
916
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
1012
917
|
o.observers && markDownstream(o);
|
|
1013
918
|
}
|
|
1014
919
|
}
|
|
@@ -1045,8 +950,7 @@ function cleanNode(node) {
|
|
|
1045
950
|
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
1046
951
|
node.cleanups = null;
|
|
1047
952
|
}
|
|
1048
|
-
if (Transition && Transition.running) node.tState = 0;
|
|
1049
|
-
else node.state = 0;
|
|
953
|
+
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
1050
954
|
delete node.sourceMap;
|
|
1051
955
|
}
|
|
1052
956
|
function reset(node, top) {
|
|
@@ -1068,21 +972,19 @@ function runErrors(err, fns, owner) {
|
|
|
1068
972
|
try {
|
|
1069
973
|
for (const f of fns) f(err);
|
|
1070
974
|
} catch (e) {
|
|
1071
|
-
handleError(e,
|
|
975
|
+
handleError(e, owner && owner.owner || null);
|
|
1072
976
|
}
|
|
1073
977
|
}
|
|
1074
978
|
function handleError(err, owner = Owner) {
|
|
1075
979
|
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
1076
980
|
const error = castError(err);
|
|
1077
981
|
if (!fns) throw error;
|
|
1078
|
-
if (Effects)
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
});
|
|
1085
|
-
else runErrors(error, fns, owner);
|
|
982
|
+
if (Effects) Effects.push({
|
|
983
|
+
fn() {
|
|
984
|
+
runErrors(error, fns, owner);
|
|
985
|
+
},
|
|
986
|
+
state: STALE
|
|
987
|
+
});else runErrors(error, fns, owner);
|
|
1086
988
|
}
|
|
1087
989
|
function resolveChildren(children) {
|
|
1088
990
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1099,26 +1001,19 @@ function resolveChildren(children) {
|
|
|
1099
1001
|
function createProvider(id, options) {
|
|
1100
1002
|
return function provider(props) {
|
|
1101
1003
|
let res;
|
|
1102
|
-
createRenderEffect(
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
return children(() => props.children);
|
|
1110
|
-
})),
|
|
1111
|
-
undefined,
|
|
1112
|
-
options
|
|
1113
|
-
);
|
|
1004
|
+
createRenderEffect(() => res = untrack(() => {
|
|
1005
|
+
Owner.context = {
|
|
1006
|
+
...Owner.context,
|
|
1007
|
+
[id]: props.value
|
|
1008
|
+
};
|
|
1009
|
+
return children(() => props.children);
|
|
1010
|
+
}), undefined, options);
|
|
1114
1011
|
return res;
|
|
1115
1012
|
};
|
|
1116
1013
|
}
|
|
1117
1014
|
function onError(fn) {
|
|
1118
1015
|
ERROR || (ERROR = Symbol("error"));
|
|
1119
|
-
if (Owner === null)
|
|
1120
|
-
console.warn("error handlers created outside a `createRoot` or `render` will never be run");
|
|
1121
|
-
else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1016
|
+
if (Owner === null) console.warn("error handlers created outside a `createRoot` or `render` will never be run");else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1122
1017
|
Owner.context = {
|
|
1123
1018
|
...Owner.context,
|
|
1124
1019
|
[ERROR]: [fn]
|
|
@@ -1147,8 +1042,7 @@ function observable(input) {
|
|
|
1147
1042
|
if (!(observer instanceof Object) || observer == null) {
|
|
1148
1043
|
throw new TypeError("Expected the observer to be an object.");
|
|
1149
1044
|
}
|
|
1150
|
-
const handler =
|
|
1151
|
-
typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1045
|
+
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1152
1046
|
if (!handler) {
|
|
1153
1047
|
return {
|
|
1154
1048
|
unsubscribe() {}
|
|
@@ -1179,7 +1073,7 @@ function from(producer) {
|
|
|
1179
1073
|
});
|
|
1180
1074
|
if ("subscribe" in producer) {
|
|
1181
1075
|
const unsub = producer.subscribe(v => set(() => v));
|
|
1182
|
-
onCleanup(() =>
|
|
1076
|
+
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
1183
1077
|
} else {
|
|
1184
1078
|
const clean = producer(set);
|
|
1185
1079
|
onCleanup(clean);
|
|
@@ -1231,7 +1125,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1231
1125
|
});
|
|
1232
1126
|
len = 1;
|
|
1233
1127
|
}
|
|
1234
|
-
}
|
|
1128
|
+
}
|
|
1129
|
+
else if (len === 0) {
|
|
1235
1130
|
mapped = new Array(newLen);
|
|
1236
1131
|
for (j = 0; j < newLen; j++) {
|
|
1237
1132
|
items[j] = newItems[j];
|
|
@@ -1242,16 +1137,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1242
1137
|
temp = new Array(newLen);
|
|
1243
1138
|
tempdisposers = new Array(newLen);
|
|
1244
1139
|
indexes && (tempIndexes = new Array(newLen));
|
|
1245
|
-
for (
|
|
1246
|
-
|
|
1247
|
-
start < end && items[start] === newItems[start];
|
|
1248
|
-
start++
|
|
1249
|
-
);
|
|
1250
|
-
for (
|
|
1251
|
-
end = len - 1, newEnd = newLen - 1;
|
|
1252
|
-
end >= start && newEnd >= start && items[end] === newItems[newEnd];
|
|
1253
|
-
end--, newEnd--
|
|
1254
|
-
) {
|
|
1140
|
+
for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
|
|
1141
|
+
for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
|
|
1255
1142
|
temp[newEnd] = mapped[end];
|
|
1256
1143
|
tempdisposers[newEnd] = disposers[end];
|
|
1257
1144
|
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
@@ -1285,7 +1172,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1285
1172
|
}
|
|
1286
1173
|
} else mapped[j] = createRoot(mapper);
|
|
1287
1174
|
}
|
|
1288
|
-
mapped = mapped.slice(0,
|
|
1175
|
+
mapped = mapped.slice(0, len = newLen);
|
|
1289
1176
|
items = newItems.slice(0);
|
|
1290
1177
|
}
|
|
1291
1178
|
return mapped;
|
|
@@ -1295,7 +1182,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1295
1182
|
if (indexes) {
|
|
1296
1183
|
const [s, set] = createSignal(j, {
|
|
1297
1184
|
name: "index"
|
|
1298
|
-
});
|
|
1185
|
+
}) ;
|
|
1299
1186
|
indexes[j] = set;
|
|
1300
1187
|
return mapFn(newItems[j], s);
|
|
1301
1188
|
}
|
|
@@ -1353,13 +1240,13 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1353
1240
|
}
|
|
1354
1241
|
len = signals.length = disposers.length = newItems.length;
|
|
1355
1242
|
items = newItems.slice(0);
|
|
1356
|
-
return
|
|
1243
|
+
return mapped = mapped.slice(0, len);
|
|
1357
1244
|
});
|
|
1358
1245
|
function mapper(disposer) {
|
|
1359
1246
|
disposers[i] = disposer;
|
|
1360
1247
|
const [s, set] = createSignal(newItems[i], {
|
|
1361
1248
|
name: "value"
|
|
1362
|
-
});
|
|
1249
|
+
}) ;
|
|
1363
1250
|
signals[i] = set;
|
|
1364
1251
|
return mapFn(s, i);
|
|
1365
1252
|
}
|
|
@@ -1375,7 +1262,7 @@ function createComponent(Comp, props) {
|
|
|
1375
1262
|
if (sharedConfig.context) {
|
|
1376
1263
|
const c = sharedConfig.context;
|
|
1377
1264
|
setHydrateContext(nextHydrateContext());
|
|
1378
|
-
const r = devComponent(Comp, props || {});
|
|
1265
|
+
const r = devComponent(Comp, props || {}) ;
|
|
1379
1266
|
setHydrateContext(c);
|
|
1380
1267
|
return r;
|
|
1381
1268
|
}
|
|
@@ -1424,33 +1311,29 @@ function mergeProps(...sources) {
|
|
|
1424
1311
|
let proxy = false;
|
|
1425
1312
|
for (let i = 0; i < sources.length; i++) {
|
|
1426
1313
|
const s = sources[i];
|
|
1427
|
-
proxy = proxy ||
|
|
1428
|
-
sources[i] = typeof s === "function" ? (
|
|
1314
|
+
proxy = proxy || !!s && $PROXY in s;
|
|
1315
|
+
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
1429
1316
|
}
|
|
1430
1317
|
if (proxy) {
|
|
1431
|
-
return new Proxy(
|
|
1432
|
-
{
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
if (property in resolveSource(sources[i])) return true;
|
|
1442
|
-
}
|
|
1443
|
-
return false;
|
|
1444
|
-
},
|
|
1445
|
-
keys() {
|
|
1446
|
-
const keys = [];
|
|
1447
|
-
for (let i = 0; i < sources.length; i++)
|
|
1448
|
-
keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1449
|
-
return [...new Set(keys)];
|
|
1318
|
+
return new Proxy({
|
|
1319
|
+
get(property) {
|
|
1320
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1321
|
+
const v = resolveSource(sources[i])[property];
|
|
1322
|
+
if (v !== undefined) return v;
|
|
1323
|
+
}
|
|
1324
|
+
},
|
|
1325
|
+
has(property) {
|
|
1326
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1327
|
+
if (property in resolveSource(sources[i])) return true;
|
|
1450
1328
|
}
|
|
1329
|
+
return false;
|
|
1451
1330
|
},
|
|
1452
|
-
|
|
1453
|
-
|
|
1331
|
+
keys() {
|
|
1332
|
+
const keys = [];
|
|
1333
|
+
for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1334
|
+
return [...new Set(keys)];
|
|
1335
|
+
}
|
|
1336
|
+
}, propTraps);
|
|
1454
1337
|
}
|
|
1455
1338
|
const target = {};
|
|
1456
1339
|
const sourcesMap = {};
|
|
@@ -1469,7 +1352,7 @@ function mergeProps(...sources) {
|
|
|
1469
1352
|
Object.defineProperty(target, key, {
|
|
1470
1353
|
enumerable: true,
|
|
1471
1354
|
configurable: true,
|
|
1472
|
-
get: resolveSources.bind(
|
|
1355
|
+
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
1473
1356
|
});
|
|
1474
1357
|
} else {
|
|
1475
1358
|
if (desc.value !== undefined) defined.add(key);
|
|
@@ -1493,60 +1376,47 @@ function splitProps(props, ...keys) {
|
|
|
1493
1376
|
if ($PROXY in props) {
|
|
1494
1377
|
const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
|
|
1495
1378
|
const res = keys.map(k => {
|
|
1496
|
-
return new Proxy(
|
|
1497
|
-
{
|
|
1498
|
-
|
|
1499
|
-
return k.includes(property) ? props[property] : undefined;
|
|
1500
|
-
},
|
|
1501
|
-
has(property) {
|
|
1502
|
-
return k.includes(property) && property in props;
|
|
1503
|
-
},
|
|
1504
|
-
keys() {
|
|
1505
|
-
return k.filter(property => property in props);
|
|
1506
|
-
}
|
|
1379
|
+
return new Proxy({
|
|
1380
|
+
get(property) {
|
|
1381
|
+
return k.includes(property) ? props[property] : undefined;
|
|
1507
1382
|
},
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
});
|
|
1511
|
-
res.push(
|
|
1512
|
-
new Proxy(
|
|
1513
|
-
{
|
|
1514
|
-
get(property) {
|
|
1515
|
-
return blocked.has(property) ? undefined : props[property];
|
|
1516
|
-
},
|
|
1517
|
-
has(property) {
|
|
1518
|
-
return blocked.has(property) ? false : property in props;
|
|
1519
|
-
},
|
|
1520
|
-
keys() {
|
|
1521
|
-
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1522
|
-
}
|
|
1383
|
+
has(property) {
|
|
1384
|
+
return k.includes(property) && property in props;
|
|
1523
1385
|
},
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1386
|
+
keys() {
|
|
1387
|
+
return k.filter(property => property in props);
|
|
1388
|
+
}
|
|
1389
|
+
}, propTraps);
|
|
1390
|
+
});
|
|
1391
|
+
res.push(new Proxy({
|
|
1392
|
+
get(property) {
|
|
1393
|
+
return blocked.has(property) ? undefined : props[property];
|
|
1394
|
+
},
|
|
1395
|
+
has(property) {
|
|
1396
|
+
return blocked.has(property) ? false : property in props;
|
|
1397
|
+
},
|
|
1398
|
+
keys() {
|
|
1399
|
+
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1400
|
+
}
|
|
1401
|
+
}, propTraps));
|
|
1527
1402
|
return res;
|
|
1528
1403
|
}
|
|
1529
1404
|
const otherObject = {};
|
|
1530
1405
|
const objects = keys.map(() => ({}));
|
|
1531
1406
|
for (const propName of Object.getOwnPropertyNames(props)) {
|
|
1532
1407
|
const desc = Object.getOwnPropertyDescriptor(props, propName);
|
|
1533
|
-
const isDefaultDesc =
|
|
1534
|
-
!desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1408
|
+
const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1535
1409
|
let blocked = false;
|
|
1536
1410
|
let objectIndex = 0;
|
|
1537
1411
|
for (const k of keys) {
|
|
1538
1412
|
if (k.includes(propName)) {
|
|
1539
1413
|
blocked = true;
|
|
1540
|
-
isDefaultDesc
|
|
1541
|
-
? (objects[objectIndex][propName] = desc.value)
|
|
1542
|
-
: Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1414
|
+
isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1543
1415
|
}
|
|
1544
1416
|
++objectIndex;
|
|
1545
1417
|
}
|
|
1546
1418
|
if (!blocked) {
|
|
1547
|
-
isDefaultDesc
|
|
1548
|
-
? (otherObject[propName] = desc.value)
|
|
1549
|
-
: Object.defineProperty(otherObject, propName, desc);
|
|
1419
|
+
isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
|
|
1550
1420
|
}
|
|
1551
1421
|
}
|
|
1552
1422
|
return [...objects, otherObject];
|
|
@@ -1572,24 +1442,19 @@ function lazy(fn) {
|
|
|
1572
1442
|
comp = s;
|
|
1573
1443
|
}
|
|
1574
1444
|
let Comp;
|
|
1575
|
-
return createMemo(
|
|
1576
|
-
()
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
const r = Comp(props);
|
|
1587
|
-
setHydrateContext(c);
|
|
1588
|
-
return r;
|
|
1589
|
-
})
|
|
1590
|
-
);
|
|
1445
|
+
return createMemo(() => (Comp = comp()) && untrack(() => {
|
|
1446
|
+
if (true) Object.assign(Comp, {
|
|
1447
|
+
[$DEVCOMP]: true
|
|
1448
|
+
});
|
|
1449
|
+
if (!ctx) return Comp(props);
|
|
1450
|
+
const c = sharedConfig.context;
|
|
1451
|
+
setHydrateContext(ctx);
|
|
1452
|
+
const r = Comp(props);
|
|
1453
|
+
setHydrateContext(c);
|
|
1454
|
+
return r;
|
|
1455
|
+
}));
|
|
1591
1456
|
};
|
|
1592
|
-
wrap.preload = () => p || ((p = fn()).then(mod =>
|
|
1457
|
+
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
1593
1458
|
return wrap;
|
|
1594
1459
|
}
|
|
1595
1460
|
let counter = 0;
|
|
@@ -1598,113 +1463,75 @@ function createUniqueId() {
|
|
|
1598
1463
|
return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
|
|
1599
1464
|
}
|
|
1600
1465
|
|
|
1601
|
-
const narrowedError = name =>
|
|
1602
|
-
`Attempting to access a stale value from <${name}> that could possibly be undefined. This may occur because you are reading the accessor returned from the component at a time where it has already been unmounted. We recommend cleaning up any stale timers or async, or reading from the initial condition.`;
|
|
1466
|
+
const narrowedError = name => `Attempting to access a stale value from <${name}> that could possibly be undefined. This may occur because you are reading the accessor returned from the component at a time where it has already been unmounted. We recommend cleaning up any stale timers or async, or reading from the initial condition.` ;
|
|
1603
1467
|
function For(props) {
|
|
1604
1468
|
const fallback = "fallback" in props && {
|
|
1605
1469
|
fallback: () => props.fallback
|
|
1606
1470
|
};
|
|
1607
|
-
return createMemo(
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
{
|
|
1611
|
-
name: "value"
|
|
1612
|
-
}
|
|
1613
|
-
);
|
|
1471
|
+
return createMemo(mapArray(() => props.each, props.children, fallback || undefined), undefined, {
|
|
1472
|
+
name: "value"
|
|
1473
|
+
}) ;
|
|
1614
1474
|
}
|
|
1615
1475
|
function Index(props) {
|
|
1616
1476
|
const fallback = "fallback" in props && {
|
|
1617
1477
|
fallback: () => props.fallback
|
|
1618
1478
|
};
|
|
1619
|
-
return createMemo(
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
{
|
|
1623
|
-
name: "value"
|
|
1624
|
-
}
|
|
1625
|
-
);
|
|
1479
|
+
return createMemo(indexArray(() => props.each, props.children, fallback || undefined), undefined, {
|
|
1480
|
+
name: "value"
|
|
1481
|
+
}) ;
|
|
1626
1482
|
}
|
|
1627
1483
|
function Show(props) {
|
|
1628
1484
|
const keyed = props.keyed;
|
|
1629
1485
|
const condition = createMemo(() => props.when, undefined, {
|
|
1630
|
-
equals: (a, b) =>
|
|
1486
|
+
equals: (a, b) => keyed ? a === b : !a === !b,
|
|
1631
1487
|
name: "condition"
|
|
1632
|
-
});
|
|
1633
|
-
return createMemo(
|
|
1634
|
-
()
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
keyed
|
|
1643
|
-
? c
|
|
1644
|
-
: () => {
|
|
1645
|
-
if (!untrack(condition)) throw narrowedError("Show");
|
|
1646
|
-
return props.when;
|
|
1647
|
-
}
|
|
1648
|
-
)
|
|
1649
|
-
)
|
|
1650
|
-
: child;
|
|
1651
|
-
}
|
|
1652
|
-
return props.fallback;
|
|
1653
|
-
},
|
|
1654
|
-
undefined,
|
|
1655
|
-
{
|
|
1656
|
-
name: "value"
|
|
1488
|
+
} );
|
|
1489
|
+
return createMemo(() => {
|
|
1490
|
+
const c = condition();
|
|
1491
|
+
if (c) {
|
|
1492
|
+
const child = props.children;
|
|
1493
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1494
|
+
return fn ? untrack(() => child(keyed ? c : () => {
|
|
1495
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
1496
|
+
return props.when;
|
|
1497
|
+
})) : child;
|
|
1657
1498
|
}
|
|
1658
|
-
|
|
1499
|
+
return props.fallback;
|
|
1500
|
+
}, undefined, {
|
|
1501
|
+
name: "value"
|
|
1502
|
+
} );
|
|
1659
1503
|
}
|
|
1660
1504
|
function Switch(props) {
|
|
1661
1505
|
let keyed = false;
|
|
1662
|
-
const equals = (a, b) =>
|
|
1663
|
-
a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1506
|
+
const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1664
1507
|
const conditions = children(() => props.children),
|
|
1665
|
-
evalConditions = createMemo(
|
|
1666
|
-
()
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
return [i, c, conds[i]];
|
|
1674
|
-
}
|
|
1508
|
+
evalConditions = createMemo(() => {
|
|
1509
|
+
let conds = conditions();
|
|
1510
|
+
if (!Array.isArray(conds)) conds = [conds];
|
|
1511
|
+
for (let i = 0; i < conds.length; i++) {
|
|
1512
|
+
const c = conds[i].when;
|
|
1513
|
+
if (c) {
|
|
1514
|
+
keyed = !!conds[i].keyed;
|
|
1515
|
+
return [i, c, conds[i]];
|
|
1675
1516
|
}
|
|
1676
|
-
return [-1];
|
|
1677
|
-
},
|
|
1678
|
-
undefined,
|
|
1679
|
-
{
|
|
1680
|
-
equals,
|
|
1681
|
-
name: "eval conditions"
|
|
1682
1517
|
}
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
)
|
|
1701
|
-
: c;
|
|
1702
|
-
},
|
|
1703
|
-
undefined,
|
|
1704
|
-
{
|
|
1705
|
-
name: "value"
|
|
1706
|
-
}
|
|
1707
|
-
);
|
|
1518
|
+
return [-1];
|
|
1519
|
+
}, undefined, {
|
|
1520
|
+
equals,
|
|
1521
|
+
name: "eval conditions"
|
|
1522
|
+
} );
|
|
1523
|
+
return createMemo(() => {
|
|
1524
|
+
const [index, when, cond] = evalConditions();
|
|
1525
|
+
if (index < 0) return props.fallback;
|
|
1526
|
+
const c = cond.children;
|
|
1527
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
1528
|
+
return fn ? untrack(() => c(keyed ? when : () => {
|
|
1529
|
+
if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
|
|
1530
|
+
return cond.when;
|
|
1531
|
+
})) : c;
|
|
1532
|
+
}, undefined, {
|
|
1533
|
+
name: "value"
|
|
1534
|
+
} );
|
|
1708
1535
|
}
|
|
1709
1536
|
function Match(props) {
|
|
1710
1537
|
return props;
|
|
@@ -1715,33 +1542,27 @@ function resetErrorBoundaries() {
|
|
|
1715
1542
|
}
|
|
1716
1543
|
function ErrorBoundary(props) {
|
|
1717
1544
|
let err;
|
|
1718
|
-
if (sharedConfig.context && sharedConfig.load)
|
|
1719
|
-
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1545
|
+
if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1720
1546
|
const [errored, setErrored] = createSignal(err, {
|
|
1721
1547
|
name: "errored"
|
|
1722
|
-
});
|
|
1548
|
+
} );
|
|
1723
1549
|
Errors || (Errors = new Set());
|
|
1724
1550
|
Errors.add(setErrored);
|
|
1725
1551
|
onCleanup(() => Errors.delete(setErrored));
|
|
1726
|
-
return createMemo(
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1733
|
-
}
|
|
1734
|
-
return catchError(() => props.children, setErrored);
|
|
1735
|
-
},
|
|
1736
|
-
undefined,
|
|
1737
|
-
{
|
|
1738
|
-
name: "value"
|
|
1552
|
+
return createMemo(() => {
|
|
1553
|
+
let e;
|
|
1554
|
+
if (e = errored()) {
|
|
1555
|
+
const f = props.fallback;
|
|
1556
|
+
if ((typeof f !== "function" || f.length == 0)) console.error(e);
|
|
1557
|
+
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1739
1558
|
}
|
|
1740
|
-
|
|
1559
|
+
return catchError(() => props.children, setErrored);
|
|
1560
|
+
}, undefined, {
|
|
1561
|
+
name: "value"
|
|
1562
|
+
} );
|
|
1741
1563
|
}
|
|
1742
1564
|
|
|
1743
|
-
const suspenseListEquals = (a, b) =>
|
|
1744
|
-
a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1565
|
+
const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1745
1566
|
const SuspenseListContext = createContext();
|
|
1746
1567
|
function SuspenseList(props) {
|
|
1747
1568
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
@@ -1753,51 +1574,51 @@ function SuspenseList(props) {
|
|
|
1753
1574
|
if (listContext) {
|
|
1754
1575
|
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1755
1576
|
}
|
|
1756
|
-
const resolved = createMemo(
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1577
|
+
const resolved = createMemo(prev => {
|
|
1578
|
+
const reveal = props.revealOrder,
|
|
1579
|
+
tail = props.tail,
|
|
1580
|
+
{
|
|
1581
|
+
showContent = true,
|
|
1582
|
+
showFallback = true
|
|
1583
|
+
} = show ? show() : {},
|
|
1584
|
+
reg = registry(),
|
|
1585
|
+
reverse = reveal === "backwards";
|
|
1586
|
+
if (reveal === "together") {
|
|
1587
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1588
|
+
const res = reg.map(() => ({
|
|
1589
|
+
showContent: all && showContent,
|
|
1590
|
+
showFallback
|
|
1591
|
+
}));
|
|
1592
|
+
res.inFallback = !all;
|
|
1593
|
+
return res;
|
|
1594
|
+
}
|
|
1595
|
+
let stop = false;
|
|
1596
|
+
let inFallback = prev.inFallback;
|
|
1597
|
+
const res = [];
|
|
1598
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1599
|
+
const n = reverse ? len - i - 1 : i,
|
|
1600
|
+
s = reg[n]();
|
|
1601
|
+
if (!stop && !s) {
|
|
1602
|
+
res[n] = {
|
|
1603
|
+
showContent,
|
|
1767
1604
|
showFallback
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
s = reg[n]();
|
|
1778
|
-
if (!stop && !s) {
|
|
1779
|
-
res[n] = {
|
|
1780
|
-
showContent,
|
|
1781
|
-
showFallback
|
|
1782
|
-
};
|
|
1783
|
-
} else {
|
|
1784
|
-
const next = !stop;
|
|
1785
|
-
if (next) inFallback = true;
|
|
1786
|
-
res[n] = {
|
|
1787
|
-
showContent: next,
|
|
1788
|
-
showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
|
|
1789
|
-
};
|
|
1790
|
-
stop = true;
|
|
1791
|
-
}
|
|
1605
|
+
};
|
|
1606
|
+
} else {
|
|
1607
|
+
const next = !stop;
|
|
1608
|
+
if (next) inFallback = true;
|
|
1609
|
+
res[n] = {
|
|
1610
|
+
showContent: next,
|
|
1611
|
+
showFallback: !tail || next && tail === "collapsed" ? showFallback : false
|
|
1612
|
+
};
|
|
1613
|
+
stop = true;
|
|
1792
1614
|
}
|
|
1793
|
-
if (!stop) inFallback = false;
|
|
1794
|
-
res.inFallback = inFallback;
|
|
1795
|
-
return res;
|
|
1796
|
-
},
|
|
1797
|
-
{
|
|
1798
|
-
inFallback: false
|
|
1799
1615
|
}
|
|
1800
|
-
|
|
1616
|
+
if (!stop) inFallback = false;
|
|
1617
|
+
res.inFallback = inFallback;
|
|
1618
|
+
return res;
|
|
1619
|
+
}, {
|
|
1620
|
+
inFallback: false
|
|
1621
|
+
});
|
|
1801
1622
|
setWrapper(() => resolved);
|
|
1802
1623
|
return createComponent(SuspenseListContext.Provider, {
|
|
1803
1624
|
value: {
|
|
@@ -1872,14 +1693,17 @@ function Suspense(props) {
|
|
|
1872
1693
|
ctx = sharedConfig.context;
|
|
1873
1694
|
if (flicker) {
|
|
1874
1695
|
flicker();
|
|
1875
|
-
return
|
|
1696
|
+
return flicker = undefined;
|
|
1876
1697
|
}
|
|
1877
1698
|
if (ctx && p === "$$f") setHydrateContext();
|
|
1878
1699
|
const rendered = createMemo(() => props.children);
|
|
1879
1700
|
return createMemo(prev => {
|
|
1880
1701
|
const inFallback = store.inFallback(),
|
|
1881
|
-
{
|
|
1882
|
-
|
|
1702
|
+
{
|
|
1703
|
+
showContent = true,
|
|
1704
|
+
showFallback = true
|
|
1705
|
+
} = show ? show() : {};
|
|
1706
|
+
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1883
1707
|
store.resolved = true;
|
|
1884
1708
|
dispose && dispose();
|
|
1885
1709
|
dispose = ctx = p = undefined;
|
|
@@ -1909,68 +1733,9 @@ const DEV = {
|
|
|
1909
1733
|
hooks: DevHooks,
|
|
1910
1734
|
writeSignal,
|
|
1911
1735
|
registerGraph
|
|
1912
|
-
};
|
|
1736
|
+
} ;
|
|
1913
1737
|
if (globalThis) {
|
|
1914
|
-
if (!globalThis.Solid$$) globalThis.Solid$$ = true;
|
|
1915
|
-
else
|
|
1916
|
-
console.warn(
|
|
1917
|
-
"You appear to have multiple instances of Solid. This can lead to unexpected behavior."
|
|
1918
|
-
);
|
|
1738
|
+
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1919
1739
|
}
|
|
1920
1740
|
|
|
1921
|
-
export {
|
|
1922
|
-
$DEVCOMP,
|
|
1923
|
-
$PROXY,
|
|
1924
|
-
$TRACK,
|
|
1925
|
-
DEV,
|
|
1926
|
-
ErrorBoundary,
|
|
1927
|
-
For,
|
|
1928
|
-
Index,
|
|
1929
|
-
Match,
|
|
1930
|
-
Show,
|
|
1931
|
-
Suspense,
|
|
1932
|
-
SuspenseList,
|
|
1933
|
-
Switch,
|
|
1934
|
-
batch,
|
|
1935
|
-
cancelCallback,
|
|
1936
|
-
catchError,
|
|
1937
|
-
children,
|
|
1938
|
-
createComponent,
|
|
1939
|
-
createComputed,
|
|
1940
|
-
createContext,
|
|
1941
|
-
createDeferred,
|
|
1942
|
-
createEffect,
|
|
1943
|
-
createMemo,
|
|
1944
|
-
createReaction,
|
|
1945
|
-
createRenderEffect,
|
|
1946
|
-
createResource,
|
|
1947
|
-
createRoot,
|
|
1948
|
-
createSelector,
|
|
1949
|
-
createSignal,
|
|
1950
|
-
createUniqueId,
|
|
1951
|
-
enableExternalSource,
|
|
1952
|
-
enableHydration,
|
|
1953
|
-
enableScheduling,
|
|
1954
|
-
equalFn,
|
|
1955
|
-
from,
|
|
1956
|
-
getListener,
|
|
1957
|
-
getOwner,
|
|
1958
|
-
indexArray,
|
|
1959
|
-
lazy,
|
|
1960
|
-
mapArray,
|
|
1961
|
-
mergeProps,
|
|
1962
|
-
observable,
|
|
1963
|
-
on,
|
|
1964
|
-
onCleanup,
|
|
1965
|
-
onError,
|
|
1966
|
-
onMount,
|
|
1967
|
-
requestCallback,
|
|
1968
|
-
resetErrorBoundaries,
|
|
1969
|
-
runWithOwner,
|
|
1970
|
-
sharedConfig,
|
|
1971
|
-
splitProps,
|
|
1972
|
-
startTransition,
|
|
1973
|
-
untrack,
|
|
1974
|
-
useContext,
|
|
1975
|
-
useTransition
|
|
1976
|
-
};
|
|
1741
|
+
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 };
|