solid-js 1.7.9 → 1.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/dev.cjs +36 -20
  2. package/dist/dev.js +326 -548
  3. package/dist/server.cjs +38 -23
  4. package/dist/server.js +108 -192
  5. package/dist/solid.cjs +36 -20
  6. package/dist/solid.js +284 -475
  7. package/h/dist/h.js +8 -34
  8. package/h/jsx-runtime/dist/jsx.js +1 -1
  9. package/h/jsx-runtime/types/index.d.ts +8 -11
  10. package/h/types/hyperscript.d.ts +11 -11
  11. package/html/dist/html.js +94 -216
  12. package/html/types/lit.d.ts +31 -45
  13. package/package.json +1 -1
  14. package/store/dist/dev.cjs +4 -3
  15. package/store/dist/dev.js +46 -117
  16. package/store/dist/server.js +8 -19
  17. package/store/dist/store.cjs +4 -3
  18. package/store/dist/store.js +43 -108
  19. package/store/types/index.d.ts +7 -21
  20. package/store/types/modifiers.d.ts +3 -6
  21. package/store/types/mutable.d.ts +2 -5
  22. package/store/types/server.d.ts +4 -12
  23. package/store/types/store.d.ts +61 -215
  24. package/types/index.d.ts +9 -69
  25. package/types/reactive/array.d.ts +4 -12
  26. package/types/reactive/observable.d.ts +17 -25
  27. package/types/reactive/scheduler.d.ts +6 -9
  28. package/types/reactive/signal.d.ts +150 -236
  29. package/types/render/Suspense.d.ts +5 -5
  30. package/types/render/component.d.ts +31 -62
  31. package/types/render/flow.d.ts +31 -43
  32. package/types/render/hydration.d.ts +12 -12
  33. package/types/server/index.d.ts +2 -55
  34. package/types/server/reactive.d.ts +44 -72
  35. package/types/server/rendering.d.ts +95 -171
  36. package/universal/dist/dev.js +12 -28
  37. package/universal/dist/universal.js +12 -28
  38. package/universal/types/index.d.ts +1 -3
  39. package/universal/types/universal.d.ts +1 -0
  40. package/web/dist/dev.js +79 -610
  41. package/web/dist/server.cjs +5 -1
  42. package/web/dist/server.js +82 -177
  43. package/web/dist/web.js +79 -610
  44. package/web/types/client.d.ts +2 -2
  45. package/web/types/core.d.ts +1 -10
  46. package/web/types/index.d.ts +10 -27
  47. package/web/types/server-mock.d.ts +32 -47
  48. package/web/types/server.d.ts +1 -1
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 = (n + m) >> 1;
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,30 +159,26 @@ const DevHooks = {
161
159
  afterUpdate: null,
162
160
  afterCreateOwner: null
163
161
  };
164
- const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);
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
- root = unowned
170
- ? {
171
- owned: null,
172
- cleanups: null,
173
- context: null,
174
- owner: null
175
- }
176
- : {
177
- owned: null,
178
- cleanups: null,
179
- context: null,
180
- owner: detachedOwner === undefined ? owner : detachedOwner
181
- },
182
- updateFn = unowned
183
- ? () =>
184
- fn(() => {
185
- throw new Error("Dispose method must be an explicit argument to createRoot function");
186
- })
187
- : () => fn(() => untrack(() => cleanNode(root)));
167
+ current = detachedOwner === undefined ? owner : detachedOwner,
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)));
188
182
  DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(root);
189
183
  Owner = root;
190
184
  Listener = null;
@@ -209,44 +203,35 @@ function createSignal(value, options) {
209
203
  }
210
204
  const setter = value => {
211
205
  if (typeof value === "function") {
212
- if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
213
- else value = value(s.value);
206
+ if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
214
207
  }
215
208
  return writeSignal(s, value);
216
209
  };
217
210
  return [readSignal.bind(s), setter];
218
211
  }
219
212
  function createComputed(fn, value, options) {
220
- const c = createComputation(fn, value, true, STALE, options);
221
- if (Scheduler && Transition && Transition.running) Updates.push(c);
222
- else updateComputation(c);
213
+ const c = createComputation(fn, value, true, STALE, options );
214
+ if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
223
215
  }
224
216
  function createRenderEffect(fn, value, options) {
225
- const c = createComputation(fn, value, false, STALE, options);
226
- if (Scheduler && Transition && Transition.running) Updates.push(c);
227
- else updateComputation(c);
217
+ const c = createComputation(fn, value, false, STALE, options );
218
+ if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
228
219
  }
229
220
  function createEffect(fn, value, options) {
230
221
  runEffects = runUserEffects;
231
- const c = createComputation(fn, value, false, STALE, options),
232
- s = SuspenseContext && lookup(Owner, SuspenseContext.id);
222
+ const c = createComputation(fn, value, false, STALE, options ),
223
+ s = SuspenseContext && useContext(SuspenseContext);
233
224
  if (s) c.suspense = s;
234
225
  if (!options || !options.render) c.user = true;
235
226
  Effects ? Effects.push(c) : updateComputation(c);
236
227
  }
237
228
  function createReaction(onInvalidate, options) {
238
229
  let fn;
239
- const c = createComputation(
240
- () => {
241
- fn ? fn() : untrack(onInvalidate);
242
- fn = undefined;
243
- },
244
- undefined,
245
- false,
246
- 0,
247
- options
248
- ),
249
- s = SuspenseContext && lookup(Owner, SuspenseContext.id);
230
+ const c = createComputation(() => {
231
+ fn ? fn() : untrack(onInvalidate);
232
+ fn = undefined;
233
+ }, undefined, false, 0, options ),
234
+ s = SuspenseContext && useContext(SuspenseContext);
250
235
  if (s) c.suspense = s;
251
236
  c.user = true;
252
237
  return tracking => {
@@ -256,7 +241,7 @@ function createReaction(onInvalidate, options) {
256
241
  }
257
242
  function createMemo(fn, value, options) {
258
243
  options = options ? Object.assign({}, signalOptions, options) : signalOptions;
259
- const c = createComputation(fn, value, true, 0, options);
244
+ const c = createComputation(fn, value, true, 0, options );
260
245
  c.observers = null;
261
246
  c.observerSlots = null;
262
247
  c.comparator = options.equals || undefined;
@@ -270,7 +255,7 @@ function createResource(pSource, pFetcher, pOptions) {
270
255
  let source;
271
256
  let fetcher;
272
257
  let options;
273
- if ((arguments.length === 2 && typeof pFetcher === "object") || arguments.length === 1) {
258
+ if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
274
259
  source = true;
275
260
  fetcher = pSource;
276
261
  options = pFetcher || {};
@@ -284,7 +269,7 @@ function createResource(pSource, pFetcher, pOptions) {
284
269
  id = null,
285
270
  loadedUnderTransition = false,
286
271
  scheduled = false,
287
- resolved = "initialValue" in options,
272
+ resolved = ("initialValue" in options),
288
273
  dynamic = typeof source === "function" && createMemo(source);
289
274
  const contexts = new Set(),
290
275
  [value, setValue] = (options.storage || createSignal)(options.initialValue),
@@ -296,19 +281,15 @@ function createResource(pSource, pFetcher, pOptions) {
296
281
  if (sharedConfig.context) {
297
282
  id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
298
283
  let v;
299
- if (options.ssrLoadFrom === "initial") initP = options.initialValue;
300
- 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];
301
285
  }
302
286
  function loadEnd(p, v, error, key) {
303
287
  if (pr === p) {
304
288
  pr = null;
305
289
  key !== undefined && (resolved = true);
306
- if ((p === initP || v === initP) && options.onHydrated)
307
- queueMicrotask(() =>
308
- options.onHydrated(key, {
309
- value: v
310
- })
311
- );
290
+ if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
291
+ value: v
292
+ }));
312
293
  initP = NO_INIT;
313
294
  if (Transition && p && loadedUnderTransition) {
314
295
  Transition.promises.delete(p);
@@ -331,7 +312,7 @@ function createResource(pSource, pFetcher, pOptions) {
331
312
  }, false);
332
313
  }
333
314
  function read() {
334
- const c = SuspenseContext && lookup(Owner, SuspenseContext.id),
315
+ const c = SuspenseContext && useContext(SuspenseContext),
335
316
  v = value(),
336
317
  err = error();
337
318
  if (err !== undefined && !pr) throw err;
@@ -339,8 +320,7 @@ function createResource(pSource, pFetcher, pOptions) {
339
320
  createComputed(() => {
340
321
  track();
341
322
  if (pr) {
342
- if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
343
- else if (!contexts.has(c)) {
323
+ if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
344
324
  c.increment();
345
325
  contexts.add(c);
346
326
  }
@@ -359,30 +339,22 @@ function createResource(pSource, pFetcher, pOptions) {
359
339
  return;
360
340
  }
361
341
  if (Transition && pr) Transition.promises.delete(pr);
362
- const p =
363
- initP !== NO_INIT
364
- ? initP
365
- : untrack(() =>
366
- fetcher(lookup, {
367
- value: value(),
368
- refetching
369
- })
370
- );
342
+ const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
343
+ value: value(),
344
+ refetching
345
+ }));
371
346
  if (typeof p !== "object" || !(p && "then" in p)) {
372
347
  loadEnd(pr, p, undefined, lookup);
373
348
  return p;
374
349
  }
375
350
  pr = p;
376
351
  scheduled = true;
377
- queueMicrotask(() => (scheduled = false));
352
+ queueMicrotask(() => scheduled = false);
378
353
  runUpdates(() => {
379
354
  setState(resolved ? "refreshing" : "pending");
380
355
  trigger();
381
356
  }, false);
382
- return p.then(
383
- v => loadEnd(p, v, undefined, lookup),
384
- e => loadEnd(p, undefined, castError(e), lookup)
385
- );
357
+ return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
386
358
  }
387
359
  Object.defineProperties(read, {
388
360
  state: {
@@ -406,35 +378,21 @@ function createResource(pSource, pFetcher, pOptions) {
406
378
  }
407
379
  }
408
380
  });
409
- if (dynamic) createComputed(() => load(false));
410
- else load(false);
411
- return [
412
- read,
413
- {
414
- refetch: load,
415
- mutate: setValue
416
- }
417
- ];
381
+ if (dynamic) createComputed(() => load(false));else load(false);
382
+ return [read, {
383
+ refetch: load,
384
+ mutate: setValue
385
+ }];
418
386
  }
419
387
  function createDeferred(source, options) {
420
388
  let t,
421
389
  timeout = options ? options.timeoutMs : undefined;
422
- const node = createComputation(
423
- () => {
424
- if (!t || !t.fn)
425
- t = requestCallback(
426
- () => setDeferred(() => node.value),
427
- timeout !== undefined
428
- ? {
429
- timeout
430
- }
431
- : undefined
432
- );
433
- return source();
434
- },
435
- undefined,
436
- true
437
- );
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);
438
396
  const [deferred, setDeferred] = createSignal(node.value, options);
439
397
  updateComputation(node);
440
398
  setDeferred(() => node.value);
@@ -442,40 +400,28 @@ function createDeferred(source, options) {
442
400
  }
443
401
  function createSelector(source, fn = equalFn, options) {
444
402
  const subs = new Map();
445
- const node = createComputation(
446
- p => {
447
- const v = source();
448
- for (const [key, val] of subs.entries())
449
- if (fn(key, v) !== fn(key, p)) {
450
- for (const c of val.values()) {
451
- c.state = STALE;
452
- if (c.pure) Updates.push(c);
453
- else Effects.push(c);
454
- }
455
- }
456
- return v;
457
- },
458
- undefined,
459
- true,
460
- STALE,
461
- options
462
- );
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 );
463
413
  updateComputation(node);
464
414
  return key => {
465
415
  const listener = Listener;
466
416
  if (listener) {
467
417
  let l;
468
- if ((l = subs.get(key))) l.add(listener);
469
- 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]));
470
419
  onCleanup(() => {
471
420
  l.delete(listener);
472
421
  !l.size && subs.delete(key);
473
422
  });
474
423
  }
475
- return fn(
476
- key,
477
- Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
478
- );
424
+ return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
479
425
  };
480
426
  }
481
427
  function batch(fn) {
@@ -514,16 +460,14 @@ function onMount(fn) {
514
460
  createEffect(() => untrack(fn));
515
461
  }
516
462
  function onCleanup(fn) {
517
- if (Owner === null)
518
- console.warn("cleanups created outside a `createRoot` or `render` will never be run");
519
- else if (Owner.cleanups === null) Owner.cleanups = [fn];
520
- 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);
521
464
  return fn;
522
465
  }
523
466
  function catchError(fn, handler) {
524
467
  ERROR || (ERROR = Symbol("error"));
525
468
  Owner = createComputation(undefined, undefined, true);
526
469
  Owner.context = {
470
+ ...Owner.context,
527
471
  [ERROR]: [handler]
528
472
  };
529
473
  if (Transition && Transition.running) Transition.sources.add(Owner);
@@ -535,17 +479,6 @@ function catchError(fn, handler) {
535
479
  Owner = Owner.owner;
536
480
  }
537
481
  }
538
- function onError(fn) {
539
- ERROR || (ERROR = Symbol("error"));
540
- if (Owner === null)
541
- console.warn("error handlers created outside a `createRoot` or `render` will never be run");
542
- else if (Owner.context === null)
543
- Owner.context = {
544
- [ERROR]: [fn]
545
- };
546
- else if (!Owner.context[ERROR]) Owner.context[ERROR] = [fn];
547
- else Owner.context[ERROR].push(fn);
548
- }
549
482
  function getListener() {
550
483
  return Listener;
551
484
  }
@@ -581,17 +514,15 @@ function startTransition(fn) {
581
514
  Owner = o;
582
515
  let t;
583
516
  if (Scheduler || SuspenseContext) {
584
- t =
585
- Transition ||
586
- (Transition = {
587
- sources: new Set(),
588
- effects: [],
589
- promises: new Set(),
590
- disposed: new Set(),
591
- queue: new Set(),
592
- running: true
593
- });
594
- 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));
595
526
  t.running = true;
596
527
  }
597
528
  runUpdates(fn, false);
@@ -607,18 +538,12 @@ function resumeEffects(e) {
607
538
  e.length = 0;
608
539
  }
609
540
  function devComponent(Comp, props) {
610
- const c = createComputation(
611
- () =>
612
- untrack(() => {
613
- Object.assign(Comp, {
614
- [$DEVCOMP]: true
615
- });
616
- return Comp(props);
617
- }),
618
- undefined,
619
- true,
620
- 0
621
- );
541
+ const c = createComputation(() => untrack(() => {
542
+ Object.assign(Comp, {
543
+ [$DEVCOMP]: true
544
+ });
545
+ return Comp(props);
546
+ }), undefined, true, 0);
622
547
  c.props = props;
623
548
  c.observers = null;
624
549
  c.observerSlots = null;
@@ -629,8 +554,7 @@ function devComponent(Comp, props) {
629
554
  }
630
555
  function registerGraph(value) {
631
556
  if (!Owner) return;
632
- if (Owner.sourceMap) Owner.sourceMap.push(value);
633
- else Owner.sourceMap = [value];
557
+ if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
634
558
  value.graph = Owner;
635
559
  }
636
560
  function createContext(defaultValue, options) {
@@ -642,14 +566,13 @@ function createContext(defaultValue, options) {
642
566
  };
643
567
  }
644
568
  function useContext(context) {
645
- let ctx;
646
- return (ctx = lookup(Owner, context.id)) !== undefined ? ctx : context.defaultValue;
569
+ return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
647
570
  }
648
571
  function children(fn) {
649
572
  const children = createMemo(fn);
650
573
  const memo = createMemo(() => resolveChildren(children()), undefined, {
651
574
  name: "children"
652
- });
575
+ }) ;
653
576
  memo.toArray = () => {
654
577
  const c = memo();
655
578
  return Array.isArray(c) ? c : c != null ? [c] : [];
@@ -658,7 +581,7 @@ function children(fn) {
658
581
  }
659
582
  let SuspenseContext;
660
583
  function getSuspenseContext() {
661
- return SuspenseContext || (SuspenseContext = createContext({}));
584
+ return SuspenseContext || (SuspenseContext = createContext());
662
585
  }
663
586
  function enableExternalSource(factory) {
664
587
  if (ExternalSourceFactory) {
@@ -681,8 +604,7 @@ function enableExternalSource(factory) {
681
604
  function readSignal() {
682
605
  const runningTransition = Transition && Transition.running;
683
606
  if (this.sources && (runningTransition ? this.tState : this.state)) {
684
- if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
685
- else {
607
+ if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
686
608
  const updates = Updates;
687
609
  Updates = null;
688
610
  runUpdates(() => lookUpstream(this), false);
@@ -710,12 +632,11 @@ function readSignal() {
710
632
  return this.value;
711
633
  }
712
634
  function writeSignal(node, value, isComp) {
713
- let current =
714
- 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;
715
636
  if (!node.comparator || !node.comparator(current, value)) {
716
637
  if (Transition) {
717
638
  const TransitionRunning = Transition.running;
718
- if (TransitionRunning || (!isComp && Transition.sources.has(node))) {
639
+ if (TransitionRunning || !isComp && Transition.sources.has(node)) {
719
640
  Transition.sources.add(node);
720
641
  node.tValue = value;
721
642
  }
@@ -728,12 +649,10 @@ function writeSignal(node, value, isComp) {
728
649
  const TransitionRunning = Transition && Transition.running;
729
650
  if (TransitionRunning && Transition.disposed.has(o)) continue;
730
651
  if (TransitionRunning ? !o.tState : !o.state) {
731
- if (o.pure) Updates.push(o);
732
- else Effects.push(o);
652
+ if (o.pure) Updates.push(o);else Effects.push(o);
733
653
  if (o.observers) markDownstream(o);
734
654
  }
735
- if (!TransitionRunning) o.state = STALE;
736
- else o.tState = STALE;
655
+ if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
737
656
  }
738
657
  if (Updates.length > 10e5) {
739
658
  Updates = [];
@@ -752,11 +671,7 @@ function updateComputation(node) {
752
671
  listener = Listener,
753
672
  time = ExecCount;
754
673
  Listener = Owner = node;
755
- runComputation(
756
- node,
757
- Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
758
- time
759
- );
674
+ runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
760
675
  if (Transition && !Transition.running && Transition.sources.has(node)) {
761
676
  queueMicrotask(() => {
762
677
  runUpdates(() => {
@@ -810,22 +725,18 @@ function createComputation(fn, init, pure, state = STALE, options) {
810
725
  cleanups: null,
811
726
  value: init,
812
727
  owner: Owner,
813
- context: null,
728
+ context: Owner ? Owner.context : null,
814
729
  pure
815
730
  };
816
731
  if (Transition && Transition.running) {
817
732
  c.state = 0;
818
733
  c.tState = state;
819
734
  }
820
- if (Owner === null)
821
- console.warn("computations created outside a `createRoot` or `render` will never be disposed");
822
- 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) {
823
736
  if (Transition && Transition.running && Owner.pure) {
824
- if (!Owner.tOwned) Owner.tOwned = [c];
825
- else Owner.tOwned.push(c);
737
+ if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
826
738
  } else {
827
- if (!Owner.owned) Owner.owned = [c];
828
- else Owner.owned.push(c);
739
+ if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
829
740
  }
830
741
  }
831
742
  if (options && options.name) c.name = options.name;
@@ -878,8 +789,7 @@ function runUpdates(fn, init) {
878
789
  if (Updates) return fn();
879
790
  let wait = false;
880
791
  if (!init) Updates = [];
881
- if (Effects) wait = true;
882
- else Effects = [];
792
+ if (Effects) wait = true;else Effects = [];
883
793
  ExecCount++;
884
794
  try {
885
795
  const res = fn();
@@ -893,8 +803,7 @@ function runUpdates(fn, init) {
893
803
  }
894
804
  function completeUpdates(wait) {
895
805
  if (Updates) {
896
- if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
897
- else runQueue(Updates);
806
+ if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
898
807
  Updates = null;
899
808
  }
900
809
  if (wait) return;
@@ -934,8 +843,7 @@ function completeUpdates(wait) {
934
843
  }
935
844
  const e = Effects;
936
845
  Effects = null;
937
- if (e.length) runUpdates(() => runEffects(e), false);
938
- else DevHooks.afterUpdate && DevHooks.afterUpdate();
846
+ if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
939
847
  if (res) res();
940
848
  }
941
849
  function runQueue(queue) {
@@ -963,8 +871,7 @@ function runUserEffects(queue) {
963
871
  userLength = 0;
964
872
  for (i = 0; i < queue.length; i++) {
965
873
  const e = queue[i];
966
- if (!e.user) runTop(e);
967
- else queue[userLength++] = e;
874
+ if (!e.user) runTop(e);else queue[userLength++] = e;
968
875
  }
969
876
  if (sharedConfig.context) {
970
877
  if (sharedConfig.count) {
@@ -982,15 +889,13 @@ function runUserEffects(queue) {
982
889
  }
983
890
  function lookUpstream(node, ignore) {
984
891
  const runningTransition = Transition && Transition.running;
985
- if (runningTransition) node.tState = 0;
986
- else node.state = 0;
892
+ if (runningTransition) node.tState = 0;else node.state = 0;
987
893
  for (let i = 0; i < node.sources.length; i += 1) {
988
894
  const source = node.sources[i];
989
895
  if (source.sources) {
990
896
  const state = runningTransition ? source.tState : source.state;
991
897
  if (state === STALE) {
992
- if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
993
- runTop(source);
898
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
994
899
  } else if (state === PENDING) lookUpstream(source, ignore);
995
900
  }
996
901
  }
@@ -1000,10 +905,8 @@ function markDownstream(node) {
1000
905
  for (let i = 0; i < node.observers.length; i += 1) {
1001
906
  const o = node.observers[i];
1002
907
  if (runningTransition ? !o.tState : !o.state) {
1003
- if (runningTransition) o.tState = PENDING;
1004
- else o.state = PENDING;
1005
- if (o.pure) Updates.push(o);
1006
- 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);
1007
910
  o.observers && markDownstream(o);
1008
911
  }
1009
912
  }
@@ -1040,9 +943,7 @@ function cleanNode(node) {
1040
943
  for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
1041
944
  node.cleanups = null;
1042
945
  }
1043
- if (Transition && Transition.running) node.tState = 0;
1044
- else node.state = 0;
1045
- node.context = null;
946
+ if (Transition && Transition.running) node.tState = 0;else node.state = 0;
1046
947
  delete node.sourceMap;
1047
948
  }
1048
949
  function reset(node, top) {
@@ -1064,28 +965,19 @@ function runErrors(err, fns, owner) {
1064
965
  try {
1065
966
  for (const f of fns) f(err);
1066
967
  } catch (e) {
1067
- handleError(e, (owner && owner.owner) || null);
968
+ handleError(e, owner && owner.owner || null);
1068
969
  }
1069
970
  }
1070
971
  function handleError(err, owner = Owner) {
1071
- const fns = ERROR && lookup(owner, ERROR);
972
+ const fns = ERROR && owner && owner.context && owner.context[ERROR];
1072
973
  const error = castError(err);
1073
974
  if (!fns) throw error;
1074
- if (Effects)
1075
- Effects.push({
1076
- fn() {
1077
- runErrors(error, fns, owner);
1078
- },
1079
- state: STALE
1080
- });
1081
- else runErrors(error, fns, owner);
1082
- }
1083
- function lookup(owner, key) {
1084
- return owner
1085
- ? owner.context && owner.context[key] !== undefined
1086
- ? owner.context[key]
1087
- : lookup(owner.owner, key)
1088
- : undefined;
975
+ if (Effects) Effects.push({
976
+ fn() {
977
+ runErrors(error, fns, owner);
978
+ },
979
+ state: STALE
980
+ });else runErrors(error, fns, owner);
1089
981
  }
1090
982
  function resolveChildren(children) {
1091
983
  if (typeof children === "function" && !children.length) return resolveChildren(children());
@@ -1102,20 +994,40 @@ function resolveChildren(children) {
1102
994
  function createProvider(id, options) {
1103
995
  return function provider(props) {
1104
996
  let res;
1105
- createRenderEffect(
1106
- () =>
1107
- (res = untrack(() => {
1108
- Owner.context = {
1109
- [id]: props.value
1110
- };
1111
- return children(() => props.children);
1112
- })),
1113
- undefined,
1114
- options
1115
- );
997
+ createRenderEffect(() => res = untrack(() => {
998
+ Owner.context = {
999
+ ...Owner.context,
1000
+ [id]: props.value
1001
+ };
1002
+ return children(() => props.children);
1003
+ }), undefined, options);
1116
1004
  return res;
1117
1005
  };
1118
1006
  }
1007
+ function onError(fn) {
1008
+ ERROR || (ERROR = Symbol("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]) {
1010
+ Owner.context = {
1011
+ ...Owner.context,
1012
+ [ERROR]: [fn]
1013
+ };
1014
+ mutateContext(Owner, ERROR, [fn]);
1015
+ } else Owner.context[ERROR].push(fn);
1016
+ }
1017
+ function mutateContext(o, key, value) {
1018
+ if (o.owned) {
1019
+ for (let i = 0; i < o.owned.length; i++) {
1020
+ if (o.owned[i].context === o.context) mutateContext(o.owned[i], key, value);
1021
+ if (!o.owned[i].context) {
1022
+ o.owned[i].context = o.context;
1023
+ mutateContext(o.owned[i], key, value);
1024
+ } else if (!o.owned[i].context[key]) {
1025
+ o.owned[i].context[key] = value;
1026
+ mutateContext(o.owned[i], key, value);
1027
+ }
1028
+ }
1029
+ }
1030
+ }
1119
1031
 
1120
1032
  function observable(input) {
1121
1033
  return {
@@ -1123,8 +1035,7 @@ function observable(input) {
1123
1035
  if (!(observer instanceof Object) || observer == null) {
1124
1036
  throw new TypeError("Expected the observer to be an object.");
1125
1037
  }
1126
- const handler =
1127
- typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1038
+ const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1128
1039
  if (!handler) {
1129
1040
  return {
1130
1041
  unsubscribe() {}
@@ -1155,7 +1066,7 @@ function from(producer) {
1155
1066
  });
1156
1067
  if ("subscribe" in producer) {
1157
1068
  const unsub = producer.subscribe(v => set(() => v));
1158
- onCleanup(() => ("unsubscribe" in unsub ? unsub.unsubscribe() : unsub()));
1069
+ onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
1159
1070
  } else {
1160
1071
  const clean = producer(set);
1161
1072
  onCleanup(clean);
@@ -1207,7 +1118,8 @@ function mapArray(list, mapFn, options = {}) {
1207
1118
  });
1208
1119
  len = 1;
1209
1120
  }
1210
- } else if (len === 0) {
1121
+ }
1122
+ else if (len === 0) {
1211
1123
  mapped = new Array(newLen);
1212
1124
  for (j = 0; j < newLen; j++) {
1213
1125
  items[j] = newItems[j];
@@ -1218,16 +1130,8 @@ function mapArray(list, mapFn, options = {}) {
1218
1130
  temp = new Array(newLen);
1219
1131
  tempdisposers = new Array(newLen);
1220
1132
  indexes && (tempIndexes = new Array(newLen));
1221
- for (
1222
- start = 0, end = Math.min(len, newLen);
1223
- start < end && items[start] === newItems[start];
1224
- start++
1225
- );
1226
- for (
1227
- end = len - 1, newEnd = newLen - 1;
1228
- end >= start && newEnd >= start && items[end] === newItems[newEnd];
1229
- end--, newEnd--
1230
- ) {
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--) {
1231
1135
  temp[newEnd] = mapped[end];
1232
1136
  tempdisposers[newEnd] = disposers[end];
1233
1137
  indexes && (tempIndexes[newEnd] = indexes[end]);
@@ -1261,7 +1165,7 @@ function mapArray(list, mapFn, options = {}) {
1261
1165
  }
1262
1166
  } else mapped[j] = createRoot(mapper);
1263
1167
  }
1264
- mapped = mapped.slice(0, (len = newLen));
1168
+ mapped = mapped.slice(0, len = newLen);
1265
1169
  items = newItems.slice(0);
1266
1170
  }
1267
1171
  return mapped;
@@ -1271,7 +1175,7 @@ function mapArray(list, mapFn, options = {}) {
1271
1175
  if (indexes) {
1272
1176
  const [s, set] = createSignal(j, {
1273
1177
  name: "index"
1274
- });
1178
+ }) ;
1275
1179
  indexes[j] = set;
1276
1180
  return mapFn(newItems[j], s);
1277
1181
  }
@@ -1329,13 +1233,13 @@ function indexArray(list, mapFn, options = {}) {
1329
1233
  }
1330
1234
  len = signals.length = disposers.length = newItems.length;
1331
1235
  items = newItems.slice(0);
1332
- return (mapped = mapped.slice(0, len));
1236
+ return mapped = mapped.slice(0, len);
1333
1237
  });
1334
1238
  function mapper(disposer) {
1335
1239
  disposers[i] = disposer;
1336
1240
  const [s, set] = createSignal(newItems[i], {
1337
1241
  name: "value"
1338
- });
1242
+ }) ;
1339
1243
  signals[i] = set;
1340
1244
  return mapFn(s, i);
1341
1245
  }
@@ -1351,7 +1255,7 @@ function createComponent(Comp, props) {
1351
1255
  if (sharedConfig.context) {
1352
1256
  const c = sharedConfig.context;
1353
1257
  setHydrateContext(nextHydrateContext());
1354
- const r = devComponent(Comp, props || {});
1258
+ const r = devComponent(Comp, props || {}) ;
1355
1259
  setHydrateContext(c);
1356
1260
  return r;
1357
1261
  }
@@ -1400,33 +1304,29 @@ function mergeProps(...sources) {
1400
1304
  let proxy = false;
1401
1305
  for (let i = 0; i < sources.length; i++) {
1402
1306
  const s = sources[i];
1403
- proxy = proxy || (!!s && $PROXY in s);
1404
- sources[i] = typeof s === "function" ? ((proxy = true), createMemo(s)) : s;
1307
+ proxy = proxy || !!s && $PROXY in s;
1308
+ sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
1405
1309
  }
1406
1310
  if (proxy) {
1407
- return new Proxy(
1408
- {
1409
- get(property) {
1410
- for (let i = sources.length - 1; i >= 0; i--) {
1411
- const v = resolveSource(sources[i])[property];
1412
- if (v !== undefined) return v;
1413
- }
1414
- },
1415
- has(property) {
1416
- for (let i = sources.length - 1; i >= 0; i--) {
1417
- if (property in resolveSource(sources[i])) return true;
1418
- }
1419
- return false;
1420
- },
1421
- keys() {
1422
- const keys = [];
1423
- for (let i = 0; i < sources.length; i++)
1424
- keys.push(...Object.keys(resolveSource(sources[i])));
1425
- 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;
1426
1316
  }
1427
1317
  },
1428
- propTraps
1429
- );
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);
1430
1330
  }
1431
1331
  const target = {};
1432
1332
  const sourcesMap = {};
@@ -1445,7 +1345,7 @@ function mergeProps(...sources) {
1445
1345
  Object.defineProperty(target, key, {
1446
1346
  enumerable: true,
1447
1347
  configurable: true,
1448
- get: resolveSources.bind((sourcesMap[key] = [desc.get.bind(source)]))
1348
+ get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
1449
1349
  });
1450
1350
  } else {
1451
1351
  if (desc.value !== undefined) defined.add(key);
@@ -1469,60 +1369,47 @@ function splitProps(props, ...keys) {
1469
1369
  if ($PROXY in props) {
1470
1370
  const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
1471
1371
  const res = keys.map(k => {
1472
- return new Proxy(
1473
- {
1474
- get(property) {
1475
- return k.includes(property) ? props[property] : undefined;
1476
- },
1477
- has(property) {
1478
- return k.includes(property) && property in props;
1479
- },
1480
- keys() {
1481
- return k.filter(property => property in props);
1482
- }
1372
+ return new Proxy({
1373
+ get(property) {
1374
+ return k.includes(property) ? props[property] : undefined;
1483
1375
  },
1484
- propTraps
1485
- );
1486
- });
1487
- res.push(
1488
- new Proxy(
1489
- {
1490
- get(property) {
1491
- return blocked.has(property) ? undefined : props[property];
1492
- },
1493
- has(property) {
1494
- return blocked.has(property) ? false : property in props;
1495
- },
1496
- keys() {
1497
- return Object.keys(props).filter(k => !blocked.has(k));
1498
- }
1376
+ has(property) {
1377
+ return k.includes(property) && property in props;
1499
1378
  },
1500
- propTraps
1501
- )
1502
- );
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));
1503
1395
  return res;
1504
1396
  }
1505
1397
  const otherObject = {};
1506
1398
  const objects = keys.map(() => ({}));
1507
1399
  for (const propName of Object.getOwnPropertyNames(props)) {
1508
1400
  const desc = Object.getOwnPropertyDescriptor(props, propName);
1509
- const isDefaultDesc =
1510
- !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1401
+ const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1511
1402
  let blocked = false;
1512
1403
  let objectIndex = 0;
1513
1404
  for (const k of keys) {
1514
1405
  if (k.includes(propName)) {
1515
1406
  blocked = true;
1516
- isDefaultDesc
1517
- ? (objects[objectIndex][propName] = desc.value)
1518
- : Object.defineProperty(objects[objectIndex], propName, desc);
1407
+ isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
1519
1408
  }
1520
1409
  ++objectIndex;
1521
1410
  }
1522
1411
  if (!blocked) {
1523
- isDefaultDesc
1524
- ? (otherObject[propName] = desc.value)
1525
- : Object.defineProperty(otherObject, propName, desc);
1412
+ isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
1526
1413
  }
1527
1414
  }
1528
1415
  return [...objects, otherObject];
@@ -1548,24 +1435,19 @@ function lazy(fn) {
1548
1435
  comp = s;
1549
1436
  }
1550
1437
  let Comp;
1551
- return createMemo(
1552
- () =>
1553
- (Comp = comp()) &&
1554
- untrack(() => {
1555
- if (true)
1556
- Object.assign(Comp, {
1557
- [$DEVCOMP]: true
1558
- });
1559
- if (!ctx) return Comp(props);
1560
- const c = sharedConfig.context;
1561
- setHydrateContext(ctx);
1562
- const r = Comp(props);
1563
- setHydrateContext(c);
1564
- return r;
1565
- })
1566
- );
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
+ }));
1567
1449
  };
1568
- wrap.preload = () => p || ((p = fn()).then(mod => (comp = () => mod.default)), p);
1450
+ wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
1569
1451
  return wrap;
1570
1452
  }
1571
1453
  let counter = 0;
@@ -1574,113 +1456,75 @@ function createUniqueId() {
1574
1456
  return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1575
1457
  }
1576
1458
 
1577
- const narrowedError = name =>
1578
- `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.` ;
1579
1460
  function For(props) {
1580
1461
  const fallback = "fallback" in props && {
1581
1462
  fallback: () => props.fallback
1582
1463
  };
1583
- return createMemo(
1584
- mapArray(() => props.each, props.children, fallback || undefined),
1585
- undefined,
1586
- {
1587
- name: "value"
1588
- }
1589
- );
1464
+ return createMemo(mapArray(() => props.each, props.children, fallback || undefined), undefined, {
1465
+ name: "value"
1466
+ }) ;
1590
1467
  }
1591
1468
  function Index(props) {
1592
1469
  const fallback = "fallback" in props && {
1593
1470
  fallback: () => props.fallback
1594
1471
  };
1595
- return createMemo(
1596
- indexArray(() => props.each, props.children, fallback || undefined),
1597
- undefined,
1598
- {
1599
- name: "value"
1600
- }
1601
- );
1472
+ return createMemo(indexArray(() => props.each, props.children, fallback || undefined), undefined, {
1473
+ name: "value"
1474
+ }) ;
1602
1475
  }
1603
1476
  function Show(props) {
1604
1477
  const keyed = props.keyed;
1605
1478
  const condition = createMemo(() => props.when, undefined, {
1606
- equals: (a, b) => (keyed ? a === b : !a === !b),
1479
+ equals: (a, b) => keyed ? a === b : !a === !b,
1607
1480
  name: "condition"
1608
- });
1609
- return createMemo(
1610
- () => {
1611
- const c = condition();
1612
- if (c) {
1613
- const child = props.children;
1614
- const fn = typeof child === "function" && child.length > 0;
1615
- return fn
1616
- ? untrack(() =>
1617
- child(
1618
- keyed
1619
- ? c
1620
- : () => {
1621
- if (!untrack(condition)) throw narrowedError("Show");
1622
- return props.when;
1623
- }
1624
- )
1625
- )
1626
- : child;
1627
- }
1628
- return props.fallback;
1629
- },
1630
- undefined,
1631
- {
1632
- 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;
1633
1491
  }
1634
- );
1492
+ return props.fallback;
1493
+ }, undefined, {
1494
+ name: "value"
1495
+ } );
1635
1496
  }
1636
1497
  function Switch(props) {
1637
1498
  let keyed = false;
1638
- const equals = (a, b) =>
1639
- 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];
1640
1500
  const conditions = children(() => props.children),
1641
- evalConditions = createMemo(
1642
- () => {
1643
- let conds = conditions();
1644
- if (!Array.isArray(conds)) conds = [conds];
1645
- for (let i = 0; i < conds.length; i++) {
1646
- const c = conds[i].when;
1647
- if (c) {
1648
- keyed = !!conds[i].keyed;
1649
- return [i, c, conds[i]];
1650
- }
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]];
1651
1509
  }
1652
- return [-1];
1653
- },
1654
- undefined,
1655
- {
1656
- equals,
1657
- name: "eval conditions"
1658
1510
  }
1659
- );
1660
- return createMemo(
1661
- () => {
1662
- const [index, when, cond] = evalConditions();
1663
- if (index < 0) return props.fallback;
1664
- const c = cond.children;
1665
- const fn = typeof c === "function" && c.length > 0;
1666
- return fn
1667
- ? untrack(() =>
1668
- c(
1669
- keyed
1670
- ? when
1671
- : () => {
1672
- if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1673
- return cond.when;
1674
- }
1675
- )
1676
- )
1677
- : c;
1678
- },
1679
- undefined,
1680
- {
1681
- name: "value"
1682
- }
1683
- );
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
+ } );
1684
1528
  }
1685
1529
  function Match(props) {
1686
1530
  return props;
@@ -1692,37 +1536,27 @@ function resetErrorBoundaries() {
1692
1536
  function ErrorBoundary(props) {
1693
1537
  let err;
1694
1538
  let v;
1695
- if (
1696
- sharedConfig.context &&
1697
- sharedConfig.load &&
1698
- (v = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count))
1699
- )
1700
- err = v[0];
1539
+ if (sharedConfig.context && sharedConfig.load && (v = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count))) err = v[0];
1701
1540
  const [errored, setErrored] = createSignal(err, {
1702
1541
  name: "errored"
1703
- });
1542
+ } );
1704
1543
  Errors || (Errors = new Set());
1705
1544
  Errors.add(setErrored);
1706
1545
  onCleanup(() => Errors.delete(setErrored));
1707
- return createMemo(
1708
- () => {
1709
- let e;
1710
- if ((e = errored())) {
1711
- const f = props.fallback;
1712
- if (typeof f !== "function" || f.length == 0) console.error(e);
1713
- return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1714
- }
1715
- return catchError(() => props.children, setErrored);
1716
- },
1717
- undefined,
1718
- {
1719
- 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;
1720
1552
  }
1721
- );
1553
+ return catchError(() => props.children, setErrored);
1554
+ }, undefined, {
1555
+ name: "value"
1556
+ } );
1722
1557
  }
1723
1558
 
1724
- const suspenseListEquals = (a, b) =>
1725
- a.showContent === b.showContent && a.showFallback === b.showFallback;
1559
+ const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
1726
1560
  const SuspenseListContext = createContext();
1727
1561
  function SuspenseList(props) {
1728
1562
  let [wrapper, setWrapper] = createSignal(() => ({
@@ -1734,51 +1568,51 @@ function SuspenseList(props) {
1734
1568
  if (listContext) {
1735
1569
  show = listContext.register(createMemo(() => wrapper()().inFallback));
1736
1570
  }
1737
- const resolved = createMemo(
1738
- prev => {
1739
- const reveal = props.revealOrder,
1740
- tail = props.tail,
1741
- { showContent = true, showFallback = true } = show ? show() : {},
1742
- reg = registry(),
1743
- reverse = reveal === "backwards";
1744
- if (reveal === "together") {
1745
- const all = reg.every(inFallback => !inFallback());
1746
- const res = reg.map(() => ({
1747
- showContent: all && showContent,
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,
1748
1598
  showFallback
1749
- }));
1750
- res.inFallback = !all;
1751
- return res;
1752
- }
1753
- let stop = false;
1754
- let inFallback = prev.inFallback;
1755
- const res = [];
1756
- for (let i = 0, len = reg.length; i < len; i++) {
1757
- const n = reverse ? len - i - 1 : i,
1758
- s = reg[n]();
1759
- if (!stop && !s) {
1760
- res[n] = {
1761
- showContent,
1762
- showFallback
1763
- };
1764
- } else {
1765
- const next = !stop;
1766
- if (next) inFallback = true;
1767
- res[n] = {
1768
- showContent: next,
1769
- showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
1770
- };
1771
- stop = true;
1772
- }
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;
1773
1608
  }
1774
- if (!stop) inFallback = false;
1775
- res.inFallback = inFallback;
1776
- return res;
1777
- },
1778
- {
1779
- inFallback: false
1780
1609
  }
1781
- );
1610
+ if (!stop) inFallback = false;
1611
+ res.inFallback = inFallback;
1612
+ return res;
1613
+ }, {
1614
+ inFallback: false
1615
+ });
1782
1616
  setWrapper(() => resolved);
1783
1617
  return createComponent(SuspenseListContext.Provider, {
1784
1618
  value: {
@@ -1852,14 +1686,17 @@ function Suspense(props) {
1852
1686
  ctx = sharedConfig.context;
1853
1687
  if (flicker) {
1854
1688
  flicker();
1855
- return (flicker = undefined);
1689
+ return flicker = undefined;
1856
1690
  }
1857
1691
  if (ctx && p === "$$f") setHydrateContext();
1858
1692
  const rendered = createMemo(() => props.children);
1859
1693
  return createMemo(prev => {
1860
1694
  const inFallback = store.inFallback(),
1861
- { showContent = true, showFallback = true } = show ? show() : {};
1862
- if ((!inFallback || (p && p !== "$$f")) && showContent) {
1695
+ {
1696
+ showContent = true,
1697
+ showFallback = true
1698
+ } = show ? show() : {};
1699
+ if ((!inFallback || p && p !== "$$f") && showContent) {
1863
1700
  store.resolved = true;
1864
1701
  dispose && dispose();
1865
1702
  dispose = ctx = p = undefined;
@@ -1889,68 +1726,9 @@ const DEV = {
1889
1726
  hooks: DevHooks,
1890
1727
  writeSignal,
1891
1728
  registerGraph
1892
- };
1729
+ } ;
1893
1730
  if (globalThis) {
1894
- if (!globalThis.Solid$$) globalThis.Solid$$ = true;
1895
- else
1896
- console.warn(
1897
- "You appear to have multiple instances of Solid. This can lead to unexpected behavior."
1898
- );
1731
+ if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
1899
1732
  }
1900
1733
 
1901
- export {
1902
- $DEVCOMP,
1903
- $PROXY,
1904
- $TRACK,
1905
- DEV,
1906
- ErrorBoundary,
1907
- For,
1908
- Index,
1909
- Match,
1910
- Show,
1911
- Suspense,
1912
- SuspenseList,
1913
- Switch,
1914
- batch,
1915
- cancelCallback,
1916
- catchError,
1917
- children,
1918
- createComponent,
1919
- createComputed,
1920
- createContext,
1921
- createDeferred,
1922
- createEffect,
1923
- createMemo,
1924
- createReaction,
1925
- createRenderEffect,
1926
- createResource,
1927
- createRoot,
1928
- createSelector,
1929
- createSignal,
1930
- createUniqueId,
1931
- enableExternalSource,
1932
- enableHydration,
1933
- enableScheduling,
1934
- equalFn,
1935
- from,
1936
- getListener,
1937
- getOwner,
1938
- indexArray,
1939
- lazy,
1940
- mapArray,
1941
- mergeProps,
1942
- observable,
1943
- on,
1944
- onCleanup,
1945
- onError,
1946
- onMount,
1947
- requestCallback,
1948
- resetErrorBoundaries,
1949
- runWithOwner,
1950
- sharedConfig,
1951
- splitProps,
1952
- startTransition,
1953
- untrack,
1954
- useContext,
1955
- useTransition
1956
- };
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 };