@solidjs/signals 2.0.0-rc.2 → 2.0.0-rc.20

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 (198) hide show
  1. package/dist/dev-shared.js +6505 -0
  2. package/dist/dev.attribution.js +3484 -0
  3. package/dist/dev.js +10227 -9508
  4. package/dist/observe/affects-marks.js +86 -0
  5. package/dist/observe/affects.js +112 -0
  6. package/dist/observe/attribution.js +7 -0
  7. package/dist/observe/boundaries.js +696 -0
  8. package/dist/observe/core/action.js +182 -0
  9. package/dist/observe/core/async.js +824 -0
  10. package/dist/observe/core/attribution-costs.js +66 -0
  11. package/dist/observe/core/attribution-feedback.js +280 -0
  12. package/dist/observe/core/attribution-hooks.js +83 -0
  13. package/dist/observe/core/attribution-queries.js +43 -0
  14. package/dist/observe/core/attribution.js +3079 -0
  15. package/dist/observe/core/constants.js +269 -0
  16. package/dist/observe/core/context.js +63 -0
  17. package/dist/observe/core/copies.js +10 -0
  18. package/dist/observe/core/core.js +1707 -0
  19. package/dist/observe/core/dev.js +394 -0
  20. package/dist/observe/core/effect.js +193 -0
  21. package/dist/observe/core/error-hooks.js +71 -0
  22. package/dist/observe/core/error.js +82 -0
  23. package/dist/observe/core/external.js +97 -0
  24. package/dist/observe/core/graph.js +162 -0
  25. package/dist/observe/core/heap.js +124 -0
  26. package/dist/observe/core/identities.js +62 -0
  27. package/dist/observe/core/invariants.js +12 -0
  28. package/dist/observe/core/lanes.js +972 -0
  29. package/dist/observe/core/owner.js +371 -0
  30. package/dist/observe/core/scheduler.js +1157 -0
  31. package/dist/observe/core/truth.js +47 -0
  32. package/dist/observe/core/verdict.js +470 -0
  33. package/dist/observe/deferred.js +186 -0
  34. package/dist/observe/flatten.js +79 -0
  35. package/dist/observe/from.js +248 -0
  36. package/dist/observe/index.js +71 -0
  37. package/dist/observe/map.js +593 -0
  38. package/dist/observe/reveal.js +212 -0
  39. package/dist/observe/signals.js +717 -0
  40. package/dist/observe/store/affects.js +142 -0
  41. package/dist/observe/store/edges.js +39 -0
  42. package/dist/observe/store/hooks.js +16 -0
  43. package/dist/observe/store/index.js +47 -0
  44. package/dist/observe/store/optimistic.js +713 -0
  45. package/dist/observe/store/projection.js +345 -0
  46. package/dist/observe/store/reconcile.js +281 -0
  47. package/dist/observe/store/store.js +2127 -0
  48. package/dist/observe/store/storePath.js +103 -0
  49. package/dist/observe/store/target.js +46 -0
  50. package/dist/observe/store/types.js +83 -0
  51. package/dist/observe/store/utils.js +1063 -0
  52. package/dist/prod/affects-marks.js +86 -0
  53. package/dist/prod/affects.js +98 -112
  54. package/dist/prod/attribution.js +45 -0
  55. package/dist/prod/boundaries.js +578 -468
  56. package/dist/prod/core/action.js +92 -59
  57. package/dist/prod/core/async.js +522 -336
  58. package/dist/prod/core/attribution-hooks.js +3 -0
  59. package/dist/prod/core/constants.js +168 -44
  60. package/dist/prod/core/context.js +12 -16
  61. package/dist/prod/core/copies.js +10 -0
  62. package/dist/prod/core/core.js +1345 -627
  63. package/dist/prod/core/dev.js +123 -1
  64. package/dist/prod/core/effect.js +113 -80
  65. package/dist/prod/core/error-hooks.js +71 -0
  66. package/dist/prod/core/error.js +18 -4
  67. package/dist/prod/core/external.js +6 -7
  68. package/dist/prod/core/graph.js +119 -72
  69. package/dist/prod/core/heap.js +85 -109
  70. package/dist/prod/core/identities.js +62 -0
  71. package/dist/prod/core/invariants.js +1 -32
  72. package/dist/prod/core/lanes.js +931 -132
  73. package/dist/prod/core/owner.js +192 -129
  74. package/dist/prod/core/scheduler.js +948 -642
  75. package/dist/prod/core/truth.js +47 -0
  76. package/dist/prod/core/verdict.js +409 -420
  77. package/dist/prod/deferred.js +184 -0
  78. package/dist/prod/flatten.js +77 -0
  79. package/dist/prod/from.js +248 -0
  80. package/dist/prod/index.js +40 -16
  81. package/dist/prod/map.js +481 -211
  82. package/dist/prod/reveal.js +212 -0
  83. package/dist/prod/signals.js +401 -84
  84. package/dist/prod/store/affects.js +142 -0
  85. package/dist/prod/store/edges.js +39 -0
  86. package/dist/prod/store/hooks.js +16 -0
  87. package/dist/prod/store/index.js +27 -18
  88. package/dist/prod/store/optimistic.js +707 -0
  89. package/dist/prod/store/projection.js +331 -0
  90. package/dist/prod/store/reconcile.js +281 -0
  91. package/dist/prod/store/store.js +1952 -267
  92. package/dist/prod/store/storePath.js +1 -1
  93. package/dist/prod/store/target.js +43 -0
  94. package/dist/prod/store/types.js +83 -0
  95. package/dist/prod/store/utils.js +997 -138
  96. package/dist/types/affects-marks.d.ts +14 -0
  97. package/dist/types/affects.d.ts +12 -30
  98. package/dist/types/attribution.d.ts +19 -0
  99. package/dist/types/attribution.prod.d.ts +22 -0
  100. package/dist/types/boundaries.d.ts +99 -124
  101. package/dist/types/carved.d.ts +1 -0
  102. package/dist/types/core/action.d.ts +23 -9
  103. package/dist/types/core/async.d.ts +34 -6
  104. package/dist/types/core/attribution-costs.d.ts +35 -0
  105. package/dist/types/core/attribution-feedback.d.ts +133 -0
  106. package/dist/types/core/attribution-hooks.d.ts +307 -8
  107. package/dist/types/core/attribution-queries.d.ts +24 -0
  108. package/dist/types/core/attribution.d.ts +802 -72
  109. package/dist/types/core/constants.d.ts +195 -38
  110. package/dist/types/core/copies.d.ts +54 -0
  111. package/dist/types/core/core.d.ts +295 -65
  112. package/dist/types/core/dev.d.ts +509 -22
  113. package/dist/types/core/effect.d.ts +1 -1
  114. package/dist/types/core/error-hooks.d.ts +71 -0
  115. package/dist/types/core/error.d.ts +18 -1
  116. package/dist/types/core/graph.d.ts +40 -1
  117. package/dist/types/core/heap.d.ts +5 -5
  118. package/dist/types/core/identities.d.ts +17 -0
  119. package/dist/types/core/index.d.ts +11 -7
  120. package/dist/types/core/invariants.d.ts +1 -26
  121. package/dist/types/core/lanes.d.ts +74 -43
  122. package/dist/types/core/owner.d.ts +27 -9
  123. package/dist/types/core/scheduler.d.ts +353 -102
  124. package/dist/types/core/truth.d.ts +18 -0
  125. package/dist/types/core/types.d.ts +97 -71
  126. package/dist/types/core/verdict.d.ts +35 -0
  127. package/dist/types/deferred.d.ts +28 -0
  128. package/dist/types/flatten.d.ts +8 -0
  129. package/dist/types/from.d.ts +47 -0
  130. package/dist/types/index.d.ts +33 -7
  131. package/dist/types/map.d.ts +4 -2
  132. package/dist/types/reveal.d.ts +19 -0
  133. package/dist/types/signals.d.ts +196 -45
  134. package/dist/types/store/affects.d.ts +12 -0
  135. package/dist/types/store/edges.d.ts +9 -0
  136. package/dist/types/store/hooks.d.ts +62 -0
  137. package/dist/types/store/index.d.ts +42 -15
  138. package/dist/types/store/optimistic.d.ts +24 -45
  139. package/dist/types/store/projection.d.ts +17 -68
  140. package/dist/types/store/reconcile.d.ts +3 -46
  141. package/dist/types/store/store.d.ts +133 -136
  142. package/dist/types/store/storePath.d.ts +1 -1
  143. package/dist/types/store/target.d.ts +166 -0
  144. package/dist/types/store/types.d.ts +105 -0
  145. package/dist/types/store/utils.d.ts +188 -0
  146. package/package.json +31 -26
  147. package/dist/node.cjs +0 -8745
  148. package/dist/prod/core/optimistic.js +0 -265
  149. package/dist/prod/store/next/optimistic.js +0 -385
  150. package/dist/prod/store/next/projection.js +0 -172
  151. package/dist/prod/store/next/reconcile.js +0 -331
  152. package/dist/prod/store/next/store.js +0 -1499
  153. package/dist/prod/store/next/target.js +0 -20
  154. package/dist/types/core/optimistic.d.ts +0 -6
  155. package/dist/types/store/next/optimistic.d.ts +0 -20
  156. package/dist/types/store/next/projection.d.ts +0 -8
  157. package/dist/types/store/next/reconcile.d.ts +0 -3
  158. package/dist/types/store/next/store.d.ts +0 -77
  159. package/dist/types/store/next/target.d.ts +0 -117
  160. package/dist/types-cjs/affects.d.cts +0 -47
  161. package/dist/types-cjs/boundaries.d.cts +0 -175
  162. package/dist/types-cjs/core/action.d.cts +0 -64
  163. package/dist/types-cjs/core/async.d.cts +0 -21
  164. package/dist/types-cjs/core/attribution-hooks.d.cts +0 -52
  165. package/dist/types-cjs/core/attribution.d.cts +0 -186
  166. package/dist/types-cjs/core/constants.d.cts +0 -97
  167. package/dist/types-cjs/core/context.d.cts +0 -36
  168. package/dist/types-cjs/core/core.d.cts +0 -163
  169. package/dist/types-cjs/core/dev.d.cts +0 -81
  170. package/dist/types-cjs/core/effect.d.cts +0 -30
  171. package/dist/types-cjs/core/error.d.cts +0 -47
  172. package/dist/types-cjs/core/external.d.cts +0 -15
  173. package/dist/types-cjs/core/graph.d.cts +0 -6
  174. package/dist/types-cjs/core/heap.d.cts +0 -22
  175. package/dist/types-cjs/core/index.d.cts +0 -13
  176. package/dist/types-cjs/core/invariants.d.cts +0 -59
  177. package/dist/types-cjs/core/lanes.d.cts +0 -44
  178. package/dist/types-cjs/core/optimistic.d.cts +0 -6
  179. package/dist/types-cjs/core/owner.d.cts +0 -124
  180. package/dist/types-cjs/core/scheduler.d.cts +0 -180
  181. package/dist/types-cjs/core/types.d.cts +0 -192
  182. package/dist/types-cjs/core/verdict.d.cts +0 -2
  183. package/dist/types-cjs/index.d.cts +0 -10
  184. package/dist/types-cjs/map.d.cts +0 -69
  185. package/dist/types-cjs/package.json +0 -3
  186. package/dist/types-cjs/signals.d.cts +0 -624
  187. package/dist/types-cjs/store/index.d.cts +0 -19
  188. package/dist/types-cjs/store/next/optimistic.d.cts +0 -20
  189. package/dist/types-cjs/store/next/projection.d.cts +0 -8
  190. package/dist/types-cjs/store/next/reconcile.d.cts +0 -3
  191. package/dist/types-cjs/store/next/store.d.cts +0 -77
  192. package/dist/types-cjs/store/next/target.d.cts +0 -117
  193. package/dist/types-cjs/store/optimistic.d.cts +0 -45
  194. package/dist/types-cjs/store/projection.d.cts +0 -70
  195. package/dist/types-cjs/store/reconcile.d.cts +0 -46
  196. package/dist/types-cjs/store/store.d.cts +0 -138
  197. package/dist/types-cjs/store/storePath.d.cts +0 -58
  198. package/dist/types-cjs/store/utils.d.cts +0 -74
@@ -1,6 +1,5 @@
1
1
  import type { NOT_PENDING } from "./constants.js";
2
- import type { OptimisticLane } from "./lanes.js";
3
- import type { IQueue, Transition } from "./scheduler.js";
2
+ import type { Transaction } from "./scheduler.js";
4
3
  export interface Disposable {
5
4
  (): void;
6
5
  }
@@ -17,16 +16,38 @@ export interface Link {
17
16
  * scanning the dep list to answer membership (see `link()`).
18
17
  */
19
18
  _gen: number;
20
- _pendingObserver?: boolean;
21
19
  }
22
20
  export interface NodeOptions<T> {
23
21
  id?: string;
24
22
  name?: string;
23
+ /**
24
+ * Source location (`file:line:col`, root-relative) written by the
25
+ * compiler's `sourceNames` `locations` kind; dev and observe builds keep it
26
+ * for console reports and diagnostic events, production ignores it. Not
27
+ * meant to be written by hand.
28
+ */
29
+ loc?: string;
25
30
  transparent?: boolean;
26
31
  equals?: ((prev: T, next: T) => boolean) | false;
27
32
  ownedWrite?: boolean;
28
33
  /** Exclude this signal from snapshot capture (internal — not part of public API) */
29
34
  _noSnapshot?: boolean;
35
+ /** Extra CONFIG_* bits OR'd into the node's config at creation (internal —
36
+ * not part of public API). Used by refresh() for CONFIG_FRESH_READ,
37
+ * keeping the per-flag option arms out of the core creation path. */
38
+ _extraConfig?: number;
39
+ /** Observe tiers: framework plumbing — no name, no owner-path segment, no
40
+ * attribution records of its own; its children stay observed (internal —
41
+ * not part of public API; see CONFIG_PLUMBING). */
42
+ _plumbing?: boolean;
43
+ /** Observe tiers: a framework scope wide by construction — exempt from
44
+ * WIDE_SCOPE_DEPS, never from HUGE_FAN_IN (internal — not part of public
45
+ * API; see CONFIG_WIDE). */
46
+ _wide?: boolean;
47
+ /** Observe tiers: a framework async node that supersedes its own flights by
48
+ * design — exempt from ABANDONED_FLIGHTS (internal — not part of public
49
+ * API; see CONFIG_SUPERSEDES). */
50
+ _supersedes?: boolean;
30
51
  unobserved?: () => void;
31
52
  lazy?: boolean;
32
53
  sync?: boolean;
@@ -53,67 +74,78 @@ export interface NodeOptions<T> {
53
74
  * hot-path gates — a bit says "consult _x", never the reverse.
54
75
  */
55
76
  export interface NodeExtension {
56
- _overrideValue: unknown | typeof NOT_PENDING;
57
- /**
58
- * The transaction that owns the active override (stamped at optimistic
59
- * write, cleared at settle). Ownership must live on the node: a lane's
60
- * _transition is a scheduling affinity that a shared subscriber can merge
61
- * across transactions (#2912) — following it would let one action's settle
62
- * revert another action's live override. Node-level sibling of the store
63
- * layer's STORE_OPTIMISTIC_OWNERS stamps (#2899). `null` = ambient write.
64
- */
65
- _overrideOwner: Transition | null | undefined;
66
- _optimisticLane: OptimisticLane | undefined;
67
- _pendingSignal: Signal<boolean> | undefined;
68
- _latestValueComputed: Computed<any> | undefined;
69
- _parentSource: Signal<any> | Computed<any> | undefined;
70
- /**
71
- * Live `affects()` marks on this node (refcount). Non-zero is declared
72
- * motion — see affects(); the count is the mark's only graph state.
73
- */
74
- _affectsCount: number;
75
77
  _inFlight: PromiseLike<any> | AsyncIterable<any> | null;
78
+ /** Cancellation for the CURRENT iterator flight (#3122): closes the
79
+ * iterator (`it.return()`), idempotent. Fired at the sites that release
80
+ * `_inFlight` so a superseded stream stops at supersede time. Null for
81
+ * plain promise flights (no cancellation hook exists). */
82
+ _flightTeardown: (() => void) | null;
76
83
  _error: unknown;
77
84
  _blocked: boolean | undefined;
78
85
  _pendingSources: Set<Computed<any>> | undefined;
79
- _notifyStatus: ((status?: number, error?: any) => void) | undefined;
80
- /** Question-scoped re-ask classification of the current pending window
81
- * (see the former Computed._x?._reask doc): set by recompute from
82
- * REACTIVE_REASK, cleared on landing; meaningless while not pending. */
83
- _reask: boolean;
84
- _child: FirewallSignal<any> | null;
85
86
  _unobserved: (() => void) | undefined;
86
87
  _snapshotValue: any;
87
- /** Zombie staging (staged disposal): a recompute of an owner that HAS
88
- * children/disposal parks them here until the flush commits (or a
89
- * transition reverts). Childless nodes — the common case — never write
90
- * these. */
91
- _pendingDisposal: Disposable | Disposable[] | null;
88
+ /** L2 — the previous pass's frame, parked for this node's commit: its child
89
+ * chain and `_disposal` list, still reacting until the commit disposes
90
+ * them (or the owner's death does). */
92
91
  _pendingFirstChild: Owner | null;
93
- /** #3038: the firewall children that actually carry isPending()/latest()
94
- * companions. The post-recompute companion snap iterates THIS set —
95
- * O(companions asked for) — never the full `_child` chain (one entry per
96
- * materialized leaf). Populated at companion creation; entries live as
97
- * long as their companions (which are permanent once created). */
98
- _companionChildren: Set<FirewallSignal<any>> | undefined;
92
+ _pendingDisposal: Disposable | Disposable[] | null;
93
+ /** L2 — the transaction holding this node while CONFIG_HELD is set
94
+ * (`holdNode`); resolved through merges by `txOf`. */
95
+ _transaction: Transaction | null;
96
+ /** The node's current flight re-asks the same question (a `refresh()`,
97
+ * A19 exc. 2 / A24): verdict-quiet — `isPending` reads false for it —
98
+ * through its landing until the commit. */
99
+ _reask: boolean;
100
+ /** A28: the staging the last flush left on a held node, kept across an
101
+ * unflushed rewrite — what `latest()` and a tracked reader see until the
102
+ * flush that carries the rewrite; valid while `_flushedAt` is the current
103
+ * clock (that flush advances it). */
104
+ _flushed: unknown;
105
+ _flushedAt: number;
106
+ /** Provenance (A18, #3331): the question this node's guess or latest
107
+ * flight answers (`scheduler.question`); 0 when unstamped. */
108
+ _q: number;
109
+ /** Lanes (plan sec. 28) — the lane's value for this node while CONFIG_OVERRIDE is
110
+ * set: a written guess, or a lane pass's derivation. `NOT_PENDING` when
111
+ * none. The screen shows it once the lane has revealed (`_shown`); a
112
+ * direct read sees it throughout; the committed truth stays `_value`. */
113
+ _lane: unknown;
114
+ /** `affects()` marks live on this node (affects.ts): declared in-flight
115
+ * changes — `isPending` reads true for it and its derivations while any
116
+ * is live. A count, never a hold. */
117
+ _marks: number;
118
+ /** D-41: the error a node showed when a re-ask made it pending — still
119
+ * the display (D-39) until a new answer commits: an untracked read throws
120
+ * it, `isPending` reads a staged answer as a change over it, and a
121
+ * recovery equal to the last good value is still a new answer. */
122
+ _shownError: unknown;
123
+ /** R5: the frame pass's flight of a `latest()`/`isPending()` reader the
124
+ * seam re-derived in the verdict lane (lanes.ts `laneSeams`) — the
125
+ * frame's answer to the question it asked, which the transaction's
126
+ * landing adopts instead of asking it again (lanes.ts `adoptParked`, F-9). Cleared
127
+ * by any later pass. */
128
+ _parked?: PromiseLike<any>;
99
129
  }
100
130
  export interface RawSignal<T> {
101
131
  _subs: Link | null;
102
132
  _subsTail: Link | null;
133
+ _value: T;
103
134
  /**
104
- * DEV-only live subscriber count. Maintained by `link`/`unlinkSubs` for
105
- * graph-size diagnostics; undefined in production.
135
+ * Observe-tier label (`name` option, or the node kind: `signal`,
136
+ * `computed`, `effect`…). A slot in the observe/dev literals — never a
137
+ * post-construction write — and absent from the prod literals entirely.
106
138
  */
107
- _subCount?: number;
108
- _value: T;
109
139
  _name?: string;
140
+ /**
141
+ * Observe-tier: the owner in scope when a user-facing signal was created
142
+ * (`registerGraph`), so diagnostics about the signal get an owner path.
143
+ * A slot in the observe/dev `signal()` literal; absent from prod.
144
+ */
145
+ _owner?: Owner | null;
110
146
  _equals: false | ((a: T, b: T) => boolean);
111
147
  _config: number;
112
148
  _time: number;
113
- /** IN CORE, not the extension (stage-3 §12c): consulted on EVERY write
114
- * (setSignal's transition-init check) and on recompute scheduling — the
115
- * per-write extension chase measurably taxed propagation chains. */
116
- _transition: Transition | null;
117
149
  /** Notify-epoch stamp of the last subscriber walk (§12d). A re-write to an
118
150
  * already-staged node whose stamp still equals the global epoch skips the
119
151
  * whole walk — marking is idempotent, and the epoch bumps on every
@@ -123,14 +155,12 @@ export interface RawSignal<T> {
123
155
  /** Cold extension — see NodeExtension. */
124
156
  _x: NodeExtension | null;
125
157
  }
126
- export interface FirewallSignal<T> extends RawSignal<T> {
127
- _firewall: Computed<any>;
128
- _nextChild: FirewallSignal<unknown> | null;
129
- }
130
- export type Signal<T> = RawSignal<T> | FirewallSignal<T>;
158
+ export type Signal<T> = RawSignal<T>;
131
159
  export interface Owner {
132
160
  id?: string;
133
161
  _config: number;
162
+ /** Lifecycle flags (REACTIVE_*); roots carry only REACTIVE_DISPOSED. */
163
+ _flags: number;
134
164
  _snapshotScope?: boolean;
135
165
  /** Effect-returned cleanup; managed across reruns, invoked at true disposal */
136
166
  _cleanup?: () => void;
@@ -138,21 +168,28 @@ export interface Owner {
138
168
  _parent: Owner | null;
139
169
  _context: Record<symbol | string, unknown>;
140
170
  _childCount: number;
141
- _queue: IQueue;
142
171
  _firstChild: Owner | null;
143
172
  _nextSibling: Owner | null;
144
173
  _prevSibling: Owner | null;
145
- /** Cold extension — see NodeExtension (owners use the zombie-pair slots). */
174
+ /** Cold extension — see NodeExtension. */
146
175
  _x: NodeExtension | null;
176
+ /**
177
+ * Observe-tier label: the `name` option, the node kind (`computed`,
178
+ * `effect`…), or the component label the rendering layer writes on a root
179
+ * (`<App>`). A slot in the observe/dev literals; absent from prod.
180
+ */
181
+ _name?: string;
182
+ /**
183
+ * Observe-tier source location (`file:line:col`): the `loc` option, or
184
+ * the JSX site the rendering layer writes on a component root. A slot
185
+ * beside `_name`; absent from prod. Reserved from property mangling, like
186
+ * `_name`, because solid-js writes it and the core's diagnostics read it.
187
+ */
188
+ _loc?: string;
147
189
  }
148
190
  export interface Computed<T> extends RawSignal<T>, Owner {
149
191
  _deps: Link | null;
150
192
  _depsTail: Link | null;
151
- /**
152
- * DEV-only live source count. Maintained by `link`/`unlinkSubs` for
153
- * graph-size diagnostics; undefined in production.
154
- */
155
- _depCount?: number;
156
193
  /** Recompute-pass counter; bumped when dep revalidation starts. */
157
194
  _depGen: number;
158
195
  _flags: number;
@@ -161,22 +198,11 @@ export interface Computed<T> extends RawSignal<T>, Owner {
161
198
  _nextHeap: Computed<any> | undefined;
162
199
  _prevHeap: Computed<any>;
163
200
  _fn: (prev?: T) => T;
164
- /**
165
- * Clock tick at which REACTIVE_MANUAL_WRITE was last applied
166
- * (`suppressComputedRecompute`). Lets `refresh()` distinguish a same-tick
167
- * manual write (which wins over the refresh, #2692) from a mask carried
168
- * across ticks by a transaction (which an explicit refresh lifts, #3026).
169
- * Only meaningful while REACTIVE_MANUAL_WRITE is set.
170
- */
171
- _manualWriteTime?: number;
172
201
  /**
173
202
  * True while a `loadingValue` node's first real answer hasn't landed: the
174
203
  * node was born committed (commit #0 = the loading value) and `handleAsync`
175
204
  * serves that committed value instead of throwing NotReadyError, so first
176
- * flights never suspend readers, trip boundaries, or hold transitions.
177
- * The window is verdict-quiet: `isPending` stays false, because commit #0
178
- * answers the question by declaration (first-load affordances belong to
179
- * the value channel). Cleared by the first value landing on any path (sync
205
+ * flights never suspend readers or trip boundaries. Cleared by the first value landing on any path (sync
180
206
  * return, sync-resolved promise, first iterator yield, async settle); a
181
207
  * real error leaves it set — errors answer reads but don't enter the value
182
208
  * lineage, so a retry serves the loading value again. Once cleared, normal
@@ -1,2 +1,37 @@
1
+ /** The windows. `read` dispatches to `verdictValue` while one is open; each
2
+ * restores the dispatch it found — none inside a memo's pass a window
3
+ * pulled (`verdictValue`). */
1
4
  export declare function latest<T>(fn: () => T): T;
5
+ /**
6
+ * Reports whether what `fn` reads is still waiting on an update. Read the
7
+ * values in question inside `fn`: the probe answers `true` while any of
8
+ * them depends on a change that is in flight — a write or an async source
9
+ * that has started producing a new value whose result has not landed yet —
10
+ * and `false` once the latest value is the one on screen. The answer is
11
+ * tracked like any read, so a memo or effect that calls `isPending` re-runs
12
+ * when it flips.
13
+ *
14
+ * A read that has no value yet is loading, not pending: inside `fn` it
15
+ * follows the surrounding `Loading` path like any other read, and the probe
16
+ * reports only updates to a value that already exists. A bare `refresh()`
17
+ * does not flip `isPending`; pair it with `affects()` to make the re-ask
18
+ * visible.
19
+ *
20
+ * @param fn expression to probe; read the values in question inside it
21
+ *
22
+ * @returns `true` while a read inside `fn` depends on a change that has not committed yet
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const [query, setQuery] = createSignal("");
27
+ * const results = createMemo(() => searchProducts(query()));
28
+ * const stale = createMemo(() => isPending(results));
29
+ *
30
+ * setQuery("shoes");
31
+ * // stale() is true until the new results land, while results() keeps
32
+ * // serving the previous list — dim it instead of showing a spinner.
33
+ * ```
34
+ *
35
+ * @description https://v2.solidjs.com/reference/solid-js/reactivity/is-pending
36
+ */
2
37
  export declare function isPending(fn: () => any): boolean;
@@ -0,0 +1,28 @@
1
+ import { type MemoOptions, type SourceAccessor } from "./signals.js";
2
+ /**
3
+ * Creates an async memo that may lag, but never leads. Before its first
4
+ * answer it is an ordinary async memo: readers suspend to the nearest
5
+ * `<Loading>`. After it, a refetch holds nothing: readers keep the last
6
+ * committed value until the new one lands, and the rest of the screen moves
7
+ * on without it. `isPending` reports the refetch, on the node and on what
8
+ * derives from it. Use it for independent widgets (dashboards, feeds,
9
+ * search results) where the previous answer with a "refreshing" indicator is
10
+ * better than waiting with everything else.
11
+ *
12
+ * - It never shows a value ahead of a held change: a refetch that read a
13
+ * held value lands with that hold.
14
+ * - A rejected refetch errors like any memo; the stale value never masks it.
15
+ * - `refresh(d)` is a quiet re-ask, and `await refresh(d)` and `until`
16
+ * wait for the landing rather than the stale value.
17
+ * - Combine with `loadingValue` for a node that never suspends at all.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * const rows = createDeferred(() => fetchRows(store.period));
22
+ *
23
+ * <section class={{ stale: isPending(() => rows()) }}>
24
+ * <For each={rows()}>{row => <Row row={row} />}</For>
25
+ * </section>
26
+ * ```
27
+ */
28
+ export declare function createDeferred<T>(fn: (prev?: T) => T | PromiseLike<T> | AsyncIterable<T>, options?: MemoOptions<T>): SourceAccessor<T>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Resolves nested accessors and arrays in a children tree to their rendered
3
+ * values. See the `children()` helper in solid-js for the memoized form.
4
+ */
5
+ export declare function flatten(children: any, options?: {
6
+ skipNonRendered?: boolean;
7
+ doNotUnwrap?: boolean;
8
+ }): any;
@@ -0,0 +1,47 @@
1
+ /** The observer a `subscribe` call receives. */
2
+ type FromObserver<T> = {
3
+ next(value: T): void;
4
+ error(err: unknown): void;
5
+ complete(): void;
6
+ };
7
+ type Teardown = (() => void) | {
8
+ unsubscribe(): void;
9
+ } | void;
10
+ /**
11
+ * Anything `from` accepts: a subscribe function
12
+ * (`(next, error, complete) => unsubscribe`), an object with
13
+ * `subscribe(observer)` (RxJS and TC39 Observables, including
14
+ * `Symbol.observable` / `"@@observable"` interop), or an AsyncIterable.
15
+ */
16
+ export type FromSource<T> = ((next: (value: T) => void, error: (err: unknown) => void, complete: () => void) => Teardown) | {
17
+ subscribe(observer: FromObserver<T>): Teardown;
18
+ } | AsyncIterable<T>;
19
+ /**
20
+ * Converts a callback subscription, an Observable or an AsyncIterable into an
21
+ * AsyncIterable for a Solid computation. A subscription keeps only the latest
22
+ * value, and a value the source emits during `subscribe` is served without a
23
+ * loading frame; an AsyncIterable streams every value through.
24
+ *
25
+ * The source closes on supersede — the owning computation re-running — and
26
+ * on owner disposal. Inside an async generator memo that holds for a
27
+ * `for await` that starts before the first `await`; one that starts after it
28
+ * has no owner to bind to, so its source closes only when the loop ends.
29
+ * Prefer returning `from(...)` from its own memo, with awaited inputs read
30
+ * from upstream memos and transforms done in a downstream memo.
31
+ *
32
+ * Iterate the result with `for await` or return it from a computation: its
33
+ * `next()` returns an already-buffered value as a bare result, not a promise.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const position = createMemo(() =>
38
+ * from<Position>((next, error) => {
39
+ * const id = navigator.geolocation.watchPosition(next, error);
40
+ * return () => navigator.geolocation.clearWatch(id);
41
+ * })
42
+ * );
43
+ * const ticks = createMemo(() => from(interval$(rate())));
44
+ * ```
45
+ */
46
+ export declare function from<T>(source: FromSource<T>): AsyncIterable<T>;
47
+ export {};
@@ -1,10 +1,36 @@
1
- export { $REFRESH, ContextNotFoundError, NoOwnerError, NotReadyError, action, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, isDisposed, getObserver, isEqual, untrack, isPending, latest, refresh, SUPPORTS_PROXY, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots, enforceLoadingBoundary, enableExternalSource, resetErrorHalt } from "./core/index.js";
2
- import { type Dev } from "./core/index.js";
1
+ export { $REFRESH, action, ContextNotFoundError, NoOwnerError, NotReadyError, TimeoutError, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, isDisposed, getObserver, isEqual, untrack, isPending, latest, SUPPORTS_PROXY, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots, enforceLoadingBoundary, enableExternalSource, resetErrorHalt, configureClientErrors, ROOT_ERROR_HOOK } from "./core/index.js";
2
+ /**
3
+ * @internal The dev console footer seam — registered by `solid-js`, which
4
+ * owns the repair skill the footer points at. Not part of `DEV`; a no-op
5
+ * outside dev builds.
6
+ */
7
+ export { setConsoleFooter } from "./core/index.js";
8
+ /** @internal The flush round counter (scheduler.ts): hydration's served pass tells its own round from a later one. */
9
+ export { clock } from "./core/index.js";
10
+ /** @internal Dev duplicate-copy check: solid-js marks components and context reads. */
11
+ export { runAsSolidCopy, checkForeignOwnerless } from "./core/copies.js";
12
+ /** @internal The pre-write hook (`setWriteHook` in core/core.ts); the server-components client's deferred hydration. */
13
+ /** @internal Plain-signal identities and the dev read watch (dependency edges; the server-components client). */
14
+ export { setWriteHook, setSignalIdentities, setReadWatch, signalName } from "./core/index.js";
15
+ /** @internal Store dependency edges: the name a store proxy's writes go by (the server-components client). */
16
+ export { storeName } from "./store/edges.js";
17
+ import { type Dev, type Observe } from "./core/index.js";
18
+ /**
19
+ * Observe tier (diagnostics channel, attribution hook slot + interaction
20
+ * frame): dev and observe builds. The attribution engine itself is the
21
+ * `@solidjs/signals/attribution` entry.
22
+ */
23
+ export declare const OBSERVE: Observe | undefined;
24
+ /** Dev tier (devtools hooks, graph traversal, console reporting): dev builds only. */
3
25
  export declare const DEV: Dev | undefined;
4
- export type { Owner, Context, ContextRecord, IQueue, ExternalSourceFactory, ExternalSource, ExternalSourceConfig, Refreshable, Dev, DevHooks, DiagnosticCapture, DiagnosticCode, DiagnosticEvent, DiagnosticKind, Diagnostics, DiagnosticSeverity } from "./core/index.js";
5
- export { createSignal, createMemo, createEffect, createRenderEffect, createTrackedEffect, createReaction, createOptimistic, resolve, onSettled, onCleanup } from "./signals.js";
6
- export type { Accessor, SourceAccessor, Setter, Signal, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, SignalOptions, MemoOptions, NoInfer } from "./signals.js";
7
- export { affects } from "./affects.js";
26
+ export type { Owner, Context, ContextRecord, IQueue, ExternalSourceFactory, ExternalSource, ExternalSourceConfig, Refreshable, AttributionSlot, ClientErrorContext, ClientErrorHook, ClientErrorsConfig, InteractionRef, NavigationRef, Dev, Observe, ServerObserve, Records, RecordTypes, HostRecordTypes, RecordType, RecordEvent, RecordLive, RecordListener, RecordSubscribeOptions, DevHooks, DiagnosticCapture, DiagnosticCode, DiagnosticEvent, DiagnosticKind, DiagnosticListener, Diagnostics, DiagnosticSeverity, DiagnosticSubject } from "./core/index.js";
27
+ export { createSignal, createOptimistic, createMemo, createEffect, createRenderEffect, createTrackedEffect, createReaction, refresh, resolve, until, onSettled, onFlush, onCleanup } from "./signals.js";
28
+ export type { Truthy, UntilOptions, Accessor, SourceAccessor, Setter, Signal, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, SignalOptions, MemoOptions, NoInfer } from "./signals.js";
8
29
  export { mapArray, repeat, type Maybe } from "./map.js";
9
30
  export * from "./store/index.js";
10
- export { createLoadingBoundary, createErrorBoundary, createRevealOrder, flatten, type RevealOrder } from "./boundaries.js";
31
+ export { affects } from "./affects.js";
32
+ export { createDeferred } from "./deferred.js";
33
+ export { from, type FromSource } from "./from.js";
34
+ export { flatten } from "./flatten.js";
35
+ export { createLoadingBoundary, createErrorBoundary } from "./boundaries.js";
36
+ export { createRevealOrder, type RevealOrder } from "./reveal.js";
@@ -30,7 +30,7 @@ export type Maybe<T> = T | void | null | undefined | false;
30
30
  * );
31
31
  * ```
32
32
  *
33
- * @description https://docs.solidjs.com/reference/reactive-utilities/map-array
33
+ * @description https://v2.solidjs.com/reference/solid-js/advanced/jsx-component-primitives/map-array
34
34
  */
35
35
  export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value: Item, index: Accessor<number>) => MappedItem, options?: {
36
36
  keyed?: true;
@@ -47,6 +47,8 @@ export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly
47
47
  fallback?: Accessor<any>;
48
48
  name?: string;
49
49
  }): Accessor<MappedItem[]>;
50
+ /** @internal */
51
+ export declare function __smallMoveHits(): number;
50
52
  /**
51
53
  * Reactively renders a callback `count` times, reusing previously-rendered
52
54
  * entries when only the count changes. Underlying helper for `<Repeat>`.
@@ -60,7 +62,7 @@ export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly
60
62
  * const view = repeat(count, i => `Item ${i}`, { fallback: () => "empty" });
61
63
  * ```
62
64
  *
63
- * @description https://docs.solidjs.com/reference/reactive-utilities/repeat
65
+ * @description https://v2.solidjs.com/reference/solid-js/advanced/jsx-component-primitives/repeat
64
66
  */
65
67
  export declare function repeat(count: Accessor<number>, map: (index: number) => any, options?: {
66
68
  from?: Accessor<number | undefined>;
@@ -0,0 +1,19 @@
1
+ export type RevealOrder = "sequential" | "together" | "natural";
2
+ type OrderAccessor = () => RevealOrder;
3
+ type BoolAccessor = () => boolean;
4
+ /**
5
+ * Lower-level primitive behind `<Reveal>`: coordinates the order in which the
6
+ * Loading boundaries created directly inside `fn` reveal their content.
7
+ *
8
+ * @param fn the subtree; the Loading boundaries it creates directly are the
9
+ * group's slots, a nested `createRevealOrder` a composite slot
10
+ * @param options `order` — `"sequential"` (default: front to back, the
11
+ * first unready slot showing its fallback), `"together"` (all at once),
12
+ * `"natural"` (each on its own); `collapsed` — in a sequential group, the
13
+ * slots behind the frontier render nothing instead of their fallbacks
14
+ */
15
+ export declare function createRevealOrder<T>(fn: () => T, options?: {
16
+ order?: OrderAccessor;
17
+ collapsed?: BoolAccessor;
18
+ }): T;
19
+ export {};