@itera-web/hooks-setstate 1.23.0 → 1.25.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 n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},r={};e.d(r,{v:()=>a});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,n=arguments.length;r<n;r++)for(var u in e=arguments[r])Object.prototype.hasOwnProperty.call(e,u)&&(t[u]=e[u]);return t},u.apply(this,arguments)},o=function(t){return"[object Object]"===Object.prototype.toString.call(t)},c=function(t,e){var r=u({},t);for(var n in e)o(e[n])&&o(t[n])?r[n]=c(t[n],e[n]):r[n]=e[n];return r},a=function(t){var e=(0,n.useState)(t),r=e[0],u=e[1],a=(0,n.useRef)(t),f=(0,n.useRef)();return(0,n.useLayoutEffect)(function(){var t;a.current=r,null===(t=f.current)||void 0===t||t.call(f,r)},[r]),[r,function(t,e){var r,n;void 0===e&&(e=function(){return null}),f.current=e,n="function"==typeof(r=t)?r(a.current):r,a.current=n,o(n)?u(function(t){return c(t||{},n)}):u(n)},function(){return a.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:()=>i});const n=(r=>{var e={};return t.d(e,r),e})({useEffect:()=>r.useEffect,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,f=function(r,t){if(o(t))return t;if(c(t)&&c(r)){for(var e=u({},r),n=0,a=Object.keys(t);n<a.length;n++){var i=a[n];c(t[i])&&c(r[i])?e[i]=f(r[i],t[i]):e[i]=t[i]}return e}return t},a=function(r,t,e){return c(e)&&c(t)?r?f(t,e):u(u({},t),e):e},i=function(r){var t=(0,n.useState)(r),e=t[0],u=t[1],o=(0,n.useRef)(r),f=(0,n.useRef)(),i=(0,n.useRef)(!1);return(0,n.useEffect)(function(){f.current&&(f.current(o.current),f.current=void 0)},[e]),[e,function(r,t,e){void 0===t&&(t=function(){}),void 0===e&&(e=!1),f.current=t,i.current=e,function(r){var t="function"==typeof r?r(o.current):r;if(!c(t))return o.current=t,void u(t);c(t)&&(c(o.current)&&(o.current=a(i.current,o.current,t)),u(function(r){var e=a(i.current,r,t);return o.current=e,e}))}(r)},function(){return o.current}]},s=e.v;export{s 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.23.0",
4
+ "version": "1.25.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": "059e8a6f57fd23485e386082b0629d636dd76199"
21
+ "gitHead": "c33c3d14e691e07eccfbc766d505ad8b500c69b0"
22
22
  }