react-hooks-global-states 14.1.0-beta.1 → 14.1.0-beta.2

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/GlobalStore.d.ts CHANGED
@@ -76,9 +76,12 @@ export declare class GlobalStore<State, Metadata extends BaseMetadata, ActionsCo
76
76
  */
77
77
  getState: () => State;
78
78
  /**
79
- * Subscribe to the state changes
79
+ * Subscribe an individual callback to state changes
80
80
  */
81
81
  subscribe: SubscribeToState<State>;
82
+ /**
83
+ * Adds a subscription object to the subscribers set and returns the unsubscribe function
84
+ */
82
85
  protected subscribeCallback: (subscription: SubscriberParameters) => () => void;
83
86
  protected partialUpdateSubscription: (subscription: SubscriberParameters, values: Partial<SubscriberParameters>) => void;
84
87
  protected executeOnSubscribed: (subscription: SubscriberParameters) => void;
package/GlobalStore.js CHANGED
@@ -1 +1 @@
1
- var t,e;t=this,e=(t,e,r,n,o,i,a)=>(()=>{"use strict";var s={78:e=>{e.exports=t},155:t=>{t.exports=e},361:t=>{t.exports=r},487:t=>{t.exports=n},506:t=>{t.exports=o},673:t=>{t.exports=i},773:t=>{t.exports=a},811:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});var r=globalThis;r.isDevToolsPresent=Boolean(r.REACT_GLOBAL_STATE_HOOK_DEBUG),e.default=r}},u={};function c(t){var e=u[t];if(void 0!==e)return e.exports;var r=u[t]={exports:{}};return s[t](r,r.exports,c),r.exports}var l={};return(()=>{var t=l;function e(t){return e="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},e(t)}function r(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function o(){o=function(){return r};var t,r={},n=Object.prototype,i=n.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof m?e:m,i=Object.create(o.prototype),s=new T(n||[]);return a(i,"_invoke",{value:L(t,r,s)}),i}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var b="suspendedStart",p="suspendedYield",v="executing",y="completed",g={};function m(){}function S(){}function w(){}var j={};f(j,u,(function(){return this}));var O=Object.getPrototypeOf,x=O&&O(O(M([])));x&&x!==n&&i.call(x,u)&&(j=x);var E=w.prototype=m.prototype=Object.create(j);function k(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,r){function n(o,a,s,u){var c=d(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==e(f)&&i.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,s,u)}),(function(t){n("throw",t,s,u)})):r.resolve(f).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,u)}))}u(c.arg)}var o;a(this,"_invoke",{value:function(t,e){function i(){return new r((function(r,o){n(t,e,r,o)}))}return o=o?o.then(i,i):i()}})}function L(e,r,n){var o=b;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=_(s,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===b)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var c=d(e,r,n);if("normal"===c.type){if(o=n.done?y:p,c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=y,n.method="throw",n.arg=c.arg)}}}function _(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=d(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function q(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(q,this),this.reset(!0)}function M(r){if(r||""===r){var n=r[u];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(i.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(e(r)+" is not iterable")}return S.prototype=w,a(E,"constructor",{value:w,configurable:!0}),a(w,"constructor",{value:S,configurable:!0}),S.displayName=f(w,l,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===S||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,f(t,l,"GeneratorFunction")),t.prototype=Object.create(E),t},r.awrap=function(t){return{__await:t}},k(C.prototype),f(C.prototype,c,(function(){return this})),r.AsyncIterator=C,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new C(h(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},k(E),f(E,l,"Generator"),f(E,u,(function(){return this})),f(E,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=M,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},r}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function a(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var r=function(t){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:r+""}Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalStore=void 0,t.createObservable=S,t.createSelectorHook=w;var u,f=c(155),h=c(506),d=c(773),b=c(487),p=c(673),v=c(361),y=c(78),g=(u=c(811))&&u.__esModule?u:{default:u},m=a((function t(e){var n,i,a=this,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{metadata:{}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Set,this.initialize=function(){return t=a,e=void 0,r=o().mark((function t(){var e,r,n,i,a,s,u;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.getStoreActionsMap(),n=r.actions,i=r.storeTools,this.actions=n,this.storeTools=i,this.use=this.getMainHook(),a=this.onInit,s=null!==(e=this.callbacks)&&void 0!==e?e:{},u=s.onInit,a||u){t.next=8;break}return t.abrupt("return");case 8:null==a||a(i),(0,d.isNil)(u)||null==u||u(i);case 10:case"end":return t.stop()}}),t,this)})),new(e||(e=Promise))((function(n,o){function i(t){try{s(r.next(t))}catch(t){o(t)}}function a(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var r;t.done?n(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(i,a)}s((r=r.apply(t,[])).next())}));var t,e,r},this.executeSetStateForSubscriber=function(t,e){var r=t.selector,n=t.onStoreChange,o=t.currentState,i=t.isEqualRoot,s=void 0===i?function(t,e){return t===e}:i,u=t.isEqual,c=void 0===u?function(t,e){return t===e}:u;if(!e.forceUpdate&&s(e.currentState,e.newState))return{didUpdate:!1};var l=r?r(e.newState):e.newState;return!e.forceUpdate&&c(o,l)?{didUpdate:!1}:(a.partialUpdateSubscription(t,{currentState:l}),n({state:l},{identifier:e.identifier}),{didUpdate:!0})},this.setSubscribersState=function(t,e){var n=e.forceUpdate,o=e.identifier,i=a.state;if(n||i!==t){a.state=t;var s,u={forceUpdate:n,newState:t,currentState:i,identifier:o},c=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=r(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw i}}}}(a.subscribers.values());try{for(c.s();!(s=c.n()).done;){var l=s.value;a.executeSetStateForSubscriber(l,u)}}catch(t){c.e(t)}finally{c.f()}}},this.setMetadata=function(t){var e=(0,h.isFunction)(t)?t(a.metadata):t;a.metadata=e},this.getMetadata=function(){return a.metadata},this.getState=function(){return a.state},this.subscribe=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,o=e[0],i=e[1],s=e[2],u=(0,h.isFunction)(i),c=u?o:void 0,l=u?i:o,f=null!==(n=u?s:i)&&void 0!==n?n:void 0,d=c?c(a.state):a.state;(null==f?void 0:f.skipFirst)||l(d);var b=Object.assign({selector:c,currentState:d,onStoreChange:function(t){var e=t.state;return l(e)}},f);return a.subscribeCallback(b),function(){a.subscribers.delete(b)}},this.subscribeCallback=function(t){return a.executeOnSubscribed(t),a.subscribers.add(t),function(){a.subscribers.delete(t)}},this.partialUpdateSubscription=function(t,e){(0,b.isRecord)(t)&&Object.assign(t,e)},this.executeOnSubscribed=function(t){var e,r=a.onSubscribed,n=null===(e=a.callbacks)||void 0===e?void 0:e.onSubscribed;(r||n)&&(null==r||r(a.storeTools,t),null==n||n(a.storeTools,t))},this.getMainHook=function(){var t=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];(0,f.useDebugValue)("global-state: ".concat(a._name));var r=(0,p.isArray)(e)?{dependencies:e}:null!=e?e:{},n=(0,f.useRef)(null),o=function(e){return(0,h.isFunction)(t)?t(e):e};n.current=n.current?n.current:Object.assign({selector:o,currentState:o(a.state),onStoreChange:function(){throw new Error("Callback not set")}},r);var i=n.current.dependencies,s=null==r?void 0:r.dependencies;Object.assign(n.current,{selector:o,options:r});var u=(0,f.useMemo)((function(){var t=function(){return n.current.currentState};return{subscribe:function(t){return n.current.onStoreChange=t,a.subscribeCallback(n.current)},getSnapshot:t,getServerSnapshot:t}}),[]),c=u.subscribe,l=u.getSnapshot,d=u.getServerSnapshot;return(0,f.useSyncExternalStore)(c,l,d),[a.computeSelectedState({subscription:n.current,newDependencies:s,currentDependencies:i}),a.getStateOrchestrator(),a.metadata]},e=a.setMetadata,r=a.getMetadata,n=a.actions,o=a.actions?null:a.setState.bind(a),i=a,s={actions:n,createObservable:a.createObservable.bind(i),createSelectorHook:a.createSelectorHook.bind(i),dispose:a.dispose.bind(a),getMetadata:r,getState:a.getState.bind(a),setMetadata:e,setState:o,subscribe:a.subscribe.bind(a),subscribers:a.subscribers,use:t,select:function(){return t.apply(void 0,arguments)[0]}};return Object.assign(t,s),t},this.computeSelectedState=function(t){var e=t.subscription,r=t.newDependencies,n=t.currentDependencies;return e.selector?(n===r||(null==n?void 0:n.length)===(null==r?void 0:r.length)&&(0,p.shallowCompare)(n,r)||a.partialUpdateSubscription(e,{currentState:e.selector(a.state)}),e.currentState):e.currentState},this.createSelectorHook=w,this.createObservable=S,this.getStateOrchestrator=function(){return a.actions?a.actions:a.setState},this.setState=function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.forceUpdate,i=n.identifier,s=a.state,u=(0,h.isFunction)(t)?t(s):t;if(o||a.state!==u){var c=a.setMetadata,l=a.getMetadata,f=a.getState,d=a.actions,b={setMetadata:c,getMetadata:l,setState:a.setSubscribersState,getState:f,actions:d,previousState:s,state:u,identifier:i},p=a.computePreventStateChange,v=null===(e=a.callbacks)||void 0===e?void 0:e.computePreventStateChange;if((p||v)&&((null==p?void 0:p(b))||(null==v?void 0:v(b))))return;a.setSubscribersState(u,{forceUpdate:o,identifier:i});var y=a.onStateChanged,g=null===(r=a.callbacks)||void 0===r?void 0:r.onStateChanged;(y||g)&&(null==y||y(b),null==g||g(b))}},this.getStoreActionsMap=function(){var t=a.actionsConfig,e=a.getMetadata,r=a.getState,n={setMetadata:a.setMetadata,getMetadata:e,getState:r,setState:a.setState,subscribe:a.subscribe,actions:null};if(!(0,b.isRecord)(t))return{actions:null,storeTools:n};var o={};n.actions=o;for(var i=Object.keys(t),u=function(){var e,r,i,a=l[c];Object.assign(o,(e={},i=function(){for(var e=t[a],r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];var u=e.apply(o,i);return"function"!=typeof u&&(0,v.throwWrongKeyOnActionCollectionConfig)(a),u.call(o,n)},(r=s(r=a))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e))},c=0,l=i;c<l.length;c++)u();return{actions:o,storeTools:n}},this.removeSubscriptions=function(){a.subscribers.clear()},this.dispose=function(){a.removeSubscriptions(),a._name="",a.actionsConfig=null,a.callbacks=null,a.metadata={},a.actions=null,a.state=Object.create(null)};var c=u.metadata,l=u.callbacks,m=u.actions,j=u.name;if(this.state=e,this._name=null!=j?j:(0,y.uniqueId)("gs:"),this.metadata=null!=c?c:{},this.callbacks=null!=l?l:null,this.actionsConfig=null!=m?m:null,g.default.isDevToolsPresent){var O=null!==(n=(new Error).stack)&&void 0!==n?n:"";null===(i=g.default.REACT_GLOBAL_STATE_HOOK_DEBUG)||void 0===i||i.call(g.default,this,u,O)}this.constructor!==t||this.initialize()}));function S(t,e){var r=null==e?void 0:e.name,n=null==e?void 0:e.isEqualRoot,o=null==e?void 0:e.isEqual,i=this.getState(),a=(null!=t?t:function(t){return t})(i),s=new m(a,{name:null!=r?r:(0,y.uniqueId)("sh:")}),u=this.subscribe((function(e){if(!(null!=n?n:Object.is)(i,e)){i=e;var r=t(e);(null!=o?o:Object.is)(a,r)||(a=r,s.setState(r))}}),{skipFirst:!0}),c=s.subscribe.bind(s),l={getState:s.getState.bind(s),subscribe:s.subscribe.bind(s),createSelectorHook:w.bind(c),createObservable:S.bind(c),dispose:function(){u(),s.dispose()},subscribers:s.subscribers};return Object.assign(c,l),c}function w(t,e){var n=null==e?void 0:e.name,o=null==e?void 0:e.isEqualRoot,i=null==e?void 0:e.isEqual,a=this.getState(),s=(null!=t?t:function(t){return t})(a),u=new m(s,{name:null!=n?n:(0,y.uniqueId)("sh:")}),c=this.subscribe((function(e){if(!(null!=o?o:Object.is)(a,e)){a=e;var r=t(e);(null!=i?i:Object.is)(s,r)||(s=r,u.setState(r))}}),{skipFirst:!0}),l=function(){return(t=u.use.apply(u,arguments),function(t){if(Array.isArray(t))return t}(t)||function(t){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var r,n,o,i,a=[],s=!0,u=!1;try{for(o=(e=e.call(t)).next;!(s=(r=o.call(e)).done)&&(a.push(r.value),1!==a.length);s=!0);}catch(t){u=!0,n=t}finally{try{if(!s&&null!=e.return&&(i=e.return(),Object(i)!==i))return}finally{if(u)throw n}}return a}}(t)||r(t,1)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];var t},f={getState:function(){return u.getState()},subscribe:u.subscribe.bind(u),createSelectorHook:w.bind(l),createObservable:S.bind(l),dispose:function(){c(),u.dispose()},subscribers:u.subscribers};return Object.assign(l,f),l}t.GlobalStore=m,t.default=m})(),l})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./uniqueId.js"),require("react"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./isRecord.js"),require("json-storage-formatter/isFunction"),require("./shallowCompare.js"),require("json-storage-formatter/isNil")):"function"==typeof define&&define.amd?define(["./uniqueId.js","react","./throwWrongKeyOnActionCollectionConfig.js","./isRecord.js","json-storage-formatter/isFunction","./shallowCompare.js","json-storage-formatter/isNil"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./uniqueId.js"),require("react"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./isRecord.js"),require("json-storage-formatter/isFunction"),require("./shallowCompare.js"),require("json-storage-formatter/isNil")):t["react-hooks-global-states"]=e(t["./uniqueId.js"],t.react,t["./throwWrongKeyOnActionCollectionConfig.js"],t["./isRecord.js"],t["json-storage-formatter/isFunction"],t["./shallowCompare.js"],t["json-storage-formatter/isNil"]);
1
+ var t,e;t=this,e=(t,e,r,n,o,i,a)=>(()=>{"use strict";var s={78:e=>{e.exports=t},155:t=>{t.exports=e},361:t=>{t.exports=r},487:t=>{t.exports=n},506:t=>{t.exports=o},673:t=>{t.exports=i},773:t=>{t.exports=a},811:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});var r=globalThis;r.isDevToolsPresent=Boolean(r.REACT_GLOBAL_STATE_HOOK_DEBUG),e.default=r}},u={};function c(t){var e=u[t];if(void 0!==e)return e.exports;var r=u[t]={exports:{}};return s[t](r,r.exports,c),r.exports}var l={};return(()=>{var t=l;function e(t){return e="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},e(t)}function r(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function o(){o=function(){return r};var t,r={},n=Object.prototype,i=n.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function d(t,e,r,n){var o=e&&e.prototype instanceof m?e:m,i=Object.create(o.prototype),s=new T(n||[]);return a(i,"_invoke",{value:C(t,r,s)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=d;var b="suspendedStart",v="suspendedYield",p="executing",y="completed",g={};function m(){}function S(){}function w(){}var j={};f(j,u,(function(){return this}));var O=Object.getPrototypeOf,x=O&&O(O(q([])));x&&x!==n&&i.call(x,u)&&(j=x);var E=w.prototype=m.prototype=Object.create(j);function k(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,r){function n(o,a,s,u){var c=h(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==e(f)&&i.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,s,u)}),(function(t){n("throw",t,s,u)})):r.resolve(f).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,u)}))}u(c.arg)}var o;a(this,"_invoke",{value:function(t,e){function i(){return new r((function(r,o){n(t,e,r,o)}))}return o=o?o.then(i,i):i()}})}function C(e,r,n){var o=b;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=L(s,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===b)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var c=h(e,r,n);if("normal"===c.type){if(o=n.done?y:v,c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=y,n.method="throw",n.arg=c.arg)}}}function L(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,L(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function q(r){if(r||""===r){var n=r[u];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(i.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(e(r)+" is not iterable")}return S.prototype=w,a(E,"constructor",{value:w,configurable:!0}),a(w,"constructor",{value:S,configurable:!0}),S.displayName=f(w,l,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===S||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,f(t,l,"GeneratorFunction")),t.prototype=Object.create(E),t},r.awrap=function(t){return{__await:t}},k(_.prototype),f(_.prototype,c,(function(){return this})),r.AsyncIterator=_,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new _(d(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},k(E),f(E,l,"Generator"),f(E,u,(function(){return this})),f(E,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=q,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),M(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;M(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:q(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},r}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function a(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var r=function(t){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:r+""}var u,f=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},d=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},h=(u=function(t){return u=Object.getOwnPropertyNames||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[e.length]=r);return e},u(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r=u(t),n=0;n<r.length;n++)"default"!==r[n]&&f(e,t,r[n]);return d(e,t),e}),b=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalStore=void 0,t.createObservable=x,t.createSelectorHook=E;var v=c(155),p=b(c(506)),y=b(c(773)),g=b(c(487)),m=h(c(673)),S=b(c(361)),w=b(c(78)),j=b(c(811)),O=a((function t(e){var n,i,a=this,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{metadata:{}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Set,this.initialize=function(){return t=a,e=void 0,r=o().mark((function t(){var e,r,n,i,a,s,u;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.getStoreActionsMap(),n=r.actions,i=r.storeTools,this.actions=n,this.storeTools=i,this.use=this.getMainHook(),a=this.onInit,s=null!==(e=this.callbacks)&&void 0!==e?e:{},u=s.onInit,a||u){t.next=8;break}return t.abrupt("return");case 8:null==a||a(i),(0,y.default)(u)||null==u||u(i);case 10:case"end":return t.stop()}}),t,this)})),new(e||(e=Promise))((function(n,o){function i(t){try{s(r.next(t))}catch(t){o(t)}}function a(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var r;t.done?n(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(i,a)}s((r=r.apply(t,[])).next())}));var t,e,r},this.executeSetStateForSubscriber=function(t,e){var r=t.selector,n=t.onStoreChange,o=t.currentState,i=t.isEqualRoot,s=void 0===i?function(t,e){return t===e}:i,u=t.isEqual,c=void 0===u?function(t,e){return t===e}:u;if(!e.forceUpdate&&s(e.currentState,e.newState))return{didUpdate:!1};var l=r?r(e.newState):e.newState;return!e.forceUpdate&&c(o,l)?{didUpdate:!1}:(a.partialUpdateSubscription(t,{currentState:l}),n({state:l},{identifier:e.identifier}),{didUpdate:!0})},this.setSubscribersState=function(t,e){var n=e.forceUpdate,o=e.identifier,i=a.state;if(n||i!==t){a.state=t;var s,u={forceUpdate:n,newState:t,currentState:i,identifier:o},c=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=r(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw i}}}}(a.subscribers.values());try{for(c.s();!(s=c.n()).done;){var l=s.value;a.executeSetStateForSubscriber(l,u)}}catch(t){c.e(t)}finally{c.f()}}},this.setMetadata=function(t){var e=(0,p.default)(t)?t(a.metadata):t;a.metadata=e},this.getMetadata=function(){return a.metadata},this.getState=function(){return a.state},this.subscribe=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,o=e[0],i=e[1],s=e[2],u=(0,p.default)(i),c=u?o:void 0,l=u?i:o,f=null!==(n=u?s:i)&&void 0!==n?n:void 0,d=c?c(a.state):a.state;(null==f?void 0:f.skipFirst)||l(d);var h=Object.assign({selector:c,currentState:d,onStoreChange:function(t){var e=t.state;return l(e)}},f);return a.subscribeCallback(h),function(){a.subscribers.delete(h)}},this.subscribeCallback=function(t){return a.executeOnSubscribed(t),a.subscribers.add(t),function(){a.subscribers.delete(t)}},this.partialUpdateSubscription=function(t,e){Object.assign(t,e)},this.executeOnSubscribed=function(t){var e,r=a.onSubscribed,n=null===(e=a.callbacks)||void 0===e?void 0:e.onSubscribed;(r||n)&&(null==r||r(a.storeTools,t),null==n||n(a.storeTools,t))},this.getMainHook=function(){var t=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];(0,v.useDebugValue)("global-state: ".concat(a._name));var r=(0,m.isArray)(e)?{dependencies:e}:null!=e?e:{},n=(0,v.useRef)(null),o=function(e){return(0,p.default)(t)?t(e):e};n.current=n.current?n.current:Object.assign({selector:o,currentState:o(a.state),onStoreChange:function(){throw new Error("Callback not set")}},r);var i=n.current.dependencies,s=null==r?void 0:r.dependencies;Object.assign(n.current,{selector:o,options:r});var u=(0,v.useMemo)((function(){var t=function(){return n.current.currentState};return{subscribe:function(t){return n.current.onStoreChange=t,a.subscribeCallback(n.current)},getSnapshot:t,getServerSnapshot:t}}),[]),c=u.subscribe,l=u.getSnapshot,f=u.getServerSnapshot;return(0,v.useSyncExternalStore)(c,l,f),[a.computeSelectedState({subscription:n.current,newDependencies:s,currentDependencies:i}),a.getStateOrchestrator(),a.metadata]},e=a.setMetadata,r=a.getMetadata,n=a.actions,o=a.actions?null:a.setState.bind(a),i=a,s={actions:n,createObservable:a.createObservable.bind(i),createSelectorHook:a.createSelectorHook.bind(i),dispose:a.dispose.bind(a),getMetadata:r,getState:a.getState.bind(a),setMetadata:e,setState:o,subscribe:a.subscribe.bind(a),subscribers:a.subscribers,use:t,select:function(){return t.apply(void 0,arguments)[0]}};return Object.assign(t,s),t},this.computeSelectedState=function(t){var e=t.subscription,r=t.newDependencies,n=t.currentDependencies;return e.selector?(n===r||(null==n?void 0:n.length)===(null==r?void 0:r.length)&&(0,m.default)(n,r)||a.partialUpdateSubscription(e,{currentState:e.selector(a.state)}),e.currentState):e.currentState},this.createSelectorHook=E,this.createObservable=x,this.getStateOrchestrator=function(){return a.actions?a.actions:a.setState},this.setState=function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.forceUpdate,i=n.identifier,s=a.state,u=(0,p.default)(t)?t(s):t;if(o||a.state!==u){var c=a.setMetadata,l=a.getMetadata,f=a.getState,d=a.actions,h={setMetadata:c,getMetadata:l,setState:a.setSubscribersState,getState:f,actions:d,previousState:s,state:u,identifier:i},b=a.computePreventStateChange,v=null===(e=a.callbacks)||void 0===e?void 0:e.computePreventStateChange;if((b||v)&&((null==b?void 0:b(h))||(null==v?void 0:v(h))))return;a.setSubscribersState(u,{forceUpdate:o,identifier:i});var y=a.onStateChanged,g=null===(r=a.callbacks)||void 0===r?void 0:r.onStateChanged;(y||g)&&(null==y||y(h),null==g||g(h))}},this.getStoreActionsMap=function(){var t=a.actionsConfig,e=a.getMetadata,r=a.getState,n={setMetadata:a.setMetadata,getMetadata:e,getState:r,setState:a.setState,subscribe:a.subscribe,actions:null};if(!(0,g.default)(t))return{actions:null,storeTools:n};var o={};n.actions=o;for(var i=Object.keys(t),u=function(){var e,r,i,a=l[c];Object.assign(o,(e={},i=function(){for(var e=t[a],r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];var u=e.apply(o,i);return"function"!=typeof u&&(0,S.default)(a),u.call(o,n)},(r=s(r=a))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e))},c=0,l=i;c<l.length;c++)u();return{actions:o,storeTools:n}},this.removeSubscriptions=function(){a.subscribers.clear()},this.dispose=function(){a.removeSubscriptions(),a._name="",a.actionsConfig=null,a.callbacks=null,a.metadata={},a.actions=null,a.state=Object.create(null)};var c=u.metadata,l=u.callbacks,f=u.actions,d=u.name;if(this.state=e,this._name=null!=d?d:(0,w.default)("gs:"),this.metadata=null!=c?c:{},this.callbacks=null!=l?l:null,this.actionsConfig=null!=f?f:null,j.default.isDevToolsPresent){var h=null!==(n=(new Error).stack)&&void 0!==n?n:"";null===(i=j.default.REACT_GLOBAL_STATE_HOOK_DEBUG)||void 0===i||i.call(j.default,this,u,h)}this.constructor!==t||this.initialize()}));function x(t,e){var r=null==e?void 0:e.name,n=null==e?void 0:e.isEqualRoot,o=null==e?void 0:e.isEqual,i=this.getState(),a=(null!=t?t:function(t){return t})(i),s=new O(a,{name:null!=r?r:(0,w.default)("sh:")}),u=this.subscribe((function(e){if(!(null!=n?n:Object.is)(i,e)){i=e;var r=t(e);(null!=o?o:Object.is)(a,r)||(a=r,s.setState(r))}}),{skipFirst:!0}),c=s.subscribe.bind(s),l={getState:s.getState.bind(s),subscribe:s.subscribe.bind(s),createSelectorHook:E.bind(c),createObservable:x.bind(c),dispose:function(){u(),s.dispose()},subscribers:s.subscribers};return Object.assign(c,l),c}function E(t,e){var n=null==e?void 0:e.name,o=null==e?void 0:e.isEqualRoot,i=null==e?void 0:e.isEqual,a=this.getState(),s=(null!=t?t:function(t){return t})(a),u=new O(s,{name:null!=n?n:(0,w.default)("sh:")}),c=this.subscribe((function(e){if(!(null!=o?o:Object.is)(a,e)){a=e;var r=t(e);(null!=i?i:Object.is)(s,r)||(s=r,u.setState(r))}}),{skipFirst:!0}),l=function(){return(t=u.use.apply(u,arguments),function(t){if(Array.isArray(t))return t}(t)||function(t){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var r,n,o,i,a=[],s=!0,u=!1;try{for(o=(e=e.call(t)).next;!(s=(r=o.call(e)).done)&&(a.push(r.value),1!==a.length);s=!0);}catch(t){u=!0,n=t}finally{try{if(!s&&null!=e.return&&(i=e.return(),Object(i)!==i))return}finally{if(u)throw n}}return a}}(t)||r(t,1)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];var t},f={getState:function(){return u.getState()},subscribe:u.subscribe.bind(u),createSelectorHook:E.bind(l),createObservable:x.bind(l),dispose:function(){c(),u.dispose()},subscribers:u.subscribers};return Object.assign(l,f),l}t.GlobalStore=O,t.default=O})(),l})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./uniqueId.js"),require("react"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./isRecord.js"),require("json-storage-formatter/isFunction"),require("./shallowCompare.js"),require("json-storage-formatter/isNil")):"function"==typeof define&&define.amd?define(["./uniqueId.js","react","./throwWrongKeyOnActionCollectionConfig.js","./isRecord.js","json-storage-formatter/isFunction","./shallowCompare.js","json-storage-formatter/isNil"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./uniqueId.js"),require("react"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./isRecord.js"),require("json-storage-formatter/isFunction"),require("./shallowCompare.js"),require("json-storage-formatter/isNil")):t["react-hooks-global-states"]=e(t["./uniqueId.js"],t.react,t["./throwWrongKeyOnActionCollectionConfig.js"],t["./isRecord.js"],t["json-storage-formatter/isFunction"],t["./shallowCompare.js"],t["json-storage-formatter/isNil"]);
package/createContext.js CHANGED
@@ -1 +1 @@
1
- var e,t;e=this,t=(e,t,r,o)=>(()=>{"use strict";var n={155:t=>{t.exports=e},506:e=>{e.exports=t},639:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createContext=void 0;var o=r(155),n=r(778),a=r(506),u=r(773);function i(e,t){var r=this,a=function(){(0,o.useDebugValue)("context-selector: ".concat(null==t?void 0:t.name));var n=r.api();return(0,o.useMemo)((function(){return n.createSelectorHook(e,t)}),[n]).apply(void 0,arguments)},u={createSelectorHook:i.bind(a),api:function(){(0,o.useDebugValue)("context-selector-api: ".concat(null==t?void 0:t.name));var a=r.api();return(0,o.useMemo)((function(){var r=a.createObservable(e,t);return Object.assign(Object.assign({},a),{getState:function(){return r.getState()},subscribe:r.subscribe.bind(r),createSelectorHook:n.createSelectorHook.bind(r),createObservable:n.createObservable.bind(r)})}),[a])}};return Object.assign(a,u),a}t.createContext=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,o.createContext)(null),s=function(i){var s=i.children,c=i.value,v=i.onCreated,d=(0,o.useMemo)((function(){var r,o=function(){return(0,a.isFunction)(e)?e():e},i=(0,u.isNil)(c)?o():(0,a.isFunction)(c)?c(o()):c,s=new n.GlobalStore(i,Object.assign(Object.assign({},t),{metadata:null!==(r=(0,a.isFunction)(t.metadata)?t.metadata():t.metadata)&&void 0!==r?r:{}})),v={use:l};return Object.assign(s.storeTools,v),s}),[]);return(0,o.useEffect)((function(){return function(){var e,t,r,o;null===(t=null===(e=d.callbacks)||void 0===e?void 0:e.onUnMount)||void 0===t||t.call(e,d),null===(o=(r=d).__onUnMountContext)||void 0===o||o.call(r,d),d.dispose()}}),[d]),null==v||v(d.storeTools),(0,o.createElement)(r.Provider,{value:d.use},s)},c={makeProviderWrapper:function(e){var t={current:void 0};return{wrapper:function(r){var n=r.children;return(0,o.createElement)(s,{value:null==e?void 0:e.value,onCreated:function(r){var o;t.current=r,null===(o=null==e?void 0:e.onCreated)||void 0===o||o.call(e,r)}},n)},context:t}}},l=function(){(0,o.useDebugValue)("context-use: ".concat(t.name));var e=(0,o.useContext)(r);if(!e)throw new Error("use hook must be used within a ContextProvider");return e.apply(void 0,arguments)},v=function(){(0,o.useDebugValue)("context-api: ".concat(t.name));var e=(0,o.useContext)(r);if(!e)throw new Error("api hook must be used within a ContextProvider");return e},d={createSelectorHook:i.bind(l),api:v,select:function(){return l.apply(void 0,arguments)[0]},observable:function(){(0,o.useDebugValue)("context-observable: ".concat(t.name));for(var e=v(),r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];var u=(0,o.useRef)(n);return u.current=n,(0,o.useMemo)((function(){var t,r,o;return e.createObservable((function(e){return(0,u.current[0])(e)}),{isEqualRoot:(null===(t=u.current[1])||void 0===t?void 0:t.isEqualRoot)?function(e,t){var r=u.current[1].isEqualRoot;return Boolean(r(e,t))}:void 0,isEqual:(null===(r=u.current[1])||void 0===r?void 0:r.isEqual)?function(e,t){var r=u.current[1].isEqual;return Boolean(r(e,t))}:void 0,name:null===(o=u.current[1])||void 0===o?void 0:o.name})}),[e])},actions:function(){return v().actions}};return Object.assign(s,c),Object.assign(l,d),{use:l,Provider:s,Context:r}},t.default=t.createContext},773:e=>{e.exports=r},778:e=>{e.exports=o}},a={};return function e(t){var r=a[t];if(void 0!==r)return r.exports;var o=a[t]={exports:{}};return n[t](o,o.exports,e),o.exports}(639)})(),"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("./GlobalStore.js")):"function"==typeof define&&define.amd?define(["react","json-storage-formatter/isFunction","json-storage-formatter/isNil","./GlobalStore.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("react"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("./GlobalStore.js")):e["react-hooks-global-states"]=t(e.react,e["json-storage-formatter/isFunction"],e["json-storage-formatter/isNil"],e["./GlobalStore.js"]);
1
+ var e,t;e=this,t=(e,t,r,o)=>(()=>{"use strict";var n={155:t=>{t.exports=e},506:e=>{e.exports=t},639:(e,t,r)=>{var o=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createContext=void 0;var n=r(155),a=r(778),u=o(r(506)),i=o(r(773));function s(e,t){var r=this,o=function(){(0,n.useDebugValue)("context-selector: ".concat(null==t?void 0:t.name));var o=r.api();return(0,n.useMemo)((function(){return o.createSelectorHook(e,t)}),[o]).apply(void 0,arguments)},u={createSelectorHook:s.bind(o),api:function(){(0,n.useDebugValue)("context-selector-api: ".concat(null==t?void 0:t.name));var o=r.api();return(0,n.useMemo)((function(){var r=o.createObservable(e,t);return Object.assign(Object.assign({},o),{getState:function(){return r.getState()},subscribe:r.subscribe.bind(r),createSelectorHook:a.createSelectorHook.bind(r),createObservable:a.createObservable.bind(r)})}),[o])}};return Object.assign(o,u),o}t.createContext=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,n.createContext)(null),o=function(o){var s=o.children,c=o.value,v=o.onCreated,d=(0,n.useMemo)((function(){var r,o=function(){return(0,u.default)(e)?e():e},n=(0,i.default)(c)?o():(0,u.default)(c)?c(o()):c,s=new a.GlobalStore(n,Object.assign(Object.assign({},t),{metadata:null!==(r=(0,u.default)(t.metadata)?t.metadata():t.metadata)&&void 0!==r?r:{}})),v={use:l};return Object.assign(s.storeTools,v),s}),[]);return(0,n.useEffect)((function(){return function(){var e,t,r,o;null===(t=null===(e=d.callbacks)||void 0===e?void 0:e.onUnMount)||void 0===t||t.call(e,d),null===(o=(r=d).__onUnMountContext)||void 0===o||o.call(r,d),d.dispose()}}),[d]),null==v||v(d.storeTools),(0,n.createElement)(r.Provider,{value:d.use},s)},c={makeProviderWrapper:function(e){var t={current:void 0};return{wrapper:function(r){var a=r.children;return(0,n.createElement)(o,{value:null==e?void 0:e.value,onCreated:function(r){var o;t.current=r,null===(o=null==e?void 0:e.onCreated)||void 0===o||o.call(e,r)}},a)},context:t}}},l=function(){(0,n.useDebugValue)("context-use: ".concat(t.name));var e=(0,n.useContext)(r);if(!e)throw new Error("use hook must be used within a ContextProvider");return e.apply(void 0,arguments)},v=function(){(0,n.useDebugValue)("context-api: ".concat(t.name));var e=(0,n.useContext)(r);if(!e)throw new Error("api hook must be used within a ContextProvider");return e},d={createSelectorHook:s.bind(l),api:v,select:function(){return l.apply(void 0,arguments)[0]},observable:function(){(0,n.useDebugValue)("context-observable: ".concat(t.name));for(var e=v(),r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];var u=(0,n.useRef)(o);return u.current=o,(0,n.useMemo)((function(){var t,r,o;return e.createObservable((function(e){return(0,u.current[0])(e)}),{isEqualRoot:(null===(t=u.current[1])||void 0===t?void 0:t.isEqualRoot)?function(e,t){var r=u.current[1].isEqualRoot;return Boolean(r(e,t))}:void 0,isEqual:(null===(r=u.current[1])||void 0===r?void 0:r.isEqual)?function(e,t){var r=u.current[1].isEqual;return Boolean(r(e,t))}:void 0,name:null===(o=u.current[1])||void 0===o?void 0:o.name})}),[e])},actions:function(){return v().actions}};return Object.assign(o,c),Object.assign(l,d),{use:l,Provider:o,Context:r}},t.default=t.createContext},773:e=>{e.exports=r},778:e=>{e.exports=o}},a={};return function e(t){var r=a[t];if(void 0!==r)return r.exports;var o=a[t]={exports:{}};return n[t](o,o.exports,e),o.exports}(639)})(),"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("./GlobalStore.js")):"function"==typeof define&&define.amd?define(["react","json-storage-formatter/isFunction","json-storage-formatter/isNil","./GlobalStore.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("react"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("./GlobalStore.js")):e["react-hooks-global-states"]=t(e.react,e["json-storage-formatter/isFunction"],e["json-storage-formatter/isNil"],e["./GlobalStore.js"]);
package/isRecord.js CHANGED
@@ -1 +1 @@
1
- var o;o=o=>(()=>{"use strict";var t={35:(o,t,e)=>{function r(o){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},r(o)}Object.defineProperty(t,"__esModule",{value:!0}),t.isRecord=void 0;var s=e(773);t.isRecord=function(o){return!(0,s.isNil)(o)&&"object"===r(o)},t.default=t.isRecord},773:t=>{t.exports=o}},e={};return function o(r){var s=e[r];if(void 0!==s)return s.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,o),i.exports}(35)})(),"object"==typeof exports&&"object"==typeof module?module.exports=o(require("json-storage-formatter/isNil")):"function"==typeof define&&define.amd?define(["json-storage-formatter/isNil"],o):"object"==typeof exports?exports["react-hooks-global-states"]=o(require("json-storage-formatter/isNil")):this["react-hooks-global-states"]=o(this["json-storage-formatter/isNil"]);
1
+ var e;e=e=>(()=>{"use strict";var o={35:(e,o,t)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(o,"__esModule",{value:!0}),o.isRecord=void 0;var s,i=(s=t(773))&&s.__esModule?s:{default:s};o.isRecord=function(e){return!(0,i.default)(e)&&"object"===r(e)},o.default=o.isRecord},773:o=>{o.exports=e}},t={};return function e(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return o[r](i,i.exports,e),i.exports}(35)})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("json-storage-formatter/isNil")):"function"==typeof define&&define.amd?define(["json-storage-formatter/isNil"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("json-storage-formatter/isNil")):this["react-hooks-global-states"]=e(this["json-storage-formatter/isNil"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-hooks-global-states",
3
- "version": "14.1.0-beta.1",
3
+ "version": "14.1.0-beta.2",
4
4
  "description": "This is a package to easily handling global-state across your react-components using hooks.",
5
5
  "main": "./bundle.js",
6
6
  "types": "./index.d.ts",
@@ -74,7 +74,7 @@
74
74
  "postversion": "git push && git push --tags",
75
75
  "lint": "eslint . --max-warnings=0",
76
76
  "lint:fix": "eslint . --fix --max-warnings=0",
77
- "clean": "find . -maxdepth 1 -type f \\( -name '*.js' -o -name '*.d.ts' \\) ! -name 'webpack.config.js' ! -name 'eslint.config.mts' -exec rm {} +",
77
+ "clean": "find . -maxdepth 1 -type f \\( -name '*.js' -o -name '*.d.ts' \\) ! -name 'webpack.config.js' ! -name 'eslint.config.mts' -exec rm {} + && rm -rf coverage",
78
78
  "ts-check": "tsc -p tsconfig.json --noEmit"
79
79
  },
80
80
  "repository": {
@@ -127,7 +127,6 @@
127
127
  "jest": "^29.7.0",
128
128
  "jest-environment-jsdom": "^30.0.4",
129
129
  "jiti": "^2.6.1",
130
- "json-storage-formatter": "^2.0.9",
131
130
  "prettier": "^3.6.2",
132
131
  "react": "^18.2.0",
133
132
  "react-dom": "^18.2.0",
@@ -139,8 +138,11 @@
139
138
  "webpack": "^5.76.3",
140
139
  "webpack-cli": "^5.0.1"
141
140
  },
141
+ "dependencies": {
142
+ "json-storage-formatter": "^3.0.2"
143
+ },
142
144
  "peerDependencies": {
143
- "json-storage-formatter": "^2.0.9",
145
+ "json-storage-formatter": "^3.0.2",
144
146
  "react": "^18.0.0",
145
147
  "react-dom": "^18.0.0"
146
148
  },
package/shallowCompare.js CHANGED
@@ -1 +1 @@
1
- var r,t;r=this,t=(r,t,e,n)=>(()=>{"use strict";var o={38:t=>{t.exports=r},487:r=>{r.exports=t},773:r=>{r.exports=e},955:r=>{r.exports=n},973:(r,t,e)=>{function n(r,t){var e="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!e){if(Array.isArray(r)||(e=o(r))||t&&r&&"number"==typeof r.length){e&&(r=e);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r){throw r},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){e=e.call(r)},n:function(){var r=e.next();return s=r.done,r},e:function(r){u=!0,a=r},f:function(){try{s||null==e.return||e.return()}finally{if(u)throw a}}}}function o(r,t){if(r){if("string"==typeof r)return i(r,t);var e={}.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(r,t):void 0}}function i(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=Array(t);e<t;e++)n[e]=r[e];return n}function a(r){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},a(r)}Object.defineProperty(t,"__esModule",{value:!0}),t.isEqualObject=t.isEqualSet=t.isEqualMap=t.isEqualArray=t.canCheckSimpleEquality=t.isSet=t.isMap=t.isArray=t.shallowCompare=void 0;var s=e(955),u=e(38),l=e(773),f=e(487);t.shallowCompare=function(r,e){return!(r!==e)||((0,t.canCheckSimpleEquality)(r,e)?r===e:(0,t.isArray)(r)&&(0,t.isArray)(e)?(0,t.isEqualArray)(r,e):(0,t.isMap)(r)&&(0,t.isMap)(e)?(0,t.isEqualMap)(r,e):(0,t.isSet)(r)&&(0,t.isSet)(e)?(0,t.isEqualSet)(r,e):(0,f.isRecord)(r)&&(0,f.isRecord)(e)?(0,t.isEqualObject)(r,e):r===e)},t.isArray=function(r){return Array.isArray(r)},t.isMap=function(r){return r instanceof Map},t.isSet=function(r){return r instanceof Set},t.canCheckSimpleEquality=function(r,t){var e=a(r),n=a(t);return e!==n||(0,l.isNil)(r)||(0,l.isNil)(t)||(0,s.isPrimitive)(r)&&(0,s.isPrimitive)(t)||(0,u.isDate)(r)&&(0,u.isDate)(t)||"function"===e&&"function"===n},t.isEqualArray=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e+=1)if(r[e]!==t[e])return!1;return!0},t.isEqualMap=function(r,t){if(r.size!==t.size)return!1;var e,i,a=n(r);try{for(a.s();!(e=a.n()).done;){var s=function(r){if(Array.isArray(r))return r}(i=e.value)||function(r){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,o,i,a=[],s=!0,u=!1;try{for(o=(t=t.call(r)).next;!(s=(e=o.call(t)).done)&&(a.push(e.value),2!==a.length);s=!0);}catch(r){u=!0,n=r}finally{try{if(!s&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(u)throw n}}return a}}(i)||o(i,2)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),u=s[0];if(s[1]!==t.get(u))return!1}}catch(r){a.e(r)}finally{a.f()}return!0},t.isEqualSet=function(r,t){if(r.size!==t.size)return!1;var e,o=n(r);try{for(o.s();!(e=o.n()).done;){var i=e.value;if(!t.has(i))return!1}}catch(r){o.e(r)}finally{o.f()}return!0},t.isEqualObject=function(r,t){var e=Object.keys(r),n=Object.keys(t);if(e.length!==n.length)return!1;for(var o=0,i=e;o<i.length;o++){var a=i[o];if(r[a]!==t[a])return!1}return!0},t.default=t.shallowCompare}},i={};return function r(t){var e=i[t];if(void 0!==e)return e.exports;var n=i[t]={exports:{}};return o[t](n,n.exports,r),n.exports}(973)})(),"object"==typeof exports&&"object"==typeof module?module.exports=t(require("json-storage-formatter/isDate"),require("./isRecord.js"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isPrimitive")):"function"==typeof define&&define.amd?define(["json-storage-formatter/isDate","./isRecord.js","json-storage-formatter/isNil","json-storage-formatter/isPrimitive"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("json-storage-formatter/isDate"),require("./isRecord.js"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isPrimitive")):r["react-hooks-global-states"]=t(r["json-storage-formatter/isDate"],r["./isRecord.js"],r["json-storage-formatter/isNil"],r["json-storage-formatter/isPrimitive"]);
1
+ var r,t;r=this,t=(r,t,e,n)=>(()=>{"use strict";var o={38:t=>{t.exports=r},487:r=>{r.exports=t},773:r=>{r.exports=e},955:r=>{r.exports=n},973:(r,t,e)=>{function n(r,t){var e="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!e){if(Array.isArray(r)||(e=o(r))||t&&r&&"number"==typeof r.length){e&&(r=e);var n=0,a=function(){};return{s:a,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,s=!1;return{s:function(){e=e.call(r)},n:function(){var r=e.next();return u=r.done,r},e:function(r){s=!0,i=r},f:function(){try{u||null==e.return||e.return()}finally{if(s)throw i}}}}function o(r,t){if(r){if("string"==typeof r)return a(r,t);var e={}.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(r,t):void 0}}function a(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=Array(t);e<t;e++)n[e]=r[e];return n}function i(r){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},i(r)}var u=function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(t,"__esModule",{value:!0}),t.isEqualObject=t.isEqualSet=t.isEqualMap=t.isEqualArray=t.canCheckSimpleEquality=t.isSet=t.isMap=t.isArray=t.shallowCompare=void 0;var s=u(e(955)),l=u(e(38)),f=u(e(773)),c=u(e(487));t.shallowCompare=function(r,e){return!(r!==e)||((0,t.canCheckSimpleEquality)(r,e)?r===e:(0,t.isArray)(r)&&(0,t.isArray)(e)?(0,t.isEqualArray)(r,e):(0,t.isMap)(r)&&(0,t.isMap)(e)?(0,t.isEqualMap)(r,e):(0,t.isSet)(r)&&(0,t.isSet)(e)?(0,t.isEqualSet)(r,e):(0,c.default)(r)&&(0,c.default)(e)?(0,t.isEqualObject)(r,e):r===e)},t.isArray=function(r){return Array.isArray(r)},t.isMap=function(r){return r instanceof Map},t.isSet=function(r){return r instanceof Set},t.canCheckSimpleEquality=function(r,t){var e=i(r),n=i(t);return e!==n||(0,f.default)(r)||(0,f.default)(t)||(0,s.default)(r)&&(0,s.default)(t)||(0,l.default)(r)&&(0,l.default)(t)||"function"===e&&"function"===n},t.isEqualArray=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e+=1)if(r[e]!==t[e])return!1;return!0},t.isEqualMap=function(r,t){if(r.size!==t.size)return!1;var e,a,i=n(r);try{for(i.s();!(e=i.n()).done;){var u=function(r){if(Array.isArray(r))return r}(a=e.value)||function(r){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,o,a,i=[],u=!0,s=!1;try{for(o=(t=t.call(r)).next;!(u=(e=o.call(t)).done)&&(i.push(e.value),2!==i.length);u=!0);}catch(r){s=!0,n=r}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw n}}return i}}(a)||o(a,2)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),s=u[0];if(u[1]!==t.get(s))return!1}}catch(r){i.e(r)}finally{i.f()}return!0},t.isEqualSet=function(r,t){if(r.size!==t.size)return!1;var e,o=n(r);try{for(o.s();!(e=o.n()).done;){var a=e.value;if(!t.has(a))return!1}}catch(r){o.e(r)}finally{o.f()}return!0},t.isEqualObject=function(r,t){var e=Object.keys(r),n=Object.keys(t);if(e.length!==n.length)return!1;for(var o=0,a=e;o<a.length;o++){var i=a[o];if(r[i]!==t[i])return!1}return!0},t.default=t.shallowCompare}},a={};return function r(t){var e=a[t];if(void 0!==e)return e.exports;var n=a[t]={exports:{}};return o[t](n,n.exports,r),n.exports}(973)})(),"object"==typeof exports&&"object"==typeof module?module.exports=t(require("json-storage-formatter/isDate"),require("./isRecord.js"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isPrimitive")):"function"==typeof define&&define.amd?define(["json-storage-formatter/isDate","./isRecord.js","json-storage-formatter/isNil","json-storage-formatter/isPrimitive"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("json-storage-formatter/isDate"),require("./isRecord.js"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isPrimitive")):r["react-hooks-global-states"]=t(r["json-storage-formatter/isDate"],r["./isRecord.js"],r["json-storage-formatter/isNil"],r["json-storage-formatter/isPrimitive"]);
package/webpack.config.js CHANGED
@@ -32,7 +32,6 @@ module.exports = {
32
32
  react: 'react',
33
33
 
34
34
  'json-storage-formatter': 'json-storage-formatter',
35
- 'json-storage-formatter/clone': 'json-storage-formatter/clone',
36
35
  'json-storage-formatter/isNil': 'json-storage-formatter/isNil',
37
36
  'json-storage-formatter/isNumber': 'json-storage-formatter/isNumber',
38
37
  'json-storage-formatter/isBoolean': 'json-storage-formatter/isBoolean',