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.
Files changed (218) hide show
  1. package/README.md +143 -66
  2. package/lib/commonjs/charts/candle/Candle.js +92 -177
  3. package/lib/commonjs/charts/candle/Candles.js +39 -66
  4. package/lib/commonjs/charts/candle/Chart.js +26 -37
  5. package/lib/commonjs/charts/candle/Context.js +49 -69
  6. package/lib/commonjs/charts/candle/Crosshair.js +82 -183
  7. package/lib/commonjs/charts/candle/Crosshair.js.map +1 -1
  8. package/lib/commonjs/charts/candle/CrosshairTooltip.js +61 -140
  9. package/lib/commonjs/charts/candle/DatetimeText.js +14 -19
  10. package/lib/commonjs/charts/candle/Line.js +27 -73
  11. package/lib/commonjs/charts/candle/PriceText.js +14 -19
  12. package/lib/commonjs/charts/candle/index.js +64 -67
  13. package/lib/commonjs/charts/candle/types.js +4 -4
  14. package/lib/commonjs/charts/candle/useCandleData.js +12 -9
  15. package/lib/commonjs/charts/candle/useCandlestickChart.js +7 -9
  16. package/lib/commonjs/charts/candle/useDatetime.js +18 -16
  17. package/lib/commonjs/charts/candle/usePrice.js +22 -21
  18. package/lib/commonjs/charts/candle/utils/getDomain.js +9 -5
  19. package/lib/commonjs/charts/candle/utils/getDomain.js.map +1 -1
  20. package/lib/commonjs/charts/candle/utils/getHeight.js +11 -12
  21. package/lib/commonjs/charts/candle/utils/getHeight.js.map +1 -1
  22. package/lib/commonjs/charts/candle/utils/getPrice.js +11 -12
  23. package/lib/commonjs/charts/candle/utils/getPrice.js.map +1 -1
  24. package/lib/commonjs/charts/candle/utils/getY.js +11 -12
  25. package/lib/commonjs/charts/candle/utils/getY.js.map +1 -1
  26. package/lib/commonjs/charts/candle/utils/index.js +16 -16
  27. package/lib/commonjs/charts/line/Axis.js +148 -268
  28. package/lib/commonjs/charts/line/Chart.js +62 -129
  29. package/lib/commonjs/charts/line/Chart.js.map +1 -1
  30. package/lib/commonjs/charts/line/ChartPath.js +105 -285
  31. package/lib/commonjs/charts/line/Context.js +37 -95
  32. package/lib/commonjs/charts/line/Cursor.js +74 -125
  33. package/lib/commonjs/charts/line/Cursor.js.map +1 -1
  34. package/lib/commonjs/charts/line/CursorCrosshair.js +56 -134
  35. package/lib/commonjs/charts/line/CursorCrosshair.js.map +1 -1
  36. package/lib/commonjs/charts/line/CursorLine.js +67 -152
  37. package/lib/commonjs/charts/line/CursorLine.js.map +1 -1
  38. package/lib/commonjs/charts/line/Data.js +34 -73
  39. package/lib/commonjs/charts/line/DatetimeText.js +15 -20
  40. package/lib/commonjs/charts/line/Dot.js +56 -149
  41. package/lib/commonjs/charts/line/Gradient.js +53 -124
  42. package/lib/commonjs/charts/line/Group.js +23 -54
  43. package/lib/commonjs/charts/line/Group.js.map +1 -1
  44. package/lib/commonjs/charts/line/Highlight.js +47 -115
  45. package/lib/commonjs/charts/line/HorizontalLine.js +39 -92
  46. package/lib/commonjs/charts/line/HoverTrap/index.js +7 -10
  47. package/lib/commonjs/charts/line/HoverTrap/index.web.js +43 -48
  48. package/lib/commonjs/charts/line/LineChartPathContext.js +11 -14
  49. package/lib/commonjs/charts/line/Path.js +32 -78
  50. package/lib/commonjs/charts/line/PriceText.js +36 -78
  51. package/lib/commonjs/charts/line/Tooltip.js +102 -188
  52. package/lib/commonjs/charts/line/Tooltip.js.map +1 -1
  53. package/lib/commonjs/charts/line/index.js +65 -65
  54. package/lib/commonjs/charts/line/types.js +4 -4
  55. package/lib/commonjs/charts/line/useAnimatedPath.js +22 -27
  56. package/lib/commonjs/charts/line/useCurrentY.js +17 -17
  57. package/lib/commonjs/charts/line/useDatetime.js +28 -32
  58. package/lib/commonjs/charts/line/useLineChart.js +15 -20
  59. package/lib/commonjs/charts/line/usePrice.js +26 -28
  60. package/lib/commonjs/charts/line/utils/getArea.js +14 -47
  61. package/lib/commonjs/charts/line/utils/getDomain.js +8 -5
  62. package/lib/commonjs/charts/line/utils/getDomain.js.map +1 -1
  63. package/lib/commonjs/charts/line/utils/getPath.js +14 -53
  64. package/lib/commonjs/charts/line/utils/getXPositionForCurve.js +5 -8
  65. package/lib/commonjs/charts/line/utils/index.js +19 -19
  66. package/lib/commonjs/charts/line/utils/interpolatePath.js +60 -100
  67. package/lib/commonjs/charts/line/utils/lineChartDataPropToArray.js +5 -5
  68. package/lib/commonjs/components/AnimatedText.js +29 -67
  69. package/lib/commonjs/index.js +19 -19
  70. package/lib/commonjs/types.js +2 -2
  71. package/lib/commonjs/utils/formatDatetime.js +9 -5
  72. package/lib/commonjs/utils/formatPrice.js +6 -10
  73. package/lib/commonjs/utils/index.js +13 -13
  74. package/lib/commonjs/utils/usePrevious.js +6 -8
  75. package/lib/module/charts/candle/Candle.js +76 -126
  76. package/lib/module/charts/candle/Candles.js +30 -52
  77. package/lib/module/charts/candle/Chart.js +19 -22
  78. package/lib/module/charts/candle/Context.js +29 -47
  79. package/lib/module/charts/candle/Crosshair.js +69 -142
  80. package/lib/module/charts/candle/Crosshair.js.map +1 -1
  81. package/lib/module/charts/candle/CrosshairTooltip.js +51 -101
  82. package/lib/module/charts/candle/DatetimeText.js +5 -5
  83. package/lib/module/charts/candle/Line.js +19 -37
  84. package/lib/module/charts/candle/PriceText.js +5 -5
  85. package/lib/module/charts/candle/index.js +2 -2
  86. package/lib/module/charts/candle/types.js +1 -1
  87. package/lib/module/charts/candle/useCandleData.js +7 -3
  88. package/lib/module/charts/candle/useCandlestickChart.js +1 -1
  89. package/lib/module/charts/candle/useDatetime.js +12 -10
  90. package/lib/module/charts/candle/usePrice.js +14 -12
  91. package/lib/module/charts/candle/utils/getDomain.js +6 -2
  92. package/lib/module/charts/candle/utils/getDomain.js.map +1 -1
  93. package/lib/module/charts/candle/utils/getHeight.js +8 -9
  94. package/lib/module/charts/candle/utils/getHeight.js.map +1 -1
  95. package/lib/module/charts/candle/utils/getPrice.js +8 -4
  96. package/lib/module/charts/candle/utils/getPrice.js.map +1 -1
  97. package/lib/module/charts/candle/utils/getY.js +8 -4
  98. package/lib/module/charts/candle/utils/getY.js.map +1 -1
  99. package/lib/module/charts/candle/utils/index.js +1 -1
  100. package/lib/module/charts/line/Axis.js +113 -189
  101. package/lib/module/charts/line/Chart.js +40 -73
  102. package/lib/module/charts/line/Chart.js.map +1 -1
  103. package/lib/module/charts/line/ChartPath.js +90 -238
  104. package/lib/module/charts/line/Context.js +29 -61
  105. package/lib/module/charts/line/Cursor.js +61 -82
  106. package/lib/module/charts/line/Cursor.js.map +1 -1
  107. package/lib/module/charts/line/CursorCrosshair.js +47 -99
  108. package/lib/module/charts/line/CursorCrosshair.js.map +1 -1
  109. package/lib/module/charts/line/CursorLine.js +52 -107
  110. package/lib/module/charts/line/CursorLine.js.map +1 -1
  111. package/lib/module/charts/line/Data.js +28 -41
  112. package/lib/module/charts/line/DatetimeText.js +5 -5
  113. package/lib/module/charts/line/Dot.js +39 -93
  114. package/lib/module/charts/line/Gradient.js +41 -79
  115. package/lib/module/charts/line/Group.js +14 -15
  116. package/lib/module/charts/line/Group.js.map +1 -1
  117. package/lib/module/charts/line/Highlight.js +32 -61
  118. package/lib/module/charts/line/HorizontalLine.js +27 -49
  119. package/lib/module/charts/line/HoverTrap/index.js +2 -3
  120. package/lib/module/charts/line/HoverTrap/index.web.js +34 -34
  121. package/lib/module/charts/line/LineChartPathContext.js +3 -3
  122. package/lib/module/charts/line/Path.js +20 -33
  123. package/lib/module/charts/line/PriceText.js +25 -42
  124. package/lib/module/charts/line/Tooltip.js +89 -151
  125. package/lib/module/charts/line/Tooltip.js.map +1 -1
  126. package/lib/module/charts/line/index.js +2 -2
  127. package/lib/module/charts/line/types.js +1 -1
  128. package/lib/module/charts/line/useAnimatedPath.js +16 -22
  129. package/lib/module/charts/line/useCurrentY.js +9 -4
  130. package/lib/module/charts/line/useDatetime.js +22 -26
  131. package/lib/module/charts/line/useLineChart.js +7 -10
  132. package/lib/module/charts/line/usePrice.js +20 -22
  133. package/lib/module/charts/line/utils/getArea.js +8 -15
  134. package/lib/module/charts/line/utils/getDomain.js +5 -2
  135. package/lib/module/charts/line/utils/getDomain.js.map +1 -1
  136. package/lib/module/charts/line/utils/getPath.js +8 -21
  137. package/lib/module/charts/line/utils/getXPositionForCurve.js +2 -5
  138. package/lib/module/charts/line/utils/index.js +1 -1
  139. package/lib/module/charts/line/utils/interpolatePath.js +57 -97
  140. package/lib/module/charts/line/utils/lineChartDataPropToArray.js +2 -2
  141. package/lib/module/components/AnimatedText.js +21 -25
  142. package/lib/module/index.js +1 -1
  143. package/lib/module/types.js +2 -1
  144. package/lib/module/utils/formatDatetime.js +6 -2
  145. package/lib/module/utils/formatPrice.js +3 -7
  146. package/lib/module/utils/index.js +1 -1
  147. package/lib/module/utils/usePrevious.js +1 -1
  148. package/lib/typescript/src/charts/candle/Candle.d.ts +31 -45
  149. package/lib/typescript/src/charts/candle/Candles.d.ts +13 -24
  150. package/lib/typescript/src/charts/candle/Chart.d.ts +7 -12
  151. package/lib/typescript/src/charts/candle/Context.d.ts +7 -12
  152. package/lib/typescript/src/charts/candle/Crosshair.d.ts +9 -17
  153. package/lib/typescript/src/charts/candle/CrosshairTooltip.d.ts +8 -15
  154. package/lib/typescript/src/charts/candle/DatetimeText.d.ts +9 -15
  155. package/lib/typescript/src/charts/candle/Line.d.ts +5 -10
  156. package/lib/typescript/src/charts/candle/PriceText.d.ts +7 -13
  157. package/lib/typescript/src/charts/candle/index.d.ts +13 -32
  158. package/lib/typescript/src/charts/candle/types.d.ts +16 -16
  159. package/lib/typescript/src/charts/candle/useCandleData.d.ts +1 -1
  160. package/lib/typescript/src/charts/candle/useCandlestickChart.d.ts +1 -1
  161. package/lib/typescript/src/charts/candle/useDatetime.d.ts +9 -13
  162. package/lib/typescript/src/charts/candle/usePrice.d.ts +7 -11
  163. package/lib/typescript/src/charts/candle/utils/getDomain.d.ts +1 -1
  164. package/lib/typescript/src/charts/candle/utils/getDomain.d.ts.map +1 -1
  165. package/lib/typescript/src/charts/candle/utils/getHeight.d.ts +5 -9
  166. package/lib/typescript/src/charts/candle/utils/getPrice.d.ts +5 -9
  167. package/lib/typescript/src/charts/candle/utils/getY.d.ts +5 -9
  168. package/lib/typescript/src/charts/candle/utils/index.d.ts +1 -1
  169. package/lib/typescript/src/charts/line/Axis.d.ts +14 -27
  170. package/lib/typescript/src/charts/line/Chart.d.ts +23 -33
  171. package/lib/typescript/src/charts/line/Chart.d.ts.map +1 -1
  172. package/lib/typescript/src/charts/line/ChartPath.d.ts +15 -28
  173. package/lib/typescript/src/charts/line/Context.d.ts +9 -16
  174. package/lib/typescript/src/charts/line/Cursor.d.ts +14 -22
  175. package/lib/typescript/src/charts/line/Cursor.d.ts.map +1 -1
  176. package/lib/typescript/src/charts/line/CursorCrosshair.d.ts +11 -23
  177. package/lib/typescript/src/charts/line/CursorCrosshair.d.ts.map +1 -1
  178. package/lib/typescript/src/charts/line/CursorLine.d.ts +9 -15
  179. package/lib/typescript/src/charts/line/CursorLine.d.ts.map +1 -1
  180. package/lib/typescript/src/charts/line/Data.d.ts +13 -17
  181. package/lib/typescript/src/charts/line/DatetimeText.d.ts +8 -14
  182. package/lib/typescript/src/charts/line/Dot.d.ts +25 -38
  183. package/lib/typescript/src/charts/line/Gradient.d.ts +5 -9
  184. package/lib/typescript/src/charts/line/Group.d.ts +3 -6
  185. package/lib/typescript/src/charts/line/Group.d.ts.map +1 -1
  186. package/lib/typescript/src/charts/line/Highlight.d.ts +9 -17
  187. package/lib/typescript/src/charts/line/HorizontalLine.d.ts +22 -30
  188. package/lib/typescript/src/charts/line/HoverTrap/index.d.ts +1 -1
  189. package/lib/typescript/src/charts/line/HoverTrap/index.web.d.ts +1 -1
  190. package/lib/typescript/src/charts/line/LineChartPathContext.d.ts +4 -4
  191. package/lib/typescript/src/charts/line/Path.d.ts +23 -28
  192. package/lib/typescript/src/charts/line/PriceText.d.ts +20 -28
  193. package/lib/typescript/src/charts/line/Tooltip.d.ts +20 -32
  194. package/lib/typescript/src/charts/line/index.d.ts +20 -33
  195. package/lib/typescript/src/charts/line/types.d.ts +17 -19
  196. package/lib/typescript/src/charts/line/useAnimatedPath.d.ts +7 -10
  197. package/lib/typescript/src/charts/line/useCurrentY.d.ts +2 -2
  198. package/lib/typescript/src/charts/line/useDatetime.d.ts +7 -11
  199. package/lib/typescript/src/charts/line/useLineChart.d.ts +10 -10
  200. package/lib/typescript/src/charts/line/usePrice.d.ts +7 -11
  201. package/lib/typescript/src/charts/line/utils/getArea.d.ts +9 -17
  202. package/lib/typescript/src/charts/line/utils/getDomain.d.ts +1 -1
  203. package/lib/typescript/src/charts/line/utils/getDomain.d.ts.map +1 -1
  204. package/lib/typescript/src/charts/line/utils/getPath.d.ts +11 -21
  205. package/lib/typescript/src/charts/line/utils/getXPositionForCurve.d.ts +1 -1
  206. package/lib/typescript/src/charts/line/utils/index.d.ts +1 -1
  207. package/lib/typescript/src/charts/line/utils/interpolatePath.d.ts +5 -17
  208. package/lib/typescript/src/charts/line/utils/lineChartDataPropToArray.d.ts +2 -4
  209. package/lib/typescript/src/components/AnimatedText.d.ts +4 -7
  210. package/lib/typescript/src/index.d.ts +1 -1
  211. package/lib/typescript/src/types.d.ts +4 -7
  212. package/lib/typescript/src/utils/formatDatetime.d.ts +5 -9
  213. package/lib/typescript/src/utils/formatPrice.d.ts +5 -9
  214. package/lib/typescript/src/utils/index.d.ts +1 -1
  215. package/lib/typescript/src/utils/usePrevious.d.ts +1 -1
  216. package/package.json +1 -1
  217. package/src/charts/line/CursorLine.tsx +6 -2
  218. package/src/charts/line/HorizontalLine.tsx +5 -1
@@ -1,90 +1,52 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true,
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
5
  });
6
6
  exports.AnimatedText = void 0;
7
- var _react = _interopRequireDefault(require('react'));
8
- var _reactNative = require('react-native');
9
- var _reactNativeReanimated = _interopRequireWildcard(
10
- require('react-native-reanimated')
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
- _reactNativeReanimated.default.createAnimatedComponent(
49
- _reactNative.TextInput
50
- );
51
- const AnimatedText = ({ text, style }) => {
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
- () => text.value,
55
- (data, prevData) => {
56
- // Only execute for web platform
57
- if (
58
- _reactNative.Platform.OS === 'web' &&
59
- data !== prevData &&
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__*/ _react.default.createElement(AnimatedTextInput, {
75
- underlineColorAndroid: 'transparent',
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
@@ -1,61 +1,61 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true,
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
5
  });
6
- var _candle = require('./charts/candle');
6
+ var _candle = require("./charts/candle");
7
7
  Object.keys(_candle).forEach(function (key) {
8
- if (key === 'default' || key === '__esModule') return;
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('./charts/line');
17
+ var _line = require("./charts/line");
18
18
  Object.keys(_line).forEach(function (key) {
19
- if (key === 'default' || key === '__esModule') return;
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('./components/AnimatedText');
28
+ var _AnimatedText = require("./components/AnimatedText");
29
29
  Object.keys(_AnimatedText).forEach(function (key) {
30
- if (key === 'default' || key === '__esModule') return;
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('./utils');
39
+ var _utils = require("./utils");
40
40
  Object.keys(_utils).forEach(function (key) {
41
- if (key === 'default' || key === '__esModule') return;
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('./types');
50
+ var _types = require("./types");
51
51
  Object.keys(_types).forEach(function (key) {
52
- if (key === 'default' || key === '__esModule') return;
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
@@ -1,2 +1,2 @@
1
- 'use strict';
2
- //# sourceMappingURL=types.js.map
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -1,16 +1,20 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- Object.defineProperty(exports, '__esModule', {
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({ value, locale = 'en-US', options = {} }) {
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
- 'use strict';
1
+ "use strict";
2
2
 
3
- Object.defineProperty(exports, '__esModule', {
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
- 'use strict';
1
+ "use strict";
2
2
 
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true,
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
5
  });
6
- var _formatDatetime = require('./formatDatetime');
6
+ var _formatDatetime = require("./formatDatetime");
7
7
  Object.keys(_formatDatetime).forEach(function (key) {
8
- if (key === 'default' || key === '__esModule') return;
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('./formatPrice');
17
+ var _formatPrice = require("./formatPrice");
18
18
  Object.keys(_formatPrice).forEach(function (key) {
19
- if (key === 'default' || key === '__esModule') return;
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('./usePrevious');
28
+ var _usePrevious = require("./usePrevious");
29
29
  Object.keys(_usePrevious).forEach(function (key) {
30
- if (key === 'default' || key === '__esModule') return;
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
- 'use strict';
1
+ "use strict";
2
2
 
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true,
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
5
  });
6
6
  exports.usePrevious = usePrevious;
7
- var _react = _interopRequireDefault(require('react'));
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
- props.useAnimations
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 { close, open, high, low } = candle;
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
- stroke: fill,
40
- strokeWidth: 1,
41
- direction: isPositive ? 'positive' : 'negative',
42
- x1: x + width / 2,
43
- y1: getY({
44
- maxHeight,
45
- value: low,
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
- domain,
59
- fill,
60
- high,
61
- isPositive,
62
- low,
43
+ x2: x + width / 2,
44
+ y2: getY({
63
45
  maxHeight,
64
- overrideLineProps,
65
- width,
66
- x,
67
- candle,
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
- getY({
74
- maxHeight,
75
- value: low,
76
- domain,
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
- getY({
82
- maxHeight,
83
- value: high,
84
- domain,
85
- })
86
- ),
60
+ y2: withTiming(getY({
61
+ maxHeight,
62
+ value: high,
63
+ domain
64
+ }))
87
65
  }));
88
- const rectProps = React.useMemo(
89
- () => ({
90
- width: width - margin * 2,
91
- fill: fill,
92
- direction: isPositive ? 'positive' : 'negative',
93
- x: x + margin,
94
- y: getY({
95
- maxHeight,
96
- value: max,
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
- overrideRectProps,
116
- width,
117
- x,
118
- candle,
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
- getY({
125
- maxHeight,
126
- value: max,
127
- domain,
128
- })
129
- ),
130
- height: withTiming(
131
- getHeight({
132
- maxHeight,
133
- value: max - min,
134
- domain,
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 { width, height } = React.useContext(CandlestickChartDimensionsContext);
33
- const { data, domain, step } = useCandlestickChart();
34
- return /*#__PURE__*/ React.createElement(
35
- Svg,
36
- _extends(
37
- {
38
- width: width,
39
- height: height,
40
- },
41
- props
42
- ),
43
- step > 0 &&
44
- data.map((candle, index) =>
45
- /*#__PURE__*/ React.createElement(
46
- CandlestickChartCandle,
47
- _extends(
48
- {
49
- key: index,
50
- domain: domain,
51
- margin: margin,
52
- maxHeight: height,
53
- width: step,
54
- positiveColor: positiveColor,
55
- negativeColor: negativeColor,
56
- renderRect: renderRect,
57
- renderLine: renderLine,
58
- rectProps: rectProps,
59
- lineProps: lineProps,
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