floppy-disk 3.5.0 → 3.5.1

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 CHANGED
@@ -96,6 +96,8 @@ function PlantDetail({ id }) {
96
96
  }
97
97
  ```
98
98
 
99
+ <br>
100
+
99
101
  ---
100
102
 
101
103
  Read the docs → https://floppy-disk.vercel.app
@@ -1,4 +1,4 @@
1
- import { type InitStoreOptions, type SetState } from "../vanilla.mjs";
1
+ import { type InitStoreOptions, type SetStateInput } from "../vanilla.mjs";
2
2
  /**
3
3
  * Represents the state of a mutation.
4
4
  *
@@ -118,7 +118,7 @@ export declare const createMutation: <TData, TVariable = undefined, TError = Err
118
118
  * - Intended for advanced use cases.
119
119
  * - Prefer using provided mutation actions (`execute`, `reset`) instead.
120
120
  */
121
- setState: (value: SetState<MutationState<TData, TVariable, TError>>) => void;
121
+ setState: (value: SetStateInput<MutationState<TData, TVariable, TError>>) => void;
122
122
  /**
123
123
  * Executes the mutation.
124
124
  *
@@ -1,4 +1,4 @@
1
- import { type InitStoreOptions, type SetState } from "../vanilla.mjs";
1
+ import { type InitStoreOptions, type SetStateInput } from "../vanilla.mjs";
2
2
  import type { StoreKey } from "./create-stores.mjs";
3
3
  /**
4
4
  * Represents the state of a query.
@@ -347,7 +347,7 @@ export declare const createQuery: <TData, TVariable extends StoreKey = never, TE
347
347
  subscribe: (subscriber: import("../vanilla.d.mts").Subscriber<QueryState<TData, TError>>) => () => void;
348
348
  getSubscribers: () => Set<import("../vanilla.d.mts").Subscriber<QueryState<TData, TError>>>;
349
349
  getState: () => QueryState<TData, TError>;
350
- setState: (value: SetState<QueryState<TData, TError>>) => void;
350
+ setState: (value: SetStateInput<QueryState<TData, TError>>) => void;
351
351
  }) & {
352
352
  /**
353
353
  * Executes all query instances.
@@ -48,7 +48,7 @@ export declare const createStores: <TState extends Record<string, any>, TKey ext
48
48
  initialState?: Partial<TState>;
49
49
  }) => TState) & {
50
50
  delete: () => boolean;
51
- setState: (value: import("../vanilla.d.mts").SetState<TState>) => void;
51
+ setState: (value: import("../vanilla.d.mts").SetStateInput<TState>) => void;
52
52
  getState: () => TState;
53
53
  subscribe: (subscriber: import("../vanilla.d.mts").Subscriber<TState>) => () => void;
54
54
  getSubscribers: () => Set<import("../vanilla.d.mts").Subscriber<TState>>;
@@ -1,11 +1,4 @@
1
- /**
2
- * Represents a partial state update.
3
- *
4
- * Can be either:
5
- * - A partial object to merge into the current state
6
- * - A function that receives the current state and returns a partial update
7
- */
8
- export type SetState<TState> = Partial<TState> | ((state: TState) => Partial<TState>);
1
+ export type SetStateInput<TState> = Partial<TState> | ((state: TState) => Partial<TState>);
9
2
  /**
10
3
  * A subscriber function that is called whenever the state updates.
11
4
  *
@@ -30,7 +23,7 @@ export type Subscriber<TState> = (state: TState, prevState: TState, changedKeys:
30
23
  * - By default, `setState` is **disabled on the server** to prevent accidental shared state between requests.
31
24
  */
32
25
  export type StoreApi<TState extends Record<string, any>> = {
33
- setState: (value: SetState<TState>) => void;
26
+ setState: (value: SetStateInput<TState>) => void;
34
27
  getState: () => TState;
35
28
  subscribe: (subscriber: Subscriber<TState>) => () => void;
36
29
  getSubscribers: () => Set<Subscriber<TState>>;
package/package.json CHANGED
@@ -2,7 +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.5.0",
5
+ "version": "3.5.1",
6
6
  "keywords": [
7
7
  "utilities",
8
8
  "store",
@@ -1,4 +1,4 @@
1
- import { type InitStoreOptions, type SetState } from "../vanilla.ts";
1
+ import { type InitStoreOptions, type SetStateInput } from "../vanilla.ts";
2
2
  /**
3
3
  * Represents the state of a mutation.
4
4
  *
@@ -118,7 +118,7 @@ export declare const createMutation: <TData, TVariable = undefined, TError = Err
118
118
  * - Intended for advanced use cases.
119
119
  * - Prefer using provided mutation actions (`execute`, `reset`) instead.
120
120
  */
121
- setState: (value: SetState<MutationState<TData, TVariable, TError>>) => void;
121
+ setState: (value: SetStateInput<MutationState<TData, TVariable, TError>>) => void;
122
122
  /**
123
123
  * Executes the mutation.
124
124
  *
@@ -1,4 +1,4 @@
1
- import { type InitStoreOptions, type SetState } from "../vanilla.ts";
1
+ import { type InitStoreOptions, type SetStateInput } from "../vanilla.ts";
2
2
  import type { StoreKey } from "./create-stores.ts";
3
3
  /**
4
4
  * Represents the state of a query.
@@ -347,7 +347,7 @@ export declare const createQuery: <TData, TVariable extends StoreKey = never, TE
347
347
  subscribe: (subscriber: import("../vanilla.ts").Subscriber<QueryState<TData, TError>>) => () => void;
348
348
  getSubscribers: () => Set<import("../vanilla.ts").Subscriber<QueryState<TData, TError>>>;
349
349
  getState: () => QueryState<TData, TError>;
350
- setState: (value: SetState<QueryState<TData, TError>>) => void;
350
+ setState: (value: SetStateInput<QueryState<TData, TError>>) => void;
351
351
  }) & {
352
352
  /**
353
353
  * Executes all query instances.
@@ -48,7 +48,7 @@ export declare const createStores: <TState extends Record<string, any>, TKey ext
48
48
  initialState?: Partial<TState>;
49
49
  }) => TState) & {
50
50
  delete: () => boolean;
51
- setState: (value: import("../vanilla.ts").SetState<TState>) => void;
51
+ setState: (value: import("../vanilla.ts").SetStateInput<TState>) => void;
52
52
  getState: () => TState;
53
53
  subscribe: (subscriber: import("../vanilla.ts").Subscriber<TState>) => () => void;
54
54
  getSubscribers: () => Set<import("../vanilla.ts").Subscriber<TState>>;
@@ -1,11 +1,4 @@
1
- /**
2
- * Represents a partial state update.
3
- *
4
- * Can be either:
5
- * - A partial object to merge into the current state
6
- * - A function that receives the current state and returns a partial update
7
- */
8
- export type SetState<TState> = Partial<TState> | ((state: TState) => Partial<TState>);
1
+ export type SetStateInput<TState> = Partial<TState> | ((state: TState) => Partial<TState>);
9
2
  /**
10
3
  * A subscriber function that is called whenever the state updates.
11
4
  *
@@ -30,7 +23,7 @@ export type Subscriber<TState> = (state: TState, prevState: TState, changedKeys:
30
23
  * - By default, `setState` is **disabled on the server** to prevent accidental shared state between requests.
31
24
  */
32
25
  export type StoreApi<TState extends Record<string, any>> = {
33
- setState: (value: SetState<TState>) => void;
26
+ setState: (value: SetStateInput<TState>) => void;
34
27
  getState: () => TState;
35
28
  subscribe: (subscriber: Subscriber<TState>) => () => void;
36
29
  getSubscribers: () => Set<Subscriber<TState>>;