@solidjs/signals 0.9.0 → 0.9.1

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
@@ -214,7 +214,7 @@ class GlobalQueue extends Queue {
214
214
  this.stashQueues(activeTransition.queueStash);
215
215
  clock++;
216
216
  scheduled = false;
217
- runPending(activeTransition.pendingNodes, true);
217
+ runTransitionPending(activeTransition.pendingNodes, true);
218
218
  activeTransition = null;
219
219
  return;
220
220
  }
@@ -222,18 +222,14 @@ class GlobalQueue extends Queue {
222
222
  this.restoreQueues(activeTransition.queueStash);
223
223
  transitions.delete(activeTransition);
224
224
  activeTransition = null;
225
- if (runPending(this.$, false)) runHeap(dirtyQueue, GlobalQueue.L);
225
+ runTransitionPending(this.$, false);
226
+ dirtyQueue.R >= dirtyQueue.C && runHeap(dirtyQueue, GlobalQueue.L);
226
227
  } else if (transitions.size) runHeap(zombieQueue, GlobalQueue.L);
227
- for (let e = 0; e < this.$.length; e++) {
228
- const t = this.$[e];
229
- if (t.W !== NOT_PENDING) {
230
- t.j = t.W;
231
- t.W = NOT_PENDING;
232
- if (t.K) t.M = true;
233
- }
234
- if (t.m) GlobalQueue.F(t, false, true);
228
+ runPending(this.$);
229
+ while (dirtyQueue.R >= dirtyQueue.C) {
230
+ runHeap(dirtyQueue, GlobalQueue.L);
231
+ runPending(this.$);
235
232
  }
236
- this.$.length = 0;
237
233
  clock++;
238
234
  scheduled = false;
239
235
  this.run(EFFECT_RENDER);
@@ -245,8 +241,8 @@ class GlobalQueue extends Queue {
245
241
  notify(e, t, n) {
246
242
  if (t & STATUS_PENDING) {
247
243
  if (n & STATUS_PENDING) {
248
- if (activeTransition && !activeTransition.asyncNodes.includes(e.Y.cause)) {
249
- activeTransition.asyncNodes.push(e.Y.cause);
244
+ if (activeTransition && !activeTransition.asyncNodes.includes(e.W.cause)) {
245
+ activeTransition.asyncNodes.push(e.W.cause);
250
246
  schedule();
251
247
  }
252
248
  }
@@ -257,7 +253,7 @@ class GlobalQueue extends Queue {
257
253
  initTransition(e) {
258
254
  if (activeTransition && activeTransition.time === clock) return;
259
255
  if (!activeTransition) {
260
- activeTransition = e.B ?? {
256
+ activeTransition = e.j ?? {
261
257
  time: clock,
262
258
  pendingNodes: [],
263
259
  asyncNodes: [],
@@ -268,29 +264,36 @@ class GlobalQueue extends Queue {
268
264
  activeTransition.time = clock;
269
265
  for (let e = 0; e < this.$.length; e++) {
270
266
  const t = this.$[e];
271
- t.B = activeTransition;
267
+ t.j = activeTransition;
272
268
  activeTransition.pendingNodes.push(t);
273
269
  }
274
270
  this.$ = activeTransition.pendingNodes;
275
271
  }
276
272
  }
277
- function runPending(e, t) {
278
- let n = false;
279
- const i = e.slice();
280
- for (let e = 0; e < i.length; e++) {
281
- const r = i[e];
282
- r.B = activeTransition;
283
- if (r.X) {
284
- r.X.q(t);
285
- n = true;
273
+ function runPending(e) {
274
+ for (let t = 0; t < e.length; t++) {
275
+ const n = e[t];
276
+ if (n.K !== NOT_PENDING) {
277
+ n.M = n.K;
278
+ n.K = NOT_PENDING;
279
+ if (n.Y) n.B = true;
286
280
  }
287
- if (r.Z && r.Z.W !== NOT_PENDING) {
288
- r.Z.q(r.Z.W);
289
- r.Z.W = NOT_PENDING;
290
- n = true;
281
+ if (n.X && n.X.K !== NOT_PENDING) n.X.q(n.X.K);
282
+ if (n.m) GlobalQueue.F(n, false, true);
283
+ }
284
+ e.length = 0;
285
+ }
286
+ function runTransitionPending(e, t) {
287
+ const n = e.slice();
288
+ for (let e = 0; e < n.length; e++) {
289
+ const i = n[e];
290
+ i.j = activeTransition;
291
+ if (i.Z) i.Z.q(t);
292
+ if (i.X && i.X.K !== NOT_PENDING) {
293
+ i.X.q(i.X.K);
294
+ i.X.K = NOT_PENDING;
291
295
  }
292
296
  }
293
- return n;
294
297
  }
295
298
  const globalQueue = new GlobalQueue();
296
299
  function flush() {
@@ -313,7 +316,7 @@ function transitionComplete(e) {
313
316
  }
314
317
  function runInTransition(e, t) {
315
318
  const n = activeTransition;
316
- activeTransition = e.B;
319
+ activeTransition = e.j;
317
320
  t(e);
318
321
  activeTransition = n;
319
322
  }
@@ -333,11 +336,11 @@ function notifySubs(e) {
333
336
  }
334
337
  }
335
338
  function recompute(e, t = false) {
336
- const n = e.K && e.B != activeTransition;
339
+ const n = e.Y && e.j != activeTransition;
337
340
  if (!t) {
338
- if (e.B && activeTransition !== e.B && !n) globalQueue.initTransition(e);
341
+ if (e.j && activeTransition !== e.j && !n) globalQueue.initTransition(e);
339
342
  deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
340
- if (e.B) disposeChildren(e);
343
+ if (e.j) disposeChildren(e);
341
344
  else {
342
345
  markDisposal(e);
343
346
  e.ee = e.te;
@@ -351,10 +354,10 @@ function recompute(e, t = false) {
351
354
  e.re = null;
352
355
  e._ = REACTIVE_RECOMPUTING_DEPS;
353
356
  e.se = clock;
354
- let r = e.W === NOT_PENDING ? e.j : e.W;
357
+ let r = e.K === NOT_PENDING ? e.M : e.K;
355
358
  let s = e.o;
356
359
  let o = e.J;
357
- let u = e.Y;
360
+ let u = e.W;
358
361
  let l = tracking;
359
362
  setStatusFlags(e, STATUS_NONE | (o & STATUS_UNINITIALIZED));
360
363
  tracking = true;
@@ -382,14 +385,14 @@ function recompute(e, t = false) {
382
385
  else e.D = null;
383
386
  }
384
387
  }
385
- const c = !e.oe || !e.oe(e.W === NOT_PENDING || e.ue || n ? e.j : e.W, r);
386
- const a = e.J !== o || e.Y !== u;
388
+ const c = !e.oe || !e.oe(e.K === NOT_PENDING || e.ue || n ? e.M : e.K, r);
389
+ const a = e.J !== o || e.W !== u;
387
390
  e.le?.(a, o);
388
391
  if (c || a) {
389
392
  if (c) {
390
- if (t || e.ue || n) e.j = r;
391
- else e.W = r;
392
- if (e.Z) e.Z.W = r;
393
+ if (t || e.ue || n) e.M = r;
394
+ else e.K = r;
395
+ if (e.X) e.X.K = r;
393
396
  }
394
397
  for (let t = e.O; t !== null; t = t.p) {
395
398
  const n = t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
@@ -401,8 +404,8 @@ function recompute(e, t = false) {
401
404
  insertIntoHeapHeight(t.A, t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
402
405
  }
403
406
  }
404
- if ((!t || e.J & STATUS_PENDING) && !e.ue && !e.B) globalQueue.$.push(e);
405
- if (e.B && n) runInTransition(e, recompute);
407
+ if ((!t || e.J & STATUS_PENDING) && !e.ue && !e.j) globalQueue.$.push(e);
408
+ if (e.j && n) runInTransition(e, recompute);
406
409
  }
407
410
  function handleAsync(e, t, n) {
408
411
  const i = typeof t === "object" && t !== null;
@@ -529,7 +532,7 @@ function isValidLink(e, t) {
529
532
  }
530
533
  function setStatusFlags(e, t, n = null) {
531
534
  e.J = t;
532
- e.Y = n;
535
+ e.W = n;
533
536
  }
534
537
  function markDisposal(e) {
535
538
  let t = e.ie;
@@ -612,7 +615,7 @@ function computed(e, t, n) {
612
615
  Se: context?.Se ?? defaultContext,
613
616
  he: 0,
614
617
  m: e,
615
- j: t,
618
+ M: t,
616
619
  o: 0,
617
620
  N: null,
618
621
  h: undefined,
@@ -627,11 +630,11 @@ function computed(e, t, n) {
627
630
  _: REACTIVE_NONE,
628
631
  J: STATUS_UNINITIALIZED,
629
632
  se: clock,
630
- W: NOT_PENDING,
633
+ K: NOT_PENDING,
631
634
  ee: null,
632
635
  ne: null,
633
636
  ce: null,
634
- B: null
637
+ j: null
635
638
  };
636
639
  if (n?.Oe) Object.assign(i, n.Oe);
637
640
  i.T = i;
@@ -655,14 +658,14 @@ function signal(e, t, n = null) {
655
658
  oe: t?.equals != null ? t.equals : isEqual,
656
659
  Re: !!t?.pureWrite,
657
660
  Ee: t?.unobserved,
658
- j: e,
661
+ M: e,
659
662
  O: null,
660
663
  fe: null,
661
664
  J: STATUS_NONE,
662
665
  se: clock,
663
666
  U: n,
664
667
  I: n?.N || null,
665
- W: NOT_PENDING
668
+ K: NOT_PENDING
666
669
  };
667
670
  n && (n.N = i);
668
671
  return i;
@@ -701,33 +704,33 @@ function read(e) {
701
704
  }
702
705
  }
703
706
  if (pendingCheck) {
704
- if (!e.X) {
705
- e.X = signal(false);
706
- e.X.ue = true;
707
- e.X.q = t => setSignal(e.X, t);
707
+ if (!e.Z) {
708
+ e.Z = signal(false);
709
+ e.Z.ue = true;
710
+ e.Z.q = t => setSignal(e.Z, t);
708
711
  }
709
712
  const t = pendingCheck;
710
713
  pendingCheck = null;
711
- t.j = read(e.X) || t.j;
714
+ t.M = read(e.Z) || t.M;
712
715
  pendingCheck = t;
713
716
  }
714
717
  if (pendingValueCheck) {
715
- if (!e.Z) {
716
- e.Z = signal(e.j);
717
- e.Z.ue = true;
718
- e.Z.q = t => setSignal(e.Z, t);
718
+ if (!e.X) {
719
+ e.X = signal(e.M);
720
+ e.X.ue = true;
721
+ e.X.q = t => setSignal(e.X, t);
719
722
  }
720
723
  pendingValueCheck = false;
721
724
  try {
722
- return read(e.Z);
725
+ return read(e.X);
723
726
  } finally {
724
727
  pendingValueCheck = true;
725
728
  }
726
729
  }
727
730
  if (e.J & STATUS_PENDING && !pendingCheck) {
728
- if ((t && !stale) || e.J & STATUS_UNINITIALIZED) throw e.Y;
731
+ if ((t && !stale) || e.J & STATUS_UNINITIALIZED) throw e.W;
729
732
  else if (t && stale) {
730
- setStatusFlags(t, t.J | 1, e.Y);
733
+ setStatusFlags(t, t.J | 1, e.W);
731
734
  }
732
735
  }
733
736
  if (e.J & STATUS_ERROR) {
@@ -735,29 +738,29 @@ function read(e) {
735
738
  recompute(e, true);
736
739
  return read(e);
737
740
  } else {
738
- throw e.Y;
741
+ throw e.W;
739
742
  }
740
743
  }
741
744
  return !t ||
742
745
  e.ue ||
743
- e.W === NOT_PENDING ||
744
- (stale && !pendingCheck && e.B && activeTransition !== e.B)
745
- ? e.j
746
- : e.W;
746
+ e.K === NOT_PENDING ||
747
+ (stale && !pendingCheck && e.j && activeTransition !== e.j)
748
+ ? e.M
749
+ : e.K;
747
750
  }
748
751
  function setSignal(e, t) {
749
752
  if (typeof t === "function") {
750
- t = t(e.W === NOT_PENDING ? e.j : e.W);
753
+ t = t(e.K === NOT_PENDING ? e.M : e.K);
751
754
  }
752
- const n = !e.oe || !e.oe(e.W === NOT_PENDING || e.ue ? e.j : e.W, t);
755
+ const n = !e.oe || !e.oe(e.K === NOT_PENDING || e.ue ? e.M : e.K, t);
753
756
  if (!n && !e.J) return t;
754
757
  if (n) {
755
- if (e.ue) e.j = t;
758
+ if (e.ue) e.M = t;
756
759
  else {
757
- if (e.W === NOT_PENDING) globalQueue.$.push(e);
758
- e.W = t;
760
+ if (e.K === NOT_PENDING) globalQueue.$.push(e);
761
+ e.K = t;
759
762
  }
760
- if (e.Z) e.Z.W = t;
763
+ if (e.X) e.X.K = t;
761
764
  }
762
765
  setStatusFlags(e, STATUS_NONE);
763
766
  e.se = clock;
@@ -846,10 +849,10 @@ function pending(e) {
846
849
  }
847
850
  function isPending(e) {
848
851
  const t = pendingCheck;
849
- pendingCheck = { j: false };
852
+ pendingCheck = { M: false };
850
853
  try {
851
854
  staleValues(e);
852
- return pendingCheck.j;
855
+ return pendingCheck.M;
853
856
  } catch (e) {
854
857
  if (!(e instanceof NotReadyError)) return false;
855
858
  throw e;
@@ -903,22 +906,22 @@ function effect(e, t, n, i, r) {
903
906
  const o = computed(e, i, {
904
907
  ...r,
905
908
  Oe: {
906
- M: true,
909
+ B: true,
907
910
  pe: i,
908
911
  Ae: t,
909
912
  Ne: n,
910
913
  Ie: undefined,
911
- K: r?.render ? EFFECT_RENDER : EFFECT_USER,
914
+ Y: r?.render ? EFFECT_RENDER : EFFECT_USER,
912
915
  le(e, t) {
913
916
  if (s) {
914
917
  const n = this.J && this.J === t && e;
915
- this.M = !(this.J & STATUS_ERROR) && !(this.J & STATUS_PENDING & ~t) && !n;
916
- if (this.M) this._e.enqueue(this.K, runEffect.bind(this));
918
+ this.B = !(this.J & STATUS_ERROR) && !(this.J & STATUS_PENDING & ~t) && !n;
919
+ if (this.B) this._e.enqueue(this.Y, runEffect.bind(this));
917
920
  }
918
921
  if (this.J & STATUS_ERROR) {
919
- let e = this.Y;
922
+ let e = this.W;
920
923
  this._e.notify(this, STATUS_PENDING, 0);
921
- if (this.K === EFFECT_USER) {
924
+ if (this.Y === EFFECT_USER) {
922
925
  try {
923
926
  return this.Ne
924
927
  ? this.Ne(e, () => {
@@ -931,30 +934,30 @@ function effect(e, t, n, i, r) {
931
934
  }
932
935
  }
933
936
  if (!this._e.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
934
- } else if (this.K === EFFECT_RENDER) {
937
+ } else if (this.Y === EFFECT_RENDER) {
935
938
  this._e.notify(this, STATUS_PENDING | STATUS_ERROR, this.J);
936
939
  }
937
940
  }
938
941
  }
939
942
  });
940
943
  s = true;
941
- if (o.K === EFFECT_RENDER) o.m = t => staleValues(() => e(t));
944
+ if (o.Y === EFFECT_RENDER) o.m = t => staleValues(() => e(t));
942
945
  !r?.defer &&
943
946
  !(o.J & (STATUS_ERROR | STATUS_PENDING)) &&
944
- (o.K === EFFECT_USER ? o._e.enqueue(o.K, runEffect.bind(o)) : runEffect.call(o));
947
+ (o.Y === EFFECT_USER ? o._e.enqueue(o.Y, runEffect.bind(o)) : runEffect.call(o));
945
948
  onCleanup(() => o.Ie?.());
946
949
  }
947
950
  function runEffect() {
948
- if (!this.M || this._ & REACTIVE_DISPOSED) return;
951
+ if (!this.B || this._ & REACTIVE_DISPOSED) return;
949
952
  this.Ie?.();
950
953
  this.Ie = undefined;
951
954
  try {
952
- this.Ie = this.Ae(this.j, this.pe);
955
+ this.Ie = this.Ae(this.M, this.pe);
953
956
  } catch (e) {
954
957
  if (!this._e.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
955
958
  } finally {
956
- this.pe = this.j;
957
- this.M = false;
959
+ this.pe = this.M;
960
+ this.B = false;
958
961
  }
959
962
  }
960
963
  function createSignal(e, t, n) {
@@ -1279,7 +1282,7 @@ const storeTraps = {
1279
1282
  if (e && e.get) return e.get.call(n);
1280
1283
  }
1281
1284
  if (Writing?.has(n)) {
1282
- let n = r && (s || !o) ? (r.W !== NOT_PENDING ? r.W : r.j) : u[t];
1285
+ let n = r && (s || !o) ? (r.K !== NOT_PENDING ? r.K : r.M) : u[t];
1283
1286
  n === $DELETED && (n = undefined);
1284
1287
  if (!isWrappable(n)) return n;
1285
1288
  const i = wrap(n, e);
@@ -1976,7 +1979,7 @@ function collectErrorSources(e, t) {
1976
1979
  function createErrorBoundary(e, t) {
1977
1980
  return createCollectionBoundary(STATUS_ERROR, e, e => {
1978
1981
  let n = e.be.values().next().value;
1979
- return t(n.Y, () => {
1982
+ return t(n.W, () => {
1980
1983
  const t = [];
1981
1984
  for (const n of e.be) collectErrorSources(n, t);
1982
1985
  for (const e of t) recompute(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/signals",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",