react-use-echarts 1.0.3 → 1.0.4

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.
@@ -1,7 +1,8 @@
1
1
  import { UseEchartsOptions, UseEchartsReturn } from '../types';
2
2
  /**
3
- * React hook for Apache ECharts integration (v1.0)
4
- * Apache ECharts React Hook (v1.0)
3
+ * React hook for Apache ECharts integration
4
+ * Apache ECharts React Hook
5
+ *
5
6
  * @param ref React ref to the chart container element
6
7
  * @param options Configuration options
7
8
  * @returns Chart control methods
package/dist/index.d.ts CHANGED
@@ -19,14 +19,19 @@ export { useLazyInit } from './hooks/use-lazy-init';
19
19
  * Type definitions for the library
20
20
  * 库的类型定义
21
21
  */
22
- export type { UseEchartsOptions, UseEchartsReturn, EChartsEvents, BuiltinTheme, } from './types';
22
+ export type { UseEchartsOptions, UseEchartsReturn, EChartsEvents, EChartsInitOpts, BuiltinTheme, } from './types';
23
23
  /**
24
24
  * Theme utilities
25
25
  * 主题工具函数
26
26
  */
27
- export { registerBuiltinThemes, getBuiltinTheme, isBuiltinTheme, registerCustomTheme, getAvailableThemes, } from './themes';
27
+ export { registerBuiltinThemes, ensureBuiltinThemesRegistered, getBuiltinTheme, isBuiltinTheme, registerCustomTheme, getAvailableThemes, } from './themes';
28
28
  /**
29
- * Utility functions for ECharts
30
- * ECharts 工具函数
29
+ * Instance cache utilities (advanced)
30
+ * 实例缓存工具(高级用法)
31
31
  */
32
- export * from './utils';
32
+ export { getCachedInstance, setCachedInstance, replaceCachedInstance, releaseCachedInstance, getReferenceCount, clearInstanceCache, } from './utils/instance-cache';
33
+ /**
34
+ * Chart group/linkage utilities (advanced)
35
+ * 图表联动工具(高级用法)
36
+ */
37
+ export { addToGroup, removeFromGroup, updateGroup, getGroupInstances, getInstanceGroup, isInGroup, clearGroups, } from './utils/connect';
package/dist/index.es.js CHANGED
@@ -946,9 +946,13 @@ var themeRegistry = new Map([
946
946
  emphasis: { label: { color: "#eeeeee" } }
947
947
  }
948
948
  }]
949
- ]), customThemeCache = /* @__PURE__ */ new WeakMap(), customThemeCounter = 0;
949
+ ]), customThemeCache = /* @__PURE__ */ new WeakMap(), contentHashCache = /* @__PURE__ */ new Map(), customThemeCounter = 0, builtinThemesRegistered = !1;
950
950
  function registerBuiltinThemes() {
951
951
  for (let [e, t] of themeRegistry.entries()) echarts.registerTheme(e, t);
952
+ builtinThemesRegistered = !0;
953
+ }
954
+ function ensureBuiltinThemesRegistered() {
955
+ builtinThemesRegistered || registerBuiltinThemes();
952
956
  }
953
957
  function getBuiltinTheme(e) {
954
958
  return themeRegistry.get(e) || null;
@@ -962,13 +966,17 @@ function registerCustomTheme(e, t) {
962
966
  function getOrRegisterCustomTheme(e) {
963
967
  let t = customThemeCache.get(e);
964
968
  if (t) return t;
965
- let n = `__custom_theme_${customThemeCounter++}`;
966
- return echarts.registerTheme(n, e), customThemeCache.set(e, n), n;
969
+ let n = JSON.stringify(e), r = contentHashCache.get(n);
970
+ if (r) return customThemeCache.set(e, r), r;
971
+ let i = `__custom_theme_${customThemeCounter++}`;
972
+ return echarts.registerTheme(i, e), customThemeCache.set(e, i), contentHashCache.set(n, i), i;
967
973
  }
968
974
  function getAvailableThemes() {
969
975
  return Array.from(themeRegistry.keys());
970
976
  }
971
- registerBuiltinThemes();
977
+ function computeThemeKey(e) {
978
+ return e == null ? null : typeof e == "string" ? isBuiltinTheme(e) ? e : null : typeof e == "object" ? JSON.stringify(e) : null;
979
+ }
972
980
  function resolveThemeName(e) {
973
981
  return e == null ? null : typeof e == "string" && isBuiltinTheme(e) ? e : typeof e == "object" ? getOrRegisterCustomTheme(e) : null;
974
982
  }
@@ -979,131 +987,123 @@ function unbindEvents(e, t) {
979
987
  if (t) for (let [n, { handler: r }] of Object.entries(t)) e.off(n, r);
980
988
  }
981
989
  function useEcharts(n, i) {
982
- let o = (0, import_compiler_runtime.c)(70), { option: s, theme: c, renderer: l, lazyInit: f, group: p, setOptionOpts: m, showLoading: ce, loadingOption: h, onEvents: g } = i, _ = l === void 0 ? "canvas" : l, le = f === void 0 ? !1 : f, v = ce === void 0 ? !1 : ce, ue = useRef(s), de = useRef(m), fe = useRef(v), y = useRef(h), b = useRef(void 0), x = useRef(void 0), S = useRef(!1), C = useRef(g), w = useRef(void 0), T, E;
983
- o[0] === g ? (T = o[1], E = o[2]) : (T = () => {
984
- C.current = g;
985
- }, E = [g], o[0] = g, o[1] = T, o[2] = E), useEffect(T, E);
986
- let D = useLazyInit(n, le), O;
987
- o[3] === n ? O = o[4] : (O = () => {
990
+ let o = (0, import_compiler_runtime.c)(54), { option: s, theme: c, renderer: l, lazyInit: f, group: p, setOptionOpts: m, showLoading: ue, loadingOption: h, onEvents: g, autoResize: _, initOpts: v, onError: y } = i, b = l === void 0 ? "canvas" : l, de = f === void 0 ? !1 : f, x = ue === void 0 ? !1 : ue, S = _ === void 0 ? !0 : _, C = useRef(s), w = useRef(m), fe = useRef(x), pe = useRef(h), T = useRef(g), E = useRef(p), D = useRef(y), O = useRef(c), k;
991
+ o[0] !== p || o[1] !== h || o[2] !== y || o[3] !== g || o[4] !== s || o[5] !== m || o[6] !== x || o[7] !== c ? (k = () => {
992
+ C.current = s, w.current = m, fe.current = x, pe.current = h, T.current = g, E.current = p, D.current = y, O.current = c;
993
+ }, o[0] = p, o[1] = h, o[2] = y, o[3] = g, o[4] = s, o[5] = m, o[6] = x, o[7] = c, o[8] = k) : k = o[8], useLayoutEffect(k);
994
+ let A = useRef(void 0), j = useRef(null), M = useLazyInit(n, de), N;
995
+ o[9] === c ? N = o[10] : (N = computeThemeKey(c), o[9] = c, o[10] = N);
996
+ let P = N, F;
997
+ o[11] === n ? F = o[12] : (F = () => {
988
998
  if (n.current) return getCachedInstance(n.current);
989
- }, o[3] = n, o[4] = O);
990
- let k = O, A;
991
- o[5] !== n || o[6] !== _ || o[7] !== D || o[8] !== c ? (A = () => {
992
- let e = n.current;
993
- if (!e || !D) return;
994
- let t = getCachedInstance(e);
995
- if (!t) {
996
- let n = resolveThemeName(c);
997
- t = echarts.init(e, n, { renderer: _ }), setCachedInstance(e, t), x.current = c;
998
- }
999
- return t;
1000
- }, o[5] = n, o[6] = _, o[7] = D, o[8] = c, o[9] = A) : A = o[9];
1001
- let j = A, M = useRef(j), N, P;
1002
- o[10] !== j || o[11] !== h || o[12] !== s || o[13] !== m || o[14] !== v ? (N = () => {
1003
- ue.current = s, de.current = m, fe.current = v, y.current = h, M.current = j;
1004
- }, P = [
1005
- s,
1006
- m,
1007
- v,
1008
- h,
1009
- j
1010
- ], o[10] = j, o[11] = h, o[12] = s, o[13] = m, o[14] = v, o[15] = N, o[16] = P) : (N = o[15], P = o[16]), useLayoutEffect(N, P);
1011
- let F;
1012
- o[17] !== k || o[18] !== j || o[19] !== m ? (F = (e, t) => {
1013
- queueMicrotask(() => {
1014
- let n = k() || j();
1015
- if (n) {
1016
- let r = {
1017
- ...m,
1018
- ...t
1019
- };
1020
- n.setOption(e, r);
1021
- }
1022
- });
1023
- }, o[17] = k, o[18] = j, o[19] = m, o[20] = F) : F = o[20];
999
+ }, o[11] = n, o[12] = F);
1024
1000
  let I = F, L;
1025
- o[21] === k ? L = o[22] : (L = () => {
1026
- k()?.resize();
1027
- }, o[21] = k, o[22] = L);
1028
- let R = L, z, B;
1029
- o[23] !== n || o[24] !== D ? (z = () => {
1030
- if (!D) return;
1001
+ o[13] === I ? L = o[14] : (L = (e, t) => {
1002
+ let n = I();
1003
+ if (n) try {
1004
+ let r = {
1005
+ ...w.current,
1006
+ ...t
1007
+ };
1008
+ n.setOption(e, r);
1009
+ } catch (e) {
1010
+ let t = e;
1011
+ if (D.current) D.current(t);
1012
+ else throw t;
1013
+ }
1014
+ }, o[13] = I, o[14] = L);
1015
+ let R = L, z;
1016
+ o[15] === I ? z = o[16] : (z = () => {
1017
+ I()?.resize();
1018
+ }, o[15] = I, o[16] = z);
1019
+ let B = z, V;
1020
+ o[17] !== v || o[18] !== n || o[19] !== b || o[20] !== M ? (V = () => {
1021
+ if (!M) return;
1031
1022
  let e = n.current;
1032
1023
  if (!e) return;
1033
- let t = M.current();
1034
- if (t) return t.setOption(ue.current, de.current), S.current = !0, fe.current && t.showLoading(y.current), bindEvents(t, C.current), w.current = C.current, () => {
1024
+ ensureBuiltinThemesRegistered();
1025
+ let t = resolveThemeName(O.current), r;
1026
+ try {
1027
+ r = echarts.init(e, t, {
1028
+ renderer: b,
1029
+ ...v
1030
+ });
1031
+ } catch (e) {
1032
+ let t = e;
1033
+ D.current ? D.current(t) : console.error("ECharts init failed:", t);
1034
+ return;
1035
+ }
1036
+ setCachedInstance(e, r);
1037
+ try {
1038
+ r.setOption(C.current, w.current), j.current = {
1039
+ option: C.current,
1040
+ opts: w.current
1041
+ };
1042
+ } catch (e) {
1043
+ let t = e;
1044
+ D.current ? D.current(t) : console.error("ECharts setOption failed:", t);
1045
+ }
1046
+ fe.current && r.showLoading(pe.current), bindEvents(r, T.current), A.current = T.current;
1047
+ let i = E.current;
1048
+ return i && updateGroup(r, void 0, i), () => {
1035
1049
  let t = getCachedInstance(e);
1036
1050
  if (!t) return;
1037
- let n = b.current;
1038
- n && updateGroup(t, n, void 0), unbindEvents(t, w.current), w.current = void 0, releaseCachedInstance(e);
1051
+ let n = getInstanceGroup(t);
1052
+ n && updateGroup(t, n, void 0), unbindEvents(t, A.current), A.current = void 0, releaseCachedInstance(e);
1039
1053
  };
1040
- }, B = [D, n], o[23] = n, o[24] = D, o[25] = z, o[26] = B) : (z = o[25], B = o[26]), useLayoutEffect(z, B);
1041
- let V, H;
1042
- o[27] !== k || o[28] !== s || o[29] !== m ? (V = () => {
1043
- let e = k();
1044
- if (e) {
1045
- if (S.current) {
1046
- S.current = !1;
1047
- return;
1048
- }
1049
- e.setOption(s, m);
1050
- }
1051
- }, H = [
1052
- k,
1053
- s,
1054
- m
1055
- ], o[27] = k, o[28] = s, o[29] = m, o[30] = V, o[31] = H) : (V = o[30], H = o[31]), useEffect(V, H);
1054
+ }, o[17] = v, o[18] = n, o[19] = b, o[20] = M, o[21] = V) : V = o[21];
1055
+ let H;
1056
+ o[22] !== v || o[23] !== n || o[24] !== b || o[25] !== M || o[26] !== P ? (H = [
1057
+ M,
1058
+ n,
1059
+ P,
1060
+ b,
1061
+ v
1062
+ ], o[22] = v, o[23] = n, o[24] = b, o[25] = M, o[26] = P, o[27] = H) : H = o[27], useLayoutEffect(V, H);
1056
1063
  let U, W;
1057
- o[32] !== h || o[33] !== s || o[34] !== n || o[35] !== _ || o[36] !== m || o[37] !== v || o[38] !== c ? (U = () => {
1058
- let e = n.current;
1064
+ o[28] !== I || o[29] !== s || o[30] !== m ? (U = () => {
1065
+ let e = I();
1059
1066
  if (!e) return;
1060
- let t = getCachedInstance(e);
1061
- if (!t || x.current === c) return;
1062
- let r = b.current;
1063
- r && updateGroup(t, r, void 0);
1064
- let i = resolveThemeName(c), o = echarts.init(e, i, { renderer: _ });
1065
- replaceCachedInstance(e, o), x.current = c, o.setOption(s, m), bindEvents(o, C.current), w.current = C.current, r && updateGroup(o, void 0, r), v ? o.showLoading(h) : o.hideLoading();
1067
+ let t = j.current;
1068
+ if (!(t && t.option === s && t.opts === m)) try {
1069
+ e.setOption(s, m), j.current = {
1070
+ option: s,
1071
+ opts: m
1072
+ };
1073
+ } catch (e) {
1074
+ let t = e;
1075
+ if (D.current) D.current(t);
1076
+ else throw t;
1077
+ }
1066
1078
  }, W = [
1067
- n,
1068
- c,
1069
- _,
1079
+ I,
1070
1080
  s,
1071
- m,
1072
- v,
1081
+ m
1082
+ ], o[28] = I, o[29] = s, o[30] = m, o[31] = U, o[32] = W) : (U = o[31], W = o[32]), useEffect(U, W);
1083
+ let G, K;
1084
+ o[33] !== I || o[34] !== h || o[35] !== x ? (G = () => {
1085
+ let e = I();
1086
+ e && (x ? e.showLoading(h) : e.hideLoading());
1087
+ }, K = [
1088
+ I,
1089
+ x,
1073
1090
  h
1074
- ], o[32] = h, o[33] = s, o[34] = n, o[35] = _, o[36] = m, o[37] = v, o[38] = c, o[39] = U, o[40] = W) : (U = o[39], W = o[40]), useEffect(U, W);
1075
- let G;
1076
- o[41] !== k || o[42] !== h || o[43] !== v ? (G = () => {
1077
- let e = k();
1078
- e && (v ? e.showLoading(h) : e.hideLoading());
1079
- }, o[41] = k, o[42] = h, o[43] = v, o[44] = G) : G = o[44];
1080
- let K;
1081
- o[45] !== k || o[46] !== h || o[47] !== v || o[48] !== c ? (K = [
1082
- k,
1083
- v,
1084
- h,
1085
- c
1086
- ], o[45] = k, o[46] = h, o[47] = v, o[48] = c, o[49] = K) : K = o[49], useEffect(G, K);
1091
+ ], o[33] = I, o[34] = h, o[35] = x, o[36] = G, o[37] = K) : (G = o[36], K = o[37]), useEffect(G, K);
1087
1092
  let q, J;
1088
- o[50] !== k || o[51] !== g ? (q = () => {
1089
- let e = k();
1090
- e && w.current !== g && (unbindEvents(e, w.current), bindEvents(e, g), w.current = g);
1091
- }, J = [k, g], o[50] = k, o[51] = g, o[52] = q, o[53] = J) : (q = o[52], J = o[53]), useEffect(q, J);
1092
- let Y;
1093
- o[54] !== k || o[55] !== p || o[56] !== D ? (Y = () => {
1094
- if (!D) return;
1095
- let e = k();
1096
- e && (updateGroup(e, b.current, p), b.current = p);
1097
- }, o[54] = k, o[55] = p, o[56] = D, o[57] = Y) : Y = o[57];
1098
- let X;
1099
- o[58] !== k || o[59] !== p || o[60] !== D || o[61] !== c ? (X = [
1100
- k,
1101
- p,
1102
- D,
1103
- c
1104
- ], o[58] = k, o[59] = p, o[60] = D, o[61] = c, o[62] = X) : X = o[62], useEffect(Y, X);
1093
+ o[38] !== I || o[39] !== g ? (q = () => {
1094
+ let e = I();
1095
+ e && A.current !== g && (unbindEvents(e, A.current), bindEvents(e, g), A.current = g);
1096
+ }, J = [I, g], o[38] = I, o[39] = g, o[40] = q, o[41] = J) : (q = o[40], J = o[41]), useEffect(q, J);
1097
+ let Y, X;
1098
+ o[42] !== I || o[43] !== p ? (Y = () => {
1099
+ let e = I();
1100
+ if (!e) return;
1101
+ let t = getInstanceGroup(e);
1102
+ t !== p && updateGroup(e, t, p);
1103
+ }, X = [I, p], o[42] = I, o[43] = p, o[44] = Y, o[45] = X) : (Y = o[44], X = o[45]), useEffect(Y, X);
1105
1104
  let Z, Q;
1106
- o[63] === n ? (Z = o[64], Q = o[65]) : (Z = () => {
1105
+ o[46] !== S || o[47] !== n ? (Z = () => {
1106
+ if (!S) return;
1107
1107
  let e = n.current;
1108
1108
  if (!e) return;
1109
1109
  let t;
@@ -1118,13 +1118,13 @@ function useEcharts(n, i) {
1118
1118
  return () => {
1119
1119
  t?.disconnect();
1120
1120
  };
1121
- }, Q = [n], o[63] = n, o[64] = Z, o[65] = Q), useEffect(Z, Q);
1121
+ }, Q = [n, S], o[46] = S, o[47] = n, o[48] = Z, o[49] = Q) : (Z = o[48], Q = o[49]), useEffect(Z, Q);
1122
1122
  let $;
1123
- return o[66] !== k || o[67] !== R || o[68] !== I ? ($ = {
1124
- setOption: I,
1125
- getInstance: k,
1126
- resize: R
1127
- }, o[66] = k, o[67] = R, o[68] = I, o[69] = $) : $ = o[69], $;
1123
+ return o[50] !== I || o[51] !== B || o[52] !== R ? ($ = {
1124
+ setOption: R,
1125
+ getInstance: I,
1126
+ resize: B
1127
+ }, o[50] = I, o[51] = B, o[52] = R, o[53] = $) : $ = o[53], $;
1128
1128
  }
1129
1129
  var use_echarts_default = useEcharts;
1130
- export { addToGroup, clearGroups, clearInstanceCache, getAvailableThemes, getBuiltinTheme, getCachedInstance, getGroupInstances, getInstanceGroup, getReferenceCount, isBuiltinTheme, isInGroup, registerBuiltinThemes, registerCustomTheme, releaseCachedInstance, removeFromGroup, replaceCachedInstance, setCachedInstance, updateGroup, use_echarts_default as useEcharts, useLazyInit };
1130
+ export { addToGroup, clearGroups, clearInstanceCache, ensureBuiltinThemesRegistered, getAvailableThemes, getBuiltinTheme, getCachedInstance, getGroupInstances, getInstanceGroup, getReferenceCount, isBuiltinTheme, isInGroup, registerBuiltinThemes, registerCustomTheme, releaseCachedInstance, removeFromGroup, replaceCachedInstance, setCachedInstance, updateGroup, use_echarts_default as useEcharts, useLazyInit };
package/dist/index.umd.js CHANGED
@@ -2,4 +2,4 @@
2
2
  1. You might have mismatching versions of React and the renderer (such as React DOM)
3
3
  2. You might be breaking the Rules of Hooks
4
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)}})()})),ee=l(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=d():t.exports=f()}))();function te(e,n=!1){let r=n!==!1,[i,a]=(0,t.useState)(!r),o=typeof n==`object`,s=o?n.root:null,c=o?n.rootMargin:void 0,l=o?n.threshold:void 0,u=(0,t.useMemo)(()=>({root:s??null,rootMargin:c??`50px`,threshold:l??.1}),[s,c,l===void 0?void 0:JSON.stringify(l)]);return(0,t.useEffect)(()=>{if(!r||i)return;let t=e.current;if(!t)return;let n=new IntersectionObserver(e=>{let[t]=e;t.isIntersecting&&(a(!0),n.disconnect())},u);return n.observe(t),()=>{n.disconnect()}},[e,r,i,u]),i}var p=new WeakMap,m=new Set;function h(e){return p.get(e)?.instance}function ne(e,t){let n=p.get(e);return n?(n.refCount+=1,n.instance):(p.set(e,{instance:t,refCount:1}),m.add(e),t)}function re(e,t){let n=p.get(e);return n?(n.instance.dispose(),n.instance=t,t):(p.set(e,{instance:t,refCount:1}),m.add(e),t)}function ie(e){let t=p.get(e);t&&(--t.refCount,t.refCount<=0&&(t.instance.dispose(),p.delete(e),m.delete(e)))}function ae(e){return p.get(e)?.refCount??0}function g(){for(let e of m)p.get(e)?.instance.dispose();p=new WeakMap,m.clear()}var _=new Map;function v(e,t){let r=_.get(t);r||(r=new Set,_.set(t,r)),e.group=t,r.add(e),r.size>1&&n.connect(t)}function y(e,t){let r=_.get(t);r&&(r.delete(e),e.group===t&&(e.group=void 0),r.size===0?(_.delete(t),n.disconnect(t)):r.size===1?n.disconnect(t):n.connect(t))}function b(e,t,n){t&&y(e,t),n&&v(e,n)}function oe(e){let t=_.get(e);return t?Array.from(t):[]}function x(e){for(let[t,n]of _.entries())if(n.has(e))return t}function S(e){return x(e)!==void 0}function C(){for(let e of _.keys())n.disconnect(e);_.clear()}var w=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`}}}}]]),T=new WeakMap,E=0;function D(){for(let[e,t]of w.entries())n.registerTheme(e,t)}function O(e){return w.get(e)||null}function k(e){return w.has(e)}function A(e,t){n.registerTheme(e,t)}function j(e){let t=T.get(e);if(t)return t;let r=`__custom_theme_${E++}`;return n.registerTheme(r,e),T.set(e,r),r}function M(){return Array.from(w.keys())}D();function se(e){return e==null?null:typeof e==`string`&&k(e)?e:typeof e==`object`?j(e):null}function ce(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 le(e,t){if(t)for(let[n,{handler:r}]of Object.entries(t))e.off(n,r)}function N(e,r){let i=(0,ee.c)(70),{option:a,theme:o,renderer:s,lazyInit:c,group:l,setOptionOpts:u,showLoading:d,loadingOption:f,onEvents:p}=r,m=s===void 0?`canvas`:s,ae=c===void 0?!1:c,g=d===void 0?!1:d,_=(0,t.useRef)(a),v=(0,t.useRef)(u),y=(0,t.useRef)(g),oe=(0,t.useRef)(f),x=(0,t.useRef)(void 0),S=(0,t.useRef)(void 0),C=(0,t.useRef)(!1),w=(0,t.useRef)(p),T=(0,t.useRef)(void 0),E,D;i[0]===p?(E=i[1],D=i[2]):(E=()=>{w.current=p},D=[p],i[0]=p,i[1]=E,i[2]=D),(0,t.useEffect)(E,D);let O=te(e,ae),k;i[3]===e?k=i[4]:(k=()=>{if(e.current)return h(e.current)},i[3]=e,i[4]=k);let A=k,j;i[5]!==e||i[6]!==m||i[7]!==O||i[8]!==o?(j=()=>{let t=e.current;if(!t||!O)return;let r=h(t);if(!r){let e=se(o);r=n.init(t,e,{renderer:m}),ne(t,r),S.current=o}return r},i[5]=e,i[6]=m,i[7]=O,i[8]=o,i[9]=j):j=i[9];let M=j,N=(0,t.useRef)(M),P,F;i[10]!==M||i[11]!==f||i[12]!==a||i[13]!==u||i[14]!==g?(P=()=>{_.current=a,v.current=u,y.current=g,oe.current=f,N.current=M},F=[a,u,g,f,M],i[10]=M,i[11]=f,i[12]=a,i[13]=u,i[14]=g,i[15]=P,i[16]=F):(P=i[15],F=i[16]),(0,t.useLayoutEffect)(P,F);let I;i[17]!==A||i[18]!==M||i[19]!==u?(I=(e,t)=>{queueMicrotask(()=>{let n=A()||M();if(n){let r={...u,...t};n.setOption(e,r)}})},i[17]=A,i[18]=M,i[19]=u,i[20]=I):I=i[20];let L=I,R;i[21]===A?R=i[22]:(R=()=>{A()?.resize()},i[21]=A,i[22]=R);let ue=R,z,B;i[23]!==e||i[24]!==O?(z=()=>{if(!O)return;let t=e.current;if(!t)return;let n=N.current();if(n)return n.setOption(_.current,v.current),C.current=!0,y.current&&n.showLoading(oe.current),ce(n,w.current),T.current=w.current,()=>{let e=h(t);if(!e)return;let n=x.current;n&&b(e,n,void 0),le(e,T.current),T.current=void 0,ie(t)}},B=[O,e],i[23]=e,i[24]=O,i[25]=z,i[26]=B):(z=i[25],B=i[26]),(0,t.useLayoutEffect)(z,B);let V,H;i[27]!==A||i[28]!==a||i[29]!==u?(V=()=>{let e=A();if(e){if(C.current){C.current=!1;return}e.setOption(a,u)}},H=[A,a,u],i[27]=A,i[28]=a,i[29]=u,i[30]=V,i[31]=H):(V=i[30],H=i[31]),(0,t.useEffect)(V,H);let U,W;i[32]!==f||i[33]!==a||i[34]!==e||i[35]!==m||i[36]!==u||i[37]!==g||i[38]!==o?(U=()=>{let t=e.current;if(!t)return;let r=h(t);if(!r||S.current===o)return;let i=x.current;i&&b(r,i,void 0);let s=se(o),c=n.init(t,s,{renderer:m});re(t,c),S.current=o,c.setOption(a,u),ce(c,w.current),T.current=w.current,i&&b(c,void 0,i),g?c.showLoading(f):c.hideLoading()},W=[e,o,m,a,u,g,f],i[32]=f,i[33]=a,i[34]=e,i[35]=m,i[36]=u,i[37]=g,i[38]=o,i[39]=U,i[40]=W):(U=i[39],W=i[40]),(0,t.useEffect)(U,W);let G;i[41]!==A||i[42]!==f||i[43]!==g?(G=()=>{let e=A();e&&(g?e.showLoading(f):e.hideLoading())},i[41]=A,i[42]=f,i[43]=g,i[44]=G):G=i[44];let K;i[45]!==A||i[46]!==f||i[47]!==g||i[48]!==o?(K=[A,g,f,o],i[45]=A,i[46]=f,i[47]=g,i[48]=o,i[49]=K):K=i[49],(0,t.useEffect)(G,K);let q,J;i[50]!==A||i[51]!==p?(q=()=>{let e=A();e&&T.current!==p&&(le(e,T.current),ce(e,p),T.current=p)},J=[A,p],i[50]=A,i[51]=p,i[52]=q,i[53]=J):(q=i[52],J=i[53]),(0,t.useEffect)(q,J);let Y;i[54]!==A||i[55]!==l||i[56]!==O?(Y=()=>{if(!O)return;let e=A();e&&(b(e,x.current,l),x.current=l)},i[54]=A,i[55]=l,i[56]=O,i[57]=Y):Y=i[57];let X;i[58]!==A||i[59]!==l||i[60]!==O||i[61]!==o?(X=[A,l,O,o],i[58]=A,i[59]=l,i[60]=O,i[61]=o,i[62]=X):X=i[62],(0,t.useEffect)(Y,X);let Z,Q;i[63]===e?(Z=i[64],Q=i[65]):(Z=()=>{let t=e.current;if(!t)return;let n;try{n=new ResizeObserver(()=>{h(t)?.resize()}),n.observe(t)}catch(e){let t=e;console.warn(`ResizeObserver not available:`,t)}return()=>{n?.disconnect()}},Q=[e],i[63]=e,i[64]=Z,i[65]=Q),(0,t.useEffect)(Z,Q);let $;return i[66]!==A||i[67]!==ue||i[68]!==L?($={setOption:L,getInstance:A,resize:ue},i[66]=A,i[67]=ue,i[68]=L,i[69]=$):$=i[69],$}var P=N;e.addToGroup=v,e.clearGroups=C,e.clearInstanceCache=g,e.getAvailableThemes=M,e.getBuiltinTheme=O,e.getCachedInstance=h,e.getGroupInstances=oe,e.getInstanceGroup=x,e.getReferenceCount=ae,e.isBuiltinTheme=k,e.isInGroup=S,e.registerBuiltinThemes=D,e.registerCustomTheme=A,e.releaseCachedInstance=ie,e.removeFromGroup=y,e.replaceCachedInstance=re,e.setCachedInstance=ne,e.updateGroup=b,e.useEcharts=P,e.useLazyInit=te});
5
+ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),n.useMemoCache(e)}})()})),ee=l(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=d():t.exports=f()}))();function te(e,n=!1){let r=n!==!1,[i,a]=(0,t.useState)(!r),o=typeof n==`object`,s=o?n.root:null,c=o?n.rootMargin:void 0,l=o?n.threshold:void 0,u=(0,t.useMemo)(()=>({root:s??null,rootMargin:c??`50px`,threshold:l??.1}),[s,c,l===void 0?void 0:JSON.stringify(l)]);return(0,t.useEffect)(()=>{if(!r||i)return;let t=e.current;if(!t)return;let n=new IntersectionObserver(e=>{let[t]=e;t.isIntersecting&&(a(!0),n.disconnect())},u);return n.observe(t),()=>{n.disconnect()}},[e,r,i,u]),i}var p=new WeakMap,m=new Set;function h(e){return p.get(e)?.instance}function ne(e,t){let n=p.get(e);return n?(n.refCount+=1,n.instance):(p.set(e,{instance:t,refCount:1}),m.add(e),t)}function g(e,t){let n=p.get(e);return n?(n.instance.dispose(),n.instance=t,t):(p.set(e,{instance:t,refCount:1}),m.add(e),t)}function re(e){let t=p.get(e);t&&(--t.refCount,t.refCount<=0&&(t.instance.dispose(),p.delete(e),m.delete(e)))}function _(e){return p.get(e)?.refCount??0}function v(){for(let e of m)p.get(e)?.instance.dispose();p=new WeakMap,m.clear()}var y=new Map;function b(e,t){let r=y.get(t);r||(r=new Set,y.set(t,r)),e.group=t,r.add(e),r.size>1&&n.connect(t)}function x(e,t){let r=y.get(t);r&&(r.delete(e),e.group===t&&(e.group=void 0),r.size===0?(y.delete(t),n.disconnect(t)):r.size===1?n.disconnect(t):n.connect(t))}function S(e,t,n){t&&x(e,t),n&&b(e,n)}function C(e){let t=y.get(e);return t?Array.from(t):[]}function w(e){for(let[t,n]of y.entries())if(n.has(e))return t}function T(e){return w(e)!==void 0}function ie(){for(let e of y.keys())n.disconnect(e);y.clear()}var E=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`}}}}]]),D=new WeakMap,O=new Map,k=0,A=!1;function j(){for(let[e,t]of E.entries())n.registerTheme(e,t);A=!0}function ae(){A||j()}function M(e){return E.get(e)||null}function N(e){return E.has(e)}function P(e,t){n.registerTheme(e,t)}function F(e){let t=D.get(e);if(t)return t;let r=JSON.stringify(e),i=O.get(r);if(i)return D.set(e,i),i;let a=`__custom_theme_${k++}`;return n.registerTheme(a,e),D.set(e,a),O.set(r,a),a}function I(){return Array.from(E.keys())}function oe(e){return e==null?null:typeof e==`string`?N(e)?e:null:typeof e==`object`?JSON.stringify(e):null}function se(e){return e==null?null:typeof e==`string`&&N(e)?e:typeof e==`object`?F(e):null}function ce(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 le(e,t){if(t)for(let[n,{handler:r}]of Object.entries(t))e.off(n,r)}function L(e,r){let i=(0,ee.c)(54),{option:a,theme:o,renderer:s,lazyInit:c,group:l,setOptionOpts:u,showLoading:d,loadingOption:f,onEvents:p,autoResize:m,initOpts:g,onError:_}=r,v=s===void 0?`canvas`:s,y=c===void 0?!1:c,b=d===void 0?!1:d,x=m===void 0?!0:m,C=(0,t.useRef)(a),T=(0,t.useRef)(u),ie=(0,t.useRef)(b),E=(0,t.useRef)(f),D=(0,t.useRef)(p),O=(0,t.useRef)(l),k=(0,t.useRef)(_),A=(0,t.useRef)(o),j;i[0]!==l||i[1]!==f||i[2]!==_||i[3]!==p||i[4]!==a||i[5]!==u||i[6]!==b||i[7]!==o?(j=()=>{C.current=a,T.current=u,ie.current=b,E.current=f,D.current=p,O.current=l,k.current=_,A.current=o},i[0]=l,i[1]=f,i[2]=_,i[3]=p,i[4]=a,i[5]=u,i[6]=b,i[7]=o,i[8]=j):j=i[8],(0,t.useLayoutEffect)(j);let M=(0,t.useRef)(void 0),N=(0,t.useRef)(null),P=te(e,y),F;i[9]===o?F=i[10]:(F=oe(o),i[9]=o,i[10]=F);let I=F,L;i[11]===e?L=i[12]:(L=()=>{if(e.current)return h(e.current)},i[11]=e,i[12]=L);let R=L,z;i[13]===R?z=i[14]:(z=(e,t)=>{let n=R();if(n)try{let r={...T.current,...t};n.setOption(e,r)}catch(e){let t=e;if(k.current)k.current(t);else throw t}},i[13]=R,i[14]=z);let ue=z,B;i[15]===R?B=i[16]:(B=()=>{R()?.resize()},i[15]=R,i[16]=B);let de=B,V;i[17]!==g||i[18]!==e||i[19]!==v||i[20]!==P?(V=()=>{if(!P)return;let t=e.current;if(!t)return;ae();let r=se(A.current),i;try{i=n.init(t,r,{renderer:v,...g})}catch(e){let t=e;k.current?k.current(t):console.error(`ECharts init failed:`,t);return}ne(t,i);try{i.setOption(C.current,T.current),N.current={option:C.current,opts:T.current}}catch(e){let t=e;k.current?k.current(t):console.error(`ECharts setOption failed:`,t)}ie.current&&i.showLoading(E.current),ce(i,D.current),M.current=D.current;let a=O.current;return a&&S(i,void 0,a),()=>{let e=h(t);if(!e)return;let n=w(e);n&&S(e,n,void 0),le(e,M.current),M.current=void 0,re(t)}},i[17]=g,i[18]=e,i[19]=v,i[20]=P,i[21]=V):V=i[21];let H;i[22]!==g||i[23]!==e||i[24]!==v||i[25]!==P||i[26]!==I?(H=[P,e,I,v,g],i[22]=g,i[23]=e,i[24]=v,i[25]=P,i[26]=I,i[27]=H):H=i[27],(0,t.useLayoutEffect)(V,H);let U,W;i[28]!==R||i[29]!==a||i[30]!==u?(U=()=>{let e=R();if(!e)return;let t=N.current;if(!(t&&t.option===a&&t.opts===u))try{e.setOption(a,u),N.current={option:a,opts:u}}catch(e){let t=e;if(k.current)k.current(t);else throw t}},W=[R,a,u],i[28]=R,i[29]=a,i[30]=u,i[31]=U,i[32]=W):(U=i[31],W=i[32]),(0,t.useEffect)(U,W);let G,K;i[33]!==R||i[34]!==f||i[35]!==b?(G=()=>{let e=R();e&&(b?e.showLoading(f):e.hideLoading())},K=[R,b,f],i[33]=R,i[34]=f,i[35]=b,i[36]=G,i[37]=K):(G=i[36],K=i[37]),(0,t.useEffect)(G,K);let q,J;i[38]!==R||i[39]!==p?(q=()=>{let e=R();e&&M.current!==p&&(le(e,M.current),ce(e,p),M.current=p)},J=[R,p],i[38]=R,i[39]=p,i[40]=q,i[41]=J):(q=i[40],J=i[41]),(0,t.useEffect)(q,J);let Y,X;i[42]!==R||i[43]!==l?(Y=()=>{let e=R();if(!e)return;let t=w(e);t!==l&&S(e,t,l)},X=[R,l],i[42]=R,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]!==x||i[47]!==e?(Z=()=>{if(!x)return;let t=e.current;if(!t)return;let n;try{n=new ResizeObserver(()=>{h(t)?.resize()}),n.observe(t)}catch(e){let t=e;console.warn(`ResizeObserver not available:`,t)}return()=>{n?.disconnect()}},Q=[e,x],i[46]=x,i[47]=e,i[48]=Z,i[49]=Q):(Z=i[48],Q=i[49]),(0,t.useEffect)(Z,Q);let $;return i[50]!==R||i[51]!==de||i[52]!==ue?($={setOption:ue,getInstance:R,resize:de},i[50]=R,i[51]=de,i[52]=ue,i[53]=$):$=i[53],$}var R=L;e.addToGroup=b,e.clearGroups=ie,e.clearInstanceCache=v,e.ensureBuiltinThemesRegistered=ae,e.getAvailableThemes=I,e.getBuiltinTheme=M,e.getCachedInstance=h,e.getGroupInstances=C,e.getInstanceGroup=w,e.getReferenceCount=_,e.isBuiltinTheme=N,e.isInGroup=T,e.registerBuiltinThemes=j,e.registerCustomTheme=P,e.releaseCachedInstance=re,e.removeFromGroup=x,e.replaceCachedInstance=g,e.setCachedInstance=ne,e.updateGroup=S,e.useEcharts=R,e.useLazyInit=te});
@@ -4,6 +4,12 @@ import { BuiltinTheme } from '../types';
4
4
  * 向 ECharts 注册内置主题
5
5
  */
6
6
  export declare function registerBuiltinThemes(): void;
7
+ /**
8
+ * Ensure built-in themes are registered (lazy, idempotent)
9
+ * 确保内置主题已注册(惰性、幂等)
10
+ * Called automatically before chart initialization
11
+ */
12
+ export declare function ensureBuiltinThemesRegistered(): void;
7
13
  /**
8
14
  * Get built-in theme configuration
9
15
  * 获取内置主题配置
@@ -26,10 +32,19 @@ export declare function isBuiltinTheme(themeName: string): themeName is BuiltinT
26
32
  */
27
33
  export declare function registerCustomTheme(themeName: string, themeConfig: object): void;
28
34
  /**
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
- * 通过为相同对象引用重用主题名称来防止内存泄漏
35
+ * Get or create a cached theme name for a custom theme object.
36
+ *
37
+ * Uses two-level caching:
38
+ * 1. WeakMap by object reference (O(1) fast path for same reference)
39
+ * 2. Content hash Map (dedup for different references with identical content)
40
+ *
41
+ * This prevents ECharts global theme registry from growing unboundedly
42
+ * when consumers forget to useMemo their theme objects.
43
+ *
44
+ * 获取或创建自定义主题对象的缓存主题名称。
45
+ * 使用两级缓存:引用级 WeakMap + 内容级 Map,
46
+ * 避免消费者未 useMemo 主题对象时导致 ECharts 全局注册无限增长。
47
+ *
33
48
  * @param themeConfig Custom theme configuration object
34
49
  * @returns Cached or newly generated theme name
35
50
  */
@@ -32,6 +32,7 @@ export interface EChartsEvents {
32
32
  /**
33
33
  * Query condition for the event
34
34
  * 事件的查询条件
35
+ * @see https://echarts.apache.org/en/api.html#bindbindEvent query
35
36
  */
36
37
  query?: string | object;
37
38
  /**
@@ -41,6 +42,33 @@ export interface EChartsEvents {
41
42
  context?: object;
42
43
  };
43
44
  }
45
+ /**
46
+ * ECharts initialization options passed to echarts.init()
47
+ * 传递给 echarts.init() 的初始化选项
48
+ */
49
+ export interface EChartsInitOpts {
50
+ /**
51
+ * Device pixel ratio for canvas rendering
52
+ * Canvas 渲染的设备像素比
53
+ * @see https://echarts.apache.org/en/api.html#echarts.init
54
+ */
55
+ devicePixelRatio?: number;
56
+ /**
57
+ * Locale for chart display (e.g. 'ZH', 'EN')
58
+ * 图表显示的语言环境
59
+ */
60
+ locale?: string;
61
+ /**
62
+ * Explicit width (for off-screen rendering or fixed-size charts)
63
+ * 显式宽度(用于离屏渲染或固定尺寸图表)
64
+ */
65
+ width?: number | string;
66
+ /**
67
+ * Explicit height (for off-screen rendering or fixed-size charts)
68
+ * 显式高度(用于离屏渲染或固定尺寸图表)
69
+ */
70
+ height?: number | string;
71
+ }
44
72
  /**
45
73
  * Configuration options for useEcharts hook
46
74
  * useEcharts hook 的配置选项
@@ -86,13 +114,32 @@ export interface UseEchartsOptions {
86
114
  /**
87
115
  * Loading options
88
116
  * 加载配置项
117
+ * @see https://echarts.apache.org/en/api.html#echartsInstance.showLoading
89
118
  */
90
- loadingOption?: object;
119
+ loadingOption?: Record<string, unknown>;
91
120
  /**
92
121
  * Event configurations
93
122
  * 事件配置
94
123
  */
95
124
  onEvents?: EChartsEvents;
125
+ /**
126
+ * Whether to automatically resize chart when container size changes
127
+ * 容器尺寸变化时是否自动 resize
128
+ * @default true
129
+ */
130
+ autoResize?: boolean;
131
+ /**
132
+ * ECharts init options (devicePixelRatio, locale, width, height)
133
+ * ECharts 初始化选项
134
+ * Note: Changing these requires instance recreation
135
+ */
136
+ initOpts?: EChartsInitOpts;
137
+ /**
138
+ * Error handler for chart operations (init, setOption, etc.)
139
+ * 图表操作(init、setOption 等)的错误处理回调
140
+ * Without this, errors propagate normally (may trigger React error boundaries)
141
+ */
142
+ onError?: (error: unknown) => void;
96
143
  }
97
144
  /**
98
145
  * Return type for useEcharts hook
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-use-echarts",
3
3
  "private": false,
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "description": "A powerful React hooks library for Apache ECharts",
6
6
  "keywords": [
7
7
  "react",
@@ -50,21 +50,21 @@
50
50
  "test": "vitest",
51
51
  "coverage": "vitest run --coverage",
52
52
  "lint": "eslint .",
53
- "prepare": "pnpm build",
53
+ "prepublishOnly": "pnpm build",
54
54
  "typecheck": "tsc -b"
55
55
  },
56
56
  "devDependencies": {
57
- "@eslint/js": "^9.39.2",
57
+ "@eslint/js": "^10.0.1",
58
58
  "@testing-library/react": "^16.3.2",
59
- "@types/node": "^25.2.0",
60
- "@types/react": "^19.2.11",
59
+ "@types/node": "^25.2.3",
60
+ "@types/react": "^19.2.14",
61
61
  "@types/react-dom": "^19.2.3",
62
- "@vitejs/plugin-react": "^5.1.3",
62
+ "@vitejs/plugin-react": "^5.1.4",
63
63
  "@vitest/coverage-v8": "^4.0.18",
64
64
  "babel-plugin-react-compiler": "^1.0.0",
65
65
  "baseline-browser-mapping": "^2.9.19",
66
66
  "echarts": "^6.0.0",
67
- "eslint": "^9.39.2",
67
+ "eslint": "^10.0.0",
68
68
  "eslint-plugin-react-hooks": "^7.0.1",
69
69
  "eslint-plugin-react-refresh": "^0.5.0",
70
70
  "globals": "^17.3.0",
@@ -72,7 +72,7 @@
72
72
  "react": "^19.2.4",
73
73
  "react-dom": "^19.2.4",
74
74
  "typescript": "~5.9.3",
75
- "typescript-eslint": "^8.54.0",
75
+ "typescript-eslint": "^8.55.0",
76
76
  "vite": "npm:rolldown-vite@7.3.1",
77
77
  "vite-plugin-dts": "^4.5.4",
78
78
  "vitest": "^4.0.18"
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};