isomorfeus-redux 4.0.23 → 4.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +27 -0
- data/lib/isomorfeus/core_ext/kernel.rb +1 -1
- data/lib/isomorfeus/execution_environment.rb +17 -10
- data/lib/isomorfeus/{redux_config.rb → redux/config.rb} +0 -0
- data/lib/isomorfeus/redux/imports.rb +17 -0
- data/lib/isomorfeus-redux.rb +7 -4
- data/lib/redux/version.rb +1 -1
- data/node_modules/.package-lock.json +31 -0
- data/node_modules/@babel/runtime/LICENSE +22 -0
- data/node_modules/@babel/runtime/README.md +19 -0
- data/node_modules/@babel/runtime/helpers/AsyncGenerator.js +99 -0
- data/node_modules/@babel/runtime/helpers/AwaitValue.js +6 -0
- data/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js +31 -0
- data/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +12 -0
- data/node_modules/@babel/runtime/helpers/arrayWithHoles.js +6 -0
- data/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +8 -0
- data/node_modules/@babel/runtime/helpers/assertThisInitialized.js +10 -0
- data/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js +57 -0
- data/node_modules/@babel/runtime/helpers/asyncIterator.js +16 -0
- data/node_modules/@babel/runtime/helpers/asyncToGenerator.js +38 -0
- data/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js +8 -0
- data/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js +8 -0
- data/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +23 -0
- data/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +10 -0
- data/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +14 -0
- data/node_modules/@babel/runtime/helpers/classCallCheck.js +8 -0
- data/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +8 -0
- data/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +8 -0
- data/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +10 -0
- data/node_modules/@babel/runtime/helpers/classNameTDZError.js +6 -0
- data/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +11 -0
- data/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +11 -0
- data/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js +9 -0
- data/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js +10 -0
- data/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js +8 -0
- data/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +12 -0
- data/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +10 -0
- data/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js +9 -0
- data/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js +6 -0
- data/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +14 -0
- data/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +14 -0
- data/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +15 -0
- data/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js +9 -0
- data/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js +6 -0
- data/node_modules/@babel/runtime/helpers/construct.js +26 -0
- data/node_modules/@babel/runtime/helpers/createClass.js +18 -0
- data/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js +61 -0
- data/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js +25 -0
- data/node_modules/@babel/runtime/helpers/createSuper.js +25 -0
- data/node_modules/@babel/runtime/helpers/decorate.js +401 -0
- data/node_modules/@babel/runtime/helpers/defaults.js +17 -0
- data/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +25 -0
- data/node_modules/@babel/runtime/helpers/defineProperty.js +17 -0
- data/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js +95 -0
- data/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +3 -0
- data/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js +28 -0
- data/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +9 -0
- data/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +3 -0
- data/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +4 -0
- data/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +7 -0
- data/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js +54 -0
- data/node_modules/@babel/runtime/helpers/esm/asyncIterator.js +13 -0
- data/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +35 -0
- data/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js +4 -0
- data/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js +5 -0
- data/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +20 -0
- data/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +7 -0
- data/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +11 -0
- data/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +5 -0
- data/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +5 -0
- data/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +5 -0
- data/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +7 -0
- data/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js +3 -0
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +6 -0
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +6 -0
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js +5 -0
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js +7 -0
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js +4 -0
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +7 -0
- data/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +7 -0
- data/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js +5 -0
- data/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +3 -0
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +8 -0
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +8 -0
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +9 -0
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js +5 -0
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +3 -0
- data/node_modules/@babel/runtime/helpers/esm/construct.js +18 -0
- data/node_modules/@babel/runtime/helpers/esm/createClass.js +15 -0
- data/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js +57 -0
- data/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js +21 -0
- data/node_modules/@babel/runtime/helpers/esm/createSuper.js +19 -0
- data/node_modules/@babel/runtime/helpers/esm/decorate.js +396 -0
- data/node_modules/@babel/runtime/helpers/esm/defaults.js +14 -0
- data/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +22 -0
- data/node_modules/@babel/runtime/helpers/esm/defineProperty.js +14 -0
- data/node_modules/@babel/runtime/helpers/esm/extends.js +17 -0
- data/node_modules/@babel/runtime/helpers/esm/get.js +20 -0
- data/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +6 -0
- data/node_modules/@babel/runtime/helpers/esm/inherits.js +15 -0
- data/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +6 -0
- data/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js +9 -0
- data/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js +3 -0
- data/node_modules/@babel/runtime/helpers/esm/instanceof.js +7 -0
- data/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js +5 -0
- data/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js +51 -0
- data/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +3 -0
- data/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +12 -0
- data/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +3 -0
- data/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +29 -0
- data/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js +14 -0
- data/node_modules/@babel/runtime/helpers/esm/jsx.js +46 -0
- data/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js +9 -0
- data/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js +5 -0
- data/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +3 -0
- data/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +3 -0
- data/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js +3 -0
- data/node_modules/@babel/runtime/helpers/esm/objectSpread.js +19 -0
- data/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +39 -0
- data/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +19 -0
- data/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +14 -0
- data/node_modules/@babel/runtime/helpers/esm/package.json +3 -0
- data/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +11 -0
- data/node_modules/@babel/runtime/helpers/esm/readOnlyError.js +3 -0
- data/node_modules/@babel/runtime/helpers/esm/set.js +51 -0
- data/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
- data/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js +7 -0
- data/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +7 -0
- data/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js +7 -0
- data/node_modules/@babel/runtime/helpers/esm/superPropBase.js +9 -0
- data/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +11 -0
- data/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js +8 -0
- data/node_modules/@babel/runtime/helpers/esm/tdz.js +3 -0
- data/node_modules/@babel/runtime/helpers/esm/temporalRef.js +5 -0
- data/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js +1 -0
- data/node_modules/@babel/runtime/helpers/esm/toArray.js +7 -0
- data/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +7 -0
- data/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +13 -0
- data/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +6 -0
- data/node_modules/@babel/runtime/helpers/esm/typeof.js +15 -0
- data/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +9 -0
- data/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js +6 -0
- data/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +37 -0
- data/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js +65 -0
- data/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js +3 -0
- data/node_modules/@babel/runtime/helpers/extends.js +21 -0
- data/node_modules/@babel/runtime/helpers/get.js +27 -0
- data/node_modules/@babel/runtime/helpers/getPrototypeOf.js +10 -0
- data/node_modules/@babel/runtime/helpers/inherits.js +19 -0
- data/node_modules/@babel/runtime/helpers/inheritsLoose.js +10 -0
- data/node_modules/@babel/runtime/helpers/initializerDefineProperty.js +12 -0
- data/node_modules/@babel/runtime/helpers/initializerWarningHelper.js +6 -0
- data/node_modules/@babel/runtime/helpers/instanceof.js +10 -0
- data/node_modules/@babel/runtime/helpers/interopRequireDefault.js +8 -0
- data/node_modules/@babel/runtime/helpers/interopRequireWildcard.js +54 -0
- data/node_modules/@babel/runtime/helpers/isNativeFunction.js +6 -0
- data/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js +15 -0
- data/node_modules/@babel/runtime/helpers/iterableToArray.js +6 -0
- data/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +32 -0
- data/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js +17 -0
- data/node_modules/@babel/runtime/helpers/jsx.js +50 -0
- data/node_modules/@babel/runtime/helpers/maybeArrayLike.js +13 -0
- data/node_modules/@babel/runtime/helpers/newArrowCheck.js +8 -0
- data/node_modules/@babel/runtime/helpers/nonIterableRest.js +6 -0
- data/node_modules/@babel/runtime/helpers/nonIterableSpread.js +6 -0
- data/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js +6 -0
- data/node_modules/@babel/runtime/helpers/objectSpread.js +23 -0
- data/node_modules/@babel/runtime/helpers/objectSpread2.js +42 -0
- data/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +23 -0
- data/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +17 -0
- data/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +16 -0
- data/node_modules/@babel/runtime/helpers/readOnlyError.js +6 -0
- data/node_modules/@babel/runtime/helpers/set.js +55 -0
- data/node_modules/@babel/runtime/helpers/setPrototypeOf.js +12 -0
- data/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js +10 -0
- data/node_modules/@babel/runtime/helpers/slicedToArray.js +14 -0
- data/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js +14 -0
- data/node_modules/@babel/runtime/helpers/superPropBase.js +13 -0
- data/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js +14 -0
- data/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js +11 -0
- data/node_modules/@babel/runtime/helpers/tdz.js +6 -0
- data/node_modules/@babel/runtime/helpers/temporalRef.js +10 -0
- data/node_modules/@babel/runtime/helpers/temporalUndefined.js +4 -0
- data/node_modules/@babel/runtime/helpers/toArray.js +14 -0
- data/node_modules/@babel/runtime/helpers/toConsumableArray.js +14 -0
- data/node_modules/@babel/runtime/helpers/toPrimitive.js +17 -0
- data/node_modules/@babel/runtime/helpers/toPropertyKey.js +11 -0
- data/node_modules/@babel/runtime/helpers/typeof.js +22 -0
- data/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +13 -0
- data/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js +10 -0
- data/node_modules/@babel/runtime/helpers/wrapNativeSuper.js +45 -0
- data/node_modules/@babel/runtime/helpers/wrapRegExp.js +72 -0
- data/node_modules/@babel/runtime/helpers/writeOnlyError.js +6 -0
- data/node_modules/@babel/runtime/package.json +848 -0
- data/node_modules/@babel/runtime/regenerator/index.js +1 -0
- data/node_modules/redux/LICENSE.md +21 -0
- data/node_modules/redux/README.md +322 -0
- data/node_modules/redux/dist/redux.js +735 -0
- data/node_modules/redux/dist/redux.min.js +1 -0
- data/node_modules/redux/es/redux.js +684 -0
- data/node_modules/redux/es/redux.mjs +1 -0
- data/node_modules/redux/index.d.ts +676 -0
- data/node_modules/redux/lib/redux.js +697 -0
- data/node_modules/redux/package.json +108 -0
- data/node_modules/redux/src/applyMiddleware.js +41 -0
- data/node_modules/redux/src/bindActionCreators.js +52 -0
- data/node_modules/redux/src/combineReducers.js +175 -0
- data/node_modules/redux/src/compose.js +22 -0
- data/node_modules/redux/src/createStore.js +315 -0
- data/node_modules/redux/src/index.js +36 -0
- data/node_modules/redux/src/utils/actionTypes.js +17 -0
- data/node_modules/redux/src/utils/formatProdErrorMessage.js +15 -0
- data/node_modules/redux/src/utils/isPlainObject.js +14 -0
- data/node_modules/redux/src/utils/kindOf.js +70 -0
- data/node_modules/redux/src/utils/symbol-observable.js +3 -0
- data/node_modules/redux/src/utils/warning.js +19 -0
- data/node_modules/regenerator-runtime/LICENSE +21 -0
- data/node_modules/regenerator-runtime/README.md +31 -0
- data/node_modules/regenerator-runtime/package.json +19 -0
- data/node_modules/regenerator-runtime/path.js +11 -0
- data/node_modules/regenerator-runtime/runtime.js +754 -0
- data/package.json +6 -0
- metadata +240 -10
- data/README.md +0 -223
@@ -0,0 +1 @@
|
|
1
|
+
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self).Redux={})}(this,(function(r){"use strict";function t(r){return"Minified Redux error #"+r+"; visit https://redux.js.org/Errors?code="+r+" for the full message or use the non-minified dev environment for full errors. "}var e="function"==typeof Symbol&&Symbol.observable||"@@observable",n=function(){return Math.random().toString(36).substring(7).split("").join(".")},o={INIT:"@@redux/INIT"+n(),REPLACE:"@@redux/REPLACE"+n(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+n()}};function i(r){if("object"!=typeof r||null===r)return!1;for(var t=r;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t}function f(r,t){return function(){return t(r.apply(this,arguments))}}function u(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function c(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function p(r){for(var t=1;arguments.length>t;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?c(Object(e),!0).forEach((function(t){u(r,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):c(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}function a(){for(var r=arguments.length,t=Array(r),e=0;r>e;e++)t[e]=arguments[e];return 0===t.length?function(r){return r}:1===t.length?t[0]:t.reduce((function(r,t){return function(){return r(t.apply(void 0,arguments))}}))}r.__DO_NOT_USE__ActionTypes=o,r.applyMiddleware=function(){for(var r=arguments.length,e=Array(r),n=0;r>n;n++)e[n]=arguments[n];return function(r){return function(){var n=r.apply(void 0,arguments),o=function(){throw Error(t(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},f=e.map((function(r){return r(i)}));return o=a.apply(void 0,f)(n.dispatch),p(p({},n),{},{dispatch:o})}}},r.bindActionCreators=function(r,e){if("function"==typeof r)return f(r,e);if("object"!=typeof r||null===r)throw Error(t(16));var n={};for(var o in r){var i=r[o];"function"==typeof i&&(n[o]=f(i,e))}return n},r.combineReducers=function(r){for(var e=Object.keys(r),n={},i=0;e.length>i;i++){var f=e[i];"function"==typeof r[f]&&(n[f]=r[f])}var u,c=Object.keys(n);try{!function(r){Object.keys(r).forEach((function(e){var n=r[e];if(void 0===n(void 0,{type:o.INIT}))throw Error(t(12));if(void 0===n(void 0,{type:o.PROBE_UNKNOWN_ACTION()}))throw Error(t(13))}))}(n)}catch(r){u=r}return function(r,e){if(void 0===r&&(r={}),u)throw u;for(var o=!1,i={},f=0;c.length>f;f++){var p=c[f],a=r[p],l=(0,n[p])(a,e);if(void 0===l)throw Error(t(14));i[p]=l,o=o||l!==a}return(o=o||c.length!==Object.keys(r).length)?i:r}},r.compose=a,r.createStore=function r(n,f,u){var c;if("function"==typeof f&&"function"==typeof u||"function"==typeof u&&"function"==typeof arguments[3])throw Error(t(0));if("function"==typeof f&&void 0===u&&(u=f,f=void 0),void 0!==u){if("function"!=typeof u)throw Error(t(1));return u(r)(n,f)}if("function"!=typeof n)throw Error(t(2));var p=n,a=f,l=[],y=l,s=!1;function d(){y===l&&(y=l.slice())}function b(){if(s)throw Error(t(3));return a}function h(r){if("function"!=typeof r)throw Error(t(4));if(s)throw Error(t(5));var e=!0;return d(),y.push(r),function(){if(e){if(s)throw Error(t(6));e=!1,d();var n=y.indexOf(r);y.splice(n,1),l=null}}}function v(r){if(!i(r))throw Error(t(7));if(void 0===r.type)throw Error(t(8));if(s)throw Error(t(9));try{s=!0,a=p(a,r)}finally{s=!1}for(var e=l=y,n=0;e.length>n;n++){(0,e[n])()}return r}function O(r){if("function"!=typeof r)throw Error(t(10));p=r,v({type:o.REPLACE})}function E(){var r,n=h;return(r={subscribe:function(r){if("object"!=typeof r||null===r)throw Error(t(11));function e(){r.next&&r.next(b())}return e(),{unsubscribe:n(e)}}})[e]=function(){return this},r}return v({type:o.INIT}),(c={dispatch:v,subscribe:h,getState:b,replaceReducer:O})[e]=E,c},Object.defineProperty(r,"__esModule",{value:!0})}));
|
@@ -0,0 +1,684 @@
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
|
5
|
+
*
|
6
|
+
* Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
|
7
|
+
* during build.
|
8
|
+
* @param {number} code
|
9
|
+
*/
|
10
|
+
function formatProdErrorMessage(code) {
|
11
|
+
return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or " + 'use the non-minified dev environment for full errors. ';
|
12
|
+
}
|
13
|
+
|
14
|
+
// Inlined version of the `symbol-observable` polyfill
|
15
|
+
var $$observable = (function () {
|
16
|
+
return typeof Symbol === 'function' && Symbol.observable || '@@observable';
|
17
|
+
})();
|
18
|
+
|
19
|
+
/**
|
20
|
+
* These are private action types reserved by Redux.
|
21
|
+
* For any unknown actions, you must return the current state.
|
22
|
+
* If the current state is undefined, you must return the initial state.
|
23
|
+
* Do not reference these action types directly in your code.
|
24
|
+
*/
|
25
|
+
var randomString = function randomString() {
|
26
|
+
return Math.random().toString(36).substring(7).split('').join('.');
|
27
|
+
};
|
28
|
+
|
29
|
+
var ActionTypes = {
|
30
|
+
INIT: "@@redux/INIT" + randomString(),
|
31
|
+
REPLACE: "@@redux/REPLACE" + randomString(),
|
32
|
+
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
33
|
+
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
34
|
+
}
|
35
|
+
};
|
36
|
+
|
37
|
+
/**
|
38
|
+
* @param {any} obj The object to inspect.
|
39
|
+
* @returns {boolean} True if the argument appears to be a plain object.
|
40
|
+
*/
|
41
|
+
function isPlainObject(obj) {
|
42
|
+
if (typeof obj !== 'object' || obj === null) return false;
|
43
|
+
var proto = obj;
|
44
|
+
|
45
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
46
|
+
proto = Object.getPrototypeOf(proto);
|
47
|
+
}
|
48
|
+
|
49
|
+
return Object.getPrototypeOf(obj) === proto;
|
50
|
+
}
|
51
|
+
|
52
|
+
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
|
53
|
+
function miniKindOf(val) {
|
54
|
+
if (val === void 0) return 'undefined';
|
55
|
+
if (val === null) return 'null';
|
56
|
+
var type = typeof val;
|
57
|
+
|
58
|
+
switch (type) {
|
59
|
+
case 'boolean':
|
60
|
+
case 'string':
|
61
|
+
case 'number':
|
62
|
+
case 'symbol':
|
63
|
+
case 'function':
|
64
|
+
{
|
65
|
+
return type;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
if (Array.isArray(val)) return 'array';
|
70
|
+
if (isDate(val)) return 'date';
|
71
|
+
if (isError(val)) return 'error';
|
72
|
+
var constructorName = ctorName(val);
|
73
|
+
|
74
|
+
switch (constructorName) {
|
75
|
+
case 'Symbol':
|
76
|
+
case 'Promise':
|
77
|
+
case 'WeakMap':
|
78
|
+
case 'WeakSet':
|
79
|
+
case 'Map':
|
80
|
+
case 'Set':
|
81
|
+
return constructorName;
|
82
|
+
} // other
|
83
|
+
|
84
|
+
|
85
|
+
return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
|
86
|
+
}
|
87
|
+
|
88
|
+
function ctorName(val) {
|
89
|
+
return typeof val.constructor === 'function' ? val.constructor.name : null;
|
90
|
+
}
|
91
|
+
|
92
|
+
function isError(val) {
|
93
|
+
return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
|
94
|
+
}
|
95
|
+
|
96
|
+
function isDate(val) {
|
97
|
+
if (val instanceof Date) return true;
|
98
|
+
return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
|
99
|
+
}
|
100
|
+
|
101
|
+
function kindOf(val) {
|
102
|
+
var typeOfVal = typeof val;
|
103
|
+
|
104
|
+
if (process.env.NODE_ENV !== 'production') {
|
105
|
+
typeOfVal = miniKindOf(val);
|
106
|
+
}
|
107
|
+
|
108
|
+
return typeOfVal;
|
109
|
+
}
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Creates a Redux store that holds the state tree.
|
113
|
+
* The only way to change the data in the store is to call `dispatch()` on it.
|
114
|
+
*
|
115
|
+
* There should only be a single store in your app. To specify how different
|
116
|
+
* parts of the state tree respond to actions, you may combine several reducers
|
117
|
+
* into a single reducer function by using `combineReducers`.
|
118
|
+
*
|
119
|
+
* @param {Function} reducer A function that returns the next state tree, given
|
120
|
+
* the current state tree and the action to handle.
|
121
|
+
*
|
122
|
+
* @param {any} [preloadedState] The initial state. You may optionally specify it
|
123
|
+
* to hydrate the state from the server in universal apps, or to restore a
|
124
|
+
* previously serialized user session.
|
125
|
+
* If you use `combineReducers` to produce the root reducer function, this must be
|
126
|
+
* an object with the same shape as `combineReducers` keys.
|
127
|
+
*
|
128
|
+
* @param {Function} [enhancer] The store enhancer. You may optionally specify it
|
129
|
+
* to enhance the store with third-party capabilities such as middleware,
|
130
|
+
* time travel, persistence, etc. The only store enhancer that ships with Redux
|
131
|
+
* is `applyMiddleware()`.
|
132
|
+
*
|
133
|
+
* @returns {Store} A Redux store that lets you read the state, dispatch actions
|
134
|
+
* and subscribe to changes.
|
135
|
+
*/
|
136
|
+
|
137
|
+
function createStore(reducer, preloadedState, enhancer) {
|
138
|
+
var _ref2;
|
139
|
+
|
140
|
+
if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
|
141
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : 'It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.');
|
142
|
+
}
|
143
|
+
|
144
|
+
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
|
145
|
+
enhancer = preloadedState;
|
146
|
+
preloadedState = undefined;
|
147
|
+
}
|
148
|
+
|
149
|
+
if (typeof enhancer !== 'undefined') {
|
150
|
+
if (typeof enhancer !== 'function') {
|
151
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(1) : "Expected the enhancer to be a function. Instead, received: '" + kindOf(enhancer) + "'");
|
152
|
+
}
|
153
|
+
|
154
|
+
return enhancer(createStore)(reducer, preloadedState);
|
155
|
+
}
|
156
|
+
|
157
|
+
if (typeof reducer !== 'function') {
|
158
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(2) : "Expected the root reducer to be a function. Instead, received: '" + kindOf(reducer) + "'");
|
159
|
+
}
|
160
|
+
|
161
|
+
var currentReducer = reducer;
|
162
|
+
var currentState = preloadedState;
|
163
|
+
var currentListeners = [];
|
164
|
+
var nextListeners = currentListeners;
|
165
|
+
var isDispatching = false;
|
166
|
+
/**
|
167
|
+
* This makes a shallow copy of currentListeners so we can use
|
168
|
+
* nextListeners as a temporary list while dispatching.
|
169
|
+
*
|
170
|
+
* This prevents any bugs around consumers calling
|
171
|
+
* subscribe/unsubscribe in the middle of a dispatch.
|
172
|
+
*/
|
173
|
+
|
174
|
+
function ensureCanMutateNextListeners() {
|
175
|
+
if (nextListeners === currentListeners) {
|
176
|
+
nextListeners = currentListeners.slice();
|
177
|
+
}
|
178
|
+
}
|
179
|
+
/**
|
180
|
+
* Reads the state tree managed by the store.
|
181
|
+
*
|
182
|
+
* @returns {any} The current state tree of your application.
|
183
|
+
*/
|
184
|
+
|
185
|
+
|
186
|
+
function getState() {
|
187
|
+
if (isDispatching) {
|
188
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(3) : 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
|
189
|
+
}
|
190
|
+
|
191
|
+
return currentState;
|
192
|
+
}
|
193
|
+
/**
|
194
|
+
* Adds a change listener. It will be called any time an action is dispatched,
|
195
|
+
* and some part of the state tree may potentially have changed. You may then
|
196
|
+
* call `getState()` to read the current state tree inside the callback.
|
197
|
+
*
|
198
|
+
* You may call `dispatch()` from a change listener, with the following
|
199
|
+
* caveats:
|
200
|
+
*
|
201
|
+
* 1. The subscriptions are snapshotted just before every `dispatch()` call.
|
202
|
+
* If you subscribe or unsubscribe while the listeners are being invoked, this
|
203
|
+
* will not have any effect on the `dispatch()` that is currently in progress.
|
204
|
+
* However, the next `dispatch()` call, whether nested or not, will use a more
|
205
|
+
* recent snapshot of the subscription list.
|
206
|
+
*
|
207
|
+
* 2. The listener should not expect to see all state changes, as the state
|
208
|
+
* might have been updated multiple times during a nested `dispatch()` before
|
209
|
+
* the listener is called. It is, however, guaranteed that all subscribers
|
210
|
+
* registered before the `dispatch()` started will be called with the latest
|
211
|
+
* state by the time it exits.
|
212
|
+
*
|
213
|
+
* @param {Function} listener A callback to be invoked on every dispatch.
|
214
|
+
* @returns {Function} A function to remove this change listener.
|
215
|
+
*/
|
216
|
+
|
217
|
+
|
218
|
+
function subscribe(listener) {
|
219
|
+
if (typeof listener !== 'function') {
|
220
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(4) : "Expected the listener to be a function. Instead, received: '" + kindOf(listener) + "'");
|
221
|
+
}
|
222
|
+
|
223
|
+
if (isDispatching) {
|
224
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(5) : 'You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
|
225
|
+
}
|
226
|
+
|
227
|
+
var isSubscribed = true;
|
228
|
+
ensureCanMutateNextListeners();
|
229
|
+
nextListeners.push(listener);
|
230
|
+
return function unsubscribe() {
|
231
|
+
if (!isSubscribed) {
|
232
|
+
return;
|
233
|
+
}
|
234
|
+
|
235
|
+
if (isDispatching) {
|
236
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(6) : 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
|
237
|
+
}
|
238
|
+
|
239
|
+
isSubscribed = false;
|
240
|
+
ensureCanMutateNextListeners();
|
241
|
+
var index = nextListeners.indexOf(listener);
|
242
|
+
nextListeners.splice(index, 1);
|
243
|
+
currentListeners = null;
|
244
|
+
};
|
245
|
+
}
|
246
|
+
/**
|
247
|
+
* Dispatches an action. It is the only way to trigger a state change.
|
248
|
+
*
|
249
|
+
* The `reducer` function, used to create the store, will be called with the
|
250
|
+
* current state tree and the given `action`. Its return value will
|
251
|
+
* be considered the **next** state of the tree, and the change listeners
|
252
|
+
* will be notified.
|
253
|
+
*
|
254
|
+
* The base implementation only supports plain object actions. If you want to
|
255
|
+
* dispatch a Promise, an Observable, a thunk, or something else, you need to
|
256
|
+
* wrap your store creating function into the corresponding middleware. For
|
257
|
+
* example, see the documentation for the `redux-thunk` package. Even the
|
258
|
+
* middleware will eventually dispatch plain object actions using this method.
|
259
|
+
*
|
260
|
+
* @param {Object} action A plain object representing “what changed”. It is
|
261
|
+
* a good idea to keep actions serializable so you can record and replay user
|
262
|
+
* sessions, or use the time travelling `redux-devtools`. An action must have
|
263
|
+
* a `type` property which may not be `undefined`. It is a good idea to use
|
264
|
+
* string constants for action types.
|
265
|
+
*
|
266
|
+
* @returns {Object} For convenience, the same action object you dispatched.
|
267
|
+
*
|
268
|
+
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
|
269
|
+
* return something else (for example, a Promise you can await).
|
270
|
+
*/
|
271
|
+
|
272
|
+
|
273
|
+
function dispatch(action) {
|
274
|
+
if (!isPlainObject(action)) {
|
275
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(7) : "Actions must be plain objects. Instead, the actual type was: '" + kindOf(action) + "'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");
|
276
|
+
}
|
277
|
+
|
278
|
+
if (typeof action.type === 'undefined') {
|
279
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(8) : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
|
280
|
+
}
|
281
|
+
|
282
|
+
if (isDispatching) {
|
283
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(9) : 'Reducers may not dispatch actions.');
|
284
|
+
}
|
285
|
+
|
286
|
+
try {
|
287
|
+
isDispatching = true;
|
288
|
+
currentState = currentReducer(currentState, action);
|
289
|
+
} finally {
|
290
|
+
isDispatching = false;
|
291
|
+
}
|
292
|
+
|
293
|
+
var listeners = currentListeners = nextListeners;
|
294
|
+
|
295
|
+
for (var i = 0; i < listeners.length; i++) {
|
296
|
+
var listener = listeners[i];
|
297
|
+
listener();
|
298
|
+
}
|
299
|
+
|
300
|
+
return action;
|
301
|
+
}
|
302
|
+
/**
|
303
|
+
* Replaces the reducer currently used by the store to calculate the state.
|
304
|
+
*
|
305
|
+
* You might need this if your app implements code splitting and you want to
|
306
|
+
* load some of the reducers dynamically. You might also need this if you
|
307
|
+
* implement a hot reloading mechanism for Redux.
|
308
|
+
*
|
309
|
+
* @param {Function} nextReducer The reducer for the store to use instead.
|
310
|
+
* @returns {void}
|
311
|
+
*/
|
312
|
+
|
313
|
+
|
314
|
+
function replaceReducer(nextReducer) {
|
315
|
+
if (typeof nextReducer !== 'function') {
|
316
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(10) : "Expected the nextReducer to be a function. Instead, received: '" + kindOf(nextReducer));
|
317
|
+
}
|
318
|
+
|
319
|
+
currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
|
320
|
+
// Any reducers that existed in both the new and old rootReducer
|
321
|
+
// will receive the previous state. This effectively populates
|
322
|
+
// the new state tree with any relevant data from the old one.
|
323
|
+
|
324
|
+
dispatch({
|
325
|
+
type: ActionTypes.REPLACE
|
326
|
+
});
|
327
|
+
}
|
328
|
+
/**
|
329
|
+
* Interoperability point for observable/reactive libraries.
|
330
|
+
* @returns {observable} A minimal observable of state changes.
|
331
|
+
* For more information, see the observable proposal:
|
332
|
+
* https://github.com/tc39/proposal-observable
|
333
|
+
*/
|
334
|
+
|
335
|
+
|
336
|
+
function observable() {
|
337
|
+
var _ref;
|
338
|
+
|
339
|
+
var outerSubscribe = subscribe;
|
340
|
+
return _ref = {
|
341
|
+
/**
|
342
|
+
* The minimal observable subscription method.
|
343
|
+
* @param {Object} observer Any object that can be used as an observer.
|
344
|
+
* The observer object should have a `next` method.
|
345
|
+
* @returns {subscription} An object with an `unsubscribe` method that can
|
346
|
+
* be used to unsubscribe the observable from the store, and prevent further
|
347
|
+
* emission of values from the observable.
|
348
|
+
*/
|
349
|
+
subscribe: function subscribe(observer) {
|
350
|
+
if (typeof observer !== 'object' || observer === null) {
|
351
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : "Expected the observer to be an object. Instead, received: '" + kindOf(observer) + "'");
|
352
|
+
}
|
353
|
+
|
354
|
+
function observeState() {
|
355
|
+
if (observer.next) {
|
356
|
+
observer.next(getState());
|
357
|
+
}
|
358
|
+
}
|
359
|
+
|
360
|
+
observeState();
|
361
|
+
var unsubscribe = outerSubscribe(observeState);
|
362
|
+
return {
|
363
|
+
unsubscribe: unsubscribe
|
364
|
+
};
|
365
|
+
}
|
366
|
+
}, _ref[$$observable] = function () {
|
367
|
+
return this;
|
368
|
+
}, _ref;
|
369
|
+
} // When a store is created, an "INIT" action is dispatched so that every
|
370
|
+
// reducer returns their initial state. This effectively populates
|
371
|
+
// the initial state tree.
|
372
|
+
|
373
|
+
|
374
|
+
dispatch({
|
375
|
+
type: ActionTypes.INIT
|
376
|
+
});
|
377
|
+
return _ref2 = {
|
378
|
+
dispatch: dispatch,
|
379
|
+
subscribe: subscribe,
|
380
|
+
getState: getState,
|
381
|
+
replaceReducer: replaceReducer
|
382
|
+
}, _ref2[$$observable] = observable, _ref2;
|
383
|
+
}
|
384
|
+
|
385
|
+
/**
|
386
|
+
* Prints a warning in the console if it exists.
|
387
|
+
*
|
388
|
+
* @param {String} message The warning message.
|
389
|
+
* @returns {void}
|
390
|
+
*/
|
391
|
+
function warning(message) {
|
392
|
+
/* eslint-disable no-console */
|
393
|
+
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
394
|
+
console.error(message);
|
395
|
+
}
|
396
|
+
/* eslint-enable no-console */
|
397
|
+
|
398
|
+
|
399
|
+
try {
|
400
|
+
// This error was thrown as a convenience so that if you enable
|
401
|
+
// "break on all exceptions" in your console,
|
402
|
+
// it would pause the execution at this line.
|
403
|
+
throw new Error(message);
|
404
|
+
} catch (e) {} // eslint-disable-line no-empty
|
405
|
+
|
406
|
+
}
|
407
|
+
|
408
|
+
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
409
|
+
var reducerKeys = Object.keys(reducers);
|
410
|
+
var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
|
411
|
+
|
412
|
+
if (reducerKeys.length === 0) {
|
413
|
+
return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
|
414
|
+
}
|
415
|
+
|
416
|
+
if (!isPlainObject(inputState)) {
|
417
|
+
return "The " + argumentName + " has unexpected type of \"" + kindOf(inputState) + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
|
418
|
+
}
|
419
|
+
|
420
|
+
var unexpectedKeys = Object.keys(inputState).filter(function (key) {
|
421
|
+
return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
|
422
|
+
});
|
423
|
+
unexpectedKeys.forEach(function (key) {
|
424
|
+
unexpectedKeyCache[key] = true;
|
425
|
+
});
|
426
|
+
if (action && action.type === ActionTypes.REPLACE) return;
|
427
|
+
|
428
|
+
if (unexpectedKeys.length > 0) {
|
429
|
+
return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored.");
|
430
|
+
}
|
431
|
+
}
|
432
|
+
|
433
|
+
function assertReducerShape(reducers) {
|
434
|
+
Object.keys(reducers).forEach(function (key) {
|
435
|
+
var reducer = reducers[key];
|
436
|
+
var initialState = reducer(undefined, {
|
437
|
+
type: ActionTypes.INIT
|
438
|
+
});
|
439
|
+
|
440
|
+
if (typeof initialState === 'undefined') {
|
441
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : "The slice reducer for key \"" + key + "\" returned undefined during initialization. " + "If the state passed to the reducer is undefined, you must " + "explicitly return the initial state. The initial state may " + "not be undefined. If you don't want to set a value for this reducer, " + "you can use null instead of undefined.");
|
442
|
+
}
|
443
|
+
|
444
|
+
if (typeof reducer(undefined, {
|
445
|
+
type: ActionTypes.PROBE_UNKNOWN_ACTION()
|
446
|
+
}) === 'undefined') {
|
447
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : "The slice reducer for key \"" + key + "\" returned undefined when probed with a random type. " + ("Don't try to handle '" + ActionTypes.INIT + "' or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the " + "current state for any unknown actions, unless it is undefined, " + "in which case you must return the initial state, regardless of the " + "action type. The initial state may not be undefined, but can be null.");
|
448
|
+
}
|
449
|
+
});
|
450
|
+
}
|
451
|
+
/**
|
452
|
+
* Turns an object whose values are different reducer functions, into a single
|
453
|
+
* reducer function. It will call every child reducer, and gather their results
|
454
|
+
* into a single state object, whose keys correspond to the keys of the passed
|
455
|
+
* reducer functions.
|
456
|
+
*
|
457
|
+
* @param {Object} reducers An object whose values correspond to different
|
458
|
+
* reducer functions that need to be combined into one. One handy way to obtain
|
459
|
+
* it is to use ES6 `import * as reducers` syntax. The reducers may never return
|
460
|
+
* undefined for any action. Instead, they should return their initial state
|
461
|
+
* if the state passed to them was undefined, and the current state for any
|
462
|
+
* unrecognized action.
|
463
|
+
*
|
464
|
+
* @returns {Function} A reducer function that invokes every reducer inside the
|
465
|
+
* passed object, and builds a state object with the same shape.
|
466
|
+
*/
|
467
|
+
|
468
|
+
|
469
|
+
function combineReducers(reducers) {
|
470
|
+
var reducerKeys = Object.keys(reducers);
|
471
|
+
var finalReducers = {};
|
472
|
+
|
473
|
+
for (var i = 0; i < reducerKeys.length; i++) {
|
474
|
+
var key = reducerKeys[i];
|
475
|
+
|
476
|
+
if (process.env.NODE_ENV !== 'production') {
|
477
|
+
if (typeof reducers[key] === 'undefined') {
|
478
|
+
warning("No reducer provided for key \"" + key + "\"");
|
479
|
+
}
|
480
|
+
}
|
481
|
+
|
482
|
+
if (typeof reducers[key] === 'function') {
|
483
|
+
finalReducers[key] = reducers[key];
|
484
|
+
}
|
485
|
+
}
|
486
|
+
|
487
|
+
var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same
|
488
|
+
// keys multiple times.
|
489
|
+
|
490
|
+
var unexpectedKeyCache;
|
491
|
+
|
492
|
+
if (process.env.NODE_ENV !== 'production') {
|
493
|
+
unexpectedKeyCache = {};
|
494
|
+
}
|
495
|
+
|
496
|
+
var shapeAssertionError;
|
497
|
+
|
498
|
+
try {
|
499
|
+
assertReducerShape(finalReducers);
|
500
|
+
} catch (e) {
|
501
|
+
shapeAssertionError = e;
|
502
|
+
}
|
503
|
+
|
504
|
+
return function combination(state, action) {
|
505
|
+
if (state === void 0) {
|
506
|
+
state = {};
|
507
|
+
}
|
508
|
+
|
509
|
+
if (shapeAssertionError) {
|
510
|
+
throw shapeAssertionError;
|
511
|
+
}
|
512
|
+
|
513
|
+
if (process.env.NODE_ENV !== 'production') {
|
514
|
+
var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
515
|
+
|
516
|
+
if (warningMessage) {
|
517
|
+
warning(warningMessage);
|
518
|
+
}
|
519
|
+
}
|
520
|
+
|
521
|
+
var hasChanged = false;
|
522
|
+
var nextState = {};
|
523
|
+
|
524
|
+
for (var _i = 0; _i < finalReducerKeys.length; _i++) {
|
525
|
+
var _key = finalReducerKeys[_i];
|
526
|
+
var reducer = finalReducers[_key];
|
527
|
+
var previousStateForKey = state[_key];
|
528
|
+
var nextStateForKey = reducer(previousStateForKey, action);
|
529
|
+
|
530
|
+
if (typeof nextStateForKey === 'undefined') {
|
531
|
+
var actionType = action && action.type;
|
532
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : "When called with an action of type " + (actionType ? "\"" + String(actionType) + "\"" : '(unknown type)') + ", the slice reducer for key \"" + _key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined.");
|
533
|
+
}
|
534
|
+
|
535
|
+
nextState[_key] = nextStateForKey;
|
536
|
+
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
537
|
+
}
|
538
|
+
|
539
|
+
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
540
|
+
return hasChanged ? nextState : state;
|
541
|
+
};
|
542
|
+
}
|
543
|
+
|
544
|
+
function bindActionCreator(actionCreator, dispatch) {
|
545
|
+
return function () {
|
546
|
+
return dispatch(actionCreator.apply(this, arguments));
|
547
|
+
};
|
548
|
+
}
|
549
|
+
/**
|
550
|
+
* Turns an object whose values are action creators, into an object with the
|
551
|
+
* same keys, but with every function wrapped into a `dispatch` call so they
|
552
|
+
* may be invoked directly. This is just a convenience method, as you can call
|
553
|
+
* `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
|
554
|
+
*
|
555
|
+
* For convenience, you can also pass an action creator as the first argument,
|
556
|
+
* and get a dispatch wrapped function in return.
|
557
|
+
*
|
558
|
+
* @param {Function|Object} actionCreators An object whose values are action
|
559
|
+
* creator functions. One handy way to obtain it is to use ES6 `import * as`
|
560
|
+
* syntax. You may also pass a single function.
|
561
|
+
*
|
562
|
+
* @param {Function} dispatch The `dispatch` function available on your Redux
|
563
|
+
* store.
|
564
|
+
*
|
565
|
+
* @returns {Function|Object} The object mimicking the original object, but with
|
566
|
+
* every action creator wrapped into the `dispatch` call. If you passed a
|
567
|
+
* function as `actionCreators`, the return value will also be a single
|
568
|
+
* function.
|
569
|
+
*/
|
570
|
+
|
571
|
+
|
572
|
+
function bindActionCreators(actionCreators, dispatch) {
|
573
|
+
if (typeof actionCreators === 'function') {
|
574
|
+
return bindActionCreator(actionCreators, dispatch);
|
575
|
+
}
|
576
|
+
|
577
|
+
if (typeof actionCreators !== 'object' || actionCreators === null) {
|
578
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(16) : "bindActionCreators expected an object or a function, but instead received: '" + kindOf(actionCreators) + "'. " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
|
579
|
+
}
|
580
|
+
|
581
|
+
var boundActionCreators = {};
|
582
|
+
|
583
|
+
for (var key in actionCreators) {
|
584
|
+
var actionCreator = actionCreators[key];
|
585
|
+
|
586
|
+
if (typeof actionCreator === 'function') {
|
587
|
+
boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
|
588
|
+
}
|
589
|
+
}
|
590
|
+
|
591
|
+
return boundActionCreators;
|
592
|
+
}
|
593
|
+
|
594
|
+
/**
|
595
|
+
* Composes single-argument functions from right to left. The rightmost
|
596
|
+
* function can take multiple arguments as it provides the signature for
|
597
|
+
* the resulting composite function.
|
598
|
+
*
|
599
|
+
* @param {...Function} funcs The functions to compose.
|
600
|
+
* @returns {Function} A function obtained by composing the argument functions
|
601
|
+
* from right to left. For example, compose(f, g, h) is identical to doing
|
602
|
+
* (...args) => f(g(h(...args))).
|
603
|
+
*/
|
604
|
+
function compose() {
|
605
|
+
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
606
|
+
funcs[_key] = arguments[_key];
|
607
|
+
}
|
608
|
+
|
609
|
+
if (funcs.length === 0) {
|
610
|
+
return function (arg) {
|
611
|
+
return arg;
|
612
|
+
};
|
613
|
+
}
|
614
|
+
|
615
|
+
if (funcs.length === 1) {
|
616
|
+
return funcs[0];
|
617
|
+
}
|
618
|
+
|
619
|
+
return funcs.reduce(function (a, b) {
|
620
|
+
return function () {
|
621
|
+
return a(b.apply(void 0, arguments));
|
622
|
+
};
|
623
|
+
});
|
624
|
+
}
|
625
|
+
|
626
|
+
/**
|
627
|
+
* Creates a store enhancer that applies middleware to the dispatch method
|
628
|
+
* of the Redux store. This is handy for a variety of tasks, such as expressing
|
629
|
+
* asynchronous actions in a concise manner, or logging every action payload.
|
630
|
+
*
|
631
|
+
* See `redux-thunk` package as an example of the Redux middleware.
|
632
|
+
*
|
633
|
+
* Because middleware is potentially asynchronous, this should be the first
|
634
|
+
* store enhancer in the composition chain.
|
635
|
+
*
|
636
|
+
* Note that each middleware will be given the `dispatch` and `getState` functions
|
637
|
+
* as named arguments.
|
638
|
+
*
|
639
|
+
* @param {...Function} middlewares The middleware chain to be applied.
|
640
|
+
* @returns {Function} A store enhancer applying the middleware.
|
641
|
+
*/
|
642
|
+
|
643
|
+
function applyMiddleware() {
|
644
|
+
for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
|
645
|
+
middlewares[_key] = arguments[_key];
|
646
|
+
}
|
647
|
+
|
648
|
+
return function (createStore) {
|
649
|
+
return function () {
|
650
|
+
var store = createStore.apply(void 0, arguments);
|
651
|
+
|
652
|
+
var _dispatch = function dispatch() {
|
653
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(15) : 'Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');
|
654
|
+
};
|
655
|
+
|
656
|
+
var middlewareAPI = {
|
657
|
+
getState: store.getState,
|
658
|
+
dispatch: function dispatch() {
|
659
|
+
return _dispatch.apply(void 0, arguments);
|
660
|
+
}
|
661
|
+
};
|
662
|
+
var chain = middlewares.map(function (middleware) {
|
663
|
+
return middleware(middlewareAPI);
|
664
|
+
});
|
665
|
+
_dispatch = compose.apply(void 0, chain)(store.dispatch);
|
666
|
+
return _objectSpread(_objectSpread({}, store), {}, {
|
667
|
+
dispatch: _dispatch
|
668
|
+
});
|
669
|
+
};
|
670
|
+
};
|
671
|
+
}
|
672
|
+
|
673
|
+
/*
|
674
|
+
* This is a dummy function to check if the function name has been altered by minification.
|
675
|
+
* If the function has been minified and NODE_ENV !== 'production', warn the user.
|
676
|
+
*/
|
677
|
+
|
678
|
+
function isCrushed() {}
|
679
|
+
|
680
|
+
if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
|
681
|
+
warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');
|
682
|
+
}
|
683
|
+
|
684
|
+
export { ActionTypes as __DO_NOT_USE__ActionTypes, applyMiddleware, bindActionCreators, combineReducers, compose, createStore };
|