@solidjs/signals 0.11.3 → 0.12.0
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 +32 -20
- package/dist/node.cjs +332 -327
- package/dist/prod.js +13 -13
- package/dist/types/core/core.d.ts +9 -3
- package/dist/types/core/index.d.ts +2 -2
- package/dist/types/core/scheduler.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -148,6 +148,7 @@ let clock = 0;
|
|
|
148
148
|
let activeTransition = null;
|
|
149
149
|
let scheduled = false;
|
|
150
150
|
let projectionWriteActive = false;
|
|
151
|
+
function setOnUnhandledAsync(e) {}
|
|
151
152
|
function runLaneEffects(e) {
|
|
152
153
|
for (const t of activeLanes) {
|
|
153
154
|
if (t.k || t.U.size > 0) continue;
|
|
@@ -164,7 +165,7 @@ function setProjectionWriteActive(e) {
|
|
|
164
165
|
function schedule() {
|
|
165
166
|
if (scheduled) return;
|
|
166
167
|
scheduled = true;
|
|
167
|
-
if (!globalQueue.H) queueMicrotask(flush);
|
|
168
|
+
if (!globalQueue.H && !projectionWriteActive) queueMicrotask(flush);
|
|
168
169
|
}
|
|
169
170
|
class Queue {
|
|
170
171
|
i = null;
|
|
@@ -624,6 +625,10 @@ function handleAsync(e, t, n) {
|
|
|
624
625
|
e = n;
|
|
625
626
|
t = true;
|
|
626
627
|
} else if (!n.done) asyncWrite(n.value, iterate);
|
|
628
|
+
else {
|
|
629
|
+
schedule();
|
|
630
|
+
flush();
|
|
631
|
+
}
|
|
627
632
|
},
|
|
628
633
|
e => {
|
|
629
634
|
if (!r) handleError(e);
|
|
@@ -1142,7 +1147,7 @@ function updateIfNecessary(e) {
|
|
|
1142
1147
|
}
|
|
1143
1148
|
}
|
|
1144
1149
|
}
|
|
1145
|
-
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.X && e.J < clock)) {
|
|
1150
|
+
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.X && e.J < clock && !e.Ie)) {
|
|
1146
1151
|
recompute(e);
|
|
1147
1152
|
}
|
|
1148
1153
|
e.O = REACTIVE_NONE | (e.O & REACTIVE_SNAPSHOT_STALE);
|
|
@@ -1236,19 +1241,14 @@ function optimisticComputed(e, t, n) {
|
|
|
1236
1241
|
function isEqual(e, t) {
|
|
1237
1242
|
return e === t;
|
|
1238
1243
|
}
|
|
1239
|
-
|
|
1240
|
-
function setStrictRead(e) {
|
|
1241
|
-
const t = strictRead;
|
|
1242
|
-
strictRead = e;
|
|
1243
|
-
return t;
|
|
1244
|
-
}
|
|
1245
|
-
function untrack(e) {
|
|
1244
|
+
function untrack(e, t) {
|
|
1246
1245
|
if (!tracking && true) return e();
|
|
1246
|
+
const n = tracking;
|
|
1247
1247
|
tracking = false;
|
|
1248
1248
|
try {
|
|
1249
1249
|
return e();
|
|
1250
1250
|
} finally {
|
|
1251
|
-
tracking =
|
|
1251
|
+
tracking = n;
|
|
1252
1252
|
}
|
|
1253
1253
|
}
|
|
1254
1254
|
function read(e) {
|
|
@@ -1343,7 +1343,7 @@ function read(e) {
|
|
|
1343
1343
|
}
|
|
1344
1344
|
}
|
|
1345
1345
|
return !t ||
|
|
1346
|
-
currentOptimisticLane !== null ||
|
|
1346
|
+
(currentOptimisticLane !== null && (e._e || e.ie || n === e || !!(n.Ee & STATUS_PENDING))) ||
|
|
1347
1347
|
e.ae === NOT_PENDING ||
|
|
1348
1348
|
(stale && e.ne && activeTransition !== e.ne)
|
|
1349
1349
|
? e.fe
|
|
@@ -1810,7 +1810,6 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1810
1810
|
storeSetter(new Proxy(s, writeTraps), i => {
|
|
1811
1811
|
const r = handleAsync(t, e(i), e => {
|
|
1812
1812
|
e !== i && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
|
|
1813
|
-
setSignal(t, undefined);
|
|
1814
1813
|
});
|
|
1815
1814
|
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(s);
|
|
1816
1815
|
});
|
|
@@ -2882,6 +2881,7 @@ function flattenArray(e, t = [], n) {
|
|
|
2882
2881
|
}
|
|
2883
2882
|
export {
|
|
2884
2883
|
$PROXY,
|
|
2884
|
+
$REFRESH,
|
|
2885
2885
|
$TARGET,
|
|
2886
2886
|
$TRACK,
|
|
2887
2887
|
ContextNotFoundError,
|
|
@@ -2932,8 +2932,8 @@ export {
|
|
|
2932
2932
|
resolve,
|
|
2933
2933
|
runWithOwner,
|
|
2934
2934
|
setContext,
|
|
2935
|
+
setOnUnhandledAsync,
|
|
2935
2936
|
setSnapshotCapture,
|
|
2936
|
-
setStrictRead,
|
|
2937
2937
|
snapshot,
|
|
2938
2938
|
storePath,
|
|
2939
2939
|
untrack
|
|
@@ -24,12 +24,18 @@ export declare function optimisticSignal<T>(v: T, options?: NodeOptions<T>): Sig
|
|
|
24
24
|
export declare function optimisticComputed<T>(fn: (prev?: T) => T | PromiseLike<T> | AsyncIterable<T>, initialValue?: T, options?: NodeOptions<T>): Computed<T>;
|
|
25
25
|
export declare function isEqual<T>(a: T, b: T): boolean;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* When set to a component name string, any reactive read that is not inside a nested tracking
|
|
28
|
+
* scope will log a dev-mode warning. Managed automatically by `untrack(fn, strictReadLabel)`.
|
|
29
29
|
*/
|
|
30
30
|
export declare let strictRead: string | false;
|
|
31
31
|
export declare function setStrictRead(v: string | false): string | false;
|
|
32
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Executes `fn` without tracking reactive dependencies.
|
|
34
|
+
*
|
|
35
|
+
* Pass a `strictReadLabel` string to enable strict-read warnings: any reactive read inside `fn`
|
|
36
|
+
* that is not inside a nested tracking scope will log a warning in dev mode.
|
|
37
|
+
*/
|
|
38
|
+
export declare function untrack<T>(fn: () => T, strictReadLabel?: string | false): T;
|
|
33
39
|
export declare function read<T>(el: Signal<T> | Computed<T>): T;
|
|
34
40
|
export declare function setSignal<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)): T;
|
|
35
41
|
export declare function runWithOwner<T>(owner: Owner | null, fn: () => T): T;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { ContextNotFoundError, NoOwnerError, NotReadyError } from "./error.js";
|
|
2
|
-
export { isEqual, untrack, runWithOwner, computed, signal, read, setSignal, optimisticSignal, optimisticComputed, isPending, latest, refresh, isRefreshing, staleValues, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots,
|
|
2
|
+
export { isEqual, untrack, runWithOwner, computed, signal, read, setSignal, optimisticSignal, optimisticComputed, isPending, latest, refresh, isRefreshing, staleValues, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots, } from "./core.js";
|
|
3
3
|
export { createOwner, createRoot, dispose, getNextChildId, getObserver, getOwner, isDisposed, onCleanup, peekNextChildId } from "./owner.js";
|
|
4
4
|
export { createContext, getContext, setContext, type Context, type ContextRecord } from "./context.js";
|
|
5
5
|
export { handleAsync } from "./async.js";
|
|
6
6
|
export type { Computed, Disposable, FirewallSignal, Link, Owner, Root, Signal, NodeOptions } from "./types.js";
|
|
7
7
|
export { effect, trackedEffect, type Effect, type TrackedEffect } from "./effect.js";
|
|
8
8
|
export { action } from "./action.js";
|
|
9
|
-
export { flush, Queue, GlobalQueue, trackOptimisticStore, type IQueue, type QueueCallback } from "./scheduler.js";
|
|
9
|
+
export { flush, Queue, GlobalQueue, trackOptimisticStore, setOnUnhandledAsync, type IQueue, type QueueCallback } from "./scheduler.js";
|
|
10
10
|
export * from "./constants.js";
|
|
@@ -8,6 +8,7 @@ export declare const zombieQueue: Heap;
|
|
|
8
8
|
export declare let clock: number;
|
|
9
9
|
export declare let activeTransition: Transition | null;
|
|
10
10
|
export declare let projectionWriteActive: boolean;
|
|
11
|
+
export declare function setOnUnhandledAsync(fn: (() => void) | null): void;
|
|
11
12
|
export declare function setProjectionWriteActive(value: boolean): void;
|
|
12
13
|
export type QueueCallback = (type: number) => void;
|
|
13
14
|
type QueueStub = {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ContextNotFoundError, NoOwnerError, NotReadyError, action, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, onCleanup, isDisposed, getObserver, isEqual, untrack, isPending, latest, isRefreshing, refresh, SUPPORTS_PROXY, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots,
|
|
1
|
+
export { $REFRESH, ContextNotFoundError, NoOwnerError, NotReadyError, action, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, onCleanup, isDisposed, getObserver, isEqual, untrack, isPending, latest, isRefreshing, refresh, SUPPORTS_PROXY, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots, setOnUnhandledAsync, } from "./core/index.js";
|
|
2
2
|
export type { Owner, Context, ContextRecord, IQueue } from "./core/index.js";
|
|
3
3
|
export * from "./signals.js";
|
|
4
4
|
export { mapArray, repeat, type Maybe } from "./map.js";
|