react-use-echarts 0.0.11 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +536 -21
- package/dist/__tests__/hooks/theme-change.test.d.ts +1 -0
- package/dist/__tests__/hooks/use-echarts.test.d.ts +1 -0
- package/dist/__tests__/hooks/use-lazy-init.test.d.ts +1 -0
- package/dist/__tests__/themes/index.test.d.ts +1 -0
- package/dist/__tests__/utils/connect.test.d.ts +1 -0
- package/dist/__tests__/utils/instance-cache.test.d.ts +1 -0
- package/dist/hooks/use-echarts.d.ts +10 -0
- package/dist/hooks/use-lazy-init.d.ts +8 -0
- package/dist/index.d.ts +32 -131
- package/dist/index.es.js +1096 -83
- package/dist/index.umd.js +5 -1
- package/dist/themes/index.d.ts +42 -0
- package/dist/themes/presets/dark.json.d.ts +398 -0
- package/dist/themes/presets/light.json.d.ts +398 -0
- package/dist/themes/presets/macarons.json.d.ts +419 -0
- package/dist/types/index.d.ts +118 -0
- package/dist/utils/connect.d.ts +49 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/instance-cache.d.ts +42 -0
- package/package.json +25 -20
package/dist/index.umd.js
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`react`),require(`echarts`)):typeof define==`function`&&define.amd?define([`exports`,`react`,`echarts`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`react-use-echarts`]={},e.React,e.echarts))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)))(n);var d=l((e=>{var t=require(`react`).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;e.c=function(e){return t.H.useMemoCache(e)}})),f=l((e=>{process.env.NODE_ENV!==`production`&&(function(){var t=require(`react`).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;e.c=function(e){var n=t.H;return n===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
2
|
+
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
3
|
+
2. You might be breaking the Rules of Hooks
|
|
4
|
+
3. You might have more than one copy of React in the same app
|
|
5
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),n.useMemoCache(e)}})()})),p=l(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=d():t.exports=f()}))();function m(e,n=!1){let r=n!==!1,[i,a]=(0,t.useState)(!r),o=(0,t.useRef)(n);return o.current=n,(0,t.useEffect)(()=>{if(!r||i)return;let t=e.current;if(!t)return;let n=o.current,s={root:null,rootMargin:`50px`,threshold:.1,...typeof n==`object`?n:{}},c=new IntersectionObserver(e=>{let[t]=e;t.isIntersecting&&(a(!0),c.disconnect())},s);return c.observe(t),()=>{c.disconnect()}},[e,r,i]),i}var h=new WeakMap,g=new Set;function _(e){return h.get(e)?.instance}function v(e,t){let n=h.get(e);return n?(n.refCount+=1,n.instance):(h.set(e,{instance:t,refCount:1}),g.add(e),t)}function y(e,t){let n=h.get(e);return n?(n.instance.dispose(),n.instance=t,t):(h.set(e,{instance:t,refCount:1}),g.add(e),t)}function b(e){let t=h.get(e);t&&(--t.refCount,t.refCount<=0&&(t.instance.dispose(),h.delete(e),g.delete(e)))}function x(e){return h.get(e)?.refCount??0}function S(){for(let e of g)h.get(e)?.instance.dispose();h=new WeakMap,g.clear()}var C=new Map;function w(e,t){let r=C.get(t);r||(r=new Set,C.set(t,r)),r.add(e),r.size>1&&n.connect(t)}function T(e,t){let r=C.get(t);r&&(r.delete(e),r.size===0?(C.delete(t),n.disconnect(t)):r.size===1?n.disconnect(t):n.connect(t))}function E(e,t,n){t&&T(e,t),n&&w(e,n)}function D(e){let t=C.get(e);return t?Array.from(t):[]}function O(e){for(let[t,n]of C.entries())if(n.has(e))return t}function k(e){return O(e)!==void 0}function A(){for(let e of C.keys())n.disconnect(e);C.clear()}var j=new Map([[`light`,{color:[`#5470c6`,`#91cc75`,`#fac858`,`#ee6666`,`#73c0de`,`#3ba272`,`#fc8452`,`#9a60b4`,`#ea7ccc`],backgroundColor:`rgba(0,0,0,0)`,textStyle:{},title:{textStyle:{color:`#464646`}},line:{itemStyle:{borderWidth:1},lineStyle:{width:2},symbolSize:4,symbol:`emptyCircle`,smooth:!1},radar:{itemStyle:{borderWidth:1},lineStyle:{width:2},symbolSize:4,symbol:`emptyCircle`,smooth:!1},bar:{itemStyle:{barBorderWidth:0,barBorderColor:`#ccc`}},pie:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},scatter:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},boxplot:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},parallel:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},sankey:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},funnel:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},gauge:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},candlestick:{itemStyle:{color:`#eb5454`,color0:`#47b262`,borderColor:`#eb5454`,borderColor0:`#47b262`,borderWidth:1}},graph:{itemStyle:{borderWidth:0,borderColor:`#ccc`},lineStyle:{width:1,color:`#aaa`},symbolSize:4,symbol:`emptyCircle`,smooth:!1,color:[`#5470c6`,`#91cc75`,`#fac858`,`#ee6666`,`#73c0de`,`#3ba272`,`#fc8452`,`#9a60b4`,`#ea7ccc`],label:{color:`#eee`}},map:{itemStyle:{areaColor:`#eee`,borderColor:`#444`,borderWidth:.5},label:{color:`#000`},emphasis:{itemStyle:{areaColor:`rgba(255,215,0,0.8)`,borderColor:`#444`,borderWidth:1},label:{color:`rgb(100,0,0)`}}},geo:{itemStyle:{areaColor:`#eee`,borderColor:`#444`,borderWidth:.5},label:{color:`#000`},emphasis:{itemStyle:{areaColor:`rgba(255,215,0,0.8)`,borderColor:`#444`,borderWidth:1},label:{color:`rgb(100,0,0)`}}},categoryAxis:{axisLine:{show:!0,lineStyle:{color:`#333`}},axisTick:{show:!0,lineStyle:{color:`#333`}},axisLabel:{show:!0,color:`#333`},splitLine:{show:!1,lineStyle:{color:[`#ccc`]}},splitArea:{show:!1,areaStyle:{color:[`rgba(250,250,250,0.3)`,`rgba(200,200,200,0.3)`]}}},valueAxis:{axisLine:{show:!0,lineStyle:{color:`#333`}},axisTick:{show:!0,lineStyle:{color:`#333`}},axisLabel:{show:!0,color:`#333`},splitLine:{show:!0,lineStyle:{color:[`#ccc`]}},splitArea:{show:!1,areaStyle:{color:[`rgba(250,250,250,0.3)`,`rgba(200,200,200,0.3)`]}}},logAxis:{axisLine:{show:!0,lineStyle:{color:`#333`}},axisTick:{show:!0,lineStyle:{color:`#333`}},axisLabel:{show:!0,color:`#333`},splitLine:{show:!0,lineStyle:{color:[`#ccc`]}},splitArea:{show:!1,areaStyle:{color:[`rgba(250,250,250,0.3)`,`rgba(200,200,200,0.3)`]}}},timeAxis:{axisLine:{show:!0,lineStyle:{color:`#333`}},axisTick:{show:!0,lineStyle:{color:`#333`}},axisLabel:{show:!0,color:`#333`},splitLine:{show:!0,lineStyle:{color:[`#ccc`]}},splitArea:{show:!1,areaStyle:{color:[`rgba(250,250,250,0.3)`,`rgba(200,200,200,0.3)`]}}},toolbox:{iconStyle:{borderColor:`#999`},emphasis:{iconStyle:{borderColor:`#666`}}},legend:{textStyle:{color:`#333`}},tooltip:{axisPointer:{lineStyle:{color:`#ccc`,width:1},crossStyle:{color:`#ccc`,width:1}}},timeline:{lineStyle:{color:`#293c55`,width:1},itemStyle:{color:`#293c55`,borderWidth:1},controlStyle:{color:`#293c55`,borderColor:`#293c55`,borderWidth:.5},checkpointStyle:{color:`#e43c59`,borderColor:`#c23531`},label:{color:`#293c55`},emphasis:{itemStyle:{color:`#a9334c`},controlStyle:{color:`#293c55`,borderColor:`#293c55`,borderWidth:.5},label:{color:`#293c55`}}},visualMap:{color:[`#bf444c`,`#d88273`,`#f6efa6`]},dataZoom:{backgroundColor:`rgba(47,69,84,0)`,dataBackgroundColor:`rgba(255,255,255,0.3)`,fillerColor:`rgba(167,183,204,0.4)`,handleColor:`#a7b7cc`,handleSize:`100%`,textStyle:{color:`#333`}},markPoint:{label:{color:`#eee`},emphasis:{label:{color:`#eee`}}}}],[`dark`,{color:[`#4992ff`,`#7cffb2`,`#fddd60`,`#ff6e76`,`#58d9f9`,`#05c091`,`#ff8a45`,`#8d4eda`,`#dd79ff`],backgroundColor:`rgba(0,0,0,0)`,textStyle:{},title:{textStyle:{color:`#cccccc`}},line:{itemStyle:{borderWidth:1},lineStyle:{width:2},symbolSize:4,symbol:`emptyCircle`,smooth:!1},radar:{itemStyle:{borderWidth:1},lineStyle:{width:2},symbolSize:4,symbol:`emptyCircle`,smooth:!1},bar:{itemStyle:{barBorderWidth:0,barBorderColor:`#cccccc`}},pie:{itemStyle:{borderWidth:0,borderColor:`#cccccc`}},scatter:{itemStyle:{borderWidth:0,borderColor:`#cccccc`}},boxplot:{itemStyle:{borderWidth:0,borderColor:`#cccccc`}},parallel:{itemStyle:{borderWidth:0,borderColor:`#cccccc`}},sankey:{itemStyle:{borderWidth:0,borderColor:`#cccccc`}},funnel:{itemStyle:{borderWidth:0,borderColor:`#cccccc`}},gauge:{itemStyle:{borderWidth:0,borderColor:`#cccccc`}},candlestick:{itemStyle:{color:`#eb5454`,color0:`#47b262`,borderColor:`#eb5454`,borderColor0:`#47b262`,borderWidth:1}},graph:{itemStyle:{borderWidth:0,borderColor:`#cccccc`},lineStyle:{width:1,color:`#aaaaaa`},symbolSize:4,symbol:`emptyCircle`,smooth:!1,color:[`#4992ff`,`#7cffb2`,`#fddd60`,`#ff6e76`,`#58d9f9`,`#05c091`,`#ff8a45`,`#8d4eda`,`#dd79ff`],label:{color:`#cccccc`}},map:{itemStyle:{areaColor:`#2a2a2a`,borderColor:`#444444`,borderWidth:.5},label:{color:`#cccccc`},emphasis:{itemStyle:{areaColor:`rgba(255,215,0,0.8)`,borderColor:`#444444`,borderWidth:1},label:{color:`rgb(100,0,0)`}}},geo:{itemStyle:{areaColor:`#2a2a2a`,borderColor:`#444444`,borderWidth:.5},label:{color:`#cccccc`},emphasis:{itemStyle:{areaColor:`rgba(255,215,0,0.8)`,borderColor:`#444444`,borderWidth:1},label:{color:`rgb(100,0,0)`}}},categoryAxis:{axisLine:{show:!0,lineStyle:{color:`#cccccc`}},axisTick:{show:!0,lineStyle:{color:`#cccccc`}},axisLabel:{show:!0,color:`#cccccc`},splitLine:{show:!1,lineStyle:{color:[`#444444`]}},splitArea:{show:!1,areaStyle:{color:[`rgba(255,255,255,0.05)`,`rgba(255,255,255,0.1)`]}}},valueAxis:{axisLine:{show:!0,lineStyle:{color:`#cccccc`}},axisTick:{show:!0,lineStyle:{color:`#cccccc`}},axisLabel:{show:!0,color:`#cccccc`},splitLine:{show:!0,lineStyle:{color:[`#444444`]}},splitArea:{show:!1,areaStyle:{color:[`rgba(255,255,255,0.05)`,`rgba(255,255,255,0.1)`]}}},logAxis:{axisLine:{show:!0,lineStyle:{color:`#cccccc`}},axisTick:{show:!0,lineStyle:{color:`#cccccc`}},axisLabel:{show:!0,color:`#cccccc`},splitLine:{show:!0,lineStyle:{color:[`#444444`]}},splitArea:{show:!1,areaStyle:{color:[`rgba(255,255,255,0.05)`,`rgba(255,255,255,0.1)`]}}},timeAxis:{axisLine:{show:!0,lineStyle:{color:`#cccccc`}},axisTick:{show:!0,lineStyle:{color:`#cccccc`}},axisLabel:{show:!0,color:`#cccccc`},splitLine:{show:!0,lineStyle:{color:[`#444444`]}},splitArea:{show:!1,areaStyle:{color:[`rgba(255,255,255,0.05)`,`rgba(255,255,255,0.1)`]}}},toolbox:{iconStyle:{borderColor:`#cccccc`},emphasis:{iconStyle:{borderColor:`#ffffff`}}},legend:{textStyle:{color:`#cccccc`}},tooltip:{axisPointer:{lineStyle:{color:`#cccccc`,width:1},crossStyle:{color:`#cccccc`,width:1}}},timeline:{lineStyle:{color:`#cccccc`,width:1},itemStyle:{color:`#cccccc`,borderWidth:1},controlStyle:{color:`#cccccc`,borderColor:`#cccccc`,borderWidth:.5},checkpointStyle:{color:`#e43c59`,borderColor:`#c23531`},label:{color:`#cccccc`},emphasis:{itemStyle:{color:`#a9334c`},controlStyle:{color:`#cccccc`,borderColor:`#cccccc`,borderWidth:.5},label:{color:`#cccccc`}}},visualMap:{color:[`#ff6e76`,`#fddd60`,`#7cffb2`]},dataZoom:{backgroundColor:`rgba(47,69,84,0)`,dataBackgroundColor:`rgba(255,255,255,0.3)`,fillerColor:`rgba(167,183,204,0.4)`,handleColor:`#a7b7cc`,handleSize:`100%`,textStyle:{color:`#cccccc`}},markPoint:{label:{color:`#cccccc`},emphasis:{label:{color:`#cccccc`}}}}],[`macarons`,{color:[`#2ec7c9`,`#b6a2de`,`#5ab1ef`,`#ffb980`,`#d87a80`,`#8d98b3`,`#e5cf0d`,`#97b552`,`#95706d`,`#dc69aa`,`#07a2a4`,`#9a7fd1`,`#588dd5`,`#f5994e`,`#c05050`,`#59678c`,`#c9ab00`,`#7eb00a`,`#6f5553`,`#c14089`],backgroundColor:`rgba(0,0,0,0)`,textStyle:{},title:{textStyle:{color:`#008acd`}},line:{itemStyle:{borderWidth:1},lineStyle:{width:2},symbolSize:3,symbol:`emptyCircle`,smooth:!0},radar:{itemStyle:{borderWidth:1},lineStyle:{width:2},symbolSize:3,symbol:`emptyCircle`,smooth:!0},bar:{itemStyle:{barBorderWidth:0,barBorderColor:`#ccc`}},pie:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},scatter:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},boxplot:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},parallel:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},sankey:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},funnel:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},gauge:{itemStyle:{borderWidth:0,borderColor:`#ccc`}},candlestick:{itemStyle:{color:`#d87a80`,color0:`#2ec7c9`,borderColor:`#d87a80`,borderColor0:`#2ec7c9`,borderWidth:1}},graph:{itemStyle:{borderWidth:0,borderColor:`#ccc`},lineStyle:{width:1,color:`#aaa`},symbolSize:3,symbol:`emptyCircle`,smooth:!0,color:[`#2ec7c9`,`#b6a2de`,`#5ab1ef`,`#ffb980`,`#d87a80`,`#8d98b3`,`#e5cf0d`,`#97b552`,`#95706d`,`#dc69aa`,`#07a2a4`,`#9a7fd1`,`#588dd5`,`#f5994e`,`#c05050`,`#59678c`,`#c9ab00`,`#7eb00a`,`#6f5553`,`#c14089`],label:{color:`#eee`}},map:{itemStyle:{areaColor:`#dddddd`,borderColor:`#eeeeee`,borderWidth:.5},label:{color:`#d87a80`},emphasis:{itemStyle:{areaColor:`rgba(254,153,78,1)`,borderColor:`#444`,borderWidth:1},label:{color:`rgb(100,0,0)`}}},geo:{itemStyle:{areaColor:`#dddddd`,borderColor:`#eeeeee`,borderWidth:.5},label:{color:`#d87a80`},emphasis:{itemStyle:{areaColor:`rgba(254,153,78,1)`,borderColor:`#444`,borderWidth:1},label:{color:`rgb(100,0,0)`}}},categoryAxis:{axisLine:{show:!0,lineStyle:{color:`#008acd`}},axisTick:{show:!0,lineStyle:{color:`#333`}},axisLabel:{show:!0,color:`#333`},splitLine:{show:!1,lineStyle:{color:[`#eee`]}},splitArea:{show:!1,areaStyle:{color:[`rgba(250,250,250,0.3)`,`rgba(200,200,200,0.3)`]}}},valueAxis:{axisLine:{show:!0,lineStyle:{color:`#008acd`}},axisTick:{show:!0,lineStyle:{color:`#333`}},axisLabel:{show:!0,color:`#333`},splitLine:{show:!0,lineStyle:{color:[`#eee`]}},splitArea:{show:!1,areaStyle:{color:[`rgba(250,250,250,0.3)`,`rgba(200,200,200,0.3)`]}}},logAxis:{axisLine:{show:!0,lineStyle:{color:`#008acd`}},axisTick:{show:!0,lineStyle:{color:`#333`}},axisLabel:{show:!0,color:`#333`},splitLine:{show:!0,lineStyle:{color:[`#eee`]}},splitArea:{show:!1,areaStyle:{color:[`rgba(250,250,250,0.3)`,`rgba(200,200,200,0.3)`]}}},timeAxis:{axisLine:{show:!0,lineStyle:{color:`#008acd`}},axisTick:{show:!0,lineStyle:{color:`#333`}},axisLabel:{show:!0,color:`#333`},splitLine:{show:!0,lineStyle:{color:[`#eee`]}},splitArea:{show:!1,areaStyle:{color:[`rgba(250,250,250,0.3)`,`rgba(200,200,200,0.3)`]}}},toolbox:{iconStyle:{borderColor:`#2ec7c9`},emphasis:{iconStyle:{borderColor:`#18a4a6`}}},legend:{textStyle:{color:`#333333`}},tooltip:{axisPointer:{lineStyle:{color:`#008acd`,width:`1`},crossStyle:{color:`#008acd`,width:`1`}}},timeline:{lineStyle:{color:`#008acd`,width:1},itemStyle:{color:`#008acd`,borderWidth:1},controlStyle:{color:`#008acd`,borderColor:`#008acd`,borderWidth:.5},checkpointStyle:{color:`#2ec7c9`,borderColor:`#2ec7c9`},label:{color:`#008acd`},emphasis:{itemStyle:{color:`#a9334c`},controlStyle:{color:`#008acd`,borderColor:`#008acd`,borderWidth:.5},label:{color:`#008acd`}}},visualMap:{color:[`#5ab1ef`,`#e0ffff`]},dataZoom:{backgroundColor:`rgba(47,69,84,0)`,dataBackgroundColor:`rgba(239,239,255,0.3)`,fillerColor:`rgba(182,162,222,0.2)`,handleColor:`#008acd`,handleSize:`100%`,textStyle:{color:`#333333`}},markPoint:{label:{color:`#eeeeee`},emphasis:{label:{color:`#eeeeee`}}}}]]),M=new WeakMap,N=0;function P(){for(let[e,t]of j.entries())n.registerTheme(e,t)}function F(e){return j.get(e)||null}function I(e){return j.has(e)}function L(e,t){n.registerTheme(e,t)}function R(e){let t=M.get(e);if(t)return t;let r=`__custom_theme_${N++}`;return n.registerTheme(r,e),M.set(e,r),r}function z(){return Array.from(j.keys())}P();function B(e){return e==null?null:typeof e==`string`&&I(e)?e:typeof e==`object`?R(e):null}function V(e,t){if(t)for(let[n,{handler:r,query:i,context:a}]of Object.entries(t))i?e.on(n,i,r,a):e.on(n,r,a)}function H(e,t){if(t)for(let[n,{handler:r}]of Object.entries(t))e.off(n,r)}function U(e,r){let i=(0,p.c)(53),{option:a,theme:o,renderer:s,lazyInit:c,group:l,setOptionOpts:u,showLoading:d,loadingOption:f,onEvents:h}=r,g=s===void 0?`canvas`:s,x=c===void 0?!1:c,S=d===void 0?!1:d,C=(0,t.useRef)(void 0),w=(0,t.useRef)(void 0),T=(0,t.useRef)(h),D,O;i[0]===h?(D=i[1],O=i[2]):(D=()=>{T.current=h},O=[h],i[0]=h,i[1]=D,i[2]=O),(0,t.useEffect)(D,O);let k=m(e,x),A;i[3]===e?A=i[4]:(A=()=>{if(e.current)return _(e.current)},i[3]=e,i[4]=A);let j=A,M;i[5]!==e||i[6]!==g||i[7]!==k||i[8]!==o?(M=()=>{let t=e.current;if(!t||!k)return;let r=_(t);if(!r){let e=B(o);r=n.init(t,e,{renderer:g}),v(t,r),w.current=o}return r},i[5]=e,i[6]=g,i[7]=k,i[8]=o,i[9]=M):M=i[9];let N=M,P;i[10]!==j||i[11]!==N||i[12]!==u?(P=(e,t)=>{queueMicrotask(()=>{let n=j()||N();if(n){let r={...u,...t};n.setOption(e,r)}})},i[10]=j,i[11]=N,i[12]=u,i[13]=P):P=i[13];let F=P,I;i[14]===j?I=i[15]:(I=()=>{j()?.resize()},i[14]=j,i[15]=I);let L=I,R,z;i[16]!==N||i[17]!==f||i[18]!==a||i[19]!==e||i[20]!==u||i[21]!==k||i[22]!==S?(z=()=>{if(!k)return;let t=e.current;if(!t)return;let n=N();if(n)return n.setOption(a,u),S&&n.showLoading(f),V(n,T.current),()=>{let e=_(t);if(!e)return;let n=C.current;n&&E(e,n,void 0),H(e,T.current),b(t)}},R=[k,N,a,u,S,f,e],i[16]=N,i[17]=f,i[18]=a,i[19]=e,i[20]=u,i[21]=k,i[22]=S,i[23]=R,i[24]=z):(R=i[23],z=i[24]),(0,t.useLayoutEffect)(z,R);let U,W;i[25]!==j||i[26]!==a||i[27]!==u?(U=()=>{let e=j();e&&e.setOption(a,u)},W=[j,a,u],i[25]=j,i[26]=a,i[27]=u,i[28]=U,i[29]=W):(U=i[28],W=i[29]),(0,t.useEffect)(U,W);let G,K;i[30]!==a||i[31]!==e||i[32]!==g||i[33]!==u||i[34]!==o?(G=()=>{let t=e.current;if(!t||!_(t)||w.current===o)return;let r=B(o),i=n.init(t,r,{renderer:g});y(t,i),w.current=o,i.setOption(a,u),V(i,T.current)},K=[e,o,g,a,u],i[30]=a,i[31]=e,i[32]=g,i[33]=u,i[34]=o,i[35]=G,i[36]=K):(G=i[35],K=i[36]),(0,t.useEffect)(G,K);let q,J;i[37]!==j||i[38]!==f||i[39]!==S?(q=()=>{let e=j();e&&(S?e.showLoading(f):e.hideLoading())},J=[j,S,f],i[37]=j,i[38]=f,i[39]=S,i[40]=q,i[41]=J):(q=i[40],J=i[41]),(0,t.useEffect)(q,J);let Y,X;i[42]!==j||i[43]!==l?(Y=()=>{let e=j();e&&(E(e,C.current,l),C.current=l)},X=[j,l],i[42]=j,i[43]=l,i[44]=Y,i[45]=X):(Y=i[44],X=i[45]),(0,t.useEffect)(Y,X);let Z,Q;i[46]===e?(Z=i[47],Q=i[48]):(Z=()=>{let t=e.current;if(!t)return;let n;try{n=new ResizeObserver(()=>{_(t)?.resize()}),n.observe(t)}catch(e){let t=e;console.warn(`ResizeObserver not available:`,t)}return()=>{n?.disconnect()}},Q=[e],i[46]=e,i[47]=Z,i[48]=Q),(0,t.useEffect)(Z,Q);let $;return i[49]!==j||i[50]!==L||i[51]!==F?($={setOption:F,getInstance:j,resize:L},i[49]=j,i[50]=L,i[51]=F,i[52]=$):$=i[52],$}var W=U;e.addToGroup=w,e.clearGroups=A,e.clearInstanceCache=S,e.getAvailableThemes=z,e.getBuiltinTheme=F,e.getCachedInstance=_,e.getGroupInstances=D,e.getInstanceGroup=O,e.getReferenceCount=x,e.isBuiltinTheme=I,e.isInGroup=k,e.registerBuiltinThemes=P,e.registerCustomTheme=L,e.releaseCachedInstance=b,e.removeFromGroup=T,e.replaceCachedInstance=y,e.setCachedInstance=v,e.updateGroup=E,e.useEcharts=W,e.useLazyInit=m});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BuiltinTheme } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Register built-in themes with ECharts
|
|
4
|
+
* 向 ECharts 注册内置主题
|
|
5
|
+
*/
|
|
6
|
+
export declare function registerBuiltinThemes(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Get built-in theme configuration
|
|
9
|
+
* 获取内置主题配置
|
|
10
|
+
* @param themeName Theme name
|
|
11
|
+
* @returns Theme configuration object or null if not found
|
|
12
|
+
*/
|
|
13
|
+
export declare function getBuiltinTheme(themeName: BuiltinTheme): object | null;
|
|
14
|
+
/**
|
|
15
|
+
* Check if a theme name is a built-in theme
|
|
16
|
+
* 检查主题名是否为内置主题
|
|
17
|
+
* @param themeName Theme name to check
|
|
18
|
+
* @returns True if built-in theme
|
|
19
|
+
*/
|
|
20
|
+
export declare function isBuiltinTheme(themeName: string): themeName is BuiltinTheme;
|
|
21
|
+
/**
|
|
22
|
+
* Register a custom theme
|
|
23
|
+
* 注册自定义主题
|
|
24
|
+
* @param themeName Theme name
|
|
25
|
+
* @param themeConfig Theme configuration object
|
|
26
|
+
*/
|
|
27
|
+
export declare function registerCustomTheme(themeName: string, themeConfig: object): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get or create a cached theme name for a custom theme object
|
|
30
|
+
* This prevents memory leaks by reusing theme names for the same object reference
|
|
31
|
+
* 获取或创建自定义主题对象的缓存主题名称
|
|
32
|
+
* 通过为相同对象引用重用主题名称来防止内存泄漏
|
|
33
|
+
* @param themeConfig Custom theme configuration object
|
|
34
|
+
* @returns Cached or newly generated theme name
|
|
35
|
+
*/
|
|
36
|
+
export declare function getOrRegisterCustomTheme(themeConfig: object): string;
|
|
37
|
+
/**
|
|
38
|
+
* Get all available built-in theme names
|
|
39
|
+
* 获取所有可用的内置主题名称
|
|
40
|
+
* @returns Array of built-in theme names
|
|
41
|
+
*/
|
|
42
|
+
export declare function getAvailableThemes(): BuiltinTheme[];
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"color": [
|
|
3
|
+
"#4992ff",
|
|
4
|
+
"#7cffb2",
|
|
5
|
+
"#fddd60",
|
|
6
|
+
"#ff6e76",
|
|
7
|
+
"#58d9f9",
|
|
8
|
+
"#05c091",
|
|
9
|
+
"#ff8a45",
|
|
10
|
+
"#8d4eda",
|
|
11
|
+
"#dd79ff"
|
|
12
|
+
],
|
|
13
|
+
"backgroundColor": "rgba(0,0,0,0)",
|
|
14
|
+
"textStyle": {},
|
|
15
|
+
"title": {
|
|
16
|
+
"textStyle": {
|
|
17
|
+
"color": "#cccccc"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"line": {
|
|
21
|
+
"itemStyle": {
|
|
22
|
+
"borderWidth": 1
|
|
23
|
+
},
|
|
24
|
+
"lineStyle": {
|
|
25
|
+
"width": 2
|
|
26
|
+
},
|
|
27
|
+
"symbolSize": 4,
|
|
28
|
+
"symbol": "emptyCircle",
|
|
29
|
+
"smooth": false
|
|
30
|
+
},
|
|
31
|
+
"radar": {
|
|
32
|
+
"itemStyle": {
|
|
33
|
+
"borderWidth": 1
|
|
34
|
+
},
|
|
35
|
+
"lineStyle": {
|
|
36
|
+
"width": 2
|
|
37
|
+
},
|
|
38
|
+
"symbolSize": 4,
|
|
39
|
+
"symbol": "emptyCircle",
|
|
40
|
+
"smooth": false
|
|
41
|
+
},
|
|
42
|
+
"bar": {
|
|
43
|
+
"itemStyle": {
|
|
44
|
+
"barBorderWidth": 0,
|
|
45
|
+
"barBorderColor": "#cccccc"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"pie": {
|
|
49
|
+
"itemStyle": {
|
|
50
|
+
"borderWidth": 0,
|
|
51
|
+
"borderColor": "#cccccc"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"scatter": {
|
|
55
|
+
"itemStyle": {
|
|
56
|
+
"borderWidth": 0,
|
|
57
|
+
"borderColor": "#cccccc"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"boxplot": {
|
|
61
|
+
"itemStyle": {
|
|
62
|
+
"borderWidth": 0,
|
|
63
|
+
"borderColor": "#cccccc"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"parallel": {
|
|
67
|
+
"itemStyle": {
|
|
68
|
+
"borderWidth": 0,
|
|
69
|
+
"borderColor": "#cccccc"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"sankey": {
|
|
73
|
+
"itemStyle": {
|
|
74
|
+
"borderWidth": 0,
|
|
75
|
+
"borderColor": "#cccccc"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"funnel": {
|
|
79
|
+
"itemStyle": {
|
|
80
|
+
"borderWidth": 0,
|
|
81
|
+
"borderColor": "#cccccc"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"gauge": {
|
|
85
|
+
"itemStyle": {
|
|
86
|
+
"borderWidth": 0,
|
|
87
|
+
"borderColor": "#cccccc"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"candlestick": {
|
|
91
|
+
"itemStyle": {
|
|
92
|
+
"color": "#eb5454",
|
|
93
|
+
"color0": "#47b262",
|
|
94
|
+
"borderColor": "#eb5454",
|
|
95
|
+
"borderColor0": "#47b262",
|
|
96
|
+
"borderWidth": 1
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"graph": {
|
|
100
|
+
"itemStyle": {
|
|
101
|
+
"borderWidth": 0,
|
|
102
|
+
"borderColor": "#cccccc"
|
|
103
|
+
},
|
|
104
|
+
"lineStyle": {
|
|
105
|
+
"width": 1,
|
|
106
|
+
"color": "#aaaaaa"
|
|
107
|
+
},
|
|
108
|
+
"symbolSize": 4,
|
|
109
|
+
"symbol": "emptyCircle",
|
|
110
|
+
"smooth": false,
|
|
111
|
+
"color": [
|
|
112
|
+
"#4992ff",
|
|
113
|
+
"#7cffb2",
|
|
114
|
+
"#fddd60",
|
|
115
|
+
"#ff6e76",
|
|
116
|
+
"#58d9f9",
|
|
117
|
+
"#05c091",
|
|
118
|
+
"#ff8a45",
|
|
119
|
+
"#8d4eda",
|
|
120
|
+
"#dd79ff"
|
|
121
|
+
],
|
|
122
|
+
"label": {
|
|
123
|
+
"color": "#cccccc"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"map": {
|
|
127
|
+
"itemStyle": {
|
|
128
|
+
"areaColor": "#2a2a2a",
|
|
129
|
+
"borderColor": "#444444",
|
|
130
|
+
"borderWidth": 0.5
|
|
131
|
+
},
|
|
132
|
+
"label": {
|
|
133
|
+
"color": "#cccccc"
|
|
134
|
+
},
|
|
135
|
+
"emphasis": {
|
|
136
|
+
"itemStyle": {
|
|
137
|
+
"areaColor": "rgba(255,215,0,0.8)",
|
|
138
|
+
"borderColor": "#444444",
|
|
139
|
+
"borderWidth": 1
|
|
140
|
+
},
|
|
141
|
+
"label": {
|
|
142
|
+
"color": "rgb(100,0,0)"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"geo": {
|
|
147
|
+
"itemStyle": {
|
|
148
|
+
"areaColor": "#2a2a2a",
|
|
149
|
+
"borderColor": "#444444",
|
|
150
|
+
"borderWidth": 0.5
|
|
151
|
+
},
|
|
152
|
+
"label": {
|
|
153
|
+
"color": "#cccccc"
|
|
154
|
+
},
|
|
155
|
+
"emphasis": {
|
|
156
|
+
"itemStyle": {
|
|
157
|
+
"areaColor": "rgba(255,215,0,0.8)",
|
|
158
|
+
"borderColor": "#444444",
|
|
159
|
+
"borderWidth": 1
|
|
160
|
+
},
|
|
161
|
+
"label": {
|
|
162
|
+
"color": "rgb(100,0,0)"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"categoryAxis": {
|
|
167
|
+
"axisLine": {
|
|
168
|
+
"show": true,
|
|
169
|
+
"lineStyle": {
|
|
170
|
+
"color": "#cccccc"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"axisTick": {
|
|
174
|
+
"show": true,
|
|
175
|
+
"lineStyle": {
|
|
176
|
+
"color": "#cccccc"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"axisLabel": {
|
|
180
|
+
"show": true,
|
|
181
|
+
"color": "#cccccc"
|
|
182
|
+
},
|
|
183
|
+
"splitLine": {
|
|
184
|
+
"show": false,
|
|
185
|
+
"lineStyle": {
|
|
186
|
+
"color": [
|
|
187
|
+
"#444444"
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"splitArea": {
|
|
192
|
+
"show": false,
|
|
193
|
+
"areaStyle": {
|
|
194
|
+
"color": [
|
|
195
|
+
"rgba(255,255,255,0.05)",
|
|
196
|
+
"rgba(255,255,255,0.1)"
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"valueAxis": {
|
|
202
|
+
"axisLine": {
|
|
203
|
+
"show": true,
|
|
204
|
+
"lineStyle": {
|
|
205
|
+
"color": "#cccccc"
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"axisTick": {
|
|
209
|
+
"show": true,
|
|
210
|
+
"lineStyle": {
|
|
211
|
+
"color": "#cccccc"
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"axisLabel": {
|
|
215
|
+
"show": true,
|
|
216
|
+
"color": "#cccccc"
|
|
217
|
+
},
|
|
218
|
+
"splitLine": {
|
|
219
|
+
"show": true,
|
|
220
|
+
"lineStyle": {
|
|
221
|
+
"color": [
|
|
222
|
+
"#444444"
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"splitArea": {
|
|
227
|
+
"show": false,
|
|
228
|
+
"areaStyle": {
|
|
229
|
+
"color": [
|
|
230
|
+
"rgba(255,255,255,0.05)",
|
|
231
|
+
"rgba(255,255,255,0.1)"
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"logAxis": {
|
|
237
|
+
"axisLine": {
|
|
238
|
+
"show": true,
|
|
239
|
+
"lineStyle": {
|
|
240
|
+
"color": "#cccccc"
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
"axisTick": {
|
|
244
|
+
"show": true,
|
|
245
|
+
"lineStyle": {
|
|
246
|
+
"color": "#cccccc"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"axisLabel": {
|
|
250
|
+
"show": true,
|
|
251
|
+
"color": "#cccccc"
|
|
252
|
+
},
|
|
253
|
+
"splitLine": {
|
|
254
|
+
"show": true,
|
|
255
|
+
"lineStyle": {
|
|
256
|
+
"color": [
|
|
257
|
+
"#444444"
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
"splitArea": {
|
|
262
|
+
"show": false,
|
|
263
|
+
"areaStyle": {
|
|
264
|
+
"color": [
|
|
265
|
+
"rgba(255,255,255,0.05)",
|
|
266
|
+
"rgba(255,255,255,0.1)"
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"timeAxis": {
|
|
272
|
+
"axisLine": {
|
|
273
|
+
"show": true,
|
|
274
|
+
"lineStyle": {
|
|
275
|
+
"color": "#cccccc"
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
"axisTick": {
|
|
279
|
+
"show": true,
|
|
280
|
+
"lineStyle": {
|
|
281
|
+
"color": "#cccccc"
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"axisLabel": {
|
|
285
|
+
"show": true,
|
|
286
|
+
"color": "#cccccc"
|
|
287
|
+
},
|
|
288
|
+
"splitLine": {
|
|
289
|
+
"show": true,
|
|
290
|
+
"lineStyle": {
|
|
291
|
+
"color": [
|
|
292
|
+
"#444444"
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
"splitArea": {
|
|
297
|
+
"show": false,
|
|
298
|
+
"areaStyle": {
|
|
299
|
+
"color": [
|
|
300
|
+
"rgba(255,255,255,0.05)",
|
|
301
|
+
"rgba(255,255,255,0.1)"
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
"toolbox": {
|
|
307
|
+
"iconStyle": {
|
|
308
|
+
"borderColor": "#cccccc"
|
|
309
|
+
},
|
|
310
|
+
"emphasis": {
|
|
311
|
+
"iconStyle": {
|
|
312
|
+
"borderColor": "#ffffff"
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
"legend": {
|
|
317
|
+
"textStyle": {
|
|
318
|
+
"color": "#cccccc"
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
"tooltip": {
|
|
322
|
+
"axisPointer": {
|
|
323
|
+
"lineStyle": {
|
|
324
|
+
"color": "#cccccc",
|
|
325
|
+
"width": 1
|
|
326
|
+
},
|
|
327
|
+
"crossStyle": {
|
|
328
|
+
"color": "#cccccc",
|
|
329
|
+
"width": 1
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
"timeline": {
|
|
334
|
+
"lineStyle": {
|
|
335
|
+
"color": "#cccccc",
|
|
336
|
+
"width": 1
|
|
337
|
+
},
|
|
338
|
+
"itemStyle": {
|
|
339
|
+
"color": "#cccccc",
|
|
340
|
+
"borderWidth": 1
|
|
341
|
+
},
|
|
342
|
+
"controlStyle": {
|
|
343
|
+
"color": "#cccccc",
|
|
344
|
+
"borderColor": "#cccccc",
|
|
345
|
+
"borderWidth": 0.5
|
|
346
|
+
},
|
|
347
|
+
"checkpointStyle": {
|
|
348
|
+
"color": "#e43c59",
|
|
349
|
+
"borderColor": "#c23531"
|
|
350
|
+
},
|
|
351
|
+
"label": {
|
|
352
|
+
"color": "#cccccc"
|
|
353
|
+
},
|
|
354
|
+
"emphasis": {
|
|
355
|
+
"itemStyle": {
|
|
356
|
+
"color": "#a9334c"
|
|
357
|
+
},
|
|
358
|
+
"controlStyle": {
|
|
359
|
+
"color": "#cccccc",
|
|
360
|
+
"borderColor": "#cccccc",
|
|
361
|
+
"borderWidth": 0.5
|
|
362
|
+
},
|
|
363
|
+
"label": {
|
|
364
|
+
"color": "#cccccc"
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
"visualMap": {
|
|
369
|
+
"color": [
|
|
370
|
+
"#ff6e76",
|
|
371
|
+
"#fddd60",
|
|
372
|
+
"#7cffb2"
|
|
373
|
+
]
|
|
374
|
+
},
|
|
375
|
+
"dataZoom": {
|
|
376
|
+
"backgroundColor": "rgba(47,69,84,0)",
|
|
377
|
+
"dataBackgroundColor": "rgba(255,255,255,0.3)",
|
|
378
|
+
"fillerColor": "rgba(167,183,204,0.4)",
|
|
379
|
+
"handleColor": "#a7b7cc",
|
|
380
|
+
"handleSize": "100%",
|
|
381
|
+
"textStyle": {
|
|
382
|
+
"color": "#cccccc"
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
"markPoint": {
|
|
386
|
+
"label": {
|
|
387
|
+
"color": "#cccccc"
|
|
388
|
+
},
|
|
389
|
+
"emphasis": {
|
|
390
|
+
"label": {
|
|
391
|
+
"color": "#cccccc"
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
;
|
|
397
|
+
|
|
398
|
+
export default _default;
|