@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
@@ -1,47 +0,0 @@
1
- import type { Accessor } from "./signals.cjs";
2
- import { type Store } from "./store/store.cjs";
3
- /**
4
- * Declares that in-flight work will change the targeted data: the named
5
- * slot(s) — and everything DERIVED from them — read as pending
6
- * (`isPending` → `true`) from the declaration until the surrounding
7
- * transaction settles or reverts. A mark lives on its own channel — a
8
- * refcount on the marked node plus dep-graph reachability in the verdict
9
- * layer — so the marked values themselves stay readable (a mark is a promise
10
- * of change, not an absence of value), no reader ever suspends on one, and
11
- * completion/settlement accounting never sees one. This is the declaration
12
- * verb of the pending model — additive only. A mark can turn pending ON for
13
- * data the graph can't see changing yet; nothing can turn pending OFF while
14
- * a real change is in flight — a quiet `refresh()` re-ask under a mark still
15
- * reads pending (declaring the reload is what makes it a real question).
16
- *
17
- * Targets:
18
- * - `affects(store)` — a store proxy (any record, root or nested): every
19
- * record reachable from it at declaration time reads pending, including
20
- * through captured child proxies (e.g. `<For>` rows). Siblings are
21
- * untouched; records added after the declaration are not covered.
22
- * - `affects(record, key)` — exactly the named slot of the record. One key
23
- * per call (keys do NOT form a path — target the owning record directly).
24
- * - `affects(accessor)` — a source accessor (signal or memo): the source
25
- * reads pending.
26
- *
27
- * Typically called at the top of an `action` alongside optimistic writes —
28
- * both are up-front declarations about the same mutation. Outside any
29
- * transaction the mark is released at the end of the current flush.
30
- *
31
- * @example
32
- * ```ts
33
- * const send = action(function* (text: string) {
34
- * setState(s => { s.messages.push({ text, status: "sending" }); });
35
- * affects(state.messages.at(-1)!, "status"); // this slot pends until settle
36
- * yield api.send(text);
37
- * });
38
- *
39
- * const reload = action(function* () {
40
- * affects(thing); // the whole store pends…
41
- * refresh(thing); // …over this otherwise-quiet re-ask
42
- * yield api.done();
43
- * });
44
- * ```
45
- */
46
- export declare function affects(target: Accessor<unknown> | Store<object>): void;
47
- export declare function affects<T extends object>(target: Store<T>, key: keyof T): void;
@@ -1,175 +0,0 @@
1
- import { Queue, type Computed, type Effect } from "./core/index.cjs";
2
- import type { Signal } from "./core/index.cjs";
3
- import { type Accessor } from "./signals.cjs";
4
- export interface BoundaryComputed<T> extends Computed<T> {
5
- _propagationMask: number;
6
- }
7
- type RevealSlot = CollectionQueue | RevealController;
8
- type BoolAccessor = () => boolean;
9
- export type RevealOrder = "sequential" | "together" | "natural";
10
- type OrderAccessor = () => RevealOrder;
11
- export declare class RevealController {
12
- _orderAccessor: OrderAccessor;
13
- _collapsedAccessor: BoolAccessor;
14
- _slots: RevealSlot[];
15
- _parentController?: RevealController;
16
- _disabled: Signal<boolean>;
17
- _collapsed: Signal<boolean>;
18
- _ready: boolean;
19
- _minimallyReady: boolean;
20
- _evaluating: boolean;
21
- constructor(order: OrderAccessor, collapsed: BoolAccessor);
22
- _forEachOwnedSlot(fn: (slot: RevealSlot) => boolean | void): boolean;
23
- _isReady(): boolean;
24
- /**
25
- * "Minimally ready" = this group has something visible to show under its own policy.
26
- * Used by an enclosing `together` group to decide when it can release.
27
- * - `together`: every direct slot is minimally ready.
28
- * - `sequential`: the first owned slot is minimally ready (frontier can advance).
29
- * - `natural`: any owned slot is minimally ready.
30
- */
31
- _isMinimallyReady(): boolean;
32
- _register(slot: RevealSlot): void;
33
- _unregister(slot: RevealSlot): void;
34
- _evaluate(disabledOverride?: boolean, collapsedOverride?: boolean): void;
35
- }
36
- export declare class CollectionQueue extends Queue {
37
- _collectionType: number;
38
- _sources: Set<Computed<any>>;
39
- _tree?: BoundaryComputed<any>;
40
- _pending: boolean;
41
- _disabled: Signal<boolean>;
42
- _error?: Signal<unknown>;
43
- _collapsed: Signal<boolean>;
44
- _revealController?: RevealController;
45
- _initialized: boolean;
46
- _onFn: (() => any) | undefined;
47
- _prevOn: any;
48
- constructor(type: number);
49
- run(type: number): void;
50
- notify(node: Effect<any>, type: number, flags: number, error?: any): boolean;
51
- _checkSources(): void;
52
- }
53
- /**
54
- * Lower-level primitive that backs the `<Loading>` flow control. Catches
55
- * pending async reads inside `fn` and renders `fallback` until they settle.
56
- *
57
- * App code should use `<Loading fallback={...}>` instead — reach for this only
58
- * when authoring custom boundary components.
59
- *
60
- * @param fn the tracked subtree
61
- * @param fallback the fallback shown while async reads in `fn` are unresolved
62
- * @param options `on` — accessor whose value scopes the boundary; when set,
63
- * transitions caused by writes to other reactive sources are *not* caught
64
- *
65
- * @example
66
- * ```tsx
67
- * // Custom boundary component built on top of the primitive.
68
- * function MyLoading(props: { fallback: JSX.Element; children: JSX.Element }) {
69
- * return createLoadingBoundary(
70
- * () => props.children,
71
- * () => props.fallback
72
- * ) as unknown as JSX.Element;
73
- * }
74
- * ```
75
- */
76
- export declare function createLoadingBoundary<T, U>(fn: () => T, fallback: () => U, options?: {
77
- on?: () => any;
78
- }): Accessor<T | U>;
79
- /**
80
- * Lower-level primitive that backs the `<Errored>` flow control. Catches
81
- * thrown errors inside `fn` and invokes `fallback(error, reset)` instead.
82
- * `error` is an accessor for the latest captured error; `reset()` recomputes
83
- * the failing sources so the boundary can attempt to recover.
84
- *
85
- * App code should use `<Errored fallback={...}>` instead — reach for this only
86
- * when authoring custom boundary components.
87
- *
88
- * @example
89
- * ```tsx
90
- * // Custom boundary that wraps the primitive and adds telemetry.
91
- * function TracedErrored(props: { fallback: (e: () => unknown) => JSX.Element; children: JSX.Element }) {
92
- * return createErrorBoundary(
93
- * () => props.children,
94
- * (err, reset) => {
95
- * reportError(err());
96
- * return props.fallback(err);
97
- * }
98
- * ) as unknown as JSX.Element;
99
- * }
100
- * ```
101
- */
102
- export declare function createErrorBoundary<T, U>(fn: () => T, fallback: (error: Accessor<unknown>, reset: () => void) => U): Accessor<T | U>;
103
- /**
104
- * Coordinate the reveal timing of sibling loading boundaries.
105
- *
106
- * Accepts reactive accessors:
107
- * - `order`: `"sequential"` (default) | `"together"` | `"natural"`.
108
- * - `"sequential"` — classic frontier reveal: siblings reveal in registration order
109
- * as each resolves; later siblings stay hidden until earlier ones complete.
110
- * - `"together"` — every direct slot stays on its fallback until the whole group
111
- * is "minimally ready" (each direct slot has produced its own first visible
112
- * content under its own order), then the whole group releases at once.
113
- * - `"natural"` — children reveal independently (as each resolves). At the top
114
- * level this is a no-op compared to not using `createRevealOrder`; the mode
115
- * exists for nesting, where the group registers as a single composite slot to
116
- * any enclosing `createRevealOrder`.
117
- * - `collapsed`: only meaningful when `order === "sequential"`. When set, tail siblings
118
- * past the frontier suppress their own fallback output. Ignored under `"together"`
119
- * and `"natural"` — those orders have no frontier.
120
- *
121
- * Nested `createRevealOrder` groups compose: the inner controller registers as a
122
- * single slot in the outer controller and is held on its fallbacks until the outer
123
- * releases that slot. Once released, the inner controller runs its own order locally
124
- * over anything still pending. There is no opt-out from an outer hold.
125
- *
126
- * "Minimally ready" is what an order considers its first visible content:
127
- * - `sequential` — frontier-0 is minimally ready (leaf: on resolve; nested: via its
128
- * own minimal signal).
129
- * - `together` — every direct slot is minimally ready.
130
- * - `natural` — any direct slot has visible content (leaves on resolve; nested
131
- * composites via their own minimal signal).
132
- *
133
- * @example
134
- * ```ts
135
- * // Primitive form of `<Reveal>` — coordinate sibling loading boundaries
136
- * // programmatically. App code uses the JSX `<Reveal>` component instead.
137
- * // Both options are accessors so they can react to state changes.
138
- * createRevealOrder(
139
- * () => renderSiblings(),
140
- * { order: () => mode(), collapsed: () => true }
141
- * );
142
- * ```
143
- */
144
- export declare function createRevealOrder<T>(fn: () => T, options?: {
145
- order?: OrderAccessor;
146
- collapsed?: BoolAccessor;
147
- }): T;
148
- /**
149
- * Resolves a children value to its renderable form: unwraps zero-arg functions
150
- * (accessors), recursively flattens arrays, and optionally skips
151
- * non-rendering values (`null`, `undefined`, `true`, `false`, `""`).
152
- *
153
- * Used internally by flow components and by the renderer to walk a children
154
- * tree. App code rarely needs this directly — see `children()` in `solid-js`
155
- * for the user-facing helper that memoizes the result.
156
- *
157
- * @param children value or array of values to flatten
158
- * @param options
159
- * - `skipNonRendered` — drop values that won't render
160
- * - `doNotUnwrap` — leave function children as-is (caller will resolve)
161
- *
162
- * @example
163
- * ```ts
164
- * // Custom renderer walking a children tree manually. Most authors should
165
- * // use `children()` from solid-js, which memoizes the resolved value.
166
- * function renderChildren(value: unknown): unknown {
167
- * return flatten(value, { skipNonRendered: true });
168
- * }
169
- * ```
170
- */
171
- export declare function flatten(children: any, options?: {
172
- skipNonRendered?: boolean;
173
- doNotUnwrap?: boolean;
174
- }): any;
175
- export {};
@@ -1,64 +0,0 @@
1
- /**
2
- * The primitive for mutations: imperative async workflows whose *writes span
3
- * an async gap* — optimistic write, server round-trip, reconciling write —
4
- * where intermediate state must not leak and failure must revert cleanly
5
- * (pair with `createOptimistic` / `createOptimisticStore`).
6
- *
7
- * Navigation-shaped updates do not need an action. A plain setter call is
8
- * enough: reads pull the async, and downstream async computeds hold their
9
- * previous values per-node until the new ones are ready (`isPending` /
10
- * `latest` expose the in-flight state). Reach for `action` only when writes
11
- * happen *after* async work, not merely upstream of it.
12
- *
13
- * Framework-level actions (router form actions, server actions) are
14
- * specializations of this primitive: they are actions in exactly this sense —
15
- * the same transactional semantics — with form binding, serialization, and
16
- * submission tracking layered on top. The shared name is deliberate.
17
- *
18
- * Wraps a generator function so each invocation runs as a single transaction
19
- * (a "transition") that batches every signal/store write between yields. The
20
- * surrounding UI sees one atomic update per yielded step; nothing is committed
21
- * until the action either completes or the next `yield` resolves.
22
- *
23
- * `yield` is the transaction-safe suspension point: the action waits for a
24
- * yielded promise and re-enters the transaction before running the code after
25
- * it. A plain `await` does NOT — the runtime has no hook into an async
26
- * generator's internal await continuations, so writes to fresh signals
27
- * between an `await` and the next `yield` escape the transaction and commit
28
- * immediately. `await` is still the ergonomic choice for typed results; just
29
- * put a bare `yield` before any writes that follow it:
30
- *
31
- * ```ts
32
- * const saved = await api.createTodo(text); // typed result
33
- * yield; // re-enter the transaction before writing
34
- * setTodos(t => { ... });
35
- * ```
36
- *
37
- * (For the same reason, don't call `flush()` inside an action body — it
38
- * drains the transaction mid-step.)
39
- *
40
- * Each call returns a `Promise` that resolves with the generator's return
41
- * value, or rejects if it throws. Pair with `createOptimistic` /
42
- * `createOptimisticStore` to apply tentative writes that auto-revert if the
43
- * action fails.
44
- *
45
- * @example
46
- * ```ts
47
- * const [todos, setTodos] = createOptimisticStore<Todo[]>([]);
48
- *
49
- * const addTodo = action(async function* (text: string) {
50
- * const tempId = crypto.randomUUID();
51
- * setTodos(t => { t.push({ id: tempId, text, pending: true }); }); // optimistic
52
- * const saved = await api.createTodo(text); // network round-trip, typed
53
- * yield; // re-enter the transaction
54
- * setTodos(t => {
55
- * const i = t.findIndex(x => x.id === tempId);
56
- * if (i >= 0) t[i] = saved;
57
- * });
58
- * return saved;
59
- * });
60
- *
61
- * await addTodo("buy milk");
62
- * ```
63
- */
64
- export declare function action<Args extends any[], Y, R>(genFn: (...args: Args) => Generator<Y, R, any> | AsyncGenerator<Y, R, any>): (...args: Args) => Promise<R>;
@@ -1,23 +0,0 @@
1
- import { NotReadyError } from "./error.cjs";
2
- import { type OptimisticLane } from "./lanes.cjs";
3
- import type { Computed, Link } from "./types.cjs";
4
- export declare function addPendingSource(el: Computed<any>, source: Computed<any>): boolean;
5
- /**
6
- * A loading-window node hit an unready source (sync throw in recompute, or a
7
- * NotReadyError-rejected flight): register for the source's settle — the
8
- * settlePendingSource walk runs off `_pendingSources` + `_blocked` alone —
9
- * with NO read-visible pending status, no downstream propagation, no
10
- * transition, no lane registration. Commit #0 keeps serving.
11
- */
12
- export declare function parkLoadingWindow(el: Computed<any>, e: NotReadyError): void;
13
- export declare function setPendingError(el: Computed<any>, source?: Computed<any>, error?: any): void;
14
- export declare function forEachDependent(el: Computed<any>, fn: (node: Computed<any>, link: Link) => void): void;
15
- export declare function releaseSettledDependents(el: Computed<any>): void;
16
- export declare function settleErroredDependents(el: Computed<any>, error: any): void;
17
- export declare function settlePendingSource(el: Computed<any>): void;
18
- export declare function isThenable<T>(value: T | PromiseLike<T>): value is PromiseLike<T>;
19
- /** Fire and clear a node's iterator-flight cancellation hook (#3122). */
20
- export declare function releaseFlightTeardown(el: Computed<any>): void;
21
- export declare function handleAsync<T>(el: Computed<T>, result: T | PromiseLike<T> | AsyncIterable<T>, setter?: (value: T) => void): T;
22
- export declare function clearStatus(el: Computed<any>, clearUninitialized?: boolean): void;
23
- export declare function notifyStatus(el: Computed<any>, status: number, error: any, blockStatus?: boolean, lane?: OptimisticLane): void;
@@ -1,127 +0,0 @@
1
- import type { Transition } from "./scheduler.cjs";
2
- import type { Computed, Signal } from "./types.cjs";
3
- /**
4
- * Dev-only observability hook points for the reactive core.
5
- *
6
- * Core's obligation is to call these with true facts at the moments they
7
- * happen; ALL attribution semantics (stamps, cause chains, timings, warnings)
8
- * live in the engine that installs them (attribution.ts — same pattern as the
9
- * GlobalQueue._* feature slots). `attrHooks` is null unless an engine is
10
- * installed, so the disabled cost is one null check per site, and prod builds
11
- * fold every site out behind __DEV__.
12
- *
13
- * IMPORTANT for implementers of call sites: a hook call must never sit inside
14
- * a `try` block — rollup's tryCatchDeoptimization retains functions referenced
15
- * inside `try` even behind a folded __DEV__ guard, which re-couples the dev
16
- * engine into prod bundles (#2883 harness). Set a local flag inside the try
17
- * and call the hook after the catch.
18
- */
19
- export interface AttributionHooks {
20
- /**
21
- * A recompute is starting; `el._deps` still holds the previous run's links.
22
- * Always paired with `recomputeEnd` (recompute has no early returns).
23
- */
24
- recomputeStart(el: Computed<any>, create: boolean): void;
25
- /**
26
- * The recompute finished. `changed` = committed a changed value (false for
27
- * errored runs); `optimistic` = ran under an optimistic lane / lane-dirty
28
- * posture; `transition` = a transition was active or owns this node;
29
- * `held` = the value went to `_pendingValue` (a transition hold) rather
30
- * than committing directly — its reveal happens later on the transition's
31
- * own schedule.
32
- */
33
- recomputeEnd(el: Computed<any>, create: boolean, changed: boolean, optimistic: boolean, transition: boolean, held: boolean): void;
34
- /** A non-effect computed committed a changed value during a re-run. */
35
- derivedChanged(el: Computed<any>): void;
36
- /** A signal write committed (value passed the equality gate). */
37
- write(el: Signal<any> | Computed<any>, prev: unknown, value: unknown): void;
38
- /** refresh() invalidated this node (self-invalidation, no dep changed). */
39
- refreshed(el: Computed<any>): void;
40
- /**
41
- * A new async flight entered the system (`_inFlight` was just assigned
42
- * during a recompute of `el`). Always fired inside the owning recompute —
43
- * both call paths (core's recompute and the projection self-registration)
44
- * run within one — so the engine can read the current frame stack to link
45
- * the flight to the change that caused it (waterfall chaining). `flight`
46
- * is the registered thenable/iterable itself: the engine keys a first-seen
47
- * origin registry on its identity, so shared and preloader-marked promises
48
- * carry their true start time instead of the moment the graph saw them.
49
- */
50
- flightStart(el: Computed<any>, flight: object): void;
51
- /** An async landing is about to apply its value (before any branch). */
52
- asyncStart(el: Computed<any>): void;
53
- /**
54
- * The async landing finished. `direct` = the landing applies the value
55
- * itself (lane/override paths); false = it went through setSignal, whose
56
- * own `write` hook already saw any committed change. Fired whether or not
57
- * the landing committed — call sites cannot carry that fact out of their
58
- * try blocks (see the try rule above), so the engine derives committed-ness
59
- * from the node's state against its asyncStart snapshot.
60
- */
61
- asyncEnd(el: Computed<any>, prev: unknown, value: unknown, direct: boolean): void;
62
- /**
63
- * An effect's imperative half (its effect callback) is about to run /
64
- * has run. Both fire outside the run's try; `effectRunEnd` fires whether
65
- * or not the callback threw. Writes between the two are the effect's.
66
- */
67
- effectRunStart(el: Computed<any>): void;
68
- effectRunEnd(el: Computed<any>): void;
69
- /**
70
- * One synchronous step of an `action()` generator is about to run / has
71
- * run (`it.next()`/`it.throw()` up to the next yield). `it` is the
72
- * invocation's iterator — stable identity across its steps; `name` the
73
- * generator function's name. Writes between the two are the action's.
74
- */
75
- actionStepStart(it: object, name: string | undefined): void;
76
- actionStepEnd(it: object): void;
77
- /**
78
- * A flush found `t` incomplete (transitionComplete's false verdict): its
79
- * writes stay staged and its queues are about to be parked. Fired BEFORE
80
- * this flush's lane effects (the visible acknowledgers — isPending
81
- * companions, optimistic values) run; `holdEnd` fires from the root
82
- * stashQueues call after them, so effect runs between the two are runs that
83
- * painted *during* the hold.
84
- */
85
- holdStart(t: Transition): void;
86
- holdEnd(): void;
87
- /**
88
- * `t` was judged complete (transitionComplete's true verdict, before `_done`
89
- * flips). Fired before its held writes commit, so `t._pendingNodes` still
90
- * lists what was staged.
91
- */
92
- transitionSettled(t: Transition): void;
93
- /** `outgoing` was folded into `target` (`outgoing._done = target`). */
94
- transitionMerged(target: Transition, outgoing: Transition): void;
95
- /**
96
- * A store setter batch replaced the container at `path` (e.g. `store.user`)
97
- * with a different one (both non-null, same array-ness, not the same
98
- * logical slot), and this is the leaf census of the new container against
99
- * the old: `total` leaves (own keys, or items) in the new one, `unchanged`
100
- * of which are the same value as before (identity, judged on unwrapped
101
- * values — object keys compared by key, array items by membership), and
102
- * `prevTotal` leaves in the old one. Containers above 64 leaves are not
103
- * announced. Fired per written key from the write channel's notify. The
104
- * engine decides whether the replacement was a spread-copy worth a
105
- * diagnostic.
106
- */
107
- storeReplaced(path: string, isArray: boolean, total: number, unchanged: number, prevTotal: number): void;
108
- /**
109
- * A `mapArray` update both disposed and created rows: `removed` are the
110
- * items whose rows were disposed, `created` the items that got new rows,
111
- * `newLen` the list's new length, `keyed` whether a key function is in use
112
- * (false = identity or by-index). Fired after commit. The engine judges
113
- * whether the churn replaced equivalent records (unstable identity).
114
- */
115
- listChurn(el: Computed<any>, removed: unknown[], created: unknown[], newLen: number, keyed: boolean): void;
116
- /**
117
- * A loading boundary started (`shown` true) or stopped showing its
118
- * fallback. `boundary` is the boundary's queue (stable identity); `tree`
119
- * its bound subtree computed when already constructed — the first show can
120
- * fire while the subtree is still being built — whose owner chain names
121
- * the boundary. Fired at the source-set transitions (first pending source
122
- * registers / last one clears), not per flush.
123
- */
124
- boundaryFallback(boundary: object, tree: Computed<any> | undefined, shown: boolean): void;
125
- }
126
- export declare let attrHooks: AttributionHooks | null;
127
- export declare function setAttributionHooks(hooks: AttributionHooks | null): void;