@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
|
@@ -137,6 +137,34 @@ const CONFIG_HAS_LANE = 1 << 10;
|
|
|
137
137
|
* (A17). Cleared at commit (the commit IS the reveal); subscribers masked
|
|
138
138
|
* during the hold are woken by finalizePureQueue's post-revert pass. */ const CONFIG_HELD_TRUTH = 1 << 17;
|
|
139
139
|
|
|
140
|
+
/** SLOT node (store leaf): created through `slotSignal` with `_host`/`_key`
|
|
141
|
+
* backrefs baked into the literal. The unobserved sweep dispatches these to
|
|
142
|
+
* the ONE shared hook (`setSlotUnobserved`) instead of a per-node closure
|
|
143
|
+
* held in a per-node extension — store mounts materialize one signal per
|
|
144
|
+
* touched leaf, so per-node allocations (options object, equals closure,
|
|
145
|
+
* unobserved closure, NodeExtension) were the measured create-floor bytes
|
|
146
|
+
* (warm dbmon profile: store node machinery ~36% + GC ~29%). */ const CONFIG_SLOT_NODE = 1 << 18;
|
|
147
|
+
|
|
148
|
+
/** Optimistic node whose own source arrived with a value DIFFERENT from its
|
|
149
|
+
* active override (A18 supersession, #3331). The override survives only as
|
|
150
|
+
* the displayed value — untracked reads and the applied frame keep it until
|
|
151
|
+
* the owning transaction commits — while the graph has already moved to the
|
|
152
|
+
* staged truth in `_pendingValue`: tracked readers see it and the corrected
|
|
153
|
+
* cascade is that transaction's held work. Set by the two own-source write
|
|
154
|
+
* paths (asyncWrite, transition-held recompute); cleared by a fresh optimistic
|
|
155
|
+
* write (a new override re-masks) and by the revert. */ const CONFIG_OVERRIDE_SUPERSEDED = 1 << 19;
|
|
156
|
+
|
|
157
|
+
/** In-flight async node whose inputs were PUBLISHED while it was pending: a
|
|
158
|
+
* batch or transaction committed with the node still `STATUS_PENDING` (an
|
|
159
|
+
* unobserved flight, #3305), so the inputs are on screen and the node's
|
|
160
|
+
* committed `_value` is stale against them. Governs read()'s reveal
|
|
161
|
+
* carve-out: a stale (render) reader in some OTHER transaction may show a
|
|
162
|
+
* foreign-held pending node's committed value — parallel transactions, no
|
|
163
|
+
* entanglement — only while that value is coherent with the visible frame,
|
|
164
|
+
* i.e. while the flight's inputs are themselves held (unpublished) and not
|
|
165
|
+
* lane-revealed. Set by `commitPendingNodes`; cleared when the node next
|
|
166
|
+
* enters pending fresh (a new flight from a settled state). */ const CONFIG_INPUTS_PUBLISHED = 1 << 21;
|
|
167
|
+
|
|
140
168
|
const STATUS_PENDING = 1 << 0;
|
|
141
169
|
|
|
142
170
|
const STATUS_ERROR = 1 << 1;
|
|
@@ -149,6 +177,9 @@ const EFFECT_USER = 2;
|
|
|
149
177
|
|
|
150
178
|
const EFFECT_TRACKED = 3;
|
|
151
179
|
|
|
180
|
+
/** OR-ed into the `type` a lane passes to its effect runners: lane runs
|
|
181
|
+
* apply ahead of their transaction and are exempt from ownership parking. */ const LANE_RUN = 4;
|
|
182
|
+
|
|
152
183
|
const NOT_PENDING = {};
|
|
153
184
|
|
|
154
185
|
const NO_SNAPSHOT = {};
|
|
@@ -181,4 +212,4 @@ const defaultContext = {};
|
|
|
181
212
|
* @internal
|
|
182
213
|
*/ const $REFRESH = Symbol("refresh");
|
|
183
214
|
|
|
184
|
-
export { $REFRESH, CONFIG_AUTHORITATIVE_OBSERVED, CONFIG_AUTHORITATIVE_READ, CONFIG_AUTO_DISPOSE, CONFIG_CHILDREN_FORBIDDEN, CONFIG_CHILD_COMPANIONS, CONFIG_DIRECT_COMMIT, CONFIG_FRESH_READ, CONFIG_FW_CHILDREN, CONFIG_HAS_COMPANIONS, CONFIG_HAS_LANE, CONFIG_HAS_SNAPSHOT, CONFIG_HELD_TRUTH, CONFIG_IN_SNAPSHOT_SCOPE, CONFIG_NO_SNAPSHOT, CONFIG_OPTIMISTIC, CONFIG_OWNED_WRITE, CONFIG_SYNC, CONFIG_TRANSPARENT, EFFECT_RENDER, EFFECT_TRACKED, EFFECT_USER, NOT_PENDING, NO_SNAPSHOT, OVERRIDE_UNDEFINED, REACTIVE_CHECK, REACTIVE_DIRTY, REACTIVE_DISPOSED, REACTIVE_IN_HEAP, REACTIVE_IN_HEAP_HEIGHT, REACTIVE_LAZY, REACTIVE_MANUAL_WRITE, REACTIVE_MISSED_WAKE, REACTIVE_NONE, REACTIVE_OPTIMISTIC_DIRTY, REACTIVE_REASK, REACTIVE_RECOMPUTING_DEPS, REACTIVE_SNAPSHOT_STALE, REACTIVE_ZOMBIE, STATUS_ERROR, STATUS_PENDING, STATUS_UNINITIALIZED, STORE_SNAPSHOT_PROPS, SUPPORTS_PROXY, defaultContext, unwrapOverride };
|
|
215
|
+
export { $REFRESH, CONFIG_AUTHORITATIVE_OBSERVED, CONFIG_AUTHORITATIVE_READ, CONFIG_AUTO_DISPOSE, CONFIG_CHILDREN_FORBIDDEN, CONFIG_CHILD_COMPANIONS, CONFIG_DIRECT_COMMIT, CONFIG_FRESH_READ, CONFIG_FW_CHILDREN, CONFIG_HAS_COMPANIONS, CONFIG_HAS_LANE, CONFIG_HAS_SNAPSHOT, CONFIG_HELD_TRUTH, CONFIG_INPUTS_PUBLISHED, CONFIG_IN_SNAPSHOT_SCOPE, CONFIG_NO_SNAPSHOT, CONFIG_OPTIMISTIC, CONFIG_OVERRIDE_SUPERSEDED, CONFIG_OWNED_WRITE, CONFIG_SLOT_NODE, CONFIG_SYNC, CONFIG_TRANSPARENT, EFFECT_RENDER, EFFECT_TRACKED, EFFECT_USER, LANE_RUN, NOT_PENDING, NO_SNAPSHOT, OVERRIDE_UNDEFINED, REACTIVE_CHECK, REACTIVE_DIRTY, REACTIVE_DISPOSED, REACTIVE_IN_HEAP, REACTIVE_IN_HEAP_HEIGHT, REACTIVE_LAZY, REACTIVE_MANUAL_WRITE, REACTIVE_MISSED_WAKE, REACTIVE_NONE, REACTIVE_OPTIMISTIC_DIRTY, REACTIVE_REASK, REACTIVE_RECOMPUTING_DEPS, REACTIVE_SNAPSHOT_STALE, REACTIVE_ZOMBIE, STATUS_ERROR, STATUS_PENDING, STATUS_UNINITIALIZED, STORE_SNAPSHOT_PROPS, SUPPORTS_PROXY, defaultContext, unwrapOverride };
|
|
@@ -29,11 +29,13 @@ import { getOwner } from "./owner.js";
|
|
|
29
29
|
if (!t) {
|
|
30
30
|
throw new NoOwnerError;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
// `undefined` alone means unset — a provided `null` is a value (no `??`).
|
|
33
|
+
let r = t.xe[e.id];
|
|
34
|
+
if (r === undefined) r = e.defaultValue;
|
|
35
|
+
if (r === undefined) {
|
|
34
36
|
throw new ContextNotFoundError;
|
|
35
37
|
}
|
|
36
|
-
return
|
|
38
|
+
return r;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
/**
|
|
@@ -44,24 +46,16 @@ import { getOwner } from "./owner.js";
|
|
|
44
46
|
* @throws `NoOwnerError` if there's no owner at the time of call.
|
|
45
47
|
*
|
|
46
48
|
* @internal
|
|
47
|
-
*/ function setContext(e, t,
|
|
48
|
-
if (!
|
|
49
|
+
*/ function setContext(e, t, r = getOwner()) {
|
|
50
|
+
if (!r) {
|
|
49
51
|
throw new NoOwnerError;
|
|
50
52
|
}
|
|
51
53
|
// We're creating a new object to avoid child context values being exposed to parent owners. If
|
|
52
54
|
// we don't do this, everything will be a singleton and all hell will break lose.
|
|
53
|
-
|
|
54
|
-
...
|
|
55
|
-
[e.id]:
|
|
55
|
+
r.xe = {
|
|
56
|
+
...r.xe,
|
|
57
|
+
[e.id]: t === undefined ? e.defaultValue : t
|
|
56
58
|
};
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
function hasContext(e, t) {
|
|
60
|
-
return !isUndefined(t?.we[e.id]);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function isUndefined(e) {
|
|
64
|
-
return typeof e === "undefined";
|
|
65
|
-
}
|
|
66
|
-
|
|
67
61
|
export { createContext, getContext, setContext };
|