@solidjs/signals 0.0.8 → 0.0.9
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 +75 -45
- package/dist/node.cjs +283 -254
- package/dist/prod.js +281 -253
- package/dist/types/core/constants.d.ts +1 -2
- package/dist/types/core/core.d.ts +6 -9
- package/dist/types/core/effect.d.ts +7 -2
- package/dist/types/core/flags.d.ts +3 -0
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
export declare const STATE_CLEAN = 0;
|
|
8
8
|
export declare const STATE_CHECK = 1;
|
|
9
9
|
export declare const STATE_DIRTY = 2;
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const STATE_DISPOSED = 4;
|
|
10
|
+
export declare const STATE_DISPOSED = 3;
|
|
12
11
|
export declare const EFFECT_PURE = 0;
|
|
13
12
|
export declare const EFFECT_RENDER = 1;
|
|
14
13
|
export declare const EFFECT_USER = 2;
|
|
@@ -59,6 +59,7 @@ export declare class Computation<T = any> extends Owner implements SourceType, O
|
|
|
59
59
|
_sources: SourceType[] | null;
|
|
60
60
|
_observers: ObserverType[] | null;
|
|
61
61
|
_value: T | undefined;
|
|
62
|
+
_error: unknown;
|
|
62
63
|
_compute: null | ((p?: T) => T);
|
|
63
64
|
_name: string | undefined;
|
|
64
65
|
_equals: false | ((a: T, b: T) => boolean);
|
|
@@ -140,22 +141,18 @@ export declare function untrack<T>(fn: () => T): T;
|
|
|
140
141
|
*/
|
|
141
142
|
export declare function hasUpdated(fn: () => any): boolean;
|
|
142
143
|
/**
|
|
143
|
-
* Returns true if the given function contains async signals
|
|
144
|
+
* Returns true if the given function contains async signals are out of date.
|
|
144
145
|
*/
|
|
145
|
-
export declare function
|
|
146
|
-
export type PossiblyResolved<T> = T extends Object ? RecursivePartial<T> : T;
|
|
147
|
-
export type RecursivePartial<T> = {
|
|
148
|
-
[P in keyof T]?: PossiblyResolved<T[P]>;
|
|
149
|
-
};
|
|
146
|
+
export declare function isStale(fn: () => any): boolean;
|
|
150
147
|
/**
|
|
151
148
|
* Attempts to resolve value of expression synchronously returning the last resolved value for any async computation.
|
|
152
149
|
*/
|
|
153
|
-
export declare function
|
|
150
|
+
export declare function latest<T>(fn: () => T): T;
|
|
154
151
|
export declare function catchError(fn: () => void): unknown | undefined;
|
|
155
152
|
/**
|
|
156
153
|
* A convenient wrapper that calls `compute` with the `owner` and `observer` and is guaranteed
|
|
157
154
|
* to reset the global context after the computation is finished even if an error is thrown.
|
|
158
155
|
*/
|
|
159
|
-
export declare function compute<T>(owner: Owner | null,
|
|
160
|
-
export declare function compute<T>(owner: Owner | null,
|
|
156
|
+
export declare function compute<T>(owner: Owner | null, fn: (val: T) => T, observer: Computation<T>): T;
|
|
157
|
+
export declare function compute<T>(owner: Owner | null, fn: (val: undefined) => T, observer: null): T;
|
|
161
158
|
export {};
|
|
@@ -8,13 +8,13 @@ import { type IQueue } from "./scheduler.js";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class Effect<T = any> extends Computation<T> {
|
|
10
10
|
_effect: (val: T, prev: T | undefined) => void | (() => void);
|
|
11
|
-
|
|
11
|
+
_onerror: ((err: unknown) => void | (() => void)) | undefined;
|
|
12
12
|
_cleanup: (() => void) | undefined;
|
|
13
13
|
_modified: boolean;
|
|
14
14
|
_prevValue: T | undefined;
|
|
15
15
|
_type: typeof EFFECT_RENDER | typeof EFFECT_USER;
|
|
16
16
|
_queue: IQueue;
|
|
17
|
-
constructor(initialValue: T, compute: () => T, effect: (val: T, prev: T | undefined) => void | (() => void), error?: (err: unknown) => void | (() => void), options?: SignalOptions<T> & {
|
|
17
|
+
constructor(initialValue: T, compute: (val?: T) => T, effect: (val: T, prev: T | undefined) => void | (() => void), error?: (err: unknown) => void | (() => void), options?: SignalOptions<T> & {
|
|
18
18
|
render?: boolean;
|
|
19
19
|
defer?: boolean;
|
|
20
20
|
});
|
|
@@ -29,3 +29,8 @@ export declare class EagerComputation<T = any> extends Computation<T> {
|
|
|
29
29
|
constructor(initialValue: T, compute: () => T, options?: SignalOptions<T>);
|
|
30
30
|
_notify(state: number, skipQueue?: boolean): void;
|
|
31
31
|
}
|
|
32
|
+
export declare class ProjectionComputation extends Computation {
|
|
33
|
+
_queue: IQueue;
|
|
34
|
+
constructor(compute: () => void);
|
|
35
|
+
_notify(state: number, skipQueue?: boolean): void;
|
|
36
|
+
}
|
|
@@ -5,4 +5,7 @@ export declare const ERROR: unique symbol;
|
|
|
5
5
|
export declare const LOADING_OFFSET = 1;
|
|
6
6
|
export declare const LOADING_BIT: number;
|
|
7
7
|
export declare const LOADING: unique symbol;
|
|
8
|
+
export declare const UNINITIALIZED_OFFSET = 2;
|
|
9
|
+
export declare const UNINITIALIZED_BIT: number;
|
|
10
|
+
export declare const UNINITIALIZED: unique symbol;
|
|
8
11
|
export declare const DEFAULT_FLAGS: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ContextNotFoundError, NoOwnerError, NotReadyError, type ErrorHandler } from "./error.js";
|
|
2
2
|
export { Owner, createContext, getContext, setContext, hasContext, getOwner, onCleanup, type Context, type ContextRecord, type Disposable } from "./owner.js";
|
|
3
|
-
export { Computation, getObserver, isEqual, untrack, getClock, hasUpdated,
|
|
3
|
+
export { Computation, getObserver, isEqual, untrack, getClock, hasUpdated, isStale, latest, catchError, UNCHANGED, compute, type SignalOptions } from "./core.js";
|
|
4
4
|
export { Effect, EagerComputation } from "./effect.js";
|
|
5
5
|
export { flushSync, createBoundary, type IQueue, Queue } from "./scheduler.js";
|
|
6
6
|
export { createSuspense } from "./suspense.js";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, Queue, createContext, flatten, flushSync, createBoundary, getContext, setContext, hasContext, getOwner, onCleanup, getObserver, isEqual, untrack, hasUpdated,
|
|
1
|
+
export { Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, Queue, createContext, flatten, flushSync, createBoundary, getContext, setContext, hasContext, getOwner, onCleanup, getObserver, isEqual, untrack, hasUpdated, isStale, latest, catchError, createSuspense, SUPPORTS_PROXY } from "./core/index.js";
|
|
2
2
|
export type { ErrorHandler, SignalOptions, Context, ContextRecord, Disposable, IQueue } from "./core/index.js";
|
|
3
3
|
export { mapArray, repeat, type Maybe } from "./map.js";
|
|
4
4
|
export * from "./signals.js";
|