react-hooks-global-states 1.0.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -78
- package/lib/bundle.js +1304 -2
- package/lib/bundle.js.map +1 -0
- package/lib/src/GlobalStore.combiners.d.ts +12 -0
- package/lib/src/GlobalStore.context.d.ts +1 -1
- package/lib/src/GlobalStore.d.ts +39 -39
- package/lib/src/GlobalStore.functionHooks.d.ts +8 -6
- package/lib/src/GlobalStore.types.d.ts +19 -17
- package/lib/src/GlobalStoreAbstract.d.ts +8 -8
- package/package.json +1 -1
- package/lib/bundle.js.LICENSE.txt +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;;;;;;;ACEA,IAAAA,mBAAA,GAAAC,mBAAA;AACA,IAAAC,OAAA,GAAAD,mBAAA;AACA,IAAAE,aAAA,GAAAF,mBAAA;AAEA;;;;;;;AAOO,IAAMG,0BAA0B,GAAG,SAA7BA,0BAA0BA,CASrCC,UAKC,EAEC;;oCADCC,IAAgB,OAAAC,KAAA,CAAAC,IAAA,OAAAA,IAAA,WAAAC,IAAA,MAAAA,IAAA,GAAAD,IAAA,EAAAC,IAAA;IAAhBH,IAAgB,CAAAG,IAAA,QAAAC,SAAA,CAAAD,IAAA;EAAA;EAEnB,IAAME,OAAO,GAAGL,IAAyC;EAEzD,IAAMM,UAAU,GAAG,IAAIC,GAAG,CAAkBF,OAAO,CAACG,GAAG,CAAC,UAACC,OAAO,EAAEC,KAAK;IAAA,OAAK,CAACA,KAAK,EAAED,OAAO,EAAE,CAAC;EAAA,EAAC,CAAC;EAEhG,IAAIE,WAAW,GAAGZ,UAAU,CAACa,QAAQ,CAACX,KAAK,CAACY,IAAI,CAACP,UAAU,CAACQ,MAAM,EAAE,CAAa,CAAC;EAElF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kC,0DAA0D,2BAA2B,6BAA6B,qBAAqB,mFAAmF,YAAY,2BAA2B,IAAI,+BAA+B,wBAAwB,KAAK,UAAU,wDAAwD,OAAO,SAAS,SAAS,QAAQ,IAAI,2DAA2D,QAAQ,cAAc,UAAU,0BAA0B,iKAAiK,kBAAkB,mCAAmC,GAAG,kBAAkB,kCAAkC,wDAAwD,+BAA+B,GAAG,kBAAkB,2IAA2I,+BAA+B,wHAAwH,WAAW,qCAAqC,QAAQ,8BAA8B,IAAI,EAAE,2DAA2D,0CAA0C,6BAA6B,8DAA8D,aAAa,uJAAuJ,sBAAsB,eAAe,6BAA6B,aAAa,iBAAiB,iCAAiC,8CAA8C,YAAY,GAAG,2BAA2B,qDAAqD,YAAY,IAAI,2BAA2B,oDAAoD,YAAY,IAAI,0BAA0B,8BAA8B,2BAA2B,4BAA4B,wBAAwB,MAAM,IAAI,GAAG,+BAA+B,SAAS,GAAG,qDAAqD,SAAS,2BAA2B,wBAAwB,sCAAsC,kBAAkB,UAAU,oBAAoB,gCAAgC,QAAQ,YAAY,IAAI,EAAE,iBAAiB,+BAA+B,MAAM,qBAAqB,WAAW,+BAA+B,YAAY,YAAY,qCAAqC,MAAM;;;;;;;;;;;ACA7tM;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://react-hooks-global-states/webpack/universalModuleDefinition","webpack://react-hooks-global-states/./src/GlobalStore.combiners.ts","webpack://react-hooks-global-states/./src/GlobalStore.context.ts","webpack://react-hooks-global-states/./src/GlobalStore.functionHooks.ts","webpack://react-hooks-global-states/./src/GlobalStore.ts","webpack://react-hooks-global-states/./src/GlobalStore.types.ts","webpack://react-hooks-global-states/./src/GlobalStore.utils.ts","webpack://react-hooks-global-states/./src/GlobalStoreAbstract.ts","webpack://react-hooks-global-states/./src/index.ts","webpack://react-hooks-global-states/./node_modules/json-storage-formatter/lib/bundle.js","webpack://react-hooks-global-states/external umd \"react\"","webpack://react-hooks-global-states/webpack/bootstrap","webpack://react-hooks-global-states/webpack/before-startup","webpack://react-hooks-global-states/webpack/startup","webpack://react-hooks-global-states/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"react-hooks-global-states\"] = factory(require(\"react\"));\n\telse\n\t\troot[\"react-hooks-global-states\"] = factory(root[\"react\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE_react__) => {\nreturn ","import {\n StateGetter,\n UnsubscribeCallback,\n SelectorCallback,\n UseHookConfig,\n Subscribe,\n SubscribeCallback,\n SubscribeCallbackConfig,\n SubscribeToEmitter,\n SubscriberCallback,\n StateHook,\n} from './GlobalStore.types';\nimport { debounce, shallowCompare } from './GlobalStore.utils';\nimport { useState, useEffect } from 'react';\nimport { throwNoSubscribersWereAdded } from './GlobalStore';\n\n/**\n * @description\n * This function allows you to create a derivate state by merging the state of multiple hooks.\n * The update of the derivate state is debounced to avoid unnecessary re-renders.\n * By default, the debounce delay is 0, but you can change it by passing a delay in milliseconds as the third parameter.\n * @returns a tuple with the following elements: [subscribe, getState, dispose]\n */\nexport const combineAsyncGettersEmitter = <\n TDerivate,\n TArguments extends StateGetter<unknown>[],\n TResults = {\n [K in keyof TArguments]: TArguments[K] extends () => infer TResult\n ? Exclude<TResult, UnsubscribeCallback>\n : never;\n }\n>(\n parameters: {\n selector: SelectorCallback<TResults, TDerivate>;\n config?: UseHookConfig<TDerivate> & {\n delay?: number;\n };\n },\n ...args: TArguments\n) => {\n const getters = args as unknown as StateGetter<unknown>[];\n\n const dictionary = new Map<number, unknown>(getters.map((useHook, index) => [index, useHook()]));\n\n let parentState = parameters.selector(Array.from(dictionary.values()) as TResults);\n\n const parentIsEqual =\n parameters?.config?.isEqual !== undefined ? parameters?.config?.isEqual : shallowCompare;\n\n const subscribers = new Set<() => void>();\n\n const updateMainState = debounce(() => {\n const newState = parameters.selector(Array.from(dictionary.values()) as TResults);\n\n if (parentIsEqual?.(parentState, newState)) return;\n\n // update the parent state so the subscribers can be notified\n parentState = newState;\n\n subscribers.forEach((childCallback) => childCallback());\n }, parameters?.config?.delay);\n\n const getterSubscriptions = getters.map((useHook, index) =>\n useHook<Subscribe>((subscribe) => {\n subscribe((value) => {\n dictionary.set(index, value);\n\n updateMainState();\n });\n })\n );\n\n const subscribe = <State = TDerivate>(\n /**\n * @description\n * The callback function to subscribe to the store changes or a selector function to derive the state\n */\n param1: SubscribeCallback<State> | SelectorCallback<TDerivate, State>,\n\n /**\n * @description\n * The configuration object or the callback function to subscribe to the store changes\n */\n param2?: SubscribeCallback<State> | SubscribeCallbackConfig<State>,\n\n /**\n * @description\n * The configuration object\n */\n param3?: SubscribeCallbackConfig<State>\n ) => {\n const hasExplicitSelector = typeof param2 === 'function';\n\n const selector = (hasExplicitSelector ? param1 : null) as SelectorCallback<TDerivate, State>;\n\n const callback = (hasExplicitSelector ? param2 : param1) as SubscribeCallback<State>;\n\n const config = (hasExplicitSelector ? param3 : param2) as SubscribeCallbackConfig<State>;\n\n const $config = {\n delay: 0,\n isEqual: shallowCompare,\n ...(config ?? {}),\n };\n\n let childState = (selector?.(parentState) ?? parentState) as State;\n\n if (!$config.skipFirst) {\n // execute immediately the callback with the current state\n callback(childState);\n }\n\n const updateState = debounce(() => {\n const newChildState = (selector?.(parentState) ?? parentState) as State;\n\n // if the new state is equal to the current state, then we don't need to update the state\n if ($config.isEqual?.(childState, newChildState)) return;\n\n childState = newChildState;\n\n callback(newChildState);\n }, $config.delay ?? 0);\n\n subscribers.add(updateState);\n\n return () => {\n subscribers.delete(updateState);\n };\n };\n\n const stateGetter = (<TCallback extends SubscriberCallback<TDerivate> | null>($callback?: TCallback) => {\n // if there is no subscription callback return the state\n if (!$callback) return parentState;\n\n const internalSubscribers: UnsubscribeCallback[] = [];\n\n $callback(((...parameters) => {\n internalSubscribers.push(subscribe(...parameters));\n }) as SubscribeToEmitter<TDerivate>);\n\n if (!internalSubscribers.length) {\n throwNoSubscribersWereAdded();\n }\n\n return () => {\n internalSubscribers.forEach((unsubscribe) => {\n unsubscribe();\n\n subscribers.delete(unsubscribe);\n });\n };\n }) as StateGetter<TDerivate>;\n\n return [\n subscribe as SubscribeToEmitter<TDerivate>,\n stateGetter,\n (() => {\n getterSubscriptions.forEach((unsubscribe) => unsubscribe());\n }) as UnsubscribeCallback,\n ] as [subscribe: SubscribeToEmitter<TDerivate>, getState: typeof stateGetter, dispose: UnsubscribeCallback];\n};\n\nexport const combineRetrieverEmitterAsynchronously = combineAsyncGettersEmitter;\n\n/**\n * @description\n * This function allows you to create a derivate state by merging the state of multiple hooks.\n * The update of the derivate state is debounced to avoid unnecessary re-renders.\n * By default, the debounce delay is 0, but you can change it by passing a delay in milliseconds as the third parameter.\n * @returns A tuple containing the subscribe function, the state getter and the dispose function\n */\nexport const combineAsyncGetters = <\n TDerivate,\n TArguments extends StateGetter<unknown>[],\n TResults = {\n [K in keyof TArguments]: TArguments[K] extends () => infer TResult\n ? Exclude<TResult, UnsubscribeCallback>\n : never;\n }\n>(\n parameters: {\n selector: SelectorCallback<TResults, TDerivate>;\n config?: UseHookConfig<TDerivate> & {\n delay?: number;\n };\n },\n ...args: TArguments\n) => {\n const [subscribe, getState, dispose] = combineAsyncGettersEmitter<TDerivate, TArguments, TResults>(\n parameters,\n ...args\n );\n\n const useHook = (<State = TDerivate>(\n selector?: SelectorCallback<TDerivate, State>,\n config?: UseHookConfig<State> & {\n delay?: number;\n }\n ) => {\n const [state, setState] = useState<State>(() => {\n const parentState = getState();\n\n return selector ? selector(parentState) : (parentState as unknown as State);\n });\n\n useEffect(() => {\n const $config = {\n delay: 0,\n isEqual: shallowCompare,\n ...(config ?? {}),\n };\n\n const compareCallback = $config.isEqual !== undefined ? $config.isEqual : shallowCompare;\n\n const unsubscribe = subscribe(\n (state) => {\n return selector ? selector(state) : (state as unknown as State);\n },\n debounce((state) => {\n const newState = selector ? selector(state) : (state as unknown as State);\n\n if (compareCallback?.(state, newState)) return;\n\n setState(newState);\n }, $config.delay ?? 0)\n );\n\n return () => {\n unsubscribe();\n };\n }, []);\n\n return [state, null, null];\n }) as StateHook<TDerivate, null, null>;\n\n return [useHook, getState, dispose] as [\n useHook: typeof useHook,\n getState: StateGetter<TDerivate>,\n dispose: UnsubscribeCallback\n ];\n};\n\nexport const combineRetrieverAsynchronously = combineAsyncGetters;\n","import { createGlobalStateWithDecoupledFuncs } from '../src/GlobalStore.functionHooks';\nimport {\n ActionCollectionConfig,\n createStateConfig,\n StateHook,\n StateSetter,\n ActionCollectionResult,\n StateGetter,\n} from 'GlobalStore.types';\nimport { clone, isDate, isPrimitive } from 'json-storage-formatter';\nimport React, { PropsWithChildren } from 'react';\n\nexport const createStatefulContext = <\n TState,\n TMetadata = null,\n TActions extends ActionCollectionConfig<TState, TMetadata> = null\n>(\n initialValue: TState,\n parameters?: createStateConfig<TState, TMetadata, TActions>\n) => {\n type ContextHook = [\n hook: StateHook<\n TState,\n keyof TActions extends never\n ? StateSetter<TState>\n : ActionCollectionResult<TState, TMetadata, TActions>,\n TMetadata\n >,\n stateRetriever: StateGetter<TState>,\n stateMutator: keyof TActions extends never\n ? StateSetter<TState>\n : ActionCollectionResult<TState, TMetadata, TActions>\n ];\n\n const context = React.createContext<ContextHook>(null);\n\n const useHook = () => {\n return React.useContext(context);\n };\n\n const Provider: React.FC<\n PropsWithChildren<{\n initialValue?: Partial<TState>;\n }>\n > = ({ children, ...props }) => {\n const hook = createGlobalStateWithDecoupledFuncs<TState, TMetadata, TActions>(\n (() => {\n if (props.initialValue) {\n const isFunction = typeof props.initialValue === 'function';\n\n if (isFunction)\n return (props.initialValue as unknown as (state: TState) => TState)(clone(initialValue));\n\n const isArray = Array.isArray(props.initialValue);\n const isMap = props.initialValue instanceof Map;\n const isSet = props.initialValue instanceof Set;\n\n const isMergeAble =\n !isPrimitive(props.initialValue) && !isDate(props.initialValue) && !isArray && !isMap && !isSet;\n\n return (isMergeAble ? { ...initialValue, ...props.initialValue } : props.initialValue) as TState;\n }\n\n // return a copy of the initial value to avoid reference issues\n // this initial value will be reused in all the instances of the hook\n return clone(initialValue);\n })(),\n parameters\n );\n\n return React.createElement(context.Provider, { value: hook }, children);\n };\n\n return [useHook, Provider] as const;\n};\n","import {\n ActionCollectionConfig,\n StateConfigCallbackParam,\n StateChangesParam,\n StateSetter,\n ActionCollectionResult,\n UseHookConfig,\n AvoidNever,\n UnsubscribeCallback,\n StateHook,\n StateGetter,\n SubscribeCallback,\n Subscribe,\n createStateConfig,\n CustomGlobalHookBuilderParams,\n CustomGlobalHookParams,\n SelectorCallback,\n SubscribeCallbackConfig,\n SubscribeToEmitter,\n} from './GlobalStore.types';\n\nimport { GlobalStore } from './GlobalStore';\n\n/**\n * Creates a global state with the given state and config.\n * @returns {} [HOOK, DECOUPLED_RETRIEVER, DECOUPLED_MUTATOR] this is an array with the hook, the decoupled getState function and the decoupled setter of the state\n */\nexport const createGlobalStateWithDecoupledFuncs = <\n TState,\n TMetadata = null,\n TActions extends ActionCollectionConfig<TState, TMetadata> | null = null\n>(\n state: TState,\n { actions, ...config }: createStateConfig<TState, TMetadata, TActions> = {}\n) => {\n const store = new GlobalStore<TState, TMetadata, TActions>(state, config, actions);\n\n const [getState, setter] = store.getHookDecoupled();\n\n type Setter = keyof TActions extends never\n ? StateSetter<TState>\n : ActionCollectionResult<TState, TMetadata, TActions>;\n\n return [store.getHook(), getState, setter] as [\n state: StateHook<TState, Setter, TMetadata>,\n stateRetriever: StateGetter<TState>,\n stateMutator: Setter\n ];\n};\n\n/**\n * Creates a global hook that can be used to access the state and actions across the application\n * @returns {} - () => [TState, Setter, TMetadata] the hook that can be used to access the state and the setter of the state\n */\nexport const createGlobalState = <\n TState,\n TMetadata = null,\n TActions extends ActionCollectionConfig<TState, TMetadata> | null = null\n>(\n state: TState,\n config: createStateConfig<TState, TMetadata, TActions> = {}\n) => {\n const [useState, stateRetriever, stateMutator] = createGlobalStateWithDecoupledFuncs<\n TState,\n TMetadata,\n TActions\n >(state, config);\n\n type GlobalStateHook = typeof useState & {\n stateControls: () => [stateRetriever: typeof stateRetriever, stateMutator: typeof stateMutator];\n };\n\n (useState as unknown as GlobalStateHook).stateControls = () => [stateRetriever, stateMutator];\n\n return useState as GlobalStateHook;\n};\n\n/**\n * @description\n * Use this function to create a custom global store.\n * You can use this function to create a store with async storage.\n */\nexport const createCustomGlobalStateWithDecoupledFuncs = <TInheritMetadata = null, TCustomConfig = null>({\n onInitialize,\n onChange,\n}: CustomGlobalHookBuilderParams<TInheritMetadata, TCustomConfig>) => {\n /**\n * @description\n * Use this function to create a custom global store.\n * You can use this function to create a store with async storage or any other custom logic.\n * @param state The initial state of the store.\n * @param config The configuration of the store.\n * @returns [HOOK, DECOUPLED_RETRIEVER, DECOUPLED_MUTATOR] - this is an array with the hook, the decoupled getState function and the decoupled setter of the state\n */\n return <\n TState,\n TMetadata = null,\n TActions extends ActionCollectionConfig<\n TState,\n AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>\n > | null = null\n >(\n state: TState,\n {\n config: customConfig,\n onInit,\n onStateChanged,\n ...parameters\n }: CustomGlobalHookParams<\n TCustomConfig,\n TState,\n AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>,\n TActions\n > = {\n config: null,\n }\n ) => {\n const onInitWrapper = ((callBackParameters) => {\n onInitialize(callBackParameters as StateConfigCallbackParam<unknown, TInheritMetadata>, customConfig);\n\n onInit?.(callBackParameters);\n }) as typeof onInit;\n\n const onStateChangeWrapper = ((callBackParameters) => {\n onChange(callBackParameters as StateChangesParam<unknown, TInheritMetadata>, customConfig);\n\n onStateChanged?.(callBackParameters);\n }) as typeof onStateChanged;\n\n return createGlobalStateWithDecoupledFuncs<TState, typeof parameters.metadata, TActions>(state, {\n onInit: onInitWrapper,\n onStateChanged: onStateChangeWrapper,\n ...parameters,\n });\n };\n};\n\n/**\n * @description\n * Use this function to create a custom global hook which contains a fragment of the state of another hook or a fragment\n */\nexport const createDerivate =\n <TState, TSetter, TMetadata, TDerivate>(\n useHook: StateHook<TState, TSetter, TMetadata>,\n selector_: SelectorCallback<TState, TDerivate>,\n config_: UseHookConfig<TDerivate> = {}\n ) =>\n <State = TDerivate>(selector?: SelectorCallback<TDerivate, State>, config: UseHookConfig<State> = null) => {\n return useHook<State>((state) => {\n const fragment = selector_(state);\n\n return (selector ? selector(fragment) : fragment) as State;\n }, (selector && config ? config : config_) as UseHookConfig<State>);\n };\n\n/**\n * @description\n * This function allows you to create a derivate emitter\n * With this approach, you can subscribe to changes in a specific fragment or subset of the state.\n */\nexport const createDerivateEmitter = <\n TDerivate,\n TStateRetriever extends StateGetter<unknown>,\n TState = Exclude<ReturnType<TStateRetriever>, UnsubscribeCallback>\n>(\n getter: TStateRetriever,\n selector: SelectorCallback<TState, TDerivate>\n): SubscribeToEmitter<TDerivate> => {\n type Infected = {\n _father_emitter?: {\n getter: StateGetter<unknown>;\n selector: SelectorCallback<TState, TDerivate>;\n };\n };\n\n const father_emitter = (getter as Infected)._father_emitter;\n\n if (father_emitter) {\n // if a subscriber is already a derivate emitter, then we need to merge the selectors\n const selectorWrapper = (state: TState): TDerivate => {\n const fatherFragment = father_emitter.selector(state);\n\n return selector(fatherFragment as unknown as TState);\n };\n\n const subscriber = createDerivateEmitter<TDerivate, TStateRetriever, TState>(\n father_emitter.getter as TStateRetriever,\n selectorWrapper\n );\n\n (subscriber as Infected)._father_emitter = {\n getter: father_emitter.getter,\n selector: selectorWrapper,\n };\n\n return subscriber;\n }\n\n const subscriber = <State = TDerivate>(\n param1: SubscribeCallback<State> | SelectorCallback<TDerivate, State>,\n param2?: SubscribeCallback<State> | SubscribeCallbackConfig<State>,\n param3: SubscribeCallbackConfig<State> = {}\n ) => {\n const hasExplicitSelector = typeof param2 === 'function';\n\n const $selector = (hasExplicitSelector ? param1 : null) as SelectorCallback<unknown, unknown>;\n\n const callback = (hasExplicitSelector ? param2 : param1) as SubscribeCallback<unknown>;\n\n const config = (hasExplicitSelector ? param3 : param2) as SubscribeCallbackConfig<unknown>;\n\n return (getter as StateGetter<unknown>)<Subscribe>((subscribe) => {\n subscribe(\n (state) => {\n const fatherFragment = selector(state as TState);\n\n return $selector?.(fatherFragment) ?? fatherFragment;\n },\n callback,\n config\n );\n });\n };\n\n (subscriber as Infected)._father_emitter = {\n getter,\n selector,\n };\n\n return subscriber as SubscribeToEmitter<TDerivate>;\n};\n","import { shallowCompare, uniqueId } from './GlobalStore.utils';\nimport { useEffect, useRef, useState } from 'react';\n\nimport {\n ActionCollectionConfig,\n StateSetter,\n GlobalStoreConfig,\n ActionCollectionResult,\n StateConfigCallbackParam,\n StateChangesParam,\n MetadataSetter,\n UseHookConfig,\n StateGetter,\n SubscriberCallback,\n SubscribeCallbackConfig,\n SubscribeCallback,\n SelectorCallback,\n SubscriberParameters,\n SubscriptionCallback,\n SubscribeToEmitter,\n MetadataGetter,\n} from './GlobalStore.types';\n\nconst throwWrongKeyOnActionCollectionConfig = (action_key: string) => {\n throw new Error(`[WRONG CONFIGURATION!]: Every key inside the storeActionsConfig must be a higher order function that returns a function \\n[${action_key}]: key is not a valid function, try something like this: \\n{\\n\n ${action_key}: (param) => ({ setState, getState, setMetadata, getMetadata, actions }) => {\\n\n setState((state) => ({ ...state, ...param }))\\n\n }\\n\n}\\n`);\n};\n\nexport const throwNoSubscribersWereAdded = () => {\n throw new Error(\n 'No new subscribers were added, please make sure to add at least one subscriber with the subscribe method'\n );\n};\n\nconst uniqueSymbol = Symbol('unique');\n\n/**\n * The GlobalStore class is the main class of the library and it is used to create a GlobalStore instances\n * @template {TState} TState - The type of the state object\n * @template {TMetadata} TMetadata - The type of the metadata object (optional) (default: null) no reactive information set to share with the subscribers\n * @template {TStateMutator} TStateMutator - The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions\n * */\nexport class GlobalStore<\n TState,\n TMetadata = null,\n TStateMutator extends ActionCollectionConfig<TState, TMetadata> | StateSetter<TState> = StateSetter<TState>\n> {\n /**\n * list of all the subscribers setState functions\n * @template {TState} TState - The type of the state object\n * */\n public subscribers: Map<string, SubscriberParameters> = new Map();\n\n /**\n * Actions of the store\n */\n public actions?: ActionCollectionResult<TState, TMetadata, TStateMutator> = null;\n\n /**\n * additional configuration for the store\n * @template {TState} TState - The type of the state object\n * @template {TMetadata} TMetadata - The type of the metadata object (optional) (default: null) no reactive information set to share with the subscribers\n * @template {TStateMutator} TStateMutator - The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions\n * @property {GlobalStoreConfig<TState, TMetadata, TStateMutator>} config.metadata - The metadata to pass to the callbacks (optional) (default: null)\n * @property {GlobalStoreConfig<TState, TMetadata, TStateMutator>} config.onInit - The callback to execute when the store is initialized (optional) (default: null)\n * @property {GlobalStoreConfig<TState, TMetadata, TStateMutator>} config.onStateChanged - The callback to execute when the state is changed (optional) (default: null)\n * @property {GlobalStoreConfig<TState, TMetadata, TStateMutator>} config.onSubscribed - The callback to execute when a component is subscribed to the store (optional) (default: null)\n * @property {GlobalStoreConfig<TState, TMetadata, TStateMutator>} config.computePreventStateChange - The callback to execute when the state is changed to compute if the state change should be prevented (optional) (default: null)\n */\n protected config: GlobalStoreConfig<TState, TMetadata, TStateMutator> = {\n metadata: null,\n };\n\n /**\n * execute once the store is created\n * @template {TState} TState - The type of the state object\n * @template {TMetadata} TMetadata - The type of the metadata object (optional) (default: null) no reactive information set to share with the subscribers\n * @template {TStateMutator} TStateMutator - The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions\n * @param {StateConfigCallbackParam<TState, TMetadata, TStateMutator>} parameters - The parameters object brings the following properties: setState, getState, setMetadata, getMetadata\n * @param {Dispatch<SetStateAction<TState>>} parameters.setState - The setState function to update the state\n * @param {() => TState} parameters.getState - The getState function to get the state\n * @param {Dispatch<SetStateAction<TMetadata>>} parameters.setMetadata - The setMetadata function to update the metadata\n * @param {() => TMetadata} parameters.getMetadata - The getMetadata function to get the metadata\n * */\n protected onInit?: GlobalStoreConfig<TState, TMetadata, TStateMutator>['onInit'] = null;\n\n /**\n * execute every time the state is changed\n * @template {TState} TState - The type of the state object\n * @template {TMetadata} TMetadata - The type of the metadata object (optional) (default: null) no reactive information set to share with the subscribers\n * @template {TStateMutator} TStateMutator - The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions\n * @param {StateConfigCallbackParam<TState, TMetadata, TStateMutator>} parameters - The parameters object brings the following properties: setState, getState, setMetadata, getMetadata\n * @param {Dispatch<SetStateAction<TState>>} parameters.setState - The setState function to update the state\n * @param {() => TState} parameters.getState - The getState function to get the state\n * @param {Dispatch<SetStateAction<TMetadata>>} parameters.setMetadata - The setMetadata function to update the metadata\n * @param {() => TMetadata} parameters.getMetadata - The getMetadata function to get the metadata\n * */\n protected onStateChanged?: GlobalStoreConfig<TState, TMetadata, TStateMutator>['onStateChanged'] = null;\n\n /**\n * Execute each time a new component gets subscribed to the store\n * @template {TState} TState - The type of the state object\n * @template {TMetadata} TMetadata - The type of the metadata object (optional) (default: null) no reactive information set to share with the subscribers\n * @template {TStateMutator} TStateMutator - The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions\n * @param {StateConfigCallbackParam<TState, TMetadata, TStateMutator>} parameters - The parameters object brings the following properties: setState, getState, setMetadata, getMetadata\n * @param {Dispatch<SetStateAction<TState>>} parameters.setState - The setState function to update the state\n * @param {() => TState} parameters.getState - The getState function to get the state\n * @param {Dispatch<SetStateAction<TMetadata>>} parameters.setMetadata - The setMetadata function to update the metadata\n * @param {() => TMetadata} parameters.getMetadata - The getMetadata function to get the metadata\n * */\n protected onSubscribed?: GlobalStoreConfig<TState, TMetadata, TStateMutator>['onSubscribed'] = null;\n\n /**\n * Execute every time a state change is triggered and before the state is updated, it allows to prevent the state change by returning true\n * @template {TState} TState - The type of the state object\n * @template {TMetadata} TMetadata - The type of the metadata object (optional) (default: null) no reactive information set to share with the subscribers\n * @template {TStateMutator} TStateMutator - The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions\n * @param {StateConfigCallbackParam<TState, TMetadata, TStateMutator>} parameters - The parameters object brings the following properties: setState, getState, setMetadata, getMetadata\n * @param {Dispatch<SetStateAction<TState>>} parameters.setState - The setState function to update the state\n * @param {() => TState} parameters.getState - The getState function to get the state\n * @param {Dispatch<SetStateAction<TMetadata>>} parameters.setMetadata - The setMetadata function to update the metadata\n * @param {() => TMetadata} parameters.getMetadata - The getMetadata function to get the metadata\n * @returns {boolean} - true to prevent the state change, false to allow the state change\n * */\n protected computePreventStateChange?: GlobalStoreConfig<\n TState,\n TMetadata,\n TStateMutator\n >['computePreventStateChange'] = null;\n\n /**\n * We use a wrapper in order to be able to force the state update when necessary even with primitive types\n */\n protected stateWrapper: {\n state: TState;\n };\n\n /**\n * @deprecated direct modifications of the state could end up in unexpected behaviors\n */\n protected get state(): TState {\n return this.stateWrapper.state;\n }\n\n /**\n * Create a simple global store\n * @param {TState} state - The initial state\n * */\n constructor(state: TState);\n\n /**\n * Create a new global store with custom action\n * The metadata object could be null if not needed\n * The setter Object is used to define the actions that will be used to manipulate the state\n * @param {TState} state - The initial state\n * @param {TStateMutator} actionsConfig - The actions configuration object (optional) (default: null) if not null the store manipulation will be done through the actions\n * */\n constructor(state: TState, config: GlobalStoreConfig<TState, TMetadata, TStateMutator>);\n\n /**\n * Create a new global store with custom action\n * The metadata object could be null if not needed\n * The setter Object is used to define the actions that will be used to manipulate the state\n * The config object is used to define the callbacks that will be executed during the store lifecycle\n * The lifecycle callbacks are: onInit, onStateChanged, onSubscribed and computePreventStateChange\n * @param {TState} state - The initial state\n * @param {GlobalStoreConfig<TState, TMetadata>} config - The configuration object (optional) (default: { metadata: null })\n * @param {GlobalStoreConfig<TState, TMetadata>} config.metadata - The metadata object (optional) (default: null) if not null the metadata object will be reactive\n * @param {GlobalStoreConfig<TState, TMetadata>} config.onInit - The callback to execute when the store is initialized (optional) (default: null)\n * @param {GlobalStoreConfig<TState, TMetadata>} config.onStateChanged - The callback to execute when the state is changed (optional) (default: null)\n * @param {GlobalStoreConfig<TState, TMetadata>} config.onSubscribed - The callback to execute when a new component gets subscribed to the store (optional) (default: null)\n * @param {GlobalStoreConfig<TState, TMetadata>} config.computePreventStateChange - The callback to execute every time a state change is triggered and before the state is updated, it allows to prevent the state change by returning true (optional) (default: null)\n * @param {TStateMutator} actionsConfig - The actions configuration object (optional) (default: null) if not null the store manipulation will be done through the actions\n * */\n constructor(\n state: TState,\n config: GlobalStoreConfig<TState, TMetadata, TStateMutator>,\n actionsConfig: TStateMutator\n );\n\n /**\n * Create a new instance of the GlobalStore\n * @param {TState} state - The initial state\n * @param {GlobalStoreConfig<TState, TMetadata>} config - The configuration object (optional) (default: { metadata: null })\n * @param {GlobalStoreConfig<TState, TMetadata>} config.metadata - The metadata object (optional) (default: null) if not null the metadata object will be reactive\n * @param {GlobalStoreConfig<TState, TMetadata>} config.onInit - The callback to execute when the store is initialized (optional) (default: null)\n * @param {GlobalStoreConfig<TState, TMetadata>} config.onStateChanged - The callback to execute when the state is changed (optional) (default: null)\n * @param {GlobalStoreConfig<TState, TMetadata>} config.onSubscribed - The callback to execute when a new component gets subscribed to the store (optional) (default: null)\n * @param {GlobalStoreConfig<TState, TMetadata>} config.computePreventStateChange - The callback to execute every time a state change is triggered and before the state is updated, it allows to prevent the state change by returning true (optional) (default: null) * @param {TStateMutator} actionsConfig - The actions configuration object (optional) (default: null) if not null the store manipulation will be done through the actions\n * */\n constructor(\n state: TState,\n config: GlobalStoreConfig<TState, TMetadata, TStateMutator> = {},\n protected actionsConfig: TStateMutator | null = null\n ) {\n this.stateWrapper = {\n state,\n };\n\n this.config = {\n metadata: null,\n ...(config ?? {}),\n };\n\n const isExtensionClass = this.constructor !== GlobalStore;\n if (isExtensionClass) return;\n\n (this as GlobalStore<TState, TMetadata, TStateMutator>).initialize();\n }\n\n protected initialize = async () => {\n /**\n * actions map is created just once after the initialization\n */\n if (this.actionsConfig) {\n this.actions = this.getStoreActionsMap();\n }\n\n const { onInit } = this;\n const { onInit: onInitFromConfig } = this.config;\n\n if (!onInit && !onInitFromConfig) return;\n\n const parameters = this.getConfigCallbackParam();\n\n onInit?.(parameters);\n onInitFromConfig?.(parameters);\n };\n\n /**\n * set the state and update all the subscribers\n * @param {StateSetter<TState>} setter - The setter function or the value to set\n * */\n protected setState = ({ state: newRootState, forceUpdate }: { state: TState; forceUpdate: boolean }) => {\n const { state: currentRootState } = this.stateWrapper;\n\n // update the main state\n this.stateWrapper = {\n state: newRootState,\n };\n\n const executeSetState = (parameters: SubscriberParameters) => {\n const { selector, callback, currentState: currentChildState, config } = parameters;\n\n // compare the root state, there should not be a re-render if the root state is the same\n if (\n !forceUpdate &&\n (config?.isEqualRoot ?? ((a, b) => Object.is(a, b)))(currentRootState, newRootState)\n )\n return;\n\n const newChildState = selector ? selector(newRootState) : newRootState;\n\n // compare the result after the selector is executed\n if (!forceUpdate && (config?.isEqual ?? ((a, b) => Object.is(a, b)))(currentChildState, newChildState))\n return;\n\n // this in the case of the hooks is the setState function\n callback({ state: newChildState });\n };\n\n const subscribers = Array.from(this.subscribers.values());\n\n // update all the subscribers\n for (let index = 0; index < subscribers.length; index++) {\n const parameters = subscribers[index];\n\n executeSetState(parameters);\n }\n };\n\n /**\n * Set the value of the metadata property, this is no reactive and will not trigger a re-render\n * @param {MetadataSetter<TMetadata>} setter - The setter function or the value to set\n * */\n protected setMetadata: MetadataSetter<TMetadata> = (setter) => {\n const isSetterFunction = typeof setter === 'function';\n\n const metadata = isSetterFunction\n ? (setter as (state: TMetadata) => TMetadata)(this.config.metadata ?? null)\n : setter;\n\n this.config = {\n ...(this.config ?? {}),\n metadata,\n };\n };\n\n protected getMetadata = () => this.config.metadata ?? null;\n\n protected createChangesSubscriber = ({\n callback,\n selector,\n config,\n }: {\n selector?: SelectorCallback<unknown, unknown>;\n callback: SubscribeCallback<unknown>;\n config: SubscribeCallbackConfig<unknown>;\n }) => {\n const initialState = selector ? selector(this.stateWrapper.state) : this.stateWrapper.state;\n\n let stateWrapper = {\n state: initialState,\n };\n\n const subscriptionCallback: SubscriptionCallback = ({ state }: { state: unknown }) => {\n stateWrapper.state = state;\n\n callback(state);\n };\n\n if (!config?.skipFirst) {\n callback(initialState);\n }\n\n return {\n stateWrapper,\n subscriptionCallback,\n };\n };\n\n /**\n * Return current state of the store\n * Optionally you can use this method to subscribe a callback to the store changes\n * @param {UseHookConfig<TState, TDerivate>} config - The configuration object (optional) (default: { selector: null, subscriptionCallback: null, config: null })\n * @param {TSelector} config.selector - The selector function to derive the state (optional) (default: null)\n * @param {TSubscriptionCallback} config.subscriptionCallback - The callback to execute every time the state is changed\n * @param {UseHookConfig<TState, TDerivate>} config.config - The configuration for the callback (optional) (default: null)\n * @param {UseHookConfig<TState, TDerivate>} config.config.isEqual - The compare function to check if the state is changed (optional) (default: shallowCompare)\n * @returns The state of the store, optionally if you provide a subscriptionCallback it this method will return the unsubscribe function\n */\n protected getState = (<TCallback extends SubscriberCallback<TState> | null>($callback?: TCallback) => {\n // if there is no subscription callback return the state\n if (!$callback) return this.stateWrapper.state;\n\n const changesSubscribers: string[] = [];\n\n const subscribe = ((param1, param2, param3) => {\n const hasExplicitSelector = typeof param2 === 'function';\n\n const selector = (hasExplicitSelector ? param1 : null) as SelectorCallback<unknown, unknown>;\n\n const callback = (hasExplicitSelector ? param2 : param1) as SubscribeCallback<unknown>;\n\n const config = (hasExplicitSelector ? param3 : param2) as SubscribeCallbackConfig<unknown>;\n\n const { subscriptionCallback, stateWrapper } = this.createChangesSubscriber({\n selector,\n callback,\n config,\n });\n\n const subscriptionId = uniqueId();\n\n this.updateSubscription({\n subscriptionId,\n selector,\n config,\n stateWrapper,\n callback: subscriptionCallback,\n });\n\n changesSubscribers.push(subscriptionId);\n }) as SubscribeToEmitter<TState>;\n\n $callback(subscribe);\n\n if (!changesSubscribers.length) {\n throwNoSubscribersWereAdded();\n }\n\n return () => {\n changesSubscribers.forEach((subscriber) => {\n this.subscribers.delete(subscriber);\n });\n };\n }) as StateGetter<TState>;\n\n /**\n * get the parameters object to pass to the callback functions (onInit, onStateChanged, onSubscribed, computePreventStateChange)\n * this parameters object brings the following properties: setState, getState, setMetadata, getMetadata\n * this parameter object allows to update the state, get the state, update the metadata, get the metadata\n * @returns {StateConfigCallbackParam<TState, TMetadata>} - The parameters object\n * */\n protected getConfigCallbackParam = (): StateConfigCallbackParam<TState, TMetadata, TStateMutator> => {\n const { setMetadata, getMetadata, getState, actions, setStateWrapper } = this;\n\n return {\n setMetadata,\n getMetadata,\n getState,\n setState: setStateWrapper,\n actions,\n } as StateConfigCallbackParam<TState, TMetadata, TStateMutator>;\n };\n\n protected updateSubscription = ({\n subscriptionId,\n callback,\n selector,\n config = {},\n stateWrapper,\n }: Partial<\n Omit<SubscriberParameters, 'currentState'> & {\n stateWrapper: {\n state: unknown;\n };\n }\n >) => {\n const subscriber = this.subscribers.get(subscriptionId);\n\n if (subscriber) {\n // every time the hook is called we update the reference of the state derivate state\n // this allows to compare the state and trigger the callback only when the state is changed\n if (stateWrapper) subscriber.currentState = stateWrapper?.state;\n\n // update other dependencies if present\n if (selector) subscriber.selector = selector;\n if (config) subscriber.config = config;\n if (callback) subscriber.callback;\n\n return subscriber;\n }\n\n const newSubscriber: SubscriberParameters = {\n subscriptionId,\n selector,\n config,\n currentState: stateWrapper.state,\n callback,\n };\n\n this.subscribers.set(subscriptionId, newSubscriber);\n\n return newSubscriber;\n };\n\n protected executeOnSubscribed = () => {\n const { onSubscribed } = this;\n const { onSubscribed: onSubscribedFromConfig } = this.config;\n\n if (onSubscribed || onSubscribedFromConfig) {\n const parameters = this.getConfigCallbackParam();\n\n onSubscribed?.(parameters);\n onSubscribedFromConfig?.(parameters);\n }\n };\n\n /**\n * Returns a custom hook that allows to handle a global state\n * @returns {[TState, TStateMutator, TMetadata]} - The state, the state setter or the actions map, the metadata\n * */\n public getHook =\n () =>\n <State = TState>(selector?: SelectorCallback<TState, State>, config: UseHookConfig<State> = {}) => {\n const subscriptionRef = useRef({\n id: null as string,\n dependencies: uniqueSymbol as unknown as unknown[],\n });\n\n // remove the subscription when the component is unmounted\n useEffect(() => {\n return () => {\n this.subscribers.delete(subscriptionRef.current.id);\n };\n }, []);\n\n const computeStateWrapper = () => {\n if (selector) {\n return {\n state: selector(this.stateWrapper.state),\n };\n }\n\n return this.stateWrapper;\n };\n\n const [stateWrapper, setState] = useState<{\n state: unknown;\n }>(computeStateWrapper);\n\n // by using a ref we can avoid to lose the id when StrictMode is enabled\n useEffect(() => {\n if (subscriptionRef.current.id !== null) return;\n\n subscriptionRef.current.id = uniqueId();\n }, []);\n\n useEffect(() => {\n const subscriptionId = subscriptionRef.current.id;\n if (subscriptionId === null) return;\n\n const isFirstTime = !this.subscribers.has(subscriptionId);\n\n // prepare the values for the orchestrator\n this.updateSubscription({\n subscriptionId,\n stateWrapper,\n ...(isFirstTime && { selector, config, callback: setState }),\n });\n\n if (!isFirstTime) return;\n\n this.executeOnSubscribed();\n }, [stateWrapper]);\n\n type State_ = State extends never | undefined | null ? TState : State;\n\n type Setter = keyof TStateMutator extends never\n ? StateSetter<TState>\n : ActionCollectionResult<TState, TMetadata, TStateMutator>;\n\n return [\n (() => {\n const { id: subscriptionId, dependencies: oldDependencies } = subscriptionRef.current;\n const { dependencies: newDependencies } = config ?? {};\n\n // update the dependencies\n subscriptionRef.current.dependencies = newDependencies;\n\n if (subscriptionId === null) return stateWrapper.state;\n\n // make sure we don't proceed if wa ere just adding the dependencies\n if ((oldDependencies as unknown) === uniqueSymbol) return stateWrapper.state;\n\n // if the dependencies are the same we don't need to update the subscription\n if (newDependencies === oldDependencies) return stateWrapper.state;\n\n const haveDifferentLength = oldDependencies?.length !== newDependencies?.length;\n\n const haveDifferentValues =\n haveDifferentLength || !shallowCompare(oldDependencies, newDependencies);\n\n if (!haveDifferentLength && !haveDifferentValues) return stateWrapper.state;\n\n // this will be the state of the component but will not be part of react state yet\n const impureStateWrapper = computeStateWrapper();\n\n this.updateSubscription({\n subscriptionId,\n stateWrapper: impureStateWrapper,\n selector,\n config,\n });\n\n // we need to update directly the reference to be compatible with strict mode\n stateWrapper.state = impureStateWrapper.state;\n\n return impureStateWrapper.state;\n })(),\n this.getStateOrchestrator(),\n this.config.metadata ?? null,\n ] as [state: State_, setter: Setter, metadata: TMetadata];\n };\n\n /**\n * Returns an array with the a function to get the state, the state setter or the actions map, and a function to get the metadata\n * @returns {[() => TState, TStateMutator, () => TMetadata]} - The state getter, the state setter or the actions map, the metadata getter\n * */\n public getHookDecoupled = () => {\n const stateOrchestrator = this.getStateOrchestrator();\n\n const { getMetadata, getState } = this;\n\n return [getState, stateOrchestrator, getMetadata] as [\n StateGetter<TState>,\n typeof stateOrchestrator,\n MetadataGetter<TMetadata>\n ];\n };\n\n /**\n * Returns the state setter or the actions map\n * @returns {TStateMutator} - The state setter or the actions map\n * */\n protected getStateOrchestrator = () => {\n return (() => {\n if (this.actions) {\n return this.actions;\n }\n\n return this.setStateWrapper;\n })() as keyof TStateMutator extends never\n ? StateSetter<TState>\n : ActionCollectionResult<TState, TMetadata, TStateMutator>;\n };\n\n /**\n * Calculate whenever or not we should compute the callback parameters on the state change\n * @returns {boolean} - True if we should compute the callback parameters on the state change\n * */\n protected hasStateCallbacks = (): boolean => {\n const { computePreventStateChange, onStateChanged } = this;\n\n const {\n computePreventStateChange: computePreventStateChangeFromConfig,\n onStateChanged: onStateChangedFromConfig,\n } = this.config;\n\n const preventStateChangesCalls = computePreventStateChange || computePreventStateChangeFromConfig;\n\n const stateChangeCalls = onStateChanged || onStateChangedFromConfig;\n\n const shouldComputeParameter = preventStateChangesCalls || stateChangeCalls;\n\n return !!shouldComputeParameter;\n };\n\n /**\n * This is responsible for defining whenever or not the state change should be allowed or prevented\n * the function also execute the functions:\n * - onStateChanged (if defined) - this function is executed after the state change\n * - 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\n */\n protected setStateWrapper: StateSetter<TState> = (setter, { forceUpdate } = {}) => {\n const isSetterFunction = typeof setter === 'function';\n const previousState = this.stateWrapper.state;\n\n const newState = isSetterFunction ? (setter as (state: TState) => TState)(previousState) : setter;\n\n // if the state didn't change, we don't need to do anything\n if (!forceUpdate && Object.is(this.stateWrapper.state, newState)) return;\n\n const { setMetadata, getMetadata, getState, actions, setState } = this;\n\n const callbackParameter = {\n setMetadata,\n getMetadata,\n setState: setState,\n getState,\n actions,\n previousState,\n state: newState,\n } as StateChangesParam<TState, TMetadata, TStateMutator>;\n\n const { computePreventStateChange } = this;\n const { computePreventStateChange: computePreventStateChangeFromConfig } = this.config;\n\n // check if the state change should be prevented\n if (computePreventStateChange || computePreventStateChangeFromConfig) {\n const preventStateChange =\n computePreventStateChange?.(callbackParameter) ||\n computePreventStateChangeFromConfig?.(callbackParameter);\n\n if (preventStateChange) return;\n }\n\n this.setState({\n forceUpdate,\n state: newState,\n });\n\n const { onStateChanged } = this;\n const { onStateChanged: onStateChangedFromConfig } = this.config;\n\n if (!onStateChanged && !onStateChangedFromConfig) return;\n\n onStateChanged?.(callbackParameter);\n onStateChangedFromConfig?.(callbackParameter);\n };\n\n /**\n * This creates a map of actions that can be used to modify or interact with the state\n * @returns {ActionCollectionResult<TState, TMetadata, TStateMutator>} - The actions map result of the configuration object passed to the constructor\n * */\n protected getStoreActionsMap = (): ActionCollectionResult<TState, TMetadata, TStateMutator> => {\n if (!this.actionsConfig) return null;\n\n const { actionsConfig, setMetadata, setStateWrapper, getState, getMetadata } = this;\n\n const actionsKeys = Object.keys(actionsConfig);\n\n // we bind the functions to the actions object to allow reusing actions in the same api config by using the -this- keyword\n const actions: ActionCollectionResult<TState, TMetadata, TStateMutator> = actionsKeys.reduce(\n (accumulator, action_key) => {\n Object.assign(accumulator, {\n [action_key](...parameters: unknown[]) {\n const actionConfig = actionsConfig[action_key];\n const action = actionConfig.apply(actions, parameters);\n const actionIsNotAFunction = typeof action !== 'function';\n\n // we throw an error if the action is not a function, this is mandatory for the correct execution of the actions\n if (actionIsNotAFunction) {\n throwWrongKeyOnActionCollectionConfig(action_key);\n }\n\n // executes the actions bringing access to the state setter and a copy of the state\n const result = action.call(actions, {\n setState: setStateWrapper,\n getState,\n setMetadata,\n getMetadata,\n actions: actions as ActionCollectionResult<TState, TMetadata>,\n });\n\n // we return the result of the actions to the invoker\n return result;\n },\n });\n\n return accumulator;\n },\n {} as ActionCollectionResult<TState, TMetadata, TStateMutator>\n );\n\n return actions;\n };\n}\n","/**\n * @param {StateSetter<TState>} setter - set the state\n * @returns {void} result - void\n */\nexport type StateSetter<TState> = (\n /**\n * @param {StateSetter<TState>} setter - set the state\n * @param {{ forceUpdate?: boolean }} options - Options to be passed to the setter\n * @param {{ forceUpdate?: boolean }} options.forceUpdate - Force the re-render of the subscribers even if the state is the same\n * @returns {void} result - void\n * */\n setter: TState | ((state: TState) => TState),\n /**\n * This parameter indicate whether we should force the re-render of the subscribers even if the state is the same,\n * Do\n */\n {\n forceUpdate,\n }?: {\n /**\n * @deprecated forceUpdate normally should not be used inside components\n * Use this flag just in custom implementations of the global store\n */\n forceUpdate?: boolean;\n }\n) => void;\n\n/**\n * @description\n * The hook to use the global state\n * @returns {[State, StateSetter<TState>, TMetadata]} result - the state, the setter and the metadata\n */\nexport type StateHook<TState, TSetter, TMetadata> = <State = TState>(\n selector?: (state: TState) => State,\n config?: UseHookConfig<State>\n) => [state: State, stateMutator: TSetter, metadata: TMetadata];\n\n/**\n * @description\n * Type that prevent ts issues with merging never with other types\n */\nexport type AvoidNever<T> = T extends never | null | undefined ? {} : T;\n\n/**\n * @param {TMetadata} setter - set the metadata\n * @returns {void} result - void\n */\nexport type MetadataSetter<TMetadata> = (\n /**\n * @param {TMetadata} setter - set the metadata\n * @returns {void} result - void\n * */\n setter: TMetadata | ((metadata: TMetadata) => TMetadata)\n) => void;\n\n/**\n * Parameters of the onStateChanged callback function\n * @param {TState} state - the new state\n * @param {TState} previousState - the previous state\n **/\nexport type StateChanges<TState> = {\n /**\n * The new state\n * */\n state: TState;\n\n /**\n * The previous state\n * */\n previousState?: TState;\n};\n\n/**\n * Callbacks to be passed to the configurations function of the store\n * @template {TState} TState - The state type\n * @template {TMetadata} TMetadata - The metadata type\n * @property {StateSetter<TState>} setMetadata - Set the metadata\n * @property {StateSetter<TState>} setState - Set the state\n * @property {() => TState} getState - Get the state\n * @property {() => TMetadata} getMetadata - Get the metadata\n * @property {ActionCollectionResult<TState, TMetadata>} actions - The actions collection if any\n **/\nexport type StoreTools<TState = any, TMetadata = any, TActions = any> = {\n /**\n * Set the metadata\n * @param {TMetadata} setter - The metadata or a function that will receive the metadata and return the new metadata\n * @returns {void} result - void\n * */\n setMetadata: MetadataSetter<TMetadata>;\n\n /**\n * Set the state\n * @param {TState} setter - The state or a function that will receive the state and return the new state\n * @param {{ forceUpdate?: boolean }} options - Options\n * @returns {void} result - void\n * */\n setState: StateSetter<TState>;\n\n /**\n * Get the state\n * @returns {TState} result - The state\n * */\n getState: StateGetter<TState>;\n\n /**\n * Get the metadata\n * @returns {TMetadata} result - The metadata\n * */\n getMetadata: () => TMetadata;\n\n /**\n * Actions of the hook\n */\n actions: TActions;\n};\n\n/**\n * Basic contract for the storeActionsConfig configuration\n * @template {TState} TState - The state type\n * @template {TMetadata} TMetadata - The metadata type\n * @property {string} key - The action name\n * @property {(...parameters: unknown[]) => (storeTools: { setMetadata: MetadataSetter<TMetadata>; setState: StateSetter<TState>; getState: () => TState; getMetadata: () => TMetadata; }) => unknown | void} value - The action function\n * @returns {ActionCollectionConfig<TState, TMetadata>} result - The action collection configuration\n */\nexport interface ActionCollectionConfig<TState, TMetadata = null> {\n [key: string]: (...parameters: any[]) => (storeTools: any) => unknown | void;\n}\n\n/**\n * This is the actions object returned by the hook when you pass an storeActionsConfig configuration\n * if you pass an storeActionsConfig configuration, the hook will return an object with the actions\n * whatever data manipulation of the state should be executed through the custom actions with as access to the state and metadata\n * @template {TState} TState - The state type\n * @template {TMetadata} TMetadata - The metadata type\n * @template {TStateMutator} TStateMutator - The storeActionsConfig type (optional) - if you pass an storeActionsConfig the hook will return an object with the actions\n *\n * @example\n *\n * const store = new GlobalStore(0, {\n * increment: () => ({ setState }) => {\n * setState((state) => state + 1);\n * },\n * decrement: () => ({ setState }) => {\n * setState((state) => state - 1);\n * },\n * });\n *\n * const [state, actions] = store.getHook();\n *\n * actions.increment();\n * actions.decrement();\n *\n * console.log(state); // 0\n */\nexport type ActionCollectionResult<\n TState,\n TMetadata,\n TStateMutator extends ActionCollectionConfig<TState, TMetadata> | StateSetter<TState> = StateSetter<TState>\n> = TStateMutator extends ActionCollectionConfig<TState, TMetadata>\n ? {\n /**\n * @description\n * A new object with will be created with the same keys of the storeActionsConfig object\n */\n [key in keyof TStateMutator]: (\n ...params: Parameters<TStateMutator[key]>\n ) => ReturnType<ReturnType<TStateMutator[key]>>;\n }\n : null;\n\n/**\n * Common parameters of the store configuration callback functions\n * @param {StateSetter<TState>} setState - add a new value to the state\n * @param {() => TState} getState - get the current state\n * @param {MetadataSetter<TMetadata>} setMetadata - add a new value to the metadata\n * @param {() => TMetadata} getMetadata - get the current metadata\n * @param {ActionCollectionResult<TState, ActionCollectionConfig<TState, TMetadata>> | null} actions - the actions object returned by the hook when you pass an storeActionsConfig configuration otherwise null\n * @template {TState} TState - The state type\n * @template {TMetadata} TMetadata - The metadata type\n * @template {TStateMutator} TStateMutator - The storeActionsConfig type (optional) - if you pass an storeActionsConfig the hook will return an object with the actions\n * @template {ActionCollectionResult<TState, TStateMutator>} TStateMutator - the result of the API (optional) - if you don't pass an API as a parameter, you can pass null\n * */\nexport type StateConfigCallbackParam<\n TState = any,\n TMetadata = null,\n TStateMutator extends ActionCollectionConfig<TState, TMetadata> | StateSetter<TState> = StateSetter<TState>\n> = {\n actions: ActionCollectionResult<TState, TMetadata, TStateMutator>;\n} & StoreTools<TState, TMetadata>;\n\n/**\n * Parameters of the onStateChanged callback function\n * @template {TState} TState - The state type\n * @template {TMetadata} TMetadata - The metadata type\n * @template {TStateMutator} TStateMutator - The storeActionsConfig type (optional) - if you pass an storeActionsConfig the hook will return an object with the actions\n */\nexport type StateChangesParam<\n TState = any,\n TMetadata = null,\n TStateMutator extends ActionCollectionConfig<TState, TMetadata> | StateSetter<TState> = StateSetter<TState>\n> = StateConfigCallbackParam<TState, TMetadata, TStateMutator> & StateChanges<TState>;\n\n/**\n * Configuration of the store (optional) - if you don't need to use the store configuration you don't need to pass this parameter\n * @param {StateConfigCallbackParam<TState, TMetadata> => void} onInit - callback function called when the store is initialized\n * @param {StateConfigCallbackParam<TState, TMetadata> => void} onSubscribed - callback function called every time a component is subscribed to the store\n * @param {StateChangesParam<TState, TMetadata> => boolean} computePreventStateChange - callback function called every time the state is changed and it allows you to prevent the state change\n * @param {StateChangesParam<TState, TMetadata> => void} onStateChanged - callback function called every time the state is changed\n * @template TState - the type of the state\n * @template TMetadata - the type of the metadata (optional) - if you don't pass an metadata as a parameter, you can pass null\n * @template {ActionCollectionConfig<TState,TMetadata> | null} TStateMutator - the configuration of the API (optional) - if you don't pass an API as a parameter, you can pass null\n * */\nexport type GlobalStoreConfig<\n TState,\n TMetadata,\n TStateMutator extends ActionCollectionConfig<TState, TMetadata> | StateSetter<TState> = StateSetter<TState>\n> = {\n /**\n * @param {StateConfigCallbackParam<TState, TMetadata> => void} metadata - the initial value of the metadata\n * */\n metadata?: TMetadata;\n\n /**\n * @param {StateConfigCallbackParam<TState, TMetadata> => void} onInit - callback function called when the store is initialized\n * @returns {void} result - void\n * */\n onInit?: (parameters: StateConfigCallbackParam<TState, TMetadata, TStateMutator>) => void;\n\n /**\n * @param {StateChangesParam<TState, TMetadata> => void} onStateChanged - callback function called every time the state is changed\n * @returns {void} result - void\n */\n onStateChanged?: (parameters: StateChangesParam<TState, TMetadata, TStateMutator>) => void;\n\n /**\n * @param {StateConfigCallbackParam<TState, TMetadata> => void} onSubscribed - callback function called every time a component is subscribed to the store\n * @returns {void} result - void\n */\n onSubscribed?: (parameters: StateConfigCallbackParam<TState, TMetadata, TStateMutator>) => void;\n\n /**\n * @param {StateChangesParam<TState, TMetadata> => boolean} computePreventStateChange - callback function called every time the state is about to change and it allows you to prevent the state change\n * @returns {boolean} result - true if you want to prevent the state change, false otherwise\n */\n computePreventStateChange?: (parameters: StateChangesParam<TState, TMetadata, TStateMutator>) => boolean;\n} | null;\n\nexport type UseHookConfig<TState> = {\n /**\n * The callback to execute when the state is changed to check if the same really changed\n * If the function is not provided the derived state will perform a shallow comparison\n */\n isEqual?: (current: TState, next: TState) => boolean;\n isEqualRoot?: (current: any, next: any) => boolean;\n dependencies?: unknown[];\n};\n\n/**\n * Callback function to unsubscribe from the store\n */\nexport type UnsubscribeCallback = () => void;\n\n/**\n * Configuration of the subscribe callbacks\n */\nexport type SubscribeCallbackConfig<TState> = UseHookConfig<TState> & {\n /**\n * By default the callback is executed immediately after the subscription\n */\n skipFirst?: boolean;\n};\n\n/**\n * Callback function to subscribe to the store changes\n */\nexport type SubscribeCallback<TState> = (state: TState) => void;\n\n/**\n * Callback function to subscribe to the store changes from a getter\n */\nexport type SubscriberCallback<TState> = (subscribe: SubscribeToEmitter<TState>) => void;\n\n/**\n * Callback function to get the current state of the store or to subscribe to the store changes\n * @template TState - the type of the state\n * @param {SubscriberCallback<TState> | null} callback - the callback function to subscribe to the store changes (optional)\n * use the methods subscribe and subscribeSelect to subscribe to the store changes\n * if you don't pass a callback function the hook will return the current state of the store\n * @returns {UnsubscribeCallback | TState} result - the state or the unsubscribe callback if you pass a callback function\n */\nexport type StateGetter<TState> = <Subscription extends Subscribe | false = false>(\n /**\n * @param {SubscriberCallback<TState> | null} callback - the callback function to subscribe to the store changes (optional)\n * use the methods subscribe and subscribeSelect to subscribe to the store changes\n */\n callback?: Subscription extends Subscribe ? SubscriberCallback<TState> : null\n) => Subscription extends Subscribe ? UnsubscribeCallback : TState;\n\nexport type MetadataGetter<TMetadata> = () => TMetadata;\n\n/**\n * Constant value type to indicate that the getter is a subscription\n */\nexport type Subscribe = true;\n\n/**\n * Configuration of the state (optional) - if you don't need to use the state configuration you don't need to pass this parameter\n */\nexport type createStateConfig<\n TState,\n TMetadata,\n TActions extends ActionCollectionConfig<TState, TMetadata> | null = null\n> = {\n /**\n * @description\n * The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions\n */\n actions?: TActions;\n} & GlobalStoreConfig<TState, TMetadata, TActions>;\n\nexport type CustomGlobalHookBuilderParams<TInheritMetadata = null, TCustomConfig = {}> = {\n /**\n * @description\n * This function is called when the state is initialized.\n */\n onInitialize: (\n {\n setState,\n setMetadata,\n getMetadata,\n getState,\n actions,\n }: StateConfigCallbackParam<any, TInheritMetadata>,\n config: TCustomConfig\n ) => void;\n\n /**\n * @description\n * This function is called when the state is changed.\n */\n onChange: (\n { setState, setMetadata, getMetadata, getState, actions }: StateChangesParam<any, TInheritMetadata>,\n config: TCustomConfig\n ) => void;\n};\n\n/**\n * @description\n * Configuration of the custom global hook\n */\nexport type CustomGlobalHookParams<\n TCustomConfig,\n TState,\n TMetadata,\n TActions extends ActionCollectionConfig<TState, TMetadata> | null\n> = {\n /**\n * @description\n * Type of the configuration object that the custom hook will require or accept\n */\n config?: TCustomConfig;\n\n /**\n * @description\n * The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions\n */\n actions?: TActions;\n} & GlobalStoreConfig<TState, TMetadata, TActions>;\n\nexport type SelectorCallback<TState, TDerivate> = (state: TState) => TDerivate;\n\n/**\n * @description\n * Function to subscribe to the store changes\n * @returns {UnsubscribeCallback} result - Function to unsubscribe from the store\n */\nexport type SubscribeToEmitter<TState> = <\n TParam1 extends SubscribeCallback<TState> | SelectorCallback<TState, unknown>,\n TResult = ReturnType<TParam1>,\n TConfig = TResult extends void | null | undefined | never\n ? SubscribeCallbackConfig<TState>\n : SubscribeCallbackConfig<TResult>,\n TParam2 extends SubscribeCallbackConfig<TState> | SubscribeCallback<TResult> = TResult extends\n | void\n | null\n | undefined\n | never\n ? TConfig\n : SubscribeCallback<TResult>,\n TParam3 = TResult extends void | null | undefined | never ? never : TConfig\n>(\n /**\n * @description\n * The callback function to subscribe to the store changes or a selector function to derive the state\n */\n param1: TParam1,\n\n /**\n * @description\n * The configuration object or the callback function to subscribe to the store changes\n */\n param2?: TParam2,\n\n /**\n * @description\n * The configuration object\n */\n param3?: TParam3\n) => UnsubscribeCallback;\n\nexport type SubscriberParameters = {\n subscriptionId: string;\n selector: SelectorCallback<any, any>;\n config: UseHookConfig<any> | SubscribeCallbackConfig<any>;\n currentState: unknown;\n callback: SubscriptionCallback;\n};\n\nexport type SubscriptionCallback = (params: { state: unknown }) => void;\n\nexport type SetStateCallback = (parameters: { state: unknown }) => void;\n","import { isPrimitive, isDate, isNil } from \"json-storage-formatter\";\n\n/**\n * Shallow compare two values and return true if they are equal.\n * This function just compare the first level of the values.\n * @param value1\n * @param value2\n * @returns {boolean} true if the values are equal, false otherwise\n */\nexport const shallowCompare = <T>(value1: T, value2: T) => {\n const isEqual = value1 === value2;\n if (isEqual) return true;\n\n const typeofValue1 = typeof value1;\n const typeofValue2 = typeof value2;\n\n if (typeofValue1 !== typeofValue2) return false;\n\n if (\n isNil(value1) ||\n isNil(value2) ||\n (isPrimitive(value1) && isPrimitive(value2)) ||\n (isDate(value1) && isDate(value2)) ||\n (typeofValue1 === \"function\" && typeofValue2 === \"function\")\n ) {\n return value1 === value2;\n }\n\n const isArray = Array.isArray(value1);\n\n if (isArray) {\n const array1 = value1 as unknown[];\n const array2 = value2 as unknown[];\n\n if (array1.length !== array2.length) return false;\n\n for (let i = 0; i < array1.length; i++) {\n const value1 = array1[i];\n const value2 = array2[i];\n\n if (value1 !== value2) return false;\n }\n }\n\n const isMap = value1 instanceof Map;\n\n if (isMap) {\n const map1 = value1 as Map<unknown, unknown>;\n const map2 = value2 as Map<unknown, unknown>;\n\n if (map1.size !== map2.size) return false;\n\n for (const [key, value] of map1) {\n const value2 = map2.get(key);\n\n if (value !== value2) return false;\n }\n }\n\n const isSet = value1 instanceof Set;\n\n if (isSet) {\n const set1 = value1 as Set<unknown>;\n const set2 = value2 as Set<unknown>;\n\n if (set1.size !== set2.size) return false;\n\n for (const value of set1) {\n if (!set2.has(value)) return false;\n }\n }\n\n // for objects\n const keys1 = Object.keys(value1);\n const keys2 = Object.keys(value2);\n\n if (keys1.length !== keys2.length) return false;\n\n for (const key of keys1) {\n const propObject1 = value1[key];\n const propObject2 = value2[key];\n\n if (propObject1 !== propObject2) return false;\n }\n\n return true;\n};\n\n/**\n * Debounce a function.\n */\nexport const debounce = <T extends (...args: any[]) => any>(\n callback: T,\n delay: number = 0\n) => {\n let timeout: NodeJS.Timeout;\n\n return (...args: Parameters<T>): void => {\n if (timeout) clearTimeout(timeout);\n\n timeout = setTimeout(() => {\n callback(...args);\n }, delay);\n };\n};\n\nexport const uniqueId = (): string => {\n return Date.now().toString(36) + Math.random().toString(36).substr(2, 5);\n};\n","import {\n StateSetter,\n StateConfigCallbackParam,\n StateChangesParam,\n ActionCollectionConfig,\n GlobalStoreConfig,\n} from './GlobalStore.types';\n\nimport { GlobalStore } from './GlobalStore';\n\n/**\n * @description\n * Use this class to extends the capabilities of the GlobalStore.\n * by implementing the abstract methods onInitialize and onChange.\n * You can use this class to create a store with async storage.\n */\nexport abstract class GlobalStoreAbstract<\n TState,\n TMetadata = null,\n TStateMutator extends ActionCollectionConfig<TState, TMetadata> | StateSetter<TState> = StateSetter<TState>\n> extends GlobalStore<TState, TMetadata, TStateMutator> {\n constructor(\n state: TState,\n config: GlobalStoreConfig<TState, TMetadata, TStateMutator> = {},\n actionsConfig: TStateMutator | null = null\n ) {\n super(state, config, actionsConfig);\n }\n\n protected onInit = (parameters: StateConfigCallbackParam<TState, TMetadata, TStateMutator>) => {\n this.onInitialize(parameters);\n };\n\n protected onStateChanged = (parameters: StateChangesParam<TState, TMetadata, TStateMutator>) => {\n this.onChange(parameters);\n };\n\n protected abstract onInitialize: ({\n setState,\n setMetadata,\n getMetadata,\n getState,\n actions,\n }: StateConfigCallbackParam<TState, TMetadata, TStateMutator>) => void;\n\n protected abstract onChange: ({\n setState,\n setMetadata,\n getMetadata,\n getState,\n actions,\n }: StateChangesParam<TState, TMetadata, TStateMutator>) => void;\n}\n","export * from 'json-storage-formatter';\nexport * from './GlobalStore.types';\nexport * from './GlobalStore';\nexport * from './GlobalStoreAbstract';\nexport * from './GlobalStore.functionHooks';\nexport * from './GlobalStore.utils';\nexport * from './GlobalStore.combiners';\nexport * from './GlobalStore.context';\n","!function(r,t){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define([],t):\"object\"==typeof exports?exports[\"json-storage-formatter\"]=t():r[\"json-storage-formatter\"]=t()}(this,(()=>(()=>{\"use strict\";var r={991:(r,t,e)=>{var n=Object.create?function(r,t,e,n){void 0===n&&(n=e);var o=Object.getOwnPropertyDescriptor(t,e);o&&!(\"get\"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,o)}:function(r,t,e,n){void 0===n&&(n=e),r[n]=t[e]};Object.defineProperty(t,\"__esModule\",{value:!0}),function(r,t){for(var e in r)\"default\"===e||Object.prototype.hasOwnProperty.call(t,e)||n(t,r,e)}(e(729),t)},729:(r,t)=>{function e(r){return e=\"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},e(r)}function n(r,t,n){return(t=function(r){var t=function(r,t){if(\"object\"!==e(r)||null===r)return r;var n=r[Symbol.toPrimitive];if(void 0!==n){var o=n.call(r,\"string\");if(\"object\"!==e(o))return o;throw new TypeError(\"@@toPrimitive must return a primitive value.\")}return String(r)}(r);return\"symbol\"===e(t)?t:String(t)}(t))in r?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}function o(r,t){if(r){if(\"string\"==typeof r)return i(r,t);var e=Object.prototype.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=new Array(t);e<t;e++)n[e]=r[e];return n}Object.defineProperty(t,\"__esModule\",{value:!0}),t.formatToStore=t.formatFromStore=t.isPrimitive=t.isFunction=t.isRegex=t.isDate=t.isString=t.isBoolean=t.isNumber=t.isNil=t.clone=void 0,t.clone=function(r){var e,u=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).shallow;if((0,t.isPrimitive)(r)||(0,t.isDate)(r))return r;if(Array.isArray(r))return u?function(r){if(Array.isArray(r))return i(r)}(e=r)||function(r){if(\"undefined\"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r[\"@@iterator\"])return Array.from(r)}(e)||o(e)||function(){throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}():r.map((function(r){return(0,t.clone)(r)}));if(r instanceof Map){var a=Array.from(r.entries());return u?new Map(a):new Map(a.map((function(r){return(0,t.clone)(r)})))}if(r instanceof Set){var f=Array.from(r.values());return u?new Set(f):new Set(f.map((function(r){return(0,t.clone)(r)})))}return r instanceof RegExp?new RegExp(r.toString()):(0,t.isFunction)(r)?u?r:Object.create(r):u?Object.assign({},r):r instanceof Error?new Error(r.message):Object.keys(r).reduce((function(e,o){var i=r[o];return Object.assign(Object.assign({},e),n({},o,(0,t.clone)(i)))}),{})},t.isNil=function(r){return null==r},t.isNumber=function(r){return\"number\"==typeof r},t.isBoolean=function(r){return\"boolean\"==typeof r},t.isString=function(r){return\"string\"==typeof r},t.isDate=function(r){return r instanceof Date},t.isRegex=function(r){return r instanceof RegExp},t.isFunction=function(r){return\"function\"==typeof r||r instanceof Function},t.isPrimitive=function(r){return(0,t.isNil)(r)||(0,t.isNumber)(r)||(0,t.isBoolean)(r)||(0,t.isString)(r)||\"symbol\"===e(r)},t.formatFromStore=function(r){return function(r){var e,i;if((0,t.isPrimitive)(r))return r;if(\"date\"===(null==r?void 0:r.$t))return new Date(r.$v);if(\"map\"===(null==r?void 0:r.$t)){var u=(null!==(e=r.$v)&&void 0!==e?e:[]).map((function(r){var e,n,i=(n=2,function(r){if(Array.isArray(r))return r}(e=r)||function(r,t){var e=null==r?null:\"undefined\"!=typeof Symbol&&r[Symbol.iterator]||r[\"@@iterator\"];if(null!=e){var n,o,i,u,a=[],f=!0,c=!1;try{if(i=(e=e.call(r)).next,0===t){if(Object(e)!==e)return;f=!1}else for(;!(f=(n=i.call(e)).done)&&(a.push(n.value),a.length!==t);f=!0);}catch(r){c=!0,o=r}finally{try{if(!f&&null!=e.return&&(u=e.return(),Object(u)!==u))return}finally{if(c)throw o}}return a}}(e,n)||o(e,n)||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=i[0],a=i[1];return[u,(0,t.formatFromStore)(a)]}));return new Map(u)}if(\"set\"===(null==r?void 0:r.$t)){var a=null!==(i=r.$v)&&void 0!==i?i:[].map((function(r){return(0,t.formatFromStore)(r)}));return new Set(a)}return\"regex\"===(null==r?void 0:r.$t)?new RegExp(r.$v):\"error\"===(null==r?void 0:r.$t)?new Error(r.$v):Array.isArray(r)?r.map((function(r){return(0,t.formatFromStore)(r)})):\"function\"===(null==r?void 0:r.$t)?Function(\"(\".concat(r.$v,\")(...arguments)\")):Object.keys(r).reduce((function(e,o){var i=r[o];return Object.assign(Object.assign({},e),n({},o,(0,t.formatFromStore)(i)))}),{})}((arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).jsonParse?JSON.parse(r):(0,t.clone)(r))},t.formatToStore=function(r){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{stringify:!1},i=o.stringify,u=o.validator,a=o.excludeTypes,f=o.excludeKeys,c=new Set(null!=a?a:[]),s=new Set(null!=f?f:[]),l=c.size||s.size,m=null!=u?u:function(r){var t=r.key,n=r.value;if(!l)return!0;var o=s.has(t),i=c.has(e(n));return!o&&!i},v=function r(e){if((0,t.isPrimitive)(e))return e;if(Array.isArray(e))return e.map((function(t){return r(t)}));if(e instanceof Map)return{$t:\"map\",$v:Array.from(e.entries()).map((function(t){return r(t)}))};if(e instanceof Set)return{$t:\"set\",$v:Array.from(e.values()).map((function(t){return r(t)}))};if((0,t.isDate)(e))return{$t:\"date\",$v:e.toISOString()};if((0,t.isRegex)(e))return{$t:\"regex\",$v:e.toString()};if((0,t.isFunction)(e)){var o;try{o={$t:\"function\",$v:e.toString()}}catch(r){o={$t:\"error\",$v:\"Error: Could not serialize function\"}}return o}return e instanceof Error?{$t:\"error\",$v:e.message}:Object.keys(e).reduce((function(t,o){var i=e[o],u=r(i);return m({obj:e,key:o,value:u})?Object.assign(Object.assign({},t),n({},o,r(i))):t}),{})}((0,t.clone)(r));return i?JSON.stringify(v):v}}},t={};return function e(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return r[n](i,i.exports,e),i.exports}(991)})()));","module.exports = __WEBPACK_EXTERNAL_MODULE_react__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/index.ts\");\n",""],"names":["GlobalStore_utils_1","require","react_1","GlobalStore_1","combineAsyncGettersEmitter","parameters","args","Array","_len","_key","arguments","getters","dictionary","Map","map","useHook","index","parentState","selector","from","values","parentIsEqual","_a","config","isEqual","undefined","_b","shallowCompare","subscribers","Set","updateMainState","debounce","newState","forEach","childCallback","_c","delay","getterSubscriptions","subscribe","value","set","param1","param2","param3","hasExplicitSelector","callback","$config","Object","assign","childState","skipFirst","updateState","newChildState","call","add","stateGetter","$callback","internalSubscribers","push","apply","length","throwNoSubscribersWereAdded","unsubscribe","exports","combineRetrieverEmitterAsynchronously","combineAsyncGetters","_len2","_key2","_ref","concat","_ref2","_slicedToArray","getState","dispose","_ref3","useState","_ref4","state","setState","useEffect","compareCallback","combineRetrieverAsynchronously","GlobalStore_functionHooks_1","json_storage_formatter_1","__importDefault","createStatefulContext","initialValue","context","createContext","useContext","Provider","children","props","__rest","hook","createGlobalStateWithDecoupledFuncs","isFunction","clone","isArray","isMap","isSet","isMergeAble","isPrimitive","isDate","createElement","actions","store","GlobalStore","_store$getHookDecoupl","getHookDecoupled","_store$getHookDecoupl2","setter","getHook","createGlobalState","stateRetriever","stateMutator","stateControls","createCustomGlobalStateWithDecoupledFuncs","onInitialize","onChange","customConfig","onInit","onStateChanged","onInitWrapper","callBackParameters","onStateChangeWrapper","createDerivate","selector_","config_","fragment","createDerivateEmitter","getter","father_emitter","_father_emitter","selectorWrapper","fatherFragment","subscriber","$selector","throwWrongKeyOnActionCollectionConfig","action_key","Error","uniqueSymbol","Symbol","_this","actionsConfig","_classCallCheck","metadata","onSubscribed","computePreventStateChange","initialize","__awaiter","_regeneratorRuntime","mark","_callee","onInitFromConfig","wrap","_callee$","_context","prev","next","getStoreActionsMap","abrupt","getConfigCallbackParam","stop","newRootState","forceUpdate","currentRootState","stateWrapper","executeSetState","currentChildState","currentState","isEqualRoot","a","b","is","setMetadata","isSetterFunction","getMetadata","createChangesSubscriber","initialState","subscriptionCallback","changesSubscribers","_this$createChangesSu","subscriptionId","uniqueId","updateSubscription","setStateWrapper","_ref4$config","get","newSubscriber","executeOnSubscribed","onSubscribedFromConfig","subscriptionRef","useRef","id","dependencies","current","computeStateWrapper","_ref5","_ref6","isFirstTime","has","_subscriptionRef$curr","oldDependencies","_ref7","newDependencies","haveDifferentLength","haveDifferentValues","impureStateWrapper","getStateOrchestrator","stateOrchestrator","hasStateCallbacks","_this$config","computePreventStateChangeFromConfig","onStateChangedFromConfig","preventStateChangesCalls","stateChangeCalls","shouldComputeParameter","_ref8","previousState","callbackParameter","preventStateChange","actionsKeys","keys","reduce","accumulator","_defineProperty","actionConfig","action","actionIsNotAFunction","result","isExtensionClass","constructor","_createClass","key","value1","value2","typeofValue1","_typeof","typeofValue2","isNil","array1","array2","i","map1","map2","size","_iterator","_createForOfIteratorHelper","_step","s","n","done","_step$value","err","e","f","set1","set2","_iterator2","_step2","keys1","keys2","_i2","_keys","propObject1","propObject2","timeout","clearTimeout","setTimeout","Date","now","toString","Math","random","substr","GlobalStoreAbstract","_GlobalStore_1$Global","_inherits","_super","_createSuper","__exportStar"],"sourceRoot":""}
|
|
@@ -12,6 +12,12 @@ export declare const combineAsyncGettersEmitter: <TDerivate, TArguments extends
|
|
|
12
12
|
delay?: number;
|
|
13
13
|
};
|
|
14
14
|
}, ...args: TArguments) => [subscribe: SubscribeToEmitter<TDerivate>, getState: StateGetter<TDerivate>, dispose: UnsubscribeCallback];
|
|
15
|
+
export declare const combineRetrieverEmitterAsynchronously: <TDerivate, TArguments extends StateGetter<unknown>[], TResults = { [K in keyof TArguments]: TArguments[K] extends () => infer TResult ? Exclude<TResult, UnsubscribeCallback> : never; }>(parameters: {
|
|
16
|
+
selector: SelectorCallback<TResults, TDerivate>;
|
|
17
|
+
config?: UseHookConfig<TDerivate> & {
|
|
18
|
+
delay?: number;
|
|
19
|
+
};
|
|
20
|
+
}, ...args: TArguments) => [subscribe: SubscribeToEmitter<TDerivate>, getState: StateGetter<TDerivate>, dispose: UnsubscribeCallback];
|
|
15
21
|
/**
|
|
16
22
|
* @description
|
|
17
23
|
* This function allows you to create a derivate state by merging the state of multiple hooks.
|
|
@@ -25,3 +31,9 @@ export declare const combineAsyncGetters: <TDerivate, TArguments extends StateGe
|
|
|
25
31
|
delay?: number;
|
|
26
32
|
};
|
|
27
33
|
}, ...args: TArguments) => [useHook: StateHook<TDerivate, null, null>, getState: StateGetter<TDerivate>, dispose: UnsubscribeCallback];
|
|
34
|
+
export declare const combineRetrieverAsynchronously: <TDerivate, TArguments extends StateGetter<unknown>[], TResults = { [K in keyof TArguments]: TArguments[K] extends () => infer TResult ? Exclude<TResult, UnsubscribeCallback> : never; }>(parameters: {
|
|
35
|
+
selector: SelectorCallback<TResults, TDerivate>;
|
|
36
|
+
config?: UseHookConfig<TDerivate> & {
|
|
37
|
+
delay?: number;
|
|
38
|
+
};
|
|
39
|
+
}, ...args: TArguments) => [useHook: StateHook<TDerivate, null, null>, getState: StateGetter<TDerivate>, dispose: UnsubscribeCallback];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActionCollectionConfig, createStateConfig, StateHook, StateSetter, ActionCollectionResult, StateGetter } from 'GlobalStore.types';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export declare const createStatefulContext: <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, TMetadata> = null>(initialValue: TState, parameters?: createStateConfig<TState, TMetadata, TActions>) => readonly [() => [hook: StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>, TMetadata>,
|
|
3
|
+
export declare const createStatefulContext: <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, TMetadata> = null>(initialValue: TState, parameters?: createStateConfig<TState, TMetadata, TActions>) => readonly [() => [hook: StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>, TMetadata>, stateRetriever: StateGetter<TState>, stateMutator: keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>], React.FC<React.PropsWithChildren<{
|
|
4
4
|
initialValue?: Partial<TState>;
|
|
5
5
|
}>>];
|
package/lib/src/GlobalStore.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ export declare const throwNoSubscribersWereAdded: () => never;
|
|
|
4
4
|
* The GlobalStore class is the main class of the library and it is used to create a GlobalStore instances
|
|
5
5
|
* @template {TState} TState - The type of the state object
|
|
6
6
|
* @template {TMetadata} TMetadata - The type of the metadata object (optional) (default: null) no reactive information set to share with the subscribers
|
|
7
|
-
* @template {
|
|
7
|
+
* @template {TStateMutator} TStateMutator - The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions
|
|
8
8
|
* */
|
|
9
|
-
export declare class GlobalStore<TState, TMetadata = null,
|
|
10
|
-
protected actionsConfig:
|
|
9
|
+
export declare class GlobalStore<TState, TMetadata = null, TStateMutator extends ActionCollectionConfig<TState, TMetadata> | StateSetter<TState> = StateSetter<TState>> {
|
|
10
|
+
protected actionsConfig: TStateMutator | null;
|
|
11
11
|
/**
|
|
12
12
|
* list of all the subscribers setState functions
|
|
13
13
|
* @template {TState} TState - The type of the state object
|
|
@@ -16,68 +16,68 @@ export declare class GlobalStore<TState, TMetadata = null, TStateSetter extends
|
|
|
16
16
|
/**
|
|
17
17
|
* Actions of the store
|
|
18
18
|
*/
|
|
19
|
-
actions?: ActionCollectionResult<TState, TMetadata,
|
|
19
|
+
actions?: ActionCollectionResult<TState, TMetadata, TStateMutator>;
|
|
20
20
|
/**
|
|
21
21
|
* additional configuration for the store
|
|
22
22
|
* @template {TState} TState - The type of the state object
|
|
23
23
|
* @template {TMetadata} TMetadata - The type of the metadata object (optional) (default: null) no reactive information set to share with the subscribers
|
|
24
|
-
* @template {
|
|
25
|
-
* @property {GlobalStoreConfig<TState, TMetadata,
|
|
26
|
-
* @property {GlobalStoreConfig<TState, TMetadata,
|
|
27
|
-
* @property {GlobalStoreConfig<TState, TMetadata,
|
|
28
|
-
* @property {GlobalStoreConfig<TState, TMetadata,
|
|
29
|
-
* @property {GlobalStoreConfig<TState, TMetadata,
|
|
24
|
+
* @template {TStateMutator} TStateMutator - The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions
|
|
25
|
+
* @property {GlobalStoreConfig<TState, TMetadata, TStateMutator>} config.metadata - The metadata to pass to the callbacks (optional) (default: null)
|
|
26
|
+
* @property {GlobalStoreConfig<TState, TMetadata, TStateMutator>} config.onInit - The callback to execute when the store is initialized (optional) (default: null)
|
|
27
|
+
* @property {GlobalStoreConfig<TState, TMetadata, TStateMutator>} config.onStateChanged - The callback to execute when the state is changed (optional) (default: null)
|
|
28
|
+
* @property {GlobalStoreConfig<TState, TMetadata, TStateMutator>} config.onSubscribed - The callback to execute when a component is subscribed to the store (optional) (default: null)
|
|
29
|
+
* @property {GlobalStoreConfig<TState, TMetadata, TStateMutator>} config.computePreventStateChange - The callback to execute when the state is changed to compute if the state change should be prevented (optional) (default: null)
|
|
30
30
|
*/
|
|
31
|
-
protected config: GlobalStoreConfig<TState, TMetadata,
|
|
31
|
+
protected config: GlobalStoreConfig<TState, TMetadata, TStateMutator>;
|
|
32
32
|
/**
|
|
33
33
|
* execute once the store is created
|
|
34
34
|
* @template {TState} TState - The type of the state object
|
|
35
35
|
* @template {TMetadata} TMetadata - The type of the metadata object (optional) (default: null) no reactive information set to share with the subscribers
|
|
36
|
-
* @template {
|
|
37
|
-
* @param {StateConfigCallbackParam<TState, TMetadata,
|
|
36
|
+
* @template {TStateMutator} TStateMutator - The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions
|
|
37
|
+
* @param {StateConfigCallbackParam<TState, TMetadata, TStateMutator>} parameters - The parameters object brings the following properties: setState, getState, setMetadata, getMetadata
|
|
38
38
|
* @param {Dispatch<SetStateAction<TState>>} parameters.setState - The setState function to update the state
|
|
39
39
|
* @param {() => TState} parameters.getState - The getState function to get the state
|
|
40
40
|
* @param {Dispatch<SetStateAction<TMetadata>>} parameters.setMetadata - The setMetadata function to update the metadata
|
|
41
41
|
* @param {() => TMetadata} parameters.getMetadata - The getMetadata function to get the metadata
|
|
42
42
|
* */
|
|
43
|
-
protected onInit?: GlobalStoreConfig<TState, TMetadata,
|
|
43
|
+
protected onInit?: GlobalStoreConfig<TState, TMetadata, TStateMutator>['onInit'];
|
|
44
44
|
/**
|
|
45
45
|
* execute every time the state is changed
|
|
46
46
|
* @template {TState} TState - The type of the state object
|
|
47
47
|
* @template {TMetadata} TMetadata - The type of the metadata object (optional) (default: null) no reactive information set to share with the subscribers
|
|
48
|
-
* @template {
|
|
49
|
-
* @param {StateConfigCallbackParam<TState, TMetadata,
|
|
48
|
+
* @template {TStateMutator} TStateMutator - The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions
|
|
49
|
+
* @param {StateConfigCallbackParam<TState, TMetadata, TStateMutator>} parameters - The parameters object brings the following properties: setState, getState, setMetadata, getMetadata
|
|
50
50
|
* @param {Dispatch<SetStateAction<TState>>} parameters.setState - The setState function to update the state
|
|
51
51
|
* @param {() => TState} parameters.getState - The getState function to get the state
|
|
52
52
|
* @param {Dispatch<SetStateAction<TMetadata>>} parameters.setMetadata - The setMetadata function to update the metadata
|
|
53
53
|
* @param {() => TMetadata} parameters.getMetadata - The getMetadata function to get the metadata
|
|
54
54
|
* */
|
|
55
|
-
protected onStateChanged?: GlobalStoreConfig<TState, TMetadata,
|
|
55
|
+
protected onStateChanged?: GlobalStoreConfig<TState, TMetadata, TStateMutator>['onStateChanged'];
|
|
56
56
|
/**
|
|
57
57
|
* Execute each time a new component gets subscribed to the store
|
|
58
58
|
* @template {TState} TState - The type of the state object
|
|
59
59
|
* @template {TMetadata} TMetadata - The type of the metadata object (optional) (default: null) no reactive information set to share with the subscribers
|
|
60
|
-
* @template {
|
|
61
|
-
* @param {StateConfigCallbackParam<TState, TMetadata,
|
|
60
|
+
* @template {TStateMutator} TStateMutator - The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions
|
|
61
|
+
* @param {StateConfigCallbackParam<TState, TMetadata, TStateMutator>} parameters - The parameters object brings the following properties: setState, getState, setMetadata, getMetadata
|
|
62
62
|
* @param {Dispatch<SetStateAction<TState>>} parameters.setState - The setState function to update the state
|
|
63
63
|
* @param {() => TState} parameters.getState - The getState function to get the state
|
|
64
64
|
* @param {Dispatch<SetStateAction<TMetadata>>} parameters.setMetadata - The setMetadata function to update the metadata
|
|
65
65
|
* @param {() => TMetadata} parameters.getMetadata - The getMetadata function to get the metadata
|
|
66
66
|
* */
|
|
67
|
-
protected onSubscribed?: GlobalStoreConfig<TState, TMetadata,
|
|
67
|
+
protected onSubscribed?: GlobalStoreConfig<TState, TMetadata, TStateMutator>['onSubscribed'];
|
|
68
68
|
/**
|
|
69
69
|
* Execute every time a state change is triggered and before the state is updated, it allows to prevent the state change by returning true
|
|
70
70
|
* @template {TState} TState - The type of the state object
|
|
71
71
|
* @template {TMetadata} TMetadata - The type of the metadata object (optional) (default: null) no reactive information set to share with the subscribers
|
|
72
|
-
* @template {
|
|
73
|
-
* @param {StateConfigCallbackParam<TState, TMetadata,
|
|
72
|
+
* @template {TStateMutator} TStateMutator - The type of the actionsConfig object (optional) (default: null) if a configuration is passed, the hook will return an object with the actions then all the store manipulation will be done through the actions
|
|
73
|
+
* @param {StateConfigCallbackParam<TState, TMetadata, TStateMutator>} parameters - The parameters object brings the following properties: setState, getState, setMetadata, getMetadata
|
|
74
74
|
* @param {Dispatch<SetStateAction<TState>>} parameters.setState - The setState function to update the state
|
|
75
75
|
* @param {() => TState} parameters.getState - The getState function to get the state
|
|
76
76
|
* @param {Dispatch<SetStateAction<TMetadata>>} parameters.setMetadata - The setMetadata function to update the metadata
|
|
77
77
|
* @param {() => TMetadata} parameters.getMetadata - The getMetadata function to get the metadata
|
|
78
78
|
* @returns {boolean} - true to prevent the state change, false to allow the state change
|
|
79
79
|
* */
|
|
80
|
-
protected computePreventStateChange?: GlobalStoreConfig<TState, TMetadata,
|
|
80
|
+
protected computePreventStateChange?: GlobalStoreConfig<TState, TMetadata, TStateMutator>['computePreventStateChange'];
|
|
81
81
|
/**
|
|
82
82
|
* We use a wrapper in order to be able to force the state update when necessary even with primitive types
|
|
83
83
|
*/
|
|
@@ -98,9 +98,9 @@ export declare class GlobalStore<TState, TMetadata = null, TStateSetter extends
|
|
|
98
98
|
* The metadata object could be null if not needed
|
|
99
99
|
* The setter Object is used to define the actions that will be used to manipulate the state
|
|
100
100
|
* @param {TState} state - The initial state
|
|
101
|
-
* @param {
|
|
101
|
+
* @param {TStateMutator} actionsConfig - The actions configuration object (optional) (default: null) if not null the store manipulation will be done through the actions
|
|
102
102
|
* */
|
|
103
|
-
constructor(state: TState, config: GlobalStoreConfig<TState, TMetadata,
|
|
103
|
+
constructor(state: TState, config: GlobalStoreConfig<TState, TMetadata, TStateMutator>);
|
|
104
104
|
/**
|
|
105
105
|
* Create a new global store with custom action
|
|
106
106
|
* The metadata object could be null if not needed
|
|
@@ -114,15 +114,15 @@ export declare class GlobalStore<TState, TMetadata = null, TStateSetter extends
|
|
|
114
114
|
* @param {GlobalStoreConfig<TState, TMetadata>} config.onStateChanged - The callback to execute when the state is changed (optional) (default: null)
|
|
115
115
|
* @param {GlobalStoreConfig<TState, TMetadata>} config.onSubscribed - The callback to execute when a new component gets subscribed to the store (optional) (default: null)
|
|
116
116
|
* @param {GlobalStoreConfig<TState, TMetadata>} config.computePreventStateChange - The callback to execute every time a state change is triggered and before the state is updated, it allows to prevent the state change by returning true (optional) (default: null)
|
|
117
|
-
* @param {
|
|
117
|
+
* @param {TStateMutator} actionsConfig - The actions configuration object (optional) (default: null) if not null the store manipulation will be done through the actions
|
|
118
118
|
* */
|
|
119
|
-
constructor(state: TState, config: GlobalStoreConfig<TState, TMetadata,
|
|
119
|
+
constructor(state: TState, config: GlobalStoreConfig<TState, TMetadata, TStateMutator>, actionsConfig: TStateMutator);
|
|
120
120
|
protected initialize: () => Promise<void>;
|
|
121
121
|
/**
|
|
122
122
|
* set the state and update all the subscribers
|
|
123
123
|
* @param {StateSetter<TState>} setter - The setter function or the value to set
|
|
124
124
|
* */
|
|
125
|
-
protected setState: ({ state, forceUpdate
|
|
125
|
+
protected setState: ({ state: newRootState, forceUpdate }: {
|
|
126
126
|
state: TState;
|
|
127
127
|
forceUpdate: boolean;
|
|
128
128
|
}) => void;
|
|
@@ -159,28 +159,28 @@ export declare class GlobalStore<TState, TMetadata = null, TStateSetter extends
|
|
|
159
159
|
* this parameter object allows to update the state, get the state, update the metadata, get the metadata
|
|
160
160
|
* @returns {StateConfigCallbackParam<TState, TMetadata>} - The parameters object
|
|
161
161
|
* */
|
|
162
|
-
protected getConfigCallbackParam: () => StateConfigCallbackParam<TState, TMetadata,
|
|
163
|
-
protected updateSubscription: ({ subscriptionId, callback, selector, config, stateWrapper
|
|
162
|
+
protected getConfigCallbackParam: () => StateConfigCallbackParam<TState, TMetadata, TStateMutator>;
|
|
163
|
+
protected updateSubscription: ({ subscriptionId, callback, selector, config, stateWrapper, }: Partial<Omit<SubscriberParameters, "currentState"> & {
|
|
164
164
|
stateWrapper: {
|
|
165
165
|
state: unknown;
|
|
166
166
|
};
|
|
167
|
-
}) => SubscriberParameters;
|
|
167
|
+
}>) => SubscriberParameters;
|
|
168
168
|
protected executeOnSubscribed: () => void;
|
|
169
169
|
/**
|
|
170
170
|
* Returns a custom hook that allows to handle a global state
|
|
171
|
-
* @returns {[TState,
|
|
171
|
+
* @returns {[TState, TStateMutator, TMetadata]} - The state, the state setter or the actions map, the metadata
|
|
172
172
|
* */
|
|
173
|
-
getHook: () => <State = TState>(selector?: SelectorCallback<TState, State>, config?: UseHookConfig<State>) => [state: State extends null ? TState : State, setter: keyof
|
|
173
|
+
getHook: () => <State = TState>(selector?: SelectorCallback<TState, State>, config?: UseHookConfig<State>) => [state: State extends null ? TState : State, setter: keyof TStateMutator extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TStateMutator>, metadata: TMetadata];
|
|
174
174
|
/**
|
|
175
175
|
* Returns an array with the a function to get the state, the state setter or the actions map, and a function to get the metadata
|
|
176
|
-
* @returns {[() => TState,
|
|
176
|
+
* @returns {[() => TState, TStateMutator, () => TMetadata]} - The state getter, the state setter or the actions map, the metadata getter
|
|
177
177
|
* */
|
|
178
|
-
getHookDecoupled: () => [StateGetter<TState>, keyof
|
|
178
|
+
getHookDecoupled: () => [StateGetter<TState>, keyof TStateMutator extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TStateMutator>, MetadataGetter<TMetadata>];
|
|
179
179
|
/**
|
|
180
180
|
* Returns the state setter or the actions map
|
|
181
|
-
* @returns {
|
|
181
|
+
* @returns {TStateMutator} - The state setter or the actions map
|
|
182
182
|
* */
|
|
183
|
-
protected getStateOrchestrator: () => keyof
|
|
183
|
+
protected getStateOrchestrator: () => keyof TStateMutator extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TStateMutator>;
|
|
184
184
|
/**
|
|
185
185
|
* Calculate whenever or not we should compute the callback parameters on the state change
|
|
186
186
|
* @returns {boolean} - True if we should compute the callback parameters on the state change
|
|
@@ -195,7 +195,7 @@ export declare class GlobalStore<TState, TMetadata = null, TStateSetter extends
|
|
|
195
195
|
protected setStateWrapper: StateSetter<TState>;
|
|
196
196
|
/**
|
|
197
197
|
* This creates a map of actions that can be used to modify or interact with the state
|
|
198
|
-
* @returns {ActionCollectionResult<TState, TMetadata,
|
|
198
|
+
* @returns {ActionCollectionResult<TState, TMetadata, TStateMutator>} - The actions map result of the configuration object passed to the constructor
|
|
199
199
|
* */
|
|
200
|
-
protected getStoreActionsMap: () => ActionCollectionResult<TState, TMetadata,
|
|
200
|
+
protected getStoreActionsMap: () => ActionCollectionResult<TState, TMetadata, TStateMutator>;
|
|
201
201
|
}
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import { ActionCollectionConfig, StateSetter, ActionCollectionResult, UseHookConfig, AvoidNever, UnsubscribeCallback, StateHook, StateGetter, createStateConfig, CustomGlobalHookBuilderParams, CustomGlobalHookParams, SelectorCallback, SubscribeToEmitter } from './GlobalStore.types';
|
|
2
2
|
/**
|
|
3
3
|
* Creates a global state with the given state and config.
|
|
4
|
-
* @returns {} [HOOK,
|
|
4
|
+
* @returns {} [HOOK, DECOUPLED_RETRIEVER, DECOUPLED_MUTATOR] this is an array with the hook, the decoupled getState function and the decoupled setter of the state
|
|
5
5
|
*/
|
|
6
|
-
export declare const createGlobalStateWithDecoupledFuncs: <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, TMetadata> = null>(state: TState, { actions, ...config }?: createStateConfig<TState, TMetadata, TActions>) => [StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>, TMetadata>, StateGetter<TState>, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>];
|
|
6
|
+
export declare const createGlobalStateWithDecoupledFuncs: <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, TMetadata> = null>(state: TState, { actions, ...config }?: createStateConfig<TState, TMetadata, TActions>) => [state: StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>, TMetadata>, stateRetriever: StateGetter<TState>, stateMutator: keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>];
|
|
7
7
|
/**
|
|
8
8
|
* Creates a global hook that can be used to access the state and actions across the application
|
|
9
9
|
* @returns {} - () => [TState, Setter, TMetadata] the hook that can be used to access the state and the setter of the state
|
|
10
10
|
*/
|
|
11
|
-
export declare const createGlobalState: <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, TMetadata> = null>(state: TState, config?: createStateConfig<TState, TMetadata, TActions>) => StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>, TMetadata
|
|
11
|
+
export declare const createGlobalState: <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, TMetadata> = null>(state: TState, config?: createStateConfig<TState, TMetadata, TActions>) => StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>, TMetadata> & {
|
|
12
|
+
stateControls: () => [stateRetriever: StateGetter<TState>, stateMutator: keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>];
|
|
13
|
+
};
|
|
12
14
|
/**
|
|
13
15
|
* @description
|
|
14
16
|
* Use this function to create a custom global store.
|
|
15
17
|
* You can use this function to create a store with async storage.
|
|
16
18
|
*/
|
|
17
|
-
export declare const createCustomGlobalStateWithDecoupledFuncs: <TInheritMetadata = null, TCustomConfig = null>({ onInitialize, onChange, }: CustomGlobalHookBuilderParams<TInheritMetadata, TCustomConfig>) => <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>> = null>(state: TState, { config: customConfig, onInit, onStateChanged, ...parameters }?: CustomGlobalHookParams<TCustomConfig, TState, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>, TActions>) => [StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>, TActions>, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>>, StateGetter<TState>, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>, TActions>];
|
|
19
|
+
export declare const createCustomGlobalStateWithDecoupledFuncs: <TInheritMetadata = null, TCustomConfig = null>({ onInitialize, onChange, }: CustomGlobalHookBuilderParams<TInheritMetadata, TCustomConfig>) => <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>> = null>(state: TState, { config: customConfig, onInit, onStateChanged, ...parameters }?: CustomGlobalHookParams<TCustomConfig, TState, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>, TActions>) => [state: StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>, TActions>, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>>, stateRetriever: StateGetter<TState>, stateMutator: keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>, TActions>];
|
|
18
20
|
/**
|
|
19
21
|
* @description
|
|
20
22
|
* Use this function to create a custom global hook which contains a fragment of the state of another hook or a fragment
|
|
21
23
|
*/
|
|
22
|
-
export declare const createDerivate: <TState, TSetter, TMetadata, TDerivate>(useHook: StateHook<TState, TSetter, TMetadata>, selector_: SelectorCallback<TState, TDerivate>, config_?: UseHookConfig<TDerivate>) => <State = TDerivate>(selector?: SelectorCallback<TDerivate, State>, config?: UseHookConfig<State>) => [state: State,
|
|
24
|
+
export declare const createDerivate: <TState, TSetter, TMetadata, TDerivate>(useHook: StateHook<TState, TSetter, TMetadata>, selector_: SelectorCallback<TState, TDerivate>, config_?: UseHookConfig<TDerivate>) => <State = TDerivate>(selector?: SelectorCallback<TDerivate, State>, config?: UseHookConfig<State>) => [state: State, stateMutator: TSetter, metadata: TMetadata];
|
|
23
25
|
/**
|
|
24
26
|
* @description
|
|
25
27
|
* This function allows you to create a derivate emitter
|
|
26
28
|
* With this approach, you can subscribe to changes in a specific fragment or subset of the state.
|
|
27
29
|
*/
|
|
28
|
-
export declare const createDerivateEmitter: <TDerivate,
|
|
30
|
+
export declare const createDerivateEmitter: <TDerivate, TStateRetriever extends StateGetter<unknown>, TState = Exclude<ReturnType<TStateRetriever>, UnsubscribeCallback>>(getter: TStateRetriever, selector: SelectorCallback<TState, TDerivate>) => SubscribeToEmitter<TDerivate>;
|