@orderly.network/chart 2.0.1-alpha.3 → 2.0.1-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/tailwindcss@3.4.4_ts-node@10.9.2_@swc+core@1.4.12_@swc+helpers@0.5.15__@types+node@22.9.0_typescript@5.6.3_/node_modules/tailwindcss/lib/util/createPlugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.4_ts-node@10.9.2_@swc+core@1.4.12_@swc+helpers@0.5.15__@types+node@22.9.0_typescript@5.6.3_/node_modules/tailwindcss/lib/public/create-plugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.4_ts-node@10.9.2_@swc+core@1.4.12_@swc+helpers@0.5.15__@types+node@22.9.0_typescript@5.6.3_/node_modules/tailwindcss/plugin.js","../src/orderly/useColors.ts","../src/utils/theme.ts","../src/orderly/pnlBar.tsx","../src/orderly/customTooltip.tsx","../src/utils/yTickFormatter.ts","../src/orderly/pnlLine.tsx","../src/orderly/xAxisLabel.tsx","../src/orderly/assetLine.tsx","../src/orderly/volBar.tsx","../src/tailwindcss/theme.ts"],"names":["require_createPlugin","__commonJSMin","exports","_default","createPlugin","plugin","config","pluginFunction","configFunction","optionsFunction","options","require_create_plugin","_createPlugin","_interop_require_default","obj","require_plugin","module","useMemo","getThemeColors","root","computedStyle","convertToRGB","color","useColors","colors","themeColors","BarChart","XAxis","YAxis","ResponsiveContainer","Bar","Cell","Tooltip","CartesianGrid","ReferenceLine","Cross","Box","Flex","Text","jsx","jsxs","OrderlyChartTooltip","props","label","value","prefix","unit","coloring","dp","rm","cn","useRef","numberToHumanStyle","tickFormatter","absValue","formatted","RoundedRectangle","fill","x","y","width","height","absHeight","XAxisLabel","stroke","payload","index","containerWidth","_x","CustomizedCross","CustomTooltip","active","todayStr","PnLBarChart","invisible","widthRef","entry","LineChart","Line","PnlLineChart","dataTransfer","data","series","acc","item","AssetLineChart","opacity","tooltip","VolBarChart","isEmpty","b","maxVolume","decimal","number","decimalPlaces","abbreviations","toFixedWithoutRounding","num","fix","numStr","decimalIndex","cutoffIndex","import_plugin","chartPlugin","addComponents","addBase"],"mappings":"ygBAAA,IAAAA,EAAAC,EAAAC,GAAA,cACA,OAAO,eAAeA,EAAS,aAAc,CACzC,MAAO,EACX,CAAC,EACD,OAAO,eAAeA,EAAS,UAAW,CACtC,WAAY,GACZ,IAAK,UAAW,CACZ,OAAOC,EACX,CACJ,CAAC,EACD,SAASC,EAAaC,EAAQC,EAAQ,CAClC,MAAO,CACH,QAASD,EACT,OAAAC,CACJ,CACJ,CACAF,EAAa,YAAc,SAASG,EAAgBC,EAAiB,KAAK,CAAC,GAAI,CAC3E,IAAMC,EAAkB,SAASC,EAAS,CACtC,MAAO,CACH,UAAWA,EACX,QAASH,EAAeG,CAAO,EAC/B,OAAQF,EAAeE,CAAO,CAClC,CACJ,EACA,OAAAD,EAAgB,oBAAsB,GAGtCA,EAAgB,iBAAmBF,EACnCE,EAAgB,iBAAmBD,EAC5BC,CACX,EACA,IAAMN,GAAWC,IC/BjB,IAAAO,EAAAV,EAAAC,GAAA,cACA,OAAO,eAAeA,EAAS,aAAc,CACzC,MAAO,EACX,CAAC,EACD,OAAO,eAAeA,EAAS,UAAW,CACtC,WAAY,GACZ,IAAK,UAAW,CACZ,OAAOC,EACX,CACJ,CAAC,EACD,IAAMS,GAA8BC,GAAyB,GAA+B,EAC5F,SAASA,GAAyBC,EAAK,CACnC,OAAOA,GAAOA,EAAI,WAAaA,EAAM,CACjC,QAASA,CACb,CACJ,CACA,IAAMX,GAAWS,GAAc,UChB/B,IAAAG,EAAAd,EAAA,CAAAC,GAAAc,IAAA,kBAAIZ,EAAe,IACnBY,EAAO,SAAWZ,EAAa,WAAaA,EAAe,CAAE,QAASA,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OACxC,EAAAlG,SAAO,SAAU,CAAE,cAAAmG,EAAe,QAAAC,CAAQ,EAAG,CAC3CD,EACE,CACE,SAAU,CACR,iDAAkD,CAChD,cAAe,OACjB,EACA,gDAAiD,CAC/C,cAAe,KACjB,CACF,CACF,EACA,CACE,cAAe,EACjB,CACF,CACF,CAAC","sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nfunction createPlugin(plugin, config) {\n return {\n handler: plugin,\n config\n };\n}\ncreatePlugin.withOptions = function(pluginFunction, configFunction = ()=>({})) {\n const optionsFunction = function(options) {\n return {\n __options: options,\n handler: pluginFunction(options),\n config: configFunction(options)\n };\n };\n optionsFunction.__isOptionsFunction = true;\n // Expose plugin dependencies so that `object-hash` returns a different\n // value if anything here changes, to ensure a rebuild is triggered.\n optionsFunction.__pluginFunction = pluginFunction;\n optionsFunction.__configFunction = configFunction;\n return optionsFunction;\n};\nconst _default = createPlugin;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nconst _createPlugin = /*#__PURE__*/ _interop_require_default(require(\"../util/createPlugin\"));\nfunction _interop_require_default(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\nconst _default = _createPlugin.default;\n","let createPlugin = require('./lib/public/create-plugin')\nmodule.exports = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default\n","import { useMemo } from \"react\";\nimport { getThemeColors } from \"../utils/theme\";\n\nexport const useColors = (colors?: { profit: string; loss: string }) => {\n const _colors = useMemo(() => {\n const themeColors = getThemeColors();\n return {\n profit: colors?.profit || themeColors.profit,\n loss: colors?.loss || themeColors.loss,\n primary: themeColors.primary,\n primaryLight: themeColors.primaryLight,\n };\n }, [colors]);\n\n return _colors;\n};\n","export const getThemeColors = () => {\n const root = document.documentElement;\n const computedStyle = getComputedStyle(root);\n\n const colors = {\n primary: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-primary\")\n ),\n primaryLight: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-primary-light\")\n ),\n secondary: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-secondary\")\n ),\n success: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-success\")\n ),\n warning: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-warning\")\n ),\n danger: convertToRGB(computedStyle.getPropertyValue(\"--oui-color-danger\")),\n info: convertToRGB(computedStyle.getPropertyValue(\"--oui-color-info\")),\n loss: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-trading-loss\")\n ),\n profit: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-trading-profit\")\n ),\n };\n\n return colors;\n};\n\nconst convertToRGB = (color: string) => {\n return `rgb(${color.split(\" \").join(\",\")})`;\n};\n","import { useColors } from \"./useColors\";\nimport {\n BarChart,\n XAxis,\n YAxis,\n ResponsiveContainer,\n Bar,\n Cell,\n Tooltip,\n CartesianGrid,\n ReferenceLine,\n Cross,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { Box, cn } from \"@orderly.network/ui\";\nimport { Flex } from \"@orderly.network/ui\";\n// import { XAxisLabel } from \"./xAxisLabel\";\nimport { useRef } from \"react\";\nimport { numberToHumanStyle } from \"@orderly.network/utils\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\n\nexport type PnLChartDataItem = {\n date: string;\n pnl: number;\n};\n\nexport type PnLChartProps = {\n colors?: {\n profit: string;\n loss: string;\n };\n data: PnLChartDataItem[];\n invisible?: boolean;\n};\n\nconst RoundedRectangle = (props: any) => {\n const { fill, x, y, width, height } = props;\n\n const absHeight = Math.abs(height);\n\n return (\n <rect\n rx={2}\n x={x}\n y={height > 0 ? y : y + height}\n width={width}\n height={absHeight}\n stroke=\"none\"\n fill={fill}\n />\n );\n};\n\nexport const XAxisLabel = (props: any) => {\n const { x, y, stroke, payload, index, width, containerWidth } = props;\n\n const _x =\n index === 0\n ? 48\n : containerWidth > 0\n ? containerWidth - 10\n : width + payload.offset;\n\n return (\n <g transform={`translate(${_x},${y - 6})`}>\n <text\n x={0}\n y={0}\n dy={16}\n textAnchor={index === 0 ? \"start\" : \"end\"}\n // textAnchor={\"start\"}\n fontSize={10}\n fill={\"rgba(255,255,255,0.54)\"}\n >\n {index === 0 ? payload.value : \"Now\"}\n </text>\n </g>\n );\n};\n\nconst CustomizedCross = (props: any) => {\n const { width, height, stroke, fill } = props;\n\n return (\n // @ts-ignore\n <Cross\n // y={props.y + props.top}\n x={props.x + props.width / 2}\n top={props.top}\n height={height}\n width={1}\n stroke={\"rgba(255,255,255,0.16)\"}\n strokeDasharray={\"3 2\"}\n fill={\"none\"}\n />\n );\n};\n\nconst CustomTooltip = (props: TooltipProps<any, any>) => {\n const { active, payload, label } = props;\n\n const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? \"Now\" : label}\n value={payload[0].value}\n coloring\n />\n );\n }\n\n return null;\n};\n\nexport const PnLBarChart = (props: PnLChartProps) => {\n const { invisible } = props;\n const colors = useColors(props.colors);\n const widthRef = useRef(0);\n\n return (\n // @ts-ignore\n <ResponsiveContainer\n className={cn(invisible && \"chart-invisible\")}\n onResize={(width, height) => {\n // console.log(\"width\", width, height);\n widthRef.current = width;\n }}\n >\n {/* @ts-ignore */}\n <BarChart\n data={props.data}\n margin={{ left: -10, top: 10, right: 10, bottom: 30 }}\n >\n {!invisible && (\n // @ts-ignore\n <Tooltip\n // cursor={{ fillOpacity: 0.1 }}\n cursor={<CustomizedCross />}\n content={<CustomTooltip />}\n />\n )}\n\n <CartesianGrid vertical={false} stroke=\"#FFFFFF\" strokeOpacity={0.04} />\n <ReferenceLine y={0} stroke=\"rgba(0,0,0,0.04)\" />\n\n {!invisible && (\n // @ts-ignore\n <Bar dataKey=\"pnl\" shape={<RoundedRectangle />}>\n {props.data.map((entry, index) => {\n return (\n // @ts-ignore\n <Cell\n key={`cell-${index}`}\n fill={entry.pnl > 0 ? colors.profit : colors.loss}\n />\n );\n })}\n </Bar>\n )}\n {/* @ts-ignore */}\n <YAxis\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickFormatter={(value) => tickFormatter(value)}\n tickLine={false}\n axisLine={false}\n dataKey={\"pnl\"}\n />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n // axisLine={false}\n tickLine={false}\n interval={props.data.length - 2}\n // tick={renderQuarterTick}\n height={1}\n // scale=\"time\"\n // tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tick={<XAxisLabel containerWidth={widthRef.current} />}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.04}\n />\n </BarChart>\n </ResponsiveContainer>\n );\n};\n","import { Box, Flex, Text } from \"@orderly.network/ui\";\n\nexport const OrderlyChartTooltip = (props: {\n label: string;\n value: string | number;\n unit?: string;\n prefix?: React.ReactNode;\n titleClassName?: string;\n coloring?: boolean;\n dp?: number;\n rm?: number;\n}) => {\n const {\n label,\n value,\n prefix,\n unit = \"USDC\",\n coloring = false,\n dp,\n rm,\n } = props;\n return (\n <Box intensity={600} p={3} r=\"md\">\n <Flex direction={\"row\"} className={props.titleClassName}>\n {prefix}\n <Text.numeral\n unit={unit}\n as=\"div\"\n size=\"sm\"\n coloring={coloring}\n showIdentifier={coloring}\n unitClassName=\"oui-text-base-contrast-54 oui-ml-1\"\n weight=\"semibold\"\n rm={rm}\n dp={dp}\n >\n {value}\n </Text.numeral>\n </Flex>\n <Text size=\"2xs\" intensity={54} weight=\"semibold\">\n {label}\n </Text>\n </Box>\n );\n};\n","import { numberToHumanStyle } from \"@orderly.network/utils\";\n\nexport const tickFormatter = (value: number) => {\n let absValue = Math.abs(value);\n const dp = absValue === 0 ? 0 : absValue <= 10 ? 2 : absValue <= 100 ? 1 : 0;\n\n const formatted = numberToHumanStyle(absValue, dp);\n return value < 0 ? `-${formatted}` : formatted;\n};\n","import { useMemo, useRef } from \"react\";\nimport { getThemeColors } from \"../utils/theme\";\nimport { useColors } from \"./useColors\";\n// import { Line } from \"../line/line\";\nimport {\n LineChart,\n XAxis,\n YAxis,\n Line,\n CartesianGrid,\n ReferenceLine,\n Tooltip,\n ResponsiveContainer,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { XAxisLabel } from \"./xAxisLabel\";\nimport { numberToHumanStyle } from \"@orderly.network/utils\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\n\nexport type PnlLineChartProps = {\n colors?: {\n profit: string;\n loss: string;\n };\n data: any;\n invisible?: boolean;\n};\n\nconst CustomTooltip = (props: TooltipProps<any, any>) => {\n const { active, payload, label } = props;\n\n const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? \"Now\" : label}\n value={payload[0].value}\n coloring\n />\n );\n }\n\n return null;\n};\n\nconst PnlLineChart = (props: PnlLineChartProps) => {\n const colors = useColors(props.colors);\n\n const dataTransfer = (data: any[]) => {\n const series: any[] = [];\n\n data?.reduce((acc, item) => {\n acc += item.pnl;\n series.push({\n ...item,\n pnl: acc,\n _pnl: item.pnl,\n // date: new Date(item.date).getTime(),\n });\n return acc;\n }, 0);\n\n return series;\n };\n\n const data = useMemo(() => dataTransfer(props.data), [props.data]);\n\n return (\n // @ts-ignore\n <ResponsiveContainer className={props.invisible ? \"chart-invisible\" : \"\"}>\n {/* @ts-ignore */}\n <LineChart\n data={data}\n margin={{ top: 20, right: 10, left: -10, bottom: 0 }}\n >\n <CartesianGrid vertical={false} stroke=\"#FFFFFF\" strokeOpacity={0.04} />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n interval={props.data.length - 2}\n // tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tick={<XAxisLabel />}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.04}\n // scale={\"time\"}\n // type=\"number\"\n // range={}\n />\n {/* @ts-ignore */}\n <YAxis\n dataKey=\"pnl\"\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickLine={false}\n axisLine={false}\n tickFormatter={(value) => tickFormatter(value)}\n />\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Tooltip\n cursor={{ strokeDasharray: \"3 2\", strokeOpacity: 0.16 }}\n content={<CustomTooltip />}\n />\n )}\n\n {/* <ReferenceLine y={0} stroke=\"#000\" /> */}\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Line\n type=\"natural\"\n dataKey=\"pnl\"\n stroke={colors.primaryLight}\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n )}\n </LineChart>\n </ResponsiveContainer>\n );\n};\n\nexport { PnlLineChart };\n","export const XAxisLabel = (props: any) => {\n const { x, y, stroke, payload, index } = props;\n\n return (\n <g transform={`translate(${x},${y - 6})`}>\n <text\n x={0}\n y={0}\n dy={16}\n textAnchor=\"end\"\n fontSize={10}\n fill={\"rgba(255,255,255,0.54)\"}\n >\n {index === 0 ? payload.value : \"Now\"}\n </text>\n </g>\n );\n};\n","import { useColors } from \"./useColors\";\n// import { Line } from \"../line/line\";\nimport {\n LineChart,\n XAxis,\n YAxis,\n Line,\n CartesianGrid,\n Tooltip,\n Label,\n ResponsiveContainer,\n} from \"recharts\";\n\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { XAxisLabel } from \"./xAxisLabel\";\nimport { useRef } from \"react\";\nimport { numberToHumanStyle } from \"@orderly.network/utils\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\n\nexport type AssetChartDataItem = {\n date: string;\n account_value: number;\n};\n\nexport type PnlLineChartProps = {\n colors?: {\n profit: string;\n loss: string;\n };\n data: AssetChartDataItem[];\n invisible?: boolean;\n};\n\nconst CustomTooltip = (props: TooltipProps<any, any>) => {\n const { active, payload, label } = props;\n\n const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? \"Now\" : label}\n value={payload[0].value}\n />\n );\n }\n\n return null;\n};\n\nconst AssetLineChart = (props: PnlLineChartProps) => {\n const colors = useColors(props.colors);\n\n // const dataTransfer = (data: any[]) => {\n // const series: any[] = [];\n\n // data.reduce((acc, item) => {\n // acc += item.pnl;\n // series.push({ ...item, pnl: acc, _pnl: item.pnl });\n // return acc;\n // }, 0);\n\n // return series;\n // };\n\n // const data = useMemo(() => dataTransfer(props.data), [props.data]);\n\n return (\n // @ts-ignore\n <ResponsiveContainer className={props.invisible ? \"chart-invisible\" : \"\"}>\n {/* @ts-ignore */}\n <LineChart\n width={530}\n height={180}\n data={props.data}\n margin={{ top: 20, right: 10, left: -20, bottom: -10 }}\n >\n <CartesianGrid vertical={false} stroke=\"#FFFFFF\" strokeOpacity={0.04} />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n interval={props.data.length - 2}\n // tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tick={<XAxisLabel />}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.04}\n ></XAxis>\n {/* @ts-ignore */}\n <YAxis\n dataKey=\"account_value\"\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickLine={false}\n axisLine={false}\n tickFormatter={(value) => tickFormatter(value)}\n />\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Tooltip\n cursor={{ strokeDasharray: \"3 2\", strokeOpacity: 0.16 }}\n content={<CustomTooltip />}\n />\n )}\n\n {/* <Legend /> */}\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Line\n type=\"natural\"\n dataKey=\"account_value\"\n stroke={colors.profit}\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n )}\n </LineChart>\n </ResponsiveContainer>\n );\n};\n\nexport { AssetLineChart };\n","import { useColors } from \"./useColors\";\nimport {\n BarChart,\n XAxis,\n YAxis,\n ResponsiveContainer,\n Bar,\n Cell,\n Tooltip,\n CartesianGrid,\n ReferenceLine,\n Cross,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { Box, cn } from \"@orderly.network/ui\";\n\nexport type VolChartDataItem = {\n date: string;\n volume: number;\n opacity?: string | number;\n};\n\nexport type VolChartTooltip = {\n rm?: number;\n dp?: number;\n};\n\nexport type VolChartProps = {\n colors?: {\n fill: string;\n };\n data: VolChartDataItem[];\n tooltip?: VolChartTooltip;\n className?: string;\n};\n\nconst RoundedRectangle = (props: any) => {\n const { fill, x, y, width, height, opacity } = props;\n const absHeight = Math.abs(height);\n\n return (\n <rect\n rx={2}\n x={x}\n y={height > 0 ? y : y + height}\n width={width}\n height={absHeight}\n stroke=\"none\"\n fill={fill}\n opacity={opacity}\n />\n );\n};\n\nconst CustomizedCross = (props: any) => {\n const { width, height, payload, stroke, fill } = props;\n\n if (payload?.[0]?.value === 0) return null;\n\n return (\n // @ts-ignore\n <Cross\n // y={props.y + props.top}\n x={props.x + props.width / 2}\n top={props.top}\n height={height}\n width={1}\n stroke={\"rgba(255,255,255,0.16)\"}\n strokeDasharray={\"3 2\"}\n fill={\"none\"}\n />\n );\n};\n\nconst CustomTooltip = (\n props: TooltipProps<any, any> & { tooltip?: VolChartTooltip }\n) => {\n const { active, payload, label, tooltip } = props;\n\n if (payload?.[0]?.value === 0) return null;\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label}\n value={payload[0].value}\n // prefix=\"Commission\"\n titleClassName=\"oui-gap-4\"\n rm={tooltip?.rm}\n dp={tooltip?.dp}\n />\n );\n }\n\n return null;\n};\n\nexport const VolBarChart = (props: VolChartProps) => {\n const colors = useColors(\n props.colors?.fill\n ? { profit: props.colors?.fill, loss: props.colors?.fill }\n : undefined\n );\n\n const isEmpty = props.data.reduce((a, b) => a + b.volume, 0) === 0;\n const maxVolume = props.data.reduce((a,b) => (a > b.volume ? a : b.volume), 0);\n const decimal = maxVolume <= 10 ? 2 : (maxVolume <= 100 ? 1 : 0);\n\n return (\n // @ts-ignore\n <Box className={cn(props.className)}>\n {/* @ts-ignore */}\n <ResponsiveContainer>\n {/* @ts-ignore */}\n <BarChart\n data={props.data}\n margin={{ left: -0, top: 6, right: 0, bottom: 20 }}\n >\n {/* @ts-ignore */}\n <Tooltip\n // cursor={{ fillOpacity: 0.1 }}\n cursor={<CustomizedCross />}\n content={<CustomTooltip tooltip={props.tooltip} />}\n />\n <CartesianGrid\n vertical={false}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.08}\n repeatCount={6}\n />\n <ReferenceLine y={0} stroke=\"#000\" />\n {/* @ts-ignore */}\n <Bar dataKey=\"volume\" shape={<RoundedRectangle />} minPointSize={1}>\n {props.data.map((entry, index) => {\n return (\n // @ts-ignore\n <Cell\n key={`cell-${index}`}\n fill={entry.volume > 0 ? colors.profit : colors.loss}\n opacity={entry.opacity}\n />\n );\n })}\n </Bar>\n {/* @ts-ignore */}\n <YAxis\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickLine={false}\n axisLine={false}\n dataKey={\"volume\"}\n tickFormatter={(value, index) => {\n if (isEmpty) return `${index * 100}`;\n return numberToHumanStyle(value, decimal);\n }}\n width={45}\n />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n // axisLine={false}\n tickLine={false}\n interval={props.data.length - 2}\n // tick={renderQuarterTick}\n height={1}\n // scale=\"time\"\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n stroke=\"rgb(229, 231, 235)\"\n strokeOpacity={0.2}\n />\n </BarChart>\n </ResponsiveContainer>\n </Box>\n );\n};\nfunction numberToHumanStyle(number: number, decimalPlaces: number = 0): string {\n const abbreviations = [\"\", \"K\", \"M\", \"B\", \"T\"];\n\n let index = 0;\n while (number >= 1000 && index < abbreviations.length - 1) {\n number /= 1000;\n index++;\n }\n\n const roundedNumber = toFixedWithoutRounding(number, decimalPlaces);\n\n return `${roundedNumber}${abbreviations[index]}`;\n}\n\nfunction toFixedWithoutRounding(num: number, fix: number): string {\n const numStr = num.toString();\n const decimalIndex = numStr.indexOf(\".\");\n\n if (decimalIndex === -1 || fix === 0) {\n return numStr.split(\".\")[0];\n }\n\n const cutoffIndex = decimalIndex + fix + 1;\n\n return numStr.slice(0, cutoffIndex);\n}\n","import plugin from \"tailwindcss/plugin\";\n\nimport { PluginCreator } from \"tailwindcss/types/config\";\n\nexport const chartPlugin: PluginCreator = () =>\n plugin(function ({ addComponents, addBase }) {\n addComponents(\n {\n \".xAxis\": {\n \".recharts-cartesian-axis-tick:first-child text\": {\n \"text-anchor\": \"start\",\n },\n \".recharts-cartesian-axis-tick:last-child text\": {\n \"text-anchor\": \"end\",\n },\n },\n },\n {\n respectPrefix: false,\n }\n );\n });\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/tailwindcss@3.4.4/node_modules/tailwindcss/lib/util/createPlugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.4/node_modules/tailwindcss/lib/public/create-plugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.4/node_modules/tailwindcss/plugin.js","../src/orderly/useColors.ts","../src/utils/theme.ts","../src/orderly/pnlBar.tsx","../src/orderly/customTooltip.tsx","../src/utils/yTickFormatter.ts","../src/orderly/pnlLine.tsx","../src/orderly/xAxisLabel.tsx","../src/orderly/assetLine.tsx","../src/orderly/volBar.tsx","../src/tailwindcss/theme.ts"],"names":["require_createPlugin","__commonJSMin","exports","_default","createPlugin","plugin","config","pluginFunction","configFunction","optionsFunction","options","require_create_plugin","_createPlugin","_interop_require_default","obj","require_plugin","module","useMemo","getThemeColors","root","computedStyle","convertToRGB","color","useColors","colors","themeColors","BarChart","XAxis","YAxis","ResponsiveContainer","Bar","Cell","Tooltip","CartesianGrid","ReferenceLine","Cross","Box","Flex","Text","jsx","jsxs","OrderlyChartTooltip","props","label","value","prefix","unit","coloring","dp","rm","cn","useRef","numberToHumanStyle","tickFormatter","absValue","formatted","RoundedRectangle","fill","x","y","width","height","absHeight","XAxisLabel","stroke","payload","index","containerWidth","_x","CustomizedCross","CustomTooltip","active","todayStr","PnLBarChart","invisible","widthRef","entry","LineChart","Line","PnlLineChart","dataTransfer","data","series","acc","item","AssetLineChart","opacity","tooltip","VolBarChart","isEmpty","b","maxVolume","decimal","number","decimalPlaces","abbreviations","toFixedWithoutRounding","num","fix","numStr","decimalIndex","cutoffIndex","import_plugin","chartPlugin","addComponents","addBase"],"mappings":"ygBAAA,IAAAA,EAAAC,EAAAC,GAAA,cACA,OAAO,eAAeA,EAAS,aAAc,CACzC,MAAO,EACX,CAAC,EACD,OAAO,eAAeA,EAAS,UAAW,CACtC,WAAY,GACZ,IAAK,UAAW,CACZ,OAAOC,EACX,CACJ,CAAC,EACD,SAASC,EAAaC,EAAQC,EAAQ,CAClC,MAAO,CACH,QAASD,EACT,OAAAC,CACJ,CACJ,CACAF,EAAa,YAAc,SAASG,EAAgBC,EAAiB,KAAK,CAAC,GAAI,CAC3E,IAAMC,EAAkB,SAASC,EAAS,CACtC,MAAO,CACH,UAAWA,EACX,QAASH,EAAeG,CAAO,EAC/B,OAAQF,EAAeE,CAAO,CAClC,CACJ,EACA,OAAAD,EAAgB,oBAAsB,GAGtCA,EAAgB,iBAAmBF,EACnCE,EAAgB,iBAAmBD,EAC5BC,CACX,EACA,IAAMN,GAAWC,IC/BjB,IAAAO,EAAAV,EAAAC,GAAA,cACA,OAAO,eAAeA,EAAS,aAAc,CACzC,MAAO,EACX,CAAC,EACD,OAAO,eAAeA,EAAS,UAAW,CACtC,WAAY,GACZ,IAAK,UAAW,CACZ,OAAOC,EACX,CACJ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C,EAAaC,EAAqB,CAChE,IAAMC,EAASF,EAAI,SAAS,EACtBG,EAAeD,EAAO,QAAQ,GAAG,EAEvC,GAAIC,IAAiB,IAAMF,IAAQ,EACjC,OAAOC,EAAO,MAAM,GAAG,EAAE,CAAC,EAG5B,IAAME,EAAcD,EAAeF,EAAM,EAEzC,OAAOC,EAAO,MAAM,EAAGE,CAAW,CACpC,CCxMA,IAAAC,EAAmB,OAINC,GAA6B,OACxC,EAAAlG,SAAO,SAAU,CAAE,cAAAmG,EAAe,QAAAC,CAAQ,EAAG,CAC3CD,EACE,CACE,SAAU,CACR,iDAAkD,CAChD,cAAe,OACjB,EACA,gDAAiD,CAC/C,cAAe,KACjB,CACF,CACF,EACA,CACE,cAAe,EACjB,CACF,CACF,CAAC","sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nfunction createPlugin(plugin, config) {\n return {\n handler: plugin,\n config\n };\n}\ncreatePlugin.withOptions = function(pluginFunction, configFunction = ()=>({})) {\n const optionsFunction = function(options) {\n return {\n __options: options,\n handler: pluginFunction(options),\n config: configFunction(options)\n };\n };\n optionsFunction.__isOptionsFunction = true;\n // Expose plugin dependencies so that `object-hash` returns a different\n // value if anything here changes, to ensure a rebuild is triggered.\n optionsFunction.__pluginFunction = pluginFunction;\n optionsFunction.__configFunction = configFunction;\n return optionsFunction;\n};\nconst _default = createPlugin;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nconst _createPlugin = /*#__PURE__*/ _interop_require_default(require(\"../util/createPlugin\"));\nfunction _interop_require_default(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\nconst _default = _createPlugin.default;\n","let createPlugin = require('./lib/public/create-plugin')\nmodule.exports = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default\n","import { useMemo } from \"react\";\nimport { getThemeColors } from \"../utils/theme\";\n\nexport const useColors = (colors?: { profit: string; loss: string }) => {\n const _colors = useMemo(() => {\n const themeColors = getThemeColors();\n return {\n profit: colors?.profit || themeColors.profit,\n loss: colors?.loss || themeColors.loss,\n primary: themeColors.primary,\n primaryLight: themeColors.primaryLight,\n };\n }, [colors]);\n\n return _colors;\n};\n","export const getThemeColors = () => {\n const root = document.documentElement;\n const computedStyle = getComputedStyle(root);\n\n const colors = {\n primary: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-primary\")\n ),\n primaryLight: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-primary-light\")\n ),\n secondary: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-secondary\")\n ),\n success: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-success\")\n ),\n warning: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-warning\")\n ),\n danger: convertToRGB(computedStyle.getPropertyValue(\"--oui-color-danger\")),\n info: convertToRGB(computedStyle.getPropertyValue(\"--oui-color-info\")),\n loss: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-trading-loss\")\n ),\n profit: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-trading-profit\")\n ),\n };\n\n return colors;\n};\n\nconst convertToRGB = (color: string) => {\n return `rgb(${color.split(\" \").join(\",\")})`;\n};\n","import { useColors } from \"./useColors\";\nimport {\n BarChart,\n XAxis,\n YAxis,\n ResponsiveContainer,\n Bar,\n Cell,\n Tooltip,\n CartesianGrid,\n ReferenceLine,\n Cross,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { Box, cn } from \"@orderly.network/ui\";\nimport { Flex } from \"@orderly.network/ui\";\n// import { XAxisLabel } from \"./xAxisLabel\";\nimport { useRef } from \"react\";\nimport { numberToHumanStyle } from \"@orderly.network/utils\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\n\nexport type PnLChartDataItem = {\n date: string;\n pnl: number;\n};\n\nexport type PnLChartProps = {\n colors?: {\n profit: string;\n loss: string;\n };\n data: PnLChartDataItem[];\n invisible?: boolean;\n};\n\nconst RoundedRectangle = (props: any) => {\n const { fill, x, y, width, height } = props;\n\n const absHeight = Math.abs(height);\n\n return (\n <rect\n rx={2}\n x={x}\n y={height > 0 ? y : y + height}\n width={width}\n height={absHeight}\n stroke=\"none\"\n fill={fill}\n />\n );\n};\n\nexport const XAxisLabel = (props: any) => {\n const { x, y, stroke, payload, index, width, containerWidth } = props;\n\n const _x =\n index === 0\n ? 48\n : containerWidth > 0\n ? containerWidth - 10\n : width + payload.offset;\n\n return (\n <g transform={`translate(${_x},${y - 6})`}>\n <text\n x={0}\n y={0}\n dy={16}\n textAnchor={index === 0 ? \"start\" : \"end\"}\n // textAnchor={\"start\"}\n fontSize={10}\n fill={\"rgba(255,255,255,0.54)\"}\n >\n {index === 0 ? payload.value : \"Now\"}\n </text>\n </g>\n );\n};\n\nconst CustomizedCross = (props: any) => {\n const { width, height, stroke, fill } = props;\n\n return (\n // @ts-ignore\n <Cross\n // y={props.y + props.top}\n x={props.x + props.width / 2}\n top={props.top}\n height={height}\n width={1}\n stroke={\"rgba(255,255,255,0.16)\"}\n strokeDasharray={\"3 2\"}\n fill={\"none\"}\n />\n );\n};\n\nconst CustomTooltip = (props: TooltipProps<any, any>) => {\n const { active, payload, label } = props;\n\n const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? \"Now\" : label}\n value={payload[0].value}\n coloring\n />\n );\n }\n\n return null;\n};\n\nexport const PnLBarChart = (props: PnLChartProps) => {\n const { invisible } = props;\n const colors = useColors(props.colors);\n const widthRef = useRef(0);\n\n return (\n // @ts-ignore\n <ResponsiveContainer\n className={cn(invisible && \"chart-invisible\")}\n onResize={(width, height) => {\n // console.log(\"width\", width, height);\n widthRef.current = width;\n }}\n >\n {/* @ts-ignore */}\n <BarChart\n data={props.data}\n margin={{ left: -10, top: 10, right: 10, bottom: 30 }}\n >\n {!invisible && (\n // @ts-ignore\n <Tooltip\n // cursor={{ fillOpacity: 0.1 }}\n cursor={<CustomizedCross />}\n content={<CustomTooltip />}\n />\n )}\n\n <CartesianGrid vertical={false} stroke=\"#FFFFFF\" strokeOpacity={0.04} />\n <ReferenceLine y={0} stroke=\"rgba(0,0,0,0.04)\" />\n\n {!invisible && (\n // @ts-ignore\n <Bar dataKey=\"pnl\" shape={<RoundedRectangle />}>\n {props.data.map((entry, index) => {\n return (\n // @ts-ignore\n <Cell\n key={`cell-${index}`}\n fill={entry.pnl > 0 ? colors.profit : colors.loss}\n />\n );\n })}\n </Bar>\n )}\n {/* @ts-ignore */}\n <YAxis\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickFormatter={(value) => tickFormatter(value)}\n tickLine={false}\n axisLine={false}\n dataKey={\"pnl\"}\n />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n // axisLine={false}\n tickLine={false}\n interval={props.data.length - 2}\n // tick={renderQuarterTick}\n height={1}\n // scale=\"time\"\n // tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tick={<XAxisLabel containerWidth={widthRef.current} />}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.04}\n />\n </BarChart>\n </ResponsiveContainer>\n );\n};\n","import { Box, Flex, Text } from \"@orderly.network/ui\";\n\nexport const OrderlyChartTooltip = (props: {\n label: string;\n value: string | number;\n unit?: string;\n prefix?: React.ReactNode;\n titleClassName?: string;\n coloring?: boolean;\n dp?: number;\n rm?: number;\n}) => {\n const {\n label,\n value,\n prefix,\n unit = \"USDC\",\n coloring = false,\n dp,\n rm,\n } = props;\n return (\n <Box intensity={600} p={3} r=\"md\">\n <Flex direction={\"row\"} className={props.titleClassName}>\n {prefix}\n <Text.numeral\n unit={unit}\n as=\"div\"\n size=\"sm\"\n coloring={coloring}\n showIdentifier={coloring}\n unitClassName=\"oui-text-base-contrast-54 oui-ml-1\"\n weight=\"semibold\"\n rm={rm}\n dp={dp}\n >\n {value}\n </Text.numeral>\n </Flex>\n <Text size=\"2xs\" intensity={54} weight=\"semibold\">\n {label}\n </Text>\n </Box>\n );\n};\n","import { numberToHumanStyle } from \"@orderly.network/utils\";\n\nexport const tickFormatter = (value: number) => {\n let absValue = Math.abs(value);\n const dp = absValue === 0 ? 0 : absValue <= 10 ? 2 : absValue <= 100 ? 1 : 0;\n\n const formatted = numberToHumanStyle(absValue, dp);\n return value < 0 ? `-${formatted}` : formatted;\n};\n","import { useMemo, useRef } from \"react\";\nimport { getThemeColors } from \"../utils/theme\";\nimport { useColors } from \"./useColors\";\n// import { Line } from \"../line/line\";\nimport {\n LineChart,\n XAxis,\n YAxis,\n Line,\n CartesianGrid,\n ReferenceLine,\n Tooltip,\n ResponsiveContainer,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { XAxisLabel } from \"./xAxisLabel\";\nimport { numberToHumanStyle } from \"@orderly.network/utils\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\n\nexport type PnlLineChartProps = {\n colors?: {\n profit: string;\n loss: string;\n };\n data: any;\n invisible?: boolean;\n};\n\nconst CustomTooltip = (props: TooltipProps<any, any>) => {\n const { active, payload, label } = props;\n\n const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? \"Now\" : label}\n value={payload[0].value}\n coloring\n />\n );\n }\n\n return null;\n};\n\nconst PnlLineChart = (props: PnlLineChartProps) => {\n const colors = useColors(props.colors);\n\n const dataTransfer = (data: any[]) => {\n const series: any[] = [];\n\n data?.reduce((acc, item) => {\n acc += item.pnl;\n series.push({\n ...item,\n pnl: acc,\n _pnl: item.pnl,\n // date: new Date(item.date).getTime(),\n });\n return acc;\n }, 0);\n\n return series;\n };\n\n const data = useMemo(() => dataTransfer(props.data), [props.data]);\n\n return (\n // @ts-ignore\n <ResponsiveContainer className={props.invisible ? \"chart-invisible\" : \"\"}>\n {/* @ts-ignore */}\n <LineChart\n data={data}\n margin={{ top: 20, right: 10, left: -10, bottom: 0 }}\n >\n <CartesianGrid vertical={false} stroke=\"#FFFFFF\" strokeOpacity={0.04} />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n interval={props.data.length - 2}\n // tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tick={<XAxisLabel />}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.04}\n // scale={\"time\"}\n // type=\"number\"\n // range={}\n />\n {/* @ts-ignore */}\n <YAxis\n dataKey=\"pnl\"\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickLine={false}\n axisLine={false}\n tickFormatter={(value) => tickFormatter(value)}\n />\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Tooltip\n cursor={{ strokeDasharray: \"3 2\", strokeOpacity: 0.16 }}\n content={<CustomTooltip />}\n />\n )}\n\n {/* <ReferenceLine y={0} stroke=\"#000\" /> */}\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Line\n type=\"natural\"\n dataKey=\"pnl\"\n stroke={colors.primaryLight}\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n )}\n </LineChart>\n </ResponsiveContainer>\n );\n};\n\nexport { PnlLineChart };\n","export const XAxisLabel = (props: any) => {\n const { x, y, stroke, payload, index } = props;\n\n return (\n <g transform={`translate(${x},${y - 6})`}>\n <text\n x={0}\n y={0}\n dy={16}\n textAnchor=\"end\"\n fontSize={10}\n fill={\"rgba(255,255,255,0.54)\"}\n >\n {index === 0 ? payload.value : \"Now\"}\n </text>\n </g>\n );\n};\n","import { useColors } from \"./useColors\";\n// import { Line } from \"../line/line\";\nimport {\n LineChart,\n XAxis,\n YAxis,\n Line,\n CartesianGrid,\n Tooltip,\n Label,\n ResponsiveContainer,\n} from \"recharts\";\n\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { XAxisLabel } from \"./xAxisLabel\";\nimport { useRef } from \"react\";\nimport { numberToHumanStyle } from \"@orderly.network/utils\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\n\nexport type AssetChartDataItem = {\n date: string;\n account_value: number;\n};\n\nexport type PnlLineChartProps = {\n colors?: {\n profit: string;\n loss: string;\n };\n data: AssetChartDataItem[];\n invisible?: boolean;\n};\n\nconst CustomTooltip = (props: TooltipProps<any, any>) => {\n const { active, payload, label } = props;\n\n const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? \"Now\" : label}\n value={payload[0].value}\n />\n );\n }\n\n return null;\n};\n\nconst AssetLineChart = (props: PnlLineChartProps) => {\n const colors = useColors(props.colors);\n\n // const dataTransfer = (data: any[]) => {\n // const series: any[] = [];\n\n // data.reduce((acc, item) => {\n // acc += item.pnl;\n // series.push({ ...item, pnl: acc, _pnl: item.pnl });\n // return acc;\n // }, 0);\n\n // return series;\n // };\n\n // const data = useMemo(() => dataTransfer(props.data), [props.data]);\n\n return (\n // @ts-ignore\n <ResponsiveContainer className={props.invisible ? \"chart-invisible\" : \"\"}>\n {/* @ts-ignore */}\n <LineChart\n width={530}\n height={180}\n data={props.data}\n margin={{ top: 20, right: 10, left: -20, bottom: -10 }}\n >\n <CartesianGrid vertical={false} stroke=\"#FFFFFF\" strokeOpacity={0.04} />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n interval={props.data.length - 2}\n // tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tick={<XAxisLabel />}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.04}\n ></XAxis>\n {/* @ts-ignore */}\n <YAxis\n dataKey=\"account_value\"\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickLine={false}\n axisLine={false}\n tickFormatter={(value) => tickFormatter(value)}\n />\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Tooltip\n cursor={{ strokeDasharray: \"3 2\", strokeOpacity: 0.16 }}\n content={<CustomTooltip />}\n />\n )}\n\n {/* <Legend /> */}\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Line\n type=\"natural\"\n dataKey=\"account_value\"\n stroke={colors.profit}\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n )}\n </LineChart>\n </ResponsiveContainer>\n );\n};\n\nexport { AssetLineChart };\n","import { useColors } from \"./useColors\";\nimport {\n BarChart,\n XAxis,\n YAxis,\n ResponsiveContainer,\n Bar,\n Cell,\n Tooltip,\n CartesianGrid,\n ReferenceLine,\n Cross,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { Box, cn } from \"@orderly.network/ui\";\n\nexport type VolChartDataItem = {\n date: string;\n volume: number;\n opacity?: string | number;\n};\n\nexport type VolChartTooltip = {\n rm?: number;\n dp?: number;\n};\n\nexport type VolChartProps = {\n colors?: {\n fill: string;\n };\n data: VolChartDataItem[];\n tooltip?: VolChartTooltip;\n className?: string;\n};\n\nconst RoundedRectangle = (props: any) => {\n const { fill, x, y, width, height, opacity } = props;\n const absHeight = Math.abs(height);\n\n return (\n <rect\n rx={2}\n x={x}\n y={height > 0 ? y : y + height}\n width={width}\n height={absHeight}\n stroke=\"none\"\n fill={fill}\n opacity={opacity}\n />\n );\n};\n\nconst CustomizedCross = (props: any) => {\n const { width, height, payload, stroke, fill } = props;\n\n if (payload?.[0]?.value === 0) return null;\n\n return (\n // @ts-ignore\n <Cross\n // y={props.y + props.top}\n x={props.x + props.width / 2}\n top={props.top}\n height={height}\n width={1}\n stroke={\"rgba(255,255,255,0.16)\"}\n strokeDasharray={\"3 2\"}\n fill={\"none\"}\n />\n );\n};\n\nconst CustomTooltip = (\n props: TooltipProps<any, any> & { tooltip?: VolChartTooltip }\n) => {\n const { active, payload, label, tooltip } = props;\n\n if (payload?.[0]?.value === 0) return null;\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label}\n value={payload[0].value}\n // prefix=\"Commission\"\n titleClassName=\"oui-gap-4\"\n rm={tooltip?.rm}\n dp={tooltip?.dp}\n />\n );\n }\n\n return null;\n};\n\nexport const VolBarChart = (props: VolChartProps) => {\n const colors = useColors(\n props.colors?.fill\n ? { profit: props.colors?.fill, loss: props.colors?.fill }\n : undefined\n );\n\n const isEmpty = props.data.reduce((a, b) => a + b.volume, 0) === 0;\n const maxVolume = props.data.reduce((a,b) => (a > b.volume ? a : b.volume), 0);\n const decimal = maxVolume <= 10 ? 2 : (maxVolume <= 100 ? 1 : 0);\n\n return (\n // @ts-ignore\n <Box className={cn(props.className)}>\n {/* @ts-ignore */}\n <ResponsiveContainer>\n {/* @ts-ignore */}\n <BarChart\n data={props.data}\n margin={{ left: -0, top: 6, right: 0, bottom: 20 }}\n >\n {/* @ts-ignore */}\n <Tooltip\n // cursor={{ fillOpacity: 0.1 }}\n cursor={<CustomizedCross />}\n content={<CustomTooltip tooltip={props.tooltip} />}\n />\n <CartesianGrid\n vertical={false}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.08}\n repeatCount={6}\n />\n <ReferenceLine y={0} stroke=\"#000\" />\n {/* @ts-ignore */}\n <Bar dataKey=\"volume\" shape={<RoundedRectangle />} minPointSize={1}>\n {props.data.map((entry, index) => {\n return (\n // @ts-ignore\n <Cell\n key={`cell-${index}`}\n fill={entry.volume > 0 ? colors.profit : colors.loss}\n opacity={entry.opacity}\n />\n );\n })}\n </Bar>\n {/* @ts-ignore */}\n <YAxis\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickLine={false}\n axisLine={false}\n dataKey={\"volume\"}\n tickFormatter={(value, index) => {\n if (isEmpty) return `${index * 100}`;\n return numberToHumanStyle(value, decimal);\n }}\n width={45}\n />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n // axisLine={false}\n tickLine={false}\n interval={props.data.length - 2}\n // tick={renderQuarterTick}\n height={1}\n // scale=\"time\"\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n stroke=\"rgb(229, 231, 235)\"\n strokeOpacity={0.2}\n />\n </BarChart>\n </ResponsiveContainer>\n </Box>\n );\n};\nfunction numberToHumanStyle(number: number, decimalPlaces: number = 0): string {\n const abbreviations = [\"\", \"K\", \"M\", \"B\", \"T\"];\n\n let index = 0;\n while (number >= 1000 && index < abbreviations.length - 1) {\n number /= 1000;\n index++;\n }\n\n const roundedNumber = toFixedWithoutRounding(number, decimalPlaces);\n\n return `${roundedNumber}${abbreviations[index]}`;\n}\n\nfunction toFixedWithoutRounding(num: number, fix: number): string {\n const numStr = num.toString();\n const decimalIndex = numStr.indexOf(\".\");\n\n if (decimalIndex === -1 || fix === 0) {\n return numStr.split(\".\")[0];\n }\n\n const cutoffIndex = decimalIndex + fix + 1;\n\n return numStr.slice(0, cutoffIndex);\n}\n","import plugin from \"tailwindcss/plugin\";\n\nimport { PluginCreator } from \"tailwindcss/types/config\";\n\nexport const chartPlugin: PluginCreator = () =>\n plugin(function ({ addComponents, addBase }) {\n addComponents(\n {\n \".xAxis\": {\n \".recharts-cartesian-axis-tick:first-child text\": {\n \"text-anchor\": \"start\",\n },\n \".recharts-cartesian-axis-tick:last-child text\": {\n \"text-anchor\": \"end\",\n },\n },\n },\n {\n respectPrefix: false,\n }\n );\n });\n"]}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/tailwindcss@3.4.4_ts-node@10.9.2_@swc+core@1.4.12_@swc+helpers@0.5.15__@types+node@22.9.0_typescript@5.6.3_/node_modules/tailwindcss/lib/util/createPlugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.4_ts-node@10.9.2_@swc+core@1.4.12_@swc+helpers@0.5.15__@types+node@22.9.0_typescript@5.6.3_/node_modules/tailwindcss/lib/public/create-plugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.4_ts-node@10.9.2_@swc+core@1.4.12_@swc+helpers@0.5.15__@types+node@22.9.0_typescript@5.6.3_/node_modules/tailwindcss/plugin.js","../src/orderly/useColors.ts","../src/utils/theme.ts","../src/orderly/pnlBar.tsx","../src/orderly/customTooltip.tsx","../src/utils/yTickFormatter.ts","../src/orderly/pnlLine.tsx","../src/orderly/xAxisLabel.tsx","../src/orderly/assetLine.tsx","../src/orderly/volBar.tsx","../src/tailwindcss/theme.ts"],"names":["require_createPlugin","__commonJSMin","exports","_default","createPlugin","plugin","config","pluginFunction","configFunction","optionsFunction","options","require_create_plugin","_createPlugin","_interop_require_default","obj","require_plugin","module","useMemo","getThemeColors","root","computedStyle","convertToRGB","color","useColors","colors","themeColors","BarChart","XAxis","YAxis","ResponsiveContainer","Bar","Cell","Tooltip","CartesianGrid","ReferenceLine","Cross","Box","Flex","Text","jsx","jsxs","OrderlyChartTooltip","props","label","value","prefix","unit","coloring","dp","rm","cn","useRef","numberToHumanStyle","tickFormatter","absValue","formatted","RoundedRectangle","fill","x","y","width","height","absHeight","XAxisLabel","stroke","payload","index","containerWidth","_x","CustomizedCross","CustomTooltip","active","todayStr","PnLBarChart","invisible","widthRef","entry","LineChart","Line","PnlLineChart","dataTransfer","data","series","acc","item","AssetLineChart","opacity","tooltip","VolBarChart","isEmpty","b","maxVolume","decimal","number","decimalPlaces","abbreviations","toFixedWithoutRounding","num","fix","numStr","decimalIndex","cutoffIndex","import_plugin","chartPlugin","addComponents","addBase"],"mappings":"ygBAAA,IAAAA,EAAAC,EAAAC,GAAA,cACA,OAAO,eAAeA,EAAS,aAAc,CACzC,MAAO,EACX,CAAC,EACD,OAAO,eAAeA,EAAS,UAAW,CACtC,WAAY,GACZ,IAAK,UAAW,CACZ,OAAOC,EACX,CACJ,CAAC,EACD,S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,GAAG,GAC3Bd,GAAmBR,EAAOgD,CAAO,EAE1C,MAAO,GACT,EAEArD,EAACZ,GAAA,CACC,QAAQ,OAER,SAAU,GACV,SAAUe,EAAM,KAAK,OAAS,EAE9B,OAAQ,EAER,KAAM,CAAE,SAAU,GAAI,KAAM,wBAAyB,EACrD,OAAO,qBACP,cAAe,GACjB,GACF,EACF,EACF,CAEJ,EACA,SAASU,GAAmByC,EAAgBC,EAAwB,EAAW,CAC7E,IAAMC,EAAgB,CAAC,GAAI,IAAK,IAAK,IAAK,GAAG,EAEzC7B,EAAQ,EACZ,KAAO2B,GAAU,KAAQ3B,EAAQ6B,EAAc,OAAS,GACtDF,GAAU,IACV3B,IAKF,MAAO,GAFe8B,GAAuBH,EAAQC,CAAa,CAE3C,GAAGC,EAAc7B,CAAK,CAAC,EAChD,CAEA,SAAS8B,GAAuBC,EAAaC,EAAqB,CAChE,IAAMC,EAASF,EAAI,SAAS,EACtBG,EAAeD,EAAO,QAAQ,GAAG,EAEvC,GAAIC,IAAiB,IAAMF,IAAQ,EACjC,OAAOC,EAAO,MAAM,GAAG,EAAE,CAAC,EAG5B,IAAME,EAAcD,EAAeF,EAAM,EAEzC,OAAOC,EAAO,MAAM,EAAGE,CAAW,CACpC,CCxMA,IAAAC,EAAmB,OAINC,GAA6B,OACxC,EAAAlG,SAAO,SAAU,CAAE,cAAAmG,EAAe,QAAAC,CAAQ,EAAG,CAC3CD,EACE,CACE,SAAU,CACR,iDAAkD,CAChD,cAAe,OACjB,EACA,gDAAiD,CAC/C,cAAe,KACjB,CACF,CACF,EACA,CACE,cAAe,EACjB,CACF,CACF,CAAC","sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nfunction createPlugin(plugin, config) {\n return {\n handler: plugin,\n config\n };\n}\ncreatePlugin.withOptions = function(pluginFunction, configFunction = ()=>({})) {\n const optionsFunction = function(options) {\n return {\n __options: options,\n handler: pluginFunction(options),\n config: configFunction(options)\n };\n };\n optionsFunction.__isOptionsFunction = true;\n // Expose plugin dependencies so that `object-hash` returns a different\n // value if anything here changes, to ensure a rebuild is triggered.\n optionsFunction.__pluginFunction = pluginFunction;\n optionsFunction.__configFunction = configFunction;\n return optionsFunction;\n};\nconst _default = createPlugin;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nconst _createPlugin = /*#__PURE__*/ _interop_require_default(require(\"../util/createPlugin\"));\nfunction _interop_require_default(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\nconst _default = _createPlugin.default;\n","let createPlugin = require('./lib/public/create-plugin')\nmodule.exports = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default\n","import { useMemo } from \"react\";\nimport { getThemeColors } from \"../utils/theme\";\n\nexport const useColors = (colors?: { profit: string; loss: string }) => {\n const _colors = useMemo(() => {\n const themeColors = getThemeColors();\n return {\n profit: colors?.profit || themeColors.profit,\n loss: colors?.loss || themeColors.loss,\n primary: themeColors.primary,\n primaryLight: themeColors.primaryLight,\n };\n }, [colors]);\n\n return _colors;\n};\n","export const getThemeColors = () => {\n const root = document.documentElement;\n const computedStyle = getComputedStyle(root);\n\n const colors = {\n primary: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-primary\")\n ),\n primaryLight: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-primary-light\")\n ),\n secondary: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-secondary\")\n ),\n success: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-success\")\n ),\n warning: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-warning\")\n ),\n danger: convertToRGB(computedStyle.getPropertyValue(\"--oui-color-danger\")),\n info: convertToRGB(computedStyle.getPropertyValue(\"--oui-color-info\")),\n loss: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-trading-loss\")\n ),\n profit: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-trading-profit\")\n ),\n };\n\n return colors;\n};\n\nconst convertToRGB = (color: string) => {\n return `rgb(${color.split(\" \").join(\",\")})`;\n};\n","import { useColors } from \"./useColors\";\nimport {\n BarChart,\n XAxis,\n YAxis,\n ResponsiveContainer,\n Bar,\n Cell,\n Tooltip,\n CartesianGrid,\n ReferenceLine,\n Cross,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { Box, cn } from \"@orderly.network/ui\";\nimport { Flex } from \"@orderly.network/ui\";\n// import { XAxisLabel } from \"./xAxisLabel\";\nimport { useRef } from \"react\";\nimport { numberToHumanStyle } from \"@orderly.network/utils\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\n\nexport type PnLChartDataItem = {\n date: string;\n pnl: number;\n};\n\nexport type PnLChartProps = {\n colors?: {\n profit: string;\n loss: string;\n };\n data: PnLChartDataItem[];\n invisible?: boolean;\n};\n\nconst RoundedRectangle = (props: any) => {\n const { fill, x, y, width, height } = props;\n\n const absHeight = Math.abs(height);\n\n return (\n <rect\n rx={2}\n x={x}\n y={height > 0 ? y : y + height}\n width={width}\n height={absHeight}\n stroke=\"none\"\n fill={fill}\n />\n );\n};\n\nexport const XAxisLabel = (props: any) => {\n const { x, y, stroke, payload, index, width, containerWidth } = props;\n\n const _x =\n index === 0\n ? 48\n : containerWidth > 0\n ? containerWidth - 10\n : width + payload.offset;\n\n return (\n <g transform={`translate(${_x},${y - 6})`}>\n <text\n x={0}\n y={0}\n dy={16}\n textAnchor={index === 0 ? \"start\" : \"end\"}\n // textAnchor={\"start\"}\n fontSize={10}\n fill={\"rgba(255,255,255,0.54)\"}\n >\n {index === 0 ? payload.value : \"Now\"}\n </text>\n </g>\n );\n};\n\nconst CustomizedCross = (props: any) => {\n const { width, height, stroke, fill } = props;\n\n return (\n // @ts-ignore\n <Cross\n // y={props.y + props.top}\n x={props.x + props.width / 2}\n top={props.top}\n height={height}\n width={1}\n stroke={\"rgba(255,255,255,0.16)\"}\n strokeDasharray={\"3 2\"}\n fill={\"none\"}\n />\n );\n};\n\nconst CustomTooltip = (props: TooltipProps<any, any>) => {\n const { active, payload, label } = props;\n\n const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? \"Now\" : label}\n value={payload[0].value}\n coloring\n />\n );\n }\n\n return null;\n};\n\nexport const PnLBarChart = (props: PnLChartProps) => {\n const { invisible } = props;\n const colors = useColors(props.colors);\n const widthRef = useRef(0);\n\n return (\n // @ts-ignore\n <ResponsiveContainer\n className={cn(invisible && \"chart-invisible\")}\n onResize={(width, height) => {\n // console.log(\"width\", width, height);\n widthRef.current = width;\n }}\n >\n {/* @ts-ignore */}\n <BarChart\n data={props.data}\n margin={{ left: -10, top: 10, right: 10, bottom: 30 }}\n >\n {!invisible && (\n // @ts-ignore\n <Tooltip\n // cursor={{ fillOpacity: 0.1 }}\n cursor={<CustomizedCross />}\n content={<CustomTooltip />}\n />\n )}\n\n <CartesianGrid vertical={false} stroke=\"#FFFFFF\" strokeOpacity={0.04} />\n <ReferenceLine y={0} stroke=\"rgba(0,0,0,0.04)\" />\n\n {!invisible && (\n // @ts-ignore\n <Bar dataKey=\"pnl\" shape={<RoundedRectangle />}>\n {props.data.map((entry, index) => {\n return (\n // @ts-ignore\n <Cell\n key={`cell-${index}`}\n fill={entry.pnl > 0 ? colors.profit : colors.loss}\n />\n );\n })}\n </Bar>\n )}\n {/* @ts-ignore */}\n <YAxis\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickFormatter={(value) => tickFormatter(value)}\n tickLine={false}\n axisLine={false}\n dataKey={\"pnl\"}\n />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n // axisLine={false}\n tickLine={false}\n interval={props.data.length - 2}\n // tick={renderQuarterTick}\n height={1}\n // scale=\"time\"\n // tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tick={<XAxisLabel containerWidth={widthRef.current} />}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.04}\n />\n </BarChart>\n </ResponsiveContainer>\n );\n};\n","import { Box, Flex, Text } from \"@orderly.network/ui\";\n\nexport const OrderlyChartTooltip = (props: {\n label: string;\n value: string | number;\n unit?: string;\n prefix?: React.ReactNode;\n titleClassName?: string;\n coloring?: boolean;\n dp?: number;\n rm?: number;\n}) => {\n const {\n label,\n value,\n prefix,\n unit = \"USDC\",\n coloring = false,\n dp,\n rm,\n } = props;\n return (\n <Box intensity={600} p={3} r=\"md\">\n <Flex direction={\"row\"} className={props.titleClassName}>\n {prefix}\n <Text.numeral\n unit={unit}\n as=\"div\"\n size=\"sm\"\n coloring={coloring}\n showIdentifier={coloring}\n unitClassName=\"oui-text-base-contrast-54 oui-ml-1\"\n weight=\"semibold\"\n rm={rm}\n dp={dp}\n >\n {value}\n </Text.numeral>\n </Flex>\n <Text size=\"2xs\" intensity={54} weight=\"semibold\">\n {label}\n </Text>\n </Box>\n );\n};\n","import { numberToHumanStyle } from \"@orderly.network/utils\";\n\nexport const tickFormatter = (value: number) => {\n let absValue = Math.abs(value);\n const dp = absValue === 0 ? 0 : absValue <= 10 ? 2 : absValue <= 100 ? 1 : 0;\n\n const formatted = numberToHumanStyle(absValue, dp);\n return value < 0 ? `-${formatted}` : formatted;\n};\n","import { useMemo, useRef } from \"react\";\nimport { getThemeColors } from \"../utils/theme\";\nimport { useColors } from \"./useColors\";\n// import { Line } from \"../line/line\";\nimport {\n LineChart,\n XAxis,\n YAxis,\n Line,\n CartesianGrid,\n ReferenceLine,\n Tooltip,\n ResponsiveContainer,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { XAxisLabel } from \"./xAxisLabel\";\nimport { numberToHumanStyle } from \"@orderly.network/utils\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\n\nexport type PnlLineChartProps = {\n colors?: {\n profit: string;\n loss: string;\n };\n data: any;\n invisible?: boolean;\n};\n\nconst CustomTooltip = (props: TooltipProps<any, any>) => {\n const { active, payload, label } = props;\n\n const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? \"Now\" : label}\n value={payload[0].value}\n coloring\n />\n );\n }\n\n return null;\n};\n\nconst PnlLineChart = (props: PnlLineChartProps) => {\n const colors = useColors(props.colors);\n\n const dataTransfer = (data: any[]) => {\n const series: any[] = [];\n\n data?.reduce((acc, item) => {\n acc += item.pnl;\n series.push({\n ...item,\n pnl: acc,\n _pnl: item.pnl,\n // date: new Date(item.date).getTime(),\n });\n return acc;\n }, 0);\n\n return series;\n };\n\n const data = useMemo(() => dataTransfer(props.data), [props.data]);\n\n return (\n // @ts-ignore\n <ResponsiveContainer className={props.invisible ? \"chart-invisible\" : \"\"}>\n {/* @ts-ignore */}\n <LineChart\n data={data}\n margin={{ top: 20, right: 10, left: -10, bottom: 0 }}\n >\n <CartesianGrid vertical={false} stroke=\"#FFFFFF\" strokeOpacity={0.04} />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n interval={props.data.length - 2}\n // tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tick={<XAxisLabel />}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.04}\n // scale={\"time\"}\n // type=\"number\"\n // range={}\n />\n {/* @ts-ignore */}\n <YAxis\n dataKey=\"pnl\"\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickLine={false}\n axisLine={false}\n tickFormatter={(value) => tickFormatter(value)}\n />\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Tooltip\n cursor={{ strokeDasharray: \"3 2\", strokeOpacity: 0.16 }}\n content={<CustomTooltip />}\n />\n )}\n\n {/* <ReferenceLine y={0} stroke=\"#000\" /> */}\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Line\n type=\"natural\"\n dataKey=\"pnl\"\n stroke={colors.primaryLight}\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n )}\n </LineChart>\n </ResponsiveContainer>\n );\n};\n\nexport { PnlLineChart };\n","export const XAxisLabel = (props: any) => {\n const { x, y, stroke, payload, index } = props;\n\n return (\n <g transform={`translate(${x},${y - 6})`}>\n <text\n x={0}\n y={0}\n dy={16}\n textAnchor=\"end\"\n fontSize={10}\n fill={\"rgba(255,255,255,0.54)\"}\n >\n {index === 0 ? payload.value : \"Now\"}\n </text>\n </g>\n );\n};\n","import { useColors } from \"./useColors\";\n// import { Line } from \"../line/line\";\nimport {\n LineChart,\n XAxis,\n YAxis,\n Line,\n CartesianGrid,\n Tooltip,\n Label,\n ResponsiveContainer,\n} from \"recharts\";\n\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { XAxisLabel } from \"./xAxisLabel\";\nimport { useRef } from \"react\";\nimport { numberToHumanStyle } from \"@orderly.network/utils\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\n\nexport type AssetChartDataItem = {\n date: string;\n account_value: number;\n};\n\nexport type PnlLineChartProps = {\n colors?: {\n profit: string;\n loss: string;\n };\n data: AssetChartDataItem[];\n invisible?: boolean;\n};\n\nconst CustomTooltip = (props: TooltipProps<any, any>) => {\n const { active, payload, label } = props;\n\n const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? \"Now\" : label}\n value={payload[0].value}\n />\n );\n }\n\n return null;\n};\n\nconst AssetLineChart = (props: PnlLineChartProps) => {\n const colors = useColors(props.colors);\n\n // const dataTransfer = (data: any[]) => {\n // const series: any[] = [];\n\n // data.reduce((acc, item) => {\n // acc += item.pnl;\n // series.push({ ...item, pnl: acc, _pnl: item.pnl });\n // return acc;\n // }, 0);\n\n // return series;\n // };\n\n // const data = useMemo(() => dataTransfer(props.data), [props.data]);\n\n return (\n // @ts-ignore\n <ResponsiveContainer className={props.invisible ? \"chart-invisible\" : \"\"}>\n {/* @ts-ignore */}\n <LineChart\n width={530}\n height={180}\n data={props.data}\n margin={{ top: 20, right: 10, left: -20, bottom: -10 }}\n >\n <CartesianGrid vertical={false} stroke=\"#FFFFFF\" strokeOpacity={0.04} />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n interval={props.data.length - 2}\n // tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tick={<XAxisLabel />}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.04}\n ></XAxis>\n {/* @ts-ignore */}\n <YAxis\n dataKey=\"account_value\"\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickLine={false}\n axisLine={false}\n tickFormatter={(value) => tickFormatter(value)}\n />\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Tooltip\n cursor={{ strokeDasharray: \"3 2\", strokeOpacity: 0.16 }}\n content={<CustomTooltip />}\n />\n )}\n\n {/* <Legend /> */}\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Line\n type=\"natural\"\n dataKey=\"account_value\"\n stroke={colors.profit}\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n )}\n </LineChart>\n </ResponsiveContainer>\n );\n};\n\nexport { AssetLineChart };\n","import { useColors } from \"./useColors\";\nimport {\n BarChart,\n XAxis,\n YAxis,\n ResponsiveContainer,\n Bar,\n Cell,\n Tooltip,\n CartesianGrid,\n ReferenceLine,\n Cross,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { Box, cn } from \"@orderly.network/ui\";\n\nexport type VolChartDataItem = {\n date: string;\n volume: number;\n opacity?: string | number;\n};\n\nexport type VolChartTooltip = {\n rm?: number;\n dp?: number;\n};\n\nexport type VolChartProps = {\n colors?: {\n fill: string;\n };\n data: VolChartDataItem[];\n tooltip?: VolChartTooltip;\n className?: string;\n};\n\nconst RoundedRectangle = (props: any) => {\n const { fill, x, y, width, height, opacity } = props;\n const absHeight = Math.abs(height);\n\n return (\n <rect\n rx={2}\n x={x}\n y={height > 0 ? y : y + height}\n width={width}\n height={absHeight}\n stroke=\"none\"\n fill={fill}\n opacity={opacity}\n />\n );\n};\n\nconst CustomizedCross = (props: any) => {\n const { width, height, payload, stroke, fill } = props;\n\n if (payload?.[0]?.value === 0) return null;\n\n return (\n // @ts-ignore\n <Cross\n // y={props.y + props.top}\n x={props.x + props.width / 2}\n top={props.top}\n height={height}\n width={1}\n stroke={\"rgba(255,255,255,0.16)\"}\n strokeDasharray={\"3 2\"}\n fill={\"none\"}\n />\n );\n};\n\nconst CustomTooltip = (\n props: TooltipProps<any, any> & { tooltip?: VolChartTooltip }\n) => {\n const { active, payload, label, tooltip } = props;\n\n if (payload?.[0]?.value === 0) return null;\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label}\n value={payload[0].value}\n // prefix=\"Commission\"\n titleClassName=\"oui-gap-4\"\n rm={tooltip?.rm}\n dp={tooltip?.dp}\n />\n );\n }\n\n return null;\n};\n\nexport const VolBarChart = (props: VolChartProps) => {\n const colors = useColors(\n props.colors?.fill\n ? { profit: props.colors?.fill, loss: props.colors?.fill }\n : undefined\n );\n\n const isEmpty = props.data.reduce((a, b) => a + b.volume, 0) === 0;\n const maxVolume = props.data.reduce((a,b) => (a > b.volume ? a : b.volume), 0);\n const decimal = maxVolume <= 10 ? 2 : (maxVolume <= 100 ? 1 : 0);\n\n return (\n // @ts-ignore\n <Box className={cn(props.className)}>\n {/* @ts-ignore */}\n <ResponsiveContainer>\n {/* @ts-ignore */}\n <BarChart\n data={props.data}\n margin={{ left: -0, top: 6, right: 0, bottom: 20 }}\n >\n {/* @ts-ignore */}\n <Tooltip\n // cursor={{ fillOpacity: 0.1 }}\n cursor={<CustomizedCross />}\n content={<CustomTooltip tooltip={props.tooltip} />}\n />\n <CartesianGrid\n vertical={false}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.08}\n repeatCount={6}\n />\n <ReferenceLine y={0} stroke=\"#000\" />\n {/* @ts-ignore */}\n <Bar dataKey=\"volume\" shape={<RoundedRectangle />} minPointSize={1}>\n {props.data.map((entry, index) => {\n return (\n // @ts-ignore\n <Cell\n key={`cell-${index}`}\n fill={entry.volume > 0 ? colors.profit : colors.loss}\n opacity={entry.opacity}\n />\n );\n })}\n </Bar>\n {/* @ts-ignore */}\n <YAxis\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickLine={false}\n axisLine={false}\n dataKey={\"volume\"}\n tickFormatter={(value, index) => {\n if (isEmpty) return `${index * 100}`;\n return numberToHumanStyle(value, decimal);\n }}\n width={45}\n />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n // axisLine={false}\n tickLine={false}\n interval={props.data.length - 2}\n // tick={renderQuarterTick}\n height={1}\n // scale=\"time\"\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n stroke=\"rgb(229, 231, 235)\"\n strokeOpacity={0.2}\n />\n </BarChart>\n </ResponsiveContainer>\n </Box>\n );\n};\nfunction numberToHumanStyle(number: number, decimalPlaces: number = 0): string {\n const abbreviations = [\"\", \"K\", \"M\", \"B\", \"T\"];\n\n let index = 0;\n while (number >= 1000 && index < abbreviations.length - 1) {\n number /= 1000;\n index++;\n }\n\n const roundedNumber = toFixedWithoutRounding(number, decimalPlaces);\n\n return `${roundedNumber}${abbreviations[index]}`;\n}\n\nfunction toFixedWithoutRounding(num: number, fix: number): string {\n const numStr = num.toString();\n const decimalIndex = numStr.indexOf(\".\");\n\n if (decimalIndex === -1 || fix === 0) {\n return numStr.split(\".\")[0];\n }\n\n const cutoffIndex = decimalIndex + fix + 1;\n\n return numStr.slice(0, cutoffIndex);\n}\n","import plugin from \"tailwindcss/plugin\";\n\nimport { PluginCreator } from \"tailwindcss/types/config\";\n\nexport const chartPlugin: PluginCreator = () =>\n plugin(function ({ addComponents, addBase }) {\n addComponents(\n {\n \".xAxis\": {\n \".recharts-cartesian-axis-tick:first-child text\": {\n \"text-anchor\": \"start\",\n },\n \".recharts-cartesian-axis-tick:last-child text\": {\n \"text-anchor\": \"end\",\n },\n },\n },\n {\n respectPrefix: false,\n }\n );\n });\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/tailwindcss@3.4.4/node_modules/tailwindcss/lib/util/createPlugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.4/node_modules/tailwindcss/lib/public/create-plugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.4/node_modules/tailwindcss/plugin.js","../src/orderly/useColors.ts","../src/utils/theme.ts","../src/orderly/pnlBar.tsx","../src/orderly/customTooltip.tsx","../src/utils/yTickFormatter.ts","../src/orderly/pnlLine.tsx","../src/orderly/xAxisLabel.tsx","../src/orderly/assetLine.tsx","../src/orderly/volBar.tsx","../src/tailwindcss/theme.ts"],"names":["require_createPlugin","__commonJSMin","exports","_default","createPlugin","plugin","config","pluginFunction","configFunction","optionsFunction","options","require_create_plugin","_createPlugin","_interop_require_default","obj","require_plugin","module","useMemo","getThemeColors","root","computedStyle","convertToRGB","color","useColors","colors","themeColors","BarChart","XAxis","YAxis","ResponsiveContainer","Bar","Cell","Tooltip","CartesianGrid","ReferenceLine","Cross","Box","Flex","Text","jsx","jsxs","OrderlyChartTooltip","props","label","value","prefix","unit","coloring","dp","rm","cn","useRef","numberToHumanStyle","tickFormatter","absValue","formatted","RoundedRectangle","fill","x","y","width","height","absHeight","XAxisLabel","stroke","payload","index","containerWidth","_x","CustomizedCross","CustomTooltip","active","todayStr","PnLBarChart","invisible","widthRef","entry","LineChart","Line","PnlLineChart","dataTransfer","data","series","acc","item","AssetLineChart","opacity","tooltip","VolBarChart","isEmpty","b","maxVolume","decimal","number","decimalPlaces","abbreviations","toFixedWithoutRounding","num","fix","numStr","decimalIndex","cutoffIndex","import_plugin","chartPlugin","addComponents","addBase"],"mappings":"ygBAAA,IAAAA,EAAAC,EAAAC,GAAA,cACA,OAAO,eAAeA,EAAS,aAAc,CACzC,MAAO,EACX,CAAC,EACD,OAAO,eAAeA,EAAS,UAAW,CACtC,WAAY,GACZ,IAAK,UAAW,CACZ,OAAOC,EACX,CACJ,CAAC,EACD,SAASC,EAAaC,EAAQC,EAAQ,CAClC,MAAO,CACH,QAASD,EACT,OAAAC,CACJ,CACJ,CACAF,EAAa,YAAc,SAASG,EAAgBC,EAAiB,KAAK,CAAC,GAAI,CAC3E,IAAMC,EAAkB,SAASC,EAAS,CACtC,MAAO,CACH,UAAWA,EACX,QAASH,EAAeG,CAAO,EAC/B,OAAQF,EAAeE,CAAO,CAClC,CACJ,EACA,OAAAD,EAAgB,oBAAsB,GAGtCA,EAAgB,iBAAmBF,EACnCE,EAAgB,iBAAmBD,EAC5BC,CACX,EACA,IAAMN,GAAWC,IC/BjB,IAAAO,EAAAV,EAAAC,GAAA,cACA,OAAO,eAAeA,EAAS,aAAc,CACzC,MAAO,EACX,CAAC,EACD,OAAO,eAAeA,EAAS,UAAW,CACtC,WAAY,GACZ,IAAK,UAAW,CACZ,OAAOC,EACX,CACJ,CAAC,EACD,IAAMS,GAA8BC,GAAyB,GAA+B,EAC5F,SAASA,GAAyBC,EAAK,CACnC,OAAOA,GAAOA,EAAI,WAAaA,EAAM,CACjC,QAASA,CACb,CACJ,CACA,IAAMX,GAAWS,GAAc,UChB/B,IAAAG,EAAAd,EAAA,CAAAC,GAAAc,IAAA,kBAAIZ,EAAe,IACnBY,EAAO,SAAWZ,EAAa,WAAaA,EAAe,CAAE,QAASA,CAAa,GAAG,UCDtF,OAAS,WAAAa,MAAe,QCAjB,IAAMC,EAAiB,IAAM,CAClC,IAAMC,EAAO,SAAS,gBAChBC,EAAgB,iBAAiBD,CAAI,EA4B3C,MA1Be,CACb,QAASE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,KACjB,CACF,CACF,EACA,CACE,cAAe,EACjB,CACF,CACF,CAAC","sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nfunction createPlugin(plugin, config) {\n return {\n handler: plugin,\n config\n };\n}\ncreatePlugin.withOptions = function(pluginFunction, configFunction = ()=>({})) {\n const optionsFunction = function(options) {\n return {\n __options: options,\n handler: pluginFunction(options),\n config: configFunction(options)\n };\n };\n optionsFunction.__isOptionsFunction = true;\n // Expose plugin dependencies so that `object-hash` returns a different\n // value if anything here changes, to ensure a rebuild is triggered.\n optionsFunction.__pluginFunction = pluginFunction;\n optionsFunction.__configFunction = configFunction;\n return optionsFunction;\n};\nconst _default = createPlugin;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nconst _createPlugin = /*#__PURE__*/ _interop_require_default(require(\"../util/createPlugin\"));\nfunction _interop_require_default(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\nconst _default = _createPlugin.default;\n","let createPlugin = require('./lib/public/create-plugin')\nmodule.exports = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default\n","import { useMemo } from \"react\";\nimport { getThemeColors } from \"../utils/theme\";\n\nexport const useColors = (colors?: { profit: string; loss: string }) => {\n const _colors = useMemo(() => {\n const themeColors = getThemeColors();\n return {\n profit: colors?.profit || themeColors.profit,\n loss: colors?.loss || themeColors.loss,\n primary: themeColors.primary,\n primaryLight: themeColors.primaryLight,\n };\n }, [colors]);\n\n return _colors;\n};\n","export const getThemeColors = () => {\n const root = document.documentElement;\n const computedStyle = getComputedStyle(root);\n\n const colors = {\n primary: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-primary\")\n ),\n primaryLight: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-primary-light\")\n ),\n secondary: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-secondary\")\n ),\n success: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-success\")\n ),\n warning: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-warning\")\n ),\n danger: convertToRGB(computedStyle.getPropertyValue(\"--oui-color-danger\")),\n info: convertToRGB(computedStyle.getPropertyValue(\"--oui-color-info\")),\n loss: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-trading-loss\")\n ),\n profit: convertToRGB(\n computedStyle.getPropertyValue(\"--oui-color-trading-profit\")\n ),\n };\n\n return colors;\n};\n\nconst convertToRGB = (color: string) => {\n return `rgb(${color.split(\" \").join(\",\")})`;\n};\n","import { useColors } from \"./useColors\";\nimport {\n BarChart,\n XAxis,\n YAxis,\n ResponsiveContainer,\n Bar,\n Cell,\n Tooltip,\n CartesianGrid,\n ReferenceLine,\n Cross,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { Box, cn } from \"@orderly.network/ui\";\nimport { Flex } from \"@orderly.network/ui\";\n// import { XAxisLabel } from \"./xAxisLabel\";\nimport { useRef } from \"react\";\nimport { numberToHumanStyle } from \"@orderly.network/utils\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\n\nexport type PnLChartDataItem = {\n date: string;\n pnl: number;\n};\n\nexport type PnLChartProps = {\n colors?: {\n profit: string;\n loss: string;\n };\n data: PnLChartDataItem[];\n invisible?: boolean;\n};\n\nconst RoundedRectangle = (props: any) => {\n const { fill, x, y, width, height } = props;\n\n const absHeight = Math.abs(height);\n\n return (\n <rect\n rx={2}\n x={x}\n y={height > 0 ? y : y + height}\n width={width}\n height={absHeight}\n stroke=\"none\"\n fill={fill}\n />\n );\n};\n\nexport const XAxisLabel = (props: any) => {\n const { x, y, stroke, payload, index, width, containerWidth } = props;\n\n const _x =\n index === 0\n ? 48\n : containerWidth > 0\n ? containerWidth - 10\n : width + payload.offset;\n\n return (\n <g transform={`translate(${_x},${y - 6})`}>\n <text\n x={0}\n y={0}\n dy={16}\n textAnchor={index === 0 ? \"start\" : \"end\"}\n // textAnchor={\"start\"}\n fontSize={10}\n fill={\"rgba(255,255,255,0.54)\"}\n >\n {index === 0 ? payload.value : \"Now\"}\n </text>\n </g>\n );\n};\n\nconst CustomizedCross = (props: any) => {\n const { width, height, stroke, fill } = props;\n\n return (\n // @ts-ignore\n <Cross\n // y={props.y + props.top}\n x={props.x + props.width / 2}\n top={props.top}\n height={height}\n width={1}\n stroke={\"rgba(255,255,255,0.16)\"}\n strokeDasharray={\"3 2\"}\n fill={\"none\"}\n />\n );\n};\n\nconst CustomTooltip = (props: TooltipProps<any, any>) => {\n const { active, payload, label } = props;\n\n const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? \"Now\" : label}\n value={payload[0].value}\n coloring\n />\n );\n }\n\n return null;\n};\n\nexport const PnLBarChart = (props: PnLChartProps) => {\n const { invisible } = props;\n const colors = useColors(props.colors);\n const widthRef = useRef(0);\n\n return (\n // @ts-ignore\n <ResponsiveContainer\n className={cn(invisible && \"chart-invisible\")}\n onResize={(width, height) => {\n // console.log(\"width\", width, height);\n widthRef.current = width;\n }}\n >\n {/* @ts-ignore */}\n <BarChart\n data={props.data}\n margin={{ left: -10, top: 10, right: 10, bottom: 30 }}\n >\n {!invisible && (\n // @ts-ignore\n <Tooltip\n // cursor={{ fillOpacity: 0.1 }}\n cursor={<CustomizedCross />}\n content={<CustomTooltip />}\n />\n )}\n\n <CartesianGrid vertical={false} stroke=\"#FFFFFF\" strokeOpacity={0.04} />\n <ReferenceLine y={0} stroke=\"rgba(0,0,0,0.04)\" />\n\n {!invisible && (\n // @ts-ignore\n <Bar dataKey=\"pnl\" shape={<RoundedRectangle />}>\n {props.data.map((entry, index) => {\n return (\n // @ts-ignore\n <Cell\n key={`cell-${index}`}\n fill={entry.pnl > 0 ? colors.profit : colors.loss}\n />\n );\n })}\n </Bar>\n )}\n {/* @ts-ignore */}\n <YAxis\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickFormatter={(value) => tickFormatter(value)}\n tickLine={false}\n axisLine={false}\n dataKey={\"pnl\"}\n />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n // axisLine={false}\n tickLine={false}\n interval={props.data.length - 2}\n // tick={renderQuarterTick}\n height={1}\n // scale=\"time\"\n // tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tick={<XAxisLabel containerWidth={widthRef.current} />}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.04}\n />\n </BarChart>\n </ResponsiveContainer>\n );\n};\n","import { Box, Flex, Text } from \"@orderly.network/ui\";\n\nexport const OrderlyChartTooltip = (props: {\n label: string;\n value: string | number;\n unit?: string;\n prefix?: React.ReactNode;\n titleClassName?: string;\n coloring?: boolean;\n dp?: number;\n rm?: number;\n}) => {\n const {\n label,\n value,\n prefix,\n unit = \"USDC\",\n coloring = false,\n dp,\n rm,\n } = props;\n return (\n <Box intensity={600} p={3} r=\"md\">\n <Flex direction={\"row\"} className={props.titleClassName}>\n {prefix}\n <Text.numeral\n unit={unit}\n as=\"div\"\n size=\"sm\"\n coloring={coloring}\n showIdentifier={coloring}\n unitClassName=\"oui-text-base-contrast-54 oui-ml-1\"\n weight=\"semibold\"\n rm={rm}\n dp={dp}\n >\n {value}\n </Text.numeral>\n </Flex>\n <Text size=\"2xs\" intensity={54} weight=\"semibold\">\n {label}\n </Text>\n </Box>\n );\n};\n","import { numberToHumanStyle } from \"@orderly.network/utils\";\n\nexport const tickFormatter = (value: number) => {\n let absValue = Math.abs(value);\n const dp = absValue === 0 ? 0 : absValue <= 10 ? 2 : absValue <= 100 ? 1 : 0;\n\n const formatted = numberToHumanStyle(absValue, dp);\n return value < 0 ? `-${formatted}` : formatted;\n};\n","import { useMemo, useRef } from \"react\";\nimport { getThemeColors } from \"../utils/theme\";\nimport { useColors } from \"./useColors\";\n// import { Line } from \"../line/line\";\nimport {\n LineChart,\n XAxis,\n YAxis,\n Line,\n CartesianGrid,\n ReferenceLine,\n Tooltip,\n ResponsiveContainer,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { XAxisLabel } from \"./xAxisLabel\";\nimport { numberToHumanStyle } from \"@orderly.network/utils\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\n\nexport type PnlLineChartProps = {\n colors?: {\n profit: string;\n loss: string;\n };\n data: any;\n invisible?: boolean;\n};\n\nconst CustomTooltip = (props: TooltipProps<any, any>) => {\n const { active, payload, label } = props;\n\n const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? \"Now\" : label}\n value={payload[0].value}\n coloring\n />\n );\n }\n\n return null;\n};\n\nconst PnlLineChart = (props: PnlLineChartProps) => {\n const colors = useColors(props.colors);\n\n const dataTransfer = (data: any[]) => {\n const series: any[] = [];\n\n data?.reduce((acc, item) => {\n acc += item.pnl;\n series.push({\n ...item,\n pnl: acc,\n _pnl: item.pnl,\n // date: new Date(item.date).getTime(),\n });\n return acc;\n }, 0);\n\n return series;\n };\n\n const data = useMemo(() => dataTransfer(props.data), [props.data]);\n\n return (\n // @ts-ignore\n <ResponsiveContainer className={props.invisible ? \"chart-invisible\" : \"\"}>\n {/* @ts-ignore */}\n <LineChart\n data={data}\n margin={{ top: 20, right: 10, left: -10, bottom: 0 }}\n >\n <CartesianGrid vertical={false} stroke=\"#FFFFFF\" strokeOpacity={0.04} />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n interval={props.data.length - 2}\n // tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tick={<XAxisLabel />}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.04}\n // scale={\"time\"}\n // type=\"number\"\n // range={}\n />\n {/* @ts-ignore */}\n <YAxis\n dataKey=\"pnl\"\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickLine={false}\n axisLine={false}\n tickFormatter={(value) => tickFormatter(value)}\n />\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Tooltip\n cursor={{ strokeDasharray: \"3 2\", strokeOpacity: 0.16 }}\n content={<CustomTooltip />}\n />\n )}\n\n {/* <ReferenceLine y={0} stroke=\"#000\" /> */}\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Line\n type=\"natural\"\n dataKey=\"pnl\"\n stroke={colors.primaryLight}\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n )}\n </LineChart>\n </ResponsiveContainer>\n );\n};\n\nexport { PnlLineChart };\n","export const XAxisLabel = (props: any) => {\n const { x, y, stroke, payload, index } = props;\n\n return (\n <g transform={`translate(${x},${y - 6})`}>\n <text\n x={0}\n y={0}\n dy={16}\n textAnchor=\"end\"\n fontSize={10}\n fill={\"rgba(255,255,255,0.54)\"}\n >\n {index === 0 ? payload.value : \"Now\"}\n </text>\n </g>\n );\n};\n","import { useColors } from \"./useColors\";\n// import { Line } from \"../line/line\";\nimport {\n LineChart,\n XAxis,\n YAxis,\n Line,\n CartesianGrid,\n Tooltip,\n Label,\n ResponsiveContainer,\n} from \"recharts\";\n\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { XAxisLabel } from \"./xAxisLabel\";\nimport { useRef } from \"react\";\nimport { numberToHumanStyle } from \"@orderly.network/utils\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\n\nexport type AssetChartDataItem = {\n date: string;\n account_value: number;\n};\n\nexport type PnlLineChartProps = {\n colors?: {\n profit: string;\n loss: string;\n };\n data: AssetChartDataItem[];\n invisible?: boolean;\n};\n\nconst CustomTooltip = (props: TooltipProps<any, any>) => {\n const { active, payload, label } = props;\n\n const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? \"Now\" : label}\n value={payload[0].value}\n />\n );\n }\n\n return null;\n};\n\nconst AssetLineChart = (props: PnlLineChartProps) => {\n const colors = useColors(props.colors);\n\n // const dataTransfer = (data: any[]) => {\n // const series: any[] = [];\n\n // data.reduce((acc, item) => {\n // acc += item.pnl;\n // series.push({ ...item, pnl: acc, _pnl: item.pnl });\n // return acc;\n // }, 0);\n\n // return series;\n // };\n\n // const data = useMemo(() => dataTransfer(props.data), [props.data]);\n\n return (\n // @ts-ignore\n <ResponsiveContainer className={props.invisible ? \"chart-invisible\" : \"\"}>\n {/* @ts-ignore */}\n <LineChart\n width={530}\n height={180}\n data={props.data}\n margin={{ top: 20, right: 10, left: -20, bottom: -10 }}\n >\n <CartesianGrid vertical={false} stroke=\"#FFFFFF\" strokeOpacity={0.04} />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n interval={props.data.length - 2}\n // tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tick={<XAxisLabel />}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.04}\n ></XAxis>\n {/* @ts-ignore */}\n <YAxis\n dataKey=\"account_value\"\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickLine={false}\n axisLine={false}\n tickFormatter={(value) => tickFormatter(value)}\n />\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Tooltip\n cursor={{ strokeDasharray: \"3 2\", strokeOpacity: 0.16 }}\n content={<CustomTooltip />}\n />\n )}\n\n {/* <Legend /> */}\n {/* @ts-ignore */}\n {!props.invisible && (\n // @ts-ignore\n <Line\n type=\"natural\"\n dataKey=\"account_value\"\n stroke={colors.profit}\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n )}\n </LineChart>\n </ResponsiveContainer>\n );\n};\n\nexport { AssetLineChart };\n","import { useColors } from \"./useColors\";\nimport {\n BarChart,\n XAxis,\n YAxis,\n ResponsiveContainer,\n Bar,\n Cell,\n Tooltip,\n CartesianGrid,\n ReferenceLine,\n Cross,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { Box, cn } from \"@orderly.network/ui\";\n\nexport type VolChartDataItem = {\n date: string;\n volume: number;\n opacity?: string | number;\n};\n\nexport type VolChartTooltip = {\n rm?: number;\n dp?: number;\n};\n\nexport type VolChartProps = {\n colors?: {\n fill: string;\n };\n data: VolChartDataItem[];\n tooltip?: VolChartTooltip;\n className?: string;\n};\n\nconst RoundedRectangle = (props: any) => {\n const { fill, x, y, width, height, opacity } = props;\n const absHeight = Math.abs(height);\n\n return (\n <rect\n rx={2}\n x={x}\n y={height > 0 ? y : y + height}\n width={width}\n height={absHeight}\n stroke=\"none\"\n fill={fill}\n opacity={opacity}\n />\n );\n};\n\nconst CustomizedCross = (props: any) => {\n const { width, height, payload, stroke, fill } = props;\n\n if (payload?.[0]?.value === 0) return null;\n\n return (\n // @ts-ignore\n <Cross\n // y={props.y + props.top}\n x={props.x + props.width / 2}\n top={props.top}\n height={height}\n width={1}\n stroke={\"rgba(255,255,255,0.16)\"}\n strokeDasharray={\"3 2\"}\n fill={\"none\"}\n />\n );\n};\n\nconst CustomTooltip = (\n props: TooltipProps<any, any> & { tooltip?: VolChartTooltip }\n) => {\n const { active, payload, label, tooltip } = props;\n\n if (payload?.[0]?.value === 0) return null;\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label}\n value={payload[0].value}\n // prefix=\"Commission\"\n titleClassName=\"oui-gap-4\"\n rm={tooltip?.rm}\n dp={tooltip?.dp}\n />\n );\n }\n\n return null;\n};\n\nexport const VolBarChart = (props: VolChartProps) => {\n const colors = useColors(\n props.colors?.fill\n ? { profit: props.colors?.fill, loss: props.colors?.fill }\n : undefined\n );\n\n const isEmpty = props.data.reduce((a, b) => a + b.volume, 0) === 0;\n const maxVolume = props.data.reduce((a,b) => (a > b.volume ? a : b.volume), 0);\n const decimal = maxVolume <= 10 ? 2 : (maxVolume <= 100 ? 1 : 0);\n\n return (\n // @ts-ignore\n <Box className={cn(props.className)}>\n {/* @ts-ignore */}\n <ResponsiveContainer>\n {/* @ts-ignore */}\n <BarChart\n data={props.data}\n margin={{ left: -0, top: 6, right: 0, bottom: 20 }}\n >\n {/* @ts-ignore */}\n <Tooltip\n // cursor={{ fillOpacity: 0.1 }}\n cursor={<CustomizedCross />}\n content={<CustomTooltip tooltip={props.tooltip} />}\n />\n <CartesianGrid\n vertical={false}\n stroke=\"#FFFFFF\"\n strokeOpacity={0.08}\n repeatCount={6}\n />\n <ReferenceLine y={0} stroke=\"#000\" />\n {/* @ts-ignore */}\n <Bar dataKey=\"volume\" shape={<RoundedRectangle />} minPointSize={1}>\n {props.data.map((entry, index) => {\n return (\n // @ts-ignore\n <Cell\n key={`cell-${index}`}\n fill={entry.volume > 0 ? colors.profit : colors.loss}\n opacity={entry.opacity}\n />\n );\n })}\n </Bar>\n {/* @ts-ignore */}\n <YAxis\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n tickLine={false}\n axisLine={false}\n dataKey={\"volume\"}\n tickFormatter={(value, index) => {\n if (isEmpty) return `${index * 100}`;\n return numberToHumanStyle(value, decimal);\n }}\n width={45}\n />\n {/* @ts-ignore */}\n <XAxis\n dataKey=\"date\"\n // axisLine={false}\n tickLine={false}\n interval={props.data.length - 2}\n // tick={renderQuarterTick}\n height={1}\n // scale=\"time\"\n tick={{ fontSize: 10, fill: \"rgba(255,255,255,0.54)\" }}\n stroke=\"rgb(229, 231, 235)\"\n strokeOpacity={0.2}\n />\n </BarChart>\n </ResponsiveContainer>\n </Box>\n );\n};\nfunction numberToHumanStyle(number: number, decimalPlaces: number = 0): string {\n const abbreviations = [\"\", \"K\", \"M\", \"B\", \"T\"];\n\n let index = 0;\n while (number >= 1000 && index < abbreviations.length - 1) {\n number /= 1000;\n index++;\n }\n\n const roundedNumber = toFixedWithoutRounding(number, decimalPlaces);\n\n return `${roundedNumber}${abbreviations[index]}`;\n}\n\nfunction toFixedWithoutRounding(num: number, fix: number): string {\n const numStr = num.toString();\n const decimalIndex = numStr.indexOf(\".\");\n\n if (decimalIndex === -1 || fix === 0) {\n return numStr.split(\".\")[0];\n }\n\n const cutoffIndex = decimalIndex + fix + 1;\n\n return numStr.slice(0, cutoffIndex);\n}\n","import plugin from \"tailwindcss/plugin\";\n\nimport { PluginCreator } from \"tailwindcss/types/config\";\n\nexport const chartPlugin: PluginCreator = () =>\n plugin(function ({ addComponents, addBase }) {\n addComponents(\n {\n \".xAxis\": {\n \".recharts-cartesian-axis-tick:first-child text\": {\n \"text-anchor\": \"start\",\n },\n \".recharts-cartesian-axis-tick:last-child text\": {\n \"text-anchor\": \"end\",\n },\n },\n },\n {\n respectPrefix: false,\n }\n );\n });\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orderly.network/chart",
|
|
3
|
-
"version": "2.0.1-alpha.
|
|
3
|
+
"version": "2.0.1-alpha.5",
|
|
4
4
|
"description": "Charting library for Orderly Network",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"d3-selection": "^3.0.0",
|
|
37
37
|
"d3-shape": "^3.2.0",
|
|
38
38
|
"recharts": "^2.12.7",
|
|
39
|
-
"@orderly.network/utils": "2.0.1-alpha.
|
|
40
|
-
"@orderly.network/ui": "2.0.1-alpha.
|
|
39
|
+
"@orderly.network/utils": "2.0.1-alpha.5",
|
|
40
|
+
"@orderly.network/ui": "2.0.1-alpha.5"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "tsup",
|