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

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 (98) hide show
  1. package/dist/dev-shared.js +882 -405
  2. package/dist/dev.attribution.js +172 -66
  3. package/dist/dev.js +1529 -745
  4. package/dist/observe/affects-marks.js +86 -0
  5. package/dist/observe/affects.js +32 -80
  6. package/dist/observe/boundaries.js +202 -166
  7. package/dist/observe/core/async.js +192 -141
  8. package/dist/observe/core/attribution-queries.js +1 -1
  9. package/dist/observe/core/attribution.js +315 -214
  10. package/dist/observe/core/constants.js +23 -4
  11. package/dist/observe/core/context.js +3 -3
  12. package/dist/observe/core/core.js +532 -360
  13. package/dist/observe/core/dev.js +63 -35
  14. package/dist/observe/core/effect.js +47 -47
  15. package/dist/observe/core/error.js +5 -3
  16. package/dist/observe/core/external.js +5 -6
  17. package/dist/observe/core/graph.js +56 -42
  18. package/dist/observe/core/heap.js +33 -33
  19. package/dist/observe/core/identities.js +62 -0
  20. package/dist/observe/core/lanes.js +242 -229
  21. package/dist/observe/core/owner.js +62 -50
  22. package/dist/observe/core/scheduler.js +322 -168
  23. package/dist/observe/core/truth.js +45 -0
  24. package/dist/observe/core/verdict.js +114 -64
  25. package/dist/observe/deferred.js +184 -0
  26. package/dist/observe/index.js +7 -1
  27. package/dist/observe/map.js +339 -254
  28. package/dist/observe/reveal.js +77 -77
  29. package/dist/observe/signals.js +54 -33
  30. package/dist/observe/store/affects.js +76 -69
  31. package/dist/observe/store/edges.js +39 -0
  32. package/dist/observe/store/hooks.js +13 -0
  33. package/dist/observe/store/index.js +0 -2
  34. package/dist/observe/store/optimistic.js +82 -44
  35. package/dist/observe/store/projection.js +83 -64
  36. package/dist/observe/store/reconcile.js +32 -30
  37. package/dist/observe/store/store.js +219 -123
  38. package/dist/prod/affects-marks.js +86 -0
  39. package/dist/prod/affects.js +33 -79
  40. package/dist/prod/boundaries.js +185 -149
  41. package/dist/prod/core/async.js +176 -135
  42. package/dist/prod/core/constants.js +23 -4
  43. package/dist/prod/core/context.js +3 -3
  44. package/dist/prod/core/core.js +521 -353
  45. package/dist/prod/core/effect.js +66 -66
  46. package/dist/prod/core/error.js +5 -3
  47. package/dist/prod/core/external.js +5 -6
  48. package/dist/prod/core/graph.js +56 -42
  49. package/dist/prod/core/heap.js +38 -38
  50. package/dist/prod/core/identities.js +62 -0
  51. package/dist/prod/core/lanes.js +237 -224
  52. package/dist/prod/core/owner.js +62 -51
  53. package/dist/prod/core/scheduler.js +312 -158
  54. package/dist/prod/core/truth.js +45 -0
  55. package/dist/prod/core/verdict.js +113 -63
  56. package/dist/prod/deferred.js +182 -0
  57. package/dist/prod/index.js +7 -1
  58. package/dist/prod/map.js +366 -281
  59. package/dist/prod/reveal.js +77 -77
  60. package/dist/prod/signals.js +59 -38
  61. package/dist/prod/store/affects.js +76 -69
  62. package/dist/prod/store/edges.js +39 -0
  63. package/dist/prod/store/hooks.js +13 -0
  64. package/dist/prod/store/index.js +0 -2
  65. package/dist/prod/store/optimistic.js +121 -84
  66. package/dist/prod/store/projection.js +46 -34
  67. package/dist/prod/store/reconcile.js +32 -30
  68. package/dist/prod/store/store.js +205 -116
  69. package/dist/types/affects-marks.d.ts +14 -0
  70. package/dist/types/boundaries.d.ts +5 -1
  71. package/dist/types/core/async.d.ts +10 -0
  72. package/dist/types/core/attribution.d.ts +6 -2
  73. package/dist/types/core/constants.d.ts +18 -1
  74. package/dist/types/core/core.d.ts +77 -5
  75. package/dist/types/core/dev.d.ts +43 -13
  76. package/dist/types/core/graph.d.ts +11 -0
  77. package/dist/types/core/identities.d.ts +17 -0
  78. package/dist/types/core/index.d.ts +2 -1
  79. package/dist/types/core/lanes.d.ts +2 -4
  80. package/dist/types/core/owner.d.ts +5 -3
  81. package/dist/types/core/scheduler.d.ts +59 -34
  82. package/dist/types/core/truth.d.ts +16 -0
  83. package/dist/types/core/types.d.ts +21 -6
  84. package/dist/types/core/verdict.d.ts +32 -0
  85. package/dist/types/deferred.d.ts +28 -0
  86. package/dist/types/index.d.ts +6 -0
  87. package/dist/types/map.d.ts +2 -2
  88. package/dist/types/signals.d.ts +28 -7
  89. package/dist/types/store/affects.d.ts +11 -0
  90. package/dist/types/store/edges.d.ts +9 -0
  91. package/dist/types/store/hooks.d.ts +48 -0
  92. package/dist/types/store/index.d.ts +10 -4
  93. package/dist/types/store/optimistic.d.ts +3 -2
  94. package/dist/types/store/projection.d.ts +4 -3
  95. package/dist/types/store/store.d.ts +4 -39
  96. package/dist/types/store/target.d.ts +16 -8
  97. package/dist/types/store/types.d.ts +14 -0
  98. package/package.json +1 -1
@@ -97,7 +97,7 @@ const CONFIG_SYNC = 1 << 6;
97
97
  // CONFIG_HELD_CHILDREN, CONFIG_INPUTS_PUBLISHED and CONFIG_ADOPTED_UNFLUSHED
98
98
  // (transaction holds, zombies, until()'s authoritative view) went with the
99
99
  // transactions.
100
- // L2 (step 2): three bits, all maintained by the node's commit.
100
+ // L2 (step 2): four bits, all maintained by the node's commit.
101
101
  /** The node has a pass awaiting commit: its live children (and `_disposal`)
102
102
  * are that pass's and were never shown — a re-pass tears them down on the
103
103
  * spot, while the frame parked on `_x._pendingFirstChild` keeps waiting for
@@ -110,6 +110,11 @@ const CONFIG_SYNC = 1 << 6;
110
110
  * parking flush they see the committed value and hold nothing, and are
111
111
  * re-derived at the landing. Set at the park seam on every staged node. */ const CONFIG_HELD = 1 << 8;
112
112
 
113
+ /** A member of the uncommitted frame a held pass built (ruling A): set at
114
+ * the park seam on every computed under a staged node (`holdFrame`). Never
115
+ * shown, it has no screen: its reads are its transaction's, whichever flush
116
+ * runs it (`bornInto`, #4010). Cleared by its commit. */ const CONFIG_HELD_FRAME = 1 << 20;
117
+
113
118
  /** A15's reveal corollary (#3305): a commit published this flight's inputs
114
119
  * beneath it — the node was pending, nothing staged, when it committed — so
115
120
  * its committed value is torn against the visible frame. A render effect
@@ -134,6 +139,9 @@ const CONFIG_SYNC = 1 << 6;
134
139
  * leaf twin of REACTIVE_MANUAL_WRITE). Set by the user setter, cleared by
135
140
  * the derive's own write to the key. */ const CONFIG_MANUAL_WRITE = 1 << 18;
136
141
 
142
+ /** D-41: the staged value in `_pendingValue` is an error — an
143
+ * answer of the held frame, published at its landing like a value. */ const CONFIG_STAGED_ERROR = 1 << 21;
144
+
137
145
  /** Lanes — the node carries a written guess (`optimisticWrite`): its own
138
146
  * source recomputing it, or a plain write landing on it, is the truth
139
147
  * (`supersede`). A lane's derived staging is not. */ const CONFIG_GUESS = 1 << 13;
@@ -142,14 +150,20 @@ const CONFIG_SYNC = 1 << 6;
142
150
  * pending is a question for its next pass — the verdict changed — so the
143
151
  * propagation re-derives it instead of marking it pending (as a kept-tail
144
152
  * link does, A30). Set at the window, never cleared: a reader that stopped
145
- * asking re-derives once and goes pending through its own read. */ const CONFIG_VERDICT = 1 << 14;
153
+ * asking re-derives once and goes pending through its own read. The same
154
+ * bit as REACTIVE_PROBED: a pass's probe (or a read of a verdict memo,
155
+ * core.ts `read`) carries into the config at its end without a shift. */ const CONFIG_VERDICT = 1 << 15;
146
156
 
147
157
  /** A dependency's status is a question for this node's pass, not a fact
148
158
  * about its current one: the propagation re-derives it instead of marking
149
159
  * it, for errors as for pending (as CONFIG_VERDICT). A boundary's output
150
160
  * (show the content, or the fallback) and its `on` node (boundaries.ts); a
151
161
  * promise over an expression (`resolve`/`until`, signals.ts: the pass reads
152
- * the error and rejects, or re-asks a pending source). */ const CONFIG_REDERIVE = 1 << 15;
162
+ * the error and rejects, or re-asks a pending source). */ const CONFIG_REDERIVE = 1 << 14;
163
+
164
+ /** An answered `createDeferred` node (deferred.ts): held because a
165
+ * downstream hold staged its landing, its re-pass is a lagging question,
166
+ * not an answer, and joins no transaction (D-40). */ const CONFIG_LAGS = 1 << 19;
153
167
 
154
168
  /** The reader wants the truth, not the lane's guess (`until`, signals.ts):
155
169
  * a read of displayed optimism serves the base the guess covers, makes the
@@ -189,12 +203,17 @@ const CONFIG_HAS_SNAPSHOT = 1 << 9;
189
203
  * owns stay fully observed.
190
204
  * Set from the internal `_plumbing` option at creation; never set in prod. */ const CONFIG_PLUMBING = 1 << 25;
191
205
 
206
+ const STATUS_NONE = 0;
207
+
192
208
  const STATUS_PENDING = 1 << 0;
193
209
 
194
210
  const STATUS_ERROR = 1 << 1;
195
211
 
196
212
  const STATUS_UNINITIALIZED = 1 << 2;
197
213
 
214
+ /** `catchHook`'s answer when the catcher is a boundary re-armed by
215
+ * `on` (truthy, as any catch): what it collects is its own, not the hold's. */ const CAUGHT_REARMED = 2;
216
+
198
217
  const EFFECT_RENDER = 1;
199
218
 
200
219
  const EFFECT_USER = 2;
@@ -217,4 +236,4 @@ const defaultContext = {};
217
236
  * @internal
218
237
  */ const $REFRESH = Symbol("refresh");
219
238
 
220
- export { $REFRESH, CONFIG_AUTHORITATIVE, CONFIG_AUTO_DISPOSE, CONFIG_CHILDREN_FORBIDDEN, CONFIG_FRESH_READ, CONFIG_GUESS, CONFIG_HAS_SNAPSHOT, CONFIG_HELD, CONFIG_INPUTS_PUBLISHED, CONFIG_IN_SNAPSHOT_SCOPE, CONFIG_MANUAL_WRITE, CONFIG_NO_SNAPSHOT, CONFIG_OVERRIDE, CONFIG_OWNED_WRITE, CONFIG_PLUMBING, CONFIG_PROMOTED, CONFIG_REDERIVE, CONFIG_SLOT_NODE, CONFIG_STAGED, CONFIG_SYNC, CONFIG_TRANSPARENT, CONFIG_VERDICT, EFFECT_RENDER, EFFECT_TRACKED, EFFECT_USER, NOT_PENDING, NO_SNAPSHOT, REACTIVE_CHECK, REACTIVE_DIRTY, REACTIVE_DISPOSED, REACTIVE_FRAME_READ, REACTIVE_IN_HEAP, REACTIVE_IN_HEAP_HEIGHT, REACTIVE_JOINED, REACTIVE_LANE_DIRTY, REACTIVE_LANE_READ, REACTIVE_LAZY, REACTIVE_MANUAL_WRITE, REACTIVE_MISSED_WAKE, REACTIVE_NONE, REACTIVE_PROBED, REACTIVE_PROBE_UNANSWERED, REACTIVE_REASK, REACTIVE_RECOMPUTING_DEPS, REACTIVE_SCREEN_READ, REACTIVE_SNAPSHOT_STALE, REACTIVE_STAGED_READ, REACTIVE_ZOMBIE, STATUS_ERROR, STATUS_PENDING, STATUS_UNINITIALIZED, SUPPORTS_PROXY, defaultContext };
239
+ export { $REFRESH, CAUGHT_REARMED, CONFIG_AUTHORITATIVE, CONFIG_AUTO_DISPOSE, CONFIG_CHILDREN_FORBIDDEN, CONFIG_FRESH_READ, CONFIG_GUESS, CONFIG_HAS_SNAPSHOT, CONFIG_HELD, CONFIG_HELD_FRAME, CONFIG_INPUTS_PUBLISHED, CONFIG_IN_SNAPSHOT_SCOPE, CONFIG_LAGS, CONFIG_MANUAL_WRITE, CONFIG_NO_SNAPSHOT, CONFIG_OVERRIDE, CONFIG_OWNED_WRITE, CONFIG_PLUMBING, CONFIG_PROMOTED, CONFIG_REDERIVE, CONFIG_SLOT_NODE, CONFIG_STAGED, CONFIG_STAGED_ERROR, CONFIG_SYNC, CONFIG_TRANSPARENT, CONFIG_VERDICT, EFFECT_RENDER, EFFECT_TRACKED, EFFECT_USER, NOT_PENDING, NO_SNAPSHOT, REACTIVE_CHECK, REACTIVE_DIRTY, REACTIVE_DISPOSED, REACTIVE_FRAME_READ, REACTIVE_IN_HEAP, REACTIVE_IN_HEAP_HEIGHT, REACTIVE_JOINED, REACTIVE_LANE_DIRTY, REACTIVE_LANE_READ, REACTIVE_LAZY, REACTIVE_MANUAL_WRITE, REACTIVE_MISSED_WAKE, REACTIVE_NONE, REACTIVE_PROBED, REACTIVE_PROBE_UNANSWERED, REACTIVE_REASK, REACTIVE_RECOMPUTING_DEPS, REACTIVE_SCREEN_READ, REACTIVE_SNAPSHOT_STALE, REACTIVE_STAGED_READ, REACTIVE_ZOMBIE, STATUS_ERROR, STATUS_NONE, STATUS_PENDING, STATUS_UNINITIALIZED, SUPPORTS_PROXY, defaultContext };
@@ -30,7 +30,7 @@ import { getOwner } from "./owner.js";
30
30
  throw new NoOwnerError;
31
31
  }
32
32
  // `undefined` alone means unset — a provided `null` is a value (no `??`).
33
- let r = t.U[e.id];
33
+ let r = t.A[e.id];
34
34
  if (r === undefined) r = e.defaultValue;
35
35
  if (r === undefined) {
36
36
  throw new ContextNotFoundError;
@@ -52,8 +52,8 @@ import { getOwner } from "./owner.js";
52
52
  }
53
53
  // We're creating a new object to avoid child context values being exposed to parent owners. If
54
54
  // we don't do this, everything will be a singleton and all hell will break lose.
55
- r.U = {
56
- ...r.U,
55
+ r.A = {
56
+ ...r.A,
57
57
  [e.id]: t === undefined ? e.defaultValue : t
58
58
  };
59
59
  }