@solidjs/signals 2.0.0-beta.16 → 2.0.0-beta.18

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.
@@ -34,6 +34,7 @@ export interface Transition {
34
34
  _asyncReporters: Map<Computed<any>, Set<Computed<any>>>;
35
35
  _pendingNodes: Signal<any>[];
36
36
  _optimisticNodes: OptimisticNode[];
37
+ _affectsNodes: OptimisticNode[];
37
38
  _optimisticStores: Set<any>;
38
39
  _actions: Array<Generator<any, any, any> | AsyncGenerator<any, any, any>>;
39
40
  _queueStash: QueueStub;
@@ -78,19 +79,61 @@ export declare class GlobalQueue extends Queue {
78
79
  _pendingNode: Signal<any> | null;
79
80
  _pendingNodes: Signal<any>[];
80
81
  _optimisticNodes: OptimisticNode[];
82
+ _affectsNodes: OptimisticNode[];
81
83
  _optimisticStores: Set<any>;
82
84
  static _update: (el: Computed<unknown>) => void;
83
85
  static _dispose: (el: Computed<unknown>, self: boolean, zombie: boolean) => void;
84
86
  static _runEffect: (el: Computed<unknown>) => void;
85
87
  static _clearOptimisticStore: ((store: any) => void) | null;
88
+ static _releaseAffectsScope: ((node: OptimisticNode) => void) | null;
89
+ static _propagateAffects: ((node: OptimisticNode) => void) | null;
90
+ static _settleAffects: ((node: OptimisticNode) => void) | null;
86
91
  flush(): void;
87
92
  notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
88
93
  initTransition(transition?: Transition | null): void;
89
94
  }
90
95
  export declare function queuePendingNode(node: Signal<any>): void;
96
+ export declare function armReaskClear(): void;
91
97
  export declare function insertSubs(node: Signal<any> | Computed<any>, optimistic?: boolean): void;
92
98
  export declare function finalizePureQueue(completingTransition?: Transition | null, incomplete?: boolean): void;
93
99
  export declare function trackOptimisticStore(store: any): void;
100
+ /**
101
+ * Count of live `affects()` registrations across the system (including
102
+ * store-scope inherited marks). Gates the read-path mark check in `read()` so
103
+ * graphs that never use the feature pay one integer compare.
104
+ */
105
+ export declare let activeAffectsMarks: number;
106
+ /**
107
+ * The counting half of a mark, shared by direct registration and store-scope
108
+ * inheritance (a node created inside a live keyless mark's identity scope):
109
+ * bumps the refcount and pokes the node's verdict companions so an
110
+ * already-materialized `false` flips reactively.
111
+ *
112
+ * @internal
113
+ */
114
+ export declare function markAffects(node: OptimisticNode): void;
115
+ /**
116
+ * Registers one `affects()` mark on a node: counts it, records the
117
+ * registration with the current transaction (after initTransition the queue's
118
+ * array aliases the active transition's, mirroring `_optimisticNodes`), and
119
+ * propagates STATUS_PENDING downstream on the status rails so everything
120
+ * DERIVED from the marked data reads pending too. Propagation runs on every
121
+ * registration (not just the first): subscribers gained since an earlier
122
+ * overlapping registration get covered, and dedup stops re-descent early.
123
+ *
124
+ * @internal
125
+ */
126
+ export declare function registerAffectsMark(node: OptimisticNode): void;
127
+ /**
128
+ * Releases one registration. When the node's last mark drops, settles the
129
+ * mark's sentinel out of every downstream `_pendingSources` (waking blocked
130
+ * nodes and re-deriving verdicts along the walk). Companion writes go through
131
+ * the settlement snap (committed, not transition-scoped) so releasing a mark
132
+ * can't open a fresh override window that would itself need settlement.
133
+ *
134
+ * @internal
135
+ */
136
+ export declare function releaseAffectsMark(node: OptimisticNode): void;
94
137
  export declare const globalQueue: GlobalQueue;
95
138
  /**
96
139
  * Synchronously processes the pending reactive queue, or runs `fn` in a synchronous
@@ -48,6 +48,21 @@ export interface RawSignal<T> {
48
48
  _pendingSignal?: Signal<boolean>;
49
49
  _latestValueComputed?: Computed<T>;
50
50
  _parentSource?: Signal<any> | Computed<any>;
51
+ /**
52
+ * Live `affects()` marks on this node (refcount). Non-zero is declared
53
+ * motion: the node reads pending regardless of graph state, until every
54
+ * declaring transaction settles/reverts and releases its mark.
55
+ */
56
+ _affectsCount?: number;
57
+ /**
58
+ * The mark's identity on the pending-source rails (lazy, see
59
+ * `getAffectsSentinel`). Downstream subscribers hold it in
60
+ * `_pendingSources` exactly like a real in-flight source, but with its own
61
+ * identity so a landing or quiet re-ask on the node itself can't clear it.
62
+ */
63
+ _affectsSentinel?: Computed<any>;
64
+ /** Set only on sentinels: the marked node this sentinel stands for. */
65
+ _affectsFor?: Signal<any> | Computed<any>;
51
66
  }
52
67
  export interface FirewallSignal<T> extends RawSignal<T> {
53
68
  _firewall: Computed<any>;
@@ -90,12 +105,14 @@ export interface Computed<T> extends RawSignal<T>, Owner {
90
105
  _child: FirewallSignal<any> | null;
91
106
  _notifyStatus?: (status?: number, error?: any) => void;
92
107
  /**
93
- * Store-wide optimistic mask (count of this firewall's store targets with
94
- * live optimistic writes). Non-zero decrees the whole store settled for
95
- * `isPending`the store is the primitive the mask covers (A20 re-rule
96
- * 2026-07-07c).
108
+ * Question-scoped pending classification of the node's CURRENT pending
109
+ * window: `true` means the in-flight recompute is a re-ask of the same
110
+ * question (refresh/poll/confirm no tracked input changed value), so the
111
+ * shown answer still answers the question and the node reads NOT pending.
112
+ * Set by `recompute` from `REACTIVE_REASK`, cleared on landing
113
+ * (`clearStatus`). Meaningless while not STATUS_PENDING.
97
114
  */
98
- _optimisticMask?: number;
115
+ _reask: boolean;
99
116
  }
100
117
  export interface Root extends Owner {
101
118
  _root: true;
@@ -4,6 +4,7 @@ export declare const DEV: Dev | undefined;
4
4
  export type { Owner, Context, ContextRecord, IQueue, ExternalSourceFactory, ExternalSource, ExternalSourceConfig, Refreshable, Dev, DevHooks, DiagnosticCapture, DiagnosticCode, DiagnosticEvent, DiagnosticKind, Diagnostics, DiagnosticSeverity } from "./core/index.cjs";
5
5
  export { createSignal, createMemo, createEffect, createRenderEffect, createTrackedEffect, createReaction, createOptimistic, resolve, onSettled, onCleanup } from "./signals.cjs";
6
6
  export type { Accessor, SourceAccessor, Setter, Signal, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, SignalOptions, MemoOptions, NoInfer } from "./signals.cjs";
7
+ export { affects } from "./affects.cjs";
7
8
  export { mapArray, repeat, type Maybe } from "./map.cjs";
8
9
  export * from "./store/index.cjs";
9
10
  export { createLoadingBoundary, createErrorBoundary, createRevealOrder, flatten, type RevealOrder } from "./boundaries.cjs";
@@ -40,8 +40,8 @@ type DataNodes = Record<PropertyKey, DataNode>;
40
40
  *
41
41
  * @internal
42
42
  */
43
- export declare const $TRACK: unique symbol, $TARGET: unique symbol, $PROXY: unique symbol, $DELETED: unique symbol;
44
- export declare const STORE_VALUE = "v", STORE_OVERRIDE = "o", STORE_OPTIMISTIC_OVERRIDE = "x", STORE_NODE = "n", STORE_HAS = "h", STORE_CUSTOM_PROTO = "c", STORE_WRAP = "w", STORE_LOOKUP = "l", STORE_FIREWALL = "f", STORE_OPTIMISTIC = "p", STORE_MASKED = "m";
43
+ export declare const $TRACK: unique symbol, $TARGET: unique symbol, $PROXY: unique symbol, $DELETED: unique symbol, $AFFECTS: unique symbol;
44
+ export declare const STORE_VALUE = "v", STORE_OVERRIDE = "o", STORE_OPTIMISTIC_OVERRIDE = "x", STORE_NODE = "n", STORE_HAS = "h", STORE_CUSTOM_PROTO = "c", STORE_WRAP = "w", STORE_LOOKUP = "l", STORE_FIREWALL = "f", STORE_OPTIMISTIC = "p";
45
45
  export type StoreNode = {
46
46
  [$PROXY]: any;
47
47
  [STORE_VALUE]: Record<PropertyKey, any>;
@@ -54,8 +54,6 @@ export type StoreNode = {
54
54
  [STORE_LOOKUP]?: WeakMap<any, any>;
55
55
  [STORE_FIREWALL]?: Computed<any>;
56
56
  [STORE_OPTIMISTIC]?: boolean;
57
- /** This target currently contributes to its firewall's store-wide mask. */
58
- [STORE_MASKED]?: boolean;
59
57
  [STORE_SNAPSHOT_PROPS]?: Record<PropertyKey, any>;
60
58
  };
61
59
  export declare namespace SolidStore {
@@ -83,20 +81,40 @@ export declare function getOverlayLayer(target: StoreNode, property: PropertyKey
83
81
  * override, else held pending value, else committed value.
84
82
  */
85
83
  export declare function visibleNodeValue(node: DataNode): any;
84
+ /**
85
+ * Witness live mark coverage of a record into the active isPending() probe.
86
+ * Tracked reads don't need this — they go through real signal nodes, which
87
+ * carry marks directly (declaration walk or birth inheritance). This covers
88
+ * UNTRACKED probes reading through records whose nodes never materialized
89
+ * (no observer ever subscribed, so no node exists to carry the mark).
90
+ * Callers guard on `pendingCheckActive`, so plain reads never pay for this.
91
+ *
92
+ * @internal
93
+ */
94
+ export declare function witnessAffectsMark(target: StoreNode): void;
95
+ /**
96
+ * Resolves the store nodes an `affects()` declaration marks: with a `key`,
97
+ * the named slot's leaf node (upserted so the mark has an addressable
98
+ * carrier); without, the record's $AFFECTS carrier plus every LIVE node in
99
+ * its subtree (the edges existing readers subscribed through), with the
100
+ * subtree's identities snapshotted into the mark's scope so nodes created
101
+ * during the window — and untracked probes over captured proxies — resolve
102
+ * against it (#2882).
103
+ *
104
+ * @internal
105
+ */
106
+ export declare function getStoreAffectsNodes(target: StoreNode, key?: PropertyKey): DataNode[];
86
107
  export declare function trackSelf(target: StoreNode, symbol?: symbol): void;
87
108
  export declare function notifySelf(target: StoreNode): void;
88
- export declare function getKeys(source: Record<PropertyKey, any>, override: Record<PropertyKey, any> | undefined, enumerable?: boolean): PropertyKey[];
89
- export declare function getPropertyDescriptor(source: Record<PropertyKey, any>, override: Record<PropertyKey, any> | undefined, property: PropertyKey): PropertyDescriptor | undefined;
90
109
  /**
91
- * Store-wide mask bookkeeping (A20 re-rule 2026-07-07c): the store is the
92
- * primitive, so an optimistic write decrees the WHOLE store settled for
93
- * `isPending` firewall, written leaves, untouched siblings, structural
94
- * reads for the lifetime of the override/transition. The firewall carries a
95
- * count of masked targets (nested objects mask independently); companions of
96
- * the firewall and its probed leaves are poked on 0↔1 transitions so an
97
- * already-materialized verdict flips without waiting for another write.
110
+ * The write overlay a walk must read through: optimistic writes shadow
111
+ * regular pending writes, the same resolution order as every proxy trap and
112
+ * `reconcile` (#2850). Merging allocates only in the rare both-present case
113
+ * (a derived optimistic store with an in-flight projection commit).
98
114
  */
99
- export declare function maskStoreTarget(target: StoreNode, on: boolean): void;
115
+ export declare function mergedOverlay(target: StoreNode): Record<PropertyKey, any> | undefined;
116
+ export declare function getKeys(source: Record<PropertyKey, any>, override: Record<PropertyKey, any> | undefined, enumerable?: boolean): PropertyKey[];
117
+ export declare function getPropertyDescriptor(source: Record<PropertyKey, any>, override: Record<PropertyKey, any> | undefined, property: PropertyKey): PropertyDescriptor | undefined;
100
118
  export declare const storeTraps: ProxyHandler<StoreNode>;
101
119
  export declare function storeSetter<T extends object>(store: Store<T>, fn: (draft: T) => T | void): void;
102
120
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/signals",
3
- "version": "2.0.0-beta.16",
3
+ "version": "2.0.0-beta.18",
4
4
  "description": "Solid's reactive primitives: signals, memos, effects, stores, and async-aware computations.",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",