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

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 (118) hide show
  1. package/dist/dev-shared.js +2000 -3768
  2. package/dist/dev.attribution.js +132 -79
  3. package/dist/dev.js +7226 -8488
  4. package/dist/observe/affects.js +125 -104
  5. package/dist/observe/boundaries.js +458 -665
  6. package/dist/observe/core/action.js +63 -66
  7. package/dist/observe/core/async.js +240 -383
  8. package/dist/observe/core/attribution-queries.js +1 -1
  9. package/dist/observe/core/attribution.js +240 -183
  10. package/dist/observe/core/constants.js +115 -187
  11. package/dist/observe/core/context.js +3 -3
  12. package/dist/observe/core/core.js +840 -1438
  13. package/dist/observe/core/dev.js +3 -3
  14. package/dist/observe/core/effect.js +75 -86
  15. package/dist/observe/core/external.js +5 -5
  16. package/dist/observe/core/graph.js +61 -70
  17. package/dist/observe/core/heap.js +75 -98
  18. package/dist/observe/core/invariants.js +1 -34
  19. package/dist/observe/core/lanes.js +704 -181
  20. package/dist/observe/core/owner.js +80 -101
  21. package/dist/observe/core/scheduler.js +708 -1351
  22. package/dist/observe/core/verdict.js +302 -621
  23. package/dist/observe/flatten.js +79 -0
  24. package/dist/observe/index.js +15 -13
  25. package/dist/observe/map.js +232 -235
  26. package/dist/observe/reveal.js +212 -0
  27. package/dist/observe/signals.js +133 -215
  28. package/dist/observe/store/affects.js +135 -0
  29. package/dist/observe/store/index.js +29 -24
  30. package/dist/observe/store/optimistic.js +538 -0
  31. package/dist/observe/store/projection.js +302 -0
  32. package/dist/observe/store/reconcile.js +257 -0
  33. package/dist/observe/store/store.js +1945 -277
  34. package/dist/observe/store/storePath.js +1 -1
  35. package/dist/{prod/store/next → observe/store}/target.js +17 -18
  36. package/dist/observe/store/types.js +73 -0
  37. package/dist/observe/store/utils.js +1 -13
  38. package/dist/prod/affects.js +127 -106
  39. package/dist/prod/boundaries.js +442 -654
  40. package/dist/prod/core/action.js +71 -74
  41. package/dist/prod/core/async.js +307 -442
  42. package/dist/prod/core/constants.js +112 -186
  43. package/dist/prod/core/context.js +3 -3
  44. package/dist/prod/core/core.js +852 -1458
  45. package/dist/prod/core/effect.js +88 -99
  46. package/dist/prod/core/external.js +5 -5
  47. package/dist/prod/core/graph.js +61 -70
  48. package/dist/prod/core/heap.js +75 -98
  49. package/dist/prod/core/invariants.js +1 -32
  50. package/dist/prod/core/lanes.js +666 -181
  51. package/dist/prod/core/owner.js +75 -96
  52. package/dist/prod/core/scheduler.js +677 -1332
  53. package/dist/prod/core/verdict.js +297 -621
  54. package/dist/prod/flatten.js +77 -0
  55. package/dist/prod/index.js +15 -13
  56. package/dist/prod/map.js +143 -146
  57. package/dist/prod/reveal.js +212 -0
  58. package/dist/prod/signals.js +144 -226
  59. package/dist/prod/store/affects.js +135 -0
  60. package/dist/prod/store/index.js +28 -19
  61. package/dist/prod/store/optimistic.js +533 -0
  62. package/dist/prod/store/projection.js +295 -0
  63. package/dist/prod/store/reconcile.js +257 -0
  64. package/dist/prod/store/store.js +1840 -272
  65. package/dist/prod/store/storePath.js +1 -1
  66. package/dist/{observe/store/next → prod/store}/target.js +13 -17
  67. package/dist/prod/store/types.js +73 -0
  68. package/dist/prod/store/utils.js +1 -11
  69. package/dist/types/affects.d.ts +11 -30
  70. package/dist/types/boundaries.d.ts +62 -176
  71. package/dist/types/carved.d.ts +1 -0
  72. package/dist/types/core/action.d.ts +5 -6
  73. package/dist/types/core/async.d.ts +10 -5
  74. package/dist/types/core/attribution-hooks.d.ts +20 -1
  75. package/dist/types/core/attribution.d.ts +20 -9
  76. package/dist/types/core/constants.d.ts +125 -180
  77. package/dist/types/core/core.d.ts +104 -264
  78. package/dist/types/core/dev.d.ts +2 -2
  79. package/dist/types/core/effect.d.ts +0 -7
  80. package/dist/types/core/graph.d.ts +7 -1
  81. package/dist/types/core/heap.d.ts +5 -7
  82. package/dist/types/core/index.d.ts +5 -5
  83. package/dist/types/core/invariants.d.ts +0 -29
  84. package/dist/types/core/lanes.d.ts +65 -87
  85. package/dist/types/core/owner.d.ts +3 -3
  86. package/dist/types/core/scheduler.d.ts +249 -331
  87. package/dist/types/core/types.d.ts +51 -85
  88. package/dist/types/core/verdict.d.ts +3 -0
  89. package/dist/types/flatten.d.ts +8 -0
  90. package/dist/types/index.d.ts +6 -4
  91. package/dist/types/reveal.d.ts +19 -0
  92. package/dist/types/signals.d.ts +35 -91
  93. package/dist/types/store/affects.d.ts +1 -0
  94. package/dist/types/store/index.d.ts +35 -15
  95. package/dist/types/store/optimistic.d.ts +23 -0
  96. package/dist/types/store/projection.d.ts +18 -0
  97. package/dist/types/store/reconcile.d.ts +3 -0
  98. package/dist/types/store/store.d.ts +165 -143
  99. package/dist/types/store/storePath.d.ts +1 -1
  100. package/dist/types/store/target.d.ts +151 -0
  101. package/dist/types/store/types.d.ts +84 -0
  102. package/package.json +1 -1
  103. package/dist/observe/core/optimistic.js +0 -669
  104. package/dist/observe/store/next/optimistic.js +0 -717
  105. package/dist/observe/store/next/projection.js +0 -266
  106. package/dist/observe/store/next/reconcile.js +0 -375
  107. package/dist/observe/store/next/store.js +0 -2608
  108. package/dist/prod/core/optimistic.js +0 -658
  109. package/dist/prod/store/next/optimistic.js +0 -710
  110. package/dist/prod/store/next/projection.js +0 -257
  111. package/dist/prod/store/next/reconcile.js +0 -373
  112. package/dist/prod/store/next/store.js +0 -2484
  113. package/dist/types/core/optimistic.d.ts +0 -6
  114. package/dist/types/store/next/optimistic.d.ts +0 -25
  115. package/dist/types/store/next/projection.d.ts +0 -27
  116. package/dist/types/store/next/reconcile.d.ts +0 -10
  117. package/dist/types/store/next/store.d.ts +0 -145
  118. package/dist/types/store/next/target.d.ts +0 -196
@@ -1,88 +1,66 @@
1
- import { hasActiveOverride } from "./core.js";
2
- export { hasActiveOverride };
3
- import { type QueueCallback, type Transition } from "./scheduler.js";
1
+ import { type Transaction } from "./scheduler.js";
4
2
  import type { Computed, Signal } from "./types.js";
5
- /**
6
- * OptimisticLane represents the context for a single optimistic write.
7
- * Each optimistic signal creates its own lane. Lanes merge when their
8
- * dependency graphs overlap.
9
- */
10
- export interface OptimisticLane {
11
- _source: Signal<any>;
12
- _pendingAsync: Set<Computed<any>>;
13
- _effectQueues: [QueueCallback[], QueueCallback[]];
14
- _mergedInto: OptimisticLane | null;
15
- _transition: Transition | null;
16
- _parentLane: OptimisticLane | null;
17
- }
18
- export declare const signalLanes: WeakMap<Signal<any>, OptimisticLane>;
19
- export declare const activeLanes: Set<OptimisticLane>;
20
- /**
21
- * Get an existing lane for a signal or create a new one.
22
- * Reuses lane for multiple writes to the same signal.
23
- */
24
- export declare function getOrCreateLane(signal: Signal<any>): OptimisticLane;
25
- /**
26
- * Union-find: find the root lane.
27
- */
28
- export declare function findLane(lane: OptimisticLane): OptimisticLane;
29
- /**
30
- * Is the lane held? `_pendingAsync` records the async the lane OWNS (derived
31
- * under it); a transaction's reporter map records the async a render effect
32
- * OBSERVED pending with no boundary taking it (INV-3, the one registration
33
- * site). A hold needs both — the same rule the transaction itself uses, so a
34
- * memo nobody renders, or one a fallback-showing boundary caught, cannot tear
35
- * a frame and holds nothing (#3289). An orphan lane has no observation record
36
- * and never holds.
37
- *
38
- * The observation is looked up per NODE, in whichever live transaction
39
- * recorded it — not in this lane's transaction. Lanes merge across
40
- * transactions (#2912: ownership never travels through lanes), so after a
41
- * merge the root's transaction holds the observations of only one member;
42
- * the async the other member's transaction observed must hold the merged
43
- * reveal just the same (A15 for lanes, #3335).
44
- */
45
- export declare function laneHeld(lane: OptimisticLane): boolean;
46
- /**
47
- * Lanes mirror transitions (#3460): a render effect OFF a HELD lane that reads
48
- * a value the lane is revealing — an override, a `latest()` shadow — sees the
49
- * committed value, exactly as a stale reader of a held transaction does
50
- * (A15 reveal corollary): it publishes now, with the frame that is on screen
51
- * (the lane defers its own readers' runs, so the committed value is what is
52
- * visible), entangles nothing — a sync write is never held by a lane — and
53
- * re-derives at the release. The release re-run rides the lane's own render
54
- * queue, which runs when the lane reveals (runLaneEffects) or its transaction
55
- * commits (cleanupCompletedLanes). A reader ON the lane computes the lane's
56
- * reveal and takes the value as before.
57
- *
58
- * OFF the lane is provenance, not membership — the transaction mirror
59
- * exactly: a stale reader of a transaction is a pass that runs outside it. A
60
- * pass under the lane's own transaction is the lane's work — its write (lane
61
- * posture), or the landing of its async, which re-enters the transaction
62
- * (#3334) and runs a member with no ambient lane. Read as an outsider, that
63
- * pass published the committed view and queued a replay that revealed the
64
- * override beside its unready derivation at the release (`1:0` for an
65
- * optimistic frame that never became ready; #3479 review). Membership is the
66
- * wrong test the other way: a member re-run by a sibling's sync write is a
67
- * mainline pass and shows the committed view.
68
- */
69
- export declare function readsHeldCommitted(owner: Computed<any>, c: Computed<any>): boolean;
70
- /** The ownership relation for a lane hold (core `ownsHold`, §6 ruling 2): the
71
- * running pass owns `lane`'s hold if it runs under the transition that owns
72
- * the lane (the node's, resolved through override ownership and merges) or
73
- * inside the lane itself. */
74
- export declare function ownsLane(lane: OptimisticLane, owner: Computed<any>): boolean;
75
- /**
76
- * Merge two lanes when their dependency graphs overlap.
77
- */
78
- export declare function mergeLanes(lane1: OptimisticLane, lane2: OptimisticLane): OptimisticLane;
79
- /**
80
- * Resolve a node's lane: follow union-find chain, verify active, clear if stale.
81
- */
82
- export declare function resolveLane(el: Signal<any> | Computed<any>): OptimisticLane | undefined;
83
- export declare function resolveTransition(el: Signal<any> | Computed<any>): Transition | null | undefined;
84
- /**
85
- * Assign or merge a lane onto a node. At convergence points (node already has
86
- * a different active lane), merge unless the node has an active override.
87
- */
88
- export declare function assignOrMergeLane(el: Signal<any> | Computed<any>, sourceLane: OptimisticLane): void;
3
+ /** A lane node's current value: its guess, or the latest it derived — the
4
+ * staging a shown lane holds for its next reveal, else its slot; the
5
+ * committed value while it has none (its first lane pass in flight). */
6
+ export declare function laneValueOf(el: Signal<any> | Computed<any>): unknown;
7
+ /** What the screen shows for a lane's node: the lane's value once the lane
8
+ * has revealed, the committed truth before. */
9
+ export declare function display(el: Signal<any> | Computed<any>): unknown;
10
+ /** What the writer sees of a node: an unflushed guess to it, else the
11
+ * lane's value or the committed one — what an optimistic updater composes
12
+ * on (a store setter's draft too, store/optimistic.ts). */
13
+ export declare function guessedValueOf<T>(n: Signal<T> | Computed<T>): T;
14
+ /** The unflushed guess to `n`, else NOT_PENDING. */
15
+ export declare function pendingGuessOf(n: Signal<any> | Computed<any>): unknown;
16
+ export declare function optimisticWrite<T>(n: Signal<T> | Computed<T>, v: T | ((prev: T) => T)): T;
17
+ /** The running pass read lane `l`'s work as a derivation: it is `l`'s — or,
18
+ * already another lane's, the frame it computes derives from both guesses
19
+ * and cannot show one without the other (#3335, A15 for lanes): the two
20
+ * lanes are linked — one reveal unit, each blocked while any is — while
21
+ * their lifetimes stay their own (#2912: a guess reverts with its own
22
+ * action, not with the one it shares a reader with). A nested lane reading
23
+ * through an ancestor's guess stays its own (the screen plus its own
24
+ * guesses). */
25
+ export declare function enterLane(l: Transaction, c: Computed<any>): void;
26
+ /** Verdicts (maintainer, 2026-10-01): `isPending` and `latest` are
27
+ * optimistic state the system supplies — a verdict is a guess ("pending,
28
+ * until this lands"; "the proposal is the value") decided at the seam like
29
+ * a user's, and its readers break out of the hold the same way: work of a
30
+ * lane under the holder, shown now, re-derived at the landing, ending with
31
+ * it. Judged at the seam like any lane: blocked while a verdict reader's
32
+ * own derivation is in flight (lane rule 3), shown otherwise. */
33
+ export declare function verdictLane(t: Transaction): Transaction;
34
+ /** A lane pass's node (core.ts `recompute`, before its staging; a pending
35
+ * propagation under a lane pass, async.ts): listed, carrying the lane's
36
+ * value from now (a derivation of a guess — its readers become lane work).
37
+ * Entering the lane supersedes a frame staging the node carried: this
38
+ * pass's answer replaces it, and the frame's hold on it is over. An
39
+ * effect's value slot is private (no lane value). A pass in a lane's seat
40
+ * that read none of the lane's world has left it (false): its result is the
41
+ * frame's — a derivation whose branch no longer reaches the guess — and no
42
+ * hold the lane took over from a transaction stays on it (#3698: lane work
43
+ * never makes its node transaction work; a born-held effect's hold went to
44
+ * the lane). A pass interrupted before it got there (pending, errored) did
45
+ * not leave (A30: it never got there). A first pass under a lane is the
46
+ * lane's (ruling A); a guess is written, not derived — it never leaves this
47
+ * way. `errored`: the pass has no answer — or, a lane pass's pending
48
+ * propagation (async.ts `propagateStatus`), the node gone pending. */
49
+ export declare function laneStage(el: Computed<any>, l: Transaction, create: boolean, errored: boolean | Computed<any>): boolean;
50
+ export declare function supersede(n: Signal<any> | Computed<any>, value: unknown, changed: boolean): void;
51
+ /** Lanes. A lane's node is read by its reader's kind: an authoritative
52
+ * reader (`until`) sees the truth — staged beneath a guess, else committed
53
+ * — and is no lane's; an untracked read sees the lane's latest value (A17:
54
+ * "direct read shows optimistic"; A28); a children-forbidden reader sees
55
+ * the frame (A32). A render effect in the frame's seat reading a lane the
56
+ * seam found blocked, or a member whose own flight is up (held or not — the
57
+ * lane-membership ruling, 2026-10-05), sees the screen, re-derived at the
58
+ * reveal (#3460's stale reader) — or, the node a
59
+ * flight that has never shown (nothing to show), waits on it: its own frame
60
+ * holds (A15, #3334), not the lane's parent. Any other tracked reader is
61
+ * the lane's work from this read — a derivation; a leaf reading a lane that
62
+ * has shown, or one the seam has not judged yet (its run waits on the
63
+ * verdict: released if the lane shows, held if it blocks) — and sees the
64
+ * lane's latest. NOT_PENDING falls through: lane work's read of a pending
65
+ * member throws like any. */
66
+ export declare function laneRead(c: Computed<any> | null, el: Signal<any> | Computed<any>): unknown;
@@ -67,9 +67,9 @@ export declare function getOwner(): Owner | null;
67
67
  */
68
68
  export declare function cleanup(fn: Disposable): Disposable;
69
69
  /**
70
- * Returns `true` if the owner has been disposed (or marked zombie pending
71
- * disposal). Pair with a captured owner to bail out of late callbacks whose
72
- * surrounding component already unmounted.
70
+ * Returns `true` if the owner has been disposed. Pair with a captured owner
71
+ * to bail out of late callbacks whose surrounding component already
72
+ * unmounted.
73
73
  *
74
74
  * @example
75
75
  * ```ts