@webkrafters/react-observable-context 4.1.0 → 4.1.2

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.
@@ -16,7 +16,7 @@ declare function useStore<T extends import("../../../types").State>(prehooks: Pr
16
16
  [propertyPaths: string]: Readonly<any>;
17
17
  };
18
18
  resetState: (propertyPaths?: string[]) => void;
19
- setState: (changes: import("../../../types").UpdatePayload<import("../../../types").PartialState<T>>) => void;
19
+ setState: (changes: import("../../../types").Changes<T>) => void;
20
20
  state: T;
21
21
  subscribe: (listener: import("../../../types").Listener<T>) => VoidFunction;
22
22
  unlinkCache: (clientId: string) => void;
@@ -123,7 +123,7 @@ export type StoreRef<T extends import("../types").State> = {
123
123
  getState: () => T;
124
124
  } & {
125
125
  resetState: (propertyPaths?: string[]) => void;
126
- setState: (changes: import("../types").UpdatePayload<import("../types").PartialState<T>>) => void;
126
+ setState: (changes: import("../types").Changes<T>) => void;
127
127
  subscribe: (listener: import("../types").Listener<T>) => VoidFunction;
128
128
  };
129
129
  export type State = import("../types").State;
@@ -138,7 +138,7 @@ export type StoreInternal<T extends import("../types").State> = import("../types
138
138
  export type PartialStore<T extends import("../types").State> = {
139
139
  data?: import("../types").Data;
140
140
  resetState?: (propertyPaths?: string[]) => void;
141
- setState?: (changes: import("../types").UpdatePayload<import("../types").PartialState<T>>) => void;
141
+ setState?: (changes: import("../types").Changes<T>) => void;
142
142
  };
143
143
  export type Store<T extends import("../types").State> = import("../types").Store<T>;
144
144
  export type IStore = import("../types").IStore;
@@ -7,6 +7,6 @@ declare class AccessorCache<T extends import("../../types").State> {
7
7
  [propertyPaths: string]: Readonly<any>;
8
8
  };
9
9
  unlinkClient(clientId: string): void;
10
- watchSource(changes: import("../../types").UpdatePayload<import("../../types").PartialState<T>>): void;
10
+ watchSource(changes: import("../../types").Changes<T>): void;
11
11
  #private;
12
12
  }
@@ -106,7 +106,7 @@ var AccessorCache = function () {
106
106
  var _classPrivateMethodGe = _classPrivateMethodGet(this, _getOriginAt, _getOriginAt2).call(this, path),
107
107
  exists = _classPrivateMethodGe.exists,
108
108
  newAtomVal = _classPrivateMethodGe.value;
109
- if (path !== _constants.FULL_STATE_SELECTOR && exists && typeof newAtomVal === 'undefined' && !(0, _utils.getProperty)(originChanges, path).trail.length || (0, _lodash2["default"])(newAtomVal, atoms[path].value)) {
109
+ if (path !== _constants.FULL_STATE_SELECTOR && exists && (newAtomVal === null || newAtomVal === 'undefined') && !(0, _utils.getProperty)(originChanges, path).trail.length || (0, _lodash2["default"])(newAtomVal, atoms[path].value)) {
110
110
  continue;
111
111
  }
112
112
  atoms[path].setValue(newAtomVal);
package/dist/types.d.ts CHANGED
@@ -19,7 +19,7 @@ export type IStore = {
19
19
  subscribe: NonReactUsageReport;
20
20
  };
21
21
  export type KeyType = number | string | symbol;
22
- export type Listener<T extends State> = (changes: UpdatePayload<PartialState<T>>) => void;
22
+ export type Listener<T extends State> = (changes: Changes<T>) => void;
23
23
  export type NonReactUsageReport = () => never;
24
24
  export type PartialState<T extends State> = { [K in keyof T]?: T[K]; };
25
25
  export type Prehooks<T extends State> = {
@@ -27,7 +27,7 @@ export type Prehooks<T extends State> = {
27
27
  current: T;
28
28
  original: T;
29
29
  }) => boolean;
30
- setState?: (newChanges: PartialState<T>) => boolean;
30
+ setState?: (newChanges: Changes<T>) => boolean;
31
31
  };
32
32
  export type State = {
33
33
  [x: string]: any;
@@ -36,7 +36,7 @@ export type State = {
36
36
  };
37
37
  export type StoreInternal<T extends State> = {
38
38
  resetState: (propertyPaths?: string[]) => void;
39
- setState: (changes: UpdatePayload<PartialState<T>>) => void;
39
+ setState: (changes: Changes<T>) => void;
40
40
  } & {
41
41
  getState: (clientId: string, ...propertyPaths?: string[]) => {
42
42
  [propertyPaths: string]: Readonly<any>;
@@ -47,8 +47,9 @@ export type StoreInternal<T extends State> = {
47
47
  export type Store<T extends State> = {
48
48
  data: Data;
49
49
  resetState: (propertyPaths?: string[]) => void;
50
- setState: (changes: UpdatePayload<PartialState<T>>) => void;
50
+ setState: (changes: Changes<T>) => void;
51
51
  };
52
+ export type Changes<T extends State> = UpdatePayload<PartialState<T>>;
52
53
  export type UpdateStats = {
53
54
  hasChanges: boolean;
54
55
  };
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "steveswork <stephen.isienyi@gmail.com> (https://github.com/steveswork)"
8
8
  ],
9
9
  "dependencies": {
10
- "@webkrafters/get-property": "^1.0.1",
10
+ "@webkrafters/get-property": "^1.0.2",
11
11
  "lodash.clonedeepwith": "^4.5.0",
12
12
  "lodash.isboolean": "^3.0.3",
13
13
  "lodash.isempty": "^4.4.0",
@@ -125,7 +125,7 @@
125
125
  "url": "git+https://github.com/webKrafters/react-observable-context.git"
126
126
  },
127
127
  "scripts": {
128
- "build": "eslint --fix && rm -rf dist && babel src -d dist && npx -p typescript tsc",
128
+ "build": "eslint --fix && rm -rf dist && babel src -d dist --ignore '**/*.test.js' && npx -p typescript tsc",
129
129
  "postbuild": "node ./post-builder",
130
130
  "test": "eslint --fix && jest --coverage --updateSnapshot",
131
131
  "test:clean": "jest --clearCache",
@@ -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"
136
+ "version": "4.1.2"
137
137
  }