ccstate-vue 4.2.0 → 4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # ccstate-vue
2
2
 
3
+ ## 4.3.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [89d98a2]
8
+ - ccstate@4.3.0
9
+
3
10
  ## 4.2.0
4
11
 
5
12
  ### Patch Changes
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Store, Computed, State, Updater, Command } from 'ccstate';
1
+ import { Store, Computed, State, StateArg, Command } from 'ccstate';
2
2
  import { ShallowRef } from 'vue';
3
3
 
4
4
  declare const provideStore: (store: Store) => void;
@@ -6,7 +6,7 @@ declare const useStore: () => Store;
6
6
 
7
7
  declare function useGet<Value>(atom: Computed<Value> | State<Value>): Readonly<ShallowRef<Value>>;
8
8
 
9
- declare function useSet<T>(atom: State<T>): (value: T | Updater<T>) => void;
10
- declare function useSet<T, ARGS extends unknown[]>(atom: Command<T, ARGS>): (...args: ARGS) => T;
9
+ declare function useSet<T>(atom: State<T>): (value: StateArg<T>) => void;
10
+ declare function useSet<T, CommandArgs extends unknown[]>(atom: Command<T, CommandArgs>): (...args: CommandArgs) => T;
11
11
 
12
12
  export { provideStore, useGet, useSet, useStore };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Store, Computed, State, Updater, Command } from 'ccstate';
1
+ import { Store, Computed, State, StateArg, Command } from 'ccstate';
2
2
  import { ShallowRef } from 'vue';
3
3
 
4
4
  declare const provideStore: (store: Store) => void;
@@ -6,7 +6,7 @@ declare const useStore: () => Store;
6
6
 
7
7
  declare function useGet<Value>(atom: Computed<Value> | State<Value>): Readonly<ShallowRef<Value>>;
8
8
 
9
- declare function useSet<T>(atom: State<T>): (value: T | Updater<T>) => void;
10
- declare function useSet<T, ARGS extends unknown[]>(atom: Command<T, ARGS>): (...args: ARGS) => T;
9
+ declare function useSet<T>(atom: State<T>): (value: StateArg<T>) => void;
10
+ declare function useSet<T, CommandArgs extends unknown[]>(atom: Command<T, CommandArgs>): (...args: CommandArgs) => T;
11
11
 
12
12
  export { provideStore, useGet, useSet, useStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstate-vue",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "CCState Vue Hooks",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "vue": ">=3.2.0"
21
21
  },
22
22
  "dependencies": {
23
- "ccstate": "^4.2.0"
23
+ "ccstate": "^4.3.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@babel/preset-env": "^7.26.0",
package/src/useSet.ts CHANGED
@@ -1,22 +1,22 @@
1
1
  import { useStore } from './provider';
2
- import { type Command, type State, type Updater } from 'ccstate';
2
+ import { type Command, type State, type StateArg } from 'ccstate';
3
3
 
4
- export function useSet<T>(atom: State<T>): (value: T | Updater<T>) => void;
5
- export function useSet<T, ARGS extends unknown[]>(atom: Command<T, ARGS>): (...args: ARGS) => T;
6
- export function useSet<T, ARGS extends unknown[]>(
7
- atom: State<T> | Command<T, ARGS>,
8
- ): ((value: T | Updater<T>) => void) | ((...args: ARGS) => T) {
4
+ export function useSet<T>(atom: State<T>): (value: StateArg<T>) => void;
5
+ export function useSet<T, CommandArgs extends unknown[]>(atom: Command<T, CommandArgs>): (...args: CommandArgs) => T;
6
+ export function useSet<T, CommandArgs extends unknown[]>(
7
+ atom: State<T> | Command<T, CommandArgs>,
8
+ ): ((value: StateArg<T>) => void) | ((...args: CommandArgs) => T) {
9
9
  const store = useStore();
10
10
 
11
11
  if ('write' in atom) {
12
- return (...args: ARGS): T => {
12
+ return (...args: CommandArgs): T => {
13
13
  const ret = store.set(atom, ...args);
14
14
 
15
15
  return ret;
16
16
  };
17
17
  }
18
18
 
19
- return (value: T | Updater<T>) => {
19
+ return (value: StateArg<T>) => {
20
20
  store.set(atom, value);
21
21
  };
22
22
  }