redux-astroglide 0.1.3 → 0.1.5
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/dist/plugins/index.es.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"check-prop-types";var e=function(t){return{constructor:function(t,e){this.value=e,this.callback=t},update:function(t,e){var n=e.draft;return e.plugin.callback(t,{draft:n})}}};function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function r(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,l(r.key),r)}}function i(t,e,n){return(e=l(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},u(t,e)}function a(t,e,n){return a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&u(o,n.prototype),o},a.apply(null,arguments)}function c(t){if(null==t)throw new TypeError("Cannot destructure "+t)}function l(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var f=function(e,n,o){var u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return t(i({},o,e),r(r({},u),{},i({},o,n)),o,void 0)},p=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=f(t,e,n);if(o){var i="Astroglide: prop ".concat(n," with value ").concat(e," is not of the specified type");if(r)throw Error(i);return console.warn(i),o}return!1},s=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preventUpdate:!1}).preventUpdate;return{constructor:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.value=e,this.propType=t,this.config=r(r({},this.config),n)},getInitialValue:function(t,e){var n=e.key,r=e.plugin.propType;return p(r,t,n),t},update:function(e,n){var r=n.key,o=n.plugin,i=o.propType;return p(i,e,r,void 0!==o.config.preventUpdate?o.config.preventUpdate:t),e},config:{preventUpdate:!1}}},v="astroglide-persist",g=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:localStorage).getItem(v);return JSON.parse(t||"{}")},y=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:localStorage,o=g(r);e?(o[e]=o[e]||{},o[e][t]=n):o[t]=n;try{r.setItem(v,JSON.stringify(o))}catch(t){console.error(t)}},h=function(t,e){var n,r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:localStorage,i=g(o);e&&(i=null===(r=i)||void 0===r?void 0:r[e]);
|
|
1
|
+
import t from"check-prop-types";var e=function(t){return{constructor:function(t,e){this.value=e,this.callback=t},update:function(t,e){var n=e.draft;return e.plugin.callback(t,{draft:n})}}};function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function r(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,l(r.key),r)}}function i(t,e,n){return(e=l(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},u(t,e)}function a(t,e,n){return a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&u(o,n.prototype),o},a.apply(null,arguments)}function c(t){if(null==t)throw new TypeError("Cannot destructure "+t)}function l(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var f=function(e,n,o){var u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return t(i({},o,e),r(r({},u),{},i({},o,n)),o,void 0)},p=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=f(t,e,n);if(o){var i="Astroglide: prop ".concat(n," with value ").concat(e," is not of the specified type");if(r)throw Error(i);return console.warn(i),o}return!1},s=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preventUpdate:!1}).preventUpdate;return{constructor:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.value=e,this.propType=t,this.config=r(r({},this.config),n)},getInitialValue:function(t,e){var n=e.key,r=e.plugin.propType;return p(r,t,n),t},update:function(e,n){var r=n.key,o=n.plugin,i=o.propType;return p(i,e,r,void 0!==o.config.preventUpdate?o.config.preventUpdate:t),e},config:{preventUpdate:!1}}},v="astroglide-persist",g=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:localStorage).getItem(v);return JSON.parse(t||"{}")},y=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:localStorage,o=g(r);e?(o[e]=o[e]||{},o[e][t]=n):o[t]=n;try{r.setItem(v,JSON.stringify(o))}catch(t){console.error(t)}},h=function(t,e){var n,r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:localStorage,i=g(o);e&&(i=null===(r=i)||void 0===r?void 0:r[e]);return null===(n=i)||void 0===n?void 0:n[t]},d=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).storageType,e=void 0===t?localStorage:t;return{setup:function(t,n){return{namespace:n.sliceConfig.name,storageType:e}},getInitialValue:function(t,e){var n=e.sliceConfig,r=e.key,o=h(r,n.name);return void 0!==o?o:t},update:function(t,n){var r=n.key,o=n.sliceConfig;return y(r,o.name,t,void 0!==this.config.storageType?this.config.storageType:e),t}}},b=function(t){var e=t.constructor,n=t.setup,i=t.getInitialValue,u=t.update,a=t.config,l=void 0===a?{}:a;return function(){function t(r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.value=r,this.setup=n||this.setup,this.getInitialValue=i||this.getInitialValue,this.update=u||this.update,this.config=l;for(var o=arguments.length,a=new Array(o>1?o-1:0),c=1;c<o;c++)a[c-1]=arguments[c];null==e||e.call.apply(e,[this,r].concat(a))}var a,f,p;return a=t,f=[{key:"getValue",value:function(){return this.value}},{key:"setValue",value:function(t){this.value=t}},{key:"setConfig",value:function(t){this.config=r(r({},this.config),t)}},{key:"setup",value:function(t,e){return c(e),{plugin:t}}},{key:"getInitialValue",value:function(t,e){return c(e),t}},{key:"update",value:function(t,e){return c(e),t}}],f&&o(a.prototype,f),p&&o(a,p),Object.defineProperty(a,"prototype",{writable:!1}),t}()},O=function(t){var e=b(t);return w.push(e),function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return a(e,n)}},m=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.map(O)},w=[];export{O as addPlugin,m as addPlugins,d as persist,w as plugins,e as set,s as type};
|
package/dist/plugins/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("check-prop-types"));function
|
|
1
|
+
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("check-prop-types"));function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function r(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,l(r.key),r)}}function i(t,e,n){return(e=l(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},u(t,e)}function a(t,e,n){return a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&u(o,n.prototype),o},a.apply(null,arguments)}function c(t){if(null==t)throw new TypeError("Cannot destructure "+t)}function l(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var f=function(t,n,o){var u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return e.default(i({},o,t),r(r({},u),{},i({},o,n)),o,void 0)},p=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=f(t,e,n);if(o){var i="Astroglide: prop ".concat(n," with value ").concat(e," is not of the specified type");if(r)throw Error(i);return console.warn(i),o}return!1},s="astroglide-persist",v=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:localStorage).getItem(s);return JSON.parse(t||"{}")},g=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:localStorage,o=v(r);e?(o[e]=o[e]||{},o[e][t]=n):o[t]=n;try{r.setItem(s,JSON.stringify(o))}catch(t){console.error(t)}},y=function(t,e){var n,r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:localStorage,i=v(o);e&&(i=null===(r=i)||void 0===r?void 0:r[e]);return null===(n=i)||void 0===n?void 0:n[t]},d=function(t){var e=t.constructor,n=t.setup,i=t.getInitialValue,u=t.update,a=t.config,l=void 0===a?{}:a;return function(){function t(r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.value=r,this.setup=n||this.setup,this.getInitialValue=i||this.getInitialValue,this.update=u||this.update,this.config=l;for(var o=arguments.length,a=new Array(o>1?o-1:0),c=1;c<o;c++)a[c-1]=arguments[c];null==e||e.call.apply(e,[this,r].concat(a))}var a,f,p;return a=t,f=[{key:"getValue",value:function(){return this.value}},{key:"setValue",value:function(t){this.value=t}},{key:"setConfig",value:function(t){this.config=r(r({},this.config),t)}},{key:"setup",value:function(t,e){return c(e),{plugin:t}}},{key:"getInitialValue",value:function(t,e){return c(e),t}},{key:"update",value:function(t,e){return c(e),t}}],f&&o(a.prototype,f),p&&o(a,p),Object.defineProperty(a,"prototype",{writable:!1}),t}()},h=function(t){var e=d(t);return b.push(e),function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return a(e,n)}},b=[];exports.addPlugin=h,exports.addPlugins=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.map(h)},exports.persist=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).storageType,e=void 0===t?localStorage:t;return{setup:function(t,n){return{namespace:n.sliceConfig.name,storageType:e}},getInitialValue:function(t,e){var n=e.sliceConfig,r=e.key,o=y(r,n.name);return void 0!==o?o:t},update:function(t,n){var r=n.key,o=n.sliceConfig;return g(r,o.name,t,void 0!==this.config.storageType?this.config.storageType:e),t}}},exports.plugins=b,exports.set=function(t){return{constructor:function(t,e){this.value=e,this.callback=t},update:function(t,e){var n=e.draft;return e.plugin.callback(t,{draft:n})}}},exports.type=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preventUpdate:!1}).preventUpdate;return{constructor:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.value=e,this.propType=t,this.config=r(r({},this.config),n)},getInitialValue:function(t,e){var n=e.key,r=e.plugin.propType;return p(r,t,n),t},update:function(e,n){var r=n.key,o=n.plugin,i=o.propType;return p(i,e,r,void 0!==o.config.preventUpdate?o.config.preventUpdate:t),e},config:{preventUpdate:!1}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["redux-astroglide/plugins"]={})}(this,(function(e){"use strict";function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function n(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?t(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function o(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function u(e,t,n){return u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o},u.apply(null,arguments)}function a(e){if(null==e)throw new TypeError("Cannot destructure "+e)}function c(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var f,l,p={exports:{}};function s(e,t,n,r,o){if("production"!==process.env.NODE_ENV){const p=l?f:(l=1,f="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");var i=r||"React class";for(var u in e)if(e.hasOwnProperty(u)){var a;if("function"!=typeof e[u])return i+": "+n+" type `"+u+"` is invalid; it must be a function, usually from React.PropTypes.";try{a=e[u](t,u,r,n,null,p)}catch(e){a=e}if(a&&!(a instanceof Error))return i+": type specification of "+n+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof a+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).";if(a instanceof Error){var c=o&&o()||"";return"Failed "+n+" type: "+a.message+c}}}}p.exports=s,p.exports.assertPropTypes=function(){if("production"!==process.env.NODE_ENV){var e=s.apply(null,arguments);if(e)throw new Error(e)}};var v=function(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return p.exports(o({},r,e),n(n({},i),{},o({},r,t)),r,void 0)},y=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=v(e,t,n);if(o){var i="Astroglide: prop ".concat(n," with value ").concat(t," is not of the specified type");if(r)throw Error(i);return console.warn(i),o}return!1},g="astroglide-persist",d=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:localStorage).getItem(g);return JSON.parse(e||"{}")},h=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:localStorage,o=d(r);t?(o[t]=o[t]||{},o[t][e]=n):o[e]=n;try{r.setItem(g,JSON.stringify(o))}catch(e){console.error(e)}},b=function(e,t){var n,r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:localStorage,i=d(o);t&&(i=null===(r=i)||void 0===r?void 0:r[t]);
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["redux-astroglide/plugins"]={})}(this,(function(e){"use strict";function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function n(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?t(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function o(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function u(e,t,n){return u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o},u.apply(null,arguments)}function a(e){if(null==e)throw new TypeError("Cannot destructure "+e)}function c(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var f,l,p={exports:{}};function s(e,t,n,r,o){if("production"!==process.env.NODE_ENV){const p=l?f:(l=1,f="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");var i=r||"React class";for(var u in e)if(e.hasOwnProperty(u)){var a;if("function"!=typeof e[u])return i+": "+n+" type `"+u+"` is invalid; it must be a function, usually from React.PropTypes.";try{a=e[u](t,u,r,n,null,p)}catch(e){a=e}if(a&&!(a instanceof Error))return i+": type specification of "+n+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof a+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).";if(a instanceof Error){var c=o&&o()||"";return"Failed "+n+" type: "+a.message+c}}}}p.exports=s,p.exports.assertPropTypes=function(){if("production"!==process.env.NODE_ENV){var e=s.apply(null,arguments);if(e)throw new Error(e)}};var v=function(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return p.exports(o({},r,e),n(n({},i),{},o({},r,t)),r,void 0)},y=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=v(e,t,n);if(o){var i="Astroglide: prop ".concat(n," with value ").concat(t," is not of the specified type");if(r)throw Error(i);return console.warn(i),o}return!1},g="astroglide-persist",d=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:localStorage).getItem(g);return JSON.parse(e||"{}")},h=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:localStorage,o=d(r);t?(o[t]=o[t]||{},o[t][e]=n):o[e]=n;try{r.setItem(g,JSON.stringify(o))}catch(e){console.error(e)}},b=function(e,t){var n,r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:localStorage,i=d(o);t&&(i=null===(r=i)||void 0===r?void 0:r[t]);return null===(n=i)||void 0===n?void 0:n[e]},O=function(e){var t=e.constructor,o=e.setup,i=e.getInitialValue,u=e.update,c=e.config,f=void 0===c?{}:c;return function(){function e(n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.value=n,this.setup=o||this.setup,this.getInitialValue=i||this.getInitialValue,this.update=u||this.update,this.config=f;for(var r=arguments.length,a=new Array(r>1?r-1:0),c=1;c<r;c++)a[c-1]=arguments[c];null==t||t.call.apply(t,[this,n].concat(a))}var c,l,p;return c=e,l=[{key:"getValue",value:function(){return this.value}},{key:"setValue",value:function(e){this.value=e}},{key:"setConfig",value:function(e){this.config=n(n({},this.config),e)}},{key:"setup",value:function(e,t){return a(t),{plugin:e}}},{key:"getInitialValue",value:function(e,t){return a(t),e}},{key:"update",value:function(e,t){return a(t),e}}],l&&r(c.prototype,l),p&&r(c,p),Object.defineProperty(c,"prototype",{writable:!1}),e}()},m=function(e){var t=O(e);return w.push(t),function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return u(t,n)}},w=[];e.addPlugin=m,e.addPlugins=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.map(m)},e.persist=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).storageType,t=void 0===e?localStorage:e;return{setup:function(e,n){return{namespace:n.sliceConfig.name,storageType:t}},getInitialValue:function(e,t){var n=t.sliceConfig,r=t.key,o=b(r,n.name);return void 0!==o?o:e},update:function(e,n){var r=n.key,o=n.sliceConfig;return h(r,o.name,e,void 0!==this.config.storageType?this.config.storageType:t),e}}},e.plugins=w,e.set=function(e){return{constructor:function(e,t){this.value=t,this.callback=e},update:function(e,t){var n=t.draft;return t.plugin.callback(e,{draft:n})}}},e.type=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preventUpdate:!1}).preventUpdate;return{constructor:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.value=t,this.propType=e,this.config=n(n({},this.config),r)},getInitialValue:function(e,t){var n=t.key,r=t.plugin.propType;return y(r,e,n),e},update:function(t,n){var r=n.key,o=n.plugin,i=o.propType;return y(i,t,r,void 0!==o.config.preventUpdate?o.config.preventUpdate:e),t},config:{preventUpdate:!1}}},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="astroglide-persist",
|
|
1
|
+
var e="astroglide-persist",t=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:localStorage).getItem(e);return JSON.parse(t||"{}")},o=function(o,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:localStorage,a=t(i);n?(a[n]=a[n]||{},a[n][o]=r):a[o]=r;try{i.setItem(e,JSON.stringify(a))}catch(e){console.error(e)}},n=function(e,o){var n,r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:localStorage,a=t(i);o&&(a=null===(r=a)||void 0===r?void 0:r[o]);return null===(n=a)||void 0===n?void 0:n[e]},r=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).storageType,t=void 0===e?localStorage:e;return{setup:function(e,o){return{namespace:o.sliceConfig.name,storageType:t}},getInitialValue:function(e,t){var o=t.sliceConfig,r=t.key,i=n(r,o.name);return void 0!==i?i:e},update:function(e,n){var r=n.key,i=n.sliceConfig;return o(r,i.name,e,void 0!==this.config.storageType?this.config.storageType:t),e}}};export{r as default,t as getPersistedStore,n as getPersistedValue,o as storePersistedValue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="astroglide-persist",t=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:localStorage).getItem(e);return JSON.parse(t||"{}")},o=function(o,r,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="astroglide-persist",t=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:localStorage).getItem(e);return JSON.parse(t||"{}")},o=function(o,r,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:localStorage,a=t(n);r?(a[r]=a[r]||{},a[r][o]=i):a[o]=i;try{n.setItem(e,JSON.stringify(a))}catch(e){console.error(e)}},r=function(e,o){var r,i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:localStorage,a=t(n);o&&(a=null===(i=a)||void 0===i?void 0:i[o]);return null===(r=a)||void 0===r?void 0:r[e]};exports.default=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).storageType,t=void 0===e?localStorage:e;return{setup:function(e,o){return{namespace:o.sliceConfig.name,storageType:t}},getInitialValue:function(e,t){var o=t.sliceConfig,i=t.key,n=r(i,o.name);return void 0!==n?n:e},update:function(e,r){var i=r.key,n=r.sliceConfig;return o(i,n.name,e,void 0!==this.config.storageType?this.config.storageType:t),e}}},exports.getPersistedStore=t,exports.getPersistedValue=r,exports.storePersistedValue=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["redux-astroglide/plugins/persist"]={})}(this,(function(e){"use strict";var t="astroglide-persist",o=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:localStorage).getItem(t);return JSON.parse(e||"{}")},
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["redux-astroglide/plugins/persist"]={})}(this,(function(e){"use strict";var t="astroglide-persist",o=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:localStorage).getItem(t);return JSON.parse(e||"{}")},i=function(e,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:localStorage,s=o(r);i?(s[i]=s[i]||{},s[i][e]=n):s[e]=n;try{r.setItem(t,JSON.stringify(s))}catch(e){console.error(e)}},n=function(e,t){var i,n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:localStorage,s=o(r);t&&(s=null===(n=s)||void 0===n?void 0:n[t]);return null===(i=s)||void 0===i?void 0:i[e]};e.default=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).storageType,t=void 0===e?localStorage:e;return{setup:function(e,o){return{namespace:o.sliceConfig.name,storageType:t}},getInitialValue:function(e,t){var o=t.sliceConfig,i=t.key,r=n(i,o.name);return void 0!==r?r:e},update:function(e,o){var n=o.key,r=o.sliceConfig;return i(n,r.name,e,void 0!==this.config.storageType?this.config.storageType:t),e}}},e.getPersistedStore=o,e.getPersistedValue=n,e.storePersistedValue=i,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redux-astroglide",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Taking the pain out of redux state management",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"boilerplate",
|
|
@@ -91,11 +91,11 @@
|
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"@reduxjs/toolkit": ">=1.6.0",
|
|
94
|
-
"prop-types": "
|
|
95
|
-
"react": "
|
|
96
|
-
"react-dom": "
|
|
97
|
-
"react-redux": "
|
|
98
|
-
"redux": "
|
|
94
|
+
"prop-types": ">=12",
|
|
95
|
+
"react": ">=16",
|
|
96
|
+
"react-dom": ">=16",
|
|
97
|
+
"react-redux": ">=7",
|
|
98
|
+
"redux": ">=3"
|
|
99
99
|
},
|
|
100
100
|
"publishConfig": {
|
|
101
101
|
"access": "public"
|
|
@@ -104,7 +104,6 @@
|
|
|
104
104
|
"dev": "BUILD_ENV=dev npm run build:js -- --watch",
|
|
105
105
|
"build": "rimraf dist && npm run build:types && npm run build:js",
|
|
106
106
|
"build:js": "rollup -c",
|
|
107
|
-
"build:types": "tsc --emitDeclarationOnly"
|
|
108
|
-
"preinstall": "npx only-allow pnpm"
|
|
107
|
+
"build:types": "tsc --emitDeclarationOnly"
|
|
109
108
|
}
|
|
110
109
|
}
|