@orderly.network/chart 2.1.0 → 2.1.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/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/tailwindcss@3.4.4_ts-node@10.9.2/node_modules/tailwindcss/lib/util/createPlugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.4_ts-node@10.9.2/node_modules/tailwindcss/lib/public/create-plugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.4_ts-node@10.9.2/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","useTranslation","RoundedRectangle","fill","x","y","width","height","absHeight","XAxisLabel","stroke","payload","index","containerWidth","t","_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,EACPD,EAAc,iBAAiB,qBAAqB,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C,GAAIC,IAAiB,IAAMF,IAAQ,EACjC,OAAOC,EAAO,MAAM,GAAG,EAAE,CAAC,EAG5B,IAAME,EAAcD,EAAeF,EAAM,EAEzC,OAAOC,EAAO,MAAM,EAAGE,CAAW,CACpC,CCzMA,IAAAC,EAAmB,OAINC,GAA6B,OACxC,EAAApG,SAAO,SAAU,CAAE,cAAAqG,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 { cn } from \"@orderly.network/ui\";\nimport { useRef } from \"react\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\nimport { useTranslation } from \"@orderly.network/i18n\";\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 const { t } = useTranslation();\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 : t(\"chart.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 const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n const { t } = useTranslation();\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? t(\"chart.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 {/* @ts-ignore */}\n <ReferenceLine y={0} stroke=\"rgba(0,0,0,0.04)\" />\n {/* @ts-ignore */}\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\";\nimport { useTranslation } from \"@orderly.network/i18n\";\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 const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n const { t } = useTranslation();\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? t(\"chart.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.primary}\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n )}\n </LineChart>\n </ResponsiveContainer>\n );\n};\n\nexport { PnlLineChart };\n","import { useTranslation } from \"@orderly.network/i18n\";\n\nexport const XAxisLabel = (props: any) => {\n const { x, y, stroke, payload, index } = props;\n const { t } = useTranslation();\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 : t(\"chart.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 ResponsiveContainer,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { XAxisLabel } from \"./xAxisLabel\";\nimport { useRef } from \"react\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\nimport { useTranslation } from \"@orderly.network/i18n\";\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 const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n const { t } = useTranslation();\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? t(\"chart.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 {/* @ts-ignore */}\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_ts-node@10.9.2_@swc+core@1.4.12_@swc+helpers@0.5.15__@types+node@22.12.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.12.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.12.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","useTranslation","RoundedRectangle","fill","x","y","width","height","absHeight","XAxisLabel","stroke","payload","index","containerWidth","t","_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,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AQ,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 { cn } from \"@orderly.network/ui\";\nimport { useRef } from \"react\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\nimport { useTranslation } from \"@orderly.network/i18n\";\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 const { t } = useTranslation();\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 : t(\"chart.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 const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n const { t } = useTranslation();\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? t(\"chart.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 {/* @ts-ignore */}\n <ReferenceLine y={0} stroke=\"rgba(0,0,0,0.04)\" />\n {/* @ts-ignore */}\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\";\nimport { useTranslation } from \"@orderly.network/i18n\";\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 const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n const { t } = useTranslation();\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? t(\"chart.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.primary}\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n )}\n </LineChart>\n </ResponsiveContainer>\n );\n};\n\nexport { PnlLineChart };\n","import { useTranslation } from \"@orderly.network/i18n\";\n\nexport const XAxisLabel = (props: any) => {\n const { x, y, stroke, payload, index } = props;\n const { t } = useTranslation();\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 : t(\"chart.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 ResponsiveContainer,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { XAxisLabel } from \"./xAxisLabel\";\nimport { useRef } from \"react\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\nimport { useTranslation } from \"@orderly.network/i18n\";\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 const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n const { t } = useTranslation();\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? t(\"chart.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 {/* @ts-ignore */}\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/node_modules/tailwindcss/lib/util/createPlugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.4_ts-node@10.9.2/node_modules/tailwindcss/lib/public/create-plugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.4_ts-node@10.9.2/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","useTranslation","RoundedRectangle","fill","x","y","width","height","absHeight","XAxisLabel","stroke","payload","index","containerWidth","t","_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,I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,GAC3Bf,GAAmBR,EAAOkD,CAAO,EAE1C,MAAO,GACT,EAEAvD,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,GAAmB2C,EAAgBC,EAAwB,EAAW,CAC7E,IAAMC,EAAgB,CAAC,GAAI,IAAK,IAAK,IAAK,GAAG,EAEzC9B,EAAQ,EACZ,KAAO4B,GAAU,KAAQ5B,EAAQ8B,EAAc,OAAS,GACtDF,GAAU,IACV5B,IAKF,MAAO,GAFe+B,GAAuBH,EAAQC,CAAa,CAE3C,GAAGC,EAAc9B,CAAK,CAAC,EAChD,CAEA,SAAS+B,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,CCzMA,IAAAC,EAAmB,OAINC,GAA6B,OACxC,EAAApG,SAAO,SAAU,CAAE,cAAAqG,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 { cn } from \"@orderly.network/ui\";\nimport { useRef } from \"react\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\nimport { useTranslation } from \"@orderly.network/i18n\";\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 const { t } = useTranslation();\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 : t(\"chart.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 const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n const { t } = useTranslation();\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? t(\"chart.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 {/* @ts-ignore */}\n <ReferenceLine y={0} stroke=\"rgba(0,0,0,0.04)\" />\n {/* @ts-ignore */}\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\";\nimport { useTranslation } from \"@orderly.network/i18n\";\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 const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n const { t } = useTranslation();\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? t(\"chart.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.primary}\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n )}\n </LineChart>\n </ResponsiveContainer>\n );\n};\n\nexport { PnlLineChart };\n","import { useTranslation } from \"@orderly.network/i18n\";\n\nexport const XAxisLabel = (props: any) => {\n const { x, y, stroke, payload, index } = props;\n const { t } = useTranslation();\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 : t(\"chart.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 ResponsiveContainer,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { XAxisLabel } from \"./xAxisLabel\";\nimport { useRef } from \"react\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\nimport { useTranslation } from \"@orderly.network/i18n\";\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 const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n const { t } = useTranslation();\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? t(\"chart.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 {/* @ts-ignore */}\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_ts-node@10.9.2_@swc+core@1.4.12_@swc+helpers@0.5.15__@types+node@22.12.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.12.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.12.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","useTranslation","RoundedRectangle","fill","x","y","width","height","absHeight","XAxisLabel","stroke","payload","index","containerWidth","t","_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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U,GAAmB2C,EAAgBC,EAAwB,EAAW,CAC7E,IAAMC,EAAgB,CAAC,GAAI,IAAK,IAAK,IAAK,GAAG,EAEzC9B,EAAQ,EACZ,KAAO4B,GAAU,KAAQ5B,EAAQ8B,EAAc,OAAS,GACtDF,GAAU,IACV5B,IAKF,MAAO,GAFe+B,GAAuBH,EAAQC,CAAa,CAE3C,GAAGC,EAAc9B,CAAK,CAAC,EAChD,CAEA,SAAS+B,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,CCzMA,IAAAC,EAAmB,OAINC,GAA6B,OACxC,EAAApG,SAAO,SAAU,CAAE,cAAAqG,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 { cn } from \"@orderly.network/ui\";\nimport { useRef } from \"react\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\nimport { useTranslation } from \"@orderly.network/i18n\";\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 const { t } = useTranslation();\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 : t(\"chart.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 const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n const { t } = useTranslation();\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? t(\"chart.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 {/* @ts-ignore */}\n <ReferenceLine y={0} stroke=\"rgba(0,0,0,0.04)\" />\n {/* @ts-ignore */}\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\";\nimport { useTranslation } from \"@orderly.network/i18n\";\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 const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n const { t } = useTranslation();\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? t(\"chart.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.primary}\n strokeWidth={2}\n dot={false}\n isAnimationActive={false}\n />\n )}\n </LineChart>\n </ResponsiveContainer>\n );\n};\n\nexport { PnlLineChart };\n","import { useTranslation } from \"@orderly.network/i18n\";\n\nexport const XAxisLabel = (props: any) => {\n const { x, y, stroke, payload, index } = props;\n const { t } = useTranslation();\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 : t(\"chart.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 ResponsiveContainer,\n} from \"recharts\";\nimport type { TooltipProps } from \"recharts\";\nimport { OrderlyChartTooltip } from \"./customTooltip\";\nimport { XAxisLabel } from \"./xAxisLabel\";\nimport { useRef } from \"react\";\nimport { tickFormatter } from \"../utils/yTickFormatter\";\nimport { useTranslation } from \"@orderly.network/i18n\";\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 const todayStr = useRef(new Date().toISOString().split(\"T\")[0]);\n const { t } = useTranslation();\n\n if (active && payload && payload.length) {\n return (\n <OrderlyChartTooltip\n label={label === todayStr.current ? t(\"chart.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 {/* @ts-ignore */}\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.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Charting library for Orderly Network",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"react-dom": "^18.2.0",
|
|
24
24
|
"tailwindcss": "^3.4.4",
|
|
25
25
|
"tsup": "^8.1.0",
|
|
26
|
-
"tsconfig": "0.4.
|
|
26
|
+
"tsconfig": "0.4.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": ">=18",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"d3-selection": "^3.0.0",
|
|
37
37
|
"d3-shape": "^3.2.0",
|
|
38
38
|
"recharts": "^2.12.7",
|
|
39
|
-
"@orderly.network/
|
|
40
|
-
"@orderly.network/
|
|
41
|
-
"@orderly.network/
|
|
39
|
+
"@orderly.network/i18n": "2.1.1",
|
|
40
|
+
"@orderly.network/ui": "2.1.1",
|
|
41
|
+
"@orderly.network/utils": "2.1.1"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsup",
|