redux-vue 0.8.1 → 0.8.2
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/.babelrc +1 -1
- package/lib/connect.js +11 -4
- package/lib/index.js +20 -2
- package/lib/normalizeProps.js +7 -1
- package/lib/reduxStorePlugin.js +7 -1
- package/package.json +1 -1
package/.babelrc
CHANGED
package/lib/connect.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = connect;
|
|
7
|
+
var _normalizeProps = _interopRequireDefault(require("./normalizeProps"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
2
9
|
function noop() {}
|
|
3
10
|
function getStore(component) {
|
|
4
11
|
return component.$store;
|
|
@@ -53,15 +60,15 @@ function getProps(component) {
|
|
|
53
60
|
* @param mergeProps - optional; receives (stateProps, dispatchProps) -> props
|
|
54
61
|
* @returns Function (children) => VueComponentDescriptor
|
|
55
62
|
*/
|
|
56
|
-
|
|
63
|
+
function connect(mapStateToProps, mapActionsToProps, mergeProps) {
|
|
57
64
|
mapStateToProps = mapStateToProps || noop;
|
|
58
65
|
mapActionsToProps = mapActionsToProps || noop;
|
|
59
66
|
return children => {
|
|
60
67
|
/** @namespace children.collect */
|
|
61
68
|
if (children.collect) {
|
|
62
69
|
children.props = {
|
|
63
|
-
...
|
|
64
|
-
...
|
|
70
|
+
...(0, _normalizeProps.default)(children.props || {}),
|
|
71
|
+
...(0, _normalizeProps.default)(children.collect || {})
|
|
65
72
|
};
|
|
66
73
|
const msg = `vua-redux: collect is deprecated, use props ` + `in ${children.name || 'anonymous'} component`;
|
|
67
74
|
console.warn(msg);
|
package/lib/index.js
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "connect", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _connect.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "reduxStorePlugin", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _reduxStorePlugin.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _connect = _interopRequireDefault(require("./connect"));
|
|
19
|
+
var _reduxStorePlugin = _interopRequireDefault(require("./reduxStorePlugin"));
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
package/lib/normalizeProps.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = normalizeProps;
|
|
1
7
|
const isArray = Array.isArray;
|
|
2
8
|
const isPlainObject = v => v !== null && typeof v === 'object' && Object.getPrototypeOf(v) === Object.prototype;
|
|
3
9
|
|
|
4
10
|
// https://github.com/vuejs/vue/blob/dev/src/util/options.js
|
|
5
|
-
|
|
11
|
+
function normalizeProps(props) {
|
|
6
12
|
var i,
|
|
7
13
|
val,
|
|
8
14
|
normalizedProps = {};
|
package/lib/reduxStorePlugin.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = reduxStorePlugin;
|
|
7
|
+
function reduxStorePlugin(Vue, storeId = 'store') {
|
|
2
8
|
Vue.mixin({
|
|
3
9
|
beforeCreate() {
|
|
4
10
|
const options = this.$options;
|