@solidjs/signals 2.0.0-rc.6 → 2.0.0-rc.8

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 (131) hide show
  1. package/dist/dev-shared.js +5243 -0
  2. package/dist/dev.attribution.js +2333 -0
  3. package/dist/dev.js +1758 -6621
  4. package/dist/observe/affects.js +127 -0
  5. package/dist/observe/attribution.js +1 -0
  6. package/dist/observe/boundaries.js +586 -0
  7. package/dist/observe/core/action.js +167 -0
  8. package/dist/observe/core/async.js +736 -0
  9. package/dist/observe/core/attribution-hooks.js +60 -0
  10. package/dist/observe/core/attribution.js +2318 -0
  11. package/dist/{types-cjs/core/constants.d.cts → observe/core/constants.js} +135 -71
  12. package/dist/{types-cjs/core/context.d.cts → observe/core/context.js} +37 -12
  13. package/dist/observe/core/core.js +1289 -0
  14. package/dist/observe/core/dev.js +232 -0
  15. package/dist/observe/core/effect.js +179 -0
  16. package/dist/observe/core/error.js +80 -0
  17. package/dist/observe/core/external.js +98 -0
  18. package/dist/observe/core/graph.js +155 -0
  19. package/dist/observe/core/heap.js +147 -0
  20. package/dist/observe/core/invariants.js +43 -0
  21. package/dist/observe/core/lanes.js +168 -0
  22. package/dist/observe/core/optimistic.js +438 -0
  23. package/dist/observe/core/owner.js +308 -0
  24. package/dist/observe/core/scheduler.js +1190 -0
  25. package/dist/observe/core/verdict.js +551 -0
  26. package/dist/observe/index.js +55 -0
  27. package/dist/observe/map.js +482 -0
  28. package/dist/{types-cjs/signals.d.cts → observe/signals.js} +305 -317
  29. package/dist/observe/store/index.js +38 -0
  30. package/dist/observe/store/next/optimistic.js +651 -0
  31. package/dist/observe/store/next/projection.js +242 -0
  32. package/dist/observe/store/next/reconcile.js +373 -0
  33. package/dist/observe/store/next/store.js +2213 -0
  34. package/dist/observe/store/next/target.js +51 -0
  35. package/dist/observe/store/store.js +323 -0
  36. package/dist/observe/store/storePath.js +103 -0
  37. package/dist/observe/store/utils.js +210 -0
  38. package/dist/prod/attribution.js +32 -0
  39. package/dist/prod/boundaries.js +3 -1
  40. package/dist/prod/core/action.js +52 -32
  41. package/dist/prod/core/async.js +177 -128
  42. package/dist/prod/core/attribution-hooks.js +3 -0
  43. package/dist/prod/core/constants.js +32 -1
  44. package/dist/prod/core/context.js +10 -16
  45. package/dist/prod/core/core.js +505 -286
  46. package/dist/prod/core/dev.js +2 -0
  47. package/dist/prod/core/effect.js +72 -43
  48. package/dist/prod/core/external.js +2 -2
  49. package/dist/prod/core/graph.js +40 -36
  50. package/dist/prod/core/heap.js +50 -51
  51. package/dist/prod/core/lanes.js +43 -22
  52. package/dist/prod/core/optimistic.js +224 -80
  53. package/dist/prod/core/owner.js +43 -39
  54. package/dist/prod/core/scheduler.js +347 -232
  55. package/dist/prod/core/verdict.js +71 -74
  56. package/dist/prod/index.js +9 -5
  57. package/dist/prod/map.js +311 -150
  58. package/dist/prod/signals.js +52 -38
  59. package/dist/prod/store/next/optimistic.js +127 -131
  60. package/dist/prod/store/next/projection.js +3 -3
  61. package/dist/prod/store/next/reconcile.js +149 -294
  62. package/dist/prod/store/next/store.js +694 -380
  63. package/dist/prod/store/next/target.js +32 -10
  64. package/dist/prod/store/store.js +12 -14
  65. package/dist/prod/store/utils.js +36 -27
  66. package/dist/types/attribution.d.ts +15 -0
  67. package/dist/types/attribution.prod.d.ts +13 -0
  68. package/dist/types/core/async.d.ts +1 -1
  69. package/dist/types/core/attribution-hooks.d.ts +183 -6
  70. package/dist/types/core/attribution.d.ts +435 -24
  71. package/dist/types/core/constants.d.ts +31 -0
  72. package/dist/types/core/core.d.ts +19 -3
  73. package/dist/types/core/dev.d.ts +165 -26
  74. package/dist/types/core/effect.d.ts +8 -1
  75. package/dist/types/core/heap.d.ts +5 -3
  76. package/dist/types/core/index.d.ts +2 -1
  77. package/dist/types/core/invariants.d.ts +1 -1
  78. package/dist/types/core/lanes.d.ts +17 -0
  79. package/dist/types/core/scheduler.d.ts +69 -4
  80. package/dist/types/core/types.d.ts +29 -9
  81. package/dist/types/index.d.ts +9 -2
  82. package/dist/types/map.d.ts +2 -0
  83. package/dist/types/signals.d.ts +10 -0
  84. package/dist/types/store/index.d.ts +4 -6
  85. package/dist/types/store/next/optimistic.d.ts +4 -2
  86. package/dist/types/store/next/reconcile.d.ts +5 -12
  87. package/dist/types/store/next/store.d.ts +8 -9
  88. package/dist/types/store/next/target.d.ts +56 -55
  89. package/dist/types/store/store.d.ts +14 -9
  90. package/dist/types/store/utils.d.ts +7 -0
  91. package/package.json +21 -16
  92. package/dist/node.cjs +0 -11121
  93. package/dist/prod/store/next/patch-hooks.js +0 -13
  94. package/dist/prod/store/next/patch.js +0 -614
  95. package/dist/types/store/next/patch-hooks.d.ts +0 -41
  96. package/dist/types/store/next/patch.d.ts +0 -91
  97. package/dist/types-cjs/affects.d.cts +0 -47
  98. package/dist/types-cjs/boundaries.d.cts +0 -175
  99. package/dist/types-cjs/core/action.d.cts +0 -64
  100. package/dist/types-cjs/core/async.d.cts +0 -23
  101. package/dist/types-cjs/core/attribution-hooks.d.cts +0 -63
  102. package/dist/types-cjs/core/attribution.d.cts +0 -239
  103. package/dist/types-cjs/core/core.d.cts +0 -176
  104. package/dist/types-cjs/core/dev.d.cts +0 -95
  105. package/dist/types-cjs/core/effect.d.cts +0 -30
  106. package/dist/types-cjs/core/error.d.cts +0 -56
  107. package/dist/types-cjs/core/external.d.cts +0 -15
  108. package/dist/types-cjs/core/graph.d.cts +0 -28
  109. package/dist/types-cjs/core/heap.d.cts +0 -22
  110. package/dist/types-cjs/core/index.d.cts +0 -13
  111. package/dist/types-cjs/core/invariants.d.cts +0 -59
  112. package/dist/types-cjs/core/lanes.d.cts +0 -44
  113. package/dist/types-cjs/core/optimistic.d.cts +0 -6
  114. package/dist/types-cjs/core/owner.d.cts +0 -124
  115. package/dist/types-cjs/core/scheduler.d.cts +0 -231
  116. package/dist/types-cjs/core/types.d.cts +0 -204
  117. package/dist/types-cjs/core/verdict.d.cts +0 -2
  118. package/dist/types-cjs/index.d.cts +0 -10
  119. package/dist/types-cjs/map.d.cts +0 -69
  120. package/dist/types-cjs/package.json +0 -3
  121. package/dist/types-cjs/store/index.d.cts +0 -21
  122. package/dist/types-cjs/store/next/optimistic.d.cts +0 -23
  123. package/dist/types-cjs/store/next/patch-hooks.d.cts +0 -41
  124. package/dist/types-cjs/store/next/patch.d.cts +0 -91
  125. package/dist/types-cjs/store/next/projection.d.cts +0 -8
  126. package/dist/types-cjs/store/next/reconcile.d.cts +0 -17
  127. package/dist/types-cjs/store/next/store.d.cts +0 -127
  128. package/dist/types-cjs/store/next/target.d.cts +0 -192
  129. package/dist/types-cjs/store/store.d.cts +0 -138
  130. package/dist/types-cjs/store/storePath.d.cts +0 -58
  131. package/dist/types-cjs/store/utils.d.cts +0 -74
@@ -1,192 +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, Owner, Signal } from "../../core/types.cjs";
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
- /** Retaining transactions (#3164 fold ruling): every transaction that made
31
- * an optimistic setter call on this family and may still be open. While
32
- * any member is live, truth landings FOLD — they stage into the retaining
33
- * transaction and reveal atomically at its settle, exactly like a signal
34
- * landing under an active override. Dead members prune lazily at each
35
- * landing (retainingTransition). */
36
- rt?: Set<any>;
37
- /** Flight-owned transaction (#3146): declared when a truth-flight
38
- * registers (the ask's transaction — created by the flight's own pending
39
- * throw when none was ambient, the causing write's when one was), renewed
40
- * per settle event once the previous reveal committed. Bare optimistic
41
- * writes and landings route into it BY DECLARATION; the transitionBlocked
42
- * store-half checks it for ownership instead of reconstructing it from
43
- * `_optimisticStores` membership. null = no flight declared one (sync
44
- * derive, or a loading-window flight — the loading rail is
45
- * transaction-invisible, #2933). */
46
- ft?: any;
47
- /** Normalized row-key fn (same resolution as the projection channels:
48
- * `options.key`, "id" default, null = unkeyed). The staged-landing walk
49
- * reads it: key-matched rows keep their proxy identity across a fold. */
50
- key?: ((item: any) => any) | null;
51
- map: WeakMap<object, StoreNextTarget>;
52
- /** The projection computed — assigned after creation (accessor pattern). */
53
- node: Computed<any> | null;
54
- shallow?: boolean;
55
- }
56
- /** Write-side patch-channel state (stage 2), grouped off the target's named
57
- * fields — see the shape rule on `StoreNextTarget.pc`. One literal shape,
58
- * allocated by `pcOf` on first use. */
59
- export interface PatchChannel {
60
- /** Slot-patch hooks for shallow arrays — the reconcile walk emits
61
- * (i, next, prev) for key-aligned value-replaced slots through the patch
62
- * apply queue (records are raw, no per-record targets exist).
63
- * MULTI-CONSUMER (external audit): one array can drive several lists. */
64
- sp: {
65
- fn: (index: number, next: any, prev: any) => void;
66
- owner: Owner | null;
67
- }[] | null;
68
- /** Patch-channel consumers (next/patch.ts): per-record compiled patch
69
- * entries, multi-consumer. null when unpatched (the common case). */
70
- p: object[] | null;
71
- /** Same-batch coalescing stamp (re-audit 2/3): the container array this
72
- * channel last pushed a non-forced SELF entry into, plus that entry. A
73
- * later same-batch emission UPDATES the queued entry's `next` in place
74
- * (latest state wins — adoption REPLACES the captured object, so dropping
75
- * the later emission would apply stale state) while `prev` stays the
76
- * batch's earliest. The drain clears both stamps so a quiet record
77
- * retains nothing from its last batch. */
78
- qa: unknown;
79
- qe: unknown;
80
- /** Row-ops consumers (next/patch.ts, PR-B): structural list ops —
81
- * (nextRows, { prefix, sources, removed }) at apply timing. */
82
- ro: object[] | null;
83
- /** Keys written through the traps since the last fold commit. Bounds the
84
- * setter notify/hold-check to O(written) instead of O(subscribed nodes) —
85
- * a record with thousands of per-key subscriptions (selection maps) would
86
- * otherwise pay a full node scan on every write. null = no trap writes
87
- * this batch (bulk paths fall back to the full scan). */
88
- wk: Set<PropertyKey> | null;
89
- }
90
- export interface StoreNextTarget {
91
- /** Committed backing: source object (shared) or owned clone. */
92
- v: Record<PropertyKey, any>;
93
- /** Pending backing for the current flush (null when settled). */
94
- pb: Record<PropertyKey, any> | null;
95
- /** cached: committed backing is another store's proxy (§7b chained). */
96
- ch: boolean;
97
- /** live value-node count (deleted-key sweep fast-out in the fused walk). */
98
- nc: number;
99
- /** Lazy per-property subscription nodes (real core signals). */
100
- n: Record<PropertyKey, Signal<any>> | null;
101
- /** Lazy per-key presence nodes (`in` tracks presence, not value — R13). */
102
- h: Record<PropertyKey, Signal<boolean>> | null;
103
- /** Lazy key-set node: membership/iteration/$TRACK subscriptions (§6). */
104
- k: Signal<number> | null;
105
- /** Patch-channel extension (lazily allocated on first use): groups the
106
- * write-side stage-2 fields so they never widen the TARGET's own named
107
- * field count. LOAD-BEARING SHAPE RULE: array proxy targets carry their
108
- * fields as named properties on a real array, and V8 normalizes an array
109
- * to dictionary properties as the named count grows (empirically at
110
- * counts ≡ 0 mod 3 from 18 up on V8 13.x) — every trap field read then
111
- * becomes a hash lookup (~15% uibench, tree suites worst). New
112
- * patch-channel state MUST go inside this object, not on the target. */
113
- pc: PatchChannel | null;
114
- /** Lazy deep-witness node: `deep()` subscribes ONE node per record instead
115
- * of one per path; write paths bump it only when it exists. Separate from
116
- * `k` so $TRACK/mapArray never rerun on leaf value changes (R9). */
117
- dk: Signal<number> | null;
118
- /** Parent target (path copying walks this at commit). */
119
- u: StoreNextTarget | null;
120
- /** Property key of this target in the parent's backing. */
121
- pk: PropertyKey | null;
122
- /** The proxy for this target (stable outward identity). */
123
- px: any;
124
- /** Sticky descendants flag (§6d). */
125
- d: boolean;
126
- /** Sticky accessors-seen flag: an own accessor property was observed on
127
- * this target (first-read scan, defineProperty, or clone scan). Gates the
128
- * fold diff's descriptor-safe path and the get trap's descriptor path. */
129
- a: boolean;
130
- /** Accessor scan performed (scan-once on first trap read; adopted data is
131
- * not rescanned — legacy-parity behavior). */
132
- sc: boolean;
133
- /** Backing was swapped by adoption this batch (fold diff-notifies it). */
134
- adopted: boolean;
135
- /** Pending backing is a prototype-chain OVERLAY of the committed backing
136
- * (`Object.create(v)` — own keys are this batch's writes, everything else
137
- * reads through). O(written) per flush instead of O(container) clones
138
- * (#3044); commit flattens own keys onto an owned committed backing in
139
- * place. Only plain-data non-array non-family containers qualify;
140
- * `materializePB` downgrades to the clone path when a consumer needs a
141
- * real container (reconcile, draft escape). */
142
- ovl: boolean;
143
- /** Keys deleted in the overlay window (a prototype overlay cannot shadow
144
- * a delete); null when none. */
145
- del: Set<PropertyKey> | null;
146
- /** Projection family, null for plain stores (§7b). */
147
- fam: StoreNextFamily | null;
148
- /** Shallow store root (values served raw). */
149
- s: boolean;
150
- /** Held committed view (#3074/#3075): the pre-hold committed backing,
151
- * served to committed-visibility readers while `ht` is live. Adoption is
152
- * eager by contract, but a projection recompute deriving from uncommitted
153
- * inputs (a transition-held source, or a latest()-pull ahead of the flush)
154
- * swaps the backing SPECULATIVELY — the old view must stay servable until
155
- * the hold resolves. */
156
- hv: Record<PropertyKey, any> | null;
157
- /** The holder for `hv`: a live transition (cleared lazily when it is done)
158
- * or the PLAIN_HOLD sentinel (a latest()-pull staging — cleared by the
159
- * fold commit). null = no hold. */
160
- ht: any;
161
- }
162
- /**
163
- * Ownership (first cut, decision 2026-08-16d): one WeakSet of store-owned
164
- * backings serving both the production identity-skip guard and the __TEST__
165
- * no-mutation oracle.
166
- */
167
- export declare const ownedRaw: WeakSet<object>;
168
- /** raw → target. The only raw-keyed lookup; boundary mechanism (O8). */
169
- export declare const storeNextLookup: WeakMap<object, StoreNextTarget>;
170
- /** __TEST__ oracle: every object ingested from a user (never mutate). */
171
- export declare const ingestedRaw: WeakSet<object> | null;
172
- export declare function devAssertNeverUserMutation(target: object): void;
173
- /** Injection table for optimistic-only store machinery (next/optimistic.ts).
174
- * Every call site is gated on `fam?.opt`, and optimistic families can only
175
- * be created by createOptimisticStore — whose install populates this — so
176
- * the non-null assertions at the sites hold by construction. Keeping the
177
- * implementations out of next/store.ts lets plain-store bundles tree-shake
178
- * the optimistic channel entirely. */
179
- export interface OptStoreHooks {
180
- notifyOptimisticWrites(t: any, pb: Record<PropertyKey, any>): void;
181
- optimisticView(t: any, src: Record<PropertyKey, any>): Record<PropertyKey, any>;
182
- applyTentative(t: any, incoming: any, keyFn: ((item: any) => any) | null): void;
183
- /** #3164 fold: does this live transaction still retain optimism (armed
184
- * nodes or tracked stores)? Backs the held-truth masks in next/store.ts so
185
- * plain-store bundles don't carry the transition-optimism probe. */
186
- retainsOptimism(t: any): boolean;
187
- }
188
- export declare let optHooks: OptStoreHooks | null;
189
- export declare function setOptHooks(h: OptStoreHooks): void;
190
- /** Sticky descendants flag walk (§6d): reconcile's keyed pruning descends
191
- * only where subscriptions exist at/below. Nodes AND patches count. */
192
- export declare function markDescendants(target: StoreNextTarget): void;
@@ -1,138 +0,0 @@
1
- import { type Signal } from "../core/index.cjs";
2
- import type { Refreshable } from "../core/index.cjs";
3
- /** A read-only view of a store's value as seen by consumers. Mutate it via the paired `StoreSetter`. */
4
- export type Store<T> = Readonly<T>;
5
- /**
6
- * A store setter. The callback receives a writable **draft** of the store.
7
- *
8
- * - **Mutate in place (canonical):** `s.foo = 1`, `s.list.push(x)`,
9
- * `s.list.splice(i, 1)`. This is the default form for most updates.
10
- * - **Return a new value:** for shapes where mutation is awkward, most
11
- * commonly removing items (`s => s.list.filter(...)`). Arrays are replaced
12
- * by index (length adjusted); objects are shallow-diffed at the top level
13
- * (keys present in the returned value are written, missing keys deleted).
14
- *
15
- * The setter does **not** perform keyed reconciliation. If you need surviving
16
- * items to keep their store identity across full-array replacement, use the
17
- * projection form — `createStore(fn, seed, { key })` or `createProjection` —
18
- * whose derive function reconciles its return by `options.key`.
19
- */
20
- export type StoreSetter<T> = (fn: (state: T) => T | void) => void;
21
- /** Tuple returned by the plain `createStore(initialValue)` form. */
22
- export type StoreReturn<T> = [get: Store<T>, set: StoreSetter<T>];
23
- /** Tuple returned by the derived `createStore(fn, seed, options?)` form. */
24
- export type ProjectionStoreReturn<T> = [get: Refreshable<Store<T>>, set: StoreSetter<T>];
25
- /** Base options for store primitives. */
26
- export interface StoreOptions {
27
- /** Debug name (dev mode only) */
28
- name?: string;
29
- }
30
- /** Options for derived/projected stores created with `createStore(fn)`, `createProjection`, or `createOptimisticStore(fn)`. */
31
- export interface ProjectionOptions extends StoreOptions {
32
- /** Key property name or function for reconciliation identity; `null` merges positionally */
33
- key?: string | ((item: NonNullable<any>) => any) | null;
34
- /** Single-layer store: root keys reactive, values raw records replaced by reference */
35
- shallow?: boolean;
36
- /**
37
- * Treat the seed as commit #0: the store is born committed with the seed's
38
- * contents, shown until the derive's first real answer lands. While that
39
- * first answer is in flight, reads serve the seed everywhere — nothing
40
- * suspends to a `<Loading>` boundary, no transition is held, and
41
- * `isPending` stays false (the seed answers by declaration; first-load
42
- * affordances belong to the data, e.g. a `skeleton: true` field in the
43
- * seed). Once the first answer lands (reconciled into the seed), refetches
44
- * use normal pending semantics with `isPending` true.
45
- *
46
- * The store equivalent of `MemoOptions.loadingValue`; the seed already
47
- * carries the placeholder shape, so this is just the opt-in.
48
- */
49
- seedLoadingValue?: boolean;
50
- }
51
- export type NoFn<T> = T extends Function ? never : T;
52
- type DataNode = Signal<any>;
53
- type DataNodes = Record<PropertyKey, DataNode>;
54
- /**
55
- * Brand symbols used internally by the store proxy / projection plumbing.
56
- * Cross-package wiring; not part of the user-facing API.
57
- *
58
- * @internal
59
- */
60
- export declare const $TRACK: unique symbol, $TARGET: unique symbol, $PROXY: unique symbol, $DELETED: unique symbol, $AFFECTS: unique symbol;
61
- export declare const STORE_VALUE = "v", STORE_NODE = "n", STORE_HAS = "h", STORE_PARENT = "u", STORE_DESC = "d", STORE_SHALLOW = "s";
62
- /** Structural view of a store target as shared machinery sees it (the real
63
- * shape is `StoreNextTarget` in ./next/target.ts). */
64
- export type StoreNode = {
65
- [$PROXY]: any;
66
- [STORE_VALUE]: Record<PropertyKey, any>;
67
- [STORE_NODE]?: DataNodes;
68
- [STORE_HAS]?: DataNodes;
69
- [STORE_PARENT]?: StoreNode;
70
- [STORE_SHALLOW]?: boolean;
71
- [STORE_DESC]?: boolean;
72
- };
73
- export declare namespace SolidStore {
74
- interface Unwrappable {
75
- }
76
- }
77
- export type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined | SolidStore.Unwrappable[keyof SolidStore.Unwrappable];
78
- /**
79
- * Marks a value as raw: no store will ever wrap it — every store presents it
80
- * as-is, tracked by reference at whatever slot holds it and updated by
81
- * replacement. Useful for class instances and external objects (editors,
82
- * scene graphs, Maps) and for record-shaped data updated wholesale. Sticky
83
- * for the value's lifetime.
84
- */
85
- export declare let rawValuesUsed: boolean;
86
- export declare function isRawValue(value: any): boolean;
87
- export declare function markRaw<T>(value: T): T;
88
- export declare function markRawOne(v: any): void;
89
- export declare function markRawIngest(container: any): void;
90
- export declare function isWrappable<T>(obj: T | NotWrappable): obj is T;
91
- export declare function setWriteOverride(value: boolean): void;
92
- export declare function getWriteOverride(): boolean;
93
- export declare function ownEnumerableKeys(o: object): (string | symbol)[];
94
- /**
95
- * Scope inheritance for late-created nodes: every live mark whose identity
96
- * scope contains the owning record's raw — and, for keyed marks, whose key
97
- * is this property — gets counted on the new node. Inherited marks live
98
- * exactly as long as the scope's carrier — the release hook below drops
99
- * them with the entry.
100
- */
101
- export declare function inheritAffectsMarks(node: DataNode, raw: object, property: PropertyKey): void;
102
- /** Next-store node factory for affects carriers/slots: injected by the
103
- * rewrite module (next targets alias the legacy field names, so everything
104
- * here EXCEPT node creation works on them structurally). */
105
- export declare let nextAffectsNodeResolver: ((target: any, key: PropertyKey) => DataNode) | null;
106
- export declare function setNextAffectsNodeResolver(fn: (target: any, key: PropertyKey) => DataNode): void;
107
- /** Next-store optimistic view for the declaration walk (optimistic rows
108
- * pushed before the declaration are in motion too — legacy reads its write
109
- * overlays; next composes armed-node overrides). */
110
- export declare let nextOptimisticViewResolver: ((target: any, raw: any) => any) | null;
111
- export declare function setNextOptimisticViewResolver(fn: (target: any, raw: any) => any): void;
112
- /** @internal birth inheritance for nodes created inside a live mark window —
113
- * exported for the rewrite's node factories. */
114
- export declare function affectsScopesLive(): boolean;
115
- /**
116
- * Witness live mark coverage of a record into the active isPending() probe.
117
- * Tracked reads don't need this — they go through real signal nodes, which
118
- * carry marks directly (declaration walk or birth inheritance). This covers
119
- * UNTRACKED probes reading through records whose nodes never materialized
120
- * (no observer ever subscribed, so no node exists to carry the mark).
121
- * Callers guard on `pendingCheckActive`, so plain reads never pay for this.
122
- *
123
- * @internal
124
- */
125
- export declare function witnessAffectsMark(target: StoreNode, property?: PropertyKey): void;
126
- /**
127
- * Resolves the store nodes an `affects()` declaration marks: with a `key`,
128
- * the named slot's leaf node (upserted so the mark has an addressable
129
- * carrier); without, the record's $AFFECTS carrier plus every LIVE node in
130
- * its subtree (the edges existing readers subscribed through), with the
131
- * subtree's identities snapshotted into the mark's scope so nodes created
132
- * during the window — and untracked probes over captured proxies — resolve
133
- * against it (#2882).
134
- *
135
- * @internal
136
- */
137
- export declare function getStoreAffectsNodes(target: StoreNode, key?: PropertyKey): DataNode[];
138
- export {};
@@ -1,58 +0,0 @@
1
- import { type NotWrappable } from "./store.cjs";
2
- type W<T> = Exclude<T, NotWrappable>;
3
- type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [never] ? never : [T] extends [readonly unknown[]] ? number : keyof T : keyof T;
4
- export type CustomPartial<T> = T extends readonly unknown[] ? "0" extends keyof T ? {
5
- [K in Extract<keyof T, `${number}`>]?: T[K];
6
- } : {
7
- [x: number]: T[number];
8
- } : Partial<T>;
9
- export type StorePathRange = {
10
- from?: number;
11
- to?: number;
12
- by?: number;
13
- };
14
- export type ArrayFilterFn<T> = (item: T, index: number) => boolean;
15
- export type PathSetter<T> = T | CustomPartial<T> | ((prev: T) => T | CustomPartial<T>) | typeof DELETE;
16
- export type Part<T, K extends KeyOf<T> = KeyOf<T>> = K | ([K] extends [never] ? never : readonly K[]) | ([T] extends [readonly unknown[]] ? ArrayFilterFn<T[number]> | StorePathRange : never);
17
- declare const DELETE: unique symbol;
18
- export interface storePath {
19
- DELETE: typeof DELETE;
20
- <T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>, K7 extends KeyOf<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, k7: Part<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, K7>, setter: PathSetter<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>): (state: T) => void;
21
- <T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, setter: PathSetter<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>): (state: T) => void;
22
- <T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, setter: PathSetter<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>): (state: T) => void;
23
- <T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, setter: PathSetter<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>): (state: T) => void;
24
- <T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, setter: PathSetter<W<W<W<T>[K1]>[K2]>[K3]>): (state: T) => void;
25
- <T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, setter: PathSetter<W<W<T>[K1]>[K2]>): (state: T) => void;
26
- <T, K1 extends KeyOf<W<T>>>(k1: Part<W<T>, K1>, setter: PathSetter<W<T>[K1]>): (state: T) => void;
27
- <T>(setter: PathSetter<T>): (state: T) => void;
28
- }
29
- /**
30
- * Path-based setter helper for `createStore`. Call `storePath(...path, value)`
31
- * to produce a draft-mutating function suitable for passing to `setStore`.
32
- *
33
- * The canonical setter form in Solid 2.0 is the draft-mutating callback
34
- * (`setStore(s => { s.user.name = "Ada"; })`). `storePath` is a backwards-
35
- * compatibility helper for users porting from Solid 1.x's
36
- * `setStore("user", "name", "Ada")` style — it's optional and you can mix the
37
- * two styles freely.
38
- *
39
- * Path parts can be:
40
- * - a single key — `"user"`, `0`
41
- * - an array of keys — `[0, 1, 2]`
42
- * - a range over an array — `{ from?, to?, by? }`
43
- * - a filter `(item, index) => boolean` for arrays
44
- *
45
- * The final argument is the new value or an updater `(prev) => next`. Use
46
- * `storePath.DELETE` to remove a property.
47
- *
48
- * @example
49
- * ```ts
50
- * const [state, setState] = createStore({ user: { name: "Ada" }, todos: [] });
51
- *
52
- * setState(storePath("user", "name", "Grace"));
53
- * setState(storePath("todos", t => !t.done, "done", true)); // mark all undone as done
54
- * setState(storePath("user", "nickname", storePath.DELETE));
55
- * ```
56
- */
57
- export declare const storePath: storePath;
58
- export {};
@@ -1,74 +0,0 @@
1
- type DistributeOverride<T, F> = T extends undefined ? F : T;
2
- type Override<T, U> = T extends any ? U extends any ? {
3
- [K in keyof T]: K extends keyof U ? DistributeOverride<U[K], T[K]> : T[K];
4
- } & {
5
- [K in keyof U]: K extends keyof T ? DistributeOverride<U[K], T[K]> : U[K];
6
- } : T & U : T & U;
7
- type OverrideSpread<T, U> = T extends any ? {
8
- [K in keyof ({
9
- [K in keyof T]: any;
10
- } & {
11
- [K in keyof U]?: any;
12
- } & {
13
- [K in U extends any ? keyof U : keyof U]?: any;
14
- })]: K extends keyof T ? Exclude<U extends any ? U[K & keyof U] : never, undefined> | T[K] : U extends any ? U[K & keyof U] : never;
15
- } : T & U;
16
- type Simplify<T> = T extends any ? {
17
- [K in keyof T]: T[K];
18
- } : T;
19
- type _Merge<T extends unknown[], Curr = {}> = T extends [
20
- infer Next | (() => infer Next),
21
- ...infer Rest
22
- ] ? _Merge<Rest, Override<Curr, Next>> : T extends [...infer Rest, infer Next | (() => infer Next)] ? Override<_Merge<Rest, Curr>, Next> : T extends [] ? Curr : T extends (infer I | (() => infer I))[] ? OverrideSpread<Curr, I> : Curr;
23
- export type Merge<T extends unknown[]> = Simplify<_Merge<T>>;
24
- /**
25
- * Merges multiple props-like objects into a single proxy that *preserves
26
- * reactivity*. Reads are forwarded to the right-most source that defines the
27
- * property, so later sources override earlier ones (like `Object.assign`).
28
- *
29
- * Function arguments are treated as memo-backed sources — useful for passing
30
- * derived defaults whose computation should track reactively.
31
- *
32
- * Use this in component bodies to merge defaults / overrides without losing
33
- * Solid's per-property tracking.
34
- *
35
- * @example
36
- * ```tsx
37
- * function Button(_props: { label: string; type?: string; disabled?: boolean }) {
38
- * const props = merge({ type: "button", disabled: false }, _props);
39
- *
40
- * return <button type={props.type} disabled={props.disabled}>{props.label}</button>;
41
- * }
42
- * ```
43
- */
44
- export declare function merge<T extends unknown[]>(...sources: T): Merge<T>;
45
- export type Omit<T, K extends readonly (keyof T)[]> = {
46
- [P in keyof T as Exclude<P, K[number]>]: T[P];
47
- };
48
- /**
49
- * Returns a reactive proxy of `props` with the listed keys hidden. Tracking
50
- * on the remaining keys is preserved.
51
- *
52
- * Use it to forward "rest" props to a child element while pulling out the
53
- * keys your component handles itself — the equivalent of `splitProps(p, ["a","b"])[1]`.
54
- *
55
- * @example
56
- * ```tsx
57
- * function Input(props: { label: string; value: string; onInput: (v: string) => void } & JSX.HTMLAttributes<HTMLInputElement>) {
58
- * const rest = omit(props, "label", "value", "onInput");
59
- *
60
- * return (
61
- * <label>
62
- * {props.label}
63
- * <input
64
- * {...rest}
65
- * value={props.value}
66
- * onInput={e => props.onInput(e.currentTarget.value)}
67
- * />
68
- * </label>
69
- * );
70
- * }
71
- * ```
72
- */
73
- export declare function omit<T extends Record<any, any>, K extends readonly (keyof T)[]>(props: T, ...keys: K): Omit<T, K>;
74
- export {};