@solidjs/signals 2.0.0-rc.14 → 2.0.0-rc.15

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 (66) hide show
  1. package/dist/dev-shared.js +248 -189
  2. package/dist/dev.attribution.js +124 -41
  3. package/dist/dev.js +553 -322
  4. package/dist/observe/affects.js +34 -31
  5. package/dist/observe/boundaries.js +166 -132
  6. package/dist/observe/core/async.js +90 -83
  7. package/dist/observe/core/attribution-queries.js +1 -1
  8. package/dist/observe/core/attribution.js +281 -197
  9. package/dist/observe/core/constants.js +7 -2
  10. package/dist/observe/core/context.js +3 -3
  11. package/dist/observe/core/core.js +277 -245
  12. package/dist/observe/core/dev.js +3 -3
  13. package/dist/observe/core/effect.js +21 -21
  14. package/dist/observe/core/external.js +2 -2
  15. package/dist/observe/core/graph.js +25 -25
  16. package/dist/observe/core/heap.js +9 -9
  17. package/dist/observe/core/lanes.js +206 -160
  18. package/dist/observe/core/owner.js +27 -27
  19. package/dist/observe/core/scheduler.js +92 -86
  20. package/dist/observe/core/verdict.js +66 -54
  21. package/dist/observe/map.js +35 -35
  22. package/dist/observe/reveal.js +24 -24
  23. package/dist/observe/signals.js +38 -28
  24. package/dist/observe/store/affects.js +75 -68
  25. package/dist/observe/store/hooks.js +13 -0
  26. package/dist/observe/store/index.js +0 -2
  27. package/dist/observe/store/optimistic.js +67 -34
  28. package/dist/observe/store/projection.js +37 -31
  29. package/dist/observe/store/reconcile.js +32 -30
  30. package/dist/observe/store/store.js +128 -85
  31. package/dist/prod/affects.js +34 -31
  32. package/dist/prod/boundaries.js +143 -109
  33. package/dist/prod/core/async.js +64 -67
  34. package/dist/prod/core/constants.js +7 -2
  35. package/dist/prod/core/context.js +3 -3
  36. package/dist/prod/core/core.js +302 -270
  37. package/dist/prod/core/effect.js +38 -38
  38. package/dist/prod/core/external.js +4 -4
  39. package/dist/prod/core/graph.js +27 -27
  40. package/dist/prod/core/heap.js +30 -30
  41. package/dist/prod/core/lanes.js +257 -211
  42. package/dist/prod/core/owner.js +39 -39
  43. package/dist/prod/core/scheduler.js +125 -119
  44. package/dist/prod/core/verdict.js +70 -58
  45. package/dist/prod/map.js +73 -73
  46. package/dist/prod/reveal.js +38 -38
  47. package/dist/prod/signals.js +30 -20
  48. package/dist/prod/store/affects.js +75 -68
  49. package/dist/prod/store/hooks.js +13 -0
  50. package/dist/prod/store/index.js +0 -2
  51. package/dist/prod/store/optimistic.js +114 -81
  52. package/dist/prod/store/projection.js +30 -24
  53. package/dist/prod/store/reconcile.js +32 -30
  54. package/dist/prod/store/store.js +136 -93
  55. package/dist/types/boundaries.d.ts +4 -0
  56. package/dist/types/core/attribution.d.ts +6 -2
  57. package/dist/types/core/constants.d.ts +5 -0
  58. package/dist/types/core/core.d.ts +33 -3
  59. package/dist/types/core/lanes.d.ts +10 -0
  60. package/dist/types/core/scheduler.d.ts +12 -6
  61. package/dist/types/core/types.d.ts +0 -6
  62. package/dist/types/store/affects.d.ts +11 -0
  63. package/dist/types/store/hooks.d.ts +48 -0
  64. package/dist/types/store/index.d.ts +0 -1
  65. package/dist/types/store/store.d.ts +3 -38
  66. package/package.json +1 -1
@@ -6,7 +6,9 @@ import "./core/dev.js";
6
6
 
7
7
  import { enqueueSub } from "./core/heap.js";
8
8
 
9
- import { GlobalQueue, schedule, resolveTx, flushTransaction } from "./core/scheduler.js";
9
+ import { schedule, resolveTx, flushTransaction, GlobalQueue } from "./core/scheduler.js";
10
+
11
+ import { storeMarks, installStoreAffects, releaseMarkScope } from "./store/affects.js";
10
12
 
11
13
  import { $TARGET } from "./store/types.js";
12
14
 
@@ -38,12 +40,12 @@ let active = 0;
38
40
  /** The verdict readers downstream of `node` — through derivations, stopping
39
41
  * at effects — re-derive: the mark's one notification (a probe's answer
40
42
  * changed with no value notifying anyone). */ function repoll(e, t = new Set) {
41
- for (let n = e.t; n !== null; n = n.l) {
42
- const e = n.o;
43
+ for (let r = e.t; r !== null; r = r.o) {
44
+ const e = r.l;
43
45
  if (t.has(e)) continue;
44
46
  t.add(e);
45
- if (e.u & CONFIG_VERDICT) enqueueSub(e);
46
- if (!e.i) repoll(e, t);
47
+ if (e.i & CONFIG_VERDICT) enqueueSub(e);
48
+ if (!e.u) repoll(e, t);
47
49
  }
48
50
  }
49
51
 
@@ -53,13 +55,13 @@ let active = 0;
53
55
  * (a direct mark on one still reads pending). Mid-recompute, only the
54
56
  * validated prefix of the dependency list is this pass's. */ function marked(e, t) {
55
57
  if (e.m !== null && e.m.T !== 0) return true;
56
- const n = e;
57
- if (n.G & STATUS_ERROR || t.has(e)) return false;
58
+ const r = e;
59
+ if (r.S & STATUS_ERROR || t.has(e)) return false;
58
60
  t.add(e);
59
- const r = n.R & REACTIVE_RECOMPUTING_DEPS ? n.S : undefined;
60
- if (r !== null) for (let e = n._ ?? null; e !== null; e = e.p) {
61
+ const n = r.R & REACTIVE_RECOMPUTING_DEPS ? r.p : undefined;
62
+ if (n !== null) for (let e = r.G ?? null; e !== null; e = e._) {
61
63
  if (marked(e.I, t)) return true;
62
- if (e === r) break;
64
+ if (e === n) break;
63
65
  }
64
66
  return false;
65
67
  }
@@ -67,13 +69,13 @@ let active = 0;
67
69
  /** Releases one scope's marks (a landed transaction's, the ambient list at
68
70
  * the seam): a node whose last mark drops re-derives its verdict readers. */ function release(e) {
69
71
  for (let t = 0; t < e.length; t++) {
70
- const n = e[t];
72
+ const r = e[t];
71
73
  active--;
72
- if (--n.m.T === 0) {
73
- repoll(n);
74
+ if (--r.m.T === 0) {
75
+ repoll(r);
74
76
  // A store mark's carrier: its scope (and the marks the nodes born in
75
77
  // its window inherited) goes with it.
76
- GlobalQueue.N?.(n);
78
+ releaseMarkScope(r);
77
79
  }
78
80
  }
79
81
  e.length = 0;
@@ -84,8 +86,8 @@ let active = 0;
84
86
  mark(e);
85
87
  const t = flushTransaction;
86
88
  if (t === null) ambient.push(e); else {
87
- const n = resolveTx(t);
88
- (n.T ??= []).push(e);
89
+ const r = resolveTx(t);
90
+ (r.T ??= []).push(e);
89
91
  }
90
92
  repoll(e);
91
93
  }
@@ -98,28 +100,29 @@ function mark(e) {
98
100
  function affects(e, t) {
99
101
  // A store (the store half, store/affects.ts): the slot's leaf, or the
100
102
  // record's carrier and every live node under it.
101
- const n = e?.[$TARGET];
102
- if (n !== undefined) {
103
- const e = GlobalQueue.O(n, t);
103
+ const r = e?.[$TARGET];
104
+ if (r !== undefined) {
105
+ installStoreAffects();
106
+ const e = storeMarks(r, t);
104
107
  for (let t = 0; t < e.length; t++) register(e[t]);
105
108
  schedule();
106
109
  return;
107
110
  }
108
- const r = e?.[$REFRESH];
109
- if (!r) {
111
+ const n = e?.[$REFRESH];
112
+ if (!n) {
110
113
  return;
111
114
  }
112
- register(r);
115
+ register(n);
113
116
  schedule();
114
117
  }
115
118
 
116
- GlobalQueue.C = e => active !== 0 && marked(e, new Set);
119
+ GlobalQueue.N = e => active !== 0 && marked(e, new Set);
117
120
 
118
- GlobalQueue.h = mark;
121
+ GlobalQueue.O = mark;
119
122
 
120
- GlobalQueue.A = release;
123
+ GlobalQueue.k = release;
121
124
 
122
- GlobalQueue.D = e => {
125
+ GlobalQueue.A = e => {
123
126
  if (ambient.length === 0) return;
124
127
  // The flush parked: the declaration's window is the frame's — the marks
125
128
  // are its transaction's ("nothing async below ⇒ no window").
@@ -134,17 +137,17 @@ GlobalQueue.D = e => {
134
137
  // the window is the flight's; the mark stays to the seam after the
135
138
  // landing. The rest release: verdict-only, nothing to show.
136
139
  let t = 0;
137
- const n = [];
140
+ const r = [];
138
141
  for (let e = 0; e < ambient.length; e++) {
139
- const r = ambient[e];
140
- if (inFlight(r)) ambient[t++] = r; else n.push(r);
142
+ const n = ambient[e];
143
+ if (inFlight(n)) ambient[t++] = n; else r.push(n);
141
144
  }
142
145
  ambient.length = t;
143
- if (n.length !== 0) release(n);
146
+ if (r.length !== 0) release(r);
144
147
  };
145
148
 
146
149
  function inFlight(e) {
147
- return (e.G & STATUS_PENDING) !== 0 || (e.u & CONFIG_SLOT_NODE) !== 0 && GlobalQueue.F?.(e) === true;
150
+ return (e.S & STATUS_PENDING) !== 0 || (e.i & CONFIG_SLOT_NODE) !== 0 && GlobalQueue.C?.(e) === true;
148
151
  }
149
152
 
150
153
  export { affects };