@itera-web/hooks-setstate 1.22.0 → 1.24.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/es/index.js CHANGED
@@ -1 +1 @@
1
- import*as t from"react";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},r={};function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}e.d(r,{v:()=>c});const n=(t=>{var r={};return e.d(r,t),r})({useLayoutEffect:()=>t.useLayoutEffect,useRef:()=>t.useRef,useState:()=>t.useState});var u=function(){return u=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},u.apply(this,arguments)},c=function(t){var e=(0,n.useState)(t),r=e[0],c=e[1],f=(0,n.useRef)(t),a=(0,n.useRef)();return(0,n.useLayoutEffect)(function(){var t;f.current=r,null===(t=a.current)||void 0===t||t.call(a,r)},[r]),[r,function(t,e){var r;void 0===e&&(e=function(){return null}),a.current=e,r=t,f.current=r,r?"object"!==o(r)||r.constructor!==Object?c(r):c(function(t){return u(u({},t||{}),r)}):c(r)},function(){return f.current}]},f=r.v;export{f as useSetState};
1
+ import*as r from"react";var t={d:(r,e)=>{for(var n in e)t.o(e,n)&&!t.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:e[n]})},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t)},e={};t.d(e,{v:()=>f});const n=(r=>{var e={};return t.d(e,r),e})({useLayoutEffect:()=>r.useLayoutEffect,useRef:()=>r.useRef,useState:()=>r.useState});var u=function(){return u=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++)for(var u in t=arguments[e])Object.prototype.hasOwnProperty.call(t,u)&&(r[u]=t[u]);return r},u.apply(this,arguments)},c=function(r){return"[object Object]"===Object.prototype.toString.call(r)},o=Array.isArray,a=function(r,t){if(o(t))return t;if(c(t)&&c(r)){for(var e=u({},r),n=0,f=Object.keys(t);n<f.length;n++){var i=f[n];c(t[i])&&c(r[i])?e[i]=a(r[i],t[i]):e[i]=t[i]}return e}return t},f=function(r){var t=(0,n.useState)(r),e=t[0],f=t[1],i=(0,n.useRef)(r),s=(0,n.useRef)(),v=(0,n.useRef)(!1);return(0,n.useLayoutEffect)(function(){s.current&&(s.current(i.current),s.current=void 0)},[e]),[e,function(r,t,e){var n,p;void 0===t&&(t=function(){}),void 0===e&&(e=!1),s.current=t,v.current=e,p="function"==typeof(n=r)?n(i.current):n,c(p)||o(p)?o(p)?(i.current=p,f(p)):c(p)&&(c(i.current)&&(i.current=u(u({},i.current||{}),p)),f(function(r){var t;return t=v.current?c(r)?a(r,p):p:c(r)?u(u({},r),p):p,i.current=t,t})):(i.current=p,f(p))},function(){return i.current}]},i=e.v;export{i as useSetState};
@@ -1,4 +1,4 @@
1
1
  type SetStateAction<S> = S | ((prevState: S) => S);
2
- type Dispatch<A> = (value: A, callback?: Function) => void;
2
+ type Dispatch<S, A = S> = (value: A, callback?: (state: S) => void, isDeep?: boolean) => void;
3
3
  export declare const useSetState: <S>(initialState: S) => [S, Dispatch<SetStateAction<S>>, () => S];
4
4
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@itera-web/hooks-setstate",
3
3
  "description": "自定义 useState",
4
- "version": "1.22.0",
4
+ "version": "1.24.0",
5
5
  "main": "es/index.js",
6
6
  "types": "es/index.d.ts",
7
7
  "publishConfig": {
@@ -18,5 +18,5 @@
18
18
  "devDependencies": {
19
19
  "@itera-web/cli": "^1.1.54"
20
20
  },
21
- "gitHead": "9a809b3a00c6244a566f85279a82a29b25dc48eb"
21
+ "gitHead": "0212c0cfef7d699e427499aa291262a4e4ec795a"
22
22
  }