react-hooks-global-states 11.0.0-beta.0 → 11.0.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.js CHANGED
@@ -1 +1,128 @@
1
- var t,e;t=this,e=(t,e,r,n,i,o,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=i},673:t=>{t.exports=o},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}},c={};function u(t){var e=c[t];if(void 0!==e)return e.exports;var r=c[t]={exports:{}};return s[t](r,r.exports,u),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 i(){i=function(){return r};var t,r={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},s="function"==typeof Symbol?Symbol:{},c=s.iterator||"@@iterator",u=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 i=e&&e.prototype instanceof m?e:m,o=Object.create(i.prototype),s=new A(n||[]);return a(o,"_invoke",{value:M(t,r,s)}),o}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",v="suspendedYield",p="executing",g="completed",y={};function m(){}function S(){}function w(){}var j={};f(j,c,(function(){return this}));var O=Object.getPrototypeOf,k=O&&O(O(P([])));k&&k!==n&&o.call(k,c)&&(j=k);var x=w.prototype=m.prototype=Object.create(j);function C(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,r){function n(i,a,s,c){var u=d(t[i],t,a);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==e(f)&&o.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,s,c)}),(function(t){n("throw",t,s,c)})):r.resolve(f).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,c)}))}c(u.arg)}var i;a(this,"_invoke",{value:function(t,e){function o(){return new r((function(r,i){n(t,e,r,i)}))}return i=i?i.then(o,o):o()}})}function M(e,r,n){var i=b;return function(o,a){if(i===p)throw Error("Generator is already running");if(i===g){if("throw"===o)throw a;return{value:t,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var c=L(s,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===b)throw i=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=p;var u=d(e,r,n);if("normal"===u.type){if(i=n.done?g:v,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=g,n.method="throw",n.arg=u.arg)}}}function L(e,r){var n=r.method,i=e.iterator[n];if(i===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")),y;var o=d(i,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var a=o.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,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function _(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 q(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function P(r){if(r||""===r){var n=r[c];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var i=-1,a=function e(){for(;++i<r.length;)if(o.call(r,i))return e.value=r[i],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(x,"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(x),t},r.awrap=function(t){return{__await:t}},C(E.prototype),f(E.prototype,u,(function(){return this})),r.AsyncIterator=E,r.async=function(t,e,n,i,o){void 0===o&&(o=Promise);var a=new E(h(t,e,n,i),o);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},C(x),f(x,l,"Generator"),f(x,c,(function(){return this})),f(x,"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=P,A.prototype={constructor:A,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(q),!e)for(var r in this)"t"===r.charAt(0)&&o.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,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),u=o.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)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&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):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),y},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),q(r),y}},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 i=n.arg;q(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:P(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},r}function o(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;var a,s=u(155),c=u(506),f=u(773),h=u(487),d=u(673),b=u(361),v=u(78),p=(a=u(811))&&a.__esModule?a:{default:a},g=function(){return t=function t(e){var n,a,u=this,l=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=u,e=void 0,r=i().mark((function t(){var e,r,n,o,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object.keys(null!==(e=this.actionsConfig)&&void 0!==e?e:{}).length>0&&(this.actions=this.getStoreActionsMap()),this.use=this.getMainHook(),this.configurationCallbackParam=this.getConfigCallbackParam(),n=this.onInit,o=null!==(r=this.callbacks)&&void 0!==r?r:{},a=o.onInit,n||a){t.next=8;break}return t.abrupt("return");case 8:null==n||n(this.configurationCallbackParam),(0,f.isNil)(a)||null==a||a(this.configurationCallbackParam);case 10:case"end":return t.stop()}}),t,this)})),new(e||(e=Promise))((function(n,i){function o(t){try{s(r.next(t))}catch(t){i(t)}}function a(t){try{s(r.throw(t))}catch(t){i(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(o,a)}s((r=r.apply(t,[])).next())}));var t,e,r},this.executeSetStateForSubscriber=function(t,e){var r,n,i,o=t.selector,a=t.callback,s=t.currentState,c=t.getConfig,l=null!==(r=null==c?void 0:c())&&void 0!==r?r:{};if(!e.forceUpdate&&(null!==(n=null==l?void 0:l.isEqualRoot)&&void 0!==n?n:function(t,e){return t===e})(e.currentState,e.newState))return{didUpdate:!1};var f=o?o(e.newState):e.newState;return!e.forceUpdate&&(null!==(i=null==l?void 0:l.isEqual)&&void 0!==i?i:function(t,e){return t===e})(s,f)?{didUpdate:!1}:(u.partialUpdateSubscription(t,{currentState:f}),a({state:f},{identifier:e.identifier}),{didUpdate:!0})},this.setSubscribersState=function(t,e){var n=e.forceUpdate,i=e.identifier,o=u.state;if(n||o!==t){u.state=t;var a,s={forceUpdate:n,newState:t,currentState:o,identifier:i},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,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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 o,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,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw o}}}}(u.subscribers.values());try{for(c.s();!(a=c.n()).done;){var l=a.value;u.executeSetStateForSubscriber(l,s)}}catch(t){c.e(t)}finally{c.f()}}},this.setMetadata=function(t){var e=(0,c.isFunction)(t)?t(u.metadata):t;u.metadata=e},this.getMetadata=function(){return u.metadata},this.getState=function(){return u.state},this.getConfigCallbackParam=function(){var t=u.setMetadata,e=u.getMetadata,r=u.getState,n=u.subscribe,i=u.actions;return{setMetadata:t,getMetadata:e,getState:r,subscribe:n,setState:u.setState,actions:i}},this.subscribeCallback=function(t){return u.executeOnSubscribed(t),u.subscribers.add(t),function(){u.subscribers.delete(t)}},this.partialUpdateSubscription=function(t,e){(0,h.isRecord)(t)&&Object.assign(t,e)},this.executeOnSubscribed=function(t){var e,r=u.onSubscribed,n=null===(e=u.callbacks)||void 0===e?void 0:e.onSubscribed;(r||n)&&(null==r||r(u.configurationCallbackParam,t),null==n||n(u.configurationCallbackParam,t))},this.getMainHook=function(){var t=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=(0,d.isArray)(e)?{dependencies:e}:null!=e?e:{},n=(0,s.useRef)({selector:t,config:r}),i=n.current.config.dependencies;n.current.selector=t,n.current.config=r;var o=(0,s.useMemo)((function(){var t=function(t){var e=n.current.selector;return(0,c.isFunction)(e)?e(t):t},e={currentState:t(u.state),selector:t,getConfig:function(){return n.current.config},callback:function(){throw new Error("Callback not set")}},r=function(){return e.currentState};return{subscribe:function(t){return e.callback=t,u.subscribeCallback(e)},getSnapshot:r,getServerSnapshot:r,subscription:e}}),[]),a=o.subscribe,l=o.getSnapshot,f=o.getServerSnapshot,h=o.subscription;return(0,s.useSyncExternalStore)(a,l,f),[u.computeSelectedState({subscription:h,currentDependencies:i}),u.getStateOrchestrator(),u.metadata]},e={setMetadata:u.setMetadata.bind(u),getMetadata:u.getMetadata.bind(u),actions:u.actions,setState:u.actions?null:u.setState,getState:u.getState.bind(u),subscribe:u.subscribe.bind(u),createSelectorHook:u.createSelectorHook.bind(t),createObservable:u.createObservable.bind(t),removeSubscriptions:u.removeSubscriptions.bind(u),dispose:u.dispose.bind(u)};return Object.assign(t,e),t},this.computeSelectedState=function(t){var e,r=t.subscription,n=t.currentDependencies;if(!r.selector)return r.currentState;var i=(null!==(e=r.getConfig())&&void 0!==e?e:{}).dependencies;return n===i||(null==n?void 0:n.length)===(null==i?void 0:i.length)&&(0,d.shallowCompare)(n,i)||u.partialUpdateSubscription(r,{currentState:r.selector(u.state)}),r.currentState},this.createSelectorHook=m.bind(this),this.createObservable=y.bind(this),this.getStateOrchestrator=function(){return u.actions?u.actions:u.setState},this.setState=function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.forceUpdate,o=n.identifier,a=u.state,s=(0,c.isFunction)(t)?t(a):t;if(i||u.state!==s){var l=u.setMetadata,f=u.getMetadata,h=u.getState,d=u.actions,b={setMetadata:l,getMetadata:f,setState:u.setSubscribersState,getState:h,actions:d,previousState:a,state:s,identifier:o},v=u.computePreventStateChange,p=null===(e=u.callbacks)||void 0===e?void 0:e.computePreventStateChange;if((v||p)&&((null==v?void 0:v(b))||(null==p?void 0:p(b))))return;u.setSubscribersState(s,{forceUpdate:i,identifier:o});var g=u.onStateChanged,y=null===(r=u.callbacks)||void 0===r?void 0:r.onStateChanged;(g||y)&&(null==g||g(b),null==y||y(b))}},this.getStoreActionsMap=function(){if(!(0,h.isRecord)(u.actionsConfig))return null;var t=u.actionsConfig,e=u.setMetadata,r=u.setState,n=u.getState,i=u.getMetadata,a=Object.keys(t).reduce((function(s,c){var u,l,f;return Object.assign(s,(u={},f=function(){for(var o=t[c],s=arguments.length,u=new Array(s),l=0;l<s;l++)u[l]=arguments[l];var f=o.apply(a,u);return"function"!=typeof f&&(0,b.throwWrongKeyOnActionCollectionConfig)(c),f.call(a,{setState:r,getState:n,setMetadata:e,getMetadata:i,actions:a})},(l=o(l=c))in u?Object.defineProperty(u,l,{value:f,enumerable:!0,configurable:!0,writable:!0}):u[l]=f,u)),s}),{});return a},this.removeSubscriptions=function(){u.subscribers.clear()},this.dispose=function(){u.removeSubscriptions(),u._name="",u.actionsConfig=null,u.callbacks=null,u.metadata={},u.actions=null,u.state=Object.create(null)};var g=l.metadata,S=l.callbacks,w=l.actions,j=l.name;if(this.state=e,this._name=null!=j?j:(0,v.uniqueId)("gs:"),this.metadata=null!=g?g:{},this.callbacks=null!=S?S:null,this.actionsConfig=null!=w?w:null,p.default.isDevToolsPresent){var O=null!==(n=(new Error).stack)&&void 0!==n?n:"";null===(a=p.default.REACT_GLOBAL_STATE_HOOK_DEBUG)||void 0===a||a.call(p.default,this,l,O)}this.constructor!==t||this.initialize()},e=[{key:"subscribe",value:function(){for(var t=this,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i,o=r[0],a=r[1],s=r[2],u=(0,c.isFunction)(a),l=u?o:void 0,f=u?a:o,h=null!==(i=u?s:a)&&void 0!==i?i:void 0,d=l?l(this.state):this.state;(null==h?void 0:h.skipFirst)||f(d);var b={selector:l,getConfig:function(){return h},currentState:d,callback:function(t){var e=t.state;return f(e)}};return this.subscribeCallback(b),function(){t.subscribers.delete(b)}}}],e&&function(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,o(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function y(t,e){var r=null==e?void 0:e.name,n=null==e?void 0:e.isEqualRoot,i=null==e?void 0:e.isEqual,o=this.getState(),a=(null!=t?t:function(t){return t})(o),s=new g(a,{name:null!=r?r:(0,v.uniqueId)("sh:")}),c=this.subscribe((function(e){if(!(null!=n?n:Object.is)(o,e)){o=e;var r=t(e);(null!=i?i:Object.is)(a,r)||(a=r,s.setState(r))}}),{skipFirst:!0}),u=this.actions?null:this.setState,l=s.subscribe.bind(s),f={setMetadata:this.setMetadata.bind(this),getMetadata:this.getMetadata.bind(this),actions:this.actions,setState:u,getState:s.getState.bind(s),subscribe:s.subscribe.bind(s),createSelectorHook:m.bind(l),createObservable:y.bind(l),removeSubscriptions:function(){c(),s.removeSubscriptions()},dispose:function(){s.removeSubscriptions(),s.dispose()}};return Object.assign(l,f),l}function m(t,e){var n,i=this,o=null==e?void 0:e.name,a=null==e?void 0:e.isEqualRoot,s=null==e?void 0:e.isEqual,c=this.getState(),u=(null!=t?t:function(t){return t})(c),l=new g(u,{name:null!=o?o:(0,v.uniqueId)("sh:")}),f=this.subscribe((function(e){if(!(null!=a?a:Object.is)(c,e)){c=e;var r=t(e);(null!=s?s:Object.is)(u,r)||(u=r,l.setState(r))}}),{skipFirst:!0}),h=null!==(n=this.actions)&&void 0!==n?n:this.setState,d=this.actions?null:this.setState,b=function(){return[(t=l.use.apply(l,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,i,o,a=[],s=!0,c=!1;try{for(i=(e=e.call(t)).next;!(s=(r=i.call(e)).done)&&(a.push(r.value),1!==a.length);s=!0);}catch(t){c=!0,n=t}finally{try{if(!s&&null!=e.return&&(o=e.return(),Object(o)!==o))return}finally{if(c)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],h,i.getMetadata()];var t},p={setMetadata:this.setMetadata.bind(this),getMetadata:this.getMetadata.bind(this),actions:this.actions,setState:d,getState:this.getState.bind(this),subscribe:this.subscribe.bind(this),createSelectorHook:m.bind(b),createObservable:y.bind(b),removeSubscriptions:function(){f(),l.removeSubscriptions()},dispose:function(){l.removeSubscriptions(),l.dispose()}};return Object.assign(b,p),b}t.GlobalStore=g,t.default=g})(),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,i,o,a)=>/******/(()=>{
2
+ /******/"use strict";
3
+ /******/var s={
4
+ /***/78:
5
+ /***/e=>{e.exports=t;
6
+ /***/},
7
+ /***/155:
8
+ /***/t=>{t.exports=e;
9
+ /***/},
10
+ /***/361:
11
+ /***/t=>{t.exports=r;
12
+ /***/},
13
+ /***/487:
14
+ /***/t=>{t.exports=n;
15
+ /***/},
16
+ /***/506:
17
+ /***/t=>{t.exports=i;
18
+ /***/},
19
+ /***/673:
20
+ /***/t=>{t.exports=o;
21
+ /***/},
22
+ /***/773:
23
+ /***/t=>{t.exports=a;
24
+ /***/},
25
+ /***/811:
26
+ /***/(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});var r=globalThis;r.isDevToolsPresent=Boolean(r.REACT_GLOBAL_STATE_HOOK_DEBUG),e.default=r}
27
+ /***/
28
+ /******/},c={};
29
+ /************************************************************************/
30
+ /******/
31
+ /******/
32
+ /******/
33
+ /******/
34
+ /******/function u(t){
35
+ /******/
36
+ /******/var e=c[t];
37
+ /******/if(void 0!==e)
38
+ /******/return e.exports;
39
+ /******/
40
+ /******/
41
+ /******/var r=c[t]={
42
+ /******/
43
+ /******/
44
+ /******/exports:{}
45
+ /******/};
46
+ /******/
47
+ /******/
48
+ /******/
49
+ /******/
50
+ /******/
51
+ /******/return s[t](r,r.exports,u),r.exports;
52
+ /******/}
53
+ /******/
54
+ /************************************************************************/var l={};
55
+ /******/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 i(){i=function(){return r};var t,r={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},s="function"==typeof Symbol?Symbol:{},c=s.iterator||"@@iterator",u=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 i=e&&e.prototype instanceof m?e:m,o=Object.create(i.prototype),s=new A(n||[]);return a(o,"_invoke",{value:M(t,r,s)}),o}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",v="suspendedYield",p="executing",g="completed",y={};function m(){}function S(){}function w(){}var j={};f(j,c,(function(){return this}));var O=Object.getPrototypeOf,k=O&&O(O(P([])));k&&k!==n&&o.call(k,c)&&(j=k);var x=w.prototype=m.prototype=Object.create(j);function C(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,r){function n(i,a,s,c){var u=d(t[i],t,a);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==e(f)&&o.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,s,c)}),(function(t){n("throw",t,s,c)})):r.resolve(f).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,c)}))}c(u.arg)}var i;a(this,"_invoke",{value:function(t,e){function o(){return new r((function(r,i){n(t,e,r,i)}))}return i=i?i.then(o,o):o()}})}function M(e,r,n){var i=b;return function(o,a){if(i===p)throw Error("Generator is already running");if(i===g){if("throw"===o)throw a;return{value:t,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var c=L(s,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===b)throw i=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=p;var u=d(e,r,n);if("normal"===u.type){if(i=n.done?g:v,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=g,n.method="throw",n.arg=u.arg)}}}function L(e,r){var n=r.method,i=e.iterator[n];if(i===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")),y;var o=d(i,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var a=o.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,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function _(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 q(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function P(r){if(r||""===r){var n=r[c];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var i=-1,a=function e(){for(;++i<r.length;)if(o.call(r,i))return e.value=r[i],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(x,"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(x),t},r.awrap=function(t){return{__await:t}},C(E.prototype),f(E.prototype,u,(function(){return this})),r.AsyncIterator=E,r.async=function(t,e,n,i,o){void 0===o&&(o=Promise);var a=new E(h(t,e,n,i),o);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},C(x),f(x,l,"Generator"),f(x,c,(function(){return this})),f(x,"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=P,A.prototype={constructor:A,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(q),!e)for(var r in this)"t"===r.charAt(0)&&o.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,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),u=o.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)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&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):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),y},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),q(r),y}},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 i=n.arg;q(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:P(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},r}function o(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;var a,s=u(155),c=u(506),f=u(773),h=u(487),d=u(673),b=u(361),v=u(78),p=(a=u(811))&&a.__esModule?a:{default:a},g=function(){return t=function t(e){var n,a,u=this,l=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,
56
+ /**
57
+ * @description If the actionsConfig is defined, this will be a map of actions that can be used to modify or interact with the state
58
+ * */
59
+ this.actions=null,this.subscribers=new Set,
60
+ /**
61
+ * @description
62
+ * Initializes the global store, setting up the main hook and actions map if applicable,
63
+ */
64
+ this.initialize=function(){return t=u,e=void 0,r=i().mark((function t(){var e,r,n,o,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object.keys(null!==(e=this.actionsConfig)&&void 0!==e?e:{}).length>0&&(this.actions=this.getStoreActionsMap()),this.use=this.getMainHook(),this.configurationCallbackParam=this.getConfigCallbackParam(),n=this.onInit,o=null!==(r=this.callbacks)&&void 0!==r?r:{},a=o.onInit,n||a){t.next=8;break}return t.abrupt("return");case 8:null==n||n(this.configurationCallbackParam),(0,f.isNil)(a)||null==a||a(this.configurationCallbackParam);case 10:case"end":return t.stop()}}),t,this)})),new(e||(e=Promise))((function(n,i){function o(t){try{s(r.next(t))}catch(t){i(t)}}function a(t){try{s(r.throw(t))}catch(t){i(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(o,a)}s((r=r.apply(t,[])).next())}));var t,e,r},
65
+ /**
66
+ * set the state for a single subscriber
67
+ * validate if the state should be updated by comparing the previous state and the new state
68
+ */
69
+ this.executeSetStateForSubscriber=function(t,e){var r,n,i,o=t.selector,a=t.callback,s=t.currentState,c=t.getConfig,l=null!==(r=null==c?void 0:c())&&void 0!==r?r:{};if(!e.forceUpdate&&(null!==(n=null==l?void 0:l.isEqualRoot)&&void 0!==n?n:function(t,e){return t===e})(e.currentState,e.newState))return{didUpdate:!1};var f=o?o(e.newState):e.newState;return!e.forceUpdate&&(null!==(i=null==l?void 0:l.isEqual)&&void 0!==i?i:function(t,e){return t===e})(s,f)?{didUpdate:!1}:(u.partialUpdateSubscription(t,{currentState:f}),a({state:f},{identifier:e.identifier}),{didUpdate:!0})},
70
+ /**
71
+ * set the state and update all the subscribers
72
+ * @param {State} newState - The new state to set
73
+ * @param {object} options - The options for setting the state
74
+ * @param {boolean} [options.forceUpdate] - Whether to force the update even if the state is the same
75
+ * @param {string} [options.identifier] - An optional identifier for the state change
76
+ * */
77
+ this.setSubscribersState=function(t,e){var n=e.forceUpdate,i=e.identifier,o=u.state;if(n||o!==t){u.state=t;var a,s={forceUpdate:n,newState:t,currentState:o,identifier:i},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,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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 o,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,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw o}}}}(u.subscribers.values());try{for(c.s();!(a=c.n()).done;){var l=a.value;u.executeSetStateForSubscriber(l,s)}}catch(t){c.e(t)}finally{c.f()}}},
78
+ /**
79
+ * Set the value of the metadata property, this is no reactive and will not trigger a re-render
80
+ * @param {MetadataSetter<Metadata>} setter - The setter function or the value to set
81
+ * */
82
+ this.setMetadata=function(t){var e=(0,c.isFunction)(t)?t(u.metadata):t;u.metadata=e},
83
+ /**
84
+ * Returns the metadata [non-reactive additional information associated with the global state]
85
+ */
86
+ this.getMetadata=function(){return u.metadata},
87
+ /**
88
+ * Get the current value of the state
89
+ */
90
+ this.getState=function(){return u.state},
91
+ /**
92
+ * get the parameters object to pass to the callback functions:
93
+ * onInit, onStateChanged, onSubscribed, computePreventStateChange
94
+ * */
95
+ this.getConfigCallbackParam=function(){var t=u.setMetadata,e=u.getMetadata,r=u.getState,n=u.subscribe,i=u.actions;return{setMetadata:t,getMetadata:e,getState:r,subscribe:n,setState:u.setState,actions:i}},this.subscribeCallback=function(t){return u.executeOnSubscribed(t),u.subscribers.add(t),function(){u.subscribers.delete(t)}},this.partialUpdateSubscription=function(t,e){(0,h.isRecord)(t)&&Object.assign(t,e)},this.executeOnSubscribed=function(t){var e,r=u.onSubscribed,n=null===(e=u.callbacks)||void 0===e?void 0:e.onSubscribed;(r||n)&&(null==r||r(u.configurationCallbackParam,t),null==n||n(u.configurationCallbackParam,t))},
96
+ /**
97
+ * Returns a custom hook that allows to handle a global state
98
+ * @returns {[State, StateMutator, Metadata]} - The state, the state setter or the actions map, the metadata
99
+ * */
100
+ this.getMainHook=function(){var t=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=(0,d.isArray)(e)?{dependencies:e}:null!=e?e:{},n=(0,s.useRef)({selector:t,config:r}),i=n.current.config.dependencies;n.current.selector=t,n.current.config=r;var o=(0,s.useMemo)((function(){var t=function(t){var e=n.current.selector;return(0,c.isFunction)(e)?e(t):t},e={currentState:t(u.state),selector:t,getConfig:function(){return n.current.config},callback:function(){throw new Error("Callback not set")}},r=function(){return e.currentState};return{subscribe:function(t){return e.callback=t,u.subscribeCallback(e)},getSnapshot:r,getServerSnapshot:r,subscription:e}}),[]),a=o.subscribe,l=o.getSnapshot,f=o.getServerSnapshot,h=o.subscription;return(0,s.useSyncExternalStore)(a,l,f),[u.computeSelectedState({subscription:h,currentDependencies:i}),u.getStateOrchestrator(),u.metadata]},e={setMetadata:u.setMetadata.bind(u),getMetadata:u.getMetadata.bind(u),actions:u.actions,setState:u.actions?null:u.setState,getState:u.getState.bind(u),subscribe:u.subscribe.bind(u),createSelectorHook:u.createSelectorHook.bind(t),createObservable:u.createObservable.bind(t),removeSubscriptions:u.removeSubscriptions.bind(u),dispose:u.dispose.bind(u)};
101
+ /**
102
+ * Extended properties and methods of the hook
103
+ */return Object.assign(t,e),t},this.computeSelectedState=function(t){var e,r=t.subscription,n=t.currentDependencies;if(!r.selector)return r.currentState;var i=(null!==(e=r.getConfig())&&void 0!==e?e:{}).dependencies;return n===i||(null==n?void 0:n.length)===(null==i?void 0:i.length)&&(0,d.shallowCompare)(n,i)||u.partialUpdateSubscription(r,{currentState:r.selector(u.state)}),r.currentState},this.createSelectorHook=m.bind(this),this.createObservable=y.bind(this),
104
+ /**
105
+ * Returns the state setter or the actions map
106
+ * @returns {StateMutator} - The state setter or the actions map
107
+ * */
108
+ this.getStateOrchestrator=function(){return u.actions?u.actions:u.setState},
109
+ /**
110
+ * This is the only setState function that should be exposed outside the class
111
+ * This is responsible for defining whenever or not the state change should be allowed or prevented
112
+ * the function also execute the functions:
113
+ * - onStateChanged (if defined) - this function is executed after the state change
114
+ * - computePreventStateChange (if defined) - this function is executed before the state change and it should return a boolean value that will be used to determine if the state change should be prevented or not
115
+ */
116
+ this.setState=function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.forceUpdate,o=n.identifier,a=u.state,s=(0,c.isFunction)(t)?t(a):t;if(i||u.state!==s){var l=u.setMetadata,f=u.getMetadata,h=u.getState,d=u.actions,b={setMetadata:l,getMetadata:f,setState:u.setSubscribersState,getState:h,actions:d,previousState:a,state:s,identifier:o},v=u.computePreventStateChange,p=null===(e=u.callbacks)||void 0===e?void 0:e.computePreventStateChange;if((v||p)&&((null==v?void 0:v(b))||(null==p?void 0:p(b))))return;u.setSubscribersState(s,{forceUpdate:i,identifier:o});var g=u.onStateChanged,y=null===(r=u.callbacks)||void 0===r?void 0:r.onStateChanged;(g||y)&&(null==g||g(b),null==y||y(b))}},
117
+ /**
118
+ * This creates a map of actions that can be used to modify or interact with the state
119
+ * @returns {ActionCollectionResult<State, Metadata, StateMutator>} - The actions map result of the configuration object passed to the constructor
120
+ * */
121
+ this.getStoreActionsMap=function(){if(!(0,h.isRecord)(u.actionsConfig))return null;var t=u.actionsConfig,e=u.setMetadata,r=u.setState,n=u.getState,i=u.getMetadata,a=Object.keys(t).reduce((function(s,c){var u,l,f;return Object.assign(s,(u={},f=function(){for(var o=t[c],s=arguments.length,u=new Array(s),l=0;l<s;l++)u[l]=arguments[l];var f=o.apply(a,u);return"function"!=typeof f&&(0,b.throwWrongKeyOnActionCollectionConfig)(c),f.call(a,{setState:r,getState:n,setMetadata:e,getMetadata:i,actions:a})},(l=o(l=c))in u?Object.defineProperty(u,l,{value:f,enumerable:!0,configurable:!0,writable:!0}):u[l]=f,u)),s}),{});return a},this.removeSubscriptions=function(){u.subscribers.clear()},this.dispose=function(){u.removeSubscriptions(),u._name="",u.actionsConfig=null,u.callbacks=null,u.metadata={},u.actions=null,u.state=Object.create(null)};var g=l.metadata,S=l.callbacks,w=l.actions,j=l.name;if(this.state=e,this._name=null!=j?j:(0,v.uniqueId)("gs:"),this.metadata=null!=g?g:{},this.callbacks=null!=S?S:null,this.actionsConfig=null!=w?w:null,p.default.isDevToolsPresent){var O=null!==(n=(new Error).stack)&&void 0!==n?n:"";null===(a=p.default.REACT_GLOBAL_STATE_HOOK_DEBUG)||void 0===a||a.call(p.default,this,l,O)}this.constructor!==t||this.initialize()},e=[{key:"subscribe",value:function(){for(var t=this,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i,o=r[0],a=r[1],s=r[2],u=(0,c.isFunction)(a),l=u?o:void 0,f=u?a:o,h=null!==(i=u?s:a)&&void 0!==i?i:void 0,d=l?l(this.state):this.state;(null==h?void 0:h.skipFirst)||f(d);var b={selector:l,getConfig:function(){return h},currentState:d,callback:function(t){var e=t.state;return f(e)}};return this.subscribeCallback(b),function(){t.subscribers.delete(b)}}}],e&&function(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,o(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function y(t,e){var r=null==e?void 0:e.name,n=null==e?void 0:e.isEqualRoot,i=null==e?void 0:e.isEqual,o=this.getState(),a=(null!=t?t:function(t){return t})(o),s=new g(a,{name:null!=r?r:(0,v.uniqueId)("sh:")}),c=this.subscribe((function(e){if(!(null!=n?n:Object.is)(o,e)){o=e;var r=t(e);(null!=i?i:Object.is)(a,r)||(a=r,s.setState(r))}}),{skipFirst:!0}),u=this.actions?null:this.setState,l=s.subscribe.bind(s),f={setMetadata:this.setMetadata.bind(this),getMetadata:this.getMetadata.bind(this),actions:this.actions,setState:u,getState:s.getState.bind(s),subscribe:s.subscribe.bind(s),createSelectorHook:m.bind(l),createObservable:y.bind(l),removeSubscriptions:function(){c(),s.removeSubscriptions()},dispose:function(){s.removeSubscriptions(),s.dispose()}};return Object.assign(l,f),l}
122
+ /**
123
+ * @description
124
+ * Creates a derived hook bound to a selected fragment of the root state.
125
+ * The derived hook re-renders only when the selected value changes and
126
+ * exposes the same API as the parent state hook.
127
+ */function m(t,e){var n,i=this,o=null==e?void 0:e.name,a=null==e?void 0:e.isEqualRoot,s=null==e?void 0:e.isEqual,c=this.getState(),u=(null!=t?t:function(t){return t})(c),l=new g(u,{name:null!=o?o:(0,v.uniqueId)("sh:")}),f=this.subscribe((function(e){if(!(null!=a?a:Object.is)(c,e)){c=e;var r=t(e);(null!=s?s:Object.is)(u,r)||(u=r,l.setState(r))}}),{skipFirst:!0}),h=null!==(n=this.actions)&&void 0!==n?n:this.setState,d=this.actions?null:this.setState,b=function(){return[(t=l.use.apply(l,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,i,o,a=[],s=!0,c=!1;try{for(i=(e=e.call(t)).next;!(s=(r=i.call(e)).done)&&(a.push(r.value),1!==a.length);s=!0);}catch(t){c=!0,n=t}finally{try{if(!s&&null!=e.return&&(o=e.return(),Object(o)!==o))return}finally{if(c)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],h,i.getMetadata()];var t},p={setMetadata:this.setMetadata.bind(this),getMetadata:this.getMetadata.bind(this),actions:this.actions,setState:d,getState:this.getState.bind(this),subscribe:this.subscribe.bind(this),createSelectorHook:m.bind(b),createObservable:y.bind(b),removeSubscriptions:function(){f(),l.removeSubscriptions()},dispose:function(){l.removeSubscriptions(),l.dispose()}};return Object.assign(b,p),b}t.GlobalStore=g,t.default=g})(),l;
128
+ /******/})(),"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 +1,41 @@
1
- var t;t=t=>(()=>{"use strict";var e={778:e=>{e.exports=t}},o={};function r(t){var n=o[t];if(void 0!==n)return n.exports;var i=o[t]={exports:{}};return e[t](i,i.exports,r),i.exports}var n={};return(()=>{var t=n;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 o(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(o=function(){return!!t})()}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalStoreAbstract=void 0;var u=function(t){function r(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(t=function(t,r,n){return r=i(r),function(t,o){if(o&&("object"==e(o)||"function"==typeof o))return o;if(void 0!==o)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,o()?Reflect.construct(r,n||[],i(t).constructor):r.apply(t,n))}(this,r,arguments)).onInit=function(e){t.onInitialize(e)},t.onStateChanged=function(e){t.onChange(e)},t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}(r,t),n=r,Object.defineProperty(n,"prototype",{writable:!1}),n;var n}(r(778).GlobalStore);t.GlobalStoreAbstract=u,t.default=u})(),n})(),"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./GlobalStore.js")):"function"==typeof define&&define.amd?define(["./GlobalStore.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./GlobalStore.js")):this["react-hooks-global-states"]=t(this["./GlobalStore.js"]);
1
+ var t;t=t=>/******/(()=>{
2
+ /******/"use strict";
3
+ /******/var e={
4
+ /***/778:
5
+ /***/e=>{e.exports=t;
6
+ /***/
7
+ /******/}},o={};
8
+ /************************************************************************/
9
+ /******/
10
+ /******/
11
+ /******/
12
+ /******/
13
+ /******/function r(t){
14
+ /******/
15
+ /******/var n=o[t];
16
+ /******/if(void 0!==n)
17
+ /******/return n.exports;
18
+ /******/
19
+ /******/
20
+ /******/var i=o[t]={
21
+ /******/
22
+ /******/
23
+ /******/exports:{}
24
+ /******/};
25
+ /******/
26
+ /******/
27
+ /******/
28
+ /******/
29
+ /******/
30
+ /******/return e[t](i,i.exports,r),i.exports;
31
+ /******/}
32
+ /******/
33
+ /************************************************************************/var n={};
34
+ /******/return(()=>{var t=n;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 o(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(o=function(){return!!t})()}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalStoreAbstract=void 0;var u=function(t){function r(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(t=function(t,r,n){return r=i(r),function(t,o){if(o&&("object"==e(o)||"function"==typeof o))return o;if(void 0!==o)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,o()?Reflect.construct(r,n||[],i(t).constructor):r.apply(t,n))}(this,r,arguments)).onInit=function(e){t.onInitialize(e)},t.onStateChanged=function(e){t.onChange(e)},t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}(r,t),n=r,Object.defineProperty(n,"prototype",{writable:!1}),n;var n}(r(778).GlobalStore);
35
+ /**
36
+ * @description
37
+ * Use this class to extends the capabilities of the GlobalStore.
38
+ * by implementing the abstract methods onInitialize and onChange.
39
+ * You can use this class to create a store with async storage.
40
+ */t.GlobalStoreAbstract=u,t.default=u})(),n;
41
+ /******/})(),"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./GlobalStore.js")):"function"==typeof define&&define.amd?define(["./GlobalStore.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./GlobalStore.js")):this["react-hooks-global-states"]=t(this["./GlobalStore.js"]);
package/bundle.js CHANGED
@@ -1 +1,56 @@
1
- var e,r;e=this,r=(e,r,t,o,n,a,l,s)=>(()=>{"use strict";var i={78:r=>{r.exports=e},361:e=>{e.exports=r},487:e=>{e.exports=t},623:e=>{e.exports=o},670:e=>{e.exports=n},673:e=>{e.exports=a},778:e=>{e.exports=l},804:e=>{e.exports=s}},c={};function u(e){var r=c[e];if(void 0!==r)return r.exports;var t=c[e]={exports:{}};return i[e](t,t.exports,u),t.exports}var b={};return(()=>{var e=b;Object.defineProperty(e,"__esModule",{value:!0}),e.createContext=e.isRecord=e.throwWrongKeyOnActionCollectionConfig=e.uniqueId=e.shallowCompare=e.createGlobalState=e.GlobalStoreAbstract=e.GlobalStore=void 0;var r=u(778);Object.defineProperty(e,"GlobalStore",{enumerable:!0,get:function(){return r.GlobalStore}});var t=u(804);Object.defineProperty(e,"GlobalStoreAbstract",{enumerable:!0,get:function(){return t.GlobalStoreAbstract}});var o=u(670);Object.defineProperty(e,"createGlobalState",{enumerable:!0,get:function(){return o.createGlobalState}});var n=u(673);Object.defineProperty(e,"shallowCompare",{enumerable:!0,get:function(){return n.shallowCompare}});var a=u(78);Object.defineProperty(e,"uniqueId",{enumerable:!0,get:function(){return a.uniqueId}});var l=u(361);Object.defineProperty(e,"throwWrongKeyOnActionCollectionConfig",{enumerable:!0,get:function(){return l.throwWrongKeyOnActionCollectionConfig}});var s=u(487);Object.defineProperty(e,"isRecord",{enumerable:!0,get:function(){return s.isRecord}});var i=u(623);Object.defineProperty(e,"createContext",{enumerable:!0,get:function(){return i.createContext}})})(),b})(),"object"==typeof exports&&"object"==typeof module?module.exports=r(require("./uniqueId.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./isRecord.js"),require("./createContext.js"),require("./createGlobalState.js"),require("./shallowCompare.js"),require("./GlobalStore.js"),require("./GlobalStoreAbstract.js")):"function"==typeof define&&define.amd?define(["./uniqueId.js","./throwWrongKeyOnActionCollectionConfig.js","./isRecord.js","./createContext.js","./createGlobalState.js","./shallowCompare.js","./GlobalStore.js","./GlobalStoreAbstract.js"],r):"object"==typeof exports?exports["react-hooks-global-states"]=r(require("./uniqueId.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./isRecord.js"),require("./createContext.js"),require("./createGlobalState.js"),require("./shallowCompare.js"),require("./GlobalStore.js"),require("./GlobalStoreAbstract.js")):e["react-hooks-global-states"]=r(e["./uniqueId.js"],e["./throwWrongKeyOnActionCollectionConfig.js"],e["./isRecord.js"],e["./createContext.js"],e["./createGlobalState.js"],e["./shallowCompare.js"],e["./GlobalStore.js"],e["./GlobalStoreAbstract.js"]);
1
+ var e,r;e=this,r=(e,r,t,o,n,a,l,s)=>/******/(()=>{
2
+ /******/"use strict";
3
+ /******/var i={
4
+ /***/78:
5
+ /***/r=>{r.exports=e;
6
+ /***/},
7
+ /***/361:
8
+ /***/e=>{e.exports=r;
9
+ /***/},
10
+ /***/487:
11
+ /***/e=>{e.exports=t;
12
+ /***/},
13
+ /***/623:
14
+ /***/e=>{e.exports=o;
15
+ /***/},
16
+ /***/670:
17
+ /***/e=>{e.exports=n;
18
+ /***/},
19
+ /***/673:
20
+ /***/e=>{e.exports=a;
21
+ /***/},
22
+ /***/778:
23
+ /***/e=>{e.exports=l;
24
+ /***/},
25
+ /***/804:
26
+ /***/e=>{e.exports=s;
27
+ /***/
28
+ /******/}},c={};
29
+ /************************************************************************/
30
+ /******/
31
+ /******/
32
+ /******/
33
+ /******/
34
+ /******/function u(e){
35
+ /******/
36
+ /******/var r=c[e];
37
+ /******/if(void 0!==r)
38
+ /******/return r.exports;
39
+ /******/
40
+ /******/
41
+ /******/var t=c[e]={
42
+ /******/
43
+ /******/
44
+ /******/exports:{}
45
+ /******/};
46
+ /******/
47
+ /******/
48
+ /******/
49
+ /******/
50
+ /******/
51
+ /******/return i[e](t,t.exports,u),t.exports;
52
+ /******/}
53
+ /******/
54
+ /************************************************************************/var b={};
55
+ /******/return(()=>{var e=b;Object.defineProperty(e,"__esModule",{value:!0}),e.createContext=e.isRecord=e.throwWrongKeyOnActionCollectionConfig=e.uniqueId=e.shallowCompare=e.createGlobalState=e.GlobalStoreAbstract=e.GlobalStore=void 0;var r=u(778);Object.defineProperty(e,"GlobalStore",{enumerable:!0,get:function(){return r.GlobalStore}});var t=u(804);Object.defineProperty(e,"GlobalStoreAbstract",{enumerable:!0,get:function(){return t.GlobalStoreAbstract}});var o=u(670);Object.defineProperty(e,"createGlobalState",{enumerable:!0,get:function(){return o.createGlobalState}});var n=u(673);Object.defineProperty(e,"shallowCompare",{enumerable:!0,get:function(){return n.shallowCompare}});var a=u(78);Object.defineProperty(e,"uniqueId",{enumerable:!0,get:function(){return a.uniqueId}});var l=u(361);Object.defineProperty(e,"throwWrongKeyOnActionCollectionConfig",{enumerable:!0,get:function(){return l.throwWrongKeyOnActionCollectionConfig}});var s=u(487);Object.defineProperty(e,"isRecord",{enumerable:!0,get:function(){return s.isRecord}});var i=u(623);Object.defineProperty(e,"createContext",{enumerable:!0,get:function(){return i.createContext}})})(),b;
56
+ /******/})(),"object"==typeof exports&&"object"==typeof module?module.exports=r(require("./uniqueId.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./isRecord.js"),require("./createContext.js"),require("./createGlobalState.js"),require("./shallowCompare.js"),require("./GlobalStore.js"),require("./GlobalStoreAbstract.js")):"function"==typeof define&&define.amd?define(["./uniqueId.js","./throwWrongKeyOnActionCollectionConfig.js","./isRecord.js","./createContext.js","./createGlobalState.js","./shallowCompare.js","./GlobalStore.js","./GlobalStoreAbstract.js"],r):"object"==typeof exports?exports["react-hooks-global-states"]=r(require("./uniqueId.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./isRecord.js"),require("./createContext.js"),require("./createGlobalState.js"),require("./shallowCompare.js"),require("./GlobalStore.js"),require("./GlobalStoreAbstract.js")):e["react-hooks-global-states"]=r(e["./uniqueId.js"],e["./throwWrongKeyOnActionCollectionConfig.js"],e["./isRecord.js"],e["./createContext.js"],e["./createGlobalState.js"],e["./shallowCompare.js"],e["./GlobalStore.js"],e["./GlobalStoreAbstract.js"]);
package/createContext.js CHANGED
@@ -1 +1,70 @@
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),i=r(773);t.createContext=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,o.createContext)(null),u=function(u){var s=u.children,l=u.value,c=u.onCreated,f=(0,o.useMemo)((function(){var r,o=function(){return(0,a.isFunction)(e)?e():e},u=(0,i.isNil)(l)?o():(0,a.isFunction)(l)?l(o()):l;return new n.GlobalStore(u,Object.assign(Object.assign({},t),{metadata:null!==(r=(0,a.isFunction)(t.metadata)?t.metadata():t.metadata)&&void 0!==r?r:{}}))}),[]);return(0,o.useEffect)((function(){return function(){var e,t,r,o;null===(t=null===(e=f.callbacks)||void 0===e?void 0:e.onUnMount)||void 0===t||t.call(e,f),null===(o=(r=f).__onUnMountContext)||void 0===o||o.call(r,f),f.dispose()}}),[f]),null==c||c(f.getConfigCallbackParam()),(0,o.createElement)(r.Provider,{value:f.use},s)},s={makeProviderWrapper:function(e){var t={current:void 0};return{wrapper:function(r){var n=r.children;return(0,o.createElement)(u,{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(){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)},c={createSelectorHook:function(e,t){return function(){var n=(0,o.useContext)(r);if((0,i.isNil)(n))throw new Error("SelectorHook must be used within a ContextProvider");var a=(0,o.useRef)(e);a.current=e;var u=(0,o.useMemo)((function(){return n.createSelectorHook((function(){return a.current.apply(a,arguments)}),t)}),[n]);return(0,o.useEffect)((function(){return function(){null==u||u.dispose()}}),[u]),u.apply(void 0,arguments)}},api:function(){var e=(0,o.useContext)(r);if(!e)throw new Error("api hook must be used within a ContextProvider");return e}};return Object.assign(u,s),Object.assign(l,c),{use:l,Provider:u,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)=>/******/(()=>{
2
+ /******/"use strict";
3
+ /******/var n={
4
+ /***/155:
5
+ /***/t=>{t.exports=e;
6
+ /***/},
7
+ /***/506:
8
+ /***/e=>{e.exports=t;
9
+ /***/},
10
+ /***/639:
11
+ /***/(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createContext=void 0;var o=r(155),n=r(778),a=r(506),i=r(773);
12
+ /**
13
+ * @description Creates a highly granular React context with its associated provider and state hook.
14
+ * Unlike the native `React.createContext`, this version provides fine-grained reactivity and supports
15
+ * state selection, metadata handling, and optional custom actions for controlled mutations.
16
+ *
17
+ * Components using the generated hook only re-render when the selected part of the state changes,
18
+ * making it efficient for large or deeply nested state trees.
19
+ */
20
+ t.createContext=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,o.createContext)(null),u=function(u){var s=u.children,l=u.value,c=u.onCreated,f=(0,o.useMemo)((function(){var r,o=function(){return(0,a.isFunction)(e)?e():e},u=(0,i.isNil)(l)?o():(0,a.isFunction)(l)?l(o()):l;return new n.GlobalStore(u,Object.assign(Object.assign({},t),{metadata:null!==(r=(0,a.isFunction)(t.metadata)?t.metadata():t.metadata)&&void 0!==r?r:{}}))}),[]);return(0,o.useEffect)((function(){return function(){var e,t,r,o;null===(t=null===(e=f.callbacks)||void 0===e?void 0:e.onUnMount)||void 0===t||t.call(e,f),
21
+ /**
22
+ * Required by the global hooks developer tools
23
+ */
24
+ null===(o=(r=f).__onUnMountContext)||void 0===o||o.call(r,f),f.dispose()}}),[f]),null==c||c(f.getConfigCallbackParam()),(0,o.createElement)(r.Provider,{value:f.use},s)},s={makeProviderWrapper:function(e){var t={current:void 0};return{wrapper:function(r){var n=r.children;return(0,o.createElement)(u,{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(){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)},c={
25
+ /**
26
+ * Store selectors are not created until the first time they are used
27
+ */
28
+ createSelectorHook:function(e,t){return function(){var n=(0,o.useContext)(r);if((0,i.isNil)(n))throw new Error("SelectorHook must be used within a ContextProvider");var a=(0,o.useRef)(e);a.current=e;var u=(0,o.useMemo)((function(){return n.createSelectorHook((function(){return a.current.apply(a,arguments)}),t)}),[n]);return(0,o.useEffect)((function(){return function(){null==u||u.dispose()}}),[u]),u.apply(void 0,arguments)}},api:function(){var e=(0,o.useContext)(r);if(!e)throw new Error("api hook must be used within a ContextProvider");return e}};return Object.assign(u,s),Object.assign(l,c),{use:l,Provider:u,Context:r}},t.default=t.createContext}
29
+ /***/,
30
+ /***/773:
31
+ /***/e=>{e.exports=r;
32
+ /***/},
33
+ /***/778:
34
+ /***/e=>{e.exports=o;
35
+ /***/
36
+ /******/}},a={};
37
+ /************************************************************************/
38
+ /******/
39
+ /******/
40
+ /******/
41
+ /******/
42
+ /******/
43
+ /******/
44
+ /******/return function e(t){
45
+ /******/
46
+ /******/var r=a[t];
47
+ /******/if(void 0!==r)
48
+ /******/return r.exports;
49
+ /******/
50
+ /******/
51
+ /******/var o=a[t]={
52
+ /******/
53
+ /******/
54
+ /******/exports:{}
55
+ /******/};
56
+ /******/
57
+ /******/
58
+ /******/
59
+ /******/
60
+ /******/
61
+ /******/return n[t](o,o.exports,e),o.exports;
62
+ /******/}
63
+ /******/
64
+ /************************************************************************/
65
+ /******/
66
+ /******/
67
+ /******/
68
+ /******/
69
+ /******/(639);
70
+ /******/})(),"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"]);
@@ -143,3 +143,4 @@ export declare const createGlobalState: CreateGlobalState;
143
143
  * ```
144
144
  */
145
145
  export type InferActionsType<Hook extends StateHook<any, any, any, any>> = ReturnType<Hook['actions']>['1'];
146
+ export default createGlobalState;
@@ -1 +1,47 @@
1
- var e;e=e=>(()=>{"use strict";var t={778:t=>{t.exports=e}},r={};function o(e){var a=r[e];if(void 0!==a)return a.exports;var s=r[e]={exports:{}};return t[e](s,s.exports,o),s.exports}var a={};return(()=>{var e=a;Object.defineProperty(e,"__esModule",{value:!0}),e.createGlobalState=void 0;var t=o(778);e.createGlobalState=function(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];var a=r[0],s=r[1];return new t.GlobalStore(a,s).use}})(),a})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./GlobalStore.js")):"function"==typeof define&&define.amd?define(["./GlobalStore.js"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./GlobalStore.js")):this["react-hooks-global-states"]=e(this["./GlobalStore.js"]);
1
+ var e;e=e=>/******/(()=>{
2
+ /******/"use strict";
3
+ /******/var t={
4
+ /***/778:
5
+ /***/t=>{t.exports=e;
6
+ /***/},
7
+ /***/840:
8
+ /***/(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createGlobalState=void 0;var r=o(778);
9
+ /**
10
+ * Creates a global state hook
11
+ */t.createGlobalState=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var a=t[0],l=t[1];return new r.GlobalStore(a,l).use},t.default=t.createGlobalState}
12
+ /***/
13
+ /******/},o={};
14
+ /************************************************************************/
15
+ /******/
16
+ /******/
17
+ /******/
18
+ /******/
19
+ /******/
20
+ /******/
21
+ /******/return function e(r){
22
+ /******/
23
+ /******/var a=o[r];
24
+ /******/if(void 0!==a)
25
+ /******/return a.exports;
26
+ /******/
27
+ /******/
28
+ /******/var l=o[r]={
29
+ /******/
30
+ /******/
31
+ /******/exports:{}
32
+ /******/};
33
+ /******/
34
+ /******/
35
+ /******/
36
+ /******/
37
+ /******/
38
+ /******/return t[r](l,l.exports,e),l.exports;
39
+ /******/}
40
+ /******/
41
+ /************************************************************************/
42
+ /******/
43
+ /******/
44
+ /******/
45
+ /******/
46
+ /******/(840);
47
+ /******/})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./GlobalStore.js")):"function"==typeof define&&define.amd?define(["./GlobalStore.js"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./GlobalStore.js")):this["react-hooks-global-states"]=e(this["./GlobalStore.js"]);
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { StateApi as HookExtensions, ObservableFragment, MetadataSetter, StateChanges, StoreTools, ActionCollectionResult, GlobalStoreCallbacks, UseHookConfig, UnsubscribeCallback, SubscribeCallbackConfig, SubscribeCallback, BaseMetadata, MetadataGetter, CustomGlobalHookBuilderParams, SelectorCallback, SubscriberParameters, SubscriptionCallback, StateHook, ActionCollectionConfig, } from './types';
1
+ export { StateApi, ObservableFragment, MetadataSetter, StateChanges, StoreTools, ActionCollectionResult, GlobalStoreCallbacks, UseHookConfig, UnsubscribeCallback, SubscribeCallbackConfig, SubscribeCallback, BaseMetadata, MetadataGetter, CustomGlobalHookBuilderParams, SelectorCallback, SubscriberParameters, SubscriptionCallback, StateHook, ActionCollectionConfig, } from './types';
2
2
  export { GlobalStore } from './GlobalStore';
3
3
  export { GlobalStoreAbstract } from './GlobalStoreAbstract';
4
4
  export { createGlobalState, type InferActionsType } from './createGlobalState';
@@ -6,4 +6,4 @@ export { shallowCompare } from './shallowCompare';
6
6
  export { uniqueId } from './uniqueId';
7
7
  export { throwWrongKeyOnActionCollectionConfig } from './throwWrongKeyOnActionCollectionConfig';
8
8
  export { isRecord } from './isRecord';
9
- export { type ContextApi as Context, type ContextProvider, type ContextHook, type CreateContext, type InferContextApi as InferContextType, createContext, } from './createContext';
9
+ export { type ContextApi as Context, type ContextProvider, type ContextHook, type InferContextApi, createContext, } from './createContext';
package/isRecord.js CHANGED
@@ -1 +1,44 @@
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 o;o=o=>/******/(()=>{
2
+ /******/"use strict";
3
+ /******/var t={
4
+ /***/35:
5
+ /***/(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}
6
+ /***/,
7
+ /***/773:
8
+ /***/t=>{t.exports=o;
9
+ /***/
10
+ /******/}},e={};
11
+ /************************************************************************/
12
+ /******/
13
+ /******/
14
+ /******/
15
+ /******/
16
+ /******/
17
+ /******/
18
+ /******/return function o(r){
19
+ /******/
20
+ /******/var s=e[r];
21
+ /******/if(void 0!==s)
22
+ /******/return s.exports;
23
+ /******/
24
+ /******/
25
+ /******/var i=e[r]={
26
+ /******/
27
+ /******/
28
+ /******/exports:{}
29
+ /******/};
30
+ /******/
31
+ /******/
32
+ /******/
33
+ /******/
34
+ /******/
35
+ /******/return t[r](i,i.exports,o),i.exports;
36
+ /******/}
37
+ /******/
38
+ /************************************************************************/
39
+ /******/
40
+ /******/
41
+ /******/
42
+ /******/
43
+ /******/(35);
44
+ /******/})(),"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"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-hooks-global-states",
3
- "version": "11.0.0-beta.0",
3
+ "version": "11.0.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",
package/shallowCompare.js CHANGED
@@ -1 +1,53 @@
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)=>/******/(()=>{
2
+ /******/"use strict";
3
+ /******/var o={
4
+ /***/38:
5
+ /***/t=>{t.exports=r;
6
+ /***/},
7
+ /***/487:
8
+ /***/r=>{r.exports=t;
9
+ /***/},
10
+ /***/773:
11
+ /***/r=>{r.exports=e;
12
+ /***/},
13
+ /***/955:
14
+ /***/r=>{r.exports=n;
15
+ /***/},
16
+ /***/973:
17
+ /***/(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}
18
+ /***/
19
+ /******/},i={};
20
+ /************************************************************************/
21
+ /******/
22
+ /******/
23
+ /******/
24
+ /******/
25
+ /******/
26
+ /******/
27
+ /******/return function r(t){
28
+ /******/
29
+ /******/var e=i[t];
30
+ /******/if(void 0!==e)
31
+ /******/return e.exports;
32
+ /******/
33
+ /******/
34
+ /******/var n=i[t]={
35
+ /******/
36
+ /******/
37
+ /******/exports:{}
38
+ /******/};
39
+ /******/
40
+ /******/
41
+ /******/
42
+ /******/
43
+ /******/
44
+ /******/return o[t](n,n.exports,r),n.exports;
45
+ /******/}
46
+ /******/
47
+ /************************************************************************/
48
+ /******/
49
+ /******/
50
+ /******/
51
+ /******/
52
+ /******/(973);
53
+ /******/})(),"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 +1,16 @@
1
- var t;t=()=>(()=>{"use strict";var t={};return((t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.throwWrongKeyOnActionCollectionConfig=void 0,e.throwWrongKeyOnActionCollectionConfig=function(t){throw new Error("[WRONG CONFIGURATION!]: Every key inside the storeActionsConfig must be a higher order function that returns a function \n[".concat(t,"]: key is not a valid function, try something like this: \n{\n\n ").concat(t,": (param) => ({ setState, getState, setMetadata, getMetadata, actions }) => {\n\n setState((state) => ({ ...state, ...param }))\n\n }\n\n}\n"))},e.default=e.throwWrongKeyOnActionCollectionConfig})(0,t),t})(),"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["react-hooks-global-states"]=t():this["react-hooks-global-states"]=t();
1
+ var t;t=()=>/******/(()=>{
2
+ /******/"use strict";
3
+ /******/var t={};
4
+ /************************************************************************/
5
+ /******/
6
+ /******/
7
+ /******/
8
+ /******/
9
+ /******/
10
+ /******/
11
+ /******/
12
+ /******/
13
+ /***/return((t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.throwWrongKeyOnActionCollectionConfig=void 0,e.throwWrongKeyOnActionCollectionConfig=function(t){throw new Error("[WRONG CONFIGURATION!]: Every key inside the storeActionsConfig must be a higher order function that returns a function \n[".concat(t,"]: key is not a valid function, try something like this: \n{\n\n ").concat(t,": (param) => ({ setState, getState, setMetadata, getMetadata, actions }) => {\n\n setState((state) => ({ ...state, ...param }))\n\n }\n\n}\n"))},e.default=e.throwWrongKeyOnActionCollectionConfig})
14
+ /***/
15
+ /******/(0,t),t;
16
+ /******/})(),"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["react-hooks-global-states"]=t():this["react-hooks-global-states"]=t();
package/types.js CHANGED
@@ -1 +1,4 @@
1
- var e;e=()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0})})(),e})(),"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["react-hooks-global-states"]=e():this["react-hooks-global-states"]=e();
1
+ var e;e=()=>/******/(()=>{
2
+ /******/"use strict";var e={};
3
+ /******/return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0})})(),e;
4
+ /******/})(),"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["react-hooks-global-states"]=e():this["react-hooks-global-states"]=e();
package/uniqueId.js CHANGED
@@ -1 +1,16 @@
1
- var e;e=()=>(()=>{"use strict";var e={};return((e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.uniqueId=void 0,t.uniqueId=(o=0,function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return o===Number.MAX_SAFE_INTEGER&&(o=0),e+Date.now().toString(36)+(o++).toString(36)}),t.default=t.uniqueId})(0,e),e})(),"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["react-hooks-global-states"]=e():this["react-hooks-global-states"]=e();
1
+ var e;e=()=>/******/(()=>{
2
+ /******/"use strict";
3
+ /******/var e={};
4
+ /************************************************************************/
5
+ /******/
6
+ /******/
7
+ /******/
8
+ /******/
9
+ /******/
10
+ /******/
11
+ /******/
12
+ /******/
13
+ /***/return((e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.uniqueId=void 0,t.uniqueId=(o=0,function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return o===Number.MAX_SAFE_INTEGER&&(o=0),e+Date.now().toString(36)+(o++).toString(36)}),t.default=t.uniqueId})
14
+ /***/
15
+ /******/(0,e),e;
16
+ /******/})(),"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["react-hooks-global-states"]=e():this["react-hooks-global-states"]=e();
package/webpack.config.js CHANGED
@@ -103,8 +103,11 @@ module.exports = {
103
103
  toplevel: true,
104
104
  properties: false,
105
105
  },
106
- format: {
107
- comments: false,
106
+ output: {
107
+ // Keep only JSDoc-style comments (/** ... */)
108
+ comments: (_node, comment) => {
109
+ return comment.type === 'comment2' && comment.value.startsWith('*');
110
+ },
108
111
  },
109
112
  },
110
113
  }),