Skip to content

Commit 3a8e2ee

Browse files
committed
Updated approach for connect
1 parent 19b59c6 commit 3a8e2ee

File tree

8 files changed

+26
-13
lines changed

8 files changed

+26
-13
lines changed

d3.compose-all.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export {default as utils} from './src/utils';
22
export {default as helpers, scaleBandSeries} from './src/helpers';
3+
export {default as connect} from './src/connect';
34
export {default as chart, Chart} from './src/chart';
45
export {default as component, Component} from './src/component';
56
export {default as overlay, Overlay} from './src/overlay';

d3.compose-mixins.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export {default as utils} from './src/utils';
22
export {default as helpers, scaleBandSeries} from './src/helpers';
3+
export {default as connect} from './src/connect';
34
export {default as chart, Chart} from './src/chart';
45
export {default as component, Component} from './src/component';
56
export {default as overlay, Overlay} from './src/overlay';

d3.compose.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export {default as utils} from './src/utils';
22
export {default as helpers, scaleBandSeries} from './src/helpers';
3+
export {default as connect} from './src/connect';
34
export {default as chart, Chart} from './src/chart';
45
export {default as component, Component} from './src/component';
56
export {default as overlay, Overlay} from './src/overlay';

src/charts/bars.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {assign} from '../utils';
22
import {
3-
connect,
43
createPrepare,
54
createSeriesDraw,
65
getBandwidth,
@@ -17,6 +16,7 @@ import {
1716
defaultXValue
1817
} from '../mixins/xy';
1918
import xyValues from '../mixins/xy-values';
19+
import connect from '../connect';
2020
import chart from '../chart';
2121

2222
// Draw vertical bars (stacked and unstacked)
@@ -177,7 +177,7 @@ export var mapState = function() {
177177
export var mapDispatch = function() {
178178
// TODO "bind" onMouseEnterBar and onMouseLeaveBar
179179
}
180-
export var connection = connect(mapState, mapDispatch);
180+
export var connection = connect.map(mapState, mapDispatch);
181181

182182
/**
183183
bars

src/charts/lines.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import {
44
isUndefined
55
} from '../utils';
66
import {
7-
connect,
87
createPrepare,
98
createSeriesDraw,
109
getValue,
1110
types
1211
} from '../helpers';
1312
import series from '../mixins/series';
1413
import xy from '../mixins/xy';
14+
import connect from '../connect';
1515
import chart from '../chart';
1616

1717
/**
@@ -115,7 +115,7 @@ Lines.properties = assign({},
115115
// ----------
116116

117117
// TODO Connect to dispatch closest points
118-
export var connection = connect();
118+
export var connection = connect.map();
119119

120120
// lines
121121
var lines = connection(chart(Lines));

src/connect.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// TODO
2+
3+
function connection(Connectee) {
4+
return Connectee;
5+
}
6+
7+
const connect = {
8+
map: function(/*mapStateToProps, mapDispatchToProps, mergeProps, options*/) {
9+
return connection;
10+
},
11+
reduce: function(/*reducer*/) {
12+
return connection;
13+
}
14+
};
15+
16+
connection.map = connect.map;
17+
connection.reduce = connect.reduce;
18+
19+
export default connect;

src/helpers.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import alignText from './helpers/align-text';
22
import checkProp from './helpers/check-prop';
3-
import connect from './helpers/connect';
43
import createChart from './helpers/create-chart';
54
import createDraw from './helpers/create-draw';
65
import createPrepare from './helpers/create-prepare';
@@ -23,7 +22,6 @@ import types from './helpers/types';
2322
var helpers = {
2423
alignText: alignText,
2524
checkProp: checkProp,
26-
connect: connect,
2725
createChart: createChart,
2826
createDraw: createDraw,
2927
createPrepare: createPrepare,

src/helpers/connect.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)