react-hooks-global-states 11.0.0-beta.3 → 11.0.0-beta.4

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
@@ -1,4 +1,4 @@
1
- import type { ActionCollectionConfig, GlobalStoreCallbacks, ActionCollectionResult, MetadataSetter, SubscribeCallbackConfig, SubscribeCallback, SelectorCallback, SubscriberParameters, StateHook, BaseMetadata, StateChanges, StoreTools, ObservableFragment, UnsubscribeCallback, AnyFunction } from './types';
1
+ import type { ActionCollectionConfig, GlobalStoreCallbacks, ActionCollectionResult, MetadataSetter, SubscribeCallbackConfig, SubscribeCallback, SelectorCallback, SubscriberParameters, StateHook, BaseMetadata, StateChanges, StoreTools, ObservableFragment, StateApi, UnsubscribeCallback, AnyFunction } from './types';
2
2
  /**
3
3
  * The GlobalStore class is the main class of the library and it is used to create a GlobalStore instances
4
4
  * */
@@ -93,16 +93,8 @@ export declare class GlobalStore<State, Metadata extends BaseMetadata, ActionsCo
93
93
  subscription: SubscriberParameters;
94
94
  currentDependencies: unknown[] | undefined;
95
95
  }) => unknown;
96
- createSelectorHook: (selector: (state: unknown) => unknown, options?: {
97
- isEqual?: ((current: unknown, next: unknown) => boolean) | undefined;
98
- isEqualRoot?: ((current: unknown, next: unknown) => boolean) | undefined;
99
- name?: string;
100
- } | undefined) => StateHook<unknown, unknown, unknown, BaseMetadata>;
101
- createObservable: (selector: (state: unknown) => unknown, options?: {
102
- isEqual?: ((current: unknown, next: unknown) => boolean) | undefined;
103
- isEqualRoot?: ((current: unknown, next: unknown) => boolean) | undefined;
104
- name?: string;
105
- } | undefined) => ObservableFragment<unknown, unknown, unknown, BaseMetadata>;
96
+ createSelectorHook: typeof createSelectorHook;
97
+ createObservable: typeof createObservable;
106
98
  /**
107
99
  * Returns the state setter or the actions map
108
100
  * @returns {StateMutator} - The state setter or the actions map
@@ -127,4 +119,20 @@ export declare class GlobalStore<State, Metadata extends BaseMetadata, ActionsCo
127
119
  protected removeSubscriptions: () => void;
128
120
  dispose: () => void;
129
121
  }
122
+ declare function createObservable<RootState, PublicStateMutator, Metadata, Selected, StateDispatch = React.Dispatch<React.SetStateAction<RootState>>>(this: StateApi<any, any, any, any>, selector: (state: any) => Selected, options?: {
123
+ isEqual?: (current: Selected, next: Selected) => boolean;
124
+ isEqualRoot?: (current: any, next: any) => boolean;
125
+ name?: string;
126
+ }): ObservableFragment<Selected, StateDispatch, PublicStateMutator, Metadata extends BaseMetadata ? Metadata : BaseMetadata>;
127
+ /**
128
+ * @description
129
+ * Creates a derived hook bound to a selected fragment of the root state.
130
+ * The derived hook re-renders only when the selected value changes and
131
+ * exposes the same API as the parent state hook.
132
+ */
133
+ declare function createSelectorHook<RootState, PublicStateMutator, Metadata, Selected, StateDispatch = React.Dispatch<React.SetStateAction<RootState>>>(this: StateApi<any, any, any, any>, selector: (state: any) => Selected, options?: {
134
+ isEqual?: (current: Selected, next: Selected) => boolean;
135
+ isEqualRoot?: (current: any, next: any) => boolean;
136
+ name?: string;
137
+ }): StateHook<Selected, StateDispatch, PublicStateMutator, any>;
130
138
  export default GlobalStore;
package/GlobalStore.js CHANGED
@@ -25,20 +25,20 @@ var t,e;t=this,e=(t,e,r,n,i,o,a)=>/******/(()=>{
25
25
  /***/811:
26
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
27
  /***/
28
- /******/},c={};
28
+ /******/},u={};
29
29
  /************************************************************************/
30
30
  /******/
31
31
  /******/
32
32
  /******/
33
33
  /******/
34
- /******/function u(t){
34
+ /******/function c(t){
35
35
  /******/
36
- /******/var e=c[t];
36
+ /******/var e=u[t];
37
37
  /******/if(void 0!==e)
38
38
  /******/return e.exports;
39
39
  /******/
40
40
  /******/
41
- /******/var r=c[t]={
41
+ /******/var r=u[t]={
42
42
  /******/
43
43
  /******/
44
44
  /******/exports:{}
@@ -48,11 +48,11 @@ var t,e;t=this,e=(t,e,r,n,i,o,a)=>/******/(()=>{
48
48
  /******/
49
49
  /******/
50
50
  /******/
51
- /******/return s[t](r,r.exports,u),r.exports;
51
+ /******/return s[t](r,r.exports,c),r.exports;
52
52
  /******/}
53
53
  /******/
54
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,
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:{},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 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,u,(function(){return this}));var O=Object.getPrototypeOf,k=O&&O(O(P([])));k&&k!==n&&o.call(k,u)&&(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,u){var c=d(t[i],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==e(f)&&o.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 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 u=L(s,n);if(u){if(u===y)continue;return u}}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 c=d(e,r,n);if("normal"===c.type){if(i=n.done?g:v,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=g,n.method="throw",n.arg=c.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[u];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,c,(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,u,(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 u=o.call(a,"catchLoc"),c=o.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&&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=c(155),u=c(506),f=c(773),h=c(487),d=c(673),b=c(361),v=c(78),p=(a=c(811))&&a.__esModule?a:{default:a},g=function(){return t=function t(e){var n,a,c=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
56
  /**
57
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
58
  * */
@@ -61,12 +61,12 @@ this.actions=null,this.subscribers=new Set,
61
61
  * @description
62
62
  * Initializes the global store, setting up the main hook and actions map if applicable,
63
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},
64
+ this.initialize=function(){return t=c,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
65
  /**
66
66
  * set the state for a single subscriber
67
67
  * validate if the state should be updated by comparing the previous state and the new state
68
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})},
69
+ this.executeSetStateForSubscriber=function(t,e){var r,n,i,o=t.selector,a=t.callback,s=t.currentState,u=t.getConfig,l=null!==(r=null==u?void 0:u())&&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}:(c.partialUpdateSubscription(t,{currentState:f}),a({state:f},{identifier:e.identifier}),{didUpdate:!0})},
70
70
  /**
71
71
  * set the state and update all the subscribers
72
72
  * @param {State} newState - The new state to set
@@ -74,38 +74,35 @@ this.executeSetStateForSubscriber=function(t,e){var r,n,i,o=t.selector,a=t.callb
74
74
  * @param {boolean} [options.forceUpdate] - Whether to force the update even if the state is the same
75
75
  * @param {string} [options.identifier] - An optional identifier for the state change
76
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()}}},
77
+ this.setSubscribersState=function(t,e){var n=e.forceUpdate,i=e.identifier,o=c.state;if(n||o!==t){c.state=t;var a,s={forceUpdate:n,newState:t,currentState:o,identifier:i},u=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}}}}(c.subscribers.values());try{for(u.s();!(a=u.n()).done;){var l=a.value;c.executeSetStateForSubscriber(l,s)}}catch(t){u.e(t)}finally{u.f()}}},
78
78
  /**
79
79
  * Set the value of the metadata property, this is no reactive and will not trigger a re-render
80
80
  * @param {MetadataSetter<Metadata>} setter - The setter function or the value to set
81
81
  * */
82
- this.setMetadata=function(t){var e=(0,c.isFunction)(t)?t(u.metadata):t;u.metadata=e},
82
+ this.setMetadata=function(t){var e=(0,u.isFunction)(t)?t(c.metadata):t;c.metadata=e},
83
83
  /**
84
84
  * Returns the metadata [non-reactive additional information associated with the global state]
85
85
  */
86
- this.getMetadata=function(){return u.metadata},
86
+ this.getMetadata=function(){return c.metadata},
87
87
  /**
88
88
  * Get the current value of the state
89
89
  */
90
- this.getState=function(){return u.state},
90
+ this.getState=function(){return c.state},
91
91
  /**
92
92
  * get the parameters object to pass to the callback functions:
93
93
  * onInit, onStateChanged, onSubscribed, computePreventStateChange
94
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))},
95
+ this.getConfigCallbackParam=function(){var t=c.setMetadata,e=c.getMetadata,r=c.getState,n=c.subscribe,i=c.actions;return{setMetadata:t,getMetadata:e,getState:r,subscribe:n,setState:c.setState,actions:i}},this.subscribeCallback=function(t){return c.executeOnSubscribed(t),c.subscribers.add(t),function(){c.subscribers.delete(t)}},this.partialUpdateSubscription=function(t,e){(0,h.isRecord)(t)&&Object.assign(t,e)},this.executeOnSubscribed=function(t){var e,r=c.onSubscribed,n=null===(e=c.callbacks)||void 0===e?void 0:e.onSubscribed;(r||n)&&(null==r||r(c.configurationCallbackParam,t),null==n||n(c.configurationCallbackParam,t))},
96
96
  /**
97
97
  * Returns a custom hook that allows to handle a global state
98
98
  * @returns {[State, StateMutator, Metadata]} - The state, the state setter or the actions map, the metadata
99
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),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),
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,u.isFunction)(e)?e(t):t},e={currentState:t(c.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,c.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),[c.computeSelectedState({subscription:h,currentDependencies:i}),c.getStateOrchestrator(),c.metadata]},e={setMetadata:c.setMetadata,getMetadata:c.getMetadata,actions:c.actions,setState:c.actions?null:c.setState.bind(c),getState:c.getState.bind(c),subscribe:c.subscribe.bind(c),dispose:c.dispose.bind(c),createSelectorHook:c.createSelectorHook.bind(c),createObservable:c.createObservable.bind(c)};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)||c.partialUpdateSubscription(r,{currentState:r.selector(c.state)}),r.currentState},this.createSelectorHook=m,this.createObservable=y,
104
101
  /**
105
102
  * Returns the state setter or the actions map
106
103
  * @returns {StateMutator} - The state setter or the actions map
107
104
  * */
108
- this.getStateOrchestrator=function(){return u.actions?u.actions:u.setState},
105
+ this.getStateOrchestrator=function(){return c.actions?c.actions:c.setState},
109
106
  /**
110
107
  * This is the only setState function that should be exposed outside the class
111
108
  * This is responsible for defining whenever or not the state change should be allowed or prevented
@@ -113,16 +110,16 @@ this.getStateOrchestrator=function(){return u.actions?u.actions:u.setState},
113
110
  * - onStateChanged (if defined) - this function is executed after the state change
114
111
  * - 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
112
  */
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))}},
113
+ this.setState=function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.forceUpdate,o=n.identifier,a=c.state,s=(0,u.isFunction)(t)?t(a):t;if(i||c.state!==s){var l=c.setMetadata,f=c.getMetadata,h=c.getState,d=c.actions,b={setMetadata:l,getMetadata:f,setState:c.setSubscribersState,getState:h,actions:d,previousState:a,state:s,identifier:o},v=c.computePreventStateChange,p=null===(e=c.callbacks)||void 0===e?void 0:e.computePreventStateChange;if((v||p)&&((null==v?void 0:v(b))||(null==p?void 0:p(b))))return;c.setSubscribersState(s,{forceUpdate:i,identifier:o});var g=c.onStateChanged,y=null===(r=c.callbacks)||void 0===r?void 0:r.onStateChanged;(g||y)&&(null==g||g(b),null==y||y(b))}},
117
114
  /**
118
115
  * This creates a map of actions that can be used to modify or interact with the state
119
116
  * @returns {ActionCollectionResult<State, Metadata, StateMutator>} - The actions map result of the configuration object passed to the constructor
120
117
  * */
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),dispose:function(){c(),s.dispose()}};return Object.assign(l,f),l}
118
+ this.getStoreActionsMap=function(){if(!(0,h.isRecord)(c.actionsConfig))return null;var t=c.actionsConfig,e=c.setMetadata,r=c.setState,n=c.getState,i=c.getMetadata,a=Object.keys(t).reduce((function(s,u){var c,l,f;return Object.assign(s,(c={},f=function(){for(var o=t[u],s=arguments.length,c=new Array(s),l=0;l<s;l++)c[l]=arguments[l];var f=o.apply(a,c);return"function"!=typeof f&&(0,b.throwWrongKeyOnActionCollectionConfig)(u),f.call(a,{setState:r,getState:n,setMetadata:e,getMetadata:i,actions:a})},(l=o(l=u))in c?Object.defineProperty(c,l,{value:f,enumerable:!0,configurable:!0,writable:!0}):c[l]=f,c)),s}),{});return a},this.removeSubscriptions=function(){c.subscribers.clear()},this.dispose=function(){c.removeSubscriptions(),c._name="",c.actionsConfig=null,c.callbacks=null,c.metadata={},c.actions=null,c.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],c=(0,u.isFunction)(a),l=c?o:void 0,f=c?a:o,h=null!==(i=c?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:")}),u=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}),c=this.actions?null:this.setState,l=s.subscribe.bind(s),f={setMetadata:this.setMetadata,getMetadata:this.getMetadata,actions:this.actions,setState:c,getState:s.getState.bind(s),subscribe:s.subscribe.bind(s),createSelectorHook:m.bind(l),createObservable:y.bind(l),dispose:function(){u(),s.dispose()}};return Object.assign(l,f),l}
122
119
  /**
123
120
  * @description
124
121
  * Creates a derived hook bound to a selected fragment of the root state.
125
122
  * The derived hook re-renders only when the selected value changes and
126
123
  * 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),dispose:function(){f(),l.dispose()}};return Object.assign(b,p),b}t.GlobalStore=g,t.default=g})(),l;
124
+ */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,u=this.getState(),c=(null!=t?t:function(t){return t})(u),l=new g(c,{name:null!=o?o:(0,v.uniqueId)("sh:")}),f=this.subscribe((function(e){if(!(null!=a?a:Object.is)(u,e)){u=e;var r=t(e);(null!=s?s:Object.is)(c,r)||(c=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,u=!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){u=!0,n=t}finally{try{if(!s&&null!=e.return&&(o=e.return(),Object(o)!==o))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],h,i.getMetadata()];var t},p={setMetadata:this.setMetadata,getMetadata:this.getMetadata,actions:this.actions,setState:d,getState:function(){return l.getState()},subscribe:l.subscribe.bind(l),createSelectorHook:m.bind(b),createObservable:y.bind(b),dispose:function(){f(),l.dispose()}};return Object.assign(b,p),b}t.GlobalStore=g,t.default=g})(),l;
128
125
  /******/})(),"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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-hooks-global-states",
3
- "version": "11.0.0-beta.3",
3
+ "version": "11.0.0-beta.4",
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",