react-global-state-hooks 15.0.7 → 15.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GlobalStore.d.ts +1 -1
- package/GlobalStore.js +1 -1
- package/bundle.js +1 -1
- package/createContext.d.ts +1 -1
- package/createContext.js +1 -1
- package/createGlobalState.d.ts +1 -1
- package/createGlobalState.js +1 -1
- package/index.d.ts +6 -5
- package/isRecord.js +1 -1
- package/package.json +2 -2
- package/shallowCompare.js +1 -1
- package/throwWrongKeyOnActionCollectionConfig.js +1 -1
- package/tryCatch.d.ts +1 -1
- package/types.d.ts +6 -2
- package/uniqueId.d.ts +1 -1
- package/uniqueId.js +1 -1
package/GlobalStore.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare class GlobalStore<State, Metadata extends BaseMetadata, ActionsCo
|
|
|
16
16
|
trySetStorageItem: (state: State) => void;
|
|
17
17
|
updateStateWithValidation: (state: State) => void;
|
|
18
18
|
protected onStateChanged: ({ state }: StateChanges<State>) => void;
|
|
19
|
-
getStorageItem: () => ItemEnvelope<State> | null;
|
|
19
|
+
getStorageItem: () => ItemEnvelope<State> | ItemEnvelope<Partial<State>> | null;
|
|
20
20
|
setStorageItem: (state: State) => void;
|
|
21
21
|
handleStorageError: (error: unknown) => void;
|
|
22
22
|
}
|
package/GlobalStore.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t,e;t=this,e=(t,e,o,r)=>(()=>{"use strict";var
|
|
1
|
+
var t,e;t=this,e=(t,e,o,r,a)=>(()=>{"use strict";var n={70(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){try{return{result:t(),error:null}}catch(t){return{result:null,error:t}}}},330(e){e.exports=t},413(t){t.exports=e},536(t){t.exports=o},773(t){t.exports=r},955(t){t.exports=a}},i={};function l(t){var e=i[t];if(void 0!==e)return e.exports;var o=i[t]={exports:{}};return n[t](o,o.exports,l),o.exports}var s={};return(()=>{var t=s;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function o(t,o){if(o&&("object"==e(o)||"function"==typeof o))return o;if(void 0!==o)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function r(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(r=function(){return!!t})()}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function n(t,e){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},n(t,e)}var i=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalStore=void 0;var u=i(l(536)),c=i(l(70)),f=i(l(330)),d=i(l(413)),g=i(l(773)),v=i(l(955)),S=function(t){function i(t){var n,l,s,u,S,p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{metadata:{}};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),s=this,S=[t,p],u=a(u=i),(n=o(s,r()?Reflect.construct(u,S||[],a(s).constructor):u.apply(s,S))).localStorage=null,n.isPersistStorageAvailable=function(){var t;return Boolean((null===(t=n.localStorage)||void 0===t?void 0:t.key)&&(null===globalThis||void 0===globalThis?void 0:globalThis.localStorage))},n.onInit=function(){var t=n.localStorage;if(t&&n.isPersistStorageAvailable()){var e=t.versioning,o=(0,c.default)(function(){var o,r,a;if(null===(o=t.adapter)||void 0===o?void 0:o.getItem)return{s:null===(r=t.adapter)||void 0===r?void 0:r.getItem(t.key),v:null!==(a=null==e?void 0:e.version)&&void 0!==a?a:-1};var i=n.getStorageItem();return i&&t.selector&&!(0,v.default)(null==i?void 0:i.s)?Object.assign(Object.assign({},i),{s:Object.assign(Object.assign({},n.getState()),i.s)}):i}),r=o.result,a=o.error;if(a)return n.handleStorageError(a),void n.updateStateWithValidation(n.getState());if(r){var i=r.v===(null==e?void 0:e.version),l=null==e?void 0:e.migrator;if(i||!l||t.adapter)n.updateStateWithValidation(r.s);else{var s=(0,c.default)(function(){return l({legacy:r.s,initial:n.getState()})}),u=s.result,f=s.error;f?(n.handleStorageError(f),n.updateStateWithValidation(n.getState())):n.updateStateWithValidation(u)}}else n.updateStateWithValidation(n.getState())}},n.trySetStorageItem=function(t){var e=n.localStorage;if(e){var o=(0,c.default)(function(){var o,r=null===(o=e.adapter)||void 0===o?void 0:o.setItem;if(!r)return n.setStorageItem(t);r(e.key,t)}),r=o.error;r&&n.handleStorageError(r)}},n.updateStateWithValidation=function(t){var e=n.localStorage;if(e){var o=(0,c.default)(function(){return e.validator({restored:t,initial:n.getState()})}),r=o.result,a=o.error;if(a)return n.handleStorageError(a),void n.trySetStorageItem(n.getState());if(void 0===r)return void 0===t?void n.trySetStorageItem(n.getState()):(n.setState(t),void n.trySetStorageItem(t));n.setState(r),n.trySetStorageItem(r)}},n.onStateChanged=function(t){var e=t.state,o=n.localStorage;if(o&&n.isPersistStorageAvailable()){var r=(0,c.default)(function(){var t,r=null===(t=o.adapter)||void 0===t?void 0:t.setItem;if(r)return r(o.key,e);n.setStorageItem(e)}),a=r.error;a&&n.handleStorageError(a)}},n.getStorageItem=function(){var t=globalThis.localStorage.getItem(n.localStorage.key),o=(0,g.default)(t)?null:(0,f.default)(t);return function(t,o){if(!((0,g.default)(o)||"object"===e(o)&&"s"in o&&"v"in o))throw new Error('[react-native-global-state-hooks] The value of the key "'.concat(t,'" is not a valid storage envelope.'))}(n.localStorage.key,o),o},n.setStorageItem=function(t){var e,o,r,a,i={s:(null===(e=n.localStorage)||void 0===e?void 0:e.selector)?n.localStorage.selector(t):t,v:null!==(a=null===(r=null===(o=n.localStorage)||void 0===o?void 0:o.versioning)||void 0===r?void 0:r.version)&&void 0!==a?a:-1},l=(0,d.default)(i);globalThis.localStorage.setItem(n.localStorage.key,l)},n.handleStorageError=function(t){var e,o;if(null===(e=n.localStorage)||void 0===e?void 0:e.onError)return n.localStorage.onError(t);globalThis.console.error(["[react-global-state-hooks]\n"," localStorage sync error:","[hook]:"," ".concat(n._name),"[Localstorage Key]:"," ".concat(null===(o=n.localStorage)||void 0===o?void 0:o.key),"[Error]:"," ".concat(null!=t?t:"undefined","\n\n"),"Stacktrace:"].join("\n"),t.stack)},n.localStorage=null!==(l=p.localStorage)&&void 0!==l?l:null,n.constructor!==i?o(n):(n.initialize(),n)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n(t,e)}(i,t),l=i,Object.defineProperty(l,"prototype",{writable:!1}),l;var l}(u.default);t.GlobalStore=S,t.default=S})(),s})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("json-storage-formatter/formatFromStore"),require("json-storage-formatter/formatToStore"),require("react-hooks-global-states/GlobalStore"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isPrimitive")):"function"==typeof define&&define.amd?define(["json-storage-formatter/formatFromStore","json-storage-formatter/formatToStore","react-hooks-global-states/GlobalStore","json-storage-formatter/isNil","json-storage-formatter/isPrimitive"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("json-storage-formatter/formatFromStore"),require("json-storage-formatter/formatToStore"),require("react-hooks-global-states/GlobalStore"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isPrimitive")):t["react-global-state-hooks"]=e(t["json-storage-formatter/formatFromStore"],t["json-storage-formatter/formatToStore"],t["react-hooks-global-states/GlobalStore"],t["json-storage-formatter/isNil"],t["json-storage-formatter/isPrimitive"]);
|
package/bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,r;e=this,r=(e,r,t,o,n,a,
|
|
1
|
+
var e,r;e=this,r=(e,r,t,o,n,a,l)=>(()=>{"use strict";var i={70(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){try{return{result:e(),error:null}}catch(e){return{result:null,error:e}}}},78(r){r.exports=e},361(e){e.exports=r},487(e){e.exports=t},623(e){e.exports=o},670(e){e.exports=n},673(e){e.exports=a},778(e){e.exports=l}},u={};function s(e){var r=u[e];if(void 0!==r)return r.exports;var t=u[e]={exports:{}};return i[e](t,t.exports,s),t.exports}var c={};return(()=>{var e=c,r=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.createGlobalState=e.GlobalStore=e.createContext=e.tryCatch=e.isRecord=e.throwWrongKeyOnActionCollectionConfig=e.uniqueId=e.shallowCompare=void 0;var t=s(673);Object.defineProperty(e,"shallowCompare",{enumerable:!0,get:function(){return t.shallowCompare}});var o=s(78);Object.defineProperty(e,"uniqueId",{enumerable:!0,get:function(){return o.uniqueId}});var n=s(361);Object.defineProperty(e,"throwWrongKeyOnActionCollectionConfig",{enumerable:!0,get:function(){return n.throwWrongKeyOnActionCollectionConfig}});var a=s(487);Object.defineProperty(e,"isRecord",{enumerable:!0,get:function(){return a.isRecord}});var l=s(70);Object.defineProperty(e,"tryCatch",{enumerable:!0,get:function(){return r(l).default}});var i=s(623);Object.defineProperty(e,"createContext",{enumerable:!0,get:function(){return i.createContext}});var u=s(778);Object.defineProperty(e,"GlobalStore",{enumerable:!0,get:function(){return r(u).default}});var f=s(670);Object.defineProperty(e,"createGlobalState",{enumerable:!0,get:function(){return f.createGlobalState}})})(),c})(),"object"==typeof exports&&"object"==typeof module?module.exports=r(require("./uniqueId.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./isRecord.js"),require("./createContext.js"),require("./createGlobalState.js"),require("./shallowCompare.js"),require("./GlobalStore.js")):"function"==typeof define&&define.amd?define(["./uniqueId.js","./throwWrongKeyOnActionCollectionConfig.js","./isRecord.js","./createContext.js","./createGlobalState.js","./shallowCompare.js","./GlobalStore.js"],r):"object"==typeof exports?exports["react-global-state-hooks"]=r(require("./uniqueId.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./isRecord.js"),require("./createContext.js"),require("./createGlobalState.js"),require("./shallowCompare.js"),require("./GlobalStore.js")):e["react-global-state-hooks"]=r(e["./uniqueId.js"],e["./throwWrongKeyOnActionCollectionConfig.js"],e["./isRecord.js"],e["./createContext.js"],e["./createGlobalState.js"],e["./shallowCompare.js"],e["./GlobalStore.js"]);
|
package/createContext.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type ContextProvider, type ContextHook, type InferContextApi, createContext, default, } from 'react-hooks-global-states/createContext';
|
|
1
|
+
export { type ContextProvider, type ContextHook, type InferContextApi, type ContextActionCollectionConfig, type ContextActionCollectionResult, type ContextStoreTools, type ContextStoreToolsExtensions, type ContextProviderExtensions, type ContextPublicApi, type ReadonlyContextPublicApi, type ReadonlyContextHook, type GlobalStoreContextCallbacks, type GlobalStoreCallbacks, type CreateContext, createContext, default, } from 'react-hooks-global-states/createContext';
|
package/createContext.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e;e=e=>(()=>{"use strict";var t={407
|
|
1
|
+
var e;e=e=>(()=>{"use strict";var t={407(t){t.exports=e}},o={};function r(e){var a=o[e];if(void 0!==a)return a.exports;var s=o[e]={exports:{}};return t[e](s,s.exports,r),s.exports}var a={};return(()=>{var e=a;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.createContext=void 0;var t=r(407);Object.defineProperty(e,"createContext",{enumerable:!0,get:function(){return t.createContext}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return(e=t,e&&e.__esModule?e:{default:e}).default;var e}})})(),a})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react-hooks-global-states/createContext")):"function"==typeof define&&define.amd?define(["react-hooks-global-states/createContext"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("react-hooks-global-states/createContext")):this["react-global-state-hooks"]=e(this["react-hooks-global-states/createContext"]);
|
package/createGlobalState.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export type { InferActionsType, InferStateApi, AnyActions, } from 'react-hooks-g
|
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
import type { StateHook, BaseMetadata, ActionCollectionConfig, ActionCollectionResult, GlobalStoreCallbacks, AnyActions } from 'react-hooks-global-states';
|
|
4
4
|
import type { LocalStorageConfig } from './types';
|
|
5
|
-
interface CreateGlobalState {
|
|
5
|
+
export interface CreateGlobalState {
|
|
6
6
|
/**
|
|
7
7
|
* Creates a global state hook.
|
|
8
8
|
* @param state initial state value
|
package/createGlobalState.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e;e=e=>(()=>{"use strict";var t={778
|
|
1
|
+
var e;e=e=>(()=>{"use strict";var t={778(t){t.exports=e},840(e,t,o){function r(e,t,o){if(a())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var l=new(e.bind.apply(e,r));return o&&n(l,o.prototype),l}function n(e,t){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},n(e,t)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}Object.defineProperty(t,"__esModule",{value:!0}),t.createGlobalState=void 0;var l,u=(l=o(778))&&l.__esModule?l:{default:l};t.createGlobalState=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return r(u.default,t).use},t.default=t.createGlobalState}},o={};return function e(r){var n=o[r];if(void 0!==n)return n.exports;var a=o[r]={exports:{}};return t[r](a,a.exports,e),a.exports}(840)})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./GlobalStore.js")):"function"==typeof define&&define.amd?define(["./GlobalStore.js"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("./GlobalStore.js")):this["react-global-state-hooks"]=e(this["./GlobalStore.js"]);
|
package/index.d.ts
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
* By handling the same structure as the original library,
|
|
3
3
|
* We can add the specific overrides for web while keeping the modularity of the library.
|
|
4
4
|
*/
|
|
5
|
-
export type { StateApi, ObservableFragment, MetadataSetter, StateChanges, StoreTools, ActionCollectionResult, GlobalStoreCallbacks, UseHookOptions, UnsubscribeCallback, SubscribeCallbackConfig, SubscribeCallback, BaseMetadata, MetadataGetter, SelectorCallback, SubscriberParameters, SubscriptionCallback, StateHook, ActionCollectionConfig, } from './types';
|
|
5
|
+
export type { AnyFunction, ReadonlyHook, SelectHook, StateApi, ReadonlyStateApi, ObservableFragment, MetadataSetter, StateChanges, StoreTools, ActionCollectionResult, GlobalStoreCallbacks, UseHookOptions, UnsubscribeCallback, SubscribeCallbackConfig, SubscribeCallback, SubscribeToState, BaseMetadata, MetadataGetter, SelectorCallback, SubscriberParameters, SubscriptionCallback, StateHook, ActionCollectionConfig, } from './types';
|
|
6
6
|
export { shallowCompare } from './shallowCompare';
|
|
7
|
-
export { uniqueId, type BrandedId } from './uniqueId';
|
|
7
|
+
export { uniqueId, type BrandedId, type UniqueId } from './uniqueId';
|
|
8
8
|
export { throwWrongKeyOnActionCollectionConfig } from './throwWrongKeyOnActionCollectionConfig';
|
|
9
9
|
export { isRecord } from './isRecord';
|
|
10
|
-
export {
|
|
11
|
-
export { type
|
|
10
|
+
export { default as tryCatch, type TryCatchResult } from './tryCatch';
|
|
11
|
+
export { type ContextProvider, type ContextHook, type InferContextApi, type ContextActionCollectionConfig, type ContextActionCollectionResult, type ContextStoreTools, type ContextStoreToolsExtensions, type ContextProviderExtensions, type ContextPublicApi, type ReadonlyContextPublicApi, type ReadonlyContextHook, type GlobalStoreContextCallbacks, type GlobalStoreCallbacks as ContextGlobalStoreCallbacks, type CreateContext, createContext, } from './createContext';
|
|
12
|
+
export { type LocalStorageConfig, type ItemEnvelope } from './types';
|
|
12
13
|
export { default as GlobalStore } from './GlobalStore';
|
|
13
|
-
export { createGlobalState, type InferActionsType, type InferStateApi, AnyActions, } from './createGlobalState';
|
|
14
|
+
export { createGlobalState, type CreateGlobalState, type InferActionsType, type InferStateApi, AnyActions, } from './createGlobalState';
|
package/isRecord.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e;e=e=>(()=>{"use strict";var t={93
|
|
1
|
+
var e;e=e=>(()=>{"use strict";var t={93(t){t.exports=e}},o={};function r(e){var s=o[e];if(void 0!==s)return s.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,r),a.exports}var s={};return(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.isRecord=void 0;var t=r(93);Object.defineProperty(e,"isRecord",{enumerable:!0,get:function(){return t.isRecord}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return(e=t,e&&e.__esModule?e:{default:e}).default;var e}})})(),s})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react-hooks-global-states/isRecord")):"function"==typeof define&&define.amd?define(["react-hooks-global-states/isRecord"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("react-hooks-global-states/isRecord")):this["react-global-state-hooks"]=e(this["react-hooks-global-states/isRecord"]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-global-state-hooks",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.9",
|
|
4
4
|
"description": "This is a package to easily handling global-state across your react components",
|
|
5
5
|
"main": "./bundle.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
},
|
|
146
146
|
"dependencies": {
|
|
147
147
|
"json-storage-formatter": "^3.0.2",
|
|
148
|
-
"react-hooks-global-states": "^15.0.
|
|
148
|
+
"react-hooks-global-states": "^15.0.9"
|
|
149
149
|
},
|
|
150
150
|
"peerDependencies": {
|
|
151
151
|
"json-storage-formatter": "^3.0.2",
|
package/shallowCompare.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e;e=e=>(()=>{"use strict";var o={859
|
|
1
|
+
var e;e=e=>(()=>{"use strict";var o={859(o){o.exports=e}},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var s=t[e]={exports:{}};return o[e](s,s.exports,r),s.exports}var a={};return(()=>{var e=a;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.shallowCompare=void 0;var o=r(859);Object.defineProperty(e,"shallowCompare",{enumerable:!0,get:function(){return o.shallowCompare}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return(e=o,e&&e.__esModule?e:{default:e}).default;var e}})})(),a})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react-hooks-global-states/shallowCompare")):"function"==typeof define&&define.amd?define(["react-hooks-global-states/shallowCompare"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("react-hooks-global-states/shallowCompare")):this["react-global-state-hooks"]=e(this["react-hooks-global-states/shallowCompare"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e;e=e=>(()=>{"use strict";var o={637
|
|
1
|
+
var e;e=e=>(()=>{"use strict";var o={637(o){o.exports=e}},t={};function r(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={exports:{}};return o[e](i,i.exports,r),i.exports}var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.throwWrongKeyOnActionCollectionConfig=void 0;var o=r(637);Object.defineProperty(e,"throwWrongKeyOnActionCollectionConfig",{enumerable:!0,get:function(){return o.throwWrongKeyOnActionCollectionConfig}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return(e=o,e&&e.__esModule?e:{default:e}).default;var e}})})(),n})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react-hooks-global-states/throwWrongKeyOnActionCollectionConfig")):"function"==typeof define&&define.amd?define(["react-hooks-global-states/throwWrongKeyOnActionCollectionConfig"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("react-hooks-global-states/throwWrongKeyOnActionCollectionConfig")):this["react-global-state-hooks"]=e(this["react-hooks-global-states/throwWrongKeyOnActionCollectionConfig"]);
|
package/tryCatch.d.ts
CHANGED
package/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { StateApi, ObservableFragment, MetadataSetter, StateChanges, StoreTools, ActionCollectionResult, GlobalStoreCallbacks, UseHookOptions, UnsubscribeCallback, SubscribeCallbackConfig, SubscribeCallback, BaseMetadata, MetadataGetter, SelectorCallback, SubscriberParameters, SubscriptionCallback, StateHook, ActionCollectionConfig, } from 'react-hooks-global-states/types';
|
|
1
|
+
export type { AnyFunction, ReadonlyHook, SelectHook, StateApi, ReadonlyStateApi, ObservableFragment, MetadataSetter, StateChanges, StoreTools, ActionCollectionResult, GlobalStoreCallbacks, UseHookOptions, UnsubscribeCallback, SubscribeCallbackConfig, SubscribeCallback, SubscribeToState, BaseMetadata, MetadataGetter, SelectorCallback, SubscriberParameters, SubscriptionCallback, StateHook, ActionCollectionConfig, } from 'react-hooks-global-states/types';
|
|
2
2
|
/**
|
|
3
3
|
* @description Configuration for persisting state in localStorage
|
|
4
4
|
*/
|
|
@@ -64,7 +64,7 @@ export type LocalStorageConfig<State> = {
|
|
|
64
64
|
* @description High level overrides of the localstorage synchronization
|
|
65
65
|
* Use it if you want to have full control of how the state is stored/retrieved.
|
|
66
66
|
*
|
|
67
|
-
* This disables versioning, migration
|
|
67
|
+
* This disables versioning, migration, and selector
|
|
68
68
|
*/
|
|
69
69
|
adapter?: {
|
|
70
70
|
/**
|
|
@@ -77,6 +77,10 @@ export type LocalStorageConfig<State> = {
|
|
|
77
77
|
*/
|
|
78
78
|
getItem: (key: string) => State;
|
|
79
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* @description Optional selector to extract a subset of the state for storage.
|
|
82
|
+
*/
|
|
83
|
+
selector?: <T extends Partial<State>>(state: State) => T;
|
|
80
84
|
};
|
|
81
85
|
/**
|
|
82
86
|
* @description Structure of the item stored in localStorage
|
package/uniqueId.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { uniqueId, default, type BrandedId } from 'react-hooks-global-states/uniqueId';
|
|
1
|
+
export { uniqueId, default, type BrandedId, type UniqueId } from 'react-hooks-global-states/uniqueId';
|
package/uniqueId.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e;e=e=>(()=>{"use strict";var t={366
|
|
1
|
+
var e;e=e=>(()=>{"use strict";var t={366(t){t.exports=e}},o={};function r(e){var u=o[e];if(void 0!==u)return u.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,r),a.exports}var u={};return(()=>{var e=u;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.uniqueId=void 0;var t=r(366);Object.defineProperty(e,"uniqueId",{enumerable:!0,get:function(){return t.uniqueId}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return(e=t,e&&e.__esModule?e:{default:e}).default;var e}})})(),u})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react-hooks-global-states/uniqueId")):"function"==typeof define&&define.amd?define(["react-hooks-global-states/uniqueId"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("react-hooks-global-states/uniqueId")):this["react-global-state-hooks"]=e(this["react-hooks-global-states/uniqueId"]);
|