@webkrafters/react-observable-context 4.1.0-alpha.3 → 4.1.0-rc.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.
@@ -3,7 +3,7 @@ export type Listener<T extends import("../../../types").State> = import("../../.
3
3
  export type State = import("../../../types").State;
4
4
  export type StoreInternal<T extends import("../../../types").State> = import("../../../types").StoreInternal<T>;
5
5
  declare function useStateManager<T extends import("../../../types").State>(initStateValue: T): {
6
- select: (clientId: string, ...propertyPaths?: import("../../../types").PropertyPathTokens) => {
6
+ select: (clientId: string, ...propertyPaths?: string[]) => {
7
7
  [propertyPaths: string]: Readonly<any>;
8
8
  };
9
9
  state: T;
@@ -12,10 +12,10 @@ export type State = import("../../../types").State;
12
12
  export type MutableRefObject<T> = import('react').MutableRefObject<T>;
13
13
  import _setState from "../../set-state";
14
14
  declare function useStore<T extends import("../../../types").State>(prehooks: Prehooks<T>, value: T, storage?: IStorage<T>): {
15
- getState: (clientId: string, ...propertyPaths?: import("../../../types").PropertyPathTokens) => {
15
+ getState: (clientId: string, ...propertyPaths?: string[]) => {
16
16
  [propertyPaths: string]: Readonly<any>;
17
17
  };
18
- resetState: (propertyPaths?: any[]) => void;
18
+ resetState: (propertyPaths?: string[]) => void;
19
19
  setState: (changes: import("../../../types").UpdatePayload<import("../../../types").PartialState<T>>) => void;
20
20
  subscribe: (listener: import("../../../types").Listener<T>) => VoidFunction;
21
21
  unlinkCache: (clientId: string) => void;
@@ -70,7 +70,7 @@ export type SelectorMap<T extends import("../types").State> = {
70
70
  export type StoreInternal<T extends import("../types").State> = import("../types").StoreInternal<T>;
71
71
  export type PartialStore<T extends import("../types").State> = {
72
72
  data?: import("../types").Data;
73
- resetState?: (propertyPaths?: any[]) => void;
73
+ resetState?: (propertyPaths?: string[]) => void;
74
74
  setState?: (changes: import("../types").UpdatePayload<import("../types").PartialState<T>>) => void;
75
75
  };
76
76
  export type Store<T extends import("../types").State> = import("../types").Store<T>;
package/dist/types.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  declare const _default: any;
2
2
  export default _default;
3
- export type BaseType = any[] | {
3
+ export type BaseType = boolean | any[] | {
4
4
  [x: string]: any;
5
- } | Scalar;
5
+ } | KeyType;
6
6
  export type Data = {
7
7
  [selectorKey: string]: Readonly<any>;
8
8
  };
@@ -18,6 +18,7 @@ export type IStore = {
18
18
  setState: NonReactUsageReport;
19
19
  subscribe: NonReactUsageReport;
20
20
  };
21
+ export type KeyType = number | string | symbol;
21
22
  export type Listener<T extends State> = (changes: UpdatePayload<PartialState<T>>) => void;
22
23
  export type NonReactUsageReport = () => never;
23
24
  export type PartialState<T extends State> = { [K in keyof T]?: T[K]; };
@@ -36,29 +37,16 @@ export type PropertyInfo<T extends any[] | State> = {
36
37
  source: T;
37
38
  value: any;
38
39
  };
39
- export type PropertyPath<T extends State> = keyof T | KeyType | KeyType[];
40
- export type PropertyPathTokens = Array<KeyType>;
41
- export type Scalar = boolean | KeyType;
42
- export type KeyType = number | string | symbol;
43
- export type SelectorMap<T extends State> = {
44
- [dataPropKey: string]: PropertyPath<T>;
45
- [dataPropKey: number]: PropertyPath<T>;
46
- [dataPropKey: symbol]: PropertyPath<T>;
47
- } & {
48
- [dataPropKey: string]: "@@STATE" | ["@@STATE"];
49
- [dataPropKey: number]: "@@STATE" | ["@@STATE"];
50
- [dataPropKey: symbol]: "@@STATE" | ["@@STATE"];
51
- };
52
40
  export type State = {
53
41
  [x: string]: any;
54
42
  [x: number]: any;
55
43
  [x: symbol]: any;
56
44
  };
57
45
  export type StoreInternal<T extends State> = {
58
- resetState: (propertyPaths?: any[]) => void;
46
+ resetState: (propertyPaths?: string[]) => void;
59
47
  setState: (changes: UpdatePayload<PartialState<T>>) => void;
60
48
  } & {
61
- getState: (clientId: string, ...propertyPaths?: PropertyPathTokens) => {
49
+ getState: (clientId: string, ...propertyPaths?: string[]) => {
62
50
  [propertyPaths: string]: Readonly<any>;
63
51
  };
64
52
  subscribe: (listener: Listener<T>) => Unsubscribe;
@@ -66,7 +54,7 @@ export type StoreInternal<T extends State> = {
66
54
  };
67
55
  export type Store<T extends State> = {
68
56
  data: Data;
69
- resetState: (propertyPaths?: PropertyPath[]) => void;
57
+ resetState: (propertyPaths?: string[]) => void;
70
58
  setState: (changes: UpdatePayload<PartialState<T>>) => void;
71
59
  };
72
60
  export type UpdateStats = {
package/package.json CHANGED
@@ -133,5 +133,5 @@
133
133
  "test:watch": "eslint --fix && jest --updateSnapshot --watchAll"
134
134
  },
135
135
  "types": "dist/main/index.d.ts",
136
- "version": "4.1.0-alpha.3"
136
+ "version": "4.1.0-rc.0"
137
137
  }