solid-js 1.7.10 → 1.7.12
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 +3 -3
- package/dist/dev.js +298 -531
- package/dist/server.cjs +3 -2
- package/dist/server.js +77 -170
- package/dist/solid.cjs +3 -3
- package/dist/solid.js +256 -458
- 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/jsx-runtime/types/jsx.d.ts +1 -0
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +94 -216
- package/html/types/lit.d.ts +31 -45
- package/package.json +1 -1
- package/store/dist/dev.js +42 -114
- package/store/dist/server.js +8 -19
- package/store/dist/store.js +39 -105
- package/store/types/index.d.ts +7 -21
- package/store/types/modifiers.d.ts +3 -6
- package/store/types/mutable.d.ts +2 -5
- package/store/types/server.d.ts +4 -12
- package/store/types/store.d.ts +61 -218
- package/types/index.d.ts +9 -72
- package/types/jsx.d.ts +2 -1
- package/types/reactive/array.d.ts +4 -12
- package/types/reactive/observable.d.ts +17 -25
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +140 -226
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +31 -62
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +12 -12
- package/types/server/index.d.ts +2 -56
- package/types/server/reactive.d.ts +40 -67
- package/types/server/rendering.d.ts +95 -171
- package/universal/dist/dev.js +12 -28
- package/universal/dist/universal.js +12 -28
- package/universal/types/index.d.ts +1 -3
- package/universal/types/universal.d.ts +1 -0
- package/web/dist/dev.js +79 -610
- package/web/dist/server.js +78 -177
- package/web/dist/web.js +79 -610
- package/web/types/client.d.ts +2 -2
- package/web/types/core.d.ts +1 -10
- package/web/types/index.d.ts +10 -27
- package/web/types/server-mock.d.ts +32 -47
package/dist/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;
|
|
@@ -271,7 +255,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
271
255
|
let source;
|
|
272
256
|
let fetcher;
|
|
273
257
|
let options;
|
|
274
|
-
if (
|
|
258
|
+
if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
|
|
275
259
|
source = true;
|
|
276
260
|
fetcher = pSource;
|
|
277
261
|
options = pFetcher || {};
|
|
@@ -285,7 +269,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
285
269
|
id = null,
|
|
286
270
|
loadedUnderTransition = false,
|
|
287
271
|
scheduled = false,
|
|
288
|
-
resolved = "initialValue" in options,
|
|
272
|
+
resolved = ("initialValue" in options),
|
|
289
273
|
dynamic = typeof source === "function" && createMemo(source);
|
|
290
274
|
const contexts = new Set(),
|
|
291
275
|
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
@@ -297,19 +281,15 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
297
281
|
if (sharedConfig.context) {
|
|
298
282
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
299
283
|
let v;
|
|
300
|
-
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
301
|
-
else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
284
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
302
285
|
}
|
|
303
286
|
function loadEnd(p, v, error, key) {
|
|
304
287
|
if (pr === p) {
|
|
305
288
|
pr = null;
|
|
306
289
|
key !== undefined && (resolved = true);
|
|
307
|
-
if ((p === initP || v === initP) && options.onHydrated)
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
value: v
|
|
311
|
-
})
|
|
312
|
-
);
|
|
290
|
+
if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
|
|
291
|
+
value: v
|
|
292
|
+
}));
|
|
313
293
|
initP = NO_INIT;
|
|
314
294
|
if (Transition && p && loadedUnderTransition) {
|
|
315
295
|
Transition.promises.delete(p);
|
|
@@ -340,8 +320,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
340
320
|
createComputed(() => {
|
|
341
321
|
track();
|
|
342
322
|
if (pr) {
|
|
343
|
-
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
344
|
-
else if (!contexts.has(c)) {
|
|
323
|
+
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
|
|
345
324
|
c.increment();
|
|
346
325
|
contexts.add(c);
|
|
347
326
|
}
|
|
@@ -360,30 +339,22 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
360
339
|
return;
|
|
361
340
|
}
|
|
362
341
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
363
|
-
const p =
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
fetcher(lookup, {
|
|
368
|
-
value: value(),
|
|
369
|
-
refetching
|
|
370
|
-
})
|
|
371
|
-
);
|
|
342
|
+
const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
|
|
343
|
+
value: value(),
|
|
344
|
+
refetching
|
|
345
|
+
}));
|
|
372
346
|
if (typeof p !== "object" || !(p && "then" in p)) {
|
|
373
347
|
loadEnd(pr, p, undefined, lookup);
|
|
374
348
|
return p;
|
|
375
349
|
}
|
|
376
350
|
pr = p;
|
|
377
351
|
scheduled = true;
|
|
378
|
-
queueMicrotask(() =>
|
|
352
|
+
queueMicrotask(() => scheduled = false);
|
|
379
353
|
runUpdates(() => {
|
|
380
354
|
setState(resolved ? "refreshing" : "pending");
|
|
381
355
|
trigger();
|
|
382
356
|
}, false);
|
|
383
|
-
return p.then(
|
|
384
|
-
v => loadEnd(p, v, undefined, lookup),
|
|
385
|
-
e => loadEnd(p, undefined, castError(e), lookup)
|
|
386
|
-
);
|
|
357
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
|
|
387
358
|
}
|
|
388
359
|
Object.defineProperties(read, {
|
|
389
360
|
state: {
|
|
@@ -407,76 +378,50 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
407
378
|
}
|
|
408
379
|
}
|
|
409
380
|
});
|
|
410
|
-
if (dynamic) createComputed(() => load(false));
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
refetch: load,
|
|
416
|
-
mutate: setValue
|
|
417
|
-
}
|
|
418
|
-
];
|
|
381
|
+
if (dynamic) createComputed(() => load(false));else load(false);
|
|
382
|
+
return [read, {
|
|
383
|
+
refetch: load,
|
|
384
|
+
mutate: setValue
|
|
385
|
+
}];
|
|
419
386
|
}
|
|
420
387
|
function createDeferred(source, options) {
|
|
421
388
|
let t,
|
|
422
389
|
timeout = options ? options.timeoutMs : undefined;
|
|
423
|
-
const node = createComputation(
|
|
424
|
-
() => {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
timeout
|
|
431
|
-
}
|
|
432
|
-
: undefined
|
|
433
|
-
);
|
|
434
|
-
return source();
|
|
435
|
-
},
|
|
436
|
-
undefined,
|
|
437
|
-
true
|
|
438
|
-
);
|
|
439
|
-
const [deferred, setDeferred] = createSignal(node.value, options);
|
|
390
|
+
const node = createComputation(() => {
|
|
391
|
+
if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
|
|
392
|
+
timeout
|
|
393
|
+
} : undefined);
|
|
394
|
+
return source();
|
|
395
|
+
}, undefined, true);
|
|
396
|
+
const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);
|
|
440
397
|
updateComputation(node);
|
|
441
|
-
setDeferred(() => node.value);
|
|
398
|
+
setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
442
399
|
return deferred;
|
|
443
400
|
}
|
|
444
401
|
function createSelector(source, fn = equalFn, options) {
|
|
445
402
|
const subs = new Map();
|
|
446
|
-
const node = createComputation(
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
for (const
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
}
|
|
457
|
-
return v;
|
|
458
|
-
},
|
|
459
|
-
undefined,
|
|
460
|
-
true,
|
|
461
|
-
STALE,
|
|
462
|
-
options
|
|
463
|
-
);
|
|
403
|
+
const node = createComputation(p => {
|
|
404
|
+
const v = source();
|
|
405
|
+
for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
|
|
406
|
+
for (const c of val.values()) {
|
|
407
|
+
c.state = STALE;
|
|
408
|
+
if (c.pure) Updates.push(c);else Effects.push(c);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return v;
|
|
412
|
+
}, undefined, true, STALE, options );
|
|
464
413
|
updateComputation(node);
|
|
465
414
|
return key => {
|
|
466
415
|
const listener = Listener;
|
|
467
416
|
if (listener) {
|
|
468
417
|
let l;
|
|
469
|
-
if (
|
|
470
|
-
else subs.set(key, (l = new Set([listener])));
|
|
418
|
+
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
471
419
|
onCleanup(() => {
|
|
472
420
|
l.delete(listener);
|
|
473
421
|
!l.size && subs.delete(key);
|
|
474
422
|
});
|
|
475
423
|
}
|
|
476
|
-
return fn(
|
|
477
|
-
key,
|
|
478
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
479
|
-
);
|
|
424
|
+
return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
480
425
|
};
|
|
481
426
|
}
|
|
482
427
|
function batch(fn) {
|
|
@@ -515,10 +460,7 @@ function onMount(fn) {
|
|
|
515
460
|
createEffect(() => untrack(fn));
|
|
516
461
|
}
|
|
517
462
|
function onCleanup(fn) {
|
|
518
|
-
if (Owner === null)
|
|
519
|
-
console.warn("cleanups created outside a `createRoot` or `render` will never be run");
|
|
520
|
-
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
521
|
-
else Owner.cleanups.push(fn);
|
|
463
|
+
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);
|
|
522
464
|
return fn;
|
|
523
465
|
}
|
|
524
466
|
function catchError(fn, handler) {
|
|
@@ -572,17 +514,15 @@ function startTransition(fn) {
|
|
|
572
514
|
Owner = o;
|
|
573
515
|
let t;
|
|
574
516
|
if (Scheduler || SuspenseContext) {
|
|
575
|
-
t =
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
});
|
|
585
|
-
t.done || (t.done = new Promise(res => (t.resolve = res)));
|
|
517
|
+
t = Transition || (Transition = {
|
|
518
|
+
sources: new Set(),
|
|
519
|
+
effects: [],
|
|
520
|
+
promises: new Set(),
|
|
521
|
+
disposed: new Set(),
|
|
522
|
+
queue: new Set(),
|
|
523
|
+
running: true
|
|
524
|
+
});
|
|
525
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
586
526
|
t.running = true;
|
|
587
527
|
}
|
|
588
528
|
runUpdates(fn, false);
|
|
@@ -598,18 +538,12 @@ function resumeEffects(e) {
|
|
|
598
538
|
e.length = 0;
|
|
599
539
|
}
|
|
600
540
|
function devComponent(Comp, props) {
|
|
601
|
-
const c = createComputation(
|
|
602
|
-
(
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
return Comp(props);
|
|
608
|
-
}),
|
|
609
|
-
undefined,
|
|
610
|
-
true,
|
|
611
|
-
0
|
|
612
|
-
);
|
|
541
|
+
const c = createComputation(() => untrack(() => {
|
|
542
|
+
Object.assign(Comp, {
|
|
543
|
+
[$DEVCOMP]: true
|
|
544
|
+
});
|
|
545
|
+
return Comp(props);
|
|
546
|
+
}), undefined, true, 0);
|
|
613
547
|
c.props = props;
|
|
614
548
|
c.observers = null;
|
|
615
549
|
c.observerSlots = null;
|
|
@@ -620,8 +554,7 @@ function devComponent(Comp, props) {
|
|
|
620
554
|
}
|
|
621
555
|
function registerGraph(value) {
|
|
622
556
|
if (!Owner) return;
|
|
623
|
-
if (Owner.sourceMap) Owner.sourceMap.push(value);
|
|
624
|
-
else Owner.sourceMap = [value];
|
|
557
|
+
if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
|
|
625
558
|
value.graph = Owner;
|
|
626
559
|
}
|
|
627
560
|
function createContext(defaultValue, options) {
|
|
@@ -633,15 +566,13 @@ function createContext(defaultValue, options) {
|
|
|
633
566
|
};
|
|
634
567
|
}
|
|
635
568
|
function useContext(context) {
|
|
636
|
-
return Owner && Owner.context && Owner.context[context.id] !== undefined
|
|
637
|
-
? Owner.context[context.id]
|
|
638
|
-
: context.defaultValue;
|
|
569
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
|
|
639
570
|
}
|
|
640
571
|
function children(fn) {
|
|
641
572
|
const children = createMemo(fn);
|
|
642
573
|
const memo = createMemo(() => resolveChildren(children()), undefined, {
|
|
643
574
|
name: "children"
|
|
644
|
-
});
|
|
575
|
+
}) ;
|
|
645
576
|
memo.toArray = () => {
|
|
646
577
|
const c = memo();
|
|
647
578
|
return Array.isArray(c) ? c : c != null ? [c] : [];
|
|
@@ -650,7 +581,7 @@ function children(fn) {
|
|
|
650
581
|
}
|
|
651
582
|
let SuspenseContext;
|
|
652
583
|
function getSuspenseContext() {
|
|
653
|
-
return SuspenseContext || (SuspenseContext = createContext(
|
|
584
|
+
return SuspenseContext || (SuspenseContext = createContext());
|
|
654
585
|
}
|
|
655
586
|
function enableExternalSource(factory) {
|
|
656
587
|
if (ExternalSourceFactory) {
|
|
@@ -673,8 +604,7 @@ function enableExternalSource(factory) {
|
|
|
673
604
|
function readSignal() {
|
|
674
605
|
const runningTransition = Transition && Transition.running;
|
|
675
606
|
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
676
|
-
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
677
|
-
else {
|
|
607
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
|
|
678
608
|
const updates = Updates;
|
|
679
609
|
Updates = null;
|
|
680
610
|
runUpdates(() => lookUpstream(this), false);
|
|
@@ -702,12 +632,11 @@ function readSignal() {
|
|
|
702
632
|
return this.value;
|
|
703
633
|
}
|
|
704
634
|
function writeSignal(node, value, isComp) {
|
|
705
|
-
let current =
|
|
706
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
635
|
+
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
707
636
|
if (!node.comparator || !node.comparator(current, value)) {
|
|
708
637
|
if (Transition) {
|
|
709
638
|
const TransitionRunning = Transition.running;
|
|
710
|
-
if (TransitionRunning ||
|
|
639
|
+
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
711
640
|
Transition.sources.add(node);
|
|
712
641
|
node.tValue = value;
|
|
713
642
|
}
|
|
@@ -720,12 +649,10 @@ function writeSignal(node, value, isComp) {
|
|
|
720
649
|
const TransitionRunning = Transition && Transition.running;
|
|
721
650
|
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
722
651
|
if (TransitionRunning ? !o.tState : !o.state) {
|
|
723
|
-
if (o.pure) Updates.push(o);
|
|
724
|
-
else Effects.push(o);
|
|
652
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
725
653
|
if (o.observers) markDownstream(o);
|
|
726
654
|
}
|
|
727
|
-
if (!TransitionRunning) o.state = STALE;
|
|
728
|
-
else o.tState = STALE;
|
|
655
|
+
if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
|
|
729
656
|
}
|
|
730
657
|
if (Updates.length > 10e5) {
|
|
731
658
|
Updates = [];
|
|
@@ -744,11 +671,7 @@ function updateComputation(node) {
|
|
|
744
671
|
listener = Listener,
|
|
745
672
|
time = ExecCount;
|
|
746
673
|
Listener = Owner = node;
|
|
747
|
-
runComputation(
|
|
748
|
-
node,
|
|
749
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
750
|
-
time
|
|
751
|
-
);
|
|
674
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
752
675
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
753
676
|
queueMicrotask(() => {
|
|
754
677
|
runUpdates(() => {
|
|
@@ -809,15 +732,11 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
809
732
|
c.state = 0;
|
|
810
733
|
c.tState = state;
|
|
811
734
|
}
|
|
812
|
-
if (Owner === null)
|
|
813
|
-
console.warn("computations created outside a `createRoot` or `render` will never be disposed");
|
|
814
|
-
else if (Owner !== UNOWNED) {
|
|
735
|
+
if (Owner === null) console.warn("computations created outside a `createRoot` or `render` will never be disposed");else if (Owner !== UNOWNED) {
|
|
815
736
|
if (Transition && Transition.running && Owner.pure) {
|
|
816
|
-
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
817
|
-
else Owner.tOwned.push(c);
|
|
737
|
+
if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
|
|
818
738
|
} else {
|
|
819
|
-
if (!Owner.owned) Owner.owned = [c];
|
|
820
|
-
else Owner.owned.push(c);
|
|
739
|
+
if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
|
|
821
740
|
}
|
|
822
741
|
}
|
|
823
742
|
if (options && options.name) c.name = options.name;
|
|
@@ -870,8 +789,7 @@ function runUpdates(fn, init) {
|
|
|
870
789
|
if (Updates) return fn();
|
|
871
790
|
let wait = false;
|
|
872
791
|
if (!init) Updates = [];
|
|
873
|
-
if (Effects) wait = true;
|
|
874
|
-
else Effects = [];
|
|
792
|
+
if (Effects) wait = true;else Effects = [];
|
|
875
793
|
ExecCount++;
|
|
876
794
|
try {
|
|
877
795
|
const res = fn();
|
|
@@ -885,8 +803,7 @@ function runUpdates(fn, init) {
|
|
|
885
803
|
}
|
|
886
804
|
function completeUpdates(wait) {
|
|
887
805
|
if (Updates) {
|
|
888
|
-
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
889
|
-
else runQueue(Updates);
|
|
806
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
|
|
890
807
|
Updates = null;
|
|
891
808
|
}
|
|
892
809
|
if (wait) return;
|
|
@@ -926,8 +843,7 @@ function completeUpdates(wait) {
|
|
|
926
843
|
}
|
|
927
844
|
const e = Effects;
|
|
928
845
|
Effects = null;
|
|
929
|
-
if (e.length) runUpdates(() => runEffects(e), false);
|
|
930
|
-
else DevHooks.afterUpdate && DevHooks.afterUpdate();
|
|
846
|
+
if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
|
|
931
847
|
if (res) res();
|
|
932
848
|
}
|
|
933
849
|
function runQueue(queue) {
|
|
@@ -955,8 +871,7 @@ function runUserEffects(queue) {
|
|
|
955
871
|
userLength = 0;
|
|
956
872
|
for (i = 0; i < queue.length; i++) {
|
|
957
873
|
const e = queue[i];
|
|
958
|
-
if (!e.user) runTop(e);
|
|
959
|
-
else queue[userLength++] = e;
|
|
874
|
+
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
960
875
|
}
|
|
961
876
|
if (sharedConfig.context) {
|
|
962
877
|
if (sharedConfig.count) {
|
|
@@ -974,15 +889,13 @@ function runUserEffects(queue) {
|
|
|
974
889
|
}
|
|
975
890
|
function lookUpstream(node, ignore) {
|
|
976
891
|
const runningTransition = Transition && Transition.running;
|
|
977
|
-
if (runningTransition) node.tState = 0;
|
|
978
|
-
else node.state = 0;
|
|
892
|
+
if (runningTransition) node.tState = 0;else node.state = 0;
|
|
979
893
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
980
894
|
const source = node.sources[i];
|
|
981
895
|
if (source.sources) {
|
|
982
896
|
const state = runningTransition ? source.tState : source.state;
|
|
983
897
|
if (state === STALE) {
|
|
984
|
-
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
985
|
-
runTop(source);
|
|
898
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
|
|
986
899
|
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
987
900
|
}
|
|
988
901
|
}
|
|
@@ -992,10 +905,8 @@ function markDownstream(node) {
|
|
|
992
905
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
993
906
|
const o = node.observers[i];
|
|
994
907
|
if (runningTransition ? !o.tState : !o.state) {
|
|
995
|
-
if (runningTransition) o.tState = PENDING;
|
|
996
|
-
|
|
997
|
-
if (o.pure) Updates.push(o);
|
|
998
|
-
else Effects.push(o);
|
|
908
|
+
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
909
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
999
910
|
o.observers && markDownstream(o);
|
|
1000
911
|
}
|
|
1001
912
|
}
|
|
@@ -1032,8 +943,7 @@ function cleanNode(node) {
|
|
|
1032
943
|
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
1033
944
|
node.cleanups = null;
|
|
1034
945
|
}
|
|
1035
|
-
if (Transition && Transition.running) node.tState = 0;
|
|
1036
|
-
else node.state = 0;
|
|
946
|
+
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
1037
947
|
delete node.sourceMap;
|
|
1038
948
|
}
|
|
1039
949
|
function reset(node, top) {
|
|
@@ -1055,21 +965,19 @@ function runErrors(err, fns, owner) {
|
|
|
1055
965
|
try {
|
|
1056
966
|
for (const f of fns) f(err);
|
|
1057
967
|
} catch (e) {
|
|
1058
|
-
handleError(e,
|
|
968
|
+
handleError(e, owner && owner.owner || null);
|
|
1059
969
|
}
|
|
1060
970
|
}
|
|
1061
971
|
function handleError(err, owner = Owner) {
|
|
1062
972
|
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
1063
973
|
const error = castError(err);
|
|
1064
974
|
if (!fns) throw error;
|
|
1065
|
-
if (Effects)
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
});
|
|
1072
|
-
else runErrors(error, fns, owner);
|
|
975
|
+
if (Effects) Effects.push({
|
|
976
|
+
fn() {
|
|
977
|
+
runErrors(error, fns, owner);
|
|
978
|
+
},
|
|
979
|
+
state: STALE
|
|
980
|
+
});else runErrors(error, fns, owner);
|
|
1073
981
|
}
|
|
1074
982
|
function resolveChildren(children) {
|
|
1075
983
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1086,26 +994,19 @@ function resolveChildren(children) {
|
|
|
1086
994
|
function createProvider(id, options) {
|
|
1087
995
|
return function provider(props) {
|
|
1088
996
|
let res;
|
|
1089
|
-
createRenderEffect(
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
return children(() => props.children);
|
|
1097
|
-
})),
|
|
1098
|
-
undefined,
|
|
1099
|
-
options
|
|
1100
|
-
);
|
|
997
|
+
createRenderEffect(() => res = untrack(() => {
|
|
998
|
+
Owner.context = {
|
|
999
|
+
...Owner.context,
|
|
1000
|
+
[id]: props.value
|
|
1001
|
+
};
|
|
1002
|
+
return children(() => props.children);
|
|
1003
|
+
}), undefined, options);
|
|
1101
1004
|
return res;
|
|
1102
1005
|
};
|
|
1103
1006
|
}
|
|
1104
1007
|
function onError(fn) {
|
|
1105
1008
|
ERROR || (ERROR = Symbol("error"));
|
|
1106
|
-
if (Owner === null)
|
|
1107
|
-
console.warn("error handlers created outside a `createRoot` or `render` will never be run");
|
|
1108
|
-
else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1009
|
+
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]) {
|
|
1109
1010
|
Owner.context = {
|
|
1110
1011
|
...Owner.context,
|
|
1111
1012
|
[ERROR]: [fn]
|
|
@@ -1134,8 +1035,7 @@ function observable(input) {
|
|
|
1134
1035
|
if (!(observer instanceof Object) || observer == null) {
|
|
1135
1036
|
throw new TypeError("Expected the observer to be an object.");
|
|
1136
1037
|
}
|
|
1137
|
-
const handler =
|
|
1138
|
-
typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1038
|
+
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1139
1039
|
if (!handler) {
|
|
1140
1040
|
return {
|
|
1141
1041
|
unsubscribe() {}
|
|
@@ -1166,7 +1066,7 @@ function from(producer) {
|
|
|
1166
1066
|
});
|
|
1167
1067
|
if ("subscribe" in producer) {
|
|
1168
1068
|
const unsub = producer.subscribe(v => set(() => v));
|
|
1169
|
-
onCleanup(() =>
|
|
1069
|
+
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
1170
1070
|
} else {
|
|
1171
1071
|
const clean = producer(set);
|
|
1172
1072
|
onCleanup(clean);
|
|
@@ -1218,7 +1118,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1218
1118
|
});
|
|
1219
1119
|
len = 1;
|
|
1220
1120
|
}
|
|
1221
|
-
}
|
|
1121
|
+
}
|
|
1122
|
+
else if (len === 0) {
|
|
1222
1123
|
mapped = new Array(newLen);
|
|
1223
1124
|
for (j = 0; j < newLen; j++) {
|
|
1224
1125
|
items[j] = newItems[j];
|
|
@@ -1229,16 +1130,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1229
1130
|
temp = new Array(newLen);
|
|
1230
1131
|
tempdisposers = new Array(newLen);
|
|
1231
1132
|
indexes && (tempIndexes = new Array(newLen));
|
|
1232
|
-
for (
|
|
1233
|
-
|
|
1234
|
-
start < end && items[start] === newItems[start];
|
|
1235
|
-
start++
|
|
1236
|
-
);
|
|
1237
|
-
for (
|
|
1238
|
-
end = len - 1, newEnd = newLen - 1;
|
|
1239
|
-
end >= start && newEnd >= start && items[end] === newItems[newEnd];
|
|
1240
|
-
end--, newEnd--
|
|
1241
|
-
) {
|
|
1133
|
+
for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
|
|
1134
|
+
for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
|
|
1242
1135
|
temp[newEnd] = mapped[end];
|
|
1243
1136
|
tempdisposers[newEnd] = disposers[end];
|
|
1244
1137
|
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
@@ -1272,7 +1165,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1272
1165
|
}
|
|
1273
1166
|
} else mapped[j] = createRoot(mapper);
|
|
1274
1167
|
}
|
|
1275
|
-
mapped = mapped.slice(0,
|
|
1168
|
+
mapped = mapped.slice(0, len = newLen);
|
|
1276
1169
|
items = newItems.slice(0);
|
|
1277
1170
|
}
|
|
1278
1171
|
return mapped;
|
|
@@ -1282,7 +1175,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1282
1175
|
if (indexes) {
|
|
1283
1176
|
const [s, set] = createSignal(j, {
|
|
1284
1177
|
name: "index"
|
|
1285
|
-
});
|
|
1178
|
+
}) ;
|
|
1286
1179
|
indexes[j] = set;
|
|
1287
1180
|
return mapFn(newItems[j], s);
|
|
1288
1181
|
}
|
|
@@ -1340,13 +1233,13 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1340
1233
|
}
|
|
1341
1234
|
len = signals.length = disposers.length = newItems.length;
|
|
1342
1235
|
items = newItems.slice(0);
|
|
1343
|
-
return
|
|
1236
|
+
return mapped = mapped.slice(0, len);
|
|
1344
1237
|
});
|
|
1345
1238
|
function mapper(disposer) {
|
|
1346
1239
|
disposers[i] = disposer;
|
|
1347
1240
|
const [s, set] = createSignal(newItems[i], {
|
|
1348
1241
|
name: "value"
|
|
1349
|
-
});
|
|
1242
|
+
}) ;
|
|
1350
1243
|
signals[i] = set;
|
|
1351
1244
|
return mapFn(s, i);
|
|
1352
1245
|
}
|
|
@@ -1362,7 +1255,7 @@ function createComponent(Comp, props) {
|
|
|
1362
1255
|
if (sharedConfig.context) {
|
|
1363
1256
|
const c = sharedConfig.context;
|
|
1364
1257
|
setHydrateContext(nextHydrateContext());
|
|
1365
|
-
const r = devComponent(Comp, props || {});
|
|
1258
|
+
const r = devComponent(Comp, props || {}) ;
|
|
1366
1259
|
setHydrateContext(c);
|
|
1367
1260
|
return r;
|
|
1368
1261
|
}
|
|
@@ -1411,33 +1304,29 @@ function mergeProps(...sources) {
|
|
|
1411
1304
|
let proxy = false;
|
|
1412
1305
|
for (let i = 0; i < sources.length; i++) {
|
|
1413
1306
|
const s = sources[i];
|
|
1414
|
-
proxy = proxy ||
|
|
1415
|
-
sources[i] = typeof s === "function" ? (
|
|
1307
|
+
proxy = proxy || !!s && $PROXY in s;
|
|
1308
|
+
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
1416
1309
|
}
|
|
1417
1310
|
if (proxy) {
|
|
1418
|
-
return new Proxy(
|
|
1419
|
-
{
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
if (v !== undefined) return v;
|
|
1424
|
-
}
|
|
1425
|
-
},
|
|
1426
|
-
has(property) {
|
|
1427
|
-
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1428
|
-
if (property in resolveSource(sources[i])) return true;
|
|
1429
|
-
}
|
|
1430
|
-
return false;
|
|
1431
|
-
},
|
|
1432
|
-
keys() {
|
|
1433
|
-
const keys = [];
|
|
1434
|
-
for (let i = 0; i < sources.length; i++)
|
|
1435
|
-
keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1436
|
-
return [...new Set(keys)];
|
|
1311
|
+
return new Proxy({
|
|
1312
|
+
get(property) {
|
|
1313
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1314
|
+
const v = resolveSource(sources[i])[property];
|
|
1315
|
+
if (v !== undefined) return v;
|
|
1437
1316
|
}
|
|
1438
1317
|
},
|
|
1439
|
-
|
|
1440
|
-
|
|
1318
|
+
has(property) {
|
|
1319
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1320
|
+
if (property in resolveSource(sources[i])) return true;
|
|
1321
|
+
}
|
|
1322
|
+
return false;
|
|
1323
|
+
},
|
|
1324
|
+
keys() {
|
|
1325
|
+
const keys = [];
|
|
1326
|
+
for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1327
|
+
return [...new Set(keys)];
|
|
1328
|
+
}
|
|
1329
|
+
}, propTraps);
|
|
1441
1330
|
}
|
|
1442
1331
|
const target = {};
|
|
1443
1332
|
const sourcesMap = {};
|
|
@@ -1456,7 +1345,7 @@ function mergeProps(...sources) {
|
|
|
1456
1345
|
Object.defineProperty(target, key, {
|
|
1457
1346
|
enumerable: true,
|
|
1458
1347
|
configurable: true,
|
|
1459
|
-
get: resolveSources.bind(
|
|
1348
|
+
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
1460
1349
|
});
|
|
1461
1350
|
} else {
|
|
1462
1351
|
if (desc.value !== undefined) defined.add(key);
|
|
@@ -1480,60 +1369,47 @@ function splitProps(props, ...keys) {
|
|
|
1480
1369
|
if ($PROXY in props) {
|
|
1481
1370
|
const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
|
|
1482
1371
|
const res = keys.map(k => {
|
|
1483
|
-
return new Proxy(
|
|
1484
|
-
{
|
|
1485
|
-
|
|
1486
|
-
return k.includes(property) ? props[property] : undefined;
|
|
1487
|
-
},
|
|
1488
|
-
has(property) {
|
|
1489
|
-
return k.includes(property) && property in props;
|
|
1490
|
-
},
|
|
1491
|
-
keys() {
|
|
1492
|
-
return k.filter(property => property in props);
|
|
1493
|
-
}
|
|
1372
|
+
return new Proxy({
|
|
1373
|
+
get(property) {
|
|
1374
|
+
return k.includes(property) ? props[property] : undefined;
|
|
1494
1375
|
},
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
});
|
|
1498
|
-
res.push(
|
|
1499
|
-
new Proxy(
|
|
1500
|
-
{
|
|
1501
|
-
get(property) {
|
|
1502
|
-
return blocked.has(property) ? undefined : props[property];
|
|
1503
|
-
},
|
|
1504
|
-
has(property) {
|
|
1505
|
-
return blocked.has(property) ? false : property in props;
|
|
1506
|
-
},
|
|
1507
|
-
keys() {
|
|
1508
|
-
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1509
|
-
}
|
|
1376
|
+
has(property) {
|
|
1377
|
+
return k.includes(property) && property in props;
|
|
1510
1378
|
},
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1379
|
+
keys() {
|
|
1380
|
+
return k.filter(property => property in props);
|
|
1381
|
+
}
|
|
1382
|
+
}, propTraps);
|
|
1383
|
+
});
|
|
1384
|
+
res.push(new Proxy({
|
|
1385
|
+
get(property) {
|
|
1386
|
+
return blocked.has(property) ? undefined : props[property];
|
|
1387
|
+
},
|
|
1388
|
+
has(property) {
|
|
1389
|
+
return blocked.has(property) ? false : property in props;
|
|
1390
|
+
},
|
|
1391
|
+
keys() {
|
|
1392
|
+
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1393
|
+
}
|
|
1394
|
+
}, propTraps));
|
|
1514
1395
|
return res;
|
|
1515
1396
|
}
|
|
1516
1397
|
const otherObject = {};
|
|
1517
1398
|
const objects = keys.map(() => ({}));
|
|
1518
1399
|
for (const propName of Object.getOwnPropertyNames(props)) {
|
|
1519
1400
|
const desc = Object.getOwnPropertyDescriptor(props, propName);
|
|
1520
|
-
const isDefaultDesc =
|
|
1521
|
-
!desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1401
|
+
const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1522
1402
|
let blocked = false;
|
|
1523
1403
|
let objectIndex = 0;
|
|
1524
1404
|
for (const k of keys) {
|
|
1525
1405
|
if (k.includes(propName)) {
|
|
1526
1406
|
blocked = true;
|
|
1527
|
-
isDefaultDesc
|
|
1528
|
-
? (objects[objectIndex][propName] = desc.value)
|
|
1529
|
-
: Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1407
|
+
isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1530
1408
|
}
|
|
1531
1409
|
++objectIndex;
|
|
1532
1410
|
}
|
|
1533
1411
|
if (!blocked) {
|
|
1534
|
-
isDefaultDesc
|
|
1535
|
-
? (otherObject[propName] = desc.value)
|
|
1536
|
-
: Object.defineProperty(otherObject, propName, desc);
|
|
1412
|
+
isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
|
|
1537
1413
|
}
|
|
1538
1414
|
}
|
|
1539
1415
|
return [...objects, otherObject];
|
|
@@ -1559,24 +1435,19 @@ function lazy(fn) {
|
|
|
1559
1435
|
comp = s;
|
|
1560
1436
|
}
|
|
1561
1437
|
let Comp;
|
|
1562
|
-
return createMemo(
|
|
1563
|
-
()
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
const r = Comp(props);
|
|
1574
|
-
setHydrateContext(c);
|
|
1575
|
-
return r;
|
|
1576
|
-
})
|
|
1577
|
-
);
|
|
1438
|
+
return createMemo(() => (Comp = comp()) && untrack(() => {
|
|
1439
|
+
if (true) Object.assign(Comp, {
|
|
1440
|
+
[$DEVCOMP]: true
|
|
1441
|
+
});
|
|
1442
|
+
if (!ctx) return Comp(props);
|
|
1443
|
+
const c = sharedConfig.context;
|
|
1444
|
+
setHydrateContext(ctx);
|
|
1445
|
+
const r = Comp(props);
|
|
1446
|
+
setHydrateContext(c);
|
|
1447
|
+
return r;
|
|
1448
|
+
}));
|
|
1578
1449
|
};
|
|
1579
|
-
wrap.preload = () => p || ((p = fn()).then(mod =>
|
|
1450
|
+
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
1580
1451
|
return wrap;
|
|
1581
1452
|
}
|
|
1582
1453
|
let counter = 0;
|
|
@@ -1585,113 +1456,75 @@ function createUniqueId() {
|
|
|
1585
1456
|
return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
|
|
1586
1457
|
}
|
|
1587
1458
|
|
|
1588
|
-
const narrowedError = name =>
|
|
1589
|
-
`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.`;
|
|
1459
|
+
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.` ;
|
|
1590
1460
|
function For(props) {
|
|
1591
1461
|
const fallback = "fallback" in props && {
|
|
1592
1462
|
fallback: () => props.fallback
|
|
1593
1463
|
};
|
|
1594
|
-
return createMemo(
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
{
|
|
1598
|
-
name: "value"
|
|
1599
|
-
}
|
|
1600
|
-
);
|
|
1464
|
+
return createMemo(mapArray(() => props.each, props.children, fallback || undefined), undefined, {
|
|
1465
|
+
name: "value"
|
|
1466
|
+
}) ;
|
|
1601
1467
|
}
|
|
1602
1468
|
function Index(props) {
|
|
1603
1469
|
const fallback = "fallback" in props && {
|
|
1604
1470
|
fallback: () => props.fallback
|
|
1605
1471
|
};
|
|
1606
|
-
return createMemo(
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
{
|
|
1610
|
-
name: "value"
|
|
1611
|
-
}
|
|
1612
|
-
);
|
|
1472
|
+
return createMemo(indexArray(() => props.each, props.children, fallback || undefined), undefined, {
|
|
1473
|
+
name: "value"
|
|
1474
|
+
}) ;
|
|
1613
1475
|
}
|
|
1614
1476
|
function Show(props) {
|
|
1615
1477
|
const keyed = props.keyed;
|
|
1616
1478
|
const condition = createMemo(() => props.when, undefined, {
|
|
1617
|
-
equals: (a, b) =>
|
|
1479
|
+
equals: (a, b) => keyed ? a === b : !a === !b,
|
|
1618
1480
|
name: "condition"
|
|
1619
|
-
});
|
|
1620
|
-
return createMemo(
|
|
1621
|
-
()
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
keyed
|
|
1630
|
-
? c
|
|
1631
|
-
: () => {
|
|
1632
|
-
if (!untrack(condition)) throw narrowedError("Show");
|
|
1633
|
-
return props.when;
|
|
1634
|
-
}
|
|
1635
|
-
)
|
|
1636
|
-
)
|
|
1637
|
-
: child;
|
|
1638
|
-
}
|
|
1639
|
-
return props.fallback;
|
|
1640
|
-
},
|
|
1641
|
-
undefined,
|
|
1642
|
-
{
|
|
1643
|
-
name: "value"
|
|
1481
|
+
} );
|
|
1482
|
+
return createMemo(() => {
|
|
1483
|
+
const c = condition();
|
|
1484
|
+
if (c) {
|
|
1485
|
+
const child = props.children;
|
|
1486
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1487
|
+
return fn ? untrack(() => child(keyed ? c : () => {
|
|
1488
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
1489
|
+
return props.when;
|
|
1490
|
+
})) : child;
|
|
1644
1491
|
}
|
|
1645
|
-
|
|
1492
|
+
return props.fallback;
|
|
1493
|
+
}, undefined, {
|
|
1494
|
+
name: "value"
|
|
1495
|
+
} );
|
|
1646
1496
|
}
|
|
1647
1497
|
function Switch(props) {
|
|
1648
1498
|
let keyed = false;
|
|
1649
|
-
const equals = (a, b) =>
|
|
1650
|
-
a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1499
|
+
const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1651
1500
|
const conditions = children(() => props.children),
|
|
1652
|
-
evalConditions = createMemo(
|
|
1653
|
-
()
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
return [i, c, conds[i]];
|
|
1661
|
-
}
|
|
1501
|
+
evalConditions = createMemo(() => {
|
|
1502
|
+
let conds = conditions();
|
|
1503
|
+
if (!Array.isArray(conds)) conds = [conds];
|
|
1504
|
+
for (let i = 0; i < conds.length; i++) {
|
|
1505
|
+
const c = conds[i].when;
|
|
1506
|
+
if (c) {
|
|
1507
|
+
keyed = !!conds[i].keyed;
|
|
1508
|
+
return [i, c, conds[i]];
|
|
1662
1509
|
}
|
|
1663
|
-
return [-1];
|
|
1664
|
-
},
|
|
1665
|
-
undefined,
|
|
1666
|
-
{
|
|
1667
|
-
equals,
|
|
1668
|
-
name: "eval conditions"
|
|
1669
1510
|
}
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
)
|
|
1688
|
-
: c;
|
|
1689
|
-
},
|
|
1690
|
-
undefined,
|
|
1691
|
-
{
|
|
1692
|
-
name: "value"
|
|
1693
|
-
}
|
|
1694
|
-
);
|
|
1511
|
+
return [-1];
|
|
1512
|
+
}, undefined, {
|
|
1513
|
+
equals,
|
|
1514
|
+
name: "eval conditions"
|
|
1515
|
+
} );
|
|
1516
|
+
return createMemo(() => {
|
|
1517
|
+
const [index, when, cond] = evalConditions();
|
|
1518
|
+
if (index < 0) return props.fallback;
|
|
1519
|
+
const c = cond.children;
|
|
1520
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
1521
|
+
return fn ? untrack(() => c(keyed ? when : () => {
|
|
1522
|
+
if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
|
|
1523
|
+
return cond.when;
|
|
1524
|
+
})) : c;
|
|
1525
|
+
}, undefined, {
|
|
1526
|
+
name: "value"
|
|
1527
|
+
} );
|
|
1695
1528
|
}
|
|
1696
1529
|
function Match(props) {
|
|
1697
1530
|
return props;
|
|
@@ -1703,37 +1536,27 @@ function resetErrorBoundaries() {
|
|
|
1703
1536
|
function ErrorBoundary(props) {
|
|
1704
1537
|
let err;
|
|
1705
1538
|
let v;
|
|
1706
|
-
if (
|
|
1707
|
-
sharedConfig.context &&
|
|
1708
|
-
sharedConfig.load &&
|
|
1709
|
-
(v = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count))
|
|
1710
|
-
)
|
|
1711
|
-
err = v[0];
|
|
1539
|
+
if (sharedConfig.context && sharedConfig.load && (v = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count))) err = v[0];
|
|
1712
1540
|
const [errored, setErrored] = createSignal(err, {
|
|
1713
1541
|
name: "errored"
|
|
1714
|
-
});
|
|
1542
|
+
} );
|
|
1715
1543
|
Errors || (Errors = new Set());
|
|
1716
1544
|
Errors.add(setErrored);
|
|
1717
1545
|
onCleanup(() => Errors.delete(setErrored));
|
|
1718
|
-
return createMemo(
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1725
|
-
}
|
|
1726
|
-
return catchError(() => props.children, setErrored);
|
|
1727
|
-
},
|
|
1728
|
-
undefined,
|
|
1729
|
-
{
|
|
1730
|
-
name: "value"
|
|
1546
|
+
return createMemo(() => {
|
|
1547
|
+
let e;
|
|
1548
|
+
if (e = errored()) {
|
|
1549
|
+
const f = props.fallback;
|
|
1550
|
+
if ((typeof f !== "function" || f.length == 0)) console.error(e);
|
|
1551
|
+
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1731
1552
|
}
|
|
1732
|
-
|
|
1553
|
+
return catchError(() => props.children, setErrored);
|
|
1554
|
+
}, undefined, {
|
|
1555
|
+
name: "value"
|
|
1556
|
+
} );
|
|
1733
1557
|
}
|
|
1734
1558
|
|
|
1735
|
-
const suspenseListEquals = (a, b) =>
|
|
1736
|
-
a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1559
|
+
const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1737
1560
|
const SuspenseListContext = createContext();
|
|
1738
1561
|
function SuspenseList(props) {
|
|
1739
1562
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
@@ -1745,51 +1568,51 @@ function SuspenseList(props) {
|
|
|
1745
1568
|
if (listContext) {
|
|
1746
1569
|
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1747
1570
|
}
|
|
1748
|
-
const resolved = createMemo(
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1571
|
+
const resolved = createMemo(prev => {
|
|
1572
|
+
const reveal = props.revealOrder,
|
|
1573
|
+
tail = props.tail,
|
|
1574
|
+
{
|
|
1575
|
+
showContent = true,
|
|
1576
|
+
showFallback = true
|
|
1577
|
+
} = show ? show() : {},
|
|
1578
|
+
reg = registry(),
|
|
1579
|
+
reverse = reveal === "backwards";
|
|
1580
|
+
if (reveal === "together") {
|
|
1581
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1582
|
+
const res = reg.map(() => ({
|
|
1583
|
+
showContent: all && showContent,
|
|
1584
|
+
showFallback
|
|
1585
|
+
}));
|
|
1586
|
+
res.inFallback = !all;
|
|
1587
|
+
return res;
|
|
1588
|
+
}
|
|
1589
|
+
let stop = false;
|
|
1590
|
+
let inFallback = prev.inFallback;
|
|
1591
|
+
const res = [];
|
|
1592
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1593
|
+
const n = reverse ? len - i - 1 : i,
|
|
1594
|
+
s = reg[n]();
|
|
1595
|
+
if (!stop && !s) {
|
|
1596
|
+
res[n] = {
|
|
1597
|
+
showContent,
|
|
1759
1598
|
showFallback
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
s = reg[n]();
|
|
1770
|
-
if (!stop && !s) {
|
|
1771
|
-
res[n] = {
|
|
1772
|
-
showContent,
|
|
1773
|
-
showFallback
|
|
1774
|
-
};
|
|
1775
|
-
} else {
|
|
1776
|
-
const next = !stop;
|
|
1777
|
-
if (next) inFallback = true;
|
|
1778
|
-
res[n] = {
|
|
1779
|
-
showContent: next,
|
|
1780
|
-
showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
|
|
1781
|
-
};
|
|
1782
|
-
stop = true;
|
|
1783
|
-
}
|
|
1599
|
+
};
|
|
1600
|
+
} else {
|
|
1601
|
+
const next = !stop;
|
|
1602
|
+
if (next) inFallback = true;
|
|
1603
|
+
res[n] = {
|
|
1604
|
+
showContent: next,
|
|
1605
|
+
showFallback: !tail || next && tail === "collapsed" ? showFallback : false
|
|
1606
|
+
};
|
|
1607
|
+
stop = true;
|
|
1784
1608
|
}
|
|
1785
|
-
if (!stop) inFallback = false;
|
|
1786
|
-
res.inFallback = inFallback;
|
|
1787
|
-
return res;
|
|
1788
|
-
},
|
|
1789
|
-
{
|
|
1790
|
-
inFallback: false
|
|
1791
1609
|
}
|
|
1792
|
-
|
|
1610
|
+
if (!stop) inFallback = false;
|
|
1611
|
+
res.inFallback = inFallback;
|
|
1612
|
+
return res;
|
|
1613
|
+
}, {
|
|
1614
|
+
inFallback: false
|
|
1615
|
+
});
|
|
1793
1616
|
setWrapper(() => resolved);
|
|
1794
1617
|
return createComponent(SuspenseListContext.Provider, {
|
|
1795
1618
|
value: {
|
|
@@ -1863,14 +1686,17 @@ function Suspense(props) {
|
|
|
1863
1686
|
ctx = sharedConfig.context;
|
|
1864
1687
|
if (flicker) {
|
|
1865
1688
|
flicker();
|
|
1866
|
-
return
|
|
1689
|
+
return flicker = undefined;
|
|
1867
1690
|
}
|
|
1868
1691
|
if (ctx && p === "$$f") setHydrateContext();
|
|
1869
1692
|
const rendered = createMemo(() => props.children);
|
|
1870
1693
|
return createMemo(prev => {
|
|
1871
1694
|
const inFallback = store.inFallback(),
|
|
1872
|
-
{
|
|
1873
|
-
|
|
1695
|
+
{
|
|
1696
|
+
showContent = true,
|
|
1697
|
+
showFallback = true
|
|
1698
|
+
} = show ? show() : {};
|
|
1699
|
+
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1874
1700
|
store.resolved = true;
|
|
1875
1701
|
dispose && dispose();
|
|
1876
1702
|
dispose = ctx = p = undefined;
|
|
@@ -1900,68 +1726,9 @@ const DEV = {
|
|
|
1900
1726
|
hooks: DevHooks,
|
|
1901
1727
|
writeSignal,
|
|
1902
1728
|
registerGraph
|
|
1903
|
-
};
|
|
1729
|
+
} ;
|
|
1904
1730
|
if (globalThis) {
|
|
1905
|
-
if (!globalThis.Solid$$) globalThis.Solid$$ = true;
|
|
1906
|
-
else
|
|
1907
|
-
console.warn(
|
|
1908
|
-
"You appear to have multiple instances of Solid. This can lead to unexpected behavior."
|
|
1909
|
-
);
|
|
1731
|
+
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1910
1732
|
}
|
|
1911
1733
|
|
|
1912
|
-
export {
|
|
1913
|
-
$DEVCOMP,
|
|
1914
|
-
$PROXY,
|
|
1915
|
-
$TRACK,
|
|
1916
|
-
DEV,
|
|
1917
|
-
ErrorBoundary,
|
|
1918
|
-
For,
|
|
1919
|
-
Index,
|
|
1920
|
-
Match,
|
|
1921
|
-
Show,
|
|
1922
|
-
Suspense,
|
|
1923
|
-
SuspenseList,
|
|
1924
|
-
Switch,
|
|
1925
|
-
batch,
|
|
1926
|
-
cancelCallback,
|
|
1927
|
-
catchError,
|
|
1928
|
-
children,
|
|
1929
|
-
createComponent,
|
|
1930
|
-
createComputed,
|
|
1931
|
-
createContext,
|
|
1932
|
-
createDeferred,
|
|
1933
|
-
createEffect,
|
|
1934
|
-
createMemo,
|
|
1935
|
-
createReaction,
|
|
1936
|
-
createRenderEffect,
|
|
1937
|
-
createResource,
|
|
1938
|
-
createRoot,
|
|
1939
|
-
createSelector,
|
|
1940
|
-
createSignal,
|
|
1941
|
-
createUniqueId,
|
|
1942
|
-
enableExternalSource,
|
|
1943
|
-
enableHydration,
|
|
1944
|
-
enableScheduling,
|
|
1945
|
-
equalFn,
|
|
1946
|
-
from,
|
|
1947
|
-
getListener,
|
|
1948
|
-
getOwner,
|
|
1949
|
-
indexArray,
|
|
1950
|
-
lazy,
|
|
1951
|
-
mapArray,
|
|
1952
|
-
mergeProps,
|
|
1953
|
-
observable,
|
|
1954
|
-
on,
|
|
1955
|
-
onCleanup,
|
|
1956
|
-
onError,
|
|
1957
|
-
onMount,
|
|
1958
|
-
requestCallback,
|
|
1959
|
-
resetErrorBoundaries,
|
|
1960
|
-
runWithOwner,
|
|
1961
|
-
sharedConfig,
|
|
1962
|
-
splitProps,
|
|
1963
|
-
startTransition,
|
|
1964
|
-
untrack,
|
|
1965
|
-
useContext,
|
|
1966
|
-
useTransition
|
|
1967
|
-
};
|
|
1734
|
+
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 };
|