react-native-wagmi-charts 2.9.0 → 2.10.0
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/README.md +143 -66
- package/lib/commonjs/charts/candle/Candle.js +92 -177
- package/lib/commonjs/charts/candle/Candles.js +39 -66
- package/lib/commonjs/charts/candle/Chart.js +26 -37
- package/lib/commonjs/charts/candle/Context.js +49 -69
- package/lib/commonjs/charts/candle/Crosshair.js +82 -183
- package/lib/commonjs/charts/candle/Crosshair.js.map +1 -1
- package/lib/commonjs/charts/candle/CrosshairTooltip.js +61 -140
- package/lib/commonjs/charts/candle/DatetimeText.js +14 -19
- package/lib/commonjs/charts/candle/Line.js +27 -73
- package/lib/commonjs/charts/candle/PriceText.js +14 -19
- package/lib/commonjs/charts/candle/index.js +64 -67
- package/lib/commonjs/charts/candle/types.js +4 -4
- package/lib/commonjs/charts/candle/useCandleData.js +12 -9
- package/lib/commonjs/charts/candle/useCandlestickChart.js +7 -9
- package/lib/commonjs/charts/candle/useDatetime.js +18 -16
- package/lib/commonjs/charts/candle/usePrice.js +22 -21
- package/lib/commonjs/charts/candle/utils/getDomain.js +9 -5
- package/lib/commonjs/charts/candle/utils/getDomain.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getHeight.js +11 -12
- package/lib/commonjs/charts/candle/utils/getHeight.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getPrice.js +11 -12
- package/lib/commonjs/charts/candle/utils/getPrice.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getY.js +11 -12
- package/lib/commonjs/charts/candle/utils/getY.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/index.js +16 -16
- package/lib/commonjs/charts/line/Axis.js +148 -268
- package/lib/commonjs/charts/line/Chart.js +62 -129
- package/lib/commonjs/charts/line/Chart.js.map +1 -1
- package/lib/commonjs/charts/line/ChartPath.js +105 -285
- package/lib/commonjs/charts/line/Context.js +37 -95
- package/lib/commonjs/charts/line/Cursor.js +74 -125
- package/lib/commonjs/charts/line/Cursor.js.map +1 -1
- package/lib/commonjs/charts/line/CursorCrosshair.js +56 -134
- package/lib/commonjs/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/commonjs/charts/line/CursorLine.js +67 -152
- package/lib/commonjs/charts/line/CursorLine.js.map +1 -1
- package/lib/commonjs/charts/line/Data.js +34 -73
- package/lib/commonjs/charts/line/DatetimeText.js +15 -20
- package/lib/commonjs/charts/line/Dot.js +56 -149
- package/lib/commonjs/charts/line/Gradient.js +53 -124
- package/lib/commonjs/charts/line/Group.js +23 -54
- package/lib/commonjs/charts/line/Group.js.map +1 -1
- package/lib/commonjs/charts/line/Highlight.js +47 -115
- package/lib/commonjs/charts/line/HorizontalLine.js +39 -92
- package/lib/commonjs/charts/line/HoverTrap/index.js +7 -10
- package/lib/commonjs/charts/line/HoverTrap/index.web.js +43 -48
- package/lib/commonjs/charts/line/LineChartPathContext.js +11 -14
- package/lib/commonjs/charts/line/Path.js +32 -78
- package/lib/commonjs/charts/line/PriceText.js +36 -78
- package/lib/commonjs/charts/line/Tooltip.js +102 -188
- package/lib/commonjs/charts/line/Tooltip.js.map +1 -1
- package/lib/commonjs/charts/line/index.js +65 -65
- package/lib/commonjs/charts/line/types.js +4 -4
- package/lib/commonjs/charts/line/useAnimatedPath.js +22 -27
- package/lib/commonjs/charts/line/useCurrentY.js +17 -17
- package/lib/commonjs/charts/line/useDatetime.js +28 -32
- package/lib/commonjs/charts/line/useLineChart.js +15 -20
- package/lib/commonjs/charts/line/usePrice.js +26 -28
- package/lib/commonjs/charts/line/utils/getArea.js +14 -47
- package/lib/commonjs/charts/line/utils/getDomain.js +8 -5
- package/lib/commonjs/charts/line/utils/getDomain.js.map +1 -1
- package/lib/commonjs/charts/line/utils/getPath.js +14 -53
- package/lib/commonjs/charts/line/utils/getXPositionForCurve.js +5 -8
- package/lib/commonjs/charts/line/utils/index.js +19 -19
- package/lib/commonjs/charts/line/utils/interpolatePath.js +60 -100
- package/lib/commonjs/charts/line/utils/lineChartDataPropToArray.js +5 -5
- package/lib/commonjs/components/AnimatedText.js +29 -67
- package/lib/commonjs/index.js +19 -19
- package/lib/commonjs/types.js +2 -2
- package/lib/commonjs/utils/formatDatetime.js +9 -5
- package/lib/commonjs/utils/formatPrice.js +6 -10
- package/lib/commonjs/utils/index.js +13 -13
- package/lib/commonjs/utils/usePrevious.js +6 -8
- package/lib/module/charts/candle/Candle.js +76 -126
- package/lib/module/charts/candle/Candles.js +30 -52
- package/lib/module/charts/candle/Chart.js +19 -22
- package/lib/module/charts/candle/Context.js +29 -47
- package/lib/module/charts/candle/Crosshair.js +69 -142
- package/lib/module/charts/candle/Crosshair.js.map +1 -1
- package/lib/module/charts/candle/CrosshairTooltip.js +51 -101
- package/lib/module/charts/candle/DatetimeText.js +5 -5
- package/lib/module/charts/candle/Line.js +19 -37
- package/lib/module/charts/candle/PriceText.js +5 -5
- package/lib/module/charts/candle/index.js +2 -2
- package/lib/module/charts/candle/types.js +1 -1
- package/lib/module/charts/candle/useCandleData.js +7 -3
- package/lib/module/charts/candle/useCandlestickChart.js +1 -1
- package/lib/module/charts/candle/useDatetime.js +12 -10
- package/lib/module/charts/candle/usePrice.js +14 -12
- package/lib/module/charts/candle/utils/getDomain.js +6 -2
- package/lib/module/charts/candle/utils/getDomain.js.map +1 -1
- package/lib/module/charts/candle/utils/getHeight.js +8 -9
- package/lib/module/charts/candle/utils/getHeight.js.map +1 -1
- package/lib/module/charts/candle/utils/getPrice.js +8 -4
- package/lib/module/charts/candle/utils/getPrice.js.map +1 -1
- package/lib/module/charts/candle/utils/getY.js +8 -4
- package/lib/module/charts/candle/utils/getY.js.map +1 -1
- package/lib/module/charts/candle/utils/index.js +1 -1
- package/lib/module/charts/line/Axis.js +113 -189
- package/lib/module/charts/line/Chart.js +40 -73
- package/lib/module/charts/line/Chart.js.map +1 -1
- package/lib/module/charts/line/ChartPath.js +90 -238
- package/lib/module/charts/line/Context.js +29 -61
- package/lib/module/charts/line/Cursor.js +61 -82
- package/lib/module/charts/line/Cursor.js.map +1 -1
- package/lib/module/charts/line/CursorCrosshair.js +47 -99
- package/lib/module/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/module/charts/line/CursorLine.js +52 -107
- package/lib/module/charts/line/CursorLine.js.map +1 -1
- package/lib/module/charts/line/Data.js +28 -41
- package/lib/module/charts/line/DatetimeText.js +5 -5
- package/lib/module/charts/line/Dot.js +39 -93
- package/lib/module/charts/line/Gradient.js +41 -79
- package/lib/module/charts/line/Group.js +14 -15
- package/lib/module/charts/line/Group.js.map +1 -1
- package/lib/module/charts/line/Highlight.js +32 -61
- package/lib/module/charts/line/HorizontalLine.js +27 -49
- package/lib/module/charts/line/HoverTrap/index.js +2 -3
- package/lib/module/charts/line/HoverTrap/index.web.js +34 -34
- package/lib/module/charts/line/LineChartPathContext.js +3 -3
- package/lib/module/charts/line/Path.js +20 -33
- package/lib/module/charts/line/PriceText.js +25 -42
- package/lib/module/charts/line/Tooltip.js +89 -151
- package/lib/module/charts/line/Tooltip.js.map +1 -1
- package/lib/module/charts/line/index.js +2 -2
- package/lib/module/charts/line/types.js +1 -1
- package/lib/module/charts/line/useAnimatedPath.js +16 -22
- package/lib/module/charts/line/useCurrentY.js +9 -4
- package/lib/module/charts/line/useDatetime.js +22 -26
- package/lib/module/charts/line/useLineChart.js +7 -10
- package/lib/module/charts/line/usePrice.js +20 -22
- package/lib/module/charts/line/utils/getArea.js +8 -15
- package/lib/module/charts/line/utils/getDomain.js +5 -2
- package/lib/module/charts/line/utils/getDomain.js.map +1 -1
- package/lib/module/charts/line/utils/getPath.js +8 -21
- package/lib/module/charts/line/utils/getXPositionForCurve.js +2 -5
- package/lib/module/charts/line/utils/index.js +1 -1
- package/lib/module/charts/line/utils/interpolatePath.js +57 -97
- package/lib/module/charts/line/utils/lineChartDataPropToArray.js +2 -2
- package/lib/module/components/AnimatedText.js +21 -25
- package/lib/module/index.js +1 -1
- package/lib/module/types.js +2 -1
- package/lib/module/utils/formatDatetime.js +6 -2
- package/lib/module/utils/formatPrice.js +3 -7
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/usePrevious.js +1 -1
- package/lib/typescript/src/charts/candle/Candle.d.ts +31 -45
- package/lib/typescript/src/charts/candle/Candles.d.ts +13 -24
- package/lib/typescript/src/charts/candle/Chart.d.ts +7 -12
- package/lib/typescript/src/charts/candle/Context.d.ts +7 -12
- package/lib/typescript/src/charts/candle/Crosshair.d.ts +9 -17
- package/lib/typescript/src/charts/candle/CrosshairTooltip.d.ts +8 -15
- package/lib/typescript/src/charts/candle/DatetimeText.d.ts +9 -15
- package/lib/typescript/src/charts/candle/Line.d.ts +5 -10
- package/lib/typescript/src/charts/candle/PriceText.d.ts +7 -13
- package/lib/typescript/src/charts/candle/index.d.ts +13 -32
- package/lib/typescript/src/charts/candle/types.d.ts +16 -16
- package/lib/typescript/src/charts/candle/useCandleData.d.ts +1 -1
- package/lib/typescript/src/charts/candle/useCandlestickChart.d.ts +1 -1
- package/lib/typescript/src/charts/candle/useDatetime.d.ts +9 -13
- package/lib/typescript/src/charts/candle/usePrice.d.ts +7 -11
- package/lib/typescript/src/charts/candle/utils/getDomain.d.ts +1 -1
- package/lib/typescript/src/charts/candle/utils/getDomain.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/utils/getHeight.d.ts +5 -9
- package/lib/typescript/src/charts/candle/utils/getPrice.d.ts +5 -9
- package/lib/typescript/src/charts/candle/utils/getY.d.ts +5 -9
- package/lib/typescript/src/charts/candle/utils/index.d.ts +1 -1
- package/lib/typescript/src/charts/line/Axis.d.ts +14 -27
- package/lib/typescript/src/charts/line/Chart.d.ts +23 -33
- package/lib/typescript/src/charts/line/Chart.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/ChartPath.d.ts +15 -28
- package/lib/typescript/src/charts/line/Context.d.ts +9 -16
- package/lib/typescript/src/charts/line/Cursor.d.ts +14 -22
- package/lib/typescript/src/charts/line/Cursor.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/CursorCrosshair.d.ts +11 -23
- package/lib/typescript/src/charts/line/CursorCrosshair.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/CursorLine.d.ts +9 -15
- package/lib/typescript/src/charts/line/CursorLine.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Data.d.ts +13 -17
- package/lib/typescript/src/charts/line/DatetimeText.d.ts +8 -14
- package/lib/typescript/src/charts/line/Dot.d.ts +25 -38
- package/lib/typescript/src/charts/line/Gradient.d.ts +5 -9
- package/lib/typescript/src/charts/line/Group.d.ts +3 -6
- package/lib/typescript/src/charts/line/Group.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Highlight.d.ts +9 -17
- package/lib/typescript/src/charts/line/HorizontalLine.d.ts +22 -30
- package/lib/typescript/src/charts/line/HoverTrap/index.d.ts +1 -1
- package/lib/typescript/src/charts/line/HoverTrap/index.web.d.ts +1 -1
- package/lib/typescript/src/charts/line/LineChartPathContext.d.ts +4 -4
- package/lib/typescript/src/charts/line/Path.d.ts +23 -28
- package/lib/typescript/src/charts/line/PriceText.d.ts +20 -28
- package/lib/typescript/src/charts/line/Tooltip.d.ts +20 -32
- package/lib/typescript/src/charts/line/index.d.ts +20 -33
- package/lib/typescript/src/charts/line/types.d.ts +17 -19
- package/lib/typescript/src/charts/line/useAnimatedPath.d.ts +7 -10
- package/lib/typescript/src/charts/line/useCurrentY.d.ts +2 -2
- package/lib/typescript/src/charts/line/useDatetime.d.ts +7 -11
- package/lib/typescript/src/charts/line/useLineChart.d.ts +10 -10
- package/lib/typescript/src/charts/line/usePrice.d.ts +7 -11
- package/lib/typescript/src/charts/line/utils/getArea.d.ts +9 -17
- package/lib/typescript/src/charts/line/utils/getDomain.d.ts +1 -1
- package/lib/typescript/src/charts/line/utils/getDomain.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/utils/getPath.d.ts +11 -21
- package/lib/typescript/src/charts/line/utils/getXPositionForCurve.d.ts +1 -1
- package/lib/typescript/src/charts/line/utils/index.d.ts +1 -1
- package/lib/typescript/src/charts/line/utils/interpolatePath.d.ts +5 -17
- package/lib/typescript/src/charts/line/utils/lineChartDataPropToArray.d.ts +2 -4
- package/lib/typescript/src/components/AnimatedText.d.ts +4 -7
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/types.d.ts +4 -7
- package/lib/typescript/src/utils/formatDatetime.d.ts +5 -9
- package/lib/typescript/src/utils/formatPrice.d.ts +5 -9
- package/lib/typescript/src/utils/index.d.ts +1 -1
- package/lib/typescript/src/utils/usePrevious.d.ts +1 -1
- package/package.json +1 -1
- package/src/charts/line/CursorLine.tsx +6 -2
- package/src/charts/line/HorizontalLine.tsx +5 -1
|
@@ -1,90 +1,52 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
4
|
-
value: true
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AnimatedText = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require(
|
|
8
|
-
var _reactNative = require(
|
|
9
|
-
var _reactNativeReanimated = _interopRequireWildcard(
|
|
10
|
-
|
|
11
|
-
);
|
|
12
|
-
function _interopRequireWildcard(e, t) {
|
|
13
|
-
if ('function' == typeof WeakMap)
|
|
14
|
-
var r = new WeakMap(),
|
|
15
|
-
n = new WeakMap();
|
|
16
|
-
return (_interopRequireWildcard = function (e, t) {
|
|
17
|
-
if (!t && e && e.__esModule) return e;
|
|
18
|
-
var o,
|
|
19
|
-
i,
|
|
20
|
-
f = { __proto__: null, default: e };
|
|
21
|
-
if (null === e || ('object' != typeof e && 'function' != typeof e))
|
|
22
|
-
return f;
|
|
23
|
-
if ((o = t ? n : r)) {
|
|
24
|
-
if (o.has(e)) return o.get(e);
|
|
25
|
-
o.set(e, f);
|
|
26
|
-
}
|
|
27
|
-
for (const t in e)
|
|
28
|
-
'default' !== t &&
|
|
29
|
-
{}.hasOwnProperty.call(e, t) &&
|
|
30
|
-
((i =
|
|
31
|
-
(o = Object.defineProperty) &&
|
|
32
|
-
Object.getOwnPropertyDescriptor(e, t)) &&
|
|
33
|
-
(i.get || i.set)
|
|
34
|
-
? o(f, t, i)
|
|
35
|
-
: (f[t] = e[t]));
|
|
36
|
-
return f;
|
|
37
|
-
})(e, t);
|
|
38
|
-
}
|
|
39
|
-
function _interopRequireDefault(e) {
|
|
40
|
-
return e && e.__esModule ? e : { default: e };
|
|
41
|
-
}
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
42
12
|
// forked from https://github.com/wcandillon/react-native-redash/blob/master/src/ReText.tsx
|
|
43
13
|
|
|
44
14
|
_reactNativeReanimated.default.addWhitelistedNativeProps({
|
|
45
|
-
text: true
|
|
15
|
+
text: true
|
|
46
16
|
});
|
|
47
|
-
const AnimatedTextInput =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
17
|
+
const AnimatedTextInput = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.TextInput);
|
|
18
|
+
const AnimatedText = ({
|
|
19
|
+
text,
|
|
20
|
+
style
|
|
21
|
+
}) => {
|
|
52
22
|
const inputRef = _react.default.useRef(null);
|
|
53
|
-
(0, _reactNativeReanimated.useAnimatedReaction)(
|
|
54
|
-
|
|
55
|
-
(data
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
inputRef.current
|
|
61
|
-
) {
|
|
62
|
-
// @ts-expect-error - web TextInput has value property
|
|
63
|
-
inputRef.current.value = data;
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
[text]
|
|
67
|
-
);
|
|
23
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => text.value, (data, prevData) => {
|
|
24
|
+
// Only execute for web platform
|
|
25
|
+
if (_reactNative.Platform.OS === 'web' && data !== prevData && inputRef.current) {
|
|
26
|
+
// @ts-expect-error - web TextInput has value property
|
|
27
|
+
inputRef.current.value = data;
|
|
28
|
+
}
|
|
29
|
+
}, [text]);
|
|
68
30
|
const animatedProps = (0, _reactNativeReanimated.useAnimatedProps)(() => {
|
|
69
31
|
return {
|
|
70
|
-
text: text.value
|
|
32
|
+
text: text.value
|
|
71
33
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
34
|
};
|
|
73
35
|
});
|
|
74
|
-
return /*#__PURE__*/
|
|
75
|
-
underlineColorAndroid:
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(AnimatedTextInput, {
|
|
37
|
+
underlineColorAndroid: "transparent",
|
|
76
38
|
editable: false,
|
|
77
39
|
ref: _reactNative.Platform.select({
|
|
78
|
-
web: inputRef
|
|
40
|
+
web: inputRef
|
|
79
41
|
}),
|
|
80
42
|
style: [styles.text, style],
|
|
81
|
-
animatedProps: animatedProps
|
|
43
|
+
animatedProps: animatedProps
|
|
82
44
|
});
|
|
83
45
|
};
|
|
84
46
|
exports.AnimatedText = AnimatedText;
|
|
85
47
|
const styles = _reactNative.StyleSheet.create({
|
|
86
48
|
text: {
|
|
87
|
-
color: 'black'
|
|
88
|
-
}
|
|
49
|
+
color: 'black'
|
|
50
|
+
}
|
|
89
51
|
});
|
|
90
|
-
//# sourceMappingURL=AnimatedText.js.map
|
|
52
|
+
//# sourceMappingURL=AnimatedText.js.map
|
package/lib/commonjs/index.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
4
|
-
value: true
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
5
|
});
|
|
6
|
-
var _candle = require(
|
|
6
|
+
var _candle = require("./charts/candle");
|
|
7
7
|
Object.keys(_candle).forEach(function (key) {
|
|
8
|
-
if (key ===
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
9
|
if (key in exports && exports[key] === _candle[key]) return;
|
|
10
10
|
Object.defineProperty(exports, key, {
|
|
11
11
|
enumerable: true,
|
|
12
12
|
get: function () {
|
|
13
13
|
return _candle[key];
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
-
var _line = require(
|
|
17
|
+
var _line = require("./charts/line");
|
|
18
18
|
Object.keys(_line).forEach(function (key) {
|
|
19
|
-
if (key ===
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
20
|
if (key in exports && exports[key] === _line[key]) return;
|
|
21
21
|
Object.defineProperty(exports, key, {
|
|
22
22
|
enumerable: true,
|
|
23
23
|
get: function () {
|
|
24
24
|
return _line[key];
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
-
var _AnimatedText = require(
|
|
28
|
+
var _AnimatedText = require("./components/AnimatedText");
|
|
29
29
|
Object.keys(_AnimatedText).forEach(function (key) {
|
|
30
|
-
if (key ===
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
31
|
if (key in exports && exports[key] === _AnimatedText[key]) return;
|
|
32
32
|
Object.defineProperty(exports, key, {
|
|
33
33
|
enumerable: true,
|
|
34
34
|
get: function () {
|
|
35
35
|
return _AnimatedText[key];
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
-
var _utils = require(
|
|
39
|
+
var _utils = require("./utils");
|
|
40
40
|
Object.keys(_utils).forEach(function (key) {
|
|
41
|
-
if (key ===
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
42
|
if (key in exports && exports[key] === _utils[key]) return;
|
|
43
43
|
Object.defineProperty(exports, key, {
|
|
44
44
|
enumerable: true,
|
|
45
45
|
get: function () {
|
|
46
46
|
return _utils[key];
|
|
47
|
-
}
|
|
47
|
+
}
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
-
var _types = require(
|
|
50
|
+
var _types = require("./types");
|
|
51
51
|
Object.keys(_types).forEach(function (key) {
|
|
52
|
-
if (key ===
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
53
|
if (key in exports && exports[key] === _types[key]) return;
|
|
54
54
|
Object.defineProperty(exports, key, {
|
|
55
55
|
enumerable: true,
|
|
56
56
|
get: function () {
|
|
57
57
|
return _types[key];
|
|
58
|
-
}
|
|
58
|
+
}
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
-
//# sourceMappingURL=index.js.map
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
package/lib/commonjs/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=types.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
4
|
-
value: true
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.formatDatetime = formatDatetime;
|
|
7
7
|
/**
|
|
8
8
|
* @worklet
|
|
9
9
|
*/
|
|
10
|
-
function formatDatetime({
|
|
10
|
+
function formatDatetime({
|
|
11
|
+
value,
|
|
12
|
+
locale = 'en-US',
|
|
13
|
+
options = {}
|
|
14
|
+
}) {
|
|
11
15
|
'worklet';
|
|
12
16
|
|
|
13
17
|
const d = new Date(value);
|
|
14
18
|
return d.toLocaleString(locale, options);
|
|
15
19
|
}
|
|
16
|
-
//# sourceMappingURL=formatDatetime.js.map
|
|
20
|
+
//# sourceMappingURL=formatDatetime.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
4
|
-
value: true
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.formatPrice = formatPrice;
|
|
7
7
|
/**
|
|
@@ -10,7 +10,7 @@ exports.formatPrice = formatPrice;
|
|
|
10
10
|
function formatPrice({
|
|
11
11
|
value: _value,
|
|
12
12
|
defaultPrice: _defaultPrice = '',
|
|
13
|
-
precision
|
|
13
|
+
precision
|
|
14
14
|
}) {
|
|
15
15
|
'worklet';
|
|
16
16
|
|
|
@@ -22,11 +22,7 @@ function formatPrice({
|
|
|
22
22
|
if (!value) {
|
|
23
23
|
return `0.00`;
|
|
24
24
|
}
|
|
25
|
-
const decimals =
|
|
26
|
-
precision ??
|
|
27
|
-
(Number(value) < 1
|
|
28
|
-
? Math.min(8, value.toString().slice(2).search(/[^0]/g) + 3)
|
|
29
|
-
: 2);
|
|
25
|
+
const decimals = precision ?? (Number(value) < 1 ? Math.min(8, value.toString().slice(2).search(/[^0]/g) + 3) : 2);
|
|
30
26
|
let res = `${Number(value).toFixed(decimals)}`;
|
|
31
27
|
const vals = res.split('.');
|
|
32
28
|
if (vals.length > 0 && vals[0]) {
|
|
@@ -37,4 +33,4 @@ function formatPrice({
|
|
|
37
33
|
}
|
|
38
34
|
return res;
|
|
39
35
|
}
|
|
40
|
-
//# sourceMappingURL=formatPrice.js.map
|
|
36
|
+
//# sourceMappingURL=formatPrice.js.map
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
4
|
-
value: true
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
5
|
});
|
|
6
|
-
var _formatDatetime = require(
|
|
6
|
+
var _formatDatetime = require("./formatDatetime");
|
|
7
7
|
Object.keys(_formatDatetime).forEach(function (key) {
|
|
8
|
-
if (key ===
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
9
|
if (key in exports && exports[key] === _formatDatetime[key]) return;
|
|
10
10
|
Object.defineProperty(exports, key, {
|
|
11
11
|
enumerable: true,
|
|
12
12
|
get: function () {
|
|
13
13
|
return _formatDatetime[key];
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
-
var _formatPrice = require(
|
|
17
|
+
var _formatPrice = require("./formatPrice");
|
|
18
18
|
Object.keys(_formatPrice).forEach(function (key) {
|
|
19
|
-
if (key ===
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
20
|
if (key in exports && exports[key] === _formatPrice[key]) return;
|
|
21
21
|
Object.defineProperty(exports, key, {
|
|
22
22
|
enumerable: true,
|
|
23
23
|
get: function () {
|
|
24
24
|
return _formatPrice[key];
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
-
var _usePrevious = require(
|
|
28
|
+
var _usePrevious = require("./usePrevious");
|
|
29
29
|
Object.keys(_usePrevious).forEach(function (key) {
|
|
30
|
-
if (key ===
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
31
|
if (key in exports && exports[key] === _usePrevious[key]) return;
|
|
32
32
|
Object.defineProperty(exports, key, {
|
|
33
33
|
enumerable: true,
|
|
34
34
|
get: function () {
|
|
35
35
|
return _usePrevious[key];
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
-
//# sourceMappingURL=index.js.map
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
4
|
-
value: true
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.usePrevious = usePrevious;
|
|
7
|
-
var _react = _interopRequireDefault(require(
|
|
8
|
-
function _interopRequireDefault(e) {
|
|
9
|
-
return e && e.__esModule ? e : { default: e };
|
|
10
|
-
}
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
9
|
function usePrevious(value) {
|
|
12
10
|
// The ref object is a generic container whose current property is mutable ...
|
|
13
11
|
// ... and can hold any value, similar to an instance property on a class
|
|
@@ -19,4 +17,4 @@ function usePrevious(value) {
|
|
|
19
17
|
// Return previous value (happens before update in useEffect above)
|
|
20
18
|
return ref.current;
|
|
21
19
|
}
|
|
22
|
-
//# sourceMappingURL=usePrevious.js.map
|
|
20
|
+
//# sourceMappingURL=usePrevious.js.map
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import Animated, {
|
|
3
|
-
withTiming,
|
|
4
|
-
useAnimatedProps,
|
|
5
|
-
} from 'react-native-reanimated';
|
|
2
|
+
import Animated, { withTiming, useAnimatedProps } from 'react-native-reanimated';
|
|
6
3
|
import { Line, Rect } from 'react-native-svg';
|
|
7
4
|
import { getY, getHeight } from './utils';
|
|
8
5
|
const AnimatedRect = Animated.createAnimatedComponent(Rect);
|
|
@@ -19,143 +16,96 @@ export const CandlestickChartCandle = ({
|
|
|
19
16
|
index,
|
|
20
17
|
width,
|
|
21
18
|
useAnimations = true,
|
|
22
|
-
renderLine = (props)
|
|
23
|
-
|
|
24
|
-
? /*#__PURE__*/ React.createElement(AnimatedLine, props)
|
|
25
|
-
: /*#__PURE__*/ React.createElement(Line, props),
|
|
26
|
-
renderRect = (props) =>
|
|
27
|
-
props.useAnimations
|
|
28
|
-
? /*#__PURE__*/ React.createElement(AnimatedRect, props)
|
|
29
|
-
: /*#__PURE__*/ React.createElement(Rect, props),
|
|
19
|
+
renderLine = props => props.useAnimations ? /*#__PURE__*/React.createElement(AnimatedLine, props) : /*#__PURE__*/React.createElement(Line, props),
|
|
20
|
+
renderRect = props => props.useAnimations ? /*#__PURE__*/React.createElement(AnimatedRect, props) : /*#__PURE__*/React.createElement(Rect, props)
|
|
30
21
|
}) => {
|
|
31
|
-
const {
|
|
22
|
+
const {
|
|
23
|
+
close,
|
|
24
|
+
open,
|
|
25
|
+
high,
|
|
26
|
+
low
|
|
27
|
+
} = candle;
|
|
32
28
|
const isPositive = close > open;
|
|
33
29
|
const fill = isPositive ? positiveColor : negativeColor;
|
|
34
30
|
const x = index * width;
|
|
35
31
|
const max = Math.max(open, close);
|
|
36
32
|
const min = Math.min(open, close);
|
|
37
|
-
const lineProps = React.useMemo(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
domain,
|
|
47
|
-
}),
|
|
48
|
-
x2: x + width / 2,
|
|
49
|
-
y2: getY({
|
|
50
|
-
maxHeight,
|
|
51
|
-
value: high,
|
|
52
|
-
domain,
|
|
53
|
-
}),
|
|
54
|
-
candle: candle,
|
|
55
|
-
...overrideLineProps,
|
|
33
|
+
const lineProps = React.useMemo(() => ({
|
|
34
|
+
stroke: fill,
|
|
35
|
+
strokeWidth: 1,
|
|
36
|
+
direction: isPositive ? 'positive' : 'negative',
|
|
37
|
+
x1: x + width / 2,
|
|
38
|
+
y1: getY({
|
|
39
|
+
maxHeight,
|
|
40
|
+
value: low,
|
|
41
|
+
domain
|
|
56
42
|
}),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
fill,
|
|
60
|
-
high,
|
|
61
|
-
isPositive,
|
|
62
|
-
low,
|
|
43
|
+
x2: x + width / 2,
|
|
44
|
+
y2: getY({
|
|
63
45
|
maxHeight,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
);
|
|
46
|
+
value: high,
|
|
47
|
+
domain
|
|
48
|
+
}),
|
|
49
|
+
candle: candle,
|
|
50
|
+
...overrideLineProps
|
|
51
|
+
}), [domain, fill, high, isPositive, low, maxHeight, overrideLineProps, width, x, candle]);
|
|
70
52
|
const animatedLineProps = useAnimatedProps(() => ({
|
|
71
53
|
x1: withTiming(x + width / 2),
|
|
72
|
-
y1: withTiming(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
})
|
|
78
|
-
),
|
|
54
|
+
y1: withTiming(getY({
|
|
55
|
+
maxHeight,
|
|
56
|
+
value: low,
|
|
57
|
+
domain
|
|
58
|
+
})),
|
|
79
59
|
x2: withTiming(x + width / 2),
|
|
80
|
-
y2: withTiming(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
})
|
|
86
|
-
),
|
|
60
|
+
y2: withTiming(getY({
|
|
61
|
+
maxHeight,
|
|
62
|
+
value: high,
|
|
63
|
+
domain
|
|
64
|
+
}))
|
|
87
65
|
}));
|
|
88
|
-
const rectProps = React.useMemo(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
domain,
|
|
98
|
-
}),
|
|
99
|
-
height: getHeight({
|
|
100
|
-
maxHeight,
|
|
101
|
-
value: max - min,
|
|
102
|
-
domain,
|
|
103
|
-
}),
|
|
104
|
-
candle: candle,
|
|
105
|
-
...overrideRectProps,
|
|
66
|
+
const rectProps = React.useMemo(() => ({
|
|
67
|
+
width: width - margin * 2,
|
|
68
|
+
fill: fill,
|
|
69
|
+
direction: isPositive ? 'positive' : 'negative',
|
|
70
|
+
x: x + margin,
|
|
71
|
+
y: getY({
|
|
72
|
+
maxHeight,
|
|
73
|
+
value: max,
|
|
74
|
+
domain
|
|
106
75
|
}),
|
|
107
|
-
|
|
108
|
-
domain,
|
|
109
|
-
fill,
|
|
110
|
-
isPositive,
|
|
111
|
-
margin,
|
|
112
|
-
max,
|
|
76
|
+
height: getHeight({
|
|
113
77
|
maxHeight,
|
|
114
|
-
min,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
);
|
|
78
|
+
value: max - min,
|
|
79
|
+
domain
|
|
80
|
+
}),
|
|
81
|
+
candle: candle,
|
|
82
|
+
...overrideRectProps
|
|
83
|
+
}), [domain, fill, isPositive, margin, max, maxHeight, min, overrideRectProps, width, x, candle]);
|
|
121
84
|
const animatedRectProps = useAnimatedProps(() => ({
|
|
122
85
|
x: withTiming(x + margin),
|
|
123
|
-
y: withTiming(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
86
|
+
y: withTiming(getY({
|
|
87
|
+
maxHeight,
|
|
88
|
+
value: max,
|
|
89
|
+
domain
|
|
90
|
+
})),
|
|
91
|
+
height: withTiming(getHeight({
|
|
92
|
+
maxHeight,
|
|
93
|
+
value: max - min,
|
|
94
|
+
domain
|
|
95
|
+
}))
|
|
96
|
+
}));
|
|
97
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderLine({
|
|
98
|
+
...lineProps,
|
|
99
|
+
useAnimations,
|
|
100
|
+
...(useAnimations ? {
|
|
101
|
+
animatedProps: animatedLineProps
|
|
102
|
+
} : {})
|
|
103
|
+
}), renderRect({
|
|
104
|
+
...rectProps,
|
|
105
|
+
useAnimations,
|
|
106
|
+
...(useAnimations ? {
|
|
107
|
+
animatedProps: animatedRectProps
|
|
108
|
+
} : {})
|
|
137
109
|
}));
|
|
138
|
-
return /*#__PURE__*/ React.createElement(
|
|
139
|
-
React.Fragment,
|
|
140
|
-
null,
|
|
141
|
-
renderLine({
|
|
142
|
-
...lineProps,
|
|
143
|
-
useAnimations,
|
|
144
|
-
...(useAnimations
|
|
145
|
-
? {
|
|
146
|
-
animatedProps: animatedLineProps,
|
|
147
|
-
}
|
|
148
|
-
: {}),
|
|
149
|
-
}),
|
|
150
|
-
renderRect({
|
|
151
|
-
...rectProps,
|
|
152
|
-
useAnimations,
|
|
153
|
-
...(useAnimations
|
|
154
|
-
? {
|
|
155
|
-
animatedProps: animatedRectProps,
|
|
156
|
-
}
|
|
157
|
-
: {}),
|
|
158
|
-
})
|
|
159
|
-
);
|
|
160
110
|
};
|
|
161
|
-
//# sourceMappingURL=Candle.js.map
|
|
111
|
+
//# sourceMappingURL=Candle.js.map
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
function _extends() {
|
|
2
|
-
return (
|
|
3
|
-
(_extends = Object.assign
|
|
4
|
-
? Object.assign.bind()
|
|
5
|
-
: function (n) {
|
|
6
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
7
|
-
var t = arguments[e];
|
|
8
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
9
|
-
}
|
|
10
|
-
return n;
|
|
11
|
-
}),
|
|
12
|
-
_extends.apply(null, arguments)
|
|
13
|
-
);
|
|
14
|
-
}
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
15
2
|
import React from 'react';
|
|
16
3
|
import { Svg } from 'react-native-svg';
|
|
17
4
|
import { CandlestickChartDimensionsContext } from './Chart';
|
|
@@ -29,42 +16,33 @@ export function CandlestickChartCandles({
|
|
|
29
16
|
candleProps,
|
|
30
17
|
...props
|
|
31
18
|
}) {
|
|
32
|
-
const {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
useAnimations: useAnimations,
|
|
61
|
-
candle: candle,
|
|
62
|
-
index: index,
|
|
63
|
-
},
|
|
64
|
-
candleProps
|
|
65
|
-
)
|
|
66
|
-
)
|
|
67
|
-
)
|
|
68
|
-
);
|
|
19
|
+
const {
|
|
20
|
+
width,
|
|
21
|
+
height
|
|
22
|
+
} = React.useContext(CandlestickChartDimensionsContext);
|
|
23
|
+
const {
|
|
24
|
+
data,
|
|
25
|
+
domain,
|
|
26
|
+
step
|
|
27
|
+
} = useCandlestickChart();
|
|
28
|
+
return /*#__PURE__*/React.createElement(Svg, _extends({
|
|
29
|
+
width: width,
|
|
30
|
+
height: height
|
|
31
|
+
}, props), step > 0 && data.map((candle, index) => /*#__PURE__*/React.createElement(CandlestickChartCandle, _extends({
|
|
32
|
+
key: index,
|
|
33
|
+
domain: domain,
|
|
34
|
+
margin: margin,
|
|
35
|
+
maxHeight: height,
|
|
36
|
+
width: step,
|
|
37
|
+
positiveColor: positiveColor,
|
|
38
|
+
negativeColor: negativeColor,
|
|
39
|
+
renderRect: renderRect,
|
|
40
|
+
renderLine: renderLine,
|
|
41
|
+
rectProps: rectProps,
|
|
42
|
+
lineProps: lineProps,
|
|
43
|
+
useAnimations: useAnimations,
|
|
44
|
+
candle: candle,
|
|
45
|
+
index: index
|
|
46
|
+
}, candleProps))));
|
|
69
47
|
}
|
|
70
|
-
//# sourceMappingURL=Candles.js.map
|
|
48
|
+
//# sourceMappingURL=Candles.js.map
|