@solidjs/signals 0.8.6 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/prod.js CHANGED
@@ -40,11 +40,11 @@ function actualInsertIntoHeap(e, t) {
40
40
  if (r === undefined) t.l[i] = e;
41
41
  else {
42
42
  const t = r.T;
43
- t.R = e;
43
+ t.h = e;
44
44
  e.T = t;
45
45
  r.T = e;
46
46
  }
47
- if (i > t.h) t.h = i;
47
+ if (i > t.R) t.R = i;
48
48
  }
49
49
  function insertIntoHeap(e, t) {
50
50
  let n = e._;
@@ -67,21 +67,21 @@ function deleteFromHeap(e, t) {
67
67
  const i = e.o;
68
68
  if (e.T === e) t.l[i] = undefined;
69
69
  else {
70
- const n = e.R;
70
+ const n = e.h;
71
71
  const r = t.l[i];
72
72
  const s = n ?? r;
73
73
  if (e === r) t.l[i] = n;
74
- else e.T.R = n;
74
+ else e.T.h = n;
75
75
  s.T = e.T;
76
76
  }
77
77
  e.T = e;
78
- e.R = undefined;
78
+ e.h = undefined;
79
79
  }
80
80
  function markHeap(e) {
81
81
  if (e.S) return;
82
82
  e.S = true;
83
- for (let t = 0; t <= e.h; t++) {
84
- for (let n = e.l[t]; n !== undefined; n = n.R) {
83
+ for (let t = 0; t <= e.R; t++) {
84
+ for (let n = e.l[t]; n !== undefined; n = n.h) {
85
85
  if (n._ & REACTIVE_IN_HEAP) markNode(n);
86
86
  }
87
87
  }
@@ -103,7 +103,7 @@ function markNode(e, t = REACTIVE_DIRTY) {
103
103
  }
104
104
  function runHeap(e, t) {
105
105
  e.S = false;
106
- for (e.C = 0; e.C <= e.h; e.C++) {
106
+ for (e.C = 0; e.C <= e.R; e.C++) {
107
107
  let n = e.l[e.C];
108
108
  while (n !== undefined) {
109
109
  if (n._ & REACTIVE_IN_HEAP) t(n);
@@ -111,7 +111,7 @@ function runHeap(e, t) {
111
111
  n = e.l[e.C];
112
112
  }
113
113
  }
114
- e.h = 0;
114
+ e.R = 0;
115
115
  }
116
116
  function adjustHeight(e, t) {
117
117
  deleteFromHeap(e, t);
@@ -129,8 +129,8 @@ function adjustHeight(e, t) {
129
129
  }
130
130
  }
131
131
  const transitions = new Set();
132
- const dirtyQueue = { l: new Array(2e3).fill(undefined), S: false, C: 0, h: 0 };
133
- const zombieQueue = { l: new Array(2e3).fill(undefined), S: false, C: 0, h: 0 };
132
+ const dirtyQueue = { l: new Array(2e3).fill(undefined), S: false, C: 0, R: 0 };
133
+ const zombieQueue = { l: new Array(2e3).fill(undefined), S: false, C: 0, R: 0 };
134
134
  let clock = 0;
135
135
  let activeTransition = null;
136
136
  let scheduled = false;
@@ -323,6 +323,7 @@ let tracking = false;
323
323
  let stale = false;
324
324
  let pendingValueCheck = false;
325
325
  let pendingCheck = null;
326
+ let refreshing = false;
326
327
  let context = null;
327
328
  function notifySubs(e) {
328
329
  for (let t = e.O; t !== null; t = t.p) {
@@ -358,7 +359,7 @@ function recompute(e, t = false) {
358
359
  setStatusFlags(e, STATUS_NONE | (o & STATUS_UNINITIALIZED));
359
360
  tracking = true;
360
361
  try {
361
- r = e.m(r);
362
+ r = handleAsync(e, e.m(r));
362
363
  e.J &= ~STATUS_UNINITIALIZED;
363
364
  } catch (t) {
364
365
  if (t instanceof NotReadyError) {
@@ -400,9 +401,56 @@ function recompute(e, t = false) {
400
401
  insertIntoHeapHeight(t.A, t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
401
402
  }
402
403
  }
403
- if ((!t || e.J & STATUS_PENDING) && !e.ue && !n && !e.B) globalQueue.$.push(e);
404
+ if ((!t || e.J & STATUS_PENDING) && !e.ue && !e.B) globalQueue.$.push(e);
404
405
  if (e.B && n) runInTransition(e, recompute);
405
406
  }
407
+ function handleAsync(e, t, n) {
408
+ const i = typeof t === "object" && t !== null;
409
+ const r = i && t instanceof Promise;
410
+ const s = i && untrack(() => t[Symbol.asyncIterator]);
411
+ if (!r && !s) {
412
+ e.ce = null;
413
+ return t;
414
+ }
415
+ e.ce = t;
416
+ if (r) {
417
+ t.then(i => {
418
+ if (e.ce !== t) return;
419
+ globalQueue.initTransition(e);
420
+ n?.(i) ?? setSignal(e, () => i);
421
+ flush();
422
+ }).catch(n => {
423
+ if (e.ce !== t) return;
424
+ globalQueue.initTransition(e);
425
+ setStatusFlags(e, STATUS_ERROR, n);
426
+ e.se = clock;
427
+ notifySubs(e);
428
+ schedule();
429
+ flush();
430
+ });
431
+ } else {
432
+ (async () => {
433
+ try {
434
+ for await (let i of t) {
435
+ if (e.ce !== t) return;
436
+ globalQueue.initTransition(e);
437
+ n?.(i) ?? setSignal(e, () => i);
438
+ flush();
439
+ }
440
+ } catch (n) {
441
+ if (e.ce !== t) return;
442
+ globalQueue.initTransition(e);
443
+ setStatusFlags(e, STATUS_ERROR, n);
444
+ e.se = clock;
445
+ notifySubs(e);
446
+ schedule();
447
+ flush();
448
+ }
449
+ })();
450
+ }
451
+ globalQueue.initTransition(e);
452
+ throw new NotReadyError(context);
453
+ }
406
454
  function updateIfNecessary(e) {
407
455
  if (e._ & REACTIVE_CHECK) {
408
456
  for (let t = e.D; t; t = t.P) {
@@ -425,15 +473,15 @@ function unlinkSubs(e) {
425
473
  const t = e.V;
426
474
  const n = e.P;
427
475
  const i = e.p;
428
- const r = e.ce;
429
- if (i !== null) i.ce = r;
430
- else t.ae = r;
476
+ const r = e.ae;
477
+ if (i !== null) i.ae = r;
478
+ else t.fe = r;
431
479
  if (r !== null) r.p = i;
432
480
  else {
433
481
  t.O = i;
434
482
  if (i === null) {
435
- t.fe?.();
436
- t.m && !t.Ee && unobserved(t);
483
+ t.Ee?.();
484
+ t.m && !t.de && unobserved(t);
437
485
  }
438
486
  }
439
487
  return n;
@@ -459,9 +507,9 @@ function link(e, t) {
459
507
  return;
460
508
  }
461
509
  }
462
- const s = e.ae;
510
+ const s = e.fe;
463
511
  if (s !== null && s.A === t && (!r || isValidLink(s, t))) return;
464
- const o = (t.re = e.ae = { V: e, A: t, P: i, ce: s, p: null });
512
+ const o = (t.re = e.fe = { V: e, A: t, P: i, ae: s, p: null });
465
513
  if (n !== null) n.P = o;
466
514
  else t.D = o;
467
515
  if (s !== null) s.p = o;
@@ -492,7 +540,7 @@ function markDisposal(e) {
492
540
  insertIntoHeap(t, zombieQueue);
493
541
  }
494
542
  markDisposal(t);
495
- t = t.de;
543
+ t = t.Te;
496
544
  }
497
545
  }
498
546
  function dispose(e) {
@@ -509,7 +557,7 @@ function disposeChildren(e, t = false, n) {
509
557
  if (t) e._ = REACTIVE_DISPOSED;
510
558
  let i = n ? e.ne : e.ie;
511
559
  while (i) {
512
- const e = i.de;
560
+ const e = i.Te;
513
561
  if (i.D) {
514
562
  const e = i;
515
563
  deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
@@ -527,7 +575,7 @@ function disposeChildren(e, t = false, n) {
527
575
  e.ne = null;
528
576
  } else {
529
577
  e.ie = null;
530
- e.de = null;
578
+ e.Te = null;
531
579
  }
532
580
  runDisposal(e, n);
533
581
  }
@@ -545,7 +593,7 @@ function runDisposal(e, t) {
545
593
  t ? (e.ee = null) : (e.te = null);
546
594
  }
547
595
  function getNextChildId(e) {
548
- if (e.id != null) return formatId(e.id, e.Te++);
596
+ if (e.id != null) return formatId(e.id, e.he++);
549
597
  throw new Error("Cannot get child id from owner without an id");
550
598
  }
551
599
  function formatId(e, t) {
@@ -558,23 +606,23 @@ function computed(e, t, n) {
558
606
  id: n?.id ?? (context?.id != null ? getNextChildId(context) : undefined),
559
607
  oe: n?.equals != null ? n.equals : isEqual,
560
608
  Re: !!n?.pureWrite,
561
- fe: n?.unobserved,
609
+ Ee: n?.unobserved,
562
610
  te: null,
563
- he: context?.he ?? globalQueue,
564
- _e: context?._e ?? defaultContext,
565
- Te: 0,
611
+ _e: context?._e ?? globalQueue,
612
+ Se: context?.Se ?? defaultContext,
613
+ he: 0,
566
614
  m: e,
567
615
  j: t,
568
616
  o: 0,
569
617
  N: null,
570
- R: undefined,
618
+ h: undefined,
571
619
  T: null,
572
620
  D: null,
573
621
  re: null,
574
622
  O: null,
575
- ae: null,
623
+ fe: null,
576
624
  i: context,
577
- de: null,
625
+ Te: null,
578
626
  ie: null,
579
627
  _: REACTIVE_NONE,
580
628
  J: STATUS_UNINITIALIZED,
@@ -582,9 +630,10 @@ function computed(e, t, n) {
582
630
  W: NOT_PENDING,
583
631
  ee: null,
584
632
  ne: null,
633
+ ce: null,
585
634
  B: null
586
635
  };
587
- if (n?.Se) Object.assign(i, n.Se);
636
+ if (n?.Oe) Object.assign(i, n.Oe);
588
637
  i.T = i;
589
638
  const r = context?.t ? context.u : context;
590
639
  if (context) {
@@ -592,7 +641,7 @@ function computed(e, t, n) {
592
641
  if (e === null) {
593
642
  context.ie = i;
594
643
  } else {
595
- i.de = e;
644
+ i.Te = e;
596
645
  context.ie = i;
597
646
  }
598
647
  }
@@ -600,74 +649,15 @@ function computed(e, t, n) {
600
649
  recompute(i, true);
601
650
  return i;
602
651
  }
603
- function asyncComputed(e, t, n) {
604
- let i = undefined;
605
- let r = false;
606
- const fn = t => {
607
- const n = e(t, r);
608
- r = false;
609
- i = n;
610
- const o = n instanceof Promise;
611
- const u = n[Symbol.asyncIterator];
612
- if (!o && !u) {
613
- return n;
614
- }
615
- if (o) {
616
- n.then(e => {
617
- if (i !== n) return;
618
- globalQueue.initTransition(s);
619
- setSignal(s, () => e);
620
- flush();
621
- }).catch(e => {
622
- if (i !== n) return;
623
- globalQueue.initTransition(s);
624
- setStatusFlags(s, STATUS_ERROR, e);
625
- s.se = clock;
626
- notifySubs(s);
627
- schedule();
628
- flush();
629
- });
630
- } else {
631
- (async () => {
632
- try {
633
- for await (let e of n) {
634
- if (i !== n) return;
635
- globalQueue.initTransition(s);
636
- setSignal(s, () => e);
637
- flush();
638
- }
639
- } catch (e) {
640
- if (i !== n) return;
641
- globalQueue.initTransition(s);
642
- setStatusFlags(s, STATUS_ERROR, e);
643
- s.se = clock;
644
- notifySubs(s);
645
- schedule();
646
- flush();
647
- }
648
- })();
649
- }
650
- globalQueue.initTransition(context);
651
- throw new NotReadyError(context);
652
- };
653
- const s = computed(fn, t, n);
654
- s.Oe = () => {
655
- r = true;
656
- recompute(s);
657
- schedule();
658
- flush();
659
- };
660
- return s;
661
- }
662
652
  function signal(e, t, n = null) {
663
653
  const i = {
664
654
  id: t?.id ?? (context?.id != null ? getNextChildId(context) : undefined),
665
655
  oe: t?.equals != null ? t.equals : isEqual,
666
656
  Re: !!t?.pureWrite,
667
- fe: t?.unobserved,
657
+ Ee: t?.unobserved,
668
658
  j: e,
669
659
  O: null,
670
- ae: null,
660
+ fe: null,
671
661
  J: STATUS_NONE,
672
662
  se: clock,
673
663
  U: n,
@@ -692,6 +682,7 @@ function untrack(e) {
692
682
  function read(e) {
693
683
  let t = context;
694
684
  if (t?.t) t = t.u;
685
+ if (refreshing && e.m) recompute(e);
695
686
  if (t && tracking && !pendingCheck && !pendingValueCheck) {
696
687
  if (e.m && e._ & REACTIVE_DISPOSED) recompute(e);
697
688
  link(e, t);
@@ -798,12 +789,12 @@ function createOwner(e) {
798
789
  t: true,
799
790
  u: t?.t ? t.u : t,
800
791
  ie: null,
801
- de: null,
792
+ Te: null,
802
793
  te: null,
803
794
  id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
804
- he: t?.he ?? globalQueue,
805
- _e: t?._e || defaultContext,
806
- Te: 0,
795
+ _e: t?._e ?? globalQueue,
796
+ Se: t?.Se || defaultContext,
797
+ he: 0,
807
798
  ee: null,
808
799
  ne: null,
809
800
  i: t,
@@ -816,7 +807,7 @@ function createOwner(e) {
816
807
  if (e === null) {
817
808
  t.ie = n;
818
809
  } else {
819
- n.de = e;
810
+ n.Te = e;
820
811
  t.ie = n;
821
812
  }
822
813
  }
@@ -866,6 +857,22 @@ function isPending(e) {
866
857
  pendingCheck = t;
867
858
  }
868
859
  }
860
+ function refresh(e) {
861
+ let t = refreshing;
862
+ refreshing = true;
863
+ try {
864
+ return untrack(e);
865
+ } finally {
866
+ refreshing = t;
867
+ if (!t) {
868
+ schedule();
869
+ flush();
870
+ }
871
+ }
872
+ }
873
+ function isRefreshing() {
874
+ return refreshing;
875
+ }
869
876
  function createContext(e, t) {
870
877
  return { id: Symbol(t), defaultValue: e };
871
878
  }
@@ -873,7 +880,7 @@ function getContext(e, t = getOwner()) {
873
880
  if (!t) {
874
881
  throw new NoOwnerError();
875
882
  }
876
- const n = hasContext(e, t) ? t._e[e.id] : e.defaultValue;
883
+ const n = hasContext(e, t) ? t.Se[e.id] : e.defaultValue;
877
884
  if (isUndefined(n)) {
878
885
  throw new ContextNotFoundError();
879
886
  }
@@ -883,10 +890,10 @@ function setContext(e, t, n = getOwner()) {
883
890
  if (!n) {
884
891
  throw new NoOwnerError();
885
892
  }
886
- n._e = { ...n._e, [e.id]: isUndefined(t) ? e.defaultValue : t };
893
+ n.Se = { ...n.Se, [e.id]: isUndefined(t) ? e.defaultValue : t };
887
894
  }
888
895
  function hasContext(e, t) {
889
- return !isUndefined(t?._e[e.id]);
896
+ return !isUndefined(t?.Se[e.id]);
890
897
  }
891
898
  function isUndefined(e) {
892
899
  return typeof e === "undefined";
@@ -895,7 +902,7 @@ function effect(e, t, n, i, r) {
895
902
  let s = false;
896
903
  const o = computed(e, i, {
897
904
  ...r,
898
- Se: {
905
+ Oe: {
899
906
  M: true,
900
907
  pe: i,
901
908
  Ae: t,
@@ -906,11 +913,11 @@ function effect(e, t, n, i, r) {
906
913
  if (s) {
907
914
  const n = this.J && this.J === t && e;
908
915
  this.M = !(this.J & STATUS_ERROR) && !(this.J & STATUS_PENDING & ~t) && !n;
909
- if (this.M) this.he.enqueue(this.K, runEffect.bind(this));
916
+ if (this.M) this._e.enqueue(this.K, runEffect.bind(this));
910
917
  }
911
918
  if (this.J & STATUS_ERROR) {
912
919
  let e = this.Y;
913
- this.he.notify(this, STATUS_PENDING, 0);
920
+ this._e.notify(this, STATUS_PENDING, 0);
914
921
  if (this.K === EFFECT_USER) {
915
922
  try {
916
923
  return this.Ne
@@ -923,9 +930,9 @@ function effect(e, t, n, i, r) {
923
930
  e = t;
924
931
  }
925
932
  }
926
- if (!this.he.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
933
+ if (!this._e.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
927
934
  } else if (this.K === EFFECT_RENDER) {
928
- this.he.notify(this, STATUS_PENDING | STATUS_ERROR, this.J);
935
+ this._e.notify(this, STATUS_PENDING | STATUS_ERROR, this.J);
929
936
  }
930
937
  }
931
938
  }
@@ -934,7 +941,7 @@ function effect(e, t, n, i, r) {
934
941
  if (o.K === EFFECT_RENDER) o.m = t => staleValues(() => e(t));
935
942
  !r?.defer &&
936
943
  !(o.J & (STATUS_ERROR | STATUS_PENDING)) &&
937
- (o.K === EFFECT_USER ? o.he.enqueue(o.K, runEffect.bind(o)) : runEffect.call(o));
944
+ (o.K === EFFECT_USER ? o._e.enqueue(o.K, runEffect.bind(o)) : runEffect.call(o));
938
945
  onCleanup(() => o.Ie?.());
939
946
  }
940
947
  function runEffect() {
@@ -944,7 +951,7 @@ function runEffect() {
944
951
  try {
945
952
  this.Ie = this.Ae(this.j, this.pe);
946
953
  } catch (e) {
947
- if (!this.he.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
954
+ if (!this._e.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
948
955
  } finally {
949
956
  this.pe = this.j;
950
957
  this.M = false;
@@ -964,12 +971,6 @@ function createMemo(e, t, n) {
964
971
  let i = computed(e, t, n);
965
972
  return read.bind(null, i);
966
973
  }
967
- function createAsync(e, t, n) {
968
- const i = asyncComputed(e, t, n);
969
- const r = read.bind(null, i);
970
- r.refresh = i.Oe;
971
- return r;
972
- }
973
974
  function createEffect(e, t, n, i) {
974
975
  void effect(e, t.effect || t, t.error, n, i);
975
976
  }
@@ -1049,7 +1050,7 @@ function applyState(e, t, n, i) {
1049
1050
  let t = false;
1050
1051
  const l = getOverrideValue(s, o, u, "length");
1051
1052
  if (e.length && l && e[0] && n(e[0]) != null) {
1052
- let c, a, f, E, d, T, R, h;
1053
+ let c, a, f, E, d, T, h, R;
1053
1054
  for (
1054
1055
  f = 0, E = Math.min(l, e.length);
1055
1056
  f < E && ((T = getOverrideValue(s, o, u, f)) === e[f] || (T && e[f] && n(T) === n(e[f])));
@@ -1083,22 +1084,22 @@ function applyState(e, t, n, i) {
1083
1084
  l !== e.length && r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
1084
1085
  return;
1085
1086
  }
1086
- R = new Array(d + 1);
1087
+ h = new Array(d + 1);
1087
1088
  for (a = d; a >= f; a--) {
1088
1089
  T = e[a];
1089
- h = T ? n(T) : T;
1090
- c = S.get(h);
1091
- R[a] = c === undefined ? -1 : c;
1092
- S.set(h, a);
1090
+ R = T ? n(T) : T;
1091
+ c = S.get(R);
1092
+ h[a] = c === undefined ? -1 : c;
1093
+ S.set(R, a);
1093
1094
  }
1094
1095
  for (c = f; c <= E; c++) {
1095
1096
  T = getOverrideValue(s, o, u, c);
1096
- h = T ? n(T) : T;
1097
- a = S.get(h);
1097
+ R = T ? n(T) : T;
1098
+ a = S.get(R);
1098
1099
  if (a !== undefined && a !== -1) {
1099
1100
  _[a] = T;
1100
- a = R[a];
1101
- S.set(h, a);
1101
+ a = h[a];
1102
+ S.set(R, a);
1102
1103
  }
1103
1104
  }
1104
1105
  for (a = f; a < e.length; a++) {
@@ -1173,11 +1174,12 @@ function createProjectionInternal(e, t = {}, n) {
1173
1174
  };
1174
1175
  const s = wrapProjection(t);
1175
1176
  i = computed(() => {
1176
- storeSetter(s, t => {
1177
- const i = e(t);
1178
- if (i !== t && i !== undefined) {
1179
- reconcile(i, n?.key || "id", n?.all)(t);
1180
- }
1177
+ const t = i || getOwner();
1178
+ storeSetter(s, i => {
1179
+ const r = handleAsync(t, e(i), e => {
1180
+ e !== i && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
1181
+ });
1182
+ r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(i);
1181
1183
  });
1182
1184
  });
1183
1185
  return { store: s, node: i };
@@ -1710,7 +1712,7 @@ function updateKeyedMap() {
1710
1712
  E = new Array(t),
1711
1713
  d = new Array(t),
1712
1714
  T = this.Ue ? new Array(t) : undefined,
1713
- R = this.me ? new Array(t) : undefined;
1715
+ h = this.me ? new Array(t) : undefined;
1714
1716
  for (
1715
1717
  s = 0, o = Math.min(this.ye, t);
1716
1718
  s < o && (this.De[s] === e[s] || (this.Ue && compare(this.Ve, this.De[s], e[s])));
@@ -1728,7 +1730,7 @@ function updateKeyedMap() {
1728
1730
  E[u] = this.we[o];
1729
1731
  d[u] = this.be[o];
1730
1732
  T && (T[u] = this.Ue[o]);
1731
- R && (R[u] = this.me[o]);
1733
+ h && (h[u] = this.me[o]);
1732
1734
  }
1733
1735
  a = new Map();
1734
1736
  f = new Array(u + 1);
@@ -1747,7 +1749,7 @@ function updateKeyedMap() {
1747
1749
  E[i] = this.we[n];
1748
1750
  d[i] = this.be[n];
1749
1751
  T && (T[i] = this.Ue[n]);
1750
- R && (R[i] = this.me[n]);
1752
+ h && (h[i] = this.me[n]);
1751
1753
  i = f[i];
1752
1754
  a.set(c, i);
1753
1755
  } else this.be[n].dispose();
@@ -1760,8 +1762,8 @@ function updateKeyedMap() {
1760
1762
  this.Ue[i] = T[i];
1761
1763
  setSignal(this.Ue[i], e[i]);
1762
1764
  }
1763
- if (R) {
1764
- this.me[i] = R[i];
1765
+ if (h) {
1766
+ this.me[i] = h[i];
1765
1767
  setSignal(this.me[i], i);
1766
1768
  }
1767
1769
  } else {
@@ -1839,26 +1841,26 @@ function compare(e, t, n) {
1839
1841
  }
1840
1842
  function boundaryComputed(e, t) {
1841
1843
  const n = computed(e, undefined, {
1842
- Se: {
1844
+ Oe: {
1843
1845
  le() {
1844
1846
  let e = this.J;
1845
1847
  this.J &= ~this.He;
1846
1848
  if (this.He & STATUS_PENDING && !(this.J & STATUS_UNINITIALIZED)) {
1847
1849
  e &= ~STATUS_PENDING;
1848
1850
  }
1849
- this.he.notify(this, this.He, e);
1851
+ this._e.notify(this, this.He, e);
1850
1852
  },
1851
1853
  He: t
1852
1854
  }
1853
1855
  });
1854
1856
  n.He = t;
1855
- n.Ee = true;
1857
+ n.de = true;
1856
1858
  return n;
1857
1859
  }
1858
1860
  function createBoundChildren(e, t, n, i) {
1859
- const r = e.he;
1860
- r.addChild((e.he = n));
1861
- onCleanup(() => r.removeChild(e.he));
1861
+ const r = e._e;
1862
+ r.addChild((e._e = n));
1863
+ onCleanup(() => r.removeChild(e._e));
1862
1864
  return runWithOwner(e, () => {
1863
1865
  const e = computed(t);
1864
1866
  return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
@@ -2039,7 +2041,6 @@ export {
2039
2041
  NoOwnerError,
2040
2042
  NotReadyError,
2041
2043
  SUPPORTS_PROXY,
2042
- createAsync,
2043
2044
  createBoundary,
2044
2045
  createContext,
2045
2046
  createEffect,
@@ -2064,6 +2065,7 @@ export {
2064
2065
  getOwner,
2065
2066
  isEqual,
2066
2067
  isPending,
2068
+ isRefreshing,
2067
2069
  isWrappable,
2068
2070
  mapArray,
2069
2071
  merge,
@@ -2072,6 +2074,7 @@ export {
2072
2074
  onSettled,
2073
2075
  pending,
2074
2076
  reconcile,
2077
+ refresh,
2075
2078
  repeat,
2076
2079
  resolve,
2077
2080
  runWithOwner,
@@ -64,6 +64,7 @@ export interface Computed<T> extends RawSignal<T>, Owner {
64
64
  _nextHeap: Computed<any> | undefined;
65
65
  _prevHeap: Computed<any>;
66
66
  _fn: (prev?: T) => T;
67
+ _inFlight: Promise<T> | AsyncIterable<T> | null;
67
68
  _child: FirewallSignal<any> | null;
68
69
  _notifyQueue?: (statusFlagsChanged: boolean, prevStatusFlags: number) => void;
69
70
  }
@@ -74,16 +75,11 @@ export interface Root extends Owner {
74
75
  }
75
76
  export declare let context: Owner | null;
76
77
  export declare function recompute(el: Computed<any>, create?: boolean): void;
78
+ export declare function handleAsync<T>(el: Computed<T>, result: T | Promise<T> | AsyncIterable<T>, setter?: (value: T) => void): T;
77
79
  export declare function dispose(node: Computed<unknown>): void;
78
80
  export declare function getNextChildId(owner: Owner): string;
79
- export declare function computed<T>(fn: (prev?: T) => T): Computed<T>;
80
- export declare function computed<T>(fn: (prev: T) => T, initialValue?: T, options?: SignalOptions<T>): Computed<T>;
81
- export declare function asyncComputed<T>(asyncFn: (prev?: T, refreshing?: boolean) => T | Promise<T> | AsyncIterable<T>): Computed<T> & {
82
- _refresh: () => void;
83
- };
84
- export declare function asyncComputed<T>(asyncFn: (prev: T, refreshing?: boolean) => T | Promise<T> | AsyncIterable<T>, initialValue: T, options?: SignalOptions<T>): Computed<T> & {
85
- _refresh: () => void;
86
- };
81
+ export declare function computed<T>(fn: (prev?: T) => T | Promise<T> | AsyncIterable<T>): Computed<T>;
82
+ export declare function computed<T>(fn: (prev: T) => T | Promise<T> | AsyncIterable<T>, initialValue?: T, options?: SignalOptions<T>): Computed<T>;
87
83
  export declare function signal<T>(v: T, options?: SignalOptions<T>): Signal<T>;
88
84
  export declare function signal<T>(v: T, options?: SignalOptions<T>, firewall?: Computed<any>): FirewallSignal<T>;
89
85
  export declare function isEqual<T>(a: T, b: T): boolean;
@@ -121,3 +117,5 @@ export declare function runWithOwner<T>(owner: Owner | null, fn: () => T): T;
121
117
  export declare function staleValues<T>(fn: () => T, set?: boolean): T;
122
118
  export declare function pending<T>(fn: () => T): T;
123
119
  export declare function isPending(fn: () => any): boolean;
120
+ export declare function refresh<T>(fn: () => T): T;
121
+ export declare function isRefreshing(): boolean;
@@ -1,6 +1,6 @@
1
1
  export { ContextNotFoundError, NoOwnerError, NotReadyError } from "./error.js";
2
2
  export { createContext, getContext, setContext, type Context, type ContextRecord } from "./context.js";
3
- export { getObserver, isEqual, untrack, getOwner, runWithOwner, createOwner, createRoot, computed, dispose, signal, asyncComputed, read, setSignal, onCleanup, getNextChildId, isPending, pending, staleValues, type Owner, type Computed, type Root, type Signal, type SignalOptions } from "./core.js";
3
+ export { getObserver, isEqual, untrack, getOwner, runWithOwner, createOwner, createRoot, computed, dispose, signal, read, setSignal, onCleanup, getNextChildId, isPending, pending, refresh, isRefreshing, staleValues, handleAsync, type Owner, type Computed, type Root, type Signal, type SignalOptions } from "./core.js";
4
4
  export { effect, type Effect } from "./effect.js";
5
5
  export { flush, Queue, type IQueue, type QueueCallback } from "./scheduler.js";
6
6
  export * from "./constants.js";
@@ -1,4 +1,4 @@
1
- export { ContextNotFoundError, NoOwnerError, NotReadyError, createContext, createRoot, runWithOwner, flush, getNextChildId, getContext, setContext, getOwner, onCleanup, getObserver, isEqual, untrack, isPending, pending, SUPPORTS_PROXY } from "./core/index.js";
1
+ export { ContextNotFoundError, NoOwnerError, NotReadyError, createContext, createRoot, runWithOwner, flush, getNextChildId, getContext, setContext, getOwner, onCleanup, getObserver, isEqual, untrack, isPending, pending, isRefreshing, refresh, SUPPORTS_PROXY } from "./core/index.js";
2
2
  export type { Owner, SignalOptions, Context, ContextRecord, IQueue } from "./core/index.js";
3
3
  export * from "./signals.js";
4
4
  export { mapArray, repeat, type Maybe } from "./map.js";