@solidjs/signals 2.0.0-rc.7 → 2.0.0-rc.9

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 (134) hide show
  1. package/dist/dev-shared.js +6357 -0
  2. package/dist/dev.attribution.js +2485 -0
  3. package/dist/dev.js +2851 -7027
  4. package/dist/observe/affects.js +129 -0
  5. package/dist/observe/attribution.js +7 -0
  6. package/dist/observe/boundaries.js +641 -0
  7. package/dist/observe/core/action.js +177 -0
  8. package/dist/observe/core/async.js +846 -0
  9. package/dist/observe/core/attribution-costs.js +66 -0
  10. package/dist/observe/core/attribution-feedback.js +282 -0
  11. package/dist/observe/core/attribution-hooks.js +82 -0
  12. package/dist/observe/core/attribution-queries.js +28 -0
  13. package/dist/observe/core/attribution.js +2095 -0
  14. package/dist/observe/core/constants.js +248 -0
  15. package/dist/{types-cjs/core/context.d.cts → observe/core/context.js} +37 -12
  16. package/dist/observe/core/core.js +1789 -0
  17. package/dist/observe/core/dev.js +293 -0
  18. package/dist/observe/core/effect.js +195 -0
  19. package/dist/observe/core/error-hooks.js +71 -0
  20. package/dist/observe/core/error.js +80 -0
  21. package/dist/observe/core/external.js +98 -0
  22. package/dist/observe/core/graph.js +155 -0
  23. package/dist/observe/core/heap.js +147 -0
  24. package/dist/observe/core/invariants.js +45 -0
  25. package/dist/observe/core/lanes.js +205 -0
  26. package/dist/observe/core/optimistic.js +585 -0
  27. package/dist/observe/core/owner.js +322 -0
  28. package/dist/observe/core/scheduler.js +1428 -0
  29. package/dist/observe/core/verdict.js +669 -0
  30. package/dist/observe/index.js +59 -0
  31. package/dist/observe/map.js +484 -0
  32. package/dist/{types-cjs/signals.d.cts → observe/signals.js} +311 -317
  33. package/dist/observe/store/index.js +40 -0
  34. package/dist/observe/store/next/optimistic.js +660 -0
  35. package/dist/observe/store/next/projection.js +255 -0
  36. package/dist/observe/store/next/reconcile.js +375 -0
  37. package/dist/observe/store/next/store.js +2327 -0
  38. package/dist/observe/store/next/target.js +51 -0
  39. package/dist/observe/store/store.js +325 -0
  40. package/dist/observe/store/storePath.js +103 -0
  41. package/dist/observe/store/utils.js +1023 -0
  42. package/dist/prod/attribution.js +41 -0
  43. package/dist/prod/boundaries.js +128 -76
  44. package/dist/prod/core/action.js +65 -37
  45. package/dist/prod/core/async.js +324 -172
  46. package/dist/prod/core/constants.js +57 -1
  47. package/dist/prod/core/context.js +3 -3
  48. package/dist/prod/core/core.js +1003 -364
  49. package/dist/prod/core/dev.js +17 -1
  50. package/dist/prod/core/effect.js +76 -42
  51. package/dist/prod/core/error-hooks.js +71 -0
  52. package/dist/prod/core/external.js +4 -4
  53. package/dist/prod/core/graph.js +37 -37
  54. package/dist/prod/core/heap.js +61 -56
  55. package/dist/prod/core/lanes.js +107 -63
  56. package/dist/prod/core/optimistic.js +374 -93
  57. package/dist/prod/core/owner.js +62 -46
  58. package/dist/prod/core/scheduler.js +653 -286
  59. package/dist/prod/core/verdict.js +245 -127
  60. package/dist/prod/index.js +15 -5
  61. package/dist/prod/map.js +292 -141
  62. package/dist/prod/signals.js +29 -16
  63. package/dist/prod/store/next/optimistic.js +77 -55
  64. package/dist/prod/store/next/projection.js +31 -20
  65. package/dist/prod/store/next/reconcile.js +87 -84
  66. package/dist/prod/store/next/store.js +718 -401
  67. package/dist/prod/store/next/target.js +32 -10
  68. package/dist/prod/store/store.js +12 -14
  69. package/dist/prod/store/utils.js +950 -130
  70. package/dist/types/attribution.d.ts +20 -0
  71. package/dist/types/attribution.prod.d.ts +22 -0
  72. package/dist/types/boundaries.d.ts +10 -1
  73. package/dist/types/core/action.d.ts +12 -5
  74. package/dist/types/core/async.d.ts +1 -1
  75. package/dist/types/core/attribution-costs.d.ts +35 -0
  76. package/dist/types/core/attribution-feedback.d.ts +133 -0
  77. package/dist/types/core/attribution-hooks.d.ts +147 -9
  78. package/dist/types/core/attribution-queries.d.ts +10 -0
  79. package/dist/types/core/attribution.d.ts +216 -182
  80. package/dist/types/core/constants.d.ts +56 -0
  81. package/dist/types/core/core.d.ts +190 -2
  82. package/dist/types/core/dev.d.ts +246 -28
  83. package/dist/types/core/effect.d.ts +8 -1
  84. package/dist/types/core/error-hooks.d.ts +71 -0
  85. package/dist/types/core/index.d.ts +4 -1
  86. package/dist/types/core/invariants.d.ts +4 -0
  87. package/dist/types/core/lanes.d.ts +39 -5
  88. package/dist/types/core/scheduler.d.ts +153 -0
  89. package/dist/types/core/types.d.ts +32 -9
  90. package/dist/types/index.d.ts +10 -3
  91. package/dist/types/map.d.ts +2 -0
  92. package/dist/types/signals.d.ts +8 -0
  93. package/dist/types/store/index.d.ts +2 -0
  94. package/dist/types/store/next/optimistic.d.ts +1 -1
  95. package/dist/types/store/next/store.d.ts +11 -5
  96. package/dist/types/store/next/target.d.ts +37 -10
  97. package/dist/types/store/utils.d.ts +178 -0
  98. package/package.json +21 -17
  99. package/dist/node.cjs +0 -10541
  100. package/dist/node.dev.cjs +0 -13724
  101. package/dist/types-cjs/affects.d.cts +0 -47
  102. package/dist/types-cjs/boundaries.d.cts +0 -175
  103. package/dist/types-cjs/core/action.d.cts +0 -64
  104. package/dist/types-cjs/core/async.d.cts +0 -23
  105. package/dist/types-cjs/core/attribution-hooks.d.cts +0 -127
  106. package/dist/types-cjs/core/attribution.d.cts +0 -495
  107. package/dist/types-cjs/core/constants.d.cts +0 -159
  108. package/dist/types-cjs/core/core.d.cts +0 -185
  109. package/dist/types-cjs/core/dev.d.cts +0 -136
  110. package/dist/types-cjs/core/effect.d.cts +0 -30
  111. package/dist/types-cjs/core/error.d.cts +0 -56
  112. package/dist/types-cjs/core/external.d.cts +0 -15
  113. package/dist/types-cjs/core/graph.d.cts +0 -28
  114. package/dist/types-cjs/core/heap.d.cts +0 -24
  115. package/dist/types-cjs/core/index.d.cts +0 -13
  116. package/dist/types-cjs/core/invariants.d.cts +0 -59
  117. package/dist/types-cjs/core/lanes.d.cts +0 -54
  118. package/dist/types-cjs/core/optimistic.d.cts +0 -6
  119. package/dist/types-cjs/core/owner.d.cts +0 -124
  120. package/dist/types-cjs/core/scheduler.d.cts +0 -236
  121. package/dist/types-cjs/core/types.d.cts +0 -204
  122. package/dist/types-cjs/core/verdict.d.cts +0 -2
  123. package/dist/types-cjs/index.d.cts +0 -10
  124. package/dist/types-cjs/map.d.cts +0 -69
  125. package/dist/types-cjs/package.json +0 -3
  126. package/dist/types-cjs/store/index.d.cts +0 -18
  127. package/dist/types-cjs/store/next/optimistic.d.cts +0 -25
  128. package/dist/types-cjs/store/next/projection.d.cts +0 -8
  129. package/dist/types-cjs/store/next/reconcile.d.cts +0 -10
  130. package/dist/types-cjs/store/next/store.d.cts +0 -121
  131. package/dist/types-cjs/store/next/target.d.cts +0 -166
  132. package/dist/types-cjs/store/store.d.cts +0 -143
  133. package/dist/types-cjs/store/storePath.d.cts +0 -58
  134. package/dist/types-cjs/store/utils.d.cts +0 -74
@@ -145,6 +145,59 @@ const CONFIG_HAS_LANE = 1 << 10;
145
145
  * unobserved closure, NodeExtension) were the measured create-floor bytes
146
146
  * (warm dbmon profile: store node machinery ~36% + GC ~29%). */ const CONFIG_SLOT_NODE = 1 << 18;
147
147
 
148
+ /** Optimistic node whose own source arrived with a value DIFFERENT from its
149
+ * active override (A18 supersession, #3331). The override survives only as
150
+ * the displayed value — untracked reads and the applied frame keep it until
151
+ * the owning transaction commits — while the graph has already moved to the
152
+ * staged truth in `_pendingValue`: tracked readers see it and the corrected
153
+ * cascade is that transaction's held work. Set by the two own-source write
154
+ * paths (asyncWrite, transition-held recompute); cleared by a fresh optimistic
155
+ * write (a new override re-masks) and by the revert. */ const CONFIG_OVERRIDE_SUPERSEDED = 1 << 19;
156
+
157
+ /** HELD children (#3404): this node's `_firstChild` chain (and `_disposal`
158
+ * list) was built by a recompute whose result has not committed — a staged
159
+ * value, a pending window, or a run under a held transaction. A later
160
+ * recompute may tear those children down immediately: nothing observable
161
+ * was ever built on them. Unset, the children belong to the committed frame
162
+ * and a recompute defers them as zombies (`_pendingFirstChild`) until this
163
+ * node commits — regardless of whether the recompute runs under a
164
+ * transaction. A parked node (status propagation stamps `_transition`
165
+ * without recomputing) recomputed when its source lands otherwise disposed
166
+ * its committed children mid-hold, running their cleanups before the
167
+ * transaction's atomic reveal. Cleared by `commitPendingNode`. */ const CONFIG_HELD_CHILDREN = 1 << 20;
168
+
169
+ /** In-flight async node whose inputs were PUBLISHED while it was pending: a
170
+ * batch or transaction committed with the node still `STATUS_PENDING` (an
171
+ * unobserved flight, #3305), so the inputs are on screen and the node's
172
+ * committed `_value` is stale against them. Governs read()'s reveal
173
+ * carve-out: a stale (render) reader in some OTHER transaction may show a
174
+ * foreign-held pending node's committed value — parallel transactions, no
175
+ * entanglement — only while that value is coherent with the visible frame,
176
+ * i.e. while the flight's inputs are themselves held (unpublished) and not
177
+ * lane-revealed. Set by `commitPendingNodes`; cleared when the node next
178
+ * enters pending fresh (a new flight from a settled state). */ const CONFIG_INPUTS_PUBLISHED = 1 << 21;
179
+
180
+ /** A28 (4): the node was written inside a recompute that ran OUTSIDE a flush
181
+ * (a creation-time compute — boundary machinery, a mapArray's first run). Such
182
+ * a write is promoted at that recompute's end: readers in the same block see
183
+ * it. Cleared when the next flush begins; set only on that rare path. */ const CONFIG_PROMOTED = 1 << 22;
184
+
185
+ /** A28 for same-tick adoption: the node was staged outside a flush and then
186
+ * adopted by a transaction (initTransition) before any flush carried the
187
+ * staging — the stamp says "held", but nothing flushed is staged for it, so
188
+ * on no channel is the write visible yet: `latest()` answers the committed
189
+ * value, the verdict sees nothing pending (as the store's leaves already did
190
+ * through their own selection). Cleared when the carrying flush re-stamps the
191
+ * transaction's pending nodes (reassignPendingTransition). */ const CONFIG_ADOPTED_UNFLUSHED = 1 << 24;
192
+
193
+ /** The node's active override is a DERIVED one: a lane pass published its
194
+ * speculative result into the override slot instead of `_value` (lanes
195
+ * stage — an optimistic derivation is an override, #3479). Its truth is not
196
+ * `_value` but a recompute from its inputs' truth, so the body-end
197
+ * supersession (`endOptimism`) and the authoritative-flight blockage
198
+ * (`transitionBlocked`) skip it; the revert drops the override and re-derives
199
+ * it (`resolveOptimisticNodes`). Cleared with the override. */ const CONFIG_DERIVED_OVERRIDE = 1 << 23;
200
+
148
201
  const STATUS_PENDING = 1 << 0;
149
202
 
150
203
  const STATUS_ERROR = 1 << 1;
@@ -157,6 +210,9 @@ const EFFECT_USER = 2;
157
210
 
158
211
  const EFFECT_TRACKED = 3;
159
212
 
213
+ /** OR-ed into the `type` a lane passes to its effect runners: lane runs
214
+ * apply ahead of their transaction and are exempt from ownership parking. */ const LANE_RUN = 4;
215
+
160
216
  const NOT_PENDING = {};
161
217
 
162
218
  const NO_SNAPSHOT = {};
@@ -189,4 +245,4 @@ const defaultContext = {};
189
245
  * @internal
190
246
  */ const $REFRESH = Symbol("refresh");
191
247
 
192
- export { $REFRESH, CONFIG_AUTHORITATIVE_OBSERVED, CONFIG_AUTHORITATIVE_READ, CONFIG_AUTO_DISPOSE, CONFIG_CHILDREN_FORBIDDEN, CONFIG_CHILD_COMPANIONS, CONFIG_DIRECT_COMMIT, CONFIG_FRESH_READ, CONFIG_FW_CHILDREN, CONFIG_HAS_COMPANIONS, CONFIG_HAS_LANE, CONFIG_HAS_SNAPSHOT, CONFIG_HELD_TRUTH, CONFIG_IN_SNAPSHOT_SCOPE, CONFIG_NO_SNAPSHOT, CONFIG_OPTIMISTIC, CONFIG_OWNED_WRITE, CONFIG_SLOT_NODE, CONFIG_SYNC, CONFIG_TRANSPARENT, EFFECT_RENDER, EFFECT_TRACKED, EFFECT_USER, NOT_PENDING, NO_SNAPSHOT, OVERRIDE_UNDEFINED, REACTIVE_CHECK, REACTIVE_DIRTY, REACTIVE_DISPOSED, REACTIVE_IN_HEAP, REACTIVE_IN_HEAP_HEIGHT, REACTIVE_LAZY, REACTIVE_MANUAL_WRITE, REACTIVE_MISSED_WAKE, REACTIVE_NONE, REACTIVE_OPTIMISTIC_DIRTY, REACTIVE_REASK, REACTIVE_RECOMPUTING_DEPS, REACTIVE_SNAPSHOT_STALE, REACTIVE_ZOMBIE, STATUS_ERROR, STATUS_PENDING, STATUS_UNINITIALIZED, STORE_SNAPSHOT_PROPS, SUPPORTS_PROXY, defaultContext, unwrapOverride };
248
+ export { $REFRESH, CONFIG_ADOPTED_UNFLUSHED, CONFIG_AUTHORITATIVE_OBSERVED, CONFIG_AUTHORITATIVE_READ, CONFIG_AUTO_DISPOSE, CONFIG_CHILDREN_FORBIDDEN, CONFIG_CHILD_COMPANIONS, CONFIG_DERIVED_OVERRIDE, CONFIG_DIRECT_COMMIT, CONFIG_FRESH_READ, CONFIG_FW_CHILDREN, CONFIG_HAS_COMPANIONS, CONFIG_HAS_LANE, CONFIG_HAS_SNAPSHOT, CONFIG_HELD_CHILDREN, CONFIG_HELD_TRUTH, CONFIG_INPUTS_PUBLISHED, CONFIG_IN_SNAPSHOT_SCOPE, CONFIG_NO_SNAPSHOT, CONFIG_OPTIMISTIC, CONFIG_OVERRIDE_SUPERSEDED, CONFIG_OWNED_WRITE, CONFIG_PROMOTED, CONFIG_SLOT_NODE, CONFIG_SYNC, CONFIG_TRANSPARENT, EFFECT_RENDER, EFFECT_TRACKED, EFFECT_USER, LANE_RUN, NOT_PENDING, NO_SNAPSHOT, OVERRIDE_UNDEFINED, REACTIVE_CHECK, REACTIVE_DIRTY, REACTIVE_DISPOSED, REACTIVE_IN_HEAP, REACTIVE_IN_HEAP_HEIGHT, REACTIVE_LAZY, REACTIVE_MANUAL_WRITE, REACTIVE_MISSED_WAKE, REACTIVE_NONE, REACTIVE_OPTIMISTIC_DIRTY, REACTIVE_REASK, REACTIVE_RECOMPUTING_DEPS, REACTIVE_SNAPSHOT_STALE, REACTIVE_ZOMBIE, STATUS_ERROR, STATUS_PENDING, STATUS_UNINITIALIZED, STORE_SNAPSHOT_PROPS, SUPPORTS_PROXY, defaultContext, unwrapOverride };
@@ -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.we[e.id];
33
+ let r = t.ze[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.we = {
56
- ...r.we,
55
+ r.ze = {
56
+ ...r.ze,
57
57
  [e.id]: t === undefined ? e.defaultValue : t
58
58
  };
59
59
  }