floppy-disk 3.3.0-beta.1 → 3.3.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/esm/react/create-mutation.d.mts +2 -0
- package/esm/react/create-query.d.mts +2 -0
- package/esm/react/create-store.d.mts +2 -0
- package/esm/react/create-stores.d.mts +2 -0
- package/esm/react/use-mutation.d.mts +2 -0
- package/package.json +1 -4
- package/react/create-mutation.d.ts +2 -0
- package/react/create-query.d.ts +2 -0
- package/react/create-store.d.ts +2 -0
- package/react/create-stores.d.ts +2 -0
- package/react/use-mutation.d.ts +2 -0
|
@@ -104,6 +104,8 @@ export type MutationOptions<TData, TVariable, TError = Error> = InitStoreOptions
|
|
|
104
104
|
*
|
|
105
105
|
* const { isPending } = useCreateUser();
|
|
106
106
|
* const result = await useCreateUser.execute({ name: 'John' });
|
|
107
|
+
*
|
|
108
|
+
* @see https://floppy-disk.vercel.app/docs/async/mutation
|
|
107
109
|
*/
|
|
108
110
|
export declare const createMutation: <TData, TVariable = undefined, TError = Error>(mutationFn: (variable: TVariable, stateBeforeExecute: MutationState<TData, TVariable, TError>) => Promise<TData>, options?: MutationOptions<TData, TVariable, TError>) => (() => MutationState<TData, TVariable, TError>) & {
|
|
109
111
|
subscribe: (subscriber: import("../vanilla.d.mts").Subscriber<MutationState<TData, TVariable, TError>>) => () => void;
|
|
@@ -161,6 +161,8 @@ export type QueryOptions<TData, TVariable extends Record<string, any>, TError =
|
|
|
161
161
|
* const state = useUserQuery();
|
|
162
162
|
* // ...
|
|
163
163
|
* }
|
|
164
|
+
*
|
|
165
|
+
* @see https://floppy-disk.vercel.app/docs/async/query
|
|
164
166
|
*/
|
|
165
167
|
export declare const createQuery: <TData, TVariable extends Record<string, any> = never, TError = Error>(queryFn: (variable: TVariable, currentState: QueryState<TData, TError>, variableHash: string) => Promise<TData>, options?: QueryOptions<TData, TVariable, TError>) => ((variable?: TVariable) => ((options?: {
|
|
166
168
|
/**
|
|
@@ -24,6 +24,8 @@ import { type InitStoreOptions } from "../vanilla.mjs";
|
|
|
24
24
|
* }
|
|
25
25
|
*
|
|
26
26
|
* useMyStore.setState({ foo: 2 }); // only components using foo will re-render
|
|
27
|
+
*
|
|
28
|
+
* @see https://floppy-disk.vercel.app/docs/sync/store
|
|
27
29
|
*/
|
|
28
30
|
export declare const createStore: <TState extends Record<string, any>>(initialState: TState, options?: InitStoreOptions<TState>) => ((options?: {
|
|
29
31
|
/**
|
|
@@ -29,6 +29,8 @@ import { type InitStoreOptions } from "../vanilla.mjs";
|
|
|
29
29
|
* const state = useUserStore();
|
|
30
30
|
* return <div>{state.name}</div>;
|
|
31
31
|
* }
|
|
32
|
+
*
|
|
33
|
+
* @see https://floppy-disk.vercel.app/docs/sync/stores
|
|
32
34
|
*/
|
|
33
35
|
export declare const createStores: <TState extends Record<string, any>, TKey extends Record<string, any>>(initialState: TState, options?: InitStoreOptions<TState>) => (key?: TKey) => ((options?: {
|
|
34
36
|
/**
|
|
@@ -20,6 +20,8 @@ import { type MutationOptions, type MutationState } from "./create-mutation.mjs"
|
|
|
20
20
|
* - If multiple executions triggered at the same time:
|
|
21
21
|
* - Only the latest execution is allowed to update the state.
|
|
22
22
|
* - Results from previous executions are ignored if a newer one exists.
|
|
23
|
+
*
|
|
24
|
+
* @see https://floppy-disk.vercel.app/docs/async/mutation
|
|
23
25
|
*/
|
|
24
26
|
export declare const useMutation: <TData, TVariable = undefined, TError = Error>(
|
|
25
27
|
/**
|
package/package.json
CHANGED
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
"name": "floppy-disk",
|
|
3
3
|
"description": "Lightweight unified state management for sync and async data.",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "3.3.0
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"tag": "beta"
|
|
8
|
-
},
|
|
5
|
+
"version": "3.3.0",
|
|
9
6
|
"keywords": [
|
|
10
7
|
"utilities",
|
|
11
8
|
"store",
|
|
@@ -104,6 +104,8 @@ export type MutationOptions<TData, TVariable, TError = Error> = InitStoreOptions
|
|
|
104
104
|
*
|
|
105
105
|
* const { isPending } = useCreateUser();
|
|
106
106
|
* const result = await useCreateUser.execute({ name: 'John' });
|
|
107
|
+
*
|
|
108
|
+
* @see https://floppy-disk.vercel.app/docs/async/mutation
|
|
107
109
|
*/
|
|
108
110
|
export declare const createMutation: <TData, TVariable = undefined, TError = Error>(mutationFn: (variable: TVariable, stateBeforeExecute: MutationState<TData, TVariable, TError>) => Promise<TData>, options?: MutationOptions<TData, TVariable, TError>) => (() => MutationState<TData, TVariable, TError>) & {
|
|
109
111
|
subscribe: (subscriber: import("../vanilla.ts").Subscriber<MutationState<TData, TVariable, TError>>) => () => void;
|
package/react/create-query.d.ts
CHANGED
|
@@ -161,6 +161,8 @@ export type QueryOptions<TData, TVariable extends Record<string, any>, TError =
|
|
|
161
161
|
* const state = useUserQuery();
|
|
162
162
|
* // ...
|
|
163
163
|
* }
|
|
164
|
+
*
|
|
165
|
+
* @see https://floppy-disk.vercel.app/docs/async/query
|
|
164
166
|
*/
|
|
165
167
|
export declare const createQuery: <TData, TVariable extends Record<string, any> = never, TError = Error>(queryFn: (variable: TVariable, currentState: QueryState<TData, TError>, variableHash: string) => Promise<TData>, options?: QueryOptions<TData, TVariable, TError>) => ((variable?: TVariable) => ((options?: {
|
|
166
168
|
/**
|
package/react/create-store.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ import { type InitStoreOptions } from "../vanilla.ts";
|
|
|
24
24
|
* }
|
|
25
25
|
*
|
|
26
26
|
* useMyStore.setState({ foo: 2 }); // only components using foo will re-render
|
|
27
|
+
*
|
|
28
|
+
* @see https://floppy-disk.vercel.app/docs/sync/store
|
|
27
29
|
*/
|
|
28
30
|
export declare const createStore: <TState extends Record<string, any>>(initialState: TState, options?: InitStoreOptions<TState>) => ((options?: {
|
|
29
31
|
/**
|
package/react/create-stores.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ import { type InitStoreOptions } from "../vanilla.ts";
|
|
|
29
29
|
* const state = useUserStore();
|
|
30
30
|
* return <div>{state.name}</div>;
|
|
31
31
|
* }
|
|
32
|
+
*
|
|
33
|
+
* @see https://floppy-disk.vercel.app/docs/sync/stores
|
|
32
34
|
*/
|
|
33
35
|
export declare const createStores: <TState extends Record<string, any>, TKey extends Record<string, any>>(initialState: TState, options?: InitStoreOptions<TState>) => (key?: TKey) => ((options?: {
|
|
34
36
|
/**
|
package/react/use-mutation.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ import { type MutationOptions, type MutationState } from "./create-mutation.ts";
|
|
|
20
20
|
* - If multiple executions triggered at the same time:
|
|
21
21
|
* - Only the latest execution is allowed to update the state.
|
|
22
22
|
* - Results from previous executions are ignored if a newer one exists.
|
|
23
|
+
*
|
|
24
|
+
* @see https://floppy-disk.vercel.app/docs/async/mutation
|
|
23
25
|
*/
|
|
24
26
|
export declare const useMutation: <TData, TVariable = undefined, TError = Error>(
|
|
25
27
|
/**
|