@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.
- package/dist/dev-shared.js +6505 -0
- package/dist/dev.attribution.js +3484 -0
- package/dist/dev.js +10227 -9508
- package/dist/observe/affects-marks.js +86 -0
- package/dist/observe/affects.js +112 -0
- package/dist/observe/attribution.js +7 -0
- package/dist/observe/boundaries.js +696 -0
- package/dist/observe/core/action.js +182 -0
- package/dist/observe/core/async.js +824 -0
- package/dist/observe/core/attribution-costs.js +66 -0
- package/dist/observe/core/attribution-feedback.js +280 -0
- package/dist/observe/core/attribution-hooks.js +83 -0
- package/dist/observe/core/attribution-queries.js +43 -0
- package/dist/observe/core/attribution.js +3079 -0
- package/dist/observe/core/constants.js +269 -0
- package/dist/observe/core/context.js +63 -0
- package/dist/observe/core/copies.js +10 -0
- package/dist/observe/core/core.js +1707 -0
- package/dist/observe/core/dev.js +394 -0
- package/dist/observe/core/effect.js +193 -0
- package/dist/observe/core/error-hooks.js +71 -0
- package/dist/observe/core/error.js +82 -0
- package/dist/observe/core/external.js +97 -0
- package/dist/observe/core/graph.js +162 -0
- package/dist/observe/core/heap.js +124 -0
- package/dist/observe/core/identities.js +62 -0
- package/dist/observe/core/invariants.js +12 -0
- package/dist/observe/core/lanes.js +972 -0
- package/dist/observe/core/owner.js +371 -0
- package/dist/observe/core/scheduler.js +1157 -0
- package/dist/observe/core/truth.js +47 -0
- package/dist/observe/core/verdict.js +470 -0
- package/dist/observe/deferred.js +186 -0
- package/dist/observe/flatten.js +79 -0
- package/dist/observe/from.js +248 -0
- package/dist/observe/index.js +71 -0
- package/dist/observe/map.js +593 -0
- package/dist/observe/reveal.js +212 -0
- package/dist/observe/signals.js +717 -0
- package/dist/observe/store/affects.js +142 -0
- package/dist/observe/store/edges.js +39 -0
- package/dist/observe/store/hooks.js +16 -0
- package/dist/observe/store/index.js +47 -0
- package/dist/observe/store/optimistic.js +713 -0
- package/dist/observe/store/projection.js +345 -0
- package/dist/observe/store/reconcile.js +281 -0
- package/dist/observe/store/store.js +2127 -0
- package/dist/observe/store/storePath.js +103 -0
- package/dist/observe/store/target.js +46 -0
- package/dist/observe/store/types.js +83 -0
- package/dist/observe/store/utils.js +1063 -0
- package/dist/prod/affects-marks.js +86 -0
- package/dist/prod/affects.js +98 -112
- package/dist/prod/attribution.js +45 -0
- package/dist/prod/boundaries.js +578 -468
- package/dist/prod/core/action.js +92 -59
- package/dist/prod/core/async.js +522 -336
- package/dist/prod/core/attribution-hooks.js +3 -0
- package/dist/prod/core/constants.js +168 -44
- package/dist/prod/core/context.js +12 -16
- package/dist/prod/core/copies.js +10 -0
- package/dist/prod/core/core.js +1345 -627
- package/dist/prod/core/dev.js +123 -1
- package/dist/prod/core/effect.js +113 -80
- package/dist/prod/core/error-hooks.js +71 -0
- package/dist/prod/core/error.js +18 -4
- package/dist/prod/core/external.js +6 -7
- package/dist/prod/core/graph.js +119 -72
- package/dist/prod/core/heap.js +85 -109
- package/dist/prod/core/identities.js +62 -0
- package/dist/prod/core/invariants.js +1 -32
- package/dist/prod/core/lanes.js +931 -132
- package/dist/prod/core/owner.js +192 -129
- package/dist/prod/core/scheduler.js +948 -642
- package/dist/prod/core/truth.js +47 -0
- package/dist/prod/core/verdict.js +409 -420
- package/dist/prod/deferred.js +184 -0
- package/dist/prod/flatten.js +77 -0
- package/dist/prod/from.js +248 -0
- package/dist/prod/index.js +40 -16
- package/dist/prod/map.js +481 -211
- package/dist/prod/reveal.js +212 -0
- package/dist/prod/signals.js +401 -84
- package/dist/prod/store/affects.js +142 -0
- package/dist/prod/store/edges.js +39 -0
- package/dist/prod/store/hooks.js +16 -0
- package/dist/prod/store/index.js +27 -18
- package/dist/prod/store/optimistic.js +707 -0
- package/dist/prod/store/projection.js +331 -0
- package/dist/prod/store/reconcile.js +281 -0
- package/dist/prod/store/store.js +1952 -267
- package/dist/prod/store/storePath.js +1 -1
- package/dist/prod/store/target.js +43 -0
- package/dist/prod/store/types.js +83 -0
- package/dist/prod/store/utils.js +997 -138
- package/dist/types/affects-marks.d.ts +14 -0
- package/dist/types/affects.d.ts +12 -30
- package/dist/types/attribution.d.ts +19 -0
- package/dist/types/attribution.prod.d.ts +22 -0
- package/dist/types/boundaries.d.ts +99 -124
- package/dist/types/carved.d.ts +1 -0
- package/dist/types/core/action.d.ts +23 -9
- package/dist/types/core/async.d.ts +34 -6
- package/dist/types/core/attribution-costs.d.ts +35 -0
- package/dist/types/core/attribution-feedback.d.ts +133 -0
- package/dist/types/core/attribution-hooks.d.ts +307 -8
- package/dist/types/core/attribution-queries.d.ts +24 -0
- package/dist/types/core/attribution.d.ts +802 -72
- package/dist/types/core/constants.d.ts +195 -38
- package/dist/types/core/copies.d.ts +54 -0
- package/dist/types/core/core.d.ts +295 -65
- package/dist/types/core/dev.d.ts +509 -22
- package/dist/types/core/effect.d.ts +1 -1
- package/dist/types/core/error-hooks.d.ts +71 -0
- package/dist/types/core/error.d.ts +18 -1
- package/dist/types/core/graph.d.ts +40 -1
- package/dist/types/core/heap.d.ts +5 -5
- package/dist/types/core/identities.d.ts +17 -0
- package/dist/types/core/index.d.ts +11 -7
- package/dist/types/core/invariants.d.ts +1 -26
- package/dist/types/core/lanes.d.ts +74 -43
- package/dist/types/core/owner.d.ts +27 -9
- package/dist/types/core/scheduler.d.ts +353 -102
- package/dist/types/core/truth.d.ts +18 -0
- package/dist/types/core/types.d.ts +97 -71
- package/dist/types/core/verdict.d.ts +35 -0
- package/dist/types/deferred.d.ts +28 -0
- package/dist/types/flatten.d.ts +8 -0
- package/dist/types/from.d.ts +47 -0
- package/dist/types/index.d.ts +33 -7
- package/dist/types/map.d.ts +4 -2
- package/dist/types/reveal.d.ts +19 -0
- package/dist/types/signals.d.ts +196 -45
- package/dist/types/store/affects.d.ts +12 -0
- package/dist/types/store/edges.d.ts +9 -0
- package/dist/types/store/hooks.d.ts +62 -0
- package/dist/types/store/index.d.ts +42 -15
- package/dist/types/store/optimistic.d.ts +24 -45
- package/dist/types/store/projection.d.ts +17 -68
- package/dist/types/store/reconcile.d.ts +3 -46
- package/dist/types/store/store.d.ts +133 -136
- package/dist/types/store/storePath.d.ts +1 -1
- package/dist/types/store/target.d.ts +166 -0
- package/dist/types/store/types.d.ts +105 -0
- package/dist/types/store/utils.d.ts +188 -0
- package/package.json +31 -26
- package/dist/node.cjs +0 -8745
- package/dist/prod/core/optimistic.js +0 -265
- package/dist/prod/store/next/optimistic.js +0 -385
- package/dist/prod/store/next/projection.js +0 -172
- package/dist/prod/store/next/reconcile.js +0 -331
- package/dist/prod/store/next/store.js +0 -1499
- package/dist/prod/store/next/target.js +0 -20
- package/dist/types/core/optimistic.d.ts +0 -6
- package/dist/types/store/next/optimistic.d.ts +0 -20
- package/dist/types/store/next/projection.d.ts +0 -8
- package/dist/types/store/next/reconcile.d.ts +0 -3
- package/dist/types/store/next/store.d.ts +0 -77
- package/dist/types/store/next/target.d.ts +0 -117
- package/dist/types-cjs/affects.d.cts +0 -47
- package/dist/types-cjs/boundaries.d.cts +0 -175
- package/dist/types-cjs/core/action.d.cts +0 -64
- package/dist/types-cjs/core/async.d.cts +0 -21
- package/dist/types-cjs/core/attribution-hooks.d.cts +0 -52
- package/dist/types-cjs/core/attribution.d.cts +0 -186
- package/dist/types-cjs/core/constants.d.cts +0 -97
- package/dist/types-cjs/core/context.d.cts +0 -36
- package/dist/types-cjs/core/core.d.cts +0 -163
- package/dist/types-cjs/core/dev.d.cts +0 -81
- package/dist/types-cjs/core/effect.d.cts +0 -30
- package/dist/types-cjs/core/error.d.cts +0 -47
- package/dist/types-cjs/core/external.d.cts +0 -15
- package/dist/types-cjs/core/graph.d.cts +0 -6
- package/dist/types-cjs/core/heap.d.cts +0 -22
- package/dist/types-cjs/core/index.d.cts +0 -13
- package/dist/types-cjs/core/invariants.d.cts +0 -59
- package/dist/types-cjs/core/lanes.d.cts +0 -44
- package/dist/types-cjs/core/optimistic.d.cts +0 -6
- package/dist/types-cjs/core/owner.d.cts +0 -124
- package/dist/types-cjs/core/scheduler.d.cts +0 -180
- package/dist/types-cjs/core/types.d.cts +0 -192
- package/dist/types-cjs/core/verdict.d.cts +0 -2
- package/dist/types-cjs/index.d.cts +0 -10
- package/dist/types-cjs/map.d.cts +0 -69
- package/dist/types-cjs/package.json +0 -3
- package/dist/types-cjs/signals.d.cts +0 -624
- package/dist/types-cjs/store/index.d.cts +0 -19
- package/dist/types-cjs/store/next/optimistic.d.cts +0 -20
- package/dist/types-cjs/store/next/projection.d.cts +0 -8
- package/dist/types-cjs/store/next/reconcile.d.cts +0 -3
- package/dist/types-cjs/store/next/store.d.cts +0 -77
- package/dist/types-cjs/store/next/target.d.cts +0 -117
- package/dist/types-cjs/store/optimistic.d.cts +0 -45
- package/dist/types-cjs/store/projection.d.cts +0 -70
- package/dist/types-cjs/store/reconcile.d.cts +0 -46
- package/dist/types-cjs/store/store.d.cts +0 -138
- package/dist/types-cjs/store/storePath.d.cts +0 -58
- package/dist/types-cjs/store/utils.d.cts +0 -74
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ownership (first cut, decision 2026-08-16d): one WeakSet of store-owned
|
|
3
|
-
* backings serving both the production identity-skip guard and the false
|
|
4
|
-
* no-mutation oracle.
|
|
5
|
-
*/
|
|
6
|
-
const ownedRaw = new WeakSet;
|
|
7
|
-
|
|
8
|
-
/** raw → target. The only raw-keyed lookup; boundary mechanism (O8). */ const storeNextLookup = new WeakMap;
|
|
9
|
-
|
|
10
|
-
function devAssertNeverUserMutation(o) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
let optHooks = null;
|
|
15
|
-
|
|
16
|
-
function setOptHooks(o) {
|
|
17
|
-
optHooks = o;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { devAssertNeverUserMutation, optHooks, ownedRaw, setOptHooks, storeNextLookup };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Installs the engine's hooks. Idempotent; called by every module that can
|
|
3
|
-
* create optimistic state (verdict.ts at module top level, createOptimistic
|
|
4
|
-
* and createOptimisticStore at first call) BEFORE any optimistic node exists.
|
|
5
|
-
*/
|
|
6
|
-
export declare function installOptimisticEngine(): void;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type NoFn, type ProjectionOptions, type Store, type StoreSetter } from "../store.js";
|
|
2
|
-
import type { StoreNextFamily, StoreNextTarget } from "./target.js";
|
|
3
|
-
export declare function createOptimisticStoreNext<T extends object = {}>(first: T | ((store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>), second?: NoFn<T> | Store<NoFn<T>>, options?: ProjectionOptions): [get: Store<T>, set: StoreSetter<T>];
|
|
4
|
-
/** Diff the draft against the current OPTIMISTIC VIEW (committed + active
|
|
5
|
-
* overrides — the same view the draft was seeded from) and emit engine writes
|
|
6
|
-
* for exactly the changed keys. Visible-view diffing keeps no-op writes from
|
|
7
|
-
* entangling lanes (RUL-10 / opt R38). */
|
|
8
|
-
export declare function notifyOptimisticWrites(t: StoreNextTarget, pb: Record<PropertyKey, any>): void;
|
|
9
|
-
/**
|
|
10
|
-
* Landing consumption (RUL-2): fresh authoritative data supersedes every
|
|
11
|
-
* tentative override in the family. Mirrors legacy clearProjectionOverride —
|
|
12
|
-
* drop the override, clear lane/ownership, notify subscribers whose visible
|
|
13
|
-
* value changes (reversion effects go to regular queues via the projection
|
|
14
|
-
* write posture the caller holds).
|
|
15
|
-
*/
|
|
16
|
-
export declare function consumeOverridesNext(fam: StoreNextFamily): void;
|
|
17
|
-
/** Optimistic-view composition for snapshot/deep (O1: snapshot is the CURRENT
|
|
18
|
-
* view, lane values included; a fresh copy per call during pending windows —
|
|
19
|
-
* RUL-12). Returns `src` untouched when no override is active on `t`. */
|
|
20
|
-
export declare function optimisticView(t: StoreNextTarget, src: Record<PropertyKey, any>): Record<PropertyKey, any>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type Computed, type Refreshable } from "../../core/index.js";
|
|
2
|
-
import { type NoFn, type ProjectionOptions, type Store } from "../store.js";
|
|
3
|
-
export declare function createProjectionNext<T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, seed: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions): Refreshable<Store<T>>;
|
|
4
|
-
/** Derived writable store (legacy parity): a projection whose public setter
|
|
5
|
-
* masks the recompute for the tick (core R31 — the manual write wins over a
|
|
6
|
-
* same-flush dependency change). */
|
|
7
|
-
export declare function createStoreDerivedNext<T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, seed: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions): [Refreshable<Store<T>>, (f: (draft: T) => T | void) => void];
|
|
8
|
-
export declare function runProjectionComputedNext<T extends object>(wrappedStore: Store<T>, fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, key: string | ((item: NonNullable<any>) => any) | null, wrapCommit?: (write: () => void) => void, onDraftWrite?: () => void): Computed<void | T>;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { Signal } from "../../core/types.js";
|
|
2
|
-
import { type StoreNextFamily, type StoreNextTarget } from "./target.js";
|
|
3
|
-
export declare function wrapNext<T extends Record<PropertyKey, any>>(value: T, parent?: StoreNextTarget | null, parentKey?: PropertyKey | null, fam?: StoreNextFamily | null): T;
|
|
4
|
-
/** Unwrap our own proxies to their current backing; leave everything else. */
|
|
5
|
-
export declare function unwrapValue(v: any): any;
|
|
6
|
-
export declare function getNode(target: StoreNextTarget, key: PropertyKey, current: any): Signal<any>;
|
|
7
|
-
export declare function getHasNode(target: StoreNextTarget, key: PropertyKey, present: boolean): Signal<boolean>;
|
|
8
|
-
export declare function getKeySetNode(target: StoreNextTarget): Signal<number>;
|
|
9
|
-
/** Deep-witness bump: any value/shape change on a record with a live deep()
|
|
10
|
-
* subscriber notifies it. One null check when unused. */
|
|
11
|
-
export declare function bumpDeep(t: StoreNextTarget): void;
|
|
12
|
-
/** Downgrade a prototype-overlay pending backing to the clone path: builds
|
|
13
|
-
* the real container (committed + overlay writes − deletes) that fold will
|
|
14
|
-
* SWAP in as the committed backing, exactly as if the draft had started on
|
|
15
|
-
* the clone path. Consumers that need a complete container (reconcile's
|
|
16
|
-
* diff walks, drafts escaping into other storage) call this. */
|
|
17
|
-
export declare function materializePB(target: StoreNextTarget): void;
|
|
18
|
-
/**
|
|
19
|
-
* Adoption (2026-08-16c): the incoming object becomes the committed backing
|
|
20
|
-
* IMMEDIATELY — reconcile is eagerly visible to every reader (shipped
|
|
21
|
-
* contract; only its notifications batch), unlike setter writes which stay
|
|
22
|
-
* pending until flush. Ownership resets (incoming is unowned/user data). Any
|
|
23
|
-
* staged draft clone folds into the diff and is discarded — next is the
|
|
24
|
-
* authoritative base (R21/R32).
|
|
25
|
-
*/
|
|
26
|
-
export declare function adoptPB(target: StoreNextTarget, incoming: Record<PropertyKey, any>, eager?: boolean): void;
|
|
27
|
-
/** Same logical slot: both values resolve to one (re-pointed) child target —
|
|
28
|
-
* adoption preserved identity, so the slot did not change (R9). */
|
|
29
|
-
export declare function targetsEqual(ov: any, nv: any): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* The fold diff walks SUBSCRIPTION KEYS ONLY (legacy parity: `for key in
|
|
32
|
-
* nodes`): nodes exist exactly where something tracked, so unobserved data
|
|
33
|
-
* costs nothing here regardless of object size. Accessor safety rides the
|
|
34
|
-
* sticky `t.a` flag — a node's key was necessarily read, so the get trap has
|
|
35
|
-
* already seen whether it is an accessor.
|
|
36
|
-
*/
|
|
37
|
-
/** One node's fold notification (shared by notifyFold's walk and the fused
|
|
38
|
-
* adoption walk): accessor-aware compare + equality/identity-gated setSignal. */
|
|
39
|
-
export declare function notifyKeyDiff(node: Signal<any>, key: PropertyKey, old: Record<PropertyKey, any>, neu: Record<PropertyKey, any>, probe?: boolean): void;
|
|
40
|
-
/** Accessor-flag probe for the fused walk's early-continue (accessor keys
|
|
41
|
-
* can never identity-skip: their VALUE is the descriptor's product). */
|
|
42
|
-
export declare function hasAccessorFlag(node: Signal<any>): boolean;
|
|
43
|
-
/** Fused-walk per-key notification with values already in hand: the caller
|
|
44
|
-
* fetched both sides and handled the identity skip; this applies the
|
|
45
|
-
* accessor branch (cached flag only — reconcile channel) or the plain
|
|
46
|
-
* equality/identity-gated write. */
|
|
47
|
-
export declare function notifyKeyValue(node: Signal<any>, key: PropertyKey, ov: any, nv: any, old: Record<PropertyKey, any>, neu: Record<PropertyKey, any>): void;
|
|
48
|
-
/** Presence + membership halves of a fold notification (shared tail). */
|
|
49
|
-
export declare function notifyFoldTail(t: StoreNextTarget, old: Record<PropertyKey, any>, neu: Record<PropertyKey, any>): void;
|
|
50
|
-
export declare function notifyFold(t: StoreNextTarget, old: Record<PropertyKey, any>, neu: Record<PropertyKey, any>): void;
|
|
51
|
-
/** Authoritative-write wrapper exported for the optimistic module: sets the
|
|
52
|
-
* scheduler's projectionWriteActive through THIS module's binding (proven to
|
|
53
|
-
* share the instance core reads — cross-module live-binding writes from other
|
|
54
|
-
* store modules were observed not to propagate under the test transform). */
|
|
55
|
-
export declare function runAuthoritative<T>(fn: () => T): T;
|
|
56
|
-
/** Active optimistic override on an armed node (armed slot idles at
|
|
57
|
-
* NOT_PENDING; undefined = unarmed plain node). */
|
|
58
|
-
export declare function hasActiveOverride(node: Signal<any>): boolean;
|
|
59
|
-
export type SetStoreNextFunction<T> = (fn: (draft: T) => T | void) => void;
|
|
60
|
-
/** Low-level setter primitive: opens write mode on a next proxy, runs `fn`,
|
|
61
|
-
* emits write-time notifications at outermost exit, applies returned
|
|
62
|
-
* replacements as adoptions. `guard=false` skips the owned-scope dev guard —
|
|
63
|
-
* projection recomputes legitimately write from inside their computed. */
|
|
64
|
-
export declare function storeSetterNext<T>(proxy: T, fn: (draft: T) => T | void, guard?: boolean): void;
|
|
65
|
-
export declare function createStoreNext<T extends Record<PropertyKey, any>>(init: T, shallow?: boolean): [T, SetStoreNextFunction<T>];
|
|
66
|
-
/** Tracking deep snapshot (`deep()` for next targets): subscribes to the
|
|
67
|
-
* key-set and every property node at every reachable level, then returns the
|
|
68
|
-
* plain view. Shared references and cycles handled via the visited set. */
|
|
69
|
-
export declare function deepNext<T>(value: T): T;
|
|
70
|
-
/**
|
|
71
|
-
* Snapshot with per-object registration resolution (RUL-12 DAG ruling): every
|
|
72
|
-
* reachable wrappable resolves through its target's CURRENT backing, so
|
|
73
|
-
* privatized subtrees are seen through any parent path. Identity-preserving:
|
|
74
|
-
* a subtree with no substitutions below returns its own object (zero copy for
|
|
75
|
-
* settled, never-diverged graphs).
|
|
76
|
-
*/
|
|
77
|
-
export declare function snapshotNext<T>(value: T): T;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Store rewrite — target & ownership (INTERNALS-STORE-STATE.md §1, §5b).
|
|
3
|
-
*
|
|
4
|
-
* The proxy wraps this internal target, never the raw (proxy-target
|
|
5
|
-
* indirection, decision 2026-08-16d). `b` is the single committed home; `pb`
|
|
6
|
-
* is the per-target pending backing (RUL-1's pending home): the CoW clone
|
|
7
|
-
* created at first draft write, mutated natively by the draft, folded into
|
|
8
|
-
* `b` at flush commit. Adoption (setter replacement / reconcile) parks an
|
|
9
|
-
* UNOWNED incoming object in `pb` — fold swaps it in and ownership resets.
|
|
10
|
-
*
|
|
11
|
-
* Creation budget (§5b): one minimal target + one proxy + one storeLookup
|
|
12
|
-
* entry per read-through object; zero layer slots; nodes, has-nodes, and the
|
|
13
|
-
* key-set node are lazy, materialized only by subscription.
|
|
14
|
-
*/
|
|
15
|
-
import type { Computed, Signal } from "../../core/types.js";
|
|
16
|
-
/** Projection family (§7b): children wrap into the family's own map (writes
|
|
17
|
-
* land in the projection, never the source family), and every node created
|
|
18
|
-
* under the family carries the projection computed as its firewall. */
|
|
19
|
-
export interface StoreNextFamily {
|
|
20
|
-
/** Optimistic family: nodes are born armed (`_overrideValue` slot) so every
|
|
21
|
-
* write rides the core optimistic engine — lanes, per-transaction ownership,
|
|
22
|
-
* reverts all core-native (§3, RUL-3). */
|
|
23
|
-
opt?: boolean;
|
|
24
|
-
/** Root proxy (registered with the scheduler's optimistic-store set for the
|
|
25
|
-
* transitionBlocked store-half, #2951). */
|
|
26
|
-
px?: any;
|
|
27
|
-
/** Targets currently carrying active node overrides (landing-consumption
|
|
28
|
-
* walk, RUL-2: visible landed truth replaces optimism). */
|
|
29
|
-
overlaid?: Set<any>;
|
|
30
|
-
map: WeakMap<object, StoreNextTarget>;
|
|
31
|
-
/** The projection computed — assigned after creation (accessor pattern). */
|
|
32
|
-
node: Computed<any> | null;
|
|
33
|
-
shallow?: boolean;
|
|
34
|
-
}
|
|
35
|
-
export interface StoreNextTarget {
|
|
36
|
-
/** Committed backing: source object (shared) or owned clone. */
|
|
37
|
-
v: Record<PropertyKey, any>;
|
|
38
|
-
/** Pending backing for the current flush (null when settled). */
|
|
39
|
-
pb: Record<PropertyKey, any> | null;
|
|
40
|
-
/** cached: committed backing is another store's proxy (§7b chained). */
|
|
41
|
-
ch: boolean;
|
|
42
|
-
/** live value-node count (deleted-key sweep fast-out in the fused walk). */
|
|
43
|
-
nc: number;
|
|
44
|
-
/** Lazy per-property subscription nodes (real core signals). */
|
|
45
|
-
n: Record<PropertyKey, Signal<any>> | null;
|
|
46
|
-
/** Lazy per-key presence nodes (`in` tracks presence, not value — R13). */
|
|
47
|
-
h: Record<PropertyKey, Signal<boolean>> | null;
|
|
48
|
-
/** Lazy key-set node: membership/iteration/$TRACK subscriptions (§6). */
|
|
49
|
-
k: Signal<number> | null;
|
|
50
|
-
/** Lazy deep-witness node: `deep()` subscribes ONE node per record instead
|
|
51
|
-
* of one per path; write paths bump it only when it exists. Separate from
|
|
52
|
-
* `k` so $TRACK/mapArray never rerun on leaf value changes (R9). */
|
|
53
|
-
dk: Signal<number> | null;
|
|
54
|
-
/** Parent target (path copying walks this at commit). */
|
|
55
|
-
u: StoreNextTarget | null;
|
|
56
|
-
/** Property key of this target in the parent's backing. */
|
|
57
|
-
pk: PropertyKey | null;
|
|
58
|
-
/** The proxy for this target (stable outward identity). */
|
|
59
|
-
px: any;
|
|
60
|
-
/** Sticky descendants flag (§6d). */
|
|
61
|
-
d: boolean;
|
|
62
|
-
/** Sticky accessors-seen flag: an own accessor property was observed on
|
|
63
|
-
* this target (first-read scan, defineProperty, or clone scan). Gates the
|
|
64
|
-
* fold diff's descriptor-safe path and the get trap's descriptor path. */
|
|
65
|
-
a: boolean;
|
|
66
|
-
/** Accessor scan performed (scan-once on first trap read; adopted data is
|
|
67
|
-
* not rescanned — legacy-parity behavior). */
|
|
68
|
-
sc: boolean;
|
|
69
|
-
/** Backing was swapped by adoption this batch (fold diff-notifies it). */
|
|
70
|
-
adopted: boolean;
|
|
71
|
-
/** Pending backing is a prototype-chain OVERLAY of the committed backing
|
|
72
|
-
* (`Object.create(v)` — own keys are this batch's writes, everything else
|
|
73
|
-
* reads through). O(written) per flush instead of O(container) clones
|
|
74
|
-
* (#3044); commit flattens own keys onto an owned committed backing in
|
|
75
|
-
* place. Only plain-data non-array non-family containers qualify;
|
|
76
|
-
* `materializePB` downgrades to the clone path when a consumer needs a
|
|
77
|
-
* real container (reconcile, draft escape). */
|
|
78
|
-
ovl: boolean;
|
|
79
|
-
/** Keys deleted in the overlay window (a prototype overlay cannot shadow
|
|
80
|
-
* a delete); null when none. */
|
|
81
|
-
del: Set<PropertyKey> | null;
|
|
82
|
-
/** Keys written through the traps since the last fold commit. Bounds the
|
|
83
|
-
* setter notify/hold-check to O(written) instead of O(subscribed nodes) —
|
|
84
|
-
* a record with thousands of per-key subscriptions (selection maps) would
|
|
85
|
-
* otherwise pay a full node scan on every write. null = no trap writes
|
|
86
|
-
* this batch (bulk paths fall back to the full scan); WK_ALL sentinel =
|
|
87
|
-
* bound unusable this batch (array length write implies index deletes). */
|
|
88
|
-
wk: Set<PropertyKey> | null;
|
|
89
|
-
/** Projection family, null for plain stores (§7b). */
|
|
90
|
-
fam: StoreNextFamily | null;
|
|
91
|
-
/** Shallow store root (values served raw). */
|
|
92
|
-
s: boolean;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Ownership (first cut, decision 2026-08-16d): one WeakSet of store-owned
|
|
96
|
-
* backings serving both the production identity-skip guard and the __TEST__
|
|
97
|
-
* no-mutation oracle.
|
|
98
|
-
*/
|
|
99
|
-
export declare const ownedRaw: WeakSet<object>;
|
|
100
|
-
/** raw → target. The only raw-keyed lookup; boundary mechanism (O8). */
|
|
101
|
-
export declare const storeNextLookup: WeakMap<object, StoreNextTarget>;
|
|
102
|
-
/** __TEST__ oracle: every object ingested from a user (never mutate). */
|
|
103
|
-
export declare const ingestedRaw: WeakSet<object> | null;
|
|
104
|
-
export declare function devAssertNeverUserMutation(target: object): void;
|
|
105
|
-
/** Injection table for optimistic-only store machinery (next/optimistic.ts).
|
|
106
|
-
* Every call site is gated on `fam?.opt`, and optimistic families can only
|
|
107
|
-
* be created by createOptimisticStore — whose install populates this — so
|
|
108
|
-
* the non-null assertions at the sites hold by construction. Keeping the
|
|
109
|
-
* implementations out of next/store.ts lets plain-store bundles tree-shake
|
|
110
|
-
* the optimistic channel entirely. */
|
|
111
|
-
export interface OptStoreHooks {
|
|
112
|
-
notifyOptimisticWrites(t: any, pb: Record<PropertyKey, any>): void;
|
|
113
|
-
optimisticView(t: any, src: Record<PropertyKey, any>): Record<PropertyKey, any>;
|
|
114
|
-
applyTentative(t: any, incoming: any, keyFn: ((item: any) => any) | null): void;
|
|
115
|
-
}
|
|
116
|
-
export declare let optHooks: OptStoreHooks | null;
|
|
117
|
-
export declare function setOptHooks(h: OptStoreHooks): void;
|
|
@@ -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,21 +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
|
-
export declare function handleAsync<T>(el: Computed<T>, result: T | PromiseLike<T> | AsyncIterable<T>, setter?: (value: T) => void): T;
|
|
20
|
-
export declare function clearStatus(el: Computed<any>, clearUninitialized?: boolean): void;
|
|
21
|
-
export declare function notifyStatus(el: Computed<any>, status: number, error: any, blockStatus?: boolean, lane?: OptimisticLane): void;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Computed, Signal } from "./types.cjs";
|
|
2
|
-
/**
|
|
3
|
-
* Dev-only observability hook points for the reactive core.
|
|
4
|
-
*
|
|
5
|
-
* Core's obligation is to call these with true facts at the moments they
|
|
6
|
-
* happen; ALL attribution semantics (stamps, cause chains, timings, warnings)
|
|
7
|
-
* live in the engine that installs them (attribution.ts — same pattern as the
|
|
8
|
-
* GlobalQueue._* feature slots). `attrHooks` is null unless an engine is
|
|
9
|
-
* installed, so the disabled cost is one null check per site, and prod builds
|
|
10
|
-
* fold every site out behind __DEV__.
|
|
11
|
-
*
|
|
12
|
-
* IMPORTANT for implementers of call sites: a hook call must never sit inside
|
|
13
|
-
* a `try` block — rollup's tryCatchDeoptimization retains functions referenced
|
|
14
|
-
* inside `try` even behind a folded __DEV__ guard, which re-couples the dev
|
|
15
|
-
* engine into prod bundles (#2883 harness). Set a local flag inside the try
|
|
16
|
-
* and call the hook after the catch.
|
|
17
|
-
*/
|
|
18
|
-
export interface AttributionHooks {
|
|
19
|
-
/**
|
|
20
|
-
* A recompute is starting; `el._deps` still holds the previous run's links.
|
|
21
|
-
* Always paired with `recomputeEnd` (recompute has no early returns).
|
|
22
|
-
*/
|
|
23
|
-
recomputeStart(el: Computed<any>, create: boolean): void;
|
|
24
|
-
/**
|
|
25
|
-
* The recompute finished. `changed` = committed a changed value (false for
|
|
26
|
-
* errored runs); `optimistic` = ran under an optimistic lane / lane-dirty
|
|
27
|
-
* posture; `transition` = a transition was active or owns this node;
|
|
28
|
-
* `held` = the value went to `_pendingValue` (a transition hold) rather
|
|
29
|
-
* than committing directly — its reveal happens later on the transition's
|
|
30
|
-
* own schedule.
|
|
31
|
-
*/
|
|
32
|
-
recomputeEnd(el: Computed<any>, create: boolean, changed: boolean, optimistic: boolean, transition: boolean, held: boolean): void;
|
|
33
|
-
/** A non-effect computed committed a changed value during a re-run. */
|
|
34
|
-
derivedChanged(el: Computed<any>): void;
|
|
35
|
-
/** A signal write committed (value passed the equality gate). */
|
|
36
|
-
write(el: Signal<any> | Computed<any>, prev: unknown, value: unknown): void;
|
|
37
|
-
/** refresh() invalidated this node (self-invalidation, no dep changed). */
|
|
38
|
-
refreshed(el: Computed<any>): void;
|
|
39
|
-
/** An async landing is about to apply its value (before any branch). */
|
|
40
|
-
asyncStart(el: Computed<any>): void;
|
|
41
|
-
/**
|
|
42
|
-
* The async landing finished. `direct` = the landing applies the value
|
|
43
|
-
* itself (lane/override paths); false = it went through setSignal, whose
|
|
44
|
-
* own `write` hook already saw any committed change. Fired whether or not
|
|
45
|
-
* the landing committed — call sites cannot carry that fact out of their
|
|
46
|
-
* try blocks (see the try rule above), so the engine derives committed-ness
|
|
47
|
-
* from the node's state against its asyncStart snapshot.
|
|
48
|
-
*/
|
|
49
|
-
asyncEnd(el: Computed<any>, prev: unknown, value: unknown, direct: boolean): void;
|
|
50
|
-
}
|
|
51
|
-
export declare let attrHooks: AttributionHooks | null;
|
|
52
|
-
export declare function setAttributionHooks(hooks: AttributionHooks | null): void;
|