@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.
- package/dist/dev-shared.js +5243 -0
- package/dist/dev.attribution.js +2333 -0
- package/dist/dev.js +1758 -6621
- package/dist/observe/affects.js +127 -0
- package/dist/observe/attribution.js +1 -0
- package/dist/observe/boundaries.js +586 -0
- package/dist/observe/core/action.js +167 -0
- package/dist/observe/core/async.js +736 -0
- package/dist/observe/core/attribution-hooks.js +60 -0
- package/dist/observe/core/attribution.js +2318 -0
- package/dist/{types-cjs/core/constants.d.cts → observe/core/constants.js} +135 -71
- package/dist/{types-cjs/core/context.d.cts → observe/core/context.js} +37 -12
- package/dist/observe/core/core.js +1289 -0
- package/dist/observe/core/dev.js +232 -0
- package/dist/observe/core/effect.js +179 -0
- package/dist/observe/core/error.js +80 -0
- package/dist/observe/core/external.js +98 -0
- package/dist/observe/core/graph.js +155 -0
- package/dist/observe/core/heap.js +147 -0
- package/dist/observe/core/invariants.js +43 -0
- package/dist/observe/core/lanes.js +168 -0
- package/dist/observe/core/optimistic.js +438 -0
- package/dist/observe/core/owner.js +308 -0
- package/dist/observe/core/scheduler.js +1190 -0
- package/dist/observe/core/verdict.js +551 -0
- package/dist/observe/index.js +55 -0
- package/dist/observe/map.js +482 -0
- package/dist/{types-cjs/signals.d.cts → observe/signals.js} +305 -317
- package/dist/observe/store/index.js +38 -0
- package/dist/observe/store/next/optimistic.js +651 -0
- package/dist/observe/store/next/projection.js +242 -0
- package/dist/observe/store/next/reconcile.js +373 -0
- package/dist/observe/store/next/store.js +2213 -0
- package/dist/observe/store/next/target.js +51 -0
- package/dist/observe/store/store.js +323 -0
- package/dist/observe/store/storePath.js +103 -0
- package/dist/observe/store/utils.js +210 -0
- package/dist/prod/attribution.js +32 -0
- package/dist/prod/boundaries.js +3 -1
- package/dist/prod/core/action.js +52 -32
- package/dist/prod/core/async.js +177 -128
- package/dist/prod/core/attribution-hooks.js +3 -0
- package/dist/prod/core/constants.js +32 -1
- package/dist/prod/core/context.js +10 -16
- package/dist/prod/core/core.js +505 -286
- package/dist/prod/core/dev.js +2 -0
- package/dist/prod/core/effect.js +72 -43
- package/dist/prod/core/external.js +2 -2
- package/dist/prod/core/graph.js +40 -36
- package/dist/prod/core/heap.js +50 -51
- package/dist/prod/core/lanes.js +43 -22
- package/dist/prod/core/optimistic.js +224 -80
- package/dist/prod/core/owner.js +43 -39
- package/dist/prod/core/scheduler.js +347 -232
- package/dist/prod/core/verdict.js +71 -74
- package/dist/prod/index.js +9 -5
- package/dist/prod/map.js +311 -150
- package/dist/prod/signals.js +52 -38
- package/dist/prod/store/next/optimistic.js +127 -131
- package/dist/prod/store/next/projection.js +3 -3
- package/dist/prod/store/next/reconcile.js +149 -294
- package/dist/prod/store/next/store.js +694 -380
- package/dist/prod/store/next/target.js +32 -10
- package/dist/prod/store/store.js +12 -14
- package/dist/prod/store/utils.js +36 -27
- package/dist/types/attribution.d.ts +15 -0
- package/dist/types/attribution.prod.d.ts +13 -0
- package/dist/types/core/async.d.ts +1 -1
- package/dist/types/core/attribution-hooks.d.ts +183 -6
- package/dist/types/core/attribution.d.ts +435 -24
- package/dist/types/core/constants.d.ts +31 -0
- package/dist/types/core/core.d.ts +19 -3
- package/dist/types/core/dev.d.ts +165 -26
- package/dist/types/core/effect.d.ts +8 -1
- package/dist/types/core/heap.d.ts +5 -3
- package/dist/types/core/index.d.ts +2 -1
- package/dist/types/core/invariants.d.ts +1 -1
- package/dist/types/core/lanes.d.ts +17 -0
- package/dist/types/core/scheduler.d.ts +69 -4
- package/dist/types/core/types.d.ts +29 -9
- package/dist/types/index.d.ts +9 -2
- package/dist/types/map.d.ts +2 -0
- package/dist/types/signals.d.ts +10 -0
- package/dist/types/store/index.d.ts +4 -6
- package/dist/types/store/next/optimistic.d.ts +4 -2
- package/dist/types/store/next/reconcile.d.ts +5 -12
- package/dist/types/store/next/store.d.ts +8 -9
- package/dist/types/store/next/target.d.ts +56 -55
- package/dist/types/store/store.d.ts +14 -9
- package/dist/types/store/utils.d.ts +7 -0
- package/package.json +21 -16
- package/dist/node.cjs +0 -11121
- package/dist/prod/store/next/patch-hooks.js +0 -13
- package/dist/prod/store/next/patch.js +0 -614
- package/dist/types/store/next/patch-hooks.d.ts +0 -41
- package/dist/types/store/next/patch.d.ts +0 -91
- 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 -23
- package/dist/types-cjs/core/attribution-hooks.d.cts +0 -63
- package/dist/types-cjs/core/attribution.d.cts +0 -239
- package/dist/types-cjs/core/core.d.cts +0 -176
- package/dist/types-cjs/core/dev.d.cts +0 -95
- package/dist/types-cjs/core/effect.d.cts +0 -30
- package/dist/types-cjs/core/error.d.cts +0 -56
- package/dist/types-cjs/core/external.d.cts +0 -15
- package/dist/types-cjs/core/graph.d.cts +0 -28
- 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 -231
- package/dist/types-cjs/core/types.d.cts +0 -204
- 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/store/index.d.cts +0 -21
- package/dist/types-cjs/store/next/optimistic.d.cts +0 -23
- package/dist/types-cjs/store/next/patch-hooks.d.cts +0 -41
- package/dist/types-cjs/store/next/patch.d.cts +0 -91
- package/dist/types-cjs/store/next/projection.d.cts +0 -8
- package/dist/types-cjs/store/next/reconcile.d.cts +0 -17
- package/dist/types-cjs/store/next/store.d.cts +0 -127
- package/dist/types-cjs/store/next/target.d.cts +0 -192
- 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,26 +1,25 @@
|
|
|
1
1
|
import type { Signal } from "../../core/types.js";
|
|
2
|
-
import { type StoreNextFamily, type StoreNextTarget
|
|
3
|
-
/** Lazily allocate the patch-channel extension (one literal shape). */
|
|
4
|
-
export declare function pcOf(t: StoreNextTarget): PatchChannel;
|
|
2
|
+
import { type StoreNextFamily, type StoreNextTarget } from "./target.js";
|
|
5
3
|
export declare function wrapNext<T extends Record<PropertyKey, any>>(value: T, parent?: StoreNextTarget | null, parentKey?: PropertyKey | null, fam?: StoreNextFamily | null): T;
|
|
6
4
|
/** Unwrap our own proxies to their current backing; leave everything else. */
|
|
7
5
|
export declare function unwrapValue(v: any): any;
|
|
8
|
-
export declare function getNode(target: StoreNextTarget, key: PropertyKey, current: any): Signal<any>;
|
|
6
|
+
export declare function getNode(target: StoreNextTarget, key: PropertyKey, current: any, accKnown?: -1 | 0 | 1): Signal<any>;
|
|
9
7
|
export declare function getHasNode(target: StoreNextTarget, key: PropertyKey, present: boolean): Signal<boolean>;
|
|
10
8
|
export declare function getKeySetNode(target: StoreNextTarget): Signal<number>;
|
|
11
9
|
/** Deep-witness bump: any value/shape change on a record with a live deep()
|
|
12
10
|
* subscriber notifies it. One null check when unused. */
|
|
13
11
|
export declare function bumpDeep(t: StoreNextTarget): void;
|
|
14
|
-
/** Scanned plainness for patch admission (patchableRaw): runs the one-time
|
|
15
|
-
* accessor scan if it hasn't happened yet — the sticky `a` flag alone is not
|
|
16
|
-
* trustworthy before a scan (it starts false and is discovered lazily). */
|
|
17
|
-
export declare function targetIsPlain(target: StoreNextTarget): boolean;
|
|
18
12
|
/** Downgrade a prototype-overlay pending backing to the clone path: builds
|
|
19
13
|
* the real container (committed + overlay writes − deletes) that fold will
|
|
20
14
|
* SWAP in as the committed backing, exactly as if the draft had started on
|
|
21
15
|
* the clone path. Consumers that need a complete container (reconcile's
|
|
22
16
|
* diff walks, drafts escaping into other storage) call this. */
|
|
23
17
|
export declare function materializePB(target: StoreNextTarget): void;
|
|
18
|
+
/** Resolve the held committed view (#3074): answers the masked old backing
|
|
19
|
+
* while the hold is live, and lazily clears a hold whose transition has
|
|
20
|
+
* committed (transitions merge — resolve through currentTransition, same as
|
|
21
|
+
* foldHeld's node stamps). */
|
|
22
|
+
export declare function heldMaskView(t: StoreNextTarget): Record<PropertyKey, any> | null;
|
|
24
23
|
/**
|
|
25
24
|
* Adoption (2026-08-16c): the incoming object becomes the committed backing
|
|
26
25
|
* IMMEDIATELY — reconcile is eagerly visible to every reader (shipped
|
|
@@ -90,7 +89,7 @@ export type SetStoreNextFunction<T> = (fn: (draft: T) => T | void) => void;
|
|
|
90
89
|
* replacements as adoptions. `guard=false` skips the owned-scope dev guard —
|
|
91
90
|
* projection recomputes legitimately write from inside their computed. */
|
|
92
91
|
export declare function storeSetterNext<T>(proxy: T, fn: (draft: T) => T | void, guard?: boolean): void;
|
|
93
|
-
export declare function createStoreNext<T extends Record<PropertyKey, any>>(
|
|
92
|
+
export declare function createStoreNext<T extends Record<PropertyKey, any>>(initialValue: T, shallow?: boolean): [T, SetStoreNextFunction<T>];
|
|
94
93
|
/** True when `proxy` is a SHALLOW store (children served verbatim, slots
|
|
95
94
|
* replaced by reference — #2932). The list driver uses this to choose the
|
|
96
95
|
* slot-patch channel (collected row bodies) over per-record registration. */
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* entry per read-through object; zero layer slots; nodes, has-nodes, and the
|
|
13
13
|
* key-set node are lazy, materialized only by subscription.
|
|
14
14
|
*/
|
|
15
|
-
import type { Computed,
|
|
15
|
+
import type { Computed, Signal } from "../../core/types.js";
|
|
16
16
|
/** Projection family (§7b): children wrap into the family's own map (writes
|
|
17
17
|
* land in the projection, never the source family), and every node created
|
|
18
18
|
* under the family carries the projection computed as its firewall. */
|
|
@@ -53,40 +53,6 @@ export interface StoreNextFamily {
|
|
|
53
53
|
node: Computed<any> | null;
|
|
54
54
|
shallow?: boolean;
|
|
55
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
56
|
export interface StoreNextTarget {
|
|
91
57
|
/** Committed backing: source object (shared) or owned clone. */
|
|
92
58
|
v: Record<PropertyKey, any>;
|
|
@@ -102,15 +68,19 @@ export interface StoreNextTarget {
|
|
|
102
68
|
h: Record<PropertyKey, Signal<boolean>> | null;
|
|
103
69
|
/** Lazy key-set node: membership/iteration/$TRACK subscriptions (§6). */
|
|
104
70
|
k: Signal<number> | null;
|
|
105
|
-
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
|
|
71
|
+
/** Keys written through the traps since the last fold commit. Bounds the
|
|
72
|
+
* setter notify/hold-check to O(written) instead of O(subscribed nodes) —
|
|
73
|
+
* a record with thousands of per-key subscriptions (selection maps) would
|
|
74
|
+
* otherwise pay a full node scan on every write. null = no trap writes
|
|
75
|
+
* this batch (bulk paths fall back to the full scan); WK_ALL = bound
|
|
76
|
+
* unusable (array length write). LOAD-BEARING SHAPE RULE: array proxy
|
|
77
|
+
* targets carry their fields as named properties on a real array, and V8
|
|
78
|
+
* normalizes an array to dictionary properties as the named count grows
|
|
79
|
+
* (empirically at counts ≡ 0 mod 3 from 18 up on V8 13.x) — every trap
|
|
80
|
+
* field read then becomes a hash lookup (~15% uibench, tree suites
|
|
81
|
+
* worst). Future write-side state MUST ride an extension object, not new
|
|
82
|
+
* named fields. */
|
|
83
|
+
wk: Set<PropertyKey> | null;
|
|
114
84
|
/** Lazy deep-witness node: `deep()` subscribes ONE node per record instead
|
|
115
85
|
* of one per path; write paths bump it only when it exists. Separate from
|
|
116
86
|
* `k` so $TRACK/mapArray never rerun on leaf value changes (R9). */
|
|
@@ -127,16 +97,30 @@ export interface StoreNextTarget {
|
|
|
127
97
|
* this target (first-read scan, defineProperty, or clone scan). Gates the
|
|
128
98
|
* fold diff's descriptor-safe path and the get trap's descriptor path. */
|
|
129
99
|
a: boolean;
|
|
130
|
-
/** Accessor scan
|
|
131
|
-
* not rescanned
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
100
|
+
/** Accessor scan grade: 0 = not yet scanned (adoption resets — adopted data
|
|
101
|
+
* is not rescanned until the next draft), 1 = scanned, 2 = scanned and
|
|
102
|
+
* PLAIN DATA — `Object.prototype` with every own key an enumerable data
|
|
103
|
+
* property. Grade 2 unlocks the spread clone (cloneRaw), bare-assignment
|
|
104
|
+
* overlay writes and flatten (#3360); a non-plain defineProperty through
|
|
105
|
+
* the draft downgrades it to 1. */
|
|
106
|
+
sc: 0 | 1 | 2;
|
|
107
|
+
/** Own-key count: exact at scan, then bumped by set-trap writes of keys new
|
|
108
|
+
* to the container (never decremented — an estimate for the overlay/clone
|
|
109
|
+
* choice only, #3360). */
|
|
110
|
+
kc: number;
|
|
111
|
+
/** Adoption diff base, non-null when the backing was swapped by adoption
|
|
112
|
+
* this batch: the view the nodes were LAST TOLD — the pre-batch committed
|
|
113
|
+
* backing, or the draft's pending backing when a draft preceded the
|
|
114
|
+
* adoption (its setter-exit notifications already moved the nodes, #3296).
|
|
115
|
+
* The deferred fold diffs incoming against this, never against committed. */
|
|
116
|
+
ab: Record<PropertyKey, any> | null;
|
|
135
117
|
/** Pending backing is a prototype-chain OVERLAY of the committed backing
|
|
136
118
|
* (`Object.create(v)` — own keys are this batch's writes, everything else
|
|
137
119
|
* reads through). O(written) per flush instead of O(container) clones
|
|
138
120
|
* (#3044); commit flattens own keys onto an owned committed backing in
|
|
139
|
-
* place.
|
|
121
|
+
* place. Plain-data non-array containers qualify, including projection
|
|
122
|
+
* and derived-store families (#3352); optimistic families, chained
|
|
123
|
+
* backings, and accessor containers keep the descriptor clone.
|
|
140
124
|
* `materializePB` downgrades to the clone path when a consumer needs a
|
|
141
125
|
* real container (reconcile, draft escape). */
|
|
142
126
|
ovl: boolean;
|
|
@@ -160,13 +144,30 @@ export interface StoreNextTarget {
|
|
|
160
144
|
ht: any;
|
|
161
145
|
}
|
|
162
146
|
/**
|
|
163
|
-
* Ownership (
|
|
164
|
-
*
|
|
165
|
-
*
|
|
147
|
+
* Ownership stamp (#3360): every backing the store ALLOCATES (CoW clones,
|
|
148
|
+
* privatized committed backings) carries its owning target under this
|
|
149
|
+
* enumerable symbol. One property write replaces the two weak-collection
|
|
150
|
+
* registrations (ownership set + raw→target map) a fresh object used to pay
|
|
151
|
+
* per draft — V8's identity-hash + ephemeron cost dominated the one-key
|
|
152
|
+
* write floor. Enumerable so a spread copy (the plain-data clone path) stays
|
|
153
|
+
* on the fast path and carries the stamp along.
|
|
154
|
+
*
|
|
155
|
+
* Owned backings are never user-reachable (`snapshot` copies them, the traps
|
|
156
|
+
* hide the key), so every raw key walk in the store must skip `$OWNER`, and
|
|
157
|
+
* ownership is answered by `isOwned` — a user object never carries it.
|
|
158
|
+
* Overlay drafts (`Object.create(v)` over an owned `v`) inherit the stamp.
|
|
166
159
|
*/
|
|
167
|
-
export declare const
|
|
168
|
-
/** raw → target
|
|
160
|
+
export declare const $OWNER: unique symbol;
|
|
161
|
+
/** raw → target for UNOWNED backings (user-ingested, adopted); owned
|
|
162
|
+
* backings resolve through their `$OWNER` stamp. Boundary mechanism (O8). */
|
|
169
163
|
export declare const storeNextLookup: WeakMap<object, StoreNextTarget>;
|
|
164
|
+
/** A backing the store allocated and may mutate in place. */
|
|
165
|
+
export declare function isOwned(raw: object): boolean;
|
|
166
|
+
/** raw → target within a family (`null` = plain stores / the global map).
|
|
167
|
+
* The stamp answers for backings owned by a target OF THAT FAMILY; anything
|
|
168
|
+
* else (user objects, adoptees, another family's backings the family
|
|
169
|
+
* re-registered for its own wrapper) resolves through the family's map. */
|
|
170
|
+
export declare function lookupTarget(raw: object, fam: StoreNextFamily | null): StoreNextTarget | undefined;
|
|
170
171
|
/** __TEST__ oracle: every object ingested from a user (never mutate). */
|
|
171
172
|
export declare const ingestedRaw: WeakSet<object> | null;
|
|
172
173
|
export declare function devAssertNeverUserMutation(target: object): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Signal } from "../core/index.js";
|
|
2
2
|
import type { Refreshable } from "../core/index.js";
|
|
3
|
-
/** A
|
|
4
|
-
export type Store<T> =
|
|
3
|
+
/** A reactive view of a store's value. Update it through the paired `StoreSetter`. */
|
|
4
|
+
export type Store<T> = T;
|
|
5
5
|
/**
|
|
6
6
|
* A store setter. The callback receives a writable **draft** of the store.
|
|
7
7
|
*
|
|
@@ -14,25 +14,30 @@ export type Store<T> = Readonly<T>;
|
|
|
14
14
|
*
|
|
15
15
|
* The setter does **not** perform keyed reconciliation. If you need surviving
|
|
16
16
|
* items to keep their store identity across full-array replacement, use the
|
|
17
|
-
* projection form — `createStore(fn, seed, { key })` or
|
|
18
|
-
* whose derive function reconciles
|
|
17
|
+
* projection form — `createStore(fn, seed, { key })` or
|
|
18
|
+
* `createProjection(fn, seed, { key })` — whose derive function reconciles
|
|
19
|
+
* its return by `options.key`.
|
|
19
20
|
*/
|
|
20
21
|
export type StoreSetter<T> = (fn: (state: T) => T | void) => void;
|
|
21
|
-
/** Tuple returned by the plain `createStore(initialValue)` form. */
|
|
22
|
+
/** Tuple returned by the plain `createStore(initialValue, options?)` form. */
|
|
22
23
|
export type StoreReturn<T> = [get: Store<T>, set: StoreSetter<T>];
|
|
23
24
|
/** Tuple returned by the derived `createStore(fn, seed, options?)` form. */
|
|
24
25
|
export type ProjectionStoreReturn<T> = [get: Refreshable<Store<T>>, set: StoreSetter<T>];
|
|
25
|
-
/**
|
|
26
|
+
/** Options shared by all store primitives. */
|
|
26
27
|
export interface StoreOptions {
|
|
27
28
|
/** Debug name (dev mode only) */
|
|
28
29
|
name?: string;
|
|
30
|
+
/** Single-layer store: root keys reactive, values raw records replaced by reference */
|
|
31
|
+
shallow?: boolean;
|
|
29
32
|
}
|
|
30
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Options for derived/projected stores created with
|
|
35
|
+
* `createStore(fn, seed, options?)`, `createProjection(fn, seed, options?)`,
|
|
36
|
+
* or `createOptimisticStore(fn, seed, options?)`.
|
|
37
|
+
*/
|
|
31
38
|
export interface ProjectionOptions extends StoreOptions {
|
|
32
39
|
/** Key property name or function for reconciliation identity; `null` merges positionally */
|
|
33
40
|
key?: string | ((item: NonNullable<any>) => any) | null;
|
|
34
|
-
/** Single-layer store: root keys reactive, values raw records replaced by reference */
|
|
35
|
-
shallow?: boolean;
|
|
36
41
|
/**
|
|
37
42
|
* Treat the seed as commit #0: the store is born committed with the seed's
|
|
38
43
|
* contents, shown until the derive's first real answer lands. While that
|
|
@@ -21,6 +21,13 @@ type _Merge<T extends unknown[], Curr = {}> = T extends [
|
|
|
21
21
|
...infer Rest
|
|
22
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
23
|
export type Merge<T extends unknown[]> = Simplify<_Merge<T>>;
|
|
24
|
+
/** @internal The flattened sources behind a `merge()` PROXY, or undefined.
|
|
25
|
+
* Only the proxy form: its writes are no-ops, so the sources are the whole
|
|
26
|
+
* truth. merge()'s plain-object form also records `$SOURCES` (so nested
|
|
27
|
+
* merges flatten), but it is a real object callers may mutate afterwards
|
|
28
|
+
* (html's tagged templates assign props after spreading) — those own writes
|
|
29
|
+
* live on the object, not in the sources, so it must be read directly. */
|
|
30
|
+
export declare function mergeSources(o: any): any[] | undefined;
|
|
24
31
|
/**
|
|
25
32
|
* Merges multiple props-like objects into a single proxy that *preserves
|
|
26
33
|
* reactivity*. Reads are forwarded to the right-most source that defines the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/signals",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.8",
|
|
4
4
|
"description": "Solid's reactive primitives: signals, memos, effects, stores, and async-aware computations.",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,12 +13,15 @@
|
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
-
"main": "./dist/
|
|
16
|
+
"main": "./dist/prod/index.js",
|
|
17
17
|
"module": "./dist/prod/index.js",
|
|
18
18
|
"unpkg": "./dist/prod/index.js",
|
|
19
19
|
"jsdelivr": "./dist/prod/index.js",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"type": "module",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=22.12.0"
|
|
24
|
+
},
|
|
22
25
|
"sideEffects": false,
|
|
23
26
|
"files": [
|
|
24
27
|
"dist",
|
|
@@ -26,24 +29,26 @@
|
|
|
26
29
|
],
|
|
27
30
|
"exports": {
|
|
28
31
|
".": {
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
"types": "./dist/types/index.d.ts",
|
|
33
|
+
"test": "./dist/dev.js",
|
|
34
|
+
"development": "./dist/dev.js",
|
|
35
|
+
"observe": "./dist/observe/index.js",
|
|
36
|
+
"default": "./dist/prod/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./attribution": {
|
|
39
|
+
"types": "./dist/types/attribution.d.ts",
|
|
40
|
+
"test": "./dist/dev.attribution.js",
|
|
41
|
+
"development": "./dist/dev.attribution.js",
|
|
42
|
+
"observe": "./dist/observe/attribution.js",
|
|
43
|
+
"default": "./dist/prod/attribution.js"
|
|
39
44
|
},
|
|
40
45
|
"./package.json": "./package.json"
|
|
41
46
|
},
|
|
42
47
|
"scripts": {
|
|
43
48
|
"build": "npm-run-all -nl build:* && pnpm types",
|
|
44
|
-
"build:clean": "rimraf dist/dev dist/prod dist/
|
|
45
|
-
"build:js": "rollup -c && node ./scripts/mangle-props.mjs dist/prod dist/node.
|
|
46
|
-
"types": "tsc -p tsconfig.build.json
|
|
49
|
+
"build:clean": "rimraf dist/dev dist/prod dist/observe dist/*.js",
|
|
50
|
+
"build:js": "rollup -c && node ./scripts/mangle-props.mjs dist/prod dist/observe && node ./scripts/check-pure.mjs dist/prod && node ./scripts/check-pure.mjs dist/observe",
|
|
51
|
+
"types": "tsc -p tsconfig.build.json",
|
|
47
52
|
"test": "vitest run",
|
|
48
53
|
"test:watch": "vitest watch tests",
|
|
49
54
|
"test:gc": "node --expose-gc ./vitest.js",
|
|
@@ -66,4 +71,4 @@
|
|
|
66
71
|
"vite": "^7.0.0",
|
|
67
72
|
"vitest": "^4.1.6"
|
|
68
73
|
}
|
|
69
|
-
}
|
|
74
|
+
}
|