@solidjs/signals 2.0.0-rc.6 → 2.0.0-rc.7
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.js +2033 -1291
- package/dist/node.cjs +1821 -2401
- package/dist/node.dev.cjs +13724 -0
- package/dist/prod/boundaries.js +3 -1
- package/dist/prod/core/async.js +6 -1
- package/dist/prod/core/attribution-hooks.js +3 -0
- package/dist/prod/core/constants.js +9 -1
- package/dist/prod/core/context.js +10 -16
- package/dist/prod/core/core.js +215 -139
- package/dist/prod/core/dev.js +2 -0
- package/dist/prod/core/effect.js +37 -28
- package/dist/prod/core/external.js +2 -2
- package/dist/prod/core/graph.js +35 -31
- package/dist/prod/core/heap.js +34 -40
- package/dist/prod/core/lanes.js +41 -27
- package/dist/prod/core/optimistic.js +42 -32
- package/dist/prod/core/owner.js +32 -32
- package/dist/prod/core/scheduler.js +140 -154
- package/dist/prod/core/verdict.js +31 -34
- package/dist/prod/index.js +0 -2
- package/dist/prod/map.js +104 -94
- package/dist/prod/signals.js +51 -34
- package/dist/prod/store/next/optimistic.js +153 -172
- package/dist/prod/store/next/reconcile.js +140 -288
- package/dist/prod/store/next/store.js +307 -237
- package/dist/prod/store/store.js +2 -2
- package/dist/types/core/attribution-hooks.d.ts +64 -0
- package/dist/types/core/attribution.d.ts +265 -9
- package/dist/types/core/constants.d.ts +8 -0
- package/dist/types/core/core.d.ts +12 -3
- package/dist/types/core/dev.d.ts +49 -8
- package/dist/types/core/heap.d.ts +5 -3
- package/dist/types/core/invariants.d.ts +1 -1
- package/dist/types/core/lanes.d.ts +10 -0
- package/dist/types/core/scheduler.d.ts +9 -4
- package/dist/types/signals.d.ts +10 -0
- package/dist/types/store/index.d.ts +3 -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 +3 -9
- package/dist/types/store/next/target.d.ts +20 -46
- package/dist/types/store/store.d.ts +14 -9
- package/dist/types-cjs/core/attribution-hooks.d.cts +64 -0
- package/dist/types-cjs/core/attribution.d.cts +265 -9
- package/dist/types-cjs/core/constants.d.cts +8 -0
- package/dist/types-cjs/core/core.d.cts +12 -3
- package/dist/types-cjs/core/dev.d.cts +49 -8
- package/dist/types-cjs/core/heap.d.cts +5 -3
- package/dist/types-cjs/core/invariants.d.cts +1 -1
- package/dist/types-cjs/core/lanes.d.cts +10 -0
- package/dist/types-cjs/core/scheduler.d.cts +9 -4
- package/dist/types-cjs/signals.d.cts +10 -0
- package/dist/types-cjs/store/index.d.cts +3 -6
- package/dist/types-cjs/store/next/optimistic.d.cts +4 -2
- package/dist/types-cjs/store/next/reconcile.d.cts +5 -12
- package/dist/types-cjs/store/next/store.d.cts +3 -9
- package/dist/types-cjs/store/next/target.d.cts +20 -46
- package/dist/types-cjs/store/store.d.cts +14 -9
- package/package.json +3 -2
- 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/store/next/patch-hooks.d.cts +0 -41
- package/dist/types-cjs/store/next/patch.d.cts +0 -91
package/dist/prod/boundaries.js
CHANGED
|
@@ -291,7 +291,9 @@ class CollectionQueue extends Queue {
|
|
|
291
291
|
if (t) {
|
|
292
292
|
const e = this.v.size === 0;
|
|
293
293
|
this.v.add(t);
|
|
294
|
-
if (e)
|
|
294
|
+
if (e) {
|
|
295
|
+
setSignal(this.D, true);
|
|
296
|
+
}
|
|
295
297
|
if (this.ee & STATUS_ERROR) {
|
|
296
298
|
setSignal(this._, unwrapStatusError(t.o?._));
|
|
297
299
|
}
|
package/dist/prod/core/async.js
CHANGED
|
@@ -290,7 +290,12 @@ function handleAsync(e, n, t) {
|
|
|
290
290
|
const s = resolveLane(e);
|
|
291
291
|
if (s) s.Oe.delete(e);
|
|
292
292
|
if (t) {
|
|
293
|
-
|
|
293
|
+
try {
|
|
294
|
+
t(r);
|
|
295
|
+
} catch (e) {
|
|
296
|
+
handleError(e);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
294
299
|
if (i) clearStatus(e, true);
|
|
295
300
|
} else if (e.o?.Pe !== undefined) {
|
|
296
301
|
// Optimistic node — resting OR covered by an active override — holds
|
|
@@ -137,6 +137,14 @@ 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
|
+
|
|
140
148
|
const STATUS_PENDING = 1 << 0;
|
|
141
149
|
|
|
142
150
|
const STATUS_ERROR = 1 << 1;
|
|
@@ -181,4 +189,4 @@ const defaultContext = {};
|
|
|
181
189
|
* @internal
|
|
182
190
|
*/ const $REFRESH = Symbol("refresh");
|
|
183
191
|
|
|
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 };
|
|
192
|
+
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_SLOT_NODE, 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 };
|
|
@@ -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.we[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.we = {
|
|
56
|
+
...r.we,
|
|
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 };
|