react-native-wagmi-charts 1.0.4 → 1.2.1
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/.DS_Store +0 -0
- package/.prettierrc.js +5 -0
- package/README.md +171 -121
- package/example/.DS_Store +0 -0
- package/example/README.md +32 -0
- package/example/package.json +1 -1
- package/example/src/App.tsx +32 -7
- package/example/src/CandlestickChart.tsx +23 -11
- package/example/src/LineChart.tsx +51 -20
- package/example/src/{candlestick-data.json → data/candlestick-data.json} +0 -0
- package/example/src/{candlestick-data2.json → data/candlestick-data2.json} +0 -0
- package/example/src/{line-data.json → data/line-data.json} +0 -0
- package/example/src/{line-data2.json → data/line-data2.json} +0 -0
- package/example/yarn.lock +5 -5
- package/lib/commonjs/charts/candle/Crosshair.js +6 -17
- package/lib/commonjs/charts/candle/Crosshair.js.map +1 -1
- package/lib/commonjs/charts/candle/CrosshairTooltip.js +12 -8
- package/lib/commonjs/charts/candle/CrosshairTooltip.js.map +1 -1
- package/lib/commonjs/charts/candle/DatetimeText.js +7 -8
- package/lib/commonjs/charts/candle/DatetimeText.js.map +1 -1
- package/lib/commonjs/charts/candle/Line.js.map +1 -1
- package/lib/commonjs/charts/candle/PriceText.js +7 -8
- package/lib/commonjs/charts/candle/PriceText.js.map +1 -1
- package/lib/commonjs/charts/candle/useCandleData.js.map +1 -1
- package/lib/commonjs/charts/candle/useCandlestickChart.js.map +1 -1
- package/lib/commonjs/charts/candle/useDatetime.js.map +1 -1
- package/lib/commonjs/charts/candle/usePrice.js.map +1 -1
- package/lib/commonjs/charts/candle/utils.js.map +1 -1
- package/lib/commonjs/charts/line/Chart.js.map +1 -1
- package/lib/commonjs/charts/line/Cursor.js.map +1 -1
- package/lib/commonjs/charts/line/CursorCrosshair.js +4 -3
- package/lib/commonjs/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/commonjs/charts/line/CursorLine.js +8 -1
- package/lib/commonjs/charts/line/CursorLine.js.map +1 -1
- package/lib/commonjs/charts/line/DatetimeText.js +7 -8
- package/lib/commonjs/charts/line/DatetimeText.js.map +1 -1
- package/lib/commonjs/charts/line/Path.js +13 -16
- package/lib/commonjs/charts/line/Path.js.map +1 -1
- package/lib/commonjs/charts/line/PriceText.js +7 -8
- package/lib/commonjs/charts/line/PriceText.js.map +1 -1
- package/lib/commonjs/charts/line/interpolatePath.js +600 -0
- package/lib/commonjs/charts/line/interpolatePath.js.map +1 -0
- package/lib/commonjs/charts/line/useDatetime.js.map +1 -1
- package/lib/commonjs/charts/line/usePrice.js.map +1 -1
- package/lib/commonjs/charts/line/utils.js +1 -70
- package/lib/commonjs/charts/line/utils.js.map +1 -1
- package/lib/commonjs/components/AnimatedText.js +63 -0
- package/lib/commonjs/components/AnimatedText.js.map +1 -0
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/charts/candle/Crosshair.js +7 -16
- package/lib/module/charts/candle/Crosshair.js.map +1 -1
- package/lib/module/charts/candle/CrosshairTooltip.js +10 -8
- package/lib/module/charts/candle/CrosshairTooltip.js.map +1 -1
- package/lib/module/charts/candle/DatetimeText.js +6 -7
- package/lib/module/charts/candle/DatetimeText.js.map +1 -1
- package/lib/module/charts/candle/Line.js.map +1 -1
- package/lib/module/charts/candle/PriceText.js +6 -7
- package/lib/module/charts/candle/PriceText.js.map +1 -1
- package/lib/module/charts/candle/useCandleData.js.map +1 -1
- package/lib/module/charts/candle/useCandlestickChart.js.map +1 -1
- package/lib/module/charts/candle/useDatetime.js.map +1 -1
- package/lib/module/charts/candle/usePrice.js.map +1 -1
- package/lib/module/charts/candle/utils.js.map +1 -1
- package/lib/module/charts/line/Chart.js.map +1 -1
- package/lib/module/charts/line/Cursor.js.map +1 -1
- package/lib/module/charts/line/CursorCrosshair.js +4 -3
- package/lib/module/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/module/charts/line/CursorLine.js +7 -1
- package/lib/module/charts/line/CursorLine.js.map +1 -1
- package/lib/module/charts/line/DatetimeText.js +6 -7
- package/lib/module/charts/line/DatetimeText.js.map +1 -1
- package/lib/module/charts/line/Path.js +11 -15
- package/lib/module/charts/line/Path.js.map +1 -1
- package/lib/module/charts/line/PriceText.js +6 -7
- package/lib/module/charts/line/PriceText.js.map +1 -1
- package/lib/module/charts/line/interpolatePath.js +587 -0
- package/lib/module/charts/line/interpolatePath.js.map +1 -0
- package/lib/module/charts/line/useDatetime.js.map +1 -1
- package/lib/module/charts/line/usePrice.js.map +1 -1
- package/lib/module/charts/line/utils.js +1 -66
- package/lib/module/charts/line/utils.js.map +1 -1
- package/lib/module/components/AnimatedText.js +43 -0
- package/lib/module/components/AnimatedText.js.map +1 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/src/charts/candle/Crosshair.d.ts +4 -4
- package/lib/typescript/src/charts/candle/DatetimeText.d.ts +3 -2
- package/lib/typescript/src/charts/candle/Line.d.ts +1 -1
- package/lib/typescript/src/charts/candle/PriceText.d.ts +3 -3
- package/lib/typescript/src/charts/candle/types.d.ts +8 -3
- package/lib/typescript/src/charts/candle/useCandleData.d.ts +3 -3
- package/lib/typescript/src/charts/candle/useCandlestickChart.d.ts +2 -1
- package/lib/typescript/src/charts/candle/useDatetime.d.ts +5 -7
- package/lib/typescript/src/charts/candle/usePrice.d.ts +5 -8
- package/lib/typescript/src/charts/candle/utils.d.ts +1 -1
- package/lib/typescript/src/charts/line/Chart.d.ts +1 -1
- package/lib/typescript/src/charts/line/Cursor.d.ts +1 -2
- package/lib/typescript/src/charts/line/CursorCrosshair.d.ts +3 -2
- package/lib/typescript/src/charts/line/DatetimeText.d.ts +5 -6
- package/lib/typescript/src/charts/line/Path.d.ts +17 -1
- package/lib/typescript/src/charts/line/PriceText.d.ts +3 -2
- package/lib/typescript/src/charts/line/interpolatePath.d.ts +50 -0
- package/lib/typescript/src/charts/line/useDatetime.d.ts +4 -5
- package/lib/typescript/src/charts/line/usePrice.d.ts +3 -2
- package/lib/typescript/src/charts/line/utils.d.ts +0 -13
- package/lib/typescript/src/components/AnimatedText.d.ts +9 -0
- package/lib/typescript/src/utils.d.ts +2 -4
- package/package.json +4 -4
- package/src/charts/candle/Crosshair.tsx +20 -20
- package/src/charts/candle/CrosshairTooltip.tsx +11 -4
- package/src/charts/candle/DatetimeText.tsx +5 -4
- package/src/charts/candle/Line.tsx +1 -1
- package/src/charts/candle/PriceText.tsx +5 -5
- package/src/charts/candle/types.ts +11 -3
- package/src/charts/candle/useCandleData.ts +3 -2
- package/src/charts/candle/useCandlestickChart.ts +2 -1
- package/src/charts/candle/useDatetime.ts +7 -3
- package/src/charts/candle/usePrice.ts +10 -3
- package/src/charts/candle/utils.ts +1 -1
- package/src/charts/line/Chart.tsx +1 -1
- package/src/charts/line/Cursor.tsx +7 -3
- package/src/charts/line/CursorCrosshair.tsx +4 -3
- package/src/charts/line/CursorLine.tsx +9 -1
- package/src/charts/line/DatetimeText.tsx +8 -7
- package/src/charts/line/Path.tsx +25 -21
- package/src/charts/line/PriceText.tsx +5 -4
- package/src/charts/line/interpolatePath.ts +650 -0
- package/src/charts/line/useDatetime.ts +3 -2
- package/src/charts/line/usePrice.ts +2 -1
- package/src/charts/line/utils.ts +2 -79
- package/src/components/AnimatedText.tsx +53 -0
- package/src/utils.ts +3 -3
- package/yarn.lock +5 -5
|
@@ -28,7 +28,8 @@ function LineChartCursorCrosshair({
|
|
|
28
28
|
outerSize = 32,
|
|
29
29
|
crosshairWrapperProps = {},
|
|
30
30
|
crosshairProps = {},
|
|
31
|
-
crosshairOuterProps = {}
|
|
31
|
+
crosshairOuterProps = {},
|
|
32
|
+
...props
|
|
32
33
|
}) {
|
|
33
34
|
const {
|
|
34
35
|
currentX,
|
|
@@ -46,9 +47,9 @@ function LineChartCursorCrosshair({
|
|
|
46
47
|
})
|
|
47
48
|
}]
|
|
48
49
|
}));
|
|
49
|
-
return /*#__PURE__*/React.createElement(_Cursor.LineChartCursor, {
|
|
50
|
+
return /*#__PURE__*/React.createElement(_Cursor.LineChartCursor, _extends({
|
|
50
51
|
type: "crosshair"
|
|
51
|
-
}, /*#__PURE__*/React.createElement(_reactNativeReanimated.default.View, _extends({}, crosshairWrapperProps, {
|
|
52
|
+
}, props), /*#__PURE__*/React.createElement(_reactNativeReanimated.default.View, _extends({}, crosshairWrapperProps, {
|
|
52
53
|
style: [{
|
|
53
54
|
width: outerSize,
|
|
54
55
|
height: outerSize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CursorCrosshair.tsx"],"names":["LineChartCursorCrosshair","children","color","size","outerSize","crosshairWrapperProps","crosshairProps","crosshairOuterProps","currentX","currentY","isActive","animatedCursorStyle","transform","translateX","value","translateY","scale","damping","width","height","alignItems","justifyContent","style","backgroundColor","borderRadius","opacity","position"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAKA;;AACA;;;;;;;;AAYO,SAASA,wBAAT,CAAkC;AACvCC,EAAAA,QADuC;AAEvCC,EAAAA,KAAK,GAAG,OAF+B;AAGvCC,EAAAA,IAAI,GAAG,CAHgC;AAIvCC,EAAAA,SAAS,GAAG,EAJ2B;AAKvCC,EAAAA,qBAAqB,GAAG,EALe;AAMvCC,EAAAA,cAAc,GAAG,EANsB;AAOvCC,EAAAA,mBAAmB,GAAG;
|
|
1
|
+
{"version":3,"sources":["CursorCrosshair.tsx"],"names":["LineChartCursorCrosshair","children","color","size","outerSize","crosshairWrapperProps","crosshairProps","crosshairOuterProps","props","currentX","currentY","isActive","animatedCursorStyle","transform","translateX","value","translateY","scale","damping","width","height","alignItems","justifyContent","style","backgroundColor","borderRadius","opacity","position"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAKA;;AACA;;;;;;;;AAYO,SAASA,wBAAT,CAAkC;AACvCC,EAAAA,QADuC;AAEvCC,EAAAA,KAAK,GAAG,OAF+B;AAGvCC,EAAAA,IAAI,GAAG,CAHgC;AAIvCC,EAAAA,SAAS,GAAG,EAJ2B;AAKvCC,EAAAA,qBAAqB,GAAG,EALe;AAMvCC,EAAAA,cAAc,GAAG,EANsB;AAOvCC,EAAAA,mBAAmB,GAAG,EAPiB;AAQvC,KAAGC;AARoC,CAAlC,EAS2B;AAChC,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,MAAmC,iCAAzC;AAEA,QAAMC,mBAAmB,GAAG,6CAAiB,OAAO;AAClDC,IAAAA,SAAS,EAAE,CACT;AAAEC,MAAAA,UAAU,EAAEL,QAAQ,CAACM,KAAT,GAAiBX,SAAS,GAAG;AAA3C,KADS,EAET;AAAEY,MAAAA,UAAU,EAAEN,QAAQ,CAACK,KAAT,GAAiBX,SAAS,GAAG;AAA3C,KAFS,EAGT;AACEa,MAAAA,KAAK,EAAE,uCAAWN,QAAQ,CAACI,KAAT,GAAiB,CAAjB,GAAqB,CAAhC,EAAmC;AACxCG,QAAAA,OAAO,EAAE;AAD+B,OAAnC;AADT,KAHS;AADuC,GAAP,CAAjB,CAA5B;AAYA,sBACE,oBAAC,uBAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KAAsCV,KAAtC,gBACE,oBAAC,8BAAD,CAAU,IAAV,eACMH,qBADN;AAEE,IAAA,KAAK,EAAE,CACL;AACEc,MAAAA,KAAK,EAAEf,SADT;AAEEgB,MAAAA,MAAM,EAAEhB,SAFV;AAGEiB,MAAAA,UAAU,EAAE,QAHd;AAIEC,MAAAA,cAAc,EAAE;AAJlB,KADK,EAOLV,mBAPK,EAQLP,qBAAqB,CAACkB,KARjB;AAFT,mBAaE,oBAAC,iBAAD,eACMhB,mBADN;AAEE,IAAA,KAAK,EAAE,CACL;AACEiB,MAAAA,eAAe,EAAEtB,KADnB;AAEEiB,MAAAA,KAAK,EAAEf,SAFT;AAGEgB,MAAAA,MAAM,EAAEhB,SAHV;AAIEqB,MAAAA,YAAY,EAAErB,SAJhB;AAKEsB,MAAAA,OAAO,EAAE,GALX;AAMEC,MAAAA,QAAQ,EAAE;AANZ,KADK,EASLpB,mBAAmB,CAACgB,KATf;AAFT,KAbF,eA2BE,oBAAC,iBAAD,eACMjB,cADN;AAEE,IAAA,KAAK,EAAE,CACL;AACEkB,MAAAA,eAAe,EAAEtB,KADnB;AAEEiB,MAAAA,KAAK,EAAEhB,IAFT;AAGEiB,MAAAA,MAAM,EAAEjB,IAHV;AAIEsB,MAAAA,YAAY,EAAEtB;AAJhB,KADK,EAOLG,cAAc,CAACiB,KAPV;AAFT,KA3BF,CADF,EAyCGtB,QAzCH,CADF;AA6CD","sourcesContent":["import * as React from 'react';\nimport { View, ViewProps } from 'react-native';\nimport Animated, {\n useAnimatedStyle,\n withSpring,\n} from 'react-native-reanimated';\n\nimport { LineChartCursor, LineChartCursorProps } from './Cursor';\nimport { useLineChart } from './useLineChart';\n\ntype LineChartCursorCrosshairProps = Omit<LineChartCursorProps, 'type'> & {\n children?: React.ReactNode;\n color?: string;\n size?: number;\n outerSize?: number;\n crosshairWrapperProps?: Animated.AnimateProps<ViewProps>;\n crosshairProps?: ViewProps;\n crosshairOuterProps?: ViewProps;\n};\n\nexport function LineChartCursorCrosshair({\n children,\n color = 'black',\n size = 8,\n outerSize = 32,\n crosshairWrapperProps = {},\n crosshairProps = {},\n crosshairOuterProps = {},\n ...props\n}: LineChartCursorCrosshairProps) {\n const { currentX, currentY, isActive } = useLineChart();\n\n const animatedCursorStyle = useAnimatedStyle(() => ({\n transform: [\n { translateX: currentX.value - outerSize / 2 },\n { translateY: currentY.value - outerSize / 2 },\n {\n scale: withSpring(isActive.value ? 1 : 0, {\n damping: 10,\n }),\n },\n ],\n }));\n\n return (\n <LineChartCursor type=\"crosshair\" {...props}>\n <Animated.View\n {...crosshairWrapperProps}\n style={[\n {\n width: outerSize,\n height: outerSize,\n alignItems: 'center',\n justifyContent: 'center',\n },\n animatedCursorStyle,\n crosshairWrapperProps.style,\n ]}\n >\n <View\n {...crosshairOuterProps}\n style={[\n {\n backgroundColor: color,\n width: outerSize,\n height: outerSize,\n borderRadius: outerSize,\n opacity: 0.1,\n position: 'absolute',\n },\n crosshairOuterProps.style,\n ]}\n />\n <View\n {...crosshairProps}\n style={[\n {\n backgroundColor: color,\n width: size,\n height: size,\n borderRadius: size,\n },\n crosshairProps.style,\n ]}\n />\n </Animated.View>\n {children}\n </LineChartCursor>\n );\n}\n"]}
|
|
@@ -52,7 +52,7 @@ const LineChartCursorLine = ({
|
|
|
52
52
|
}, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
53
53
|
style: vertical
|
|
54
54
|
}, /*#__PURE__*/_react.default.createElement(_reactNativeSvg.default, {
|
|
55
|
-
style:
|
|
55
|
+
style: styles.svg
|
|
56
56
|
}, /*#__PURE__*/_react.default.createElement(_reactNativeSvg.Line, _extends({
|
|
57
57
|
x1: 0,
|
|
58
58
|
y1: 0,
|
|
@@ -65,4 +65,11 @@ const LineChartCursorLine = ({
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
exports.LineChartCursorLine = LineChartCursorLine;
|
|
68
|
+
|
|
69
|
+
const styles = _reactNative.StyleSheet.create({
|
|
70
|
+
svg: { ..._reactNative.StyleSheet.absoluteFillObject,
|
|
71
|
+
// height: 100% is required for <svg /> on web
|
|
72
|
+
height: '100%'
|
|
73
|
+
}
|
|
74
|
+
});
|
|
68
75
|
//# sourceMappingURL=CursorLine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CursorLine.tsx"],"names":["LineChartCursorLine","children","color","lineProps","height","React","useContext","LineChartDimensionsContext","currentX","isActive","vertical","opacity","value","transform","translateX","StyleSheet","
|
|
1
|
+
{"version":3,"sources":["CursorLine.tsx"],"names":["LineChartCursorLine","children","color","lineProps","height","React","useContext","LineChartDimensionsContext","currentX","isActive","vertical","opacity","value","transform","translateX","styles","svg","StyleSheet","create","absoluteFillObject"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AAQO,MAAMA,mBAAmB,GAAG,CAAC;AAClCC,EAAAA,QADkC;AAElCC,EAAAA,KAAK,GAAG,MAF0B;AAGlCC,EAAAA,SAAS,GAAG;AAHsB,CAAD,KAIH;AAC9B,QAAM;AAAEC,IAAAA;AAAF,MAAaC,eAAMC,UAAN,CAAiBC,iCAAjB,CAAnB;;AACA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyB,iCAA/B;AAEA,QAAMC,QAAQ,GAAG,6CAAiB,OAAO;AACvCC,IAAAA,OAAO,EAAEF,QAAQ,CAACG,KAAT,GAAiB,CAAjB,GAAqB,CADS;AAEvCR,IAAAA,MAAM,EAAE,MAF+B;AAGvCS,IAAAA,SAAS,EAAE,CAAC;AAAEC,MAAAA,UAAU,EAAEN,QAAQ,CAACI;AAAvB,KAAD;AAH4B,GAAP,CAAjB,CAAjB;AAMA,sBACE,6BAAC,uBAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,kBACE,6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEF;AAAtB,kBACE,6BAAC,uBAAD;AAAK,IAAA,KAAK,EAAEK,MAAM,CAACC;AAAnB,kBACE,6BAAC,oBAAD;AACE,IAAA,EAAE,EAAE,CADN;AAEE,IAAA,EAAE,EAAE,CAFN;AAGE,IAAA,EAAE,EAAE,CAHN;AAIE,IAAA,EAAE,EAAEZ,MAJN;AAKE,IAAA,WAAW,EAAE,CALf;AAME,IAAA,MAAM,EAAEF,KANV;AAOE,IAAA,eAAe,EAAC;AAPlB,KAQMC,SARN,EADF,CADF,CADF,EAeGF,QAfH,CADF;AAmBD,CAjCM;;;;AAmCP,MAAMc,MAAM,GAAGE,wBAAWC,MAAX,CAAkB;AAC/BF,EAAAA,GAAG,EAAE,EACH,GAAGC,wBAAWE,kBADX;AAEH;AACAf,IAAAA,MAAM,EAAE;AAHL;AAD0B,CAAlB,CAAf","sourcesContent":["import React from 'react';\nimport { StyleSheet } from 'react-native';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport Svg, { Line as SVGLine, LineProps } from 'react-native-svg';\n\nimport { LineChartDimensionsContext } from './Chart';\nimport { LineChartCursor } from './Cursor';\nimport { useLineChart } from './useLineChart';\n\ntype LineChartCursorLineProps = {\n children?: React.ReactNode;\n color?: string;\n lineProps?: Partial<LineProps>;\n};\n\nexport const LineChartCursorLine = ({\n children,\n color = 'gray',\n lineProps = {},\n}: LineChartCursorLineProps) => {\n const { height } = React.useContext(LineChartDimensionsContext);\n const { currentX, isActive } = useLineChart();\n\n const vertical = useAnimatedStyle(() => ({\n opacity: isActive.value ? 1 : 0,\n height: '100%',\n transform: [{ translateX: currentX.value }],\n }));\n\n return (\n <LineChartCursor type=\"line\">\n <Animated.View style={vertical}>\n <Svg style={styles.svg}>\n <SVGLine\n x1={0}\n y1={0}\n x2={0}\n y2={height}\n strokeWidth={2}\n stroke={color}\n strokeDasharray=\"3 3\"\n {...lineProps}\n />\n </Svg>\n </Animated.View>\n {children}\n </LineChartCursor>\n );\n};\n\nconst styles = StyleSheet.create({\n svg: {\n ...StyleSheet.absoluteFillObject,\n // height: 100% is required for <svg /> on web\n height: '100%',\n },\n});\n"]}
|
|
@@ -7,30 +7,29 @@ exports.LineChartDatetimeText = LineChartDatetimeText;
|
|
|
7
7
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
-
var _reactNativeRedash = require("react-native-redash");
|
|
11
|
-
|
|
12
10
|
var _useDatetime = require("./useDatetime");
|
|
13
11
|
|
|
12
|
+
var _AnimatedText = require("../../components/AnimatedText");
|
|
13
|
+
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
|
|
18
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
-
|
|
20
18
|
function LineChartDatetimeText({
|
|
21
19
|
locale,
|
|
22
20
|
options,
|
|
23
21
|
format,
|
|
24
22
|
variant = 'formatted',
|
|
25
|
-
|
|
23
|
+
style
|
|
26
24
|
}) {
|
|
27
25
|
const datetime = (0, _useDatetime.useLineChartDatetime)({
|
|
28
26
|
format,
|
|
29
27
|
locale,
|
|
30
28
|
options
|
|
31
29
|
});
|
|
32
|
-
return /*#__PURE__*/React.createElement(
|
|
33
|
-
text: datetime[variant]
|
|
34
|
-
|
|
30
|
+
return /*#__PURE__*/React.createElement(_AnimatedText.AnimatedText, {
|
|
31
|
+
text: datetime[variant],
|
|
32
|
+
style: style
|
|
33
|
+
});
|
|
35
34
|
}
|
|
36
35
|
//# sourceMappingURL=DatetimeText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DatetimeText.tsx"],"names":["LineChartDatetimeText","locale","options","format","variant","
|
|
1
|
+
{"version":3,"sources":["DatetimeText.tsx"],"names":["LineChartDatetimeText","locale","options","format","variant","style","datetime"],"mappings":";;;;;;;AAAA;;AAIA;;AAEA;;;;;;AAUO,SAASA,qBAAT,CAA+B;AACpCC,EAAAA,MADoC;AAEpCC,EAAAA,OAFoC;AAGpCC,EAAAA,MAHoC;AAIpCC,EAAAA,OAAO,GAAG,WAJ0B;AAKpCC,EAAAA;AALoC,CAA/B,EAMoB;AACzB,QAAMC,QAAQ,GAAG,uCAAqB;AAAEH,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAArB,CAAjB;AACA,sBAAO,oBAAC,0BAAD;AAAc,IAAA,IAAI,EAAEI,QAAQ,CAACF,OAAD,CAA5B;AAAuC,IAAA,KAAK,EAAEC;AAA9C,IAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartDatetime } from './useDatetime';\nimport type { TFormatterFn } from 'react-native-wagmi-charts';\nimport { AnimatedText } from '../../components/AnimatedText';\n\ntype LineChartDatetimeProps = {\n locale?: string;\n options?: Intl.DateTimeFormatOptions;\n format?: TFormatterFn<number>;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartDatetimeText({\n locale,\n options,\n format,\n variant = 'formatted',\n style,\n}: LineChartDatetimeProps) {\n const datetime = useLineChartDatetime({ format, locale, options });\n return <AnimatedText text={datetime[variant]} style={style} />;\n}\n"]}
|
|
@@ -11,13 +11,13 @@ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reani
|
|
|
11
11
|
|
|
12
12
|
var _reactNativeSvg = require("react-native-svg");
|
|
13
13
|
|
|
14
|
-
var _reactNativeRedash = require("react-native-redash");
|
|
15
|
-
|
|
16
14
|
var _Chart = require("./Chart");
|
|
17
15
|
|
|
16
|
+
var _interpolatePath = _interopRequireDefault(require("./interpolatePath"));
|
|
17
|
+
|
|
18
18
|
var _utils = require("../../utils");
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
23
|
|
|
@@ -31,6 +31,7 @@ function LineChartPath({
|
|
|
31
31
|
color = 'black',
|
|
32
32
|
width = 3,
|
|
33
33
|
isInactive,
|
|
34
|
+
isTransitionEnabled = true,
|
|
34
35
|
...props
|
|
35
36
|
}) {
|
|
36
37
|
const {
|
|
@@ -38,8 +39,7 @@ function LineChartPath({
|
|
|
38
39
|
} = React.useContext(_Chart.LineChartDimensionsContext); ////////////////////////////////////////////////
|
|
39
40
|
|
|
40
41
|
const transition = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
41
|
-
const
|
|
42
|
-
const previousParsedPath = (0, _utils.usePrevious)(parsedPath);
|
|
42
|
+
const previousPath = (0, _utils.usePrevious)(path);
|
|
43
43
|
(0, _reactNativeReanimated.useAnimatedReaction)(() => {
|
|
44
44
|
return path;
|
|
45
45
|
}, (_, previous) => {
|
|
@@ -49,18 +49,15 @@ function LineChartPath({
|
|
|
49
49
|
}
|
|
50
50
|
}, [path]);
|
|
51
51
|
const animatedProps = (0, _reactNativeReanimated.useAnimatedProps)(() => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
parsedPath,
|
|
60
|
-
previousParsedPath
|
|
61
|
-
});
|
|
52
|
+
let d = path || '';
|
|
53
|
+
|
|
54
|
+
if (previousPath && isTransitionEnabled) {
|
|
55
|
+
const pathInterpolator = (0, _interpolatePath.default)(previousPath, path, null);
|
|
56
|
+
d = pathInterpolator(transition.value);
|
|
57
|
+
}
|
|
58
|
+
|
|
62
59
|
return {
|
|
63
|
-
d
|
|
60
|
+
d
|
|
64
61
|
};
|
|
65
62
|
}); ////////////////////////////////////////////////
|
|
66
63
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Path.tsx"],"names":["AnimatedPath","Animated","createAnimatedComponent","Path","LineChartPath","color","width","isInactive","props","path","React","useContext","LineChartDimensionsContext","transition","
|
|
1
|
+
{"version":3,"sources":["Path.tsx"],"names":["AnimatedPath","Animated","createAnimatedComponent","Path","LineChartPath","color","width","isInactive","isTransitionEnabled","props","path","React","useContext","LineChartDimensionsContext","transition","previousPath","_","previous","value","animatedProps","d","pathInterpolator"],"mappings":";;;;;;;AAAA;;AACA;;AAMA;;AAEA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,YAAY,GAAGC,+BAASC,uBAAT,CAAiCC,oBAAjC,CAArB;;AAwBO,SAASC,aAAT,CAAuB;AAC5BC,EAAAA,KAAK,GAAG,OADoB;AAE5BC,EAAAA,KAAK,GAAG,CAFoB;AAG5BC,EAAAA,UAH4B;AAI5BC,EAAAA,mBAAmB,GAAG,IAJM;AAK5B,KAAGC;AALyB,CAAvB,EAMgB;AACrB,QAAM;AAAEC,IAAAA;AAAF,MAAWC,KAAK,CAACC,UAAN,CAAiBC,iCAAjB,CAAjB,CADqB,CAGrB;;AAEA,QAAMC,UAAU,GAAG,2CAAe,CAAf,CAAnB;AAEA,QAAMC,YAAY,GAAG,wBAAYL,IAAZ,CAArB;AAEA,kDACE,MAAM;AACJ,WAAOA,IAAP;AACD,GAHH,EAIE,CAACM,CAAD,EAAIC,QAAJ,KAAiB;AACf,QAAIA,QAAJ,EAAc;AACZH,MAAAA,UAAU,CAACI,KAAX,GAAmB,CAAnB;AACAJ,MAAAA,UAAU,CAACI,KAAX,GAAmB,uCAAW,CAAX,CAAnB;AACD;AACF,GATH,EAUE,CAACR,IAAD,CAVF;AAaA,QAAMS,aAAa,GAAG,6CAAiB,MAAM;AAC3C,QAAIC,CAAC,GAAGV,IAAI,IAAI,EAAhB;;AACA,QAAIK,YAAY,IAAIP,mBAApB,EAAyC;AACvC,YAAMa,gBAAgB,GAAG,8BAAgBN,YAAhB,EAA8BL,IAA9B,EAAoC,IAApC,CAAzB;AACAU,MAAAA,CAAC,GAAGC,gBAAgB,CAACP,UAAU,CAACI,KAAZ,CAApB;AACD;;AACD,WAAO;AACLE,MAAAA;AADK,KAAP;AAGD,GATqB,CAAtB,CAtBqB,CAiCrB;;AAEA,sBACE,uDACE,oBAAC,YAAD;AACE,IAAA,aAAa,EAAED,aADjB;AAEE,IAAA,IAAI,EAAC,aAFP;AAGE,IAAA,MAAM,EAAEd,KAHV;AAIE,IAAA,aAAa,EAAEE,UAAU,GAAG,GAAH,GAAS,CAJpC;AAKE,IAAA,WAAW,EAAED;AALf,KAMMG,KANN,EADF,CADF;AAYD","sourcesContent":["import * as React from 'react';\nimport Animated, {\n useAnimatedProps,\n useAnimatedReaction,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport { Path, PathProps } from 'react-native-svg';\n\nimport { LineChartDimensionsContext } from './Chart';\nimport interpolatePath from './interpolatePath';\nimport { usePrevious } from '../../utils';\n\nconst AnimatedPath = Animated.createAnimatedComponent(Path);\n\nexport type LineChartPathProps = Animated.AnimateProps<PathProps> & {\n color?: string;\n width?: number;\n isInactive?: boolean;\n /**\n * Default: `true`.\n *\n * If `false`, changes in the chart's path will not animate.\n *\n * While this use case is rare, it may be useful on web, where animations might not work as well.\n *\n * **Example**\n *\n * ```tsx\n * <LineChart.Path\n * pathProps={{ isTransitionEnabled: Platform.OS !== 'web' }}\n * />\n * ```\n */\n isTransitionEnabled?: boolean;\n};\n\nexport function LineChartPath({\n color = 'black',\n width = 3,\n isInactive,\n isTransitionEnabled = true,\n ...props\n}: LineChartPathProps) {\n const { path } = React.useContext(LineChartDimensionsContext);\n\n ////////////////////////////////////////////////\n\n const transition = useSharedValue(0);\n\n const previousPath = usePrevious(path);\n\n useAnimatedReaction(\n () => {\n return path;\n },\n (_, previous) => {\n if (previous) {\n transition.value = 0;\n transition.value = withTiming(1);\n }\n },\n [path]\n );\n\n const animatedProps = useAnimatedProps(() => {\n let d = path || '';\n if (previousPath && isTransitionEnabled) {\n const pathInterpolator = interpolatePath(previousPath, path, null);\n d = pathInterpolator(transition.value);\n }\n return {\n d,\n };\n });\n\n ////////////////////////////////////////////////\n\n return (\n <>\n <AnimatedPath\n animatedProps={animatedProps}\n fill=\"transparent\"\n stroke={color}\n strokeOpacity={isInactive ? 0.2 : 1}\n strokeWidth={width}\n {...props}\n />\n </>\n );\n}\n"]}
|
|
@@ -7,28 +7,27 @@ exports.LineChartPriceText = LineChartPriceText;
|
|
|
7
7
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
-
var _reactNativeRedash = require("react-native-redash");
|
|
11
|
-
|
|
12
10
|
var _usePrice = require("./usePrice");
|
|
13
11
|
|
|
12
|
+
var _AnimatedText = require("../../components/AnimatedText");
|
|
13
|
+
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
|
|
18
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
-
|
|
20
18
|
function LineChartPriceText({
|
|
21
19
|
format,
|
|
22
20
|
precision = 2,
|
|
23
21
|
variant = 'formatted',
|
|
24
|
-
|
|
22
|
+
style
|
|
25
23
|
}) {
|
|
26
24
|
const price = (0, _usePrice.useLineChartPrice)({
|
|
27
25
|
format,
|
|
28
26
|
precision
|
|
29
27
|
});
|
|
30
|
-
return /*#__PURE__*/React.createElement(
|
|
31
|
-
text: price[variant]
|
|
32
|
-
|
|
28
|
+
return /*#__PURE__*/React.createElement(_AnimatedText.AnimatedText, {
|
|
29
|
+
text: price[variant],
|
|
30
|
+
style: style
|
|
31
|
+
});
|
|
33
32
|
}
|
|
34
33
|
//# sourceMappingURL=PriceText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PriceText.tsx"],"names":["LineChartPriceText","format","precision","variant","
|
|
1
|
+
{"version":3,"sources":["PriceText.tsx"],"names":["LineChartPriceText","format","precision","variant","style","price"],"mappings":";;;;;;;AAAA;;AAIA;;AAEA;;;;;;AASO,SAASA,kBAAT,CAA4B;AACjCC,EAAAA,MADiC;AAEjCC,EAAAA,SAAS,GAAG,CAFqB;AAGjCC,EAAAA,OAAO,GAAG,WAHuB;AAIjCC,EAAAA;AAJiC,CAA5B,EAKqB;AAC1B,QAAMC,KAAK,GAAG,iCAAkB;AAAEJ,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAlB,CAAd;AACA,sBAAO,oBAAC,0BAAD;AAAc,IAAA,IAAI,EAAEG,KAAK,CAACF,OAAD,CAAzB;AAAoC,IAAA,KAAK,EAAEC;AAA3C,IAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartPrice } from './usePrice';\nimport type { TFormatterFn } from '../candle/types';\nimport { AnimatedText } from '../../components/AnimatedText';\n\nexport type LineChartPriceTextProps = {\n format?: TFormatterFn<string>;\n precision?: number;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartPriceText({\n format,\n precision = 2,\n variant = 'formatted',\n style,\n}: LineChartPriceTextProps) {\n const price = useLineChartPrice({ format, precision });\n return <AnimatedText text={price[variant]} style={style} />;\n}\n"]}
|