@solidjs/signals 2.0.0-rc.1 → 2.0.0-rc.10
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 +7138 -0
- package/dist/dev.attribution.js +3307 -0
- package/dist/dev.js +5691 -4491
- package/dist/observe/affects.js +129 -0
- package/dist/observe/attribution.js +7 -0
- package/dist/observe/boundaries.js +793 -0
- package/dist/observe/core/action.js +177 -0
- package/dist/observe/core/async.js +849 -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 +2904 -0
- package/dist/observe/core/constants.js +283 -0
- package/dist/{types-cjs/core/context.d.cts → observe/core/context.js} +37 -12
- package/dist/observe/core/core.js +1999 -0
- package/dist/observe/core/dev.js +343 -0
- package/dist/observe/core/effect.js +200 -0
- package/dist/observe/core/error-hooks.js +71 -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 +45 -0
- package/dist/observe/core/lanes.js +205 -0
- package/dist/observe/core/optimistic.js +627 -0
- package/dist/observe/core/owner.js +353 -0
- package/dist/observe/core/scheduler.js +1547 -0
- package/dist/observe/core/verdict.js +674 -0
- package/dist/observe/index.js +59 -0
- package/dist/observe/map.js +484 -0
- package/dist/observe/signals.js +731 -0
- package/dist/observe/store/index.js +44 -0
- package/dist/observe/store/next/optimistic.js +717 -0
- package/dist/observe/store/next/projection.js +266 -0
- package/dist/observe/store/next/reconcile.js +375 -0
- package/dist/observe/store/next/store.js +2480 -0
- package/dist/observe/store/next/target.js +51 -0
- package/dist/observe/store/store.js +331 -0
- package/dist/observe/store/storePath.js +103 -0
- package/dist/observe/store/utils.js +1070 -0
- package/dist/prod/affects.js +10 -9
- package/dist/prod/attribution.js +45 -0
- package/dist/prod/boundaries.js +388 -178
- package/dist/prod/core/action.js +65 -37
- package/dist/prod/core/async.js +378 -163
- package/dist/prod/core/attribution-hooks.js +3 -0
- package/dist/prod/core/constants.js +186 -1
- package/dist/prod/core/context.js +10 -16
- package/dist/prod/core/core.js +1546 -416
- package/dist/prod/core/dev.js +18 -1
- package/dist/prod/core/effect.js +119 -79
- package/dist/prod/core/error-hooks.js +71 -0
- package/dist/prod/core/error.js +13 -1
- package/dist/prod/core/external.js +4 -4
- package/dist/prod/core/graph.js +105 -54
- package/dist/prod/core/heap.js +72 -65
- package/dist/prod/core/invariants.js +3 -2
- package/dist/prod/core/lanes.js +117 -52
- package/dist/prod/core/optimistic.js +458 -104
- package/dist/prod/core/owner.js +131 -84
- package/dist/prod/core/scheduler.js +998 -241
- package/dist/prod/core/verdict.js +417 -112
- package/dist/prod/index.js +20 -8
- package/dist/prod/map.js +312 -151
- package/dist/prod/signals.js +363 -32
- package/dist/prod/store/index.js +2 -0
- package/dist/prod/store/next/optimistic.js +530 -197
- package/dist/prod/store/next/projection.js +142 -57
- package/dist/prod/store/next/reconcile.js +149 -103
- package/dist/prod/store/next/store.js +1470 -346
- package/dist/prod/store/next/target.js +40 -9
- package/dist/prod/store/store.js +23 -19
- package/dist/prod/store/utils.js +997 -130
- package/dist/types/attribution.d.ts +19 -0
- package/dist/types/attribution.prod.d.ts +22 -0
- package/dist/types/boundaries.d.ts +78 -5
- package/dist/types/core/action.d.ts +12 -5
- package/dist/types/core/async.d.ts +3 -1
- 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 +304 -0
- package/dist/types/core/attribution-queries.d.ts +24 -0
- package/dist/types/core/attribution.d.ts +892 -0
- package/dist/types/core/constants.d.ts +179 -0
- package/dist/types/core/core.d.ts +299 -25
- package/dist/types/core/dev.d.ts +421 -8
- package/dist/types/core/effect.d.ts +8 -1
- package/dist/types/core/error-hooks.d.ts +71 -0
- package/dist/types/core/error.d.ts +9 -0
- package/dist/types/core/graph.d.ts +23 -0
- package/dist/types/core/heap.d.ts +5 -3
- package/dist/types/core/index.d.ts +6 -3
- package/dist/types/core/invariants.d.ts +5 -1
- package/dist/types/core/lanes.d.ts +51 -19
- package/dist/types/core/owner.d.ts +15 -3
- package/dist/types/core/scheduler.d.ts +248 -1
- package/dist/types/core/types.d.ts +124 -41
- package/dist/types/index.d.ts +18 -5
- package/dist/types/map.d.ts +2 -0
- package/dist/types/signals.d.ts +145 -13
- package/dist/types/store/index.d.ts +7 -6
- package/dist/types/store/next/optimistic.d.ts +18 -13
- package/dist/types/store/next/projection.d.ts +5 -2
- package/dist/types/store/next/reconcile.d.ts +7 -0
- package/dist/types/store/next/store.d.ts +83 -11
- package/dist/types/store/next/target.d.ts +108 -11
- package/dist/types/store/store.d.ts +20 -11
- package/dist/types/store/utils.d.ts +188 -0
- package/package.json +31 -26
- package/dist/node.cjs +0 -8137
- package/dist/types/store/optimistic.d.ts +0 -45
- package/dist/types/store/projection.d.ts +0 -70
- package/dist/types/store/reconcile.d.ts +0 -46
- 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/constants.d.cts +0 -71
- package/dist/types-cjs/core/core.d.cts +0 -156
- package/dist/types-cjs/core/dev.d.cts +0 -64
- 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 -5
- 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 -56
- 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 -172
- package/dist/types-cjs/core/types.d.cts +0 -148
- 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 -24
- package/dist/types-cjs/store/next/reconcile.d.cts +0 -3
- package/dist/types-cjs/store/next/store.d.cts +0 -71
- package/dist/types-cjs/store/next/target.d.cts +0 -99
- 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 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Ownership (
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Ownership stamp (#3360): every backing the store ALLOCATES (CoW clones,
|
|
3
|
+
* privatized committed backings) carries its owning target under this
|
|
4
|
+
* enumerable symbol. One property write replaces the two weak-collection
|
|
5
|
+
* registrations (ownership set + raw→target map) a fresh object used to pay
|
|
6
|
+
* per draft — V8's identity-hash + ephemeron cost dominated the one-key
|
|
7
|
+
* write floor. Enumerable so a spread copy (the plain-data clone path) stays
|
|
8
|
+
* on the fast path and carries the stamp along.
|
|
9
|
+
*
|
|
10
|
+
* Owned backings are never user-reachable (`snapshot` copies them, the traps
|
|
11
|
+
* hide the key), so every raw key walk in the store must skip `$OWNER`, and
|
|
12
|
+
* ownership is answered by `isOwned` — a user object never carries it.
|
|
13
|
+
* Overlay drafts (`Object.create(v)` over an owned `v`) inherit the stamp.
|
|
5
14
|
*/
|
|
6
|
-
const
|
|
15
|
+
const $OWNER = Symbol(0);
|
|
7
16
|
|
|
8
|
-
/** raw → target
|
|
17
|
+
/** raw → target for UNOWNED backings (user-ingested, adopted); owned
|
|
18
|
+
* backings resolve through their `$OWNER` stamp. Boundary mechanism (O8). */ const storeNextLookup = new WeakMap;
|
|
9
19
|
|
|
10
|
-
function
|
|
20
|
+
/** A backing the store allocated and may mutate in place. */ function isOwned(e) {
|
|
21
|
+
return e[$OWNER] !== undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** raw → target within a family (`null` = plain stores / the global map).
|
|
25
|
+
* The stamp answers for backings owned by a target OF THAT FAMILY; anything
|
|
26
|
+
* else (user objects, adoptees, another family's backings the family
|
|
27
|
+
* re-registered for its own wrapper) resolves through the family's map. */ function lookupTarget(e, o) {
|
|
28
|
+
const t = e[$OWNER];
|
|
29
|
+
return t !== undefined && t.fam === o ? t : (o?.map ?? storeNextLookup).get(e);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function devAssertNeverUserMutation(e) {
|
|
11
33
|
return;
|
|
12
34
|
}
|
|
13
35
|
|
|
14
36
|
let optHooks = null;
|
|
15
37
|
|
|
16
|
-
function setOptHooks(
|
|
17
|
-
optHooks =
|
|
38
|
+
function setOptHooks(e) {
|
|
39
|
+
optHooks = e;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Sticky descendants flag walk (§6d): reconcile's keyed pruning descends
|
|
43
|
+
* only where subscriptions exist at/below. Nodes AND patches count. */ function markDescendants(e) {
|
|
44
|
+
let o = e;
|
|
45
|
+
while (o && !o.d) {
|
|
46
|
+
o.d = true;
|
|
47
|
+
o = o.u;
|
|
48
|
+
}
|
|
18
49
|
}
|
|
19
50
|
|
|
20
|
-
export { devAssertNeverUserMutation,
|
|
51
|
+
export { $OWNER, devAssertNeverUserMutation, isOwned, lookupTarget, markDescendants, optHooks, setOptHooks, storeNextLookup };
|
package/dist/prod/store/store.js
CHANGED
|
@@ -8,14 +8,20 @@ import "../core/verdict.js";
|
|
|
8
8
|
|
|
9
9
|
import "../core/effect.js";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { $OWNER, lookupTarget as lookupTarget$1 } from "./next/target.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Brand symbols used internally by the store proxy / projection plumbing.
|
|
15
15
|
* Cross-package wiring; not part of the user-facing API.
|
|
16
16
|
*
|
|
17
17
|
* @internal
|
|
18
|
-
*/ const $TRACK = Symbol(0), $TARGET = Symbol(0), $PROXY = Symbol(0),
|
|
18
|
+
*/ const $TRACK = Symbol(0), $TARGET = Symbol(0), $PROXY = Symbol(0),
|
|
19
|
+
// The view record behind a merge()/omit() proxy (a `MergeView` or an
|
|
20
|
+
// `OmitView`, utils.ts); a store answers `undefined` on its symbol fast
|
|
21
|
+
// path. One read classifies any `$PROXY`-marked object — store, view, or
|
|
22
|
+
// foreign — where asking `$TARGET` first and then each view kind was two
|
|
23
|
+
// to four trap hops (see `viewOf`).
|
|
24
|
+
$RECORD = Symbol(0), // Node-map slot carrying a record-level `affects()` mark: any read through
|
|
19
25
|
// the record witnesses it into the active isPending() probe.
|
|
20
26
|
$AFFECTS = Symbol(0);
|
|
21
27
|
|
|
@@ -24,13 +30,9 @@ $AFFECTS = Symbol(0);
|
|
|
24
30
|
const STORE_VALUE = "v", STORE_NODE = "n", STORE_HAS = "h";
|
|
25
31
|
|
|
26
32
|
function lookupTarget(e, t) {
|
|
27
|
-
// Family
|
|
28
|
-
// lookup
|
|
29
|
-
|
|
30
|
-
const o = t.get(e);
|
|
31
|
-
if (o !== undefined) return o[$TARGET] ?? o;
|
|
32
|
-
}
|
|
33
|
-
return storeNextLookup.get(e);
|
|
33
|
+
// Family registrations (projections/optimistic) first, then the global
|
|
34
|
+
// next lookup. Proxies resolve through $TARGET directly.
|
|
35
|
+
return (t ? lookupTarget$1(e, t) : undefined) ?? lookupTarget$1(e, null);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
// Values marked raw never acquire a proxy identity: wrap() serves them as-is
|
|
@@ -138,7 +140,7 @@ function ownEnumerableKeys(e) {
|
|
|
138
140
|
*/ function inheritAffectsMarks(e, t, o) {
|
|
139
141
|
// A live scope exists, so affects.ts already installed the mark engine.
|
|
140
142
|
for (const [r, s] of affectsScopes) {
|
|
141
|
-
if (r.t && s.scope.has(t) && (s.key === undefined || s.key === o)) {
|
|
143
|
+
if (r.o?.t && s.scope.has(t) && (s.key === undefined || s.key === o)) {
|
|
142
144
|
GlobalQueue.M(e);
|
|
143
145
|
s.inherited.push(e);
|
|
144
146
|
}
|
|
@@ -202,9 +204,9 @@ s) {
|
|
|
202
204
|
// scope must mark them like any property node.
|
|
203
205
|
if (f.k) o.push(f.k);
|
|
204
206
|
if (f.dk) o.push(f.dk);
|
|
205
|
-
// Carry the effective
|
|
206
|
-
//
|
|
207
|
-
r = f.fam
|
|
207
|
+
// Carry the effective family into untouched descendants (projections/
|
|
208
|
+
// optimistic stores register children under their family).
|
|
209
|
+
r = f.fam ?? r;
|
|
208
210
|
}
|
|
209
211
|
// Overlays are gone (next has no layer): raw enumeration; the optimistic
|
|
210
212
|
// view composition above already folded armed-node membership/values in.
|
|
@@ -214,6 +216,7 @@ s) {
|
|
|
214
216
|
}
|
|
215
217
|
const e = Object.getOwnPropertySymbols(n);
|
|
216
218
|
for (let f = 0, c = e.length; f < c; f++) {
|
|
219
|
+
if (e[f] === $OWNER) continue;
|
|
217
220
|
const c = Object.getOwnPropertyDescriptor(n, e[f]);
|
|
218
221
|
if (!c || c.get) continue;
|
|
219
222
|
walkAffectsScope(c.value, t, o, r, s);
|
|
@@ -221,6 +224,7 @@ s) {
|
|
|
221
224
|
} else {
|
|
222
225
|
const e = Reflect.ownKeys(n);
|
|
223
226
|
for (let f = 0, c = e.length; f < c; f++) {
|
|
227
|
+
if (e[f] === $OWNER) continue;
|
|
224
228
|
const c = Object.getOwnPropertyDescriptor(n, e[f]);
|
|
225
229
|
if (!c || c.get) continue;
|
|
226
230
|
walkAffectsScope(c.value, t, o, r, s);
|
|
@@ -252,18 +256,18 @@ s) {
|
|
|
252
256
|
// Callers guard on `pendingCheckActive`, which only flips inside
|
|
253
257
|
// isPending() — the verdict layer is loaded and its hook installed.
|
|
254
258
|
const o = e[STORE_NODE]?.[$AFFECTS];
|
|
255
|
-
if (o?.t) GlobalQueue.
|
|
259
|
+
if (o?.o?.t) GlobalQueue.Et(o);
|
|
256
260
|
if (affectsScopes.size) {
|
|
257
261
|
// Chained backings (§7b): a wrapper's STORE_VALUE can be another store's
|
|
258
262
|
// proxy — marks cover by identity of the BASE raw, so resolve the chain
|
|
259
263
|
// and check every identity along it.
|
|
260
264
|
let r = e[STORE_VALUE];
|
|
261
265
|
for (const [e, s] of affectsScopes) {
|
|
262
|
-
if (e !== o && e.t && (s.key === undefined || s.key === t)) {
|
|
266
|
+
if (e !== o && e.o?.t && (s.key === undefined || s.key === t)) {
|
|
263
267
|
let t = r;
|
|
264
268
|
for (;;) {
|
|
265
269
|
if (s.scope.has(t)) {
|
|
266
|
-
GlobalQueue.
|
|
270
|
+
GlobalQueue.Et(e);
|
|
267
271
|
break;
|
|
268
272
|
}
|
|
269
273
|
const o = t?.[$TARGET];
|
|
@@ -292,7 +296,7 @@ s) {
|
|
|
292
296
|
const t = affectsScopes.get(e);
|
|
293
297
|
if (!t) return;
|
|
294
298
|
affectsScopes.delete(e);
|
|
295
|
-
for (let e = 0; e < t.inherited.length; e++) GlobalQueue.
|
|
299
|
+
for (let e = 0; e < t.inherited.length; e++) GlobalQueue.N(t.inherited[e]);
|
|
296
300
|
};
|
|
297
301
|
if (t === undefined) {
|
|
298
302
|
const t = nextAffectsNodeResolver(e, $AFFECTS);
|
|
@@ -302,7 +306,7 @@ s) {
|
|
|
302
306
|
inherited: []
|
|
303
307
|
});
|
|
304
308
|
const r = [ t ];
|
|
305
|
-
walkAffectsScope(e[$PROXY], o, r, e.fam
|
|
309
|
+
walkAffectsScope(e[$PROXY], o, r, e.fam, new Set);
|
|
306
310
|
return r;
|
|
307
311
|
}
|
|
308
312
|
const o = e.n?.[t] ?? nextAffectsNodeResolver(e, t);
|
|
@@ -322,4 +326,4 @@ s) {
|
|
|
322
326
|
return [ o ];
|
|
323
327
|
}
|
|
324
328
|
|
|
325
|
-
export { $AFFECTS, $PROXY, $TARGET, $TRACK, STORE_HAS, STORE_NODE, STORE_VALUE, affectsScopesLive, getStoreAffectsNodes, getWriteOverride, inheritAffectsMarks, isRawValue, isWrappable, markRawIngest, markRawOne, nextAffectsNodeResolver, nextOptimisticViewResolver, ownEnumerableKeys, rawValuesUsed, setNextAffectsNodeResolver, setNextOptimisticViewResolver, setWriteOverride, witnessAffectsMark };
|
|
329
|
+
export { $AFFECTS, $PROXY, $RECORD, $TARGET, $TRACK, STORE_HAS, STORE_NODE, STORE_VALUE, affectsScopesLive, getStoreAffectsNodes, getWriteOverride, inheritAffectsMarks, isRawValue, isWrappable, markRawIngest, markRawOne, nextAffectsNodeResolver, nextOptimisticViewResolver, ownEnumerableKeys, rawValuesUsed, setNextAffectsNodeResolver, setNextOptimisticViewResolver, setWriteOverride, witnessAffectsMark };
|