@solidjs/signals 2.0.0-beta.13 → 2.0.0-beta.14
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/README.md +2 -3
- package/dist/dev.js +81 -23
- package/dist/node.cjs +712 -665
- package/dist/prod.js +481 -434
- package/dist/types/core/core.d.ts +4 -8
- package/dist/types/store/index.d.ts +1 -1
- package/dist/types/store/store.d.ts +6 -2
- package/dist/types-cjs/core/core.d.cts +4 -8
- package/dist/types-cjs/store/index.d.cts +1 -1
- package/dist/types-cjs/store/store.d.cts +6 -2
- package/package.json +1 -1
|
@@ -129,10 +129,8 @@ export declare function latest<T>(fn: () => T): T;
|
|
|
129
129
|
*
|
|
130
130
|
* Useful for showing inline transition indicators alongside the previous
|
|
131
131
|
* value (rather than swapping to a `<Loading>` fallback).
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* async source. If the source is on the Loading path for that read, the
|
|
135
|
-
* pending read follows that path instead of being treated as `false`.
|
|
132
|
+
* Because `fn` is read normally, `isPending` participates in Loading/SSR
|
|
133
|
+
* readiness the same way the read itself would.
|
|
136
134
|
*
|
|
137
135
|
* @example
|
|
138
136
|
* ```tsx
|
|
@@ -140,12 +138,10 @@ export declare function latest<T>(fn: () => T): T;
|
|
|
140
138
|
*
|
|
141
139
|
* <button disabled={pending()}>{pending() ? "Saving…" : "Save"}</button>
|
|
142
140
|
*
|
|
143
|
-
* <
|
|
144
|
-
* <button disabled={isPending(() => user(), true)}>Save</button>
|
|
145
|
-
* </Loading>
|
|
141
|
+
* <button disabled={isPending(() => user())}>Save</button>
|
|
146
142
|
* ```
|
|
147
143
|
*/
|
|
148
|
-
export declare function isPending(fn: () => any
|
|
144
|
+
export declare function isPending(fn: () => any): boolean;
|
|
149
145
|
/**
|
|
150
146
|
* Invalidates one reactive source, forcing it to re-execute even if its inputs
|
|
151
147
|
* haven't changed.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { Store, StoreSetter, StoreNode, StoreOptions, ProjectionOptions, NotWrappable, SolidStore } from "./store.js";
|
|
1
|
+
export type { Store, StoreReturn, ProjectionStoreReturn, StoreSetter, StoreNode, StoreOptions, ProjectionOptions, NotWrappable, SolidStore } from "./store.js";
|
|
2
2
|
export type { Merge, Omit } from "./utils.js";
|
|
3
3
|
export { isWrappable, createStore, $TRACK, $PROXY, $TARGET } from "./store.js";
|
|
4
4
|
export { createProjection } from "./projection.js";
|
|
@@ -17,6 +17,10 @@ export type Store<T> = Readonly<T>;
|
|
|
17
17
|
* whose derive function reconciles its return by `options.key`.
|
|
18
18
|
*/
|
|
19
19
|
export type StoreSetter<T> = (fn: (state: T) => T | void) => void;
|
|
20
|
+
/** Tuple returned by the plain `createStore(initialValue)` form. */
|
|
21
|
+
export type StoreReturn<T> = [get: Store<T>, set: StoreSetter<T>];
|
|
22
|
+
/** Tuple returned by the derived `createStore(fn, seed, options?)` form. */
|
|
23
|
+
export type ProjectionStoreReturn<T> = [get: Refreshable<Store<T>>, set: StoreSetter<T>];
|
|
20
24
|
/** Base options for store primitives. */
|
|
21
25
|
export interface StoreOptions {
|
|
22
26
|
/** Debug name (dev mode only) */
|
|
@@ -120,6 +124,6 @@ export declare function storeSetter<T extends object>(store: Store<T>, fn: (draf
|
|
|
120
124
|
*
|
|
121
125
|
* @returns `[store: Store<T>, setStore: StoreSetter<T>]`
|
|
122
126
|
*/
|
|
123
|
-
export declare function createStore<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>):
|
|
124
|
-
export declare function createStore<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions):
|
|
127
|
+
export declare function createStore<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): StoreReturn<T>;
|
|
128
|
+
export declare function createStore<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions): ProjectionStoreReturn<T>;
|
|
125
129
|
export {};
|
|
@@ -129,10 +129,8 @@ export declare function latest<T>(fn: () => T): T;
|
|
|
129
129
|
*
|
|
130
130
|
* Useful for showing inline transition indicators alongside the previous
|
|
131
131
|
* value (rather than swapping to a `<Loading>` fallback).
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* async source. If the source is on the Loading path for that read, the
|
|
135
|
-
* pending read follows that path instead of being treated as `false`.
|
|
132
|
+
* Because `fn` is read normally, `isPending` participates in Loading/SSR
|
|
133
|
+
* readiness the same way the read itself would.
|
|
136
134
|
*
|
|
137
135
|
* @example
|
|
138
136
|
* ```tsx
|
|
@@ -140,12 +138,10 @@ export declare function latest<T>(fn: () => T): T;
|
|
|
140
138
|
*
|
|
141
139
|
* <button disabled={pending()}>{pending() ? "Saving…" : "Save"}</button>
|
|
142
140
|
*
|
|
143
|
-
* <
|
|
144
|
-
* <button disabled={isPending(() => user(), true)}>Save</button>
|
|
145
|
-
* </Loading>
|
|
141
|
+
* <button disabled={isPending(() => user())}>Save</button>
|
|
146
142
|
* ```
|
|
147
143
|
*/
|
|
148
|
-
export declare function isPending(fn: () => any
|
|
144
|
+
export declare function isPending(fn: () => any): boolean;
|
|
149
145
|
/**
|
|
150
146
|
* Invalidates one reactive source, forcing it to re-execute even if its inputs
|
|
151
147
|
* haven't changed.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { Store, StoreSetter, StoreNode, StoreOptions, ProjectionOptions, NotWrappable, SolidStore } from "./store.cjs";
|
|
1
|
+
export type { Store, StoreReturn, ProjectionStoreReturn, StoreSetter, StoreNode, StoreOptions, ProjectionOptions, NotWrappable, SolidStore } from "./store.cjs";
|
|
2
2
|
export type { Merge, Omit } from "./utils.cjs";
|
|
3
3
|
export { isWrappable, createStore, $TRACK, $PROXY, $TARGET } from "./store.cjs";
|
|
4
4
|
export { createProjection } from "./projection.cjs";
|
|
@@ -17,6 +17,10 @@ export type Store<T> = Readonly<T>;
|
|
|
17
17
|
* whose derive function reconciles its return by `options.key`.
|
|
18
18
|
*/
|
|
19
19
|
export type StoreSetter<T> = (fn: (state: T) => T | void) => void;
|
|
20
|
+
/** Tuple returned by the plain `createStore(initialValue)` form. */
|
|
21
|
+
export type StoreReturn<T> = [get: Store<T>, set: StoreSetter<T>];
|
|
22
|
+
/** Tuple returned by the derived `createStore(fn, seed, options?)` form. */
|
|
23
|
+
export type ProjectionStoreReturn<T> = [get: Refreshable<Store<T>>, set: StoreSetter<T>];
|
|
20
24
|
/** Base options for store primitives. */
|
|
21
25
|
export interface StoreOptions {
|
|
22
26
|
/** Debug name (dev mode only) */
|
|
@@ -120,6 +124,6 @@ export declare function storeSetter<T extends object>(store: Store<T>, fn: (draf
|
|
|
120
124
|
*
|
|
121
125
|
* @returns `[store: Store<T>, setStore: StoreSetter<T>]`
|
|
122
126
|
*/
|
|
123
|
-
export declare function createStore<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>):
|
|
124
|
-
export declare function createStore<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions):
|
|
127
|
+
export declare function createStore<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): StoreReturn<T>;
|
|
128
|
+
export declare function createStore<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions): ProjectionStoreReturn<T>;
|
|
125
129
|
export {};
|
package/package.json
CHANGED