@sheinx/hooks 3.2.0-rc.2 → 3.2.0-rc.3
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/utils/immer.d.ts +8 -1
- package/cjs/utils/immer.d.ts.map +1 -1
- package/cjs/utils/immer.js +6 -10
- package/esm/utils/immer.d.ts +8 -1
- package/esm/utils/immer.d.ts.map +1 -1
- package/esm/utils/immer.js +7 -11
- package/package.json +1 -1
package/cjs/utils/immer.d.ts
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
import { Draft, PatchListener } from 'immer';
|
1
2
|
export { current } from 'immer';
|
2
|
-
|
3
|
+
declare const NOTHING: unique symbol;
|
4
|
+
type ValidRecipeReturnType<State> = State | void | undefined | (State extends undefined ? typeof NOTHING : never);
|
5
|
+
interface IProduce {
|
6
|
+
<Base, D = Draft<Base>>(// By using a default inferred D, rather than Draft<Base> in the recipe, we can override it.
|
7
|
+
base: Base, recipe: (draft: D) => ValidRecipeReturnType<D>, listener?: PatchListener): Base;
|
8
|
+
}
|
9
|
+
export declare const produce: IProduce;
|
3
10
|
//# sourceMappingURL=immer.d.ts.map
|
package/cjs/utils/immer.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"immer.d.ts","sourceRoot":"","sources":["immer.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"immer.d.ts","sourceRoot":"","sources":["immer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,KAAK,qBAAqB,CAAC,KAAK,IAC5B,KAAK,GACL,IAAI,GACJ,SAAS,GACT,CAAC,KAAK,SAAS,SAAS,GAAG,OAAO,OAAO,GAAG,KAAK,CAAC,CAAC;AACvD,UAAU,QAAQ;IAChB,CAAC,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,EAAG,4FAA4F;IACnH,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,qBAAqB,CAAC,CAAC,CAAC,EAC9C,QAAQ,CAAC,EAAE,aAAa,GACvB,IAAI,CAAC;CACT;AAED,eAAO,MAAM,OAAO,UAGN,CAAC"}
|
package/cjs/utils/immer.js
CHANGED
@@ -11,14 +11,10 @@ Object.defineProperty(exports, "current", {
|
|
11
11
|
});
|
12
12
|
exports.produce = void 0;
|
13
13
|
var _immer = require("immer");
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
// export const current = getSnapshot;
|
21
|
-
|
22
|
-
var produce = exports.produce = function produce(value, cb) {
|
23
|
-
return (0, _immer.produce)(value, cb);
|
14
|
+
var produce = exports.produce = function produce() {
|
15
|
+
(0, _immer.setAutoFreeze)(false);
|
16
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
17
|
+
args[_key] = arguments[_key];
|
18
|
+
}
|
19
|
+
return _immer.produce.apply(null, args);
|
24
20
|
};
|
package/esm/utils/immer.d.ts
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
import { Draft, PatchListener } from 'immer';
|
1
2
|
export { current } from 'immer';
|
2
|
-
|
3
|
+
declare const NOTHING: unique symbol;
|
4
|
+
type ValidRecipeReturnType<State> = State | void | undefined | (State extends undefined ? typeof NOTHING : never);
|
5
|
+
interface IProduce {
|
6
|
+
<Base, D = Draft<Base>>(// By using a default inferred D, rather than Draft<Base> in the recipe, we can override it.
|
7
|
+
base: Base, recipe: (draft: D) => ValidRecipeReturnType<D>, listener?: PatchListener): Base;
|
8
|
+
}
|
9
|
+
export declare const produce: IProduce;
|
3
10
|
//# sourceMappingURL=immer.d.ts.map
|
package/esm/utils/immer.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"immer.d.ts","sourceRoot":"","sources":["immer.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"immer.d.ts","sourceRoot":"","sources":["immer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,KAAK,qBAAqB,CAAC,KAAK,IAC5B,KAAK,GACL,IAAI,GACJ,SAAS,GACT,CAAC,KAAK,SAAS,SAAS,GAAG,OAAO,OAAO,GAAG,KAAK,CAAC,CAAC;AACvD,UAAU,QAAQ;IAChB,CAAC,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,EAAG,4FAA4F;IACnH,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,qBAAqB,CAAC,CAAC,CAAC,EAC9C,QAAQ,CAAC,EAAE,aAAa,GACvB,IAAI,CAAC;CACT;AAED,eAAO,MAAM,OAAO,UAGN,CAAC"}
|
package/esm/utils/immer.js
CHANGED
@@ -1,13 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
// export const produce = ((...args: any) => {
|
4
|
-
// return produce2.apply(null, args);
|
5
|
-
// }) as typeof produce2;
|
6
|
-
|
7
|
-
// export const current = getSnapshot;
|
8
|
-
|
9
|
-
import { produce as produce2 } from 'immer';
|
1
|
+
import { produce as produce2, setAutoFreeze } from 'immer';
|
10
2
|
export { current } from 'immer';
|
11
|
-
export var produce = function produce(
|
12
|
-
|
3
|
+
export var produce = function produce() {
|
4
|
+
setAutoFreeze(false);
|
5
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
6
|
+
args[_key] = arguments[_key];
|
7
|
+
}
|
8
|
+
return produce2.apply(null, args);
|
13
9
|
};
|