state-decorator 7.0.0-rc4 → 7.0.0-rc5

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/es/helpers.d.ts CHANGED
@@ -1,33 +1,34 @@
1
1
  /**
2
2
  * Effect function that sets the first action argument to the specified prop.
3
+ * if dirtyProp is set
3
4
  */
4
- export declare function setArgIn<S, K extends keyof S>(propName: K): (ctx: {
5
+ export declare function setArgIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
5
6
  s: S;
6
7
  args: [S[K]];
7
8
  }) => Partial<S>;
8
9
  /**
9
10
  * Effect function that sets <code>true</code> in the specified prop.
10
11
  */
11
- export declare function setTrueIn<S, K extends keyof S>(propName: K): (ctx: {
12
+ export declare function setTrueIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
12
13
  s: S;
13
14
  }) => Partial<S>;
14
15
  /**
15
16
  * Effect function that sets <code>false</code> in the specified prop.
16
17
  */
17
- export declare function setFalseIn<S, K extends keyof S>(propName: K): (ctx: {
18
+ export declare function setFalseIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
18
19
  s: S;
19
20
  }) => Partial<S>;
20
21
  /**
21
22
  * Effect function that sets toggles the boolean value of the specified prop.
22
23
  */
23
- export declare function toggleProp<S, K extends keyof S>(propName: K): (ctx: {
24
+ export declare function toggleProp<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
24
25
  s: S;
25
26
  }) => Partial<S>;
26
27
  /**
27
28
  * Effect function that sets the update the specifed prop as an array using first action argument as index
28
29
  * and second as value to set.
29
30
  */
30
- export declare function setArgsInMap<S, K extends keyof S, T>(propName: K): (ctx: {
31
+ export declare function setArgsInMap<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
31
32
  s: S;
32
33
  args: [string, T];
33
34
  }) => Partial<S>;
@@ -35,14 +36,14 @@ export declare function setArgsInMap<S, K extends keyof S, T>(propName: K): (ctx
35
36
  * Effect function that sets the update the specifed prop as an array using first action argument as index
36
37
  * and second as value to set.
37
38
  */
38
- export declare function setArgsInArray<S, K extends keyof S, T>(propName: K): (ctx: {
39
+ export declare function setArgsInArray<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
39
40
  s: S;
40
41
  args: [number, T];
41
42
  }) => Partial<S>;
42
43
  /**
43
44
  * Effect function that sets the asynchronous action result to the specified prop.
44
45
  */
45
- export declare function setResIn<S, K extends keyof S>(propName: K): (ctx: {
46
+ export declare function setResIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
46
47
  s: S;
47
48
  res: S[K];
48
49
  }) => Partial<S>;
@@ -50,7 +51,7 @@ export declare function setResIn<S, K extends keyof S>(propName: K): (ctx: {
50
51
  * Effect function that sets the update the specifed prop as an array using first action argument as index
51
52
  * and second as value to set.
52
53
  */
53
- export declare function setResInArray<S, K extends keyof S, T>(propName: K): (ctx: {
54
+ export declare function setResInArray<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
54
55
  s: S;
55
56
  args: [number];
56
57
  res: T;
@@ -59,7 +60,7 @@ export declare function setResInArray<S, K extends keyof S, T>(propName: K): (ct
59
60
  * Effect function that sets the update the specifed prop as an array using first action argument as index
60
61
  * and second as value to set.
61
62
  */
62
- export declare function setResInMap<S, K extends keyof S, T>(propName: K): (ctx: {
63
+ export declare function setResInMap<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
63
64
  s: S;
64
65
  args: [string];
65
66
  res: T;
package/es/helpers.js CHANGED
@@ -1,2 +1,2 @@
1
- var r=function(){return r=Object.assign||function(r){for(var n,t=1,u=arguments.length;t<u;t++)for(var e in n=arguments[t])Object.prototype.hasOwnProperty.call(n,e)&&(r[e]=n[e]);return r},r.apply(this,arguments)};function n(r,n,t){if(t||2===arguments.length)for(var u,e=0,o=n.length;e<o;e++)!u&&e in n||(u||(u=Array.prototype.slice.call(n,0,e)),u[e]=n[e]);return r.concat(u||Array.prototype.slice.call(n))}function t(r){return function(n){var t,u=n.s,e=n.args[0];return u[r]===e?null:((t={})[r]=e,t)}}function u(r){return function(n){var t;return n.s[r]?null:((t={})[r]=!0,t)}}function e(r){return function(n){var t;return n.s[r]?((t={})[r]=!1,t):null}}function o(r){return function(n){var t,u=n.s;return(t={})[r]=!u[r],t}}function c(n){return function(t){var u,e,o=t.s,c=t.args,i=c[0],a=c[1];return(u={})[n]=r(r({},o[n]),((e={})[i]=a,e)),u}}function i(r){return function(t){var u,e=t.s,o=t.args,c=o[0],i=o[1],a=n([],e[r],!0);return a[c]=i,(u={})[r]=a,u}}function a(r){return function(n){var t,u=n.res;return(t={})[r]=u,t}}function f(r){return function(t){var u,e=t.s,o=t.args[0],c=t.res,i=n([],e[r],!0);return i[o]=c,(u={})[r]=i,u}}function s(n){return function(t){var u,e,o=t.s,c=t.args[0],i=t.res;return(u={})[n]=r(r({},o[n]),((e={})[c]=i,e)),u}}export{t as setArgIn,i as setArgsInArray,c as setArgsInMap,e as setFalseIn,a as setResIn,f as setResInArray,s as setResInMap,u as setTrueIn,o as toggleProp};
1
+ var r=function(){return r=Object.assign||function(r){for(var n,t=1,u=arguments.length;t<u;t++)for(var e in n=arguments[t])Object.prototype.hasOwnProperty.call(n,e)&&(r[e]=n[e]);return r},r.apply(this,arguments)};function n(r,n,t){if(t||2===arguments.length)for(var u,e=0,o=n.length;e<o;e++)!u&&e in n||(u||(u=Array.prototype.slice.call(n,0,e)),u[e]=n[e]);return r.concat(u||Array.prototype.slice.call(n))}function t(r,n){return n&&(r[n]=!0),r}function u(r,n){return function(u){var e,o=u.s,c=u.args[0];return o[r]===c?null:t(((e={})[r]=c,e),n)}}function e(r,n){return function(u){var e;return u.s[r]?null:t(((e={})[r]=!0,e),n)}}function o(r,n){return function(u){var e;return u.s[r]?t(((e={})[r]=!1,e),n):null}}function c(r,n){return function(u){var e,o=u.s;return t(((e={})[r]=!o[r],e),n)}}function i(n,u){return function(e){var o,c,i=e.s,a=e.args,f=a[0],s=a[1];return t(((o={})[n]=r(r({},i[n]),((c={})[f]=s,c)),o),u)}}function a(r,u){return function(e){var o,c=e.s,i=e.args,a=i[0],f=i[1],s=n([],c[r],!0);return s[a]=f,t(((o={})[r]=s,o),u)}}function f(r,n){return function(u){var e,o=u.res;return t(((e={})[r]=o,e),n)}}function s(r,u){return function(e){var o,c=e.s,i=e.args[0],a=e.res,f=n([],c[r],!0);return f[i]=a,t(((o={})[r]=f,o),u)}}function l(n,u){return function(e){var o,c,i=e.s,a=e.args[0],f=e.res;return t(((o={})[n]=r(r({},i[n]),((c={})[a]=f,c)),o),u)}}export{u as setArgIn,a as setArgsInArray,i as setArgsInMap,o as setFalseIn,f as setResIn,s as setResInArray,l as setResInMap,e as setTrueIn,c as toggleProp};
2
2
  //# sourceMappingURL=helpers.js.map
package/helpers.d.ts CHANGED
@@ -1,33 +1,34 @@
1
1
  /**
2
2
  * Effect function that sets the first action argument to the specified prop.
3
+ * if dirtyProp is set
3
4
  */
4
- export declare function setArgIn<S, K extends keyof S>(propName: K): (ctx: {
5
+ export declare function setArgIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
5
6
  s: S;
6
7
  args: [S[K]];
7
8
  }) => Partial<S>;
8
9
  /**
9
10
  * Effect function that sets <code>true</code> in the specified prop.
10
11
  */
11
- export declare function setTrueIn<S, K extends keyof S>(propName: K): (ctx: {
12
+ export declare function setTrueIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
12
13
  s: S;
13
14
  }) => Partial<S>;
14
15
  /**
15
16
  * Effect function that sets <code>false</code> in the specified prop.
16
17
  */
17
- export declare function setFalseIn<S, K extends keyof S>(propName: K): (ctx: {
18
+ export declare function setFalseIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
18
19
  s: S;
19
20
  }) => Partial<S>;
20
21
  /**
21
22
  * Effect function that sets toggles the boolean value of the specified prop.
22
23
  */
23
- export declare function toggleProp<S, K extends keyof S>(propName: K): (ctx: {
24
+ export declare function toggleProp<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
24
25
  s: S;
25
26
  }) => Partial<S>;
26
27
  /**
27
28
  * Effect function that sets the update the specifed prop as an array using first action argument as index
28
29
  * and second as value to set.
29
30
  */
30
- export declare function setArgsInMap<S, K extends keyof S, T>(propName: K): (ctx: {
31
+ export declare function setArgsInMap<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
31
32
  s: S;
32
33
  args: [string, T];
33
34
  }) => Partial<S>;
@@ -35,14 +36,14 @@ export declare function setArgsInMap<S, K extends keyof S, T>(propName: K): (ctx
35
36
  * Effect function that sets the update the specifed prop as an array using first action argument as index
36
37
  * and second as value to set.
37
38
  */
38
- export declare function setArgsInArray<S, K extends keyof S, T>(propName: K): (ctx: {
39
+ export declare function setArgsInArray<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
39
40
  s: S;
40
41
  args: [number, T];
41
42
  }) => Partial<S>;
42
43
  /**
43
44
  * Effect function that sets the asynchronous action result to the specified prop.
44
45
  */
45
- export declare function setResIn<S, K extends keyof S>(propName: K): (ctx: {
46
+ export declare function setResIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
46
47
  s: S;
47
48
  res: S[K];
48
49
  }) => Partial<S>;
@@ -50,7 +51,7 @@ export declare function setResIn<S, K extends keyof S>(propName: K): (ctx: {
50
51
  * Effect function that sets the update the specifed prop as an array using first action argument as index
51
52
  * and second as value to set.
52
53
  */
53
- export declare function setResInArray<S, K extends keyof S, T>(propName: K): (ctx: {
54
+ export declare function setResInArray<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
54
55
  s: S;
55
56
  args: [number];
56
57
  res: T;
@@ -59,7 +60,7 @@ export declare function setResInArray<S, K extends keyof S, T>(propName: K): (ct
59
60
  * Effect function that sets the update the specifed prop as an array using first action argument as index
60
61
  * and second as value to set.
61
62
  */
62
- export declare function setResInMap<S, K extends keyof S, T>(propName: K): (ctx: {
63
+ export declare function setResInMap<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
63
64
  s: S;
64
65
  args: [string];
65
66
  res: T;
package/helpers.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=function(){return r=Object.assign||function(r){for(var n,t=1,e=arguments.length;t<e;t++)for(var s in n=arguments[t])Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s]);return r},r.apply(this,arguments)};function n(r,n,t){if(t||2===arguments.length)for(var e,s=0,u=n.length;s<u;s++)!e&&s in n||(e||(e=Array.prototype.slice.call(n,0,s)),e[s]=n[s]);return r.concat(e||Array.prototype.slice.call(n))}exports.setArgIn=function(r){return function(n){var t,e=n.s,s=n.args[0];return e[r]===s?null:((t={})[r]=s,t)}},exports.setArgsInArray=function(r){return function(t){var e,s=t.s,u=t.args,o=u[0],a=u[1],c=n([],s[r],!0);return c[o]=a,(e={})[r]=c,e}},exports.setArgsInMap=function(n){return function(t){var e,s,u=t.s,o=t.args,a=o[0],c=o[1];return(e={})[n]=r(r({},u[n]),((s={})[a]=c,s)),e}},exports.setFalseIn=function(r){return function(n){var t;return n.s[r]?((t={})[r]=!1,t):null}},exports.setResIn=function(r){return function(n){var t,e=n.res;return(t={})[r]=e,t}},exports.setResInArray=function(r){return function(t){var e,s=t.s,u=t.args[0],o=t.res,a=n([],s[r],!0);return a[u]=o,(e={})[r]=a,e}},exports.setResInMap=function(n){return function(t){var e,s,u=t.s,o=t.args[0],a=t.res;return(e={})[n]=r(r({},u[n]),((s={})[o]=a,s)),e}},exports.setTrueIn=function(r){return function(n){var t;return n.s[r]?null:((t={})[r]=!0,t)}},exports.toggleProp=function(r){return function(n){var t,e=n.s;return(t={})[r]=!e[r],t}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=function(){return r=Object.assign||function(r){for(var n,t=1,e=arguments.length;t<e;t++)for(var u in n=arguments[t])Object.prototype.hasOwnProperty.call(n,u)&&(r[u]=n[u]);return r},r.apply(this,arguments)};function n(r,n,t){if(t||2===arguments.length)for(var e,u=0,s=n.length;u<s;u++)!e&&u in n||(e||(e=Array.prototype.slice.call(n,0,u)),e[u]=n[u]);return r.concat(e||Array.prototype.slice.call(n))}function t(r,n){return n&&(r[n]=!0),r}exports.setArgIn=function(r,n){return function(e){var u,s=e.s,o=e.args[0];return s[r]===o?null:t(((u={})[r]=o,u),n)}},exports.setArgsInArray=function(r,e){return function(u){var s,o=u.s,a=u.args,c=a[0],i=a[1],f=n([],o[r],!0);return f[c]=i,t(((s={})[r]=f,s),e)}},exports.setArgsInMap=function(n,e){return function(u){var s,o,a=u.s,c=u.args,i=c[0],f=c[1];return t(((s={})[n]=r(r({},a[n]),((o={})[i]=f,o)),s),e)}},exports.setFalseIn=function(r,n){return function(e){var u;return e.s[r]?t(((u={})[r]=!1,u),n):null}},exports.setResIn=function(r,n){return function(e){var u,s=e.res;return t(((u={})[r]=s,u),n)}},exports.setResInArray=function(r,e){return function(u){var s,o=u.s,a=u.args[0],c=u.res,i=n([],o[r],!0);return i[a]=c,t(((s={})[r]=i,s),e)}},exports.setResInMap=function(n,e){return function(u){var s,o,a=u.s,c=u.args[0],i=u.res;return t(((s={})[n]=r(r({},a[n]),((o={})[c]=i,o)),s),e)}},exports.setTrueIn=function(r,n){return function(e){var u;return e.s[r]?null:t(((u={})[r]=!0,u),n)}},exports.toggleProp=function(r,n){return function(e){var u,s=e.s;return t(((u={})[r]=!s[r],u),n)}};
2
2
  //# sourceMappingURL=helpers.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "state-decorator",
3
- "version": "7.0.0-rc4",
3
+ "version": "7.0.0-rc5",
4
4
  "description": "React state management library",
5
5
  "main": "index.js",
6
6
  "module": "es/index.js",