@itera-web/hooks-setstate 1.24.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.
Files changed (2) hide show
  1. package/es/index.js +1 -1
  2. package/package.json +2 -2
package/es/index.js CHANGED
@@ -1 +1 @@
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
+ 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};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@itera-web/hooks-setstate",
3
3
  "description": "自定义 useState",
4
- "version": "1.24.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": "0212c0cfef7d699e427499aa291262a4e4ec795a"
21
+ "gitHead": "c33c3d14e691e07eccfbc766d505ad8b500c69b0"
22
22
  }