solid-js 1.8.17 → 1.8.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +223 -223
  2. package/dist/dev.cjs +29 -24
  3. package/dist/dev.js +344 -580
  4. package/dist/server.cjs +31 -18
  5. package/dist/server.js +103 -185
  6. package/dist/solid.cjs +29 -24
  7. package/dist/solid.js +302 -507
  8. package/h/dist/h.cjs +12 -1
  9. package/h/dist/h.js +19 -34
  10. package/h/jsx-runtime/dist/jsx.js +1 -1
  11. package/h/jsx-runtime/types/index.d.ts +8 -11
  12. package/h/jsx-runtime/types/jsx.d.ts +5 -0
  13. package/h/types/hyperscript.d.ts +11 -11
  14. package/html/dist/html.js +94 -216
  15. package/html/types/lit.d.ts +33 -47
  16. package/package.json +3 -3
  17. package/store/dist/dev.js +43 -122
  18. package/store/dist/server.js +8 -19
  19. package/store/dist/store.js +40 -113
  20. package/store/types/index.d.ts +7 -21
  21. package/store/types/modifiers.d.ts +3 -6
  22. package/store/types/mutable.d.ts +2 -5
  23. package/store/types/server.d.ts +4 -12
  24. package/store/types/store.d.ts +62 -219
  25. package/types/index.d.ts +10 -75
  26. package/types/jsx.d.ts +5 -0
  27. package/types/reactive/array.d.ts +6 -14
  28. package/types/reactive/observable.d.ts +18 -26
  29. package/types/reactive/scheduler.d.ts +6 -9
  30. package/types/reactive/signal.d.ts +164 -255
  31. package/types/render/Suspense.d.ts +7 -7
  32. package/types/render/component.d.ts +33 -64
  33. package/types/render/flow.d.ts +37 -49
  34. package/types/render/hydration.d.ts +15 -13
  35. package/types/server/index.d.ts +2 -57
  36. package/types/server/reactive.d.ts +42 -73
  37. package/types/server/rendering.d.ts +99 -168
  38. package/universal/dist/dev.js +12 -28
  39. package/universal/dist/universal.js +12 -28
  40. package/universal/types/index.d.ts +1 -3
  41. package/universal/types/universal.d.ts +1 -0
  42. package/web/dist/dev.cjs +6 -4
  43. package/web/dist/dev.js +88 -630
  44. package/web/dist/server.cjs +6 -6
  45. package/web/dist/server.js +102 -216
  46. package/web/dist/web.cjs +6 -4
  47. package/web/dist/web.js +86 -621
  48. package/web/storage/dist/storage.js +3 -3
  49. package/web/types/client.d.ts +2 -2
  50. package/web/types/core.d.ts +1 -10
  51. package/web/types/index.d.ts +12 -29
  52. 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 = (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
  }
@@ -118,15 +116,26 @@ function workLoop(hasTimeRemaining, initialTime) {
118
116
 
119
117
  const sharedConfig = {
120
118
  context: undefined,
121
- registry: undefined
119
+ registry: undefined,
120
+ getContextId() {
121
+ return getContextId(this.context.count);
122
+ },
123
+ getNextContextId() {
124
+ return getContextId(this.context.count++);
125
+ }
122
126
  };
127
+ function getContextId(count) {
128
+ const num = String(count),
129
+ len = num.length - 1;
130
+ return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
131
+ }
123
132
  function setHydrateContext(context) {
124
133
  sharedConfig.context = context;
125
134
  }
126
135
  function nextHydrateContext() {
127
136
  return {
128
137
  ...sharedConfig.context,
129
- id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
138
+ id: sharedConfig.getNextContextId(),
130
139
  count: 0
131
140
  };
132
141
  }
@@ -167,25 +176,20 @@ function createRoot(fn, detachedOwner) {
167
176
  owner = Owner,
168
177
  unowned = fn.length === 0,
169
178
  current = detachedOwner === undefined ? owner : detachedOwner,
170
- root = unowned
171
- ? {
172
- owned: null,
173
- cleanups: null,
174
- context: null,
175
- owner: null
176
- }
177
- : {
178
- owned: null,
179
- cleanups: null,
180
- context: current ? current.context : null,
181
- owner: current
182
- },
183
- updateFn = unowned
184
- ? () =>
185
- fn(() => {
186
- throw new Error("Dispose method must be an explicit argument to createRoot function");
187
- })
188
- : () => fn(() => untrack(() => cleanNode(root)));
179
+ root = unowned ? {
180
+ owned: null,
181
+ cleanups: null,
182
+ context: null,
183
+ owner: null
184
+ } : {
185
+ owned: null,
186
+ cleanups: null,
187
+ context: current ? current.context : null,
188
+ owner: current
189
+ },
190
+ updateFn = unowned ? () => fn(() => {
191
+ throw new Error("Dispose method must be an explicit argument to createRoot function");
192
+ }) : () => fn(() => untrack(() => cleanNode(root)));
189
193
  DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(root);
190
194
  Owner = root;
191
195
  Listener = null;
@@ -211,26 +215,23 @@ function createSignal(value, options) {
211
215
  }
212
216
  const setter = value => {
213
217
  if (typeof value === "function") {
214
- if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
215
- else value = value(s.value);
218
+ if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
216
219
  }
217
220
  return writeSignal(s, value);
218
221
  };
219
222
  return [readSignal.bind(s), setter];
220
223
  }
221
224
  function createComputed(fn, value, options) {
222
- const c = createComputation(fn, value, true, STALE, options);
223
- if (Scheduler && Transition && Transition.running) Updates.push(c);
224
- else updateComputation(c);
225
+ const c = createComputation(fn, value, true, STALE, options );
226
+ if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
225
227
  }
226
228
  function createRenderEffect(fn, value, options) {
227
- const c = createComputation(fn, value, false, STALE, options);
228
- if (Scheduler && Transition && Transition.running) Updates.push(c);
229
- else updateComputation(c);
229
+ const c = createComputation(fn, value, false, STALE, options );
230
+ if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
230
231
  }
231
232
  function createEffect(fn, value, options) {
232
233
  runEffects = runUserEffects;
233
- const c = createComputation(fn, value, false, STALE, options),
234
+ const c = createComputation(fn, value, false, STALE, options ),
234
235
  s = SuspenseContext && useContext(SuspenseContext);
235
236
  if (s) c.suspense = s;
236
237
  if (!options || !options.render) c.user = true;
@@ -238,16 +239,10 @@ function createEffect(fn, value, options) {
238
239
  }
239
240
  function createReaction(onInvalidate, options) {
240
241
  let fn;
241
- const c = createComputation(
242
- () => {
243
- fn ? fn() : untrack(onInvalidate);
244
- fn = undefined;
245
- },
246
- undefined,
247
- false,
248
- 0,
249
- options
250
- ),
242
+ const c = createComputation(() => {
243
+ fn ? fn() : untrack(onInvalidate);
244
+ fn = undefined;
245
+ }, undefined, false, 0, options ),
251
246
  s = SuspenseContext && useContext(SuspenseContext);
252
247
  if (s) c.suspense = s;
253
248
  c.user = true;
@@ -258,7 +253,7 @@ function createReaction(onInvalidate, options) {
258
253
  }
259
254
  function createMemo(fn, value, options) {
260
255
  options = options ? Object.assign({}, signalOptions, options) : signalOptions;
261
- const c = createComputation(fn, value, true, 0, options);
256
+ const c = createComputation(fn, value, true, 0, options );
262
257
  c.observers = null;
263
258
  c.observerSlots = null;
264
259
  c.comparator = options.equals || undefined;
@@ -275,7 +270,7 @@ function createResource(pSource, pFetcher, pOptions) {
275
270
  let source;
276
271
  let fetcher;
277
272
  let options;
278
- if ((arguments.length === 2 && typeof pFetcher === "object") || arguments.length === 1) {
273
+ if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
279
274
  source = true;
280
275
  fetcher = pSource;
281
276
  options = pFetcher || {};
@@ -289,7 +284,7 @@ function createResource(pSource, pFetcher, pOptions) {
289
284
  id = null,
290
285
  loadedUnderTransition = false,
291
286
  scheduled = false,
292
- resolved = "initialValue" in options,
287
+ resolved = ("initialValue" in options),
293
288
  dynamic = typeof source === "function" && createMemo(source);
294
289
  const contexts = new Set(),
295
290
  [value, setValue] = (options.storage || createSignal)(options.initialValue),
@@ -299,21 +294,17 @@ function createResource(pSource, pFetcher, pOptions) {
299
294
  }),
300
295
  [state, setState] = createSignal(resolved ? "ready" : "unresolved");
301
296
  if (sharedConfig.context) {
302
- id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
297
+ id = sharedConfig.getNextContextId();
303
298
  let v;
304
- if (options.ssrLoadFrom === "initial") initP = options.initialValue;
305
- else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
299
+ if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
306
300
  }
307
301
  function loadEnd(p, v, error, key) {
308
302
  if (pr === p) {
309
303
  pr = null;
310
304
  key !== undefined && (resolved = true);
311
- if ((p === initP || v === initP) && options.onHydrated)
312
- queueMicrotask(() =>
313
- options.onHydrated(key, {
314
- value: v
315
- })
316
- );
305
+ if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
306
+ value: v
307
+ }));
317
308
  initP = NO_INIT;
318
309
  if (Transition && p && loadedUnderTransition) {
319
310
  Transition.promises.delete(p);
@@ -344,8 +335,7 @@ function createResource(pSource, pFetcher, pOptions) {
344
335
  createComputed(() => {
345
336
  track();
346
337
  if (pr) {
347
- if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
348
- else if (!contexts.has(c)) {
338
+ if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
349
339
  c.increment();
350
340
  contexts.add(c);
351
341
  }
@@ -364,35 +354,26 @@ function createResource(pSource, pFetcher, pOptions) {
364
354
  return;
365
355
  }
366
356
  if (Transition && pr) Transition.promises.delete(pr);
367
- const p =
368
- initP !== NO_INIT
369
- ? initP
370
- : untrack(() =>
371
- fetcher(lookup, {
372
- value: value(),
373
- refetching
374
- })
375
- );
357
+ const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
358
+ value: value(),
359
+ refetching
360
+ }));
376
361
  if (!isPromise(p)) {
377
362
  loadEnd(pr, p, undefined, lookup);
378
363
  return p;
379
364
  }
380
365
  pr = p;
381
366
  if ("value" in p) {
382
- if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
383
- else loadEnd(pr, undefined, undefined, lookup);
367
+ if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, castError(p.value), lookup);
384
368
  return p;
385
369
  }
386
370
  scheduled = true;
387
- queueMicrotask(() => (scheduled = false));
371
+ queueMicrotask(() => scheduled = false);
388
372
  runUpdates(() => {
389
373
  setState(resolved ? "refreshing" : "pending");
390
374
  trigger();
391
375
  }, false);
392
- return p.then(
393
- v => loadEnd(p, v, undefined, lookup),
394
- e => loadEnd(p, undefined, castError(e), lookup)
395
- );
376
+ return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
396
377
  }
397
378
  Object.defineProperties(read, {
398
379
  state: {
@@ -416,81 +397,50 @@ function createResource(pSource, pFetcher, pOptions) {
416
397
  }
417
398
  }
418
399
  });
419
- if (dynamic) createComputed(() => load(false));
420
- else load(false);
421
- return [
422
- read,
423
- {
424
- refetch: load,
425
- mutate: setValue
426
- }
427
- ];
400
+ if (dynamic) createComputed(() => load(false));else load(false);
401
+ return [read, {
402
+ refetch: load,
403
+ mutate: setValue
404
+ }];
428
405
  }
429
406
  function createDeferred(source, options) {
430
407
  let t,
431
408
  timeout = options ? options.timeoutMs : undefined;
432
- const node = createComputation(
433
- () => {
434
- if (!t || !t.fn)
435
- t = requestCallback(
436
- () => setDeferred(() => node.value),
437
- timeout !== undefined
438
- ? {
439
- timeout
440
- }
441
- : undefined
442
- );
443
- return source();
444
- },
445
- undefined,
446
- true
447
- );
448
- const [deferred, setDeferred] = createSignal(
449
- Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
450
- options
451
- );
409
+ const node = createComputation(() => {
410
+ if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
411
+ timeout
412
+ } : undefined);
413
+ return source();
414
+ }, undefined, true);
415
+ const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);
452
416
  updateComputation(node);
453
- setDeferred(() =>
454
- Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
455
- );
417
+ setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
456
418
  return deferred;
457
419
  }
458
420
  function createSelector(source, fn = equalFn, options) {
459
421
  const subs = new Map();
460
- const node = createComputation(
461
- p => {
462
- const v = source();
463
- for (const [key, val] of subs.entries())
464
- if (fn(key, v) !== fn(key, p)) {
465
- for (const c of val.values()) {
466
- c.state = STALE;
467
- if (c.pure) Updates.push(c);
468
- else Effects.push(c);
469
- }
470
- }
471
- return v;
472
- },
473
- undefined,
474
- true,
475
- STALE,
476
- options
477
- );
422
+ const node = createComputation(p => {
423
+ const v = source();
424
+ for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
425
+ for (const c of val.values()) {
426
+ c.state = STALE;
427
+ if (c.pure) Updates.push(c);else Effects.push(c);
428
+ }
429
+ }
430
+ return v;
431
+ }, undefined, true, STALE, options );
478
432
  updateComputation(node);
479
433
  return key => {
480
434
  const listener = Listener;
481
435
  if (listener) {
482
436
  let l;
483
- if ((l = subs.get(key))) l.add(listener);
484
- else subs.set(key, (l = new Set([listener])));
437
+ if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
485
438
  onCleanup(() => {
486
439
  l.delete(listener);
487
440
  !l.size && subs.delete(key);
488
441
  });
489
442
  }
490
- return fn(
491
- key,
492
- Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
493
- );
443
+ return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
494
444
  };
495
445
  }
496
446
  function batch(fn) {
@@ -530,10 +480,7 @@ function onMount(fn) {
530
480
  createEffect(() => untrack(fn));
531
481
  }
532
482
  function onCleanup(fn) {
533
- if (Owner === null)
534
- console.warn("cleanups created outside a `createRoot` or `render` will never be run");
535
- else if (Owner.cleanups === null) Owner.cleanups = [fn];
536
- else Owner.cleanups.push(fn);
483
+ 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);
537
484
  return fn;
538
485
  }
539
486
  function catchError(fn, handler) {
@@ -587,17 +534,15 @@ function startTransition(fn) {
587
534
  Owner = o;
588
535
  let t;
589
536
  if (Scheduler || SuspenseContext) {
590
- t =
591
- Transition ||
592
- (Transition = {
593
- sources: new Set(),
594
- effects: [],
595
- promises: new Set(),
596
- disposed: new Set(),
597
- queue: new Set(),
598
- running: true
599
- });
600
- t.done || (t.done = new Promise(res => (t.resolve = res)));
537
+ t = Transition || (Transition = {
538
+ sources: new Set(),
539
+ effects: [],
540
+ promises: new Set(),
541
+ disposed: new Set(),
542
+ queue: new Set(),
543
+ running: true
544
+ });
545
+ t.done || (t.done = new Promise(res => t.resolve = res));
601
546
  t.running = true;
602
547
  }
603
548
  runUpdates(fn, false);
@@ -605,7 +550,7 @@ function startTransition(fn) {
605
550
  return t ? t.done : undefined;
606
551
  });
607
552
  }
608
- const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);
553
+ const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
609
554
  function useTransition() {
610
555
  return [transPending, startTransition];
611
556
  }
@@ -614,18 +559,12 @@ function resumeEffects(e) {
614
559
  e.length = 0;
615
560
  }
616
561
  function devComponent(Comp, props) {
617
- const c = createComputation(
618
- () =>
619
- untrack(() => {
620
- Object.assign(Comp, {
621
- [$DEVCOMP]: true
622
- });
623
- return Comp(props);
624
- }),
625
- undefined,
626
- true,
627
- 0
628
- );
562
+ const c = createComputation(() => untrack(() => {
563
+ Object.assign(Comp, {
564
+ [$DEVCOMP]: true
565
+ });
566
+ return Comp(props);
567
+ }), undefined, true, 0);
629
568
  c.props = props;
630
569
  c.observers = null;
631
570
  c.observerSlots = null;
@@ -636,8 +575,7 @@ function devComponent(Comp, props) {
636
575
  }
637
576
  function registerGraph(value) {
638
577
  if (!Owner) return;
639
- if (Owner.sourceMap) Owner.sourceMap.push(value);
640
- else Owner.sourceMap = [value];
578
+ if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
641
579
  value.graph = Owner;
642
580
  }
643
581
  function createContext(defaultValue, options) {
@@ -649,15 +587,14 @@ function createContext(defaultValue, options) {
649
587
  };
650
588
  }
651
589
  function useContext(context) {
652
- return Owner && Owner.context && Owner.context[context.id] !== undefined
653
- ? Owner.context[context.id]
654
- : context.defaultValue;
590
+ let value;
591
+ return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
655
592
  }
656
593
  function children(fn) {
657
594
  const children = createMemo(fn);
658
595
  const memo = createMemo(() => resolveChildren(children()), undefined, {
659
596
  name: "children"
660
- });
597
+ }) ;
661
598
  memo.toArray = () => {
662
599
  const c = memo();
663
600
  return Array.isArray(c) ? c : c != null ? [c] : [];
@@ -670,7 +607,10 @@ function getSuspenseContext() {
670
607
  }
671
608
  function enableExternalSource(factory, untrack = fn => fn()) {
672
609
  if (ExternalSourceConfig) {
673
- const { factory: oldFactory, untrack: oldUntrack } = ExternalSourceConfig;
610
+ const {
611
+ factory: oldFactory,
612
+ untrack: oldUntrack
613
+ } = ExternalSourceConfig;
674
614
  ExternalSourceConfig = {
675
615
  factory: (fn, trigger) => {
676
616
  const oldSource = oldFactory(fn, trigger);
@@ -695,8 +635,7 @@ function enableExternalSource(factory, untrack = fn => fn()) {
695
635
  function readSignal() {
696
636
  const runningTransition = Transition && Transition.running;
697
637
  if (this.sources && (runningTransition ? this.tState : this.state)) {
698
- if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
699
- else {
638
+ if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
700
639
  const updates = Updates;
701
640
  Updates = null;
702
641
  runUpdates(() => lookUpstream(this), false);
@@ -724,12 +663,11 @@ function readSignal() {
724
663
  return this.value;
725
664
  }
726
665
  function writeSignal(node, value, isComp) {
727
- let current =
728
- Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
666
+ let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
729
667
  if (!node.comparator || !node.comparator(current, value)) {
730
668
  if (Transition) {
731
669
  const TransitionRunning = Transition.running;
732
- if (TransitionRunning || (!isComp && Transition.sources.has(node))) {
670
+ if (TransitionRunning || !isComp && Transition.sources.has(node)) {
733
671
  Transition.sources.add(node);
734
672
  node.tValue = value;
735
673
  }
@@ -742,12 +680,10 @@ function writeSignal(node, value, isComp) {
742
680
  const TransitionRunning = Transition && Transition.running;
743
681
  if (TransitionRunning && Transition.disposed.has(o)) continue;
744
682
  if (TransitionRunning ? !o.tState : !o.state) {
745
- if (o.pure) Updates.push(o);
746
- else Effects.push(o);
683
+ if (o.pure) Updates.push(o);else Effects.push(o);
747
684
  if (o.observers) markDownstream(o);
748
685
  }
749
- if (!TransitionRunning) o.state = STALE;
750
- else o.tState = STALE;
686
+ if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
751
687
  }
752
688
  if (Updates.length > 10e5) {
753
689
  Updates = [];
@@ -763,11 +699,7 @@ function updateComputation(node) {
763
699
  if (!node.fn) return;
764
700
  cleanNode(node);
765
701
  const time = ExecCount;
766
- runComputation(
767
- node,
768
- Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
769
- time
770
- );
702
+ runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
771
703
  if (Transition && !Transition.running && Transition.sources.has(node)) {
772
704
  queueMicrotask(() => {
773
705
  runUpdates(() => {
@@ -832,15 +764,11 @@ function createComputation(fn, init, pure, state = STALE, options) {
832
764
  c.state = 0;
833
765
  c.tState = state;
834
766
  }
835
- if (Owner === null)
836
- console.warn("computations created outside a `createRoot` or `render` will never be disposed");
837
- else if (Owner !== UNOWNED) {
767
+ if (Owner === null) console.warn("computations created outside a `createRoot` or `render` will never be disposed");else if (Owner !== UNOWNED) {
838
768
  if (Transition && Transition.running && Owner.pure) {
839
- if (!Owner.tOwned) Owner.tOwned = [c];
840
- else Owner.tOwned.push(c);
769
+ if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
841
770
  } else {
842
- if (!Owner.owned) Owner.owned = [c];
843
- else Owner.owned.push(c);
771
+ if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
844
772
  }
845
773
  }
846
774
  if (options && options.name) c.name = options.name;
@@ -893,8 +821,7 @@ function runUpdates(fn, init) {
893
821
  if (Updates) return fn();
894
822
  let wait = false;
895
823
  if (!init) Updates = [];
896
- if (Effects) wait = true;
897
- else Effects = [];
824
+ if (Effects) wait = true;else Effects = [];
898
825
  ExecCount++;
899
826
  try {
900
827
  const res = fn();
@@ -908,8 +835,7 @@ function runUpdates(fn, init) {
908
835
  }
909
836
  function completeUpdates(wait) {
910
837
  if (Updates) {
911
- if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
912
- else runQueue(Updates);
838
+ if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
913
839
  Updates = null;
914
840
  }
915
841
  if (wait) return;
@@ -949,8 +875,7 @@ function completeUpdates(wait) {
949
875
  }
950
876
  const e = Effects;
951
877
  Effects = null;
952
- if (e.length) runUpdates(() => runEffects(e), false);
953
- else DevHooks.afterUpdate && DevHooks.afterUpdate();
878
+ if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
954
879
  if (res) res();
955
880
  }
956
881
  function runQueue(queue) {
@@ -978,8 +903,7 @@ function runUserEffects(queue) {
978
903
  userLength = 0;
979
904
  for (i = 0; i < queue.length; i++) {
980
905
  const e = queue[i];
981
- if (!e.user) runTop(e);
982
- else queue[userLength++] = e;
906
+ if (!e.user) runTop(e);else queue[userLength++] = e;
983
907
  }
984
908
  if (sharedConfig.context) {
985
909
  if (sharedConfig.count) {
@@ -997,15 +921,13 @@ function runUserEffects(queue) {
997
921
  }
998
922
  function lookUpstream(node, ignore) {
999
923
  const runningTransition = Transition && Transition.running;
1000
- if (runningTransition) node.tState = 0;
1001
- else node.state = 0;
924
+ if (runningTransition) node.tState = 0;else node.state = 0;
1002
925
  for (let i = 0; i < node.sources.length; i += 1) {
1003
926
  const source = node.sources[i];
1004
927
  if (source.sources) {
1005
928
  const state = runningTransition ? source.tState : source.state;
1006
929
  if (state === STALE) {
1007
- if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
1008
- runTop(source);
930
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
1009
931
  } else if (state === PENDING) lookUpstream(source, ignore);
1010
932
  }
1011
933
  }
@@ -1015,10 +937,8 @@ function markDownstream(node) {
1015
937
  for (let i = 0; i < node.observers.length; i += 1) {
1016
938
  const o = node.observers[i];
1017
939
  if (runningTransition ? !o.tState : !o.state) {
1018
- if (runningTransition) o.tState = PENDING;
1019
- else o.state = PENDING;
1020
- if (o.pure) Updates.push(o);
1021
- else Effects.push(o);
940
+ if (runningTransition) o.tState = PENDING;else o.state = PENDING;
941
+ if (o.pure) Updates.push(o);else Effects.push(o);
1022
942
  o.observers && markDownstream(o);
1023
943
  }
1024
944
  }
@@ -1055,8 +975,7 @@ function cleanNode(node) {
1055
975
  for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
1056
976
  node.cleanups = null;
1057
977
  }
1058
- if (Transition && Transition.running) node.tState = 0;
1059
- else node.state = 0;
978
+ if (Transition && Transition.running) node.tState = 0;else node.state = 0;
1060
979
  delete node.sourceMap;
1061
980
  }
1062
981
  function reset(node, top) {
@@ -1078,21 +997,19 @@ function runErrors(err, fns, owner) {
1078
997
  try {
1079
998
  for (const f of fns) f(err);
1080
999
  } catch (e) {
1081
- handleError(e, (owner && owner.owner) || null);
1000
+ handleError(e, owner && owner.owner || null);
1082
1001
  }
1083
1002
  }
1084
1003
  function handleError(err, owner = Owner) {
1085
1004
  const fns = ERROR && owner && owner.context && owner.context[ERROR];
1086
1005
  const error = castError(err);
1087
1006
  if (!fns) throw error;
1088
- if (Effects)
1089
- Effects.push({
1090
- fn() {
1091
- runErrors(error, fns, owner);
1092
- },
1093
- state: STALE
1094
- });
1095
- else runErrors(error, fns, owner);
1007
+ if (Effects) Effects.push({
1008
+ fn() {
1009
+ runErrors(error, fns, owner);
1010
+ },
1011
+ state: STALE
1012
+ });else runErrors(error, fns, owner);
1096
1013
  }
1097
1014
  function resolveChildren(children) {
1098
1015
  if (typeof children === "function" && !children.length) return resolveChildren(children());
@@ -1109,26 +1026,19 @@ function resolveChildren(children) {
1109
1026
  function createProvider(id, options) {
1110
1027
  return function provider(props) {
1111
1028
  let res;
1112
- createRenderEffect(
1113
- () =>
1114
- (res = untrack(() => {
1115
- Owner.context = {
1116
- ...Owner.context,
1117
- [id]: props.value
1118
- };
1119
- return children(() => props.children);
1120
- })),
1121
- undefined,
1122
- options
1123
- );
1029
+ createRenderEffect(() => res = untrack(() => {
1030
+ Owner.context = {
1031
+ ...Owner.context,
1032
+ [id]: props.value
1033
+ };
1034
+ return children(() => props.children);
1035
+ }), undefined, options);
1124
1036
  return res;
1125
1037
  };
1126
1038
  }
1127
1039
  function onError(fn) {
1128
1040
  ERROR || (ERROR = Symbol("error"));
1129
- if (Owner === null)
1130
- console.warn("error handlers created outside a `createRoot` or `render` will never be run");
1131
- else if (Owner.context === null || !Owner.context[ERROR]) {
1041
+ 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]) {
1132
1042
  Owner.context = {
1133
1043
  ...Owner.context,
1134
1044
  [ERROR]: [fn]
@@ -1157,8 +1067,7 @@ function observable(input) {
1157
1067
  if (!(observer instanceof Object) || observer == null) {
1158
1068
  throw new TypeError("Expected the observer to be an object.");
1159
1069
  }
1160
- const handler =
1161
- typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1070
+ const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1162
1071
  if (!handler) {
1163
1072
  return {
1164
1073
  unsubscribe() {}
@@ -1189,7 +1098,7 @@ function from(producer) {
1189
1098
  });
1190
1099
  if ("subscribe" in producer) {
1191
1100
  const unsub = producer.subscribe(v => set(() => v));
1192
- onCleanup(() => ("unsubscribe" in unsub ? unsub.unsubscribe() : unsub()));
1101
+ onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
1193
1102
  } else {
1194
1103
  const clean = producer(set);
1195
1104
  onCleanup(clean);
@@ -1210,20 +1119,12 @@ function mapArray(list, mapFn, options = {}) {
1210
1119
  onCleanup(() => dispose(disposers));
1211
1120
  return () => {
1212
1121
  let newItems = list() || [],
1122
+ newLen = newItems.length,
1213
1123
  i,
1214
1124
  j;
1215
1125
  newItems[$TRACK];
1216
1126
  return untrack(() => {
1217
- let newLen = newItems.length,
1218
- newIndices,
1219
- newIndicesNext,
1220
- temp,
1221
- tempdisposers,
1222
- tempIndexes,
1223
- start,
1224
- end,
1225
- newEnd,
1226
- item;
1127
+ let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
1227
1128
  if (newLen === 0) {
1228
1129
  if (len !== 0) {
1229
1130
  dispose(disposers);
@@ -1241,7 +1142,8 @@ function mapArray(list, mapFn, options = {}) {
1241
1142
  });
1242
1143
  len = 1;
1243
1144
  }
1244
- } else if (len === 0) {
1145
+ }
1146
+ else if (len === 0) {
1245
1147
  mapped = new Array(newLen);
1246
1148
  for (j = 0; j < newLen; j++) {
1247
1149
  items[j] = newItems[j];
@@ -1252,16 +1154,8 @@ function mapArray(list, mapFn, options = {}) {
1252
1154
  temp = new Array(newLen);
1253
1155
  tempdisposers = new Array(newLen);
1254
1156
  indexes && (tempIndexes = new Array(newLen));
1255
- for (
1256
- start = 0, end = Math.min(len, newLen);
1257
- start < end && items[start] === newItems[start];
1258
- start++
1259
- );
1260
- for (
1261
- end = len - 1, newEnd = newLen - 1;
1262
- end >= start && newEnd >= start && items[end] === newItems[newEnd];
1263
- end--, newEnd--
1264
- ) {
1157
+ for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
1158
+ for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
1265
1159
  temp[newEnd] = mapped[end];
1266
1160
  tempdisposers[newEnd] = disposers[end];
1267
1161
  indexes && (tempIndexes[newEnd] = indexes[end]);
@@ -1295,7 +1189,7 @@ function mapArray(list, mapFn, options = {}) {
1295
1189
  }
1296
1190
  } else mapped[j] = createRoot(mapper);
1297
1191
  }
1298
- mapped = mapped.slice(0, (len = newLen));
1192
+ mapped = mapped.slice(0, len = newLen);
1299
1193
  items = newItems.slice(0);
1300
1194
  }
1301
1195
  return mapped;
@@ -1305,7 +1199,7 @@ function mapArray(list, mapFn, options = {}) {
1305
1199
  if (indexes) {
1306
1200
  const [s, set] = createSignal(j, {
1307
1201
  name: "index"
1308
- });
1202
+ }) ;
1309
1203
  indexes[j] = set;
1310
1204
  return mapFn(newItems[j], s);
1311
1205
  }
@@ -1322,10 +1216,11 @@ function indexArray(list, mapFn, options = {}) {
1322
1216
  i;
1323
1217
  onCleanup(() => dispose(disposers));
1324
1218
  return () => {
1325
- const newItems = list() || [];
1219
+ const newItems = list() || [],
1220
+ newLen = newItems.length;
1326
1221
  newItems[$TRACK];
1327
1222
  return untrack(() => {
1328
- if (newItems.length === 0) {
1223
+ if (newLen === 0) {
1329
1224
  if (len !== 0) {
1330
1225
  dispose(disposers);
1331
1226
  disposers = [];
@@ -1351,7 +1246,7 @@ function indexArray(list, mapFn, options = {}) {
1351
1246
  mapped = [];
1352
1247
  len = 0;
1353
1248
  }
1354
- for (i = 0; i < newItems.length; i++) {
1249
+ for (i = 0; i < newLen; i++) {
1355
1250
  if (i < items.length && items[i] !== newItems[i]) {
1356
1251
  signals[i](() => newItems[i]);
1357
1252
  } else if (i >= items.length) {
@@ -1361,15 +1256,15 @@ function indexArray(list, mapFn, options = {}) {
1361
1256
  for (; i < items.length; i++) {
1362
1257
  disposers[i]();
1363
1258
  }
1364
- len = signals.length = disposers.length = newItems.length;
1259
+ len = signals.length = disposers.length = newLen;
1365
1260
  items = newItems.slice(0);
1366
- return (mapped = mapped.slice(0, len));
1261
+ return mapped = mapped.slice(0, len);
1367
1262
  });
1368
1263
  function mapper(disposer) {
1369
1264
  disposers[i] = disposer;
1370
1265
  const [s, set] = createSignal(newItems[i], {
1371
1266
  name: "value"
1372
- });
1267
+ }) ;
1373
1268
  signals[i] = set;
1374
1269
  return mapFn(s, i);
1375
1270
  }
@@ -1385,7 +1280,7 @@ function createComponent(Comp, props) {
1385
1280
  if (sharedConfig.context) {
1386
1281
  const c = sharedConfig.context;
1387
1282
  setHydrateContext(nextHydrateContext());
1388
- const r = devComponent(Comp, props || {});
1283
+ const r = devComponent(Comp, props || {}) ;
1389
1284
  setHydrateContext(c);
1390
1285
  return r;
1391
1286
  }
@@ -1434,33 +1329,29 @@ function mergeProps(...sources) {
1434
1329
  let proxy = false;
1435
1330
  for (let i = 0; i < sources.length; i++) {
1436
1331
  const s = sources[i];
1437
- proxy = proxy || (!!s && $PROXY in s);
1438
- sources[i] = typeof s === "function" ? ((proxy = true), createMemo(s)) : s;
1332
+ proxy = proxy || !!s && $PROXY in s;
1333
+ sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
1439
1334
  }
1440
1335
  if (proxy) {
1441
- return new Proxy(
1442
- {
1443
- get(property) {
1444
- for (let i = sources.length - 1; i >= 0; i--) {
1445
- const v = resolveSource(sources[i])[property];
1446
- if (v !== undefined) return v;
1447
- }
1448
- },
1449
- has(property) {
1450
- for (let i = sources.length - 1; i >= 0; i--) {
1451
- if (property in resolveSource(sources[i])) return true;
1452
- }
1453
- return false;
1454
- },
1455
- keys() {
1456
- const keys = [];
1457
- for (let i = 0; i < sources.length; i++)
1458
- keys.push(...Object.keys(resolveSource(sources[i])));
1459
- return [...new Set(keys)];
1336
+ return new Proxy({
1337
+ get(property) {
1338
+ for (let i = sources.length - 1; i >= 0; i--) {
1339
+ const v = resolveSource(sources[i])[property];
1340
+ if (v !== undefined) return v;
1341
+ }
1342
+ },
1343
+ has(property) {
1344
+ for (let i = sources.length - 1; i >= 0; i--) {
1345
+ if (property in resolveSource(sources[i])) return true;
1460
1346
  }
1347
+ return false;
1461
1348
  },
1462
- propTraps
1463
- );
1349
+ keys() {
1350
+ const keys = [];
1351
+ for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
1352
+ return [...new Set(keys)];
1353
+ }
1354
+ }, propTraps);
1464
1355
  }
1465
1356
  const sourcesMap = {};
1466
1357
  const defined = Object.create(null);
@@ -1473,20 +1364,15 @@ function mergeProps(...sources) {
1473
1364
  if (key === "__proto__" || key === "constructor") continue;
1474
1365
  const desc = Object.getOwnPropertyDescriptor(source, key);
1475
1366
  if (!defined[key]) {
1476
- defined[key] = desc.get
1477
- ? {
1478
- enumerable: true,
1479
- configurable: true,
1480
- get: resolveSources.bind((sourcesMap[key] = [desc.get.bind(source)]))
1481
- }
1482
- : desc.value !== undefined
1483
- ? desc
1484
- : undefined;
1367
+ defined[key] = desc.get ? {
1368
+ enumerable: true,
1369
+ configurable: true,
1370
+ get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
1371
+ } : desc.value !== undefined ? desc : undefined;
1485
1372
  } else {
1486
1373
  const sources = sourcesMap[key];
1487
1374
  if (sources) {
1488
- if (desc.get) sources.push(desc.get.bind(source));
1489
- else if (desc.value !== undefined) sources.push(() => desc.value);
1375
+ if (desc.get) sources.push(desc.get.bind(source));else if (desc.value !== undefined) sources.push(() => desc.value);
1490
1376
  }
1491
1377
  }
1492
1378
  }
@@ -1496,8 +1382,7 @@ function mergeProps(...sources) {
1496
1382
  for (let i = definedKeys.length - 1; i >= 0; i--) {
1497
1383
  const key = definedKeys[i],
1498
1384
  desc = defined[key];
1499
- if (desc && desc.get) Object.defineProperty(target, key, desc);
1500
- else target[key] = desc ? desc.value : undefined;
1385
+ if (desc && desc.get) Object.defineProperty(target, key, desc);else target[key] = desc ? desc.value : undefined;
1501
1386
  }
1502
1387
  return target;
1503
1388
  }
@@ -1505,60 +1390,47 @@ function splitProps(props, ...keys) {
1505
1390
  if ($PROXY in props) {
1506
1391
  const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
1507
1392
  const res = keys.map(k => {
1508
- return new Proxy(
1509
- {
1510
- get(property) {
1511
- return k.includes(property) ? props[property] : undefined;
1512
- },
1513
- has(property) {
1514
- return k.includes(property) && property in props;
1515
- },
1516
- keys() {
1517
- return k.filter(property => property in props);
1518
- }
1393
+ return new Proxy({
1394
+ get(property) {
1395
+ return k.includes(property) ? props[property] : undefined;
1519
1396
  },
1520
- propTraps
1521
- );
1522
- });
1523
- res.push(
1524
- new Proxy(
1525
- {
1526
- get(property) {
1527
- return blocked.has(property) ? undefined : props[property];
1528
- },
1529
- has(property) {
1530
- return blocked.has(property) ? false : property in props;
1531
- },
1532
- keys() {
1533
- return Object.keys(props).filter(k => !blocked.has(k));
1534
- }
1397
+ has(property) {
1398
+ return k.includes(property) && property in props;
1535
1399
  },
1536
- propTraps
1537
- )
1538
- );
1400
+ keys() {
1401
+ return k.filter(property => property in props);
1402
+ }
1403
+ }, propTraps);
1404
+ });
1405
+ res.push(new Proxy({
1406
+ get(property) {
1407
+ return blocked.has(property) ? undefined : props[property];
1408
+ },
1409
+ has(property) {
1410
+ return blocked.has(property) ? false : property in props;
1411
+ },
1412
+ keys() {
1413
+ return Object.keys(props).filter(k => !blocked.has(k));
1414
+ }
1415
+ }, propTraps));
1539
1416
  return res;
1540
1417
  }
1541
1418
  const otherObject = {};
1542
1419
  const objects = keys.map(() => ({}));
1543
1420
  for (const propName of Object.getOwnPropertyNames(props)) {
1544
1421
  const desc = Object.getOwnPropertyDescriptor(props, propName);
1545
- const isDefaultDesc =
1546
- !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1422
+ const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1547
1423
  let blocked = false;
1548
1424
  let objectIndex = 0;
1549
1425
  for (const k of keys) {
1550
1426
  if (k.includes(propName)) {
1551
1427
  blocked = true;
1552
- isDefaultDesc
1553
- ? (objects[objectIndex][propName] = desc.value)
1554
- : Object.defineProperty(objects[objectIndex], propName, desc);
1428
+ isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
1555
1429
  }
1556
1430
  ++objectIndex;
1557
1431
  }
1558
1432
  if (!blocked) {
1559
- isDefaultDesc
1560
- ? (otherObject[propName] = desc.value)
1561
- : Object.defineProperty(otherObject, propName, desc);
1433
+ isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
1562
1434
  }
1563
1435
  }
1564
1436
  return [...objects, otherObject];
@@ -1584,138 +1456,96 @@ function lazy(fn) {
1584
1456
  comp = s;
1585
1457
  }
1586
1458
  let Comp;
1587
- return createMemo(
1588
- () =>
1589
- (Comp = comp()) &&
1590
- untrack(() => {
1591
- if (true)
1592
- Object.assign(Comp, {
1593
- [$DEVCOMP]: true
1594
- });
1595
- if (!ctx) return Comp(props);
1596
- const c = sharedConfig.context;
1597
- setHydrateContext(ctx);
1598
- const r = Comp(props);
1599
- setHydrateContext(c);
1600
- return r;
1601
- })
1602
- );
1459
+ return createMemo(() => (Comp = comp()) && untrack(() => {
1460
+ if (true) Object.assign(Comp, {
1461
+ [$DEVCOMP]: true
1462
+ });
1463
+ if (!ctx) return Comp(props);
1464
+ const c = sharedConfig.context;
1465
+ setHydrateContext(ctx);
1466
+ const r = Comp(props);
1467
+ setHydrateContext(c);
1468
+ return r;
1469
+ }));
1603
1470
  };
1604
- wrap.preload = () => p || ((p = fn()).then(mod => (comp = () => mod.default)), p);
1471
+ wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
1605
1472
  return wrap;
1606
1473
  }
1607
1474
  let counter = 0;
1608
1475
  function createUniqueId() {
1609
1476
  const ctx = sharedConfig.context;
1610
- return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1477
+ return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
1611
1478
  }
1612
1479
 
1613
- const narrowedError = name =>
1614
- `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.`;
1480
+ 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.` ;
1615
1481
  function For(props) {
1616
1482
  const fallback = "fallback" in props && {
1617
1483
  fallback: () => props.fallback
1618
1484
  };
1619
- return createMemo(
1620
- mapArray(() => props.each, props.children, fallback || undefined),
1621
- undefined,
1622
- {
1623
- name: "value"
1624
- }
1625
- );
1485
+ return createMemo(mapArray(() => props.each, props.children, fallback || undefined), undefined, {
1486
+ name: "value"
1487
+ }) ;
1626
1488
  }
1627
1489
  function Index(props) {
1628
1490
  const fallback = "fallback" in props && {
1629
1491
  fallback: () => props.fallback
1630
1492
  };
1631
- return createMemo(
1632
- indexArray(() => props.each, props.children, fallback || undefined),
1633
- undefined,
1634
- {
1635
- name: "value"
1636
- }
1637
- );
1493
+ return createMemo(indexArray(() => props.each, props.children, fallback || undefined), undefined, {
1494
+ name: "value"
1495
+ }) ;
1638
1496
  }
1639
1497
  function Show(props) {
1640
1498
  const keyed = props.keyed;
1641
1499
  const condition = createMemo(() => props.when, undefined, {
1642
- equals: (a, b) => (keyed ? a === b : !a === !b),
1500
+ equals: (a, b) => keyed ? a === b : !a === !b,
1643
1501
  name: "condition"
1644
- });
1645
- return createMemo(
1646
- () => {
1647
- const c = condition();
1648
- if (c) {
1649
- const child = props.children;
1650
- const fn = typeof child === "function" && child.length > 0;
1651
- return fn
1652
- ? untrack(() =>
1653
- child(
1654
- keyed
1655
- ? c
1656
- : () => {
1657
- if (!untrack(condition)) throw narrowedError("Show");
1658
- return props.when;
1659
- }
1660
- )
1661
- )
1662
- : child;
1663
- }
1664
- return props.fallback;
1665
- },
1666
- undefined,
1667
- {
1668
- name: "value"
1502
+ } );
1503
+ return createMemo(() => {
1504
+ const c = condition();
1505
+ if (c) {
1506
+ const child = props.children;
1507
+ const fn = typeof child === "function" && child.length > 0;
1508
+ return fn ? untrack(() => child(keyed ? c : () => {
1509
+ if (!untrack(condition)) throw narrowedError("Show");
1510
+ return props.when;
1511
+ })) : child;
1669
1512
  }
1670
- );
1513
+ return props.fallback;
1514
+ }, undefined, {
1515
+ name: "value"
1516
+ } );
1671
1517
  }
1672
1518
  function Switch(props) {
1673
1519
  let keyed = false;
1674
1520
  const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1675
1521
  const conditions = children(() => props.children),
1676
- evalConditions = createMemo(
1677
- () => {
1678
- let conds = conditions();
1679
- if (!Array.isArray(conds)) conds = [conds];
1680
- for (let i = 0; i < conds.length; i++) {
1681
- const c = conds[i].when;
1682
- if (c) {
1683
- keyed = !!conds[i].keyed;
1684
- return [i, c, conds[i]];
1685
- }
1522
+ evalConditions = createMemo(() => {
1523
+ let conds = conditions();
1524
+ if (!Array.isArray(conds)) conds = [conds];
1525
+ for (let i = 0; i < conds.length; i++) {
1526
+ const c = conds[i].when;
1527
+ if (c) {
1528
+ keyed = !!conds[i].keyed;
1529
+ return [i, c, conds[i]];
1686
1530
  }
1687
- return [-1];
1688
- },
1689
- undefined,
1690
- {
1691
- equals,
1692
- name: "eval conditions"
1693
1531
  }
1694
- );
1695
- return createMemo(
1696
- () => {
1697
- const [index, when, cond] = evalConditions();
1698
- if (index < 0) return props.fallback;
1699
- const c = cond.children;
1700
- const fn = typeof c === "function" && c.length > 0;
1701
- return fn
1702
- ? untrack(() =>
1703
- c(
1704
- keyed
1705
- ? when
1706
- : () => {
1707
- if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1708
- return cond.when;
1709
- }
1710
- )
1711
- )
1712
- : c;
1713
- },
1714
- undefined,
1715
- {
1716
- name: "value"
1717
- }
1718
- );
1532
+ return [-1];
1533
+ }, undefined, {
1534
+ equals,
1535
+ name: "eval conditions"
1536
+ } );
1537
+ return createMemo(() => {
1538
+ const [index, when, cond] = evalConditions();
1539
+ if (index < 0) return props.fallback;
1540
+ const c = cond.children;
1541
+ const fn = typeof c === "function" && c.length > 0;
1542
+ return fn ? untrack(() => c(keyed ? when : () => {
1543
+ if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1544
+ return cond.when;
1545
+ })) : c;
1546
+ }, undefined, {
1547
+ name: "value"
1548
+ } );
1719
1549
  }
1720
1550
  function Match(props) {
1721
1551
  return props;
@@ -1726,34 +1556,28 @@ function resetErrorBoundaries() {
1726
1556
  }
1727
1557
  function ErrorBoundary(props) {
1728
1558
  let err;
1729
- if (sharedConfig.context && sharedConfig.load)
1730
- err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
1559
+ if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.getContextId());
1731
1560
  const [errored, setErrored] = createSignal(err, {
1732
1561
  name: "errored"
1733
- });
1562
+ } );
1734
1563
  Errors || (Errors = new Set());
1735
1564
  Errors.add(setErrored);
1736
1565
  onCleanup(() => Errors.delete(setErrored));
1737
- return createMemo(
1738
- () => {
1739
- let e;
1740
- if ((e = errored())) {
1741
- const f = props.fallback;
1742
- if (typeof f !== "function" || f.length == 0) console.error(e);
1743
- return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1744
- }
1745
- return catchError(() => props.children, setErrored);
1746
- },
1747
- undefined,
1748
- {
1749
- name: "value"
1566
+ return createMemo(() => {
1567
+ let e;
1568
+ if (e = errored()) {
1569
+ const f = props.fallback;
1570
+ if ((typeof f !== "function" || f.length == 0)) console.error(e);
1571
+ return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1750
1572
  }
1751
- );
1573
+ return catchError(() => props.children, setErrored);
1574
+ }, undefined, {
1575
+ name: "value"
1576
+ } );
1752
1577
  }
1753
1578
 
1754
- const suspenseListEquals = (a, b) =>
1755
- a.showContent === b.showContent && a.showFallback === b.showFallback;
1756
- const SuspenseListContext = createContext();
1579
+ const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
1580
+ const SuspenseListContext = /* #__PURE__ */createContext();
1757
1581
  function SuspenseList(props) {
1758
1582
  let [wrapper, setWrapper] = createSignal(() => ({
1759
1583
  inFallback: false
@@ -1764,51 +1588,51 @@ function SuspenseList(props) {
1764
1588
  if (listContext) {
1765
1589
  show = listContext.register(createMemo(() => wrapper()().inFallback));
1766
1590
  }
1767
- const resolved = createMemo(
1768
- prev => {
1769
- const reveal = props.revealOrder,
1770
- tail = props.tail,
1771
- { showContent = true, showFallback = true } = show ? show() : {},
1772
- reg = registry(),
1773
- reverse = reveal === "backwards";
1774
- if (reveal === "together") {
1775
- const all = reg.every(inFallback => !inFallback());
1776
- const res = reg.map(() => ({
1777
- showContent: all && showContent,
1591
+ const resolved = createMemo(prev => {
1592
+ const reveal = props.revealOrder,
1593
+ tail = props.tail,
1594
+ {
1595
+ showContent = true,
1596
+ showFallback = true
1597
+ } = show ? show() : {},
1598
+ reg = registry(),
1599
+ reverse = reveal === "backwards";
1600
+ if (reveal === "together") {
1601
+ const all = reg.every(inFallback => !inFallback());
1602
+ const res = reg.map(() => ({
1603
+ showContent: all && showContent,
1604
+ showFallback
1605
+ }));
1606
+ res.inFallback = !all;
1607
+ return res;
1608
+ }
1609
+ let stop = false;
1610
+ let inFallback = prev.inFallback;
1611
+ const res = [];
1612
+ for (let i = 0, len = reg.length; i < len; i++) {
1613
+ const n = reverse ? len - i - 1 : i,
1614
+ s = reg[n]();
1615
+ if (!stop && !s) {
1616
+ res[n] = {
1617
+ showContent,
1778
1618
  showFallback
1779
- }));
1780
- res.inFallback = !all;
1781
- return res;
1782
- }
1783
- let stop = false;
1784
- let inFallback = prev.inFallback;
1785
- const res = [];
1786
- for (let i = 0, len = reg.length; i < len; i++) {
1787
- const n = reverse ? len - i - 1 : i,
1788
- s = reg[n]();
1789
- if (!stop && !s) {
1790
- res[n] = {
1791
- showContent,
1792
- showFallback
1793
- };
1794
- } else {
1795
- const next = !stop;
1796
- if (next) inFallback = true;
1797
- res[n] = {
1798
- showContent: next,
1799
- showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
1800
- };
1801
- stop = true;
1802
- }
1619
+ };
1620
+ } else {
1621
+ const next = !stop;
1622
+ if (next) inFallback = true;
1623
+ res[n] = {
1624
+ showContent: next,
1625
+ showFallback: !tail || next && tail === "collapsed" ? showFallback : false
1626
+ };
1627
+ stop = true;
1803
1628
  }
1804
- if (!stop) inFallback = false;
1805
- res.inFallback = inFallback;
1806
- return res;
1807
- },
1808
- {
1809
- inFallback: false
1810
1629
  }
1811
- );
1630
+ if (!stop) inFallback = false;
1631
+ res.inFallback = inFallback;
1632
+ return res;
1633
+ }, {
1634
+ inFallback: false
1635
+ });
1812
1636
  setWrapper(() => resolved);
1813
1637
  return createComponent(SuspenseListContext.Provider, {
1814
1638
  value: {
@@ -1850,30 +1674,26 @@ function Suspense(props) {
1850
1674
  },
1851
1675
  owner = getOwner();
1852
1676
  if (sharedConfig.context && sharedConfig.load) {
1853
- const key = sharedConfig.context.id + sharedConfig.context.count;
1677
+ const key = sharedConfig.getContextId();
1854
1678
  let ref = sharedConfig.load(key);
1855
1679
  if (ref) {
1856
- if (typeof ref !== "object" || ref.status !== "success") p = ref;
1857
- else sharedConfig.gather(key);
1680
+ if (typeof ref !== "object" || ref.status !== "success") p = ref;else sharedConfig.gather(key);
1858
1681
  }
1859
1682
  if (p && p !== "$$f") {
1860
1683
  const [s, set] = createSignal(undefined, {
1861
1684
  equals: false
1862
1685
  });
1863
1686
  flicker = s;
1864
- p.then(
1865
- () => {
1866
- if (sharedConfig.done) return set();
1867
- sharedConfig.gather(key);
1868
- setHydrateContext(ctx);
1869
- set();
1870
- setHydrateContext();
1871
- },
1872
- err => {
1873
- error = err;
1874
- set();
1875
- }
1876
- );
1687
+ p.then(() => {
1688
+ if (sharedConfig.done) return set();
1689
+ sharedConfig.gather(key);
1690
+ setHydrateContext(ctx);
1691
+ set();
1692
+ setHydrateContext();
1693
+ }, err => {
1694
+ error = err;
1695
+ set();
1696
+ });
1877
1697
  }
1878
1698
  }
1879
1699
  const listContext = useContext(SuspenseListContext);
@@ -1888,14 +1708,17 @@ function Suspense(props) {
1888
1708
  ctx = sharedConfig.context;
1889
1709
  if (flicker) {
1890
1710
  flicker();
1891
- return (flicker = undefined);
1711
+ return flicker = undefined;
1892
1712
  }
1893
1713
  if (ctx && p === "$$f") setHydrateContext();
1894
1714
  const rendered = createMemo(() => props.children);
1895
1715
  return createMemo(prev => {
1896
1716
  const inFallback = store.inFallback(),
1897
- { showContent = true, showFallback = true } = show ? show() : {};
1898
- if ((!inFallback || (p && p !== "$$f")) && showContent) {
1717
+ {
1718
+ showContent = true,
1719
+ showFallback = true
1720
+ } = show ? show() : {};
1721
+ if ((!inFallback || p && p !== "$$f") && showContent) {
1899
1722
  store.resolved = true;
1900
1723
  dispose && dispose();
1901
1724
  dispose = ctx = p = undefined;
@@ -1908,7 +1731,7 @@ function Suspense(props) {
1908
1731
  dispose = disposer;
1909
1732
  if (ctx) {
1910
1733
  setHydrateContext({
1911
- id: ctx.id + "f",
1734
+ id: ctx.id + "F",
1912
1735
  count: 0
1913
1736
  });
1914
1737
  ctx = undefined;
@@ -1925,68 +1748,9 @@ const DEV = {
1925
1748
  hooks: DevHooks,
1926
1749
  writeSignal,
1927
1750
  registerGraph
1928
- };
1751
+ } ;
1929
1752
  if (globalThis) {
1930
- if (!globalThis.Solid$$) globalThis.Solid$$ = true;
1931
- else
1932
- console.warn(
1933
- "You appear to have multiple instances of Solid. This can lead to unexpected behavior."
1934
- );
1753
+ if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
1935
1754
  }
1936
1755
 
1937
- export {
1938
- $DEVCOMP,
1939
- $PROXY,
1940
- $TRACK,
1941
- DEV,
1942
- ErrorBoundary,
1943
- For,
1944
- Index,
1945
- Match,
1946
- Show,
1947
- Suspense,
1948
- SuspenseList,
1949
- Switch,
1950
- batch,
1951
- cancelCallback,
1952
- catchError,
1953
- children,
1954
- createComponent,
1955
- createComputed,
1956
- createContext,
1957
- createDeferred,
1958
- createEffect,
1959
- createMemo,
1960
- createReaction,
1961
- createRenderEffect,
1962
- createResource,
1963
- createRoot,
1964
- createSelector,
1965
- createSignal,
1966
- createUniqueId,
1967
- enableExternalSource,
1968
- enableHydration,
1969
- enableScheduling,
1970
- equalFn,
1971
- from,
1972
- getListener,
1973
- getOwner,
1974
- indexArray,
1975
- lazy,
1976
- mapArray,
1977
- mergeProps,
1978
- observable,
1979
- on,
1980
- onCleanup,
1981
- onError,
1982
- onMount,
1983
- requestCallback,
1984
- resetErrorBoundaries,
1985
- runWithOwner,
1986
- sharedConfig,
1987
- splitProps,
1988
- startTransition,
1989
- untrack,
1990
- useContext,
1991
- useTransition
1992
- };
1756
+ 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 };