@orderly.network/chart 2.1.3 → 2.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var react = require('react');
|
|
4
|
-
var recharts = require('recharts');
|
|
5
|
-
var ui = require('@orderly.network/ui');
|
|
6
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var utils = require('@orderly.network/utils');
|
|
8
|
-
var i18n = require('@orderly.network/i18n');
|
|
9
|
-
|
|
10
|
-
var N=Object.create;var k=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var g=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var X=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of K(e))!M.call(t,i)&&i!==r&&k(t,i,{get:()=>e[i],enumerable:!(o=I(e,i))||o.enumerable});return t};var G=(t,e,r)=>(r=t!=null?N($(t)):{},X(!t||!t.__esModule?k(r,"default",{value:t,enumerable:true}):r,t));var O=g(x=>{Object.defineProperty(x,"__esModule",{value:true});Object.defineProperty(x,"default",{enumerable:true,get:function(){return re}});function S(t,e){return {handler:t,config:e}}S.withOptions=function(t,e=()=>({})){let r=function(o){return {__options:o,handler:t(o),config:e(o)}};return r.__isOptionsFunction=true,r.__pluginFunction=t,r.__configFunction=e,r};var re=S;});var A=g(C=>{Object.defineProperty(C,"__esModule",{value:true});Object.defineProperty(C,"default",{enumerable:true,get:function(){return ae}});var oe=ie(O());function ie(t){return t&&t.__esModule?t:{default:t}}var ae=oe.default;});var V=g((rr,R)=>{var b=A();R.exports=(b.__esModule?b:{default:b}).default;});var v=()=>{let t=document.documentElement,e=getComputedStyle(t);return {primary:u(e.getPropertyValue("--oui-color-primary")),primaryLight:u(e.getPropertyValue("--oui-color-primary-light")),secondary:u(e.getPropertyValue("--oui-color-secondary")),success:u(e.getPropertyValue("--oui-color-success")),warning:u(e.getPropertyValue("--oui-color-warning")),danger:u(e.getPropertyValue("--oui-color-danger")),info:u(e.getPropertyValue("--oui-color-info")),loss:u(e.getPropertyValue("--oui-color-trading-loss")),profit:u(e.getPropertyValue("--oui-color-trading-profit"))}},u=t=>`rgb(${t.split(" ").join(",")})`;var f=t=>react.useMemo(()=>{let r=v();return {profit:t?.profit||r.profit,loss:t?.loss||r.loss,primary:r.primary,primaryLight:r.primaryLight}},[t]);var d=t=>{let{label:e,value:r,prefix:o,unit:i="USDC",coloring:a=false,dp:n,rm:c}=t;return jsxRuntime.jsxs(ui.Box,{intensity:600,p:3,r:"md",children:[jsxRuntime.jsxs(ui.Flex,{direction:"row",className:t.titleClassName,children:[o,jsxRuntime.jsx(ui.Text.numeral,{unit:i,as:"div",size:"sm",coloring:a,showIdentifier:a,unitClassName:"oui-text-base-contrast-54 oui-ml-1",weight:"semibold",rm:c,dp:n,children:r})]}),jsxRuntime.jsx(ui.Text,{size:"2xs",intensity:54,weight:"semibold",children:e})]})};var h=t=>{let e=Math.abs(t),r=e===0?0:e<=10?2:e<=100?1:0,o=utils.numberToHumanStyle(e,r);return t<0?`-${o}`:o};var at=t=>{let{fill:e,x:r,y:o,width:i,height:a}=t,n=Math.abs(a);return jsxRuntime.jsx("rect",{rx:2,x:r,y:a>0?o:o+a,width:i,height:n,stroke:"none",fill:e})},nt=t=>{let{x:e,y:r,stroke:o,payload:i,index:a,width:n,containerWidth:c}=t,{t:z}=i18n.useTranslation(),D=a===0?48:c>0?c-10:n+i.offset;return jsxRuntime.jsx("g",{transform:`translate(${D},${r-6})`,children:jsxRuntime.jsx("text",{x:0,y:0,dy:16,textAnchor:a===0?"start":"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:a===0?i.value:z("chart.now")})})},lt=t=>{let{width:e,height:r,stroke:o,fill:i}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:r,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},st=t=>{let{active:e,payload:r,label:o}=t,i=react.useRef(new Date().toISOString().split("T")[0]),{t:a}=i18n.useTranslation();return e&&r&&r.length?jsxRuntime.jsx(d,{label:o===i.current?a("chart.now"):o,value:r[0].value,coloring:true}):null},ct=t=>{let{invisible:e}=t,r=f(t.colors),o=react.useRef(0);return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:ui.cn(e&&"chart-invisible"),onResize:(i,a)=>{o.current=i;},children:jsxRuntime.jsxs(recharts.BarChart,{data:t.data,margin:{left:-10,top:10,right:10,bottom:30},children:[!e&&jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(lt,{}),content:jsxRuntime.jsx(st,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),!e&&jsxRuntime.jsx(recharts.Bar,{dataKey:"pnl",shape:jsxRuntime.jsx(at,{}),children:t.data.map((i,a)=>jsxRuntime.jsx(recharts.Cell,{fill:i.pnl>0?r.profit:r.loss},`cell-${a}`))}),jsxRuntime.jsx(recharts.YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickFormatter:i=>h(i),tickLine:false,axisLine:false,dataKey:"pnl"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:t.data.length-2,height:1,tick:jsxRuntime.jsx(nt,{containerWidth:o.current}),stroke:"#FFFFFF",strokeOpacity:.04})]})})};var y=t=>{let{x:e,y:r,stroke:o,payload:i,index:a}=t,{t:n}=i18n.useTranslation();return jsxRuntime.jsx("g",{transform:`translate(${e},${r-6})`,children:jsxRuntime.jsx("text",{x:0,y:0,dy:16,textAnchor:"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:a===0?i.value:n("chart.now")})})};var vt=t=>{let{active:e,payload:r,label:o}=t,i=react.useRef(new Date().toISOString().split("T")[0]),{t:a}=i18n.useTranslation();return e&&r&&r.length?jsxRuntime.jsx(d,{label:o===i.current?a("chart.now"):o,value:r[0].value,coloring:true}):null},Ft=t=>{let e=f(t.colors),r=i=>{let a=[];return i?.reduce((n,c)=>(n+=c.pnl,a.push({...c,pnl:n,_pnl:c.pnl}),n),0),a},o=react.useMemo(()=>r(t.data),[t.data]);return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":"",children:jsxRuntime.jsxs(recharts.LineChart,{data:o,margin:{top:20,right:10,left:-10,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(y,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"pnl",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:i=>h(i)}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(vt,{})}),!t.invisible&&jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"pnl",stroke:e.primary,strokeWidth:2,dot:false,isAnimationActive:false})]})})};var Bt=t=>{let{active:e,payload:r,label:o}=t,i=react.useRef(new Date().toISOString().split("T")[0]),{t:a}=i18n.useTranslation();return e&&r&&r.length?jsxRuntime.jsx(d,{label:o===i.current?a("chart.now"):o,value:r[0].value}):null},zt=t=>{let e=f(t.colors);return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":"",children:jsxRuntime.jsxs(recharts.LineChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(y,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:r=>h(r)}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(Bt,{})}),!t.invisible&&jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:2,dot:false,isAnimationActive:false})]})})};var Qt=t=>{let{fill:e,x:r,y:o,width:i,height:a,opacity:n}=t,c=Math.abs(a);return jsxRuntime.jsx("rect",{rx:2,x:r,y:a>0?o:o+a,width:i,height:c,stroke:"none",fill:e,opacity:n})},Ut=t=>{let{width:e,height:r,payload:o,stroke:i,fill:a}=t;return o?.[0]?.value===0?null:jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:r,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},Jt=t=>{let{active:e,payload:r,label:o,tooltip:i}=t;return r?.[0]?.value===0?null:e&&r&&r.length?jsxRuntime.jsx(d,{label:o,value:r[0].value,titleClassName:"oui-gap-4",rm:i?.rm,dp:i?.dp}):null},Zt=t=>{let e=f(t.colors?.fill?{profit:t.colors?.fill,loss:t.colors?.fill}:void 0),r=t.data.reduce((a,n)=>a+n.volume,0)===0,o=t.data.reduce((a,n)=>a>n.volume?a:n.volume,0),i=o<=10?2:o<=100?1:0;return jsxRuntime.jsx(ui.Box,{className:ui.cn(t.className),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{children:jsxRuntime.jsxs(recharts.BarChart,{data:t.data,margin:{left:-0,top:6,right:0,bottom:20},children:[jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(Ut,{}),content:jsxRuntime.jsx(Jt,{tooltip:t.tooltip})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.08,repeatCount:6}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"#000"}),jsxRuntime.jsx(recharts.Bar,{dataKey:"volume",shape:jsxRuntime.jsx(Qt,{}),minPointSize:1,children:t.data.map((a,n)=>jsxRuntime.jsx(recharts.Cell,{fill:a.volume>0?e.profit:e.loss,opacity:a.opacity},`cell-${n}`))}),jsxRuntime.jsx(recharts.YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,dataKey:"volume",tickFormatter:(a,n)=>r?`${n*100}`:jt(a,i),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:t.data.length-2,height:1,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"rgb(229, 231, 235)",strokeOpacity:.2})]})})})};function jt(t,e=0){let r=["","K","M","B","T"],o=0;for(;t>=1e3&&o<r.length-1;)t/=1e3,o++;return `${te(t,e)}${r[o]}`}function te(t,e){let r=t.toString(),o=r.indexOf(".");if(o===-1||e===0)return r.split(".")[0];let i=o+e+1;return r.slice(0,i)}var B=G(V()),ne=()=>(0, B.default)(function({addComponents:t,addBase:e}){t({".xAxis":{".recharts-cartesian-axis-tick:first-child text":{"text-anchor":"start"},".recharts-cartesian-axis-tick:last-child text":{"text-anchor":"end"}}},{respectPrefix:false});});
|
|
11
|
-
|
|
12
|
-
exports.AssetLineChart = zt;
|
|
13
|
-
exports.PnLBarChart = ct;
|
|
14
|
-
exports.PnlLineChart = Ft;
|
|
15
|
-
exports.VolBarChart = Zt;
|
|
16
|
-
exports.chartPlugin = ne;
|
|
17
|
-
//# sourceMappingURL=out.js.map
|
|
1
|
+
'use strict';var react=require('react'),recharts=require('recharts'),ui=require('@orderly.network/ui'),jsxRuntime=require('react/jsx-runtime'),utils=require('@orderly.network/utils'),i18n=require('@orderly.network/i18n');var N=Object.create;var k=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var g=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var X=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of K(e))!M.call(t,i)&&i!==r&&k(t,i,{get:()=>e[i],enumerable:!(o=I(e,i))||o.enumerable});return t};var G=(t,e,r)=>(r=t!=null?N($(t)):{},X(!t||!t.__esModule?k(r,"default",{value:t,enumerable:true}):r,t));var O=g(x=>{Object.defineProperty(x,"__esModule",{value:true});Object.defineProperty(x,"default",{enumerable:true,get:function(){return re}});function S(t,e){return {handler:t,config:e}}S.withOptions=function(t,e=()=>({})){let r=function(o){return {__options:o,handler:t(o),config:e(o)}};return r.__isOptionsFunction=true,r.__pluginFunction=t,r.__configFunction=e,r};var re=S;});var A=g(C=>{Object.defineProperty(C,"__esModule",{value:true});Object.defineProperty(C,"default",{enumerable:true,get:function(){return ae}});var oe=ie(O());function ie(t){return t&&t.__esModule?t:{default:t}}var ae=oe.default;});var V=g((rr,R)=>{var b=A();R.exports=(b.__esModule?b:{default:b}).default;});var v=()=>{let t=document.documentElement,e=getComputedStyle(t);return {primary:u(e.getPropertyValue("--oui-color-primary")),primaryLight:u(e.getPropertyValue("--oui-color-primary-light")),secondary:u(e.getPropertyValue("--oui-color-secondary")),success:u(e.getPropertyValue("--oui-color-success")),warning:u(e.getPropertyValue("--oui-color-warning")),danger:u(e.getPropertyValue("--oui-color-danger")),info:u(e.getPropertyValue("--oui-color-info")),loss:u(e.getPropertyValue("--oui-color-trading-loss")),profit:u(e.getPropertyValue("--oui-color-trading-profit"))}},u=t=>`rgb(${t.split(" ").join(",")})`;var f=t=>react.useMemo(()=>{let r=v();return {profit:t?.profit||r.profit,loss:t?.loss||r.loss,primary:r.primary,primaryLight:r.primaryLight}},[t]);var d=t=>{let{label:e,value:r,prefix:o,unit:i="USDC",coloring:a=false,dp:n,rm:c}=t;return jsxRuntime.jsxs(ui.Box,{intensity:600,p:3,r:"md",children:[jsxRuntime.jsxs(ui.Flex,{direction:"row",className:t.titleClassName,children:[o,jsxRuntime.jsx(ui.Text.numeral,{unit:i,as:"div",size:"sm",coloring:a,showIdentifier:a,unitClassName:"oui-text-base-contrast-54 oui-ml-1",weight:"semibold",rm:c,dp:n,children:r})]}),jsxRuntime.jsx(ui.Text,{size:"2xs",intensity:54,weight:"semibold",children:e})]})};var h=t=>{let e=Math.abs(t),r=e===0?0:e<=10?2:e<=100?1:0,o=utils.numberToHumanStyle(e,r);return t<0?`-${o}`:o};var at=t=>{let{fill:e,x:r,y:o,width:i,height:a}=t,n=Math.abs(a);return jsxRuntime.jsx("rect",{rx:2,x:r,y:a>0?o:o+a,width:i,height:n,stroke:"none",fill:e})},nt=t=>{let{x:e,y:r,stroke:o,payload:i,index:a,width:n,containerWidth:c}=t,{t:z}=i18n.useTranslation(),D=a===0?48:c>0?c-10:n+i.offset;return jsxRuntime.jsx("g",{transform:`translate(${D},${r-6})`,children:jsxRuntime.jsx("text",{x:0,y:0,dy:16,textAnchor:a===0?"start":"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:a===0?i.value:z("chart.now")})})},lt=t=>{let{width:e,height:r,stroke:o,fill:i}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:r,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},st=t=>{let{active:e,payload:r,label:o}=t,i=react.useRef(new Date().toISOString().split("T")[0]),{t:a}=i18n.useTranslation();return e&&r&&r.length?jsxRuntime.jsx(d,{label:o===i.current?a("chart.now"):o,value:r[0].value,coloring:true}):null},ct=t=>{let{invisible:e}=t,r=f(t.colors),o=react.useRef(0);return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:ui.cn(e&&"chart-invisible"),onResize:(i,a)=>{o.current=i;},children:jsxRuntime.jsxs(recharts.BarChart,{data:t.data,margin:{left:-10,top:10,right:10,bottom:30},children:[!e&&jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(lt,{}),content:jsxRuntime.jsx(st,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),!e&&jsxRuntime.jsx(recharts.Bar,{dataKey:"pnl",shape:jsxRuntime.jsx(at,{}),children:t.data.map((i,a)=>jsxRuntime.jsx(recharts.Cell,{fill:i.pnl>0?r.profit:r.loss},`cell-${a}`))}),jsxRuntime.jsx(recharts.YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickFormatter:i=>h(i),tickLine:false,axisLine:false,dataKey:"pnl"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:t.data.length-2,height:1,tick:jsxRuntime.jsx(nt,{containerWidth:o.current}),stroke:"#FFFFFF",strokeOpacity:.04})]})})};var y=t=>{let{x:e,y:r,stroke:o,payload:i,index:a}=t,{t:n}=i18n.useTranslation();return jsxRuntime.jsx("g",{transform:`translate(${e},${r-6})`,children:jsxRuntime.jsx("text",{x:0,y:0,dy:16,textAnchor:"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:a===0?i.value:n("chart.now")})})};var vt=t=>{let{active:e,payload:r,label:o}=t,i=react.useRef(new Date().toISOString().split("T")[0]),{t:a}=i18n.useTranslation();return e&&r&&r.length?jsxRuntime.jsx(d,{label:o===i.current?a("chart.now"):o,value:r[0].value,coloring:true}):null},Ft=t=>{let e=f(t.colors),r=i=>{let a=[];return i?.reduce((n,c)=>(n+=c.pnl,a.push({...c,pnl:n,_pnl:c.pnl}),n),0),a},o=react.useMemo(()=>r(t.data),[t.data]);return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":"",children:jsxRuntime.jsxs(recharts.LineChart,{data:o,margin:{top:20,right:10,left:-10,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(y,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"pnl",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:i=>h(i)}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(vt,{})}),!t.invisible&&jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"pnl",stroke:e.primary,strokeWidth:2,dot:false,isAnimationActive:false})]})})};var Bt=t=>{let{active:e,payload:r,label:o}=t,i=react.useRef(new Date().toISOString().split("T")[0]),{t:a}=i18n.useTranslation();return e&&r&&r.length?jsxRuntime.jsx(d,{label:o===i.current?a("chart.now"):o,value:r[0].value}):null},zt=t=>{let e=f(t.colors);return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":"",children:jsxRuntime.jsxs(recharts.LineChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(y,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:r=>h(r)}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(Bt,{})}),!t.invisible&&jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:2,dot:false,isAnimationActive:false})]})})};var Qt=t=>{let{fill:e,x:r,y:o,width:i,height:a,opacity:n}=t,c=Math.abs(a);return jsxRuntime.jsx("rect",{rx:2,x:r,y:a>0?o:o+a,width:i,height:c,stroke:"none",fill:e,opacity:n})},Ut=t=>{let{width:e,height:r,payload:o,stroke:i,fill:a}=t;return o?.[0]?.value===0?null:jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:r,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},Jt=t=>{let{active:e,payload:r,label:o,tooltip:i}=t;return r?.[0]?.value===0?null:e&&r&&r.length?jsxRuntime.jsx(d,{label:o,value:r[0].value,titleClassName:"oui-gap-4",rm:i?.rm,dp:i?.dp}):null},Zt=t=>{let e=f(t.colors?.fill?{profit:t.colors?.fill,loss:t.colors?.fill}:void 0),r=t.data.reduce((a,n)=>a+n.volume,0)===0,o=t.data.reduce((a,n)=>a>n.volume?a:n.volume,0),i=o<=10?2:o<=100?1:0;return jsxRuntime.jsx(ui.Box,{className:ui.cn(t.className),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{children:jsxRuntime.jsxs(recharts.BarChart,{data:t.data,margin:{left:-0,top:6,right:0,bottom:20},children:[jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(Ut,{}),content:jsxRuntime.jsx(Jt,{tooltip:t.tooltip})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.08,repeatCount:6}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"#000"}),jsxRuntime.jsx(recharts.Bar,{dataKey:"volume",shape:jsxRuntime.jsx(Qt,{}),minPointSize:1,children:t.data.map((a,n)=>jsxRuntime.jsx(recharts.Cell,{fill:a.volume>0?e.profit:e.loss,opacity:a.opacity},`cell-${n}`))}),jsxRuntime.jsx(recharts.YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,dataKey:"volume",tickFormatter:(a,n)=>r?`${n*100}`:jt(a,i),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:t.data.length-2,height:1,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"rgb(229, 231, 235)",strokeOpacity:.2})]})})})};function jt(t,e=0){let r=["","K","M","B","T"],o=0;for(;t>=1e3&&o<r.length-1;)t/=1e3,o++;return `${te(t,e)}${r[o]}`}function te(t,e){let r=t.toString(),o=r.indexOf(".");if(o===-1||e===0)return r.split(".")[0];let i=o+e+1;return r.slice(0,i)}var B=G(V()),ne=()=>(0, B.default)(function({addComponents:t,addBase:e}){t({".xAxis":{".recharts-cartesian-axis-tick:first-child text":{"text-anchor":"start"},".recharts-cartesian-axis-tick:last-child text":{"text-anchor":"end"}}},{respectPrefix:false});});exports.AssetLineChart=zt;exports.PnLBarChart=ct;exports.PnlLineChart=Ft;exports.VolBarChart=Zt;exports.chartPlugin=ne;//# sourceMappingURL=index.js.map
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
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.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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ineProperty(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.17_ts-node@10.9.2_@swc+core@1.11.24_@swc+helpers@0.5.17__@types+node@22.15.18_typescript@5.8.3_/node_modules/tailwindcss/lib/util/createPlugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.17_ts-node@10.9.2_@swc+core@1.11.24_@swc+helpers@0.5.17__@types+node@22.15.18_typescript@5.8.3_/node_modules/tailwindcss/lib/public/create-plugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.17_ts-node@10.9.2_@swc+core@1.11.24_@swc+helpers@0.5.17__@types+node@22.15.18_typescript@5.8.3_/node_modules/tailwindcss/plugin.js","../src/utils/theme.ts","../src/orderly/useColors.ts","../src/orderly/pnlBar.tsx","../src/orderly/customTooltip.tsx","../src/utils/yTickFormatter.ts","../src/orderly/xAxisLabel.tsx","../src/orderly/pnlLine.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","getThemeColors","root","computedStyle","convertToRGB","color","useColors","colors","useMemo","themeColors","OrderlyChartTooltip","props","label","value","prefix","unit","coloring","dp","rm","jsxs","Box","Flex","jsx","Text","tickFormatter","absValue","formatted","numberToHumanStyle","RoundedRectangle","fill","x","y","width","height","absHeight","XAxisLabel","stroke","payload","index","containerWidth","t","useTranslation","_x","CustomizedCross","Cross","CustomTooltip","active","todayStr","useRef","PnLBarChart","invisible","widthRef","ResponsiveContainer","cn","BarChart","Tooltip","CartesianGrid","ReferenceLine","Bar","entry","Cell","YAxis","XAxis","PnlLineChart","dataTransfer","data","series","acc","item","LineChart","Line","AssetLineChart","opacity","tooltip","VolBarChart","isEmpty","b","maxVolume","decimal","number","decimalPlaces","abbreviations","toFixedWithoutRounding","num","fix","numStr","decimalIndex","cutoffIndex","import_plugin","chartPlugin","addComponents","addBase"],"mappings":"quBAAA,IAAAA,CAAAA,CAAAC,CAAAC,CAAAA,CAAAA,EAAA,CACA,MAAA,CAAO,cAAeA,CAAAA,CAAAA,CAAS,YAAc,CAAA,CACzC,KAAO,CAAA,IACX,CAAC,CAAA,CACD,OAAO,cAAeA,CAAAA,CAAAA,CAAS,SAAW,CAAA,CACtC,UAAY,CAAA,IAAA,CACZ,GAAK,CAAA,UAAW,CACZ,OAAOC,EACX,CACJ,CAAC,CAAA,CACD,SAASC,CAAaC,CAAAA,CAAAA,CAAQC,CAAQ,CAAA,CAClC,OAAO,CACH,OAASD,CAAAA,CAAAA,CACT,MAAAC,CAAAA,CACJ,CACJ,CACAF,CAAa,CAAA,WAAA,CAAc,SAASG,CAAgBC,CAAAA,CAAAA,CAAiB,KAAK,EAAK,CAAA,CAAA,CAC3E,IAAMC,CAAAA,CAAkB,SAASC,CAAAA,CAAS,CACtC,OAAO,CACH,SAAA,CAAWA,EACX,OAASH,CAAAA,CAAAA,C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,CAAA,GAAA,CAAK,GAAG,CAAA,CAEzC3C,CAAQ,CAAA,CAAA,CACZ,KAAOyC,CAAAA,EAAU,GAAQzC,EAAAA,CAAAA,CAAQ2C,CAAc,CAAA,MAAA,CAAS,CACtDF,EAAAA,CAAAA,EAAU,IACVzC,CAKF,EAAA,CAAA,OAAO,CAFe4C,EAAAA,EAAAA,CAAuBH,CAAQC,CAAAA,CAAa,CAE3C,CAAA,EAAGC,CAAc3C,CAAAA,CAAK,CAAC,CAAA,CAChD,CAEA,SAAS4C,GAAuBC,CAAaC,CAAAA,CAAAA,CAAqB,CAChE,IAAMC,CAASF,CAAAA,CAAAA,CAAI,QAAS,EAAA,CACtBG,CAAeD,CAAAA,CAAAA,CAAO,OAAQ,CAAA,GAAG,CAEvC,CAAA,GAAIC,IAAiB,EAAMF,EAAAA,CAAAA,GAAQ,CACjC,CAAA,OAAOC,CAAO,CAAA,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,CAG5B,IAAME,CAAAA,CAAcD,CAAeF,CAAAA,CAAAA,CAAM,EAEzC,OAAOC,CAAAA,CAAO,KAAM,CAAA,CAAA,CAAGE,CAAW,CACpC,CCzMA,IAAAC,CAAmB,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAINC,EAA6B,CAAA,IAAA,IACxC,CAAApG,CAAAA,OAAAA,EAAO,SAAU,CAAE,aAAA,CAAAqG,CAAe,CAAA,OAAA,CAAAC,CAAQ,CAAA,CAAG,CAC3CD,CAAAA,CACE,CACE,QAAA,CAAU,CACR,gDAAA,CAAkD,CAChD,aAAA,CAAe,OACjB,CAAA,CACA,+CAAiD,CAAA,CAC/C,aAAe,CAAA,KACjB,CACF,CACF,CACA,CAAA,CACE,aAAe,CAAA,KACjB,CACF,EACF,CAAC","file":"index.js","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","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 { 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","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 { 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 { 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 { 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
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ResponsiveContainer, BarChart, Tooltip, CartesianGrid, ReferenceLine, Bar, Cell, YAxis, XAxis, LineChart, Line, Cross } from 'recharts';
|
|
3
|
-
import { cn, Box, Flex, Text } from '@orderly.network/ui';
|
|
4
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
-
import { numberToHumanStyle } from '@orderly.network/utils';
|
|
6
|
-
import { useTranslation } from '@orderly.network/i18n';
|
|
7
|
-
|
|
8
|
-
var N=Object.create;var k=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var g=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var X=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of K(e))!M.call(t,i)&&i!==r&&k(t,i,{get:()=>e[i],enumerable:!(o=I(e,i))||o.enumerable});return t};var G=(t,e,r)=>(r=t!=null?N($(t)):{},X(!t||!t.__esModule?k(r,"default",{value:t,enumerable:true}):r,t));var O=g(x=>{Object.defineProperty(x,"__esModule",{value:true});Object.defineProperty(x,"default",{enumerable:true,get:function(){return re}});function S(t,e){return {handler:t,config:e}}S.withOptions=function(t,e=()=>({})){let r=function(o){return {__options:o,handler:t(o),config:e(o)}};return r.__isOptionsFunction=true,r.__pluginFunction=t,r.__configFunction=e,r};var re=S;});var A=g(C=>{Object.defineProperty(C,"__esModule",{value:true});Object.defineProperty(C,"default",{enumerable:true,get:function(){return ae}});var oe=ie(O());function ie(t){return t&&t.__esModule?t:{default:t}}var ae=oe.default;});var V=g((rr,R)=>{var b=A();R.exports=(b.__esModule?b:{default:b}).default;});var v=()=>{let t=document.documentElement,e=getComputedStyle(t);return {primary:u(e.getPropertyValue("--oui-color-primary")),primaryLight:u(e.getPropertyValue("--oui-color-primary-light")),secondary:u(e.getPropertyValue("--oui-color-secondary")),success:u(e.getPropertyValue("--oui-color-success")),warning:u(e.getPropertyValue("--oui-color-warning")),danger:u(e.getPropertyValue("--oui-color-danger")),info:u(e.getPropertyValue("--oui-color-info")),loss:u(e.getPropertyValue("--oui-color-trading-loss")),profit:u(e.getPropertyValue("--oui-color-trading-profit"))}},u=t=>`rgb(${t.split(" ").join(",")})`;var f=t=>useMemo(()=>{let r=v();return {profit:t?.profit||r.profit,loss:t?.loss||r.loss,primary:r.primary,primaryLight:r.primaryLight}},[t]);var d=t=>{let{label:e,value:r,prefix:o,unit:i="USDC",coloring:a=false,dp:n,rm:c}=t;return jsxs(Box,{intensity:600,p:3,r:"md",children:[jsxs(Flex,{direction:"row",className:t.titleClassName,children:[o,jsx(Text.numeral,{unit:i,as:"div",size:"sm",coloring:a,showIdentifier:a,unitClassName:"oui-text-base-contrast-54 oui-ml-1",weight:"semibold",rm:c,dp:n,children:r})]}),jsx(Text,{size:"2xs",intensity:54,weight:"semibold",children:e})]})};var h=t=>{let e=Math.abs(t),r=e===0?0:e<=10?2:e<=100?1:0,o=numberToHumanStyle(e,r);return t<0?`-${o}`:o};var at=t=>{let{fill:e,x:r,y:o,width:i,height:a}=t,n=Math.abs(a);return jsx("rect",{rx:2,x:r,y:a>0?o:o+a,width:i,height:n,stroke:"none",fill:e})},nt=t=>{let{x:e,y:r,stroke:o,payload:i,index:a,width:n,containerWidth:c}=t,{t:z}=useTranslation(),D=a===0?48:c>0?c-10:n+i.offset;return jsx("g",{transform:`translate(${D},${r-6})`,children:jsx("text",{x:0,y:0,dy:16,textAnchor:a===0?"start":"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:a===0?i.value:z("chart.now")})})},lt=t=>{let{width:e,height:r,stroke:o,fill:i}=t;return jsx(Cross,{x:t.x+t.width/2,top:t.top,height:r,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},st=t=>{let{active:e,payload:r,label:o}=t,i=useRef(new Date().toISOString().split("T")[0]),{t:a}=useTranslation();return e&&r&&r.length?jsx(d,{label:o===i.current?a("chart.now"):o,value:r[0].value,coloring:true}):null},ct=t=>{let{invisible:e}=t,r=f(t.colors),o=useRef(0);return jsx(ResponsiveContainer,{className:cn(e&&"chart-invisible"),onResize:(i,a)=>{o.current=i;},children:jsxs(BarChart,{data:t.data,margin:{left:-10,top:10,right:10,bottom:30},children:[!e&&jsx(Tooltip,{cursor:jsx(lt,{}),content:jsx(st,{})}),jsx(CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsx(ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),!e&&jsx(Bar,{dataKey:"pnl",shape:jsx(at,{}),children:t.data.map((i,a)=>jsx(Cell,{fill:i.pnl>0?r.profit:r.loss},`cell-${a}`))}),jsx(YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickFormatter:i=>h(i),tickLine:false,axisLine:false,dataKey:"pnl"}),jsx(XAxis,{dataKey:"date",tickLine:false,interval:t.data.length-2,height:1,tick:jsx(nt,{containerWidth:o.current}),stroke:"#FFFFFF",strokeOpacity:.04})]})})};var y=t=>{let{x:e,y:r,stroke:o,payload:i,index:a}=t,{t:n}=useTranslation();return jsx("g",{transform:`translate(${e},${r-6})`,children:jsx("text",{x:0,y:0,dy:16,textAnchor:"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:a===0?i.value:n("chart.now")})})};var vt=t=>{let{active:e,payload:r,label:o}=t,i=useRef(new Date().toISOString().split("T")[0]),{t:a}=useTranslation();return e&&r&&r.length?jsx(d,{label:o===i.current?a("chart.now"):o,value:r[0].value,coloring:true}):null},Ft=t=>{let e=f(t.colors),r=i=>{let a=[];return i?.reduce((n,c)=>(n+=c.pnl,a.push({...c,pnl:n,_pnl:c.pnl}),n),0),a},o=useMemo(()=>r(t.data),[t.data]);return jsx(ResponsiveContainer,{className:t.invisible?"chart-invisible":"",children:jsxs(LineChart,{data:o,margin:{top:20,right:10,left:-10,bottom:0},children:[jsx(CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsx(XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsx(y,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsx(YAxis,{dataKey:"pnl",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:i=>h(i)}),!t.invisible&&jsx(Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsx(vt,{})}),!t.invisible&&jsx(Line,{type:"natural",dataKey:"pnl",stroke:e.primary,strokeWidth:2,dot:false,isAnimationActive:false})]})})};var Bt=t=>{let{active:e,payload:r,label:o}=t,i=useRef(new Date().toISOString().split("T")[0]),{t:a}=useTranslation();return e&&r&&r.length?jsx(d,{label:o===i.current?a("chart.now"):o,value:r[0].value}):null},zt=t=>{let e=f(t.colors);return jsx(ResponsiveContainer,{className:t.invisible?"chart-invisible":"",children:jsxs(LineChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsx(CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsx(XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsx(y,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsx(YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:r=>h(r)}),!t.invisible&&jsx(Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsx(Bt,{})}),!t.invisible&&jsx(Line,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:2,dot:false,isAnimationActive:false})]})})};var Qt=t=>{let{fill:e,x:r,y:o,width:i,height:a,opacity:n}=t,c=Math.abs(a);return jsx("rect",{rx:2,x:r,y:a>0?o:o+a,width:i,height:c,stroke:"none",fill:e,opacity:n})},Ut=t=>{let{width:e,height:r,payload:o,stroke:i,fill:a}=t;return o?.[0]?.value===0?null:jsx(Cross,{x:t.x+t.width/2,top:t.top,height:r,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},Jt=t=>{let{active:e,payload:r,label:o,tooltip:i}=t;return r?.[0]?.value===0?null:e&&r&&r.length?jsx(d,{label:o,value:r[0].value,titleClassName:"oui-gap-4",rm:i?.rm,dp:i?.dp}):null},Zt=t=>{let e=f(t.colors?.fill?{profit:t.colors?.fill,loss:t.colors?.fill}:void 0),r=t.data.reduce((a,n)=>a+n.volume,0)===0,o=t.data.reduce((a,n)=>a>n.volume?a:n.volume,0),i=o<=10?2:o<=100?1:0;return jsx(Box,{className:cn(t.className),children:jsx(ResponsiveContainer,{children:jsxs(BarChart,{data:t.data,margin:{left:-0,top:6,right:0,bottom:20},children:[jsx(Tooltip,{cursor:jsx(Ut,{}),content:jsx(Jt,{tooltip:t.tooltip})}),jsx(CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.08,repeatCount:6}),jsx(ReferenceLine,{y:0,stroke:"#000"}),jsx(Bar,{dataKey:"volume",shape:jsx(Qt,{}),minPointSize:1,children:t.data.map((a,n)=>jsx(Cell,{fill:a.volume>0?e.profit:e.loss,opacity:a.opacity},`cell-${n}`))}),jsx(YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,dataKey:"volume",tickFormatter:(a,n)=>r?`${n*100}`:jt(a,i),width:45}),jsx(XAxis,{dataKey:"date",tickLine:false,interval:t.data.length-2,height:1,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"rgb(229, 231, 235)",strokeOpacity:.2})]})})})};function jt(t,e=0){let r=["","K","M","B","T"],o=0;for(;t>=1e3&&o<r.length-1;)t/=1e3,o++;return `${te(t,e)}${r[o]}`}function te(t,e){let r=t.toString(),o=r.indexOf(".");if(o===-1||e===0)return r.split(".")[0];let i=o+e+1;return r.slice(0,i)}var B=G(V()),ne=()=>(0, B.default)(function({addComponents:t,addBase:e}){t({".xAxis":{".recharts-cartesian-axis-tick:first-child text":{"text-anchor":"start"},".recharts-cartesian-axis-tick:last-child text":{"text-anchor":"end"}}},{respectPrefix:false});});
|
|
9
|
-
|
|
10
|
-
export { zt as AssetLineChart, ct as PnLBarChart, Ft as PnlLineChart, Zt as VolBarChart, ne as chartPlugin };
|
|
11
|
-
//# sourceMappingURL=out.js.map
|
|
1
|
+
import {useMemo,useRef}from'react';import {ResponsiveContainer,BarChart,Tooltip,CartesianGrid,ReferenceLine,Bar,Cell,YAxis,XAxis,LineChart,Line,Cross}from'recharts';import {cn,Box,Flex,Text}from'@orderly.network/ui';import {jsx,jsxs}from'react/jsx-runtime';import {numberToHumanStyle}from'@orderly.network/utils';import {useTranslation}from'@orderly.network/i18n';var N=Object.create;var k=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var g=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var X=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of K(e))!M.call(t,i)&&i!==r&&k(t,i,{get:()=>e[i],enumerable:!(o=I(e,i))||o.enumerable});return t};var G=(t,e,r)=>(r=t!=null?N($(t)):{},X(!t||!t.__esModule?k(r,"default",{value:t,enumerable:true}):r,t));var O=g(x=>{Object.defineProperty(x,"__esModule",{value:true});Object.defineProperty(x,"default",{enumerable:true,get:function(){return re}});function S(t,e){return {handler:t,config:e}}S.withOptions=function(t,e=()=>({})){let r=function(o){return {__options:o,handler:t(o),config:e(o)}};return r.__isOptionsFunction=true,r.__pluginFunction=t,r.__configFunction=e,r};var re=S;});var A=g(C=>{Object.defineProperty(C,"__esModule",{value:true});Object.defineProperty(C,"default",{enumerable:true,get:function(){return ae}});var oe=ie(O());function ie(t){return t&&t.__esModule?t:{default:t}}var ae=oe.default;});var V=g((rr,R)=>{var b=A();R.exports=(b.__esModule?b:{default:b}).default;});var v=()=>{let t=document.documentElement,e=getComputedStyle(t);return {primary:u(e.getPropertyValue("--oui-color-primary")),primaryLight:u(e.getPropertyValue("--oui-color-primary-light")),secondary:u(e.getPropertyValue("--oui-color-secondary")),success:u(e.getPropertyValue("--oui-color-success")),warning:u(e.getPropertyValue("--oui-color-warning")),danger:u(e.getPropertyValue("--oui-color-danger")),info:u(e.getPropertyValue("--oui-color-info")),loss:u(e.getPropertyValue("--oui-color-trading-loss")),profit:u(e.getPropertyValue("--oui-color-trading-profit"))}},u=t=>`rgb(${t.split(" ").join(",")})`;var f=t=>useMemo(()=>{let r=v();return {profit:t?.profit||r.profit,loss:t?.loss||r.loss,primary:r.primary,primaryLight:r.primaryLight}},[t]);var d=t=>{let{label:e,value:r,prefix:o,unit:i="USDC",coloring:a=false,dp:n,rm:c}=t;return jsxs(Box,{intensity:600,p:3,r:"md",children:[jsxs(Flex,{direction:"row",className:t.titleClassName,children:[o,jsx(Text.numeral,{unit:i,as:"div",size:"sm",coloring:a,showIdentifier:a,unitClassName:"oui-text-base-contrast-54 oui-ml-1",weight:"semibold",rm:c,dp:n,children:r})]}),jsx(Text,{size:"2xs",intensity:54,weight:"semibold",children:e})]})};var h=t=>{let e=Math.abs(t),r=e===0?0:e<=10?2:e<=100?1:0,o=numberToHumanStyle(e,r);return t<0?`-${o}`:o};var at=t=>{let{fill:e,x:r,y:o,width:i,height:a}=t,n=Math.abs(a);return jsx("rect",{rx:2,x:r,y:a>0?o:o+a,width:i,height:n,stroke:"none",fill:e})},nt=t=>{let{x:e,y:r,stroke:o,payload:i,index:a,width:n,containerWidth:c}=t,{t:z}=useTranslation(),D=a===0?48:c>0?c-10:n+i.offset;return jsx("g",{transform:`translate(${D},${r-6})`,children:jsx("text",{x:0,y:0,dy:16,textAnchor:a===0?"start":"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:a===0?i.value:z("chart.now")})})},lt=t=>{let{width:e,height:r,stroke:o,fill:i}=t;return jsx(Cross,{x:t.x+t.width/2,top:t.top,height:r,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},st=t=>{let{active:e,payload:r,label:o}=t,i=useRef(new Date().toISOString().split("T")[0]),{t:a}=useTranslation();return e&&r&&r.length?jsx(d,{label:o===i.current?a("chart.now"):o,value:r[0].value,coloring:true}):null},ct=t=>{let{invisible:e}=t,r=f(t.colors),o=useRef(0);return jsx(ResponsiveContainer,{className:cn(e&&"chart-invisible"),onResize:(i,a)=>{o.current=i;},children:jsxs(BarChart,{data:t.data,margin:{left:-10,top:10,right:10,bottom:30},children:[!e&&jsx(Tooltip,{cursor:jsx(lt,{}),content:jsx(st,{})}),jsx(CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsx(ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),!e&&jsx(Bar,{dataKey:"pnl",shape:jsx(at,{}),children:t.data.map((i,a)=>jsx(Cell,{fill:i.pnl>0?r.profit:r.loss},`cell-${a}`))}),jsx(YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickFormatter:i=>h(i),tickLine:false,axisLine:false,dataKey:"pnl"}),jsx(XAxis,{dataKey:"date",tickLine:false,interval:t.data.length-2,height:1,tick:jsx(nt,{containerWidth:o.current}),stroke:"#FFFFFF",strokeOpacity:.04})]})})};var y=t=>{let{x:e,y:r,stroke:o,payload:i,index:a}=t,{t:n}=useTranslation();return jsx("g",{transform:`translate(${e},${r-6})`,children:jsx("text",{x:0,y:0,dy:16,textAnchor:"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:a===0?i.value:n("chart.now")})})};var vt=t=>{let{active:e,payload:r,label:o}=t,i=useRef(new Date().toISOString().split("T")[0]),{t:a}=useTranslation();return e&&r&&r.length?jsx(d,{label:o===i.current?a("chart.now"):o,value:r[0].value,coloring:true}):null},Ft=t=>{let e=f(t.colors),r=i=>{let a=[];return i?.reduce((n,c)=>(n+=c.pnl,a.push({...c,pnl:n,_pnl:c.pnl}),n),0),a},o=useMemo(()=>r(t.data),[t.data]);return jsx(ResponsiveContainer,{className:t.invisible?"chart-invisible":"",children:jsxs(LineChart,{data:o,margin:{top:20,right:10,left:-10,bottom:0},children:[jsx(CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsx(XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsx(y,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsx(YAxis,{dataKey:"pnl",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:i=>h(i)}),!t.invisible&&jsx(Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsx(vt,{})}),!t.invisible&&jsx(Line,{type:"natural",dataKey:"pnl",stroke:e.primary,strokeWidth:2,dot:false,isAnimationActive:false})]})})};var Bt=t=>{let{active:e,payload:r,label:o}=t,i=useRef(new Date().toISOString().split("T")[0]),{t:a}=useTranslation();return e&&r&&r.length?jsx(d,{label:o===i.current?a("chart.now"):o,value:r[0].value}):null},zt=t=>{let e=f(t.colors);return jsx(ResponsiveContainer,{className:t.invisible?"chart-invisible":"",children:jsxs(LineChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsx(CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsx(XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsx(y,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsx(YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:r=>h(r)}),!t.invisible&&jsx(Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsx(Bt,{})}),!t.invisible&&jsx(Line,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:2,dot:false,isAnimationActive:false})]})})};var Qt=t=>{let{fill:e,x:r,y:o,width:i,height:a,opacity:n}=t,c=Math.abs(a);return jsx("rect",{rx:2,x:r,y:a>0?o:o+a,width:i,height:c,stroke:"none",fill:e,opacity:n})},Ut=t=>{let{width:e,height:r,payload:o,stroke:i,fill:a}=t;return o?.[0]?.value===0?null:jsx(Cross,{x:t.x+t.width/2,top:t.top,height:r,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},Jt=t=>{let{active:e,payload:r,label:o,tooltip:i}=t;return r?.[0]?.value===0?null:e&&r&&r.length?jsx(d,{label:o,value:r[0].value,titleClassName:"oui-gap-4",rm:i?.rm,dp:i?.dp}):null},Zt=t=>{let e=f(t.colors?.fill?{profit:t.colors?.fill,loss:t.colors?.fill}:void 0),r=t.data.reduce((a,n)=>a+n.volume,0)===0,o=t.data.reduce((a,n)=>a>n.volume?a:n.volume,0),i=o<=10?2:o<=100?1:0;return jsx(Box,{className:cn(t.className),children:jsx(ResponsiveContainer,{children:jsxs(BarChart,{data:t.data,margin:{left:-0,top:6,right:0,bottom:20},children:[jsx(Tooltip,{cursor:jsx(Ut,{}),content:jsx(Jt,{tooltip:t.tooltip})}),jsx(CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.08,repeatCount:6}),jsx(ReferenceLine,{y:0,stroke:"#000"}),jsx(Bar,{dataKey:"volume",shape:jsx(Qt,{}),minPointSize:1,children:t.data.map((a,n)=>jsx(Cell,{fill:a.volume>0?e.profit:e.loss,opacity:a.opacity},`cell-${n}`))}),jsx(YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,dataKey:"volume",tickFormatter:(a,n)=>r?`${n*100}`:jt(a,i),width:45}),jsx(XAxis,{dataKey:"date",tickLine:false,interval:t.data.length-2,height:1,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"rgb(229, 231, 235)",strokeOpacity:.2})]})})})};function jt(t,e=0){let r=["","K","M","B","T"],o=0;for(;t>=1e3&&o<r.length-1;)t/=1e3,o++;return `${te(t,e)}${r[o]}`}function te(t,e){let r=t.toString(),o=r.indexOf(".");if(o===-1||e===0)return r.split(".")[0];let i=o+e+1;return r.slice(0,i)}var B=G(V()),ne=()=>(0, B.default)(function({addComponents:t,addBase:e}){t({".xAxis":{".recharts-cartesian-axis-tick:first-child text":{"text-anchor":"start"},".recharts-cartesian-axis-tick:last-child text":{"text-anchor":"end"}}},{respectPrefix:false});});export{zt as AssetLineChart,ct as PnLBarChart,Ft as PnlLineChart,Zt as VolBarChart,ne as chartPlugin};//# sourceMappingURL=index.mjs.map
|
|
12
2
|
//# sourceMappingURL=index.mjs.map
|
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.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,EAAk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ent":["\"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.17_ts-node@10.9.2_@swc+core@1.11.24_@swc+helpers@0.5.17__@types+node@22.15.18_typescript@5.8.3_/node_modules/tailwindcss/lib/util/createPlugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.17_ts-node@10.9.2_@swc+core@1.11.24_@swc+helpers@0.5.17__@types+node@22.15.18_typescript@5.8.3_/node_modules/tailwindcss/lib/public/create-plugin.js","../../../node_modules/.pnpm/tailwindcss@3.4.17_ts-node@10.9.2_@swc+core@1.11.24_@swc+helpers@0.5.17__@types+node@22.15.18_typescript@5.8.3_/node_modules/tailwindcss/plugin.js","../src/utils/theme.ts","../src/orderly/useColors.ts","../src/orderly/pnlBar.tsx","../src/orderly/customTooltip.tsx","../src/utils/yTickFormatter.ts","../src/orderly/xAxisLabel.tsx","../src/orderly/pnlLine.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","getThemeColors","root","computedStyle","convertToRGB","color","useColors","colors","useMemo","themeColors","OrderlyChartTooltip","props","label","value","prefix","unit","coloring","dp","rm","jsxs","Box","Flex","jsx","Text","tickFormatter","absValue","formatted","numberToHumanStyle","RoundedRectangle","fill","x","y","width","height","absHeight","XAxisLabel","stroke","payload","index","containerWidth","t","useTranslation","_x","CustomizedCross","Cross","CustomTooltip","active","todayStr","useRef","PnLBarChart","invisible","widthRef","ResponsiveContainer","cn","BarChart","Tooltip","CartesianGrid","ReferenceLine","Bar","entry","Cell","YAxis","XAxis","PnlLineChart","dataTransfer","data","series","acc","item","LineChart","Line","AssetLineChart","opacity","tooltip","VolBarChart","isEmpty","b","maxVolume","decimal","number","decimalPlaces","abbreviations","toFixedWithoutRounding","num","fix","numStr","decimalIndex","cutoffIndex","import_plugin","chartPlugin","addComponents","addBase"],"mappings":"o3BAAA,IAAAA,CAAAA,CAAAC,CAAAC,CAAAA,CAAAA,EAAA,CACA,MAAA,CAAO,cAAeA,CAAAA,CAAAA,CAAS,YAAc,CAAA,CACzC,KAAO,CAAA,IACX,CAAC,CAAA,CACD,OAAO,cAAeA,CAAAA,CAAAA,CAAS,SAAW,CAAA,CACtC,UAAY,CAAA,IAAA,CACZ,GAAK,CAAA,UAAW,CACZ,OAAOC,EACX,CACJ,CAAC,CAAA,CACD,SAASC,CAAaC,CAAAA,CAAAA,CAAQC,CAAQ,CAAA,CAClC,OAAO,CACH,OAASD,CAAAA,CAAAA,CACT,MAAAC,CAAAA,CACJ,CACJ,CACAF,CAAa,CAAA,WAAA,CAAc,SAASG,CAAgBC,CAAAA,CAAAA,CAAiB,KAAK,EAAK,CAAA,CAAA,CAC3E,IAAMC,CAAAA,CAAkB,SAASC,CAAAA,CAAS,CACtC,OAAO,CACH,SAAA,CAAWA,EACX,O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AAA,GAAA,CAAK,GAAG,CAAA,CAEzC3C,CAAQ,CAAA,CAAA,CACZ,KAAOyC,CAAAA,EAAU,GAAQzC,EAAAA,CAAAA,CAAQ2C,CAAc,CAAA,MAAA,CAAS,CACtDF,EAAAA,CAAAA,EAAU,IACVzC,CAKF,EAAA,CAAA,OAAO,CAFe4C,EAAAA,EAAAA,CAAuBH,CAAQC,CAAAA,CAAa,CAE3C,CAAA,EAAGC,CAAc3C,CAAAA,CAAK,CAAC,CAAA,CAChD,CAEA,SAAS4C,GAAuBC,CAAaC,CAAAA,CAAAA,CAAqB,CAChE,IAAMC,CAASF,CAAAA,CAAAA,CAAI,QAAS,EAAA,CACtBG,CAAeD,CAAAA,CAAAA,CAAO,OAAQ,CAAA,GAAG,CAEvC,CAAA,GAAIC,IAAiB,EAAMF,EAAAA,CAAAA,GAAQ,CACjC,CAAA,OAAOC,CAAO,CAAA,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,CAG5B,IAAME,CAAAA,CAAcD,CAAeF,CAAAA,CAAAA,CAAM,EAEzC,OAAOC,CAAAA,CAAO,KAAM,CAAA,CAAA,CAAGE,CAAW,CACpC,CCzMA,IAAAC,CAAmB,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAINC,EAA6B,CAAA,IAAA,IACxC,CAAApG,CAAAA,OAAAA,EAAO,SAAU,CAAE,aAAA,CAAAqG,CAAe,CAAA,OAAA,CAAAC,CAAQ,CAAA,CAAG,CAC3CD,CAAAA,CACE,CACE,QAAA,CAAU,CACR,gDAAA,CAAkD,CAChD,aAAA,CAAe,OACjB,CAAA,CACA,+CAAiD,CAAA,CAC/C,aAAe,CAAA,KACjB,CACF,CACF,CACA,CAAA,CACE,aAAe,CAAA,KACjB,CACF,EACF,CAAC","file":"index.mjs","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","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 { 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","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 { 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 { 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 { 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.
|
|
3
|
+
"version": "2.2.0-alpha.0",
|
|
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.
|
|
26
|
+
"tsconfig": "0.5.0-alpha.0"
|
|
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/ui": "2.
|
|
39
|
+
"@orderly.network/utils": "2.2.0-alpha.0",
|
|
40
|
+
"@orderly.network/i18n": "2.2.0-alpha.0",
|
|
41
|
+
"@orderly.network/ui": "2.2.0-alpha.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsup",
|