victory-core 36.8.4 → 36.8.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/CHANGELOG.md +8 -0
- package/dist/victory-core.js +684 -1046
- package/dist/victory-core.min.js +1 -1
- package/es/victory-clip-container/victory-clip-container.js +3 -6
- package/es/victory-container/victory-container.js +5 -13
- package/es/victory-label/victory-label.js +6 -7
- package/es/victory-primitives/arc.js +2 -4
- package/es/victory-primitives/background.js +1 -3
- package/es/victory-primitives/border.js +2 -4
- package/es/victory-primitives/line-segment.js +2 -4
- package/es/victory-primitives/point.js +1 -3
- package/es/victory-primitives/whisker.js +3 -5
- package/es/victory-theme/grayscale.js +24 -27
- package/es/victory-theme/material.js +27 -30
- package/es/victory-util/add-events.js +1 -2
- package/es/victory-util/axis.js +3 -6
- package/es/victory-util/data.js +5 -10
- package/es/victory-util/events.js +13 -14
- package/es/victory-util/helpers.d.ts +11 -0
- package/es/victory-util/helpers.js +34 -5
- package/es/victory-util/point-path-helpers.js +3 -3
- package/es/victory-util/textsize.js +1 -2
- package/es/victory-util/transitions.js +14 -20
- package/es/victory-util/wrapper.js +7 -10
- package/lib/victory-clip-container/victory-clip-container.js +3 -5
- package/lib/victory-container/victory-container.js +5 -7
- package/lib/victory-label/victory-label.js +6 -8
- package/lib/victory-primitives/arc.js +2 -4
- package/lib/victory-primitives/background.js +1 -3
- package/lib/victory-primitives/border.js +2 -4
- package/lib/victory-primitives/line-segment.js +2 -4
- package/lib/victory-primitives/point.js +1 -3
- package/lib/victory-primitives/whisker.js +3 -5
- package/lib/victory-theme/grayscale.js +24 -29
- package/lib/victory-theme/material.js +27 -32
- package/lib/victory-util/add-events.js +1 -3
- package/lib/victory-util/axis.js +3 -7
- package/lib/victory-util/data.js +5 -9
- package/lib/victory-util/events.js +13 -15
- package/lib/victory-util/helpers.d.ts +11 -0
- package/lib/victory-util/helpers.js +36 -4
- package/lib/victory-util/point-path-helpers.js +6 -3
- package/lib/victory-util/textsize.js +1 -3
- package/lib/victory-util/transitions.js +14 -16
- package/lib/victory-util/wrapper.js +7 -9
- package/package.json +2 -2
- package/src/victory-clip-container/victory-clip-container.tsx +4 -4
- package/src/victory-container/victory-container.tsx +6 -6
- package/src/victory-label/victory-label.tsx +7 -7
- package/src/victory-primitives/arc.tsx +2 -3
- package/src/victory-primitives/background.tsx +1 -2
- package/src/victory-primitives/border.tsx +2 -3
- package/src/victory-primitives/line-segment.tsx +2 -3
- package/src/victory-primitives/point.tsx +1 -2
- package/src/victory-primitives/whisker.tsx +3 -4
- package/src/victory-theme/grayscale.tsx +30 -25
- package/src/victory-theme/material.tsx +33 -28
- package/src/victory-util/add-events.tsx +1 -2
- package/src/victory-util/axis.tsx +3 -5
- package/src/victory-util/data.ts +7 -7
- package/src/victory-util/events.ts +23 -16
- package/src/victory-util/helpers.ts +34 -3
- package/src/victory-util/point-path-helpers.ts +3 -2
- package/src/victory-util/textsize.ts +2 -2
- package/src/victory-util/transitions.ts +22 -15
- package/src/victory-util/wrapper.tsx +11 -8
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _assign from "lodash/assign";
|
|
2
1
|
// *
|
|
3
2
|
// * Colors
|
|
4
3
|
// *
|
|
@@ -40,19 +39,17 @@ var baseLabelStyles = {
|
|
|
40
39
|
stroke: "transparent",
|
|
41
40
|
strokeWidth: 0
|
|
42
41
|
};
|
|
43
|
-
|
|
44
|
-
var centeredLabelStyles = _assign({
|
|
42
|
+
var centeredLabelStyles = Object.assign({
|
|
45
43
|
textAnchor: "middle"
|
|
46
44
|
}, baseLabelStyles); // *
|
|
47
45
|
// * Strokes
|
|
48
46
|
// *
|
|
49
47
|
|
|
50
|
-
|
|
51
48
|
var strokeDasharray = "10, 5";
|
|
52
49
|
var strokeLinecap = "round";
|
|
53
50
|
var strokeLinejoin = "round";
|
|
54
51
|
export var material = {
|
|
55
|
-
area:
|
|
52
|
+
area: Object.assign({
|
|
56
53
|
style: {
|
|
57
54
|
data: {
|
|
58
55
|
fill: grey900
|
|
@@ -60,7 +57,7 @@ export var material = {
|
|
|
60
57
|
labels: baseLabelStyles
|
|
61
58
|
}
|
|
62
59
|
}, baseProps),
|
|
63
|
-
axis:
|
|
60
|
+
axis: Object.assign({
|
|
64
61
|
style: {
|
|
65
62
|
axis: {
|
|
66
63
|
fill: "transparent",
|
|
@@ -69,7 +66,7 @@ export var material = {
|
|
|
69
66
|
strokeLinecap: strokeLinecap,
|
|
70
67
|
strokeLinejoin: strokeLinejoin
|
|
71
68
|
},
|
|
72
|
-
axisLabel:
|
|
69
|
+
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
73
70
|
padding: padding,
|
|
74
71
|
stroke: "transparent"
|
|
75
72
|
}),
|
|
@@ -89,12 +86,12 @@ export var material = {
|
|
|
89
86
|
strokeLinecap: strokeLinecap,
|
|
90
87
|
strokeLinejoin: strokeLinejoin
|
|
91
88
|
},
|
|
92
|
-
tickLabels:
|
|
89
|
+
tickLabels: Object.assign({}, baseLabelStyles, {
|
|
93
90
|
fill: blueGrey700
|
|
94
91
|
})
|
|
95
92
|
}
|
|
96
93
|
}, baseProps),
|
|
97
|
-
polarDependentAxis:
|
|
94
|
+
polarDependentAxis: Object.assign({
|
|
98
95
|
style: {
|
|
99
96
|
ticks: {
|
|
100
97
|
fill: "transparent",
|
|
@@ -103,7 +100,7 @@ export var material = {
|
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
102
|
}),
|
|
106
|
-
bar:
|
|
103
|
+
bar: Object.assign({
|
|
107
104
|
style: {
|
|
108
105
|
data: {
|
|
109
106
|
fill: blueGrey700,
|
|
@@ -113,14 +110,14 @@ export var material = {
|
|
|
113
110
|
labels: baseLabelStyles
|
|
114
111
|
}
|
|
115
112
|
}, baseProps),
|
|
116
|
-
boxplot:
|
|
113
|
+
boxplot: Object.assign({
|
|
117
114
|
style: {
|
|
118
115
|
max: {
|
|
119
116
|
padding: padding,
|
|
120
117
|
stroke: blueGrey700,
|
|
121
118
|
strokeWidth: 1
|
|
122
119
|
},
|
|
123
|
-
maxLabels:
|
|
120
|
+
maxLabels: Object.assign({}, baseLabelStyles, {
|
|
124
121
|
padding: 3
|
|
125
122
|
}),
|
|
126
123
|
median: {
|
|
@@ -128,7 +125,7 @@ export var material = {
|
|
|
128
125
|
stroke: blueGrey700,
|
|
129
126
|
strokeWidth: 1
|
|
130
127
|
},
|
|
131
|
-
medianLabels:
|
|
128
|
+
medianLabels: Object.assign({}, baseLabelStyles, {
|
|
132
129
|
padding: 3
|
|
133
130
|
}),
|
|
134
131
|
min: {
|
|
@@ -136,32 +133,32 @@ export var material = {
|
|
|
136
133
|
stroke: blueGrey700,
|
|
137
134
|
strokeWidth: 1
|
|
138
135
|
},
|
|
139
|
-
minLabels:
|
|
136
|
+
minLabels: Object.assign({}, baseLabelStyles, {
|
|
140
137
|
padding: 3
|
|
141
138
|
}),
|
|
142
139
|
q1: {
|
|
143
140
|
padding: padding,
|
|
144
141
|
fill: blueGrey700
|
|
145
142
|
},
|
|
146
|
-
q1Labels:
|
|
143
|
+
q1Labels: Object.assign({}, baseLabelStyles, {
|
|
147
144
|
padding: 3
|
|
148
145
|
}),
|
|
149
146
|
q3: {
|
|
150
147
|
padding: padding,
|
|
151
148
|
fill: blueGrey700
|
|
152
149
|
},
|
|
153
|
-
q3Labels:
|
|
150
|
+
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
154
151
|
padding: 3
|
|
155
152
|
})
|
|
156
153
|
},
|
|
157
154
|
boxWidth: 20
|
|
158
155
|
}, baseProps),
|
|
159
|
-
candlestick:
|
|
156
|
+
candlestick: Object.assign({
|
|
160
157
|
style: {
|
|
161
158
|
data: {
|
|
162
159
|
stroke: blueGrey700
|
|
163
160
|
},
|
|
164
|
-
labels:
|
|
161
|
+
labels: Object.assign({}, baseLabelStyles, {
|
|
165
162
|
padding: 5
|
|
166
163
|
})
|
|
167
164
|
},
|
|
@@ -171,7 +168,7 @@ export var material = {
|
|
|
171
168
|
}
|
|
172
169
|
}, baseProps),
|
|
173
170
|
chart: baseProps,
|
|
174
|
-
errorbar:
|
|
171
|
+
errorbar: Object.assign({
|
|
175
172
|
borderWidth: 8,
|
|
176
173
|
style: {
|
|
177
174
|
data: {
|
|
@@ -183,10 +180,10 @@ export var material = {
|
|
|
183
180
|
labels: baseLabelStyles
|
|
184
181
|
}
|
|
185
182
|
}, baseProps),
|
|
186
|
-
group:
|
|
183
|
+
group: Object.assign({
|
|
187
184
|
colorScale: colors
|
|
188
185
|
}, baseProps),
|
|
189
|
-
histogram:
|
|
186
|
+
histogram: Object.assign({
|
|
190
187
|
style: {
|
|
191
188
|
data: {
|
|
192
189
|
fill: blueGrey700,
|
|
@@ -206,12 +203,12 @@ export var material = {
|
|
|
206
203
|
type: "circle"
|
|
207
204
|
},
|
|
208
205
|
labels: baseLabelStyles,
|
|
209
|
-
title:
|
|
206
|
+
title: Object.assign({}, baseLabelStyles, {
|
|
210
207
|
padding: 5
|
|
211
208
|
})
|
|
212
209
|
}
|
|
213
210
|
},
|
|
214
|
-
line:
|
|
211
|
+
line: Object.assign({
|
|
215
212
|
style: {
|
|
216
213
|
data: {
|
|
217
214
|
fill: "transparent",
|
|
@@ -222,7 +219,7 @@ export var material = {
|
|
|
222
219
|
labels: baseLabelStyles
|
|
223
220
|
}
|
|
224
221
|
}, baseProps),
|
|
225
|
-
pie:
|
|
222
|
+
pie: Object.assign({
|
|
226
223
|
colorScale: colors,
|
|
227
224
|
style: {
|
|
228
225
|
data: {
|
|
@@ -230,12 +227,12 @@ export var material = {
|
|
|
230
227
|
stroke: blueGrey50,
|
|
231
228
|
strokeWidth: 1
|
|
232
229
|
},
|
|
233
|
-
labels:
|
|
230
|
+
labels: Object.assign({}, baseLabelStyles, {
|
|
234
231
|
padding: 20
|
|
235
232
|
})
|
|
236
233
|
}
|
|
237
234
|
}, baseProps),
|
|
238
|
-
scatter:
|
|
235
|
+
scatter: Object.assign({
|
|
239
236
|
style: {
|
|
240
237
|
data: {
|
|
241
238
|
fill: blueGrey700,
|
|
@@ -246,11 +243,11 @@ export var material = {
|
|
|
246
243
|
labels: baseLabelStyles
|
|
247
244
|
}
|
|
248
245
|
}, baseProps),
|
|
249
|
-
stack:
|
|
246
|
+
stack: Object.assign({
|
|
250
247
|
colorScale: colors
|
|
251
248
|
}, baseProps),
|
|
252
249
|
tooltip: {
|
|
253
|
-
style:
|
|
250
|
+
style: Object.assign({}, baseLabelStyles, {
|
|
254
251
|
padding: 0,
|
|
255
252
|
pointerEvents: "none"
|
|
256
253
|
}),
|
|
@@ -264,14 +261,14 @@ export var material = {
|
|
|
264
261
|
cornerRadius: 5,
|
|
265
262
|
pointerLength: 10
|
|
266
263
|
},
|
|
267
|
-
voronoi:
|
|
264
|
+
voronoi: Object.assign({
|
|
268
265
|
style: {
|
|
269
266
|
data: {
|
|
270
267
|
fill: "transparent",
|
|
271
268
|
stroke: "transparent",
|
|
272
269
|
strokeWidth: 0
|
|
273
270
|
},
|
|
274
|
-
labels:
|
|
271
|
+
labels: Object.assign({}, baseLabelStyles, {
|
|
275
272
|
padding: 5,
|
|
276
273
|
pointerEvents: "none"
|
|
277
274
|
}),
|
|
@@ -6,7 +6,6 @@ import _isFunction from "lodash/isFunction";
|
|
|
6
6
|
import _isEmpty from "lodash/isEmpty";
|
|
7
7
|
import _difference from "lodash/difference";
|
|
8
8
|
import _defaults from "lodash/defaults";
|
|
9
|
-
import _assign from "lodash/assign";
|
|
10
9
|
|
|
11
10
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
11
|
|
|
@@ -327,7 +326,7 @@ export function addEvents(WrappedComponent) {
|
|
|
327
326
|
|
|
328
327
|
var events = _defaults({}, Events.getPartialEvents(baseEvents, key, componentProps), componentProps.events);
|
|
329
328
|
|
|
330
|
-
return
|
|
329
|
+
return Object.assign({}, componentProps, {
|
|
331
330
|
events: events
|
|
332
331
|
});
|
|
333
332
|
}
|
package/es/victory-util/axis.js
CHANGED
|
@@ -2,14 +2,12 @@ import _without from "lodash/without";
|
|
|
2
2
|
import _includes from "lodash/includes";
|
|
3
3
|
import _values from "lodash/values";
|
|
4
4
|
import _orderBy from "lodash/orderBy";
|
|
5
|
-
import _range from "lodash/range";
|
|
6
5
|
import _uniq from "lodash/uniq";
|
|
7
6
|
import _invert from "lodash/invert";
|
|
8
7
|
import _isObject from "lodash/isObject";
|
|
9
8
|
import _isFunction from "lodash/isFunction";
|
|
10
9
|
import _identity from "lodash/identity";
|
|
11
10
|
import _defaults from "lodash/defaults";
|
|
12
|
-
import _assign from "lodash/assign";
|
|
13
11
|
|
|
14
12
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
15
13
|
|
|
@@ -221,7 +219,7 @@ function getTickArray(props) {
|
|
|
221
219
|
if (tickValues && Collection.containsStrings(tickValues)) {
|
|
222
220
|
ticks = stringMap ? tickValues.map(function (tick) {
|
|
223
221
|
return stringMap[tick];
|
|
224
|
-
}) :
|
|
222
|
+
}) : Helpers.range(1, tickValues.length + 1);
|
|
225
223
|
}
|
|
226
224
|
|
|
227
225
|
var tickArray = ticks ? _uniq(ticks) : getTicksFromFormat();
|
|
@@ -430,11 +428,10 @@ export function modifyProps(props, fallbackProps) {
|
|
|
430
428
|
|
|
431
429
|
var axisTheme = _defaults({}, props.theme[role], props.theme.axis);
|
|
432
430
|
|
|
433
|
-
var theme =
|
|
431
|
+
var theme = Object.assign({}, props.theme, {
|
|
434
432
|
axis: axisTheme
|
|
435
433
|
});
|
|
436
|
-
|
|
437
|
-
return Helpers.modifyProps(_assign({}, props, {
|
|
434
|
+
return Helpers.modifyProps(Object.assign({}, props, {
|
|
438
435
|
theme: theme
|
|
439
436
|
}), fallbackProps, "axis");
|
|
440
437
|
}
|
package/es/victory-util/data.js
CHANGED
|
@@ -8,9 +8,7 @@ import _property from "lodash/property";
|
|
|
8
8
|
import _isPlainObject from "lodash/isPlainObject";
|
|
9
9
|
import _isFunction from "lodash/isFunction";
|
|
10
10
|
import _last from "lodash/last";
|
|
11
|
-
import _range from "lodash/range";
|
|
12
11
|
import _uniq from "lodash/uniq";
|
|
13
|
-
import _assign from "lodash/assign";
|
|
14
12
|
|
|
15
13
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
16
14
|
|
|
@@ -51,9 +49,7 @@ function generateDataArray(props, axis) {
|
|
|
51
49
|
var domainMax = Math.max.apply(Math, _toConsumableArray(domain));
|
|
52
50
|
var domainMin = Math.min.apply(Math, _toConsumableArray(domain));
|
|
53
51
|
var step = (domainMax - domainMin) / samples;
|
|
54
|
-
|
|
55
|
-
var values = _range(domainMin, domainMax, step);
|
|
56
|
-
|
|
52
|
+
var values = Helpers.range(domainMin, domainMax, step);
|
|
57
53
|
return _last(values) === domainMax ? values : values.concat(domainMax);
|
|
58
54
|
} // Returns sorted data. If no sort keys are provided, data is returned unaltered.
|
|
59
55
|
|
|
@@ -99,7 +95,7 @@ function cleanData(dataset, props) {
|
|
|
99
95
|
|
|
100
96
|
var _y0 = rules(datum, "y0") ? datum._y0 : smallNumber;
|
|
101
97
|
|
|
102
|
-
return
|
|
98
|
+
return Object.assign({}, datum, {
|
|
103
99
|
_x: _x,
|
|
104
100
|
_y: _y,
|
|
105
101
|
_y0: _y0
|
|
@@ -140,7 +136,7 @@ function addEventKeys(props, data) {
|
|
|
140
136
|
return datum;
|
|
141
137
|
} else if (hasEventKeyAccessor) {
|
|
142
138
|
var eventKey = eventKeyAccessor(datum, index);
|
|
143
|
-
return eventKey !== undefined ?
|
|
139
|
+
return eventKey !== undefined ? Object.assign({
|
|
144
140
|
eventKey: eventKey
|
|
145
141
|
}, datum) : datum;
|
|
146
142
|
}
|
|
@@ -196,7 +192,7 @@ export function formatDataFromDomain(dataset, domain, defaultBaseline) {
|
|
|
196
192
|
if (isUnderMinY(baseline) && !isUnderMinY(value)) _y0 = minDomainY; // baseline and value with only baseline above max, set baseline to maxDomainY
|
|
197
193
|
|
|
198
194
|
if (isOverMaxY(baseline) && !isOverMaxY(value)) _y0 = maxDomainY;
|
|
199
|
-
return
|
|
195
|
+
return Object.assign({}, datum, _omitBy({
|
|
200
196
|
_x: _x,
|
|
201
197
|
_y: _y,
|
|
202
198
|
_y0: _y0,
|
|
@@ -312,8 +308,7 @@ export function formatData(dataset, props, expectedKeys) {
|
|
|
312
308
|
|
|
313
309
|
return memo;
|
|
314
310
|
}, {});
|
|
315
|
-
|
|
316
|
-
var formattedDatum = _assign({}, processedValues, parsedDatum);
|
|
311
|
+
var formattedDatum = Object.assign({}, processedValues, parsedDatum);
|
|
317
312
|
|
|
318
313
|
if (!_isEmpty(formattedDatum)) {
|
|
319
314
|
dataArr.push(formattedDatum);
|
|
@@ -6,7 +6,6 @@ import _pickBy from "lodash/pickBy";
|
|
|
6
6
|
import _without from "lodash/without";
|
|
7
7
|
import _isFunction from "lodash/isFunction";
|
|
8
8
|
import _isEmpty from "lodash/isEmpty";
|
|
9
|
-
import _assign from "lodash/assign";
|
|
10
9
|
|
|
11
10
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
11
|
|
|
@@ -66,7 +65,7 @@ getScopedEvents) {
|
|
|
66
65
|
|
|
67
66
|
var selectedEvents = getSelectedEvents();
|
|
68
67
|
return Array.isArray(selectedEvents) && selectedEvents.reduce(function (memo, event) {
|
|
69
|
-
return event ?
|
|
68
|
+
return event ? Object.assign(memo, event.eventHandlers) : memo;
|
|
70
69
|
}, {});
|
|
71
70
|
};
|
|
72
71
|
/* Returns all events from props and defaultEvents from components. Events handlers
|
|
@@ -99,7 +98,7 @@ getScopedEvents) {
|
|
|
99
98
|
|
|
100
99
|
var getSharedEvents = props.sharedEvents.getEvents;
|
|
101
100
|
var sharedEvents = props.sharedEvents.events && getSharedEvents(getEventsByTarget(props.sharedEvents.events), target);
|
|
102
|
-
return
|
|
101
|
+
return Object.assign({}, sharedEvents, ownEvents);
|
|
103
102
|
}
|
|
104
103
|
/* Returns a modified events object where each event handler is replaced by a new
|
|
105
104
|
* function that calls the original handler and then calls setState with the return
|
|
@@ -168,7 +167,7 @@ export function getScopedEvents(events, namespace, childType, baseProps) {
|
|
|
168
167
|
key: key,
|
|
169
168
|
target: target
|
|
170
169
|
}, "state");
|
|
171
|
-
var mutatedProps = eventReturn.mutation(
|
|
170
|
+
var mutatedProps = eventReturn.mutation(Object.assign({}, mutationTargetProps, mutationTargetState), newBaseProps);
|
|
172
171
|
var childState = baseState[childName] || {};
|
|
173
172
|
|
|
174
173
|
var filterState = function (state) {
|
|
@@ -184,35 +183,35 @@ export function getScopedEvents(events, namespace, childType, baseProps) {
|
|
|
184
183
|
};
|
|
185
184
|
|
|
186
185
|
var extendState = function (state) {
|
|
187
|
-
return target === "parent" ?
|
|
186
|
+
return target === "parent" ? Object.assign(state, _defineProperty({}, key, Object.assign(state[key] || {}, mutatedProps))) : Object.assign(state, _defineProperty({}, key, Object.assign(state[key] || {}, _defineProperty({}, target, mutatedProps))));
|
|
188
187
|
};
|
|
189
188
|
|
|
190
189
|
var updateState = function (state) {
|
|
191
190
|
return mutatedProps ? extendState(state) : filterState(state);
|
|
192
191
|
};
|
|
193
192
|
|
|
194
|
-
return childName !== undefined && childName !== null ?
|
|
193
|
+
return childName !== undefined && childName !== null ? Object.assign(baseState, _defineProperty({}, childName, updateState(childState))) : updateState(baseState);
|
|
195
194
|
}; // returns entire mutated state for a given childName
|
|
196
195
|
|
|
197
196
|
|
|
198
197
|
var getReturnByChild = function (childName) {
|
|
199
198
|
var mutationKeys = getKeys(childName);
|
|
200
199
|
return Array.isArray(mutationKeys) ? mutationKeys.reduce(function (memo, key) {
|
|
201
|
-
return
|
|
200
|
+
return Object.assign(memo, getMutationObject(key, childName));
|
|
202
201
|
}, {}) : getMutationObject(mutationKeys, childName);
|
|
203
202
|
}; // returns an entire mutated state for all children
|
|
204
203
|
|
|
205
204
|
|
|
206
205
|
var allChildNames = childNames === "all" ? _without(_keys(newBaseProps), "parent") : childNames;
|
|
207
206
|
return Array.isArray(allChildNames) ? allChildNames.reduce(function (memo, childName) {
|
|
208
|
-
return
|
|
207
|
+
return Object.assign(memo, getReturnByChild(childName));
|
|
209
208
|
}, {}) : getReturnByChild(allChildNames);
|
|
210
209
|
}; // Parses an array of event returns into a single state mutation
|
|
211
210
|
|
|
212
211
|
|
|
213
212
|
var parseEventReturn = function (eventReturn, eventKey) {
|
|
214
213
|
return Array.isArray(eventReturn) ? eventReturn.reduce(function (memo, props) {
|
|
215
|
-
return
|
|
214
|
+
return Object.assign({}, memo, parseEvent(props, eventKey));
|
|
216
215
|
}, {}) : parseEvent(eventReturn, eventKey);
|
|
217
216
|
};
|
|
218
217
|
|
|
@@ -340,7 +339,7 @@ export function getExternalMutations(mutations) {
|
|
|
340
339
|
target: "parent"
|
|
341
340
|
};
|
|
342
341
|
var mutation = getExternalMutation(mutations, keyProps, keyState, identifier);
|
|
343
|
-
memo[eventKey] = mutation !== undefined ?
|
|
342
|
+
memo[eventKey] = mutation !== undefined ? Object.assign({}, keyState, mutation) : keyState;
|
|
344
343
|
} else {
|
|
345
344
|
// use keys from both state and props so that elements not intially included in baseProps
|
|
346
345
|
// will be used. (i.e. labels)
|
|
@@ -353,7 +352,7 @@ export function getExternalMutations(mutations) {
|
|
|
353
352
|
childName: childName
|
|
354
353
|
};
|
|
355
354
|
var mutation = getExternalMutation(mutations, keyProps[target], keyState[target], identifier);
|
|
356
|
-
m[target] = mutation !== undefined ?
|
|
355
|
+
m[target] = mutation !== undefined ? Object.assign({}, keyState[target], mutation) : keyState[target];
|
|
357
356
|
return _pickBy(m, function (v) {
|
|
358
357
|
return !_isEmpty(v);
|
|
359
358
|
});
|
|
@@ -421,8 +420,8 @@ export function getExternalMutation(mutations, baseProps, baseState, identifier)
|
|
|
421
420
|
var mutationFunction = curr && _isFunction(curr.mutation) ? curr.mutation : function () {
|
|
422
421
|
return undefined;
|
|
423
422
|
};
|
|
424
|
-
var currentMutation = mutationFunction(
|
|
425
|
-
return
|
|
423
|
+
var currentMutation = mutationFunction(Object.assign({}, baseProps, baseState));
|
|
424
|
+
return Object.assign({}, memo, currentMutation);
|
|
426
425
|
}, {});
|
|
427
426
|
}
|
|
428
427
|
/* Returns an array of defaultEvents from sub-components of a given component.
|
|
@@ -453,7 +452,7 @@ export var omitGlobalEvents = function (events) {
|
|
|
453
452
|
});
|
|
454
453
|
};
|
|
455
454
|
export var emulateReactEvent = function (event) {
|
|
456
|
-
return
|
|
455
|
+
return Object.assign(event, {
|
|
457
456
|
nativeEvent: event
|
|
458
457
|
});
|
|
459
458
|
};
|
|
@@ -44,6 +44,17 @@ export declare function modifyProps(props: any, fallbackProps?: any, role?: any)
|
|
|
44
44
|
* @returns {String} the dimension appropriate for the axis given its props "x" or "y"
|
|
45
45
|
*/
|
|
46
46
|
export declare function getCurrentAxis(axis: any, horizontal: any): any;
|
|
47
|
+
/**
|
|
48
|
+
* Creates an array of numbers (positive and/or negative) progressing
|
|
49
|
+
* from start up to, but not including, end.
|
|
50
|
+
* A step of -1 is used if a negative start is specified without an end or step.
|
|
51
|
+
* If end is not specified, it's set to start with start then set to 0.
|
|
52
|
+
*
|
|
53
|
+
* @param start The length of the array to create, or the start value
|
|
54
|
+
* @param end [The end value] If this is defined, start is the start value
|
|
55
|
+
* @returns An array of the given length
|
|
56
|
+
*/
|
|
57
|
+
export declare function range(start: number, end?: number, increment?: number): number[];
|
|
47
58
|
/**
|
|
48
59
|
* @param {Array} children: an array of child components
|
|
49
60
|
* @param {Function} iteratee: a function with arguments "child", "childName", and "parent"
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _keys from "lodash/keys";
|
|
2
|
-
import _assign from "lodash/assign";
|
|
3
2
|
import _pick from "lodash/pick";
|
|
4
3
|
import _property from "lodash/property";
|
|
5
4
|
import _isFunction from "lodash/isFunction";
|
|
@@ -263,6 +262,38 @@ export function getCurrentAxis(axis, horizontal) {
|
|
|
263
262
|
var otherAxis = axis === "x" ? "y" : "x";
|
|
264
263
|
return horizontal ? otherAxis : axis;
|
|
265
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* Creates an array of numbers (positive and/or negative) progressing
|
|
267
|
+
* from start up to, but not including, end.
|
|
268
|
+
* A step of -1 is used if a negative start is specified without an end or step.
|
|
269
|
+
* If end is not specified, it's set to start with start then set to 0.
|
|
270
|
+
*
|
|
271
|
+
* @param start The length of the array to create, or the start value
|
|
272
|
+
* @param end [The end value] If this is defined, start is the start value
|
|
273
|
+
* @returns An array of the given length
|
|
274
|
+
*/
|
|
275
|
+
|
|
276
|
+
export function range(start, end, increment) {
|
|
277
|
+
// when the end index is not given, start from 0
|
|
278
|
+
var startIndex = end ? start : 0; // when the end index is not given, the end of the range is the start index
|
|
279
|
+
|
|
280
|
+
var endIndex = end ? end : start; // ensure endIndex is not a falsy value
|
|
281
|
+
|
|
282
|
+
if (!endIndex) endIndex = 0;
|
|
283
|
+
var k = endIndex - startIndex; // the value range
|
|
284
|
+
|
|
285
|
+
var length = Math.abs(k); // the length of the range
|
|
286
|
+
|
|
287
|
+
var sign = k / length || 1; // the sign of the range (negative or positive)
|
|
288
|
+
|
|
289
|
+
var inc = increment || 1; // the step size of each increment
|
|
290
|
+
// normalize the array length when dealing with floating point values
|
|
291
|
+
|
|
292
|
+
var arrayLength = Math.max(Math.ceil(length / inc), 0);
|
|
293
|
+
return Array.from(Array(arrayLength), function (_, i) {
|
|
294
|
+
return startIndex + i * sign * inc;
|
|
295
|
+
});
|
|
296
|
+
}
|
|
266
297
|
/**
|
|
267
298
|
* @param {Array} children: an array of child components
|
|
268
299
|
* @param {Function} iteratee: a function with arguments "child", "childName", and "parent"
|
|
@@ -292,11 +323,9 @@ export function reduceChildren(children, iteratee) {
|
|
|
292
323
|
var childName = child.props.name || "".concat(childRole, "-").concat(names[index]);
|
|
293
324
|
|
|
294
325
|
if (child.props && child.props.children) {
|
|
295
|
-
var childProps =
|
|
296
|
-
|
|
326
|
+
var childProps = Object.assign({}, child.props, _pick(parentProps, sharedProps));
|
|
297
327
|
var nestedChildren = child.type && child.type.role === "stack" && _isFunction(child.type.getChildren) ? child.type.getChildren(childProps) : React.Children.toArray(child.props.children).map(function (c) {
|
|
298
|
-
var nestedChildProps =
|
|
299
|
-
|
|
328
|
+
var nestedChildProps = Object.assign({}, c.props, _pick(childProps, sharedProps));
|
|
300
329
|
return /*#__PURE__*/React.cloneElement(c, nestedChildProps);
|
|
301
330
|
});
|
|
302
331
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint no-magic-numbers: ["error", { "ignore": [0, 1, 2, 2.5, 3] }]*/
|
|
2
|
+
import * as Helpers from "./helpers";
|
|
2
3
|
export function circle(x, y, size) {
|
|
3
4
|
return "M ".concat(x, ", ").concat(y, "\n m ").concat(-size, ", 0\n a ").concat(size, ", ").concat(size, " 0 1,0 ").concat(size * 2, ",0\n a ").concat(size, ", ").concat(size, " 0 1,0 ").concat(-size * 2, ",0");
|
|
4
5
|
}
|
|
@@ -62,10 +63,9 @@ export function star(x, y, size) {
|
|
|
62
63
|
var angle = Math.PI / 5; // eslint-disable-line no-magic-numbers
|
|
63
64
|
// eslint-disable-next-line no-magic-numbers
|
|
64
65
|
|
|
65
|
-
var starCoords =
|
|
66
|
+
var starCoords = Helpers.range(10).map(function (index) {
|
|
66
67
|
var length = index % 2 === 0 ? baseSize : baseSize / 2;
|
|
67
68
|
return "".concat(length * Math.sin(angle * (index + 1)) + x, ",\n ").concat(length * Math.cos(angle * (index + 1)) + y);
|
|
68
69
|
});
|
|
69
|
-
|
|
70
70
|
return "M ".concat(starCoords.join("L"), " z");
|
|
71
71
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _memoize from "lodash/memoize";
|
|
2
2
|
import _defaults from "lodash/defaults";
|
|
3
|
-
import _assign from "lodash/assign";
|
|
4
3
|
|
|
5
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
5
|
|
|
@@ -215,7 +214,7 @@ var _prepareParams = function (inputStyle, index) {
|
|
|
215
214
|
|
|
216
215
|
var style = _defaults({}, lineStyle, defaultStyle);
|
|
217
216
|
|
|
218
|
-
return
|
|
217
|
+
return Object.assign({}, style, {
|
|
219
218
|
fontFamily: style.fontFamily,
|
|
220
219
|
letterSpacing: typeof style.letterSpacing === "number" ? style.letterSpacing : convertLengthToPixels(String(style.letterSpacing), style.fontSize),
|
|
221
220
|
fontSize: typeof style.fontSize === "number" ? style.fontSize : convertLengthToPixels(String(style.fontSize))
|