@cloudflare/kumo 2.5.2 → 2.6.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/CHANGELOG.md +24 -0
- package/ai/component-registry.json +166 -119
- package/ai/component-registry.md +168 -50
- package/ai/schemas.ts +23 -12
- package/dist/.build-complete +1 -1
- package/dist/ai/schemas.d.ts +75 -48
- package/dist/ai/schemas.d.ts.map +1 -1
- package/dist/ai/schemas.js +207 -197
- package/dist/ai/schemas.js.map +1 -1
- package/dist/chunks/SankeyChart-g1tng405ml2e0qg2.js +890 -0
- package/dist/chunks/SankeyChart-g1tng405ml2e0qg2.js.map +1 -0
- package/dist/chunks/{autocomplete-d52negr21cedr4rm.js → autocomplete-hgprlcuf0ixbbo6d.js} +18 -18
- package/dist/chunks/{autocomplete-d52negr21cedr4rm.js.map → autocomplete-hgprlcuf0ixbbo6d.js.map} +1 -1
- package/dist/chunks/{breadcrumbs-bfuf7g8hh36rg7h8.js → breadcrumbs-lyj8ljudrm2owx5y.js} +2 -2
- package/dist/chunks/{breadcrumbs-bfuf7g8hh36rg7h8.js.map → breadcrumbs-lyj8ljudrm2owx5y.js.map} +1 -1
- package/dist/chunks/button-gtdhvogt5rlrf1is.js +237 -0
- package/dist/chunks/button-gtdhvogt5rlrf1is.js.map +1 -0
- package/dist/chunks/{checkbox-bt4nfv1i2142kykg.js → checkbox-byg8t8r9vbmif696.js} +3 -3
- package/dist/chunks/{checkbox-bt4nfv1i2142kykg.js.map → checkbox-byg8t8r9vbmif696.js.map} +1 -1
- package/dist/chunks/{clipboard-text-h3oi6wm5vj2q7q4h.js → clipboard-text-lf909phvldd8rfk8.js} +4 -4
- package/dist/chunks/{clipboard-text-h3oi6wm5vj2q7q4h.js.map → clipboard-text-lf909phvldd8rfk8.js.map} +1 -1
- package/dist/chunks/{collapsible-nzqcf9zwnjkxqzr6.js → collapsible-dl61f8gd4j897hmv.js} +4 -4
- package/dist/chunks/{collapsible-nzqcf9zwnjkxqzr6.js.map → collapsible-dl61f8gd4j897hmv.js.map} +1 -1
- package/dist/chunks/{combobox-l6qcou2s3xmsbplp.js → combobox-dxff22zxzq846nec.js} +4 -4
- package/dist/chunks/{combobox-l6qcou2s3xmsbplp.js.map → combobox-dxff22zxzq846nec.js.map} +1 -1
- package/dist/chunks/{command-palette-fqhyacp33fhyf696.js → command-palette-i4r0402b838wiy0j.js} +21 -21
- package/dist/chunks/{command-palette-fqhyacp33fhyf696.js.map → command-palette-i4r0402b838wiy0j.js.map} +1 -1
- package/dist/chunks/{dialog-3mpu1i1wssrsz8i6.js → dialog-g1b8161nbyixdit0.js} +7 -7
- package/dist/chunks/{dialog-3mpu1i1wssrsz8i6.js.map → dialog-g1b8161nbyixdit0.js.map} +1 -1
- package/dist/chunks/{dropdown-g4sb4cw9ffqaw5gx.js → dropdown-irp18txvgz8590e9.js} +27 -27
- package/dist/chunks/{dropdown-g4sb4cw9ffqaw5gx.js.map → dropdown-irp18txvgz8590e9.js.map} +1 -1
- package/dist/chunks/{empty-frsjvok4w6i0fyex.js → empty-daa6d7u9oleaw24a.js} +2 -2
- package/dist/chunks/{empty-frsjvok4w6i0fyex.js.map → empty-daa6d7u9oleaw24a.js.map} +1 -1
- package/dist/chunks/{field-m57qcw5b1zt1ohfz.js → field-f1hy08um3jf9jos6.js} +3 -3
- package/dist/chunks/{field-m57qcw5b1zt1ohfz.js.map → field-f1hy08um3jf9jos6.js.map} +1 -1
- package/dist/chunks/{input-area-o2avpahffav0gydf.js → input-area-bwyujceeulpfkpxv.js} +4 -4
- package/dist/chunks/{input-area-o2avpahffav0gydf.js.map → input-area-bwyujceeulpfkpxv.js.map} +1 -1
- package/dist/chunks/{input-iahz0dpc9xdar2ju.js → input-f2ct7obgdzypjmp2.js} +3 -3
- package/dist/chunks/{input-iahz0dpc9xdar2ju.js.map → input-f2ct7obgdzypjmp2.js.map} +1 -1
- package/dist/chunks/{input-group-os810pmsqcftt6mq.js → input-group-kcd3jin5pbdijmw8.js} +5 -5
- package/dist/chunks/{input-group-os810pmsqcftt6mq.js.map → input-group-kcd3jin5pbdijmw8.js.map} +1 -1
- package/dist/chunks/{label-kib2hn4pkbn28c31.js → label-himqjkdhh0hgfdsa.js} +3 -3
- package/dist/chunks/{label-kib2hn4pkbn28c31.js.map → label-himqjkdhh0hgfdsa.js.map} +1 -1
- package/dist/chunks/{layer-card-er4flkcxmzfug8jw.js → layer-card-cshi5vydqg3phyfx.js} +2 -2
- package/dist/chunks/{layer-card-er4flkcxmzfug8jw.js.map → layer-card-cshi5vydqg3phyfx.js.map} +1 -1
- package/dist/chunks/{link-i6vnwyjcwvjz5btm.js → link-bw21ofmgg58igq5n.js} +4 -4
- package/dist/chunks/{link-i6vnwyjcwvjz5btm.js.map → link-bw21ofmgg58igq5n.js.map} +1 -1
- package/dist/chunks/{menubar-ng5if56amh1tto4j.js → menubar-m12wcbbucuszspw4.js} +2 -2
- package/dist/chunks/{menubar-ng5if56amh1tto4j.js.map → menubar-m12wcbbucuszspw4.js.map} +1 -1
- package/dist/chunks/{meter-d5igshkjqttl1fdj.js → meter-dn8vgc0smpk0du75.js} +4 -4
- package/dist/chunks/{meter-d5igshkjqttl1fdj.js.map → meter-dn8vgc0smpk0du75.js.map} +1 -1
- package/dist/chunks/{pagination-mvvg7qfvoqr5l4vt.js → pagination-oafyxvdndm9m8250.js} +3 -3
- package/dist/chunks/{pagination-mvvg7qfvoqr5l4vt.js.map → pagination-oafyxvdndm9m8250.js.map} +1 -1
- package/dist/chunks/{popover-ozf1j7oi7pxiudyz.js → popover-bbxr39l1lx175hum.js} +18 -18
- package/dist/chunks/{popover-ozf1j7oi7pxiudyz.js.map → popover-bbxr39l1lx175hum.js.map} +1 -1
- package/dist/chunks/radio-ffx05ih9nc764evh.js +226 -0
- package/dist/chunks/radio-ffx05ih9nc764evh.js.map +1 -0
- package/dist/chunks/{select-c79vjqmcytn2oujb.js → select-kl1skfh3pmwc33rp.js} +6 -6
- package/dist/chunks/{select-c79vjqmcytn2oujb.js.map → select-kl1skfh3pmwc33rp.js.map} +1 -1
- package/dist/chunks/{sensitive-input-mxbd0ayw2mbju4ii.js → sensitive-input-izmbyk1t7r56ciiq.js} +4 -4
- package/dist/chunks/{sensitive-input-mxbd0ayw2mbju4ii.js.map → sensitive-input-izmbyk1t7r56ciiq.js.map} +1 -1
- package/dist/chunks/{sidebar-dqw2uxx6xqln639l.js → sidebar-ior8rnhsd7gy5am5.js} +48 -48
- package/dist/chunks/sidebar-ior8rnhsd7gy5am5.js.map +1 -0
- package/dist/chunks/{surface-iyejjbqogjbo7ise.js → surface-g5a1buofz4erjov2.js} +2 -2
- package/dist/chunks/{surface-iyejjbqogjbo7ise.js.map → surface-g5a1buofz4erjov2.js.map} +1 -1
- package/dist/chunks/{switch-dld1q6qdzhe1uip7.js → switch-kh8a6l3l0hszm9h4.js} +3 -3
- package/dist/chunks/{switch-dld1q6qdzhe1uip7.js.map → switch-kh8a6l3l0hszm9h4.js.map} +1 -1
- package/dist/chunks/{table-l64wm81r9t67mtzm.js → table-dz2k55oab66h2vi9.js} +2 -2
- package/dist/chunks/{table-l64wm81r9t67mtzm.js.map → table-dz2k55oab66h2vi9.js.map} +1 -1
- package/dist/chunks/{tabs-ho9t1gkq22jb855l.js → tabs-kcw98wibdz4mhpkc.js} +2 -2
- package/dist/chunks/{tabs-ho9t1gkq22jb855l.js.map → tabs-kcw98wibdz4mhpkc.js.map} +1 -1
- package/dist/chunks/{toast-gewrapiiy5x9ak0o.js → toast-dkdo1lu72tnefya6.js} +7 -7
- package/dist/chunks/{toast-gewrapiiy5x9ak0o.js.map → toast-dkdo1lu72tnefya6.js.map} +1 -1
- package/dist/chunks/toolbar-o7xe6pd189evdd53.js +172 -0
- package/dist/chunks/toolbar-o7xe6pd189evdd53.js.map +1 -0
- package/dist/chunks/{tooltip-ken77ixya0qpidie.js → tooltip-eqnhjdbvwapy8gj4.js} +4 -4
- package/dist/chunks/{tooltip-ken77ixya0qpidie.js.map → tooltip-eqnhjdbvwapy8gj4.js.map} +1 -1
- package/dist/chunks/{vendor-base-ui-knphx7dts1vm1x37.js → vendor-base-ui-f9z44m829vvptrg0.js} +2209 -2207
- package/dist/chunks/{vendor-base-ui-knphx7dts1vm1x37.js.map → vendor-base-ui-f9z44m829vvptrg0.js.map} +1 -1
- package/dist/code.js +1 -1
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/chart.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/clipboard-text.js +1 -1
- package/dist/components/collapsible.js +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/command-palette.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/dropdown.js +1 -1
- package/dist/components/empty.js +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/input-group.js +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/label.js +1 -1
- package/dist/components/layer-card.js +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/menubar.js +1 -1
- package/dist/components/meter.js +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/sensitive-input.js +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/surface.js +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/toast.js +2 -2
- package/dist/components/toolbar.js +8 -0
- package/dist/components/toolbar.js.map +1 -0
- package/dist/components/tooltip.js +1 -1
- package/dist/index.js +199 -195
- package/dist/index.js.map +1 -1
- package/dist/primitives/accordion.js +1 -1
- package/dist/primitives/alert-dialog.js +1 -1
- package/dist/primitives/autocomplete.js +1 -1
- package/dist/primitives/avatar.js +1 -1
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/checkbox-group.js +1 -1
- package/dist/primitives/checkbox.js +1 -1
- package/dist/primitives/collapsible.js +1 -1
- package/dist/primitives/combobox.js +1 -1
- package/dist/primitives/context-menu.js +1 -1
- package/dist/primitives/csp-provider.js +1 -1
- package/dist/primitives/dialog.js +1 -1
- package/dist/primitives/direction-provider.js +1 -1
- package/dist/primitives/drawer.js +1 -1
- package/dist/primitives/field.js +1 -1
- package/dist/primitives/fieldset.js +1 -1
- package/dist/primitives/form.js +1 -1
- package/dist/primitives/input.js +1 -1
- package/dist/primitives/menu.js +1 -1
- package/dist/primitives/menubar.js +1 -1
- package/dist/primitives/meter.js +1 -1
- package/dist/primitives/navigation-menu.js +1 -1
- package/dist/primitives/number-field.js +1 -1
- package/dist/primitives/otp-field.js +1 -1
- package/dist/primitives/popover.js +1 -1
- package/dist/primitives/preview-card.js +1 -1
- package/dist/primitives/progress.js +1 -1
- package/dist/primitives/radio-group.js +1 -1
- package/dist/primitives/radio.js +1 -1
- package/dist/primitives/scroll-area.js +1 -1
- package/dist/primitives/select.js +1 -1
- package/dist/primitives/separator.js +1 -1
- package/dist/primitives/slider.js +1 -1
- package/dist/primitives/switch.js +1 -1
- package/dist/primitives/tabs.js +1 -1
- package/dist/primitives/toast.js +1 -1
- package/dist/primitives/toggle-group.js +1 -1
- package/dist/primitives/toggle.js +1 -1
- package/dist/primitives/toolbar.js +1 -1
- package/dist/primitives/tooltip.js +1 -1
- package/dist/primitives.js +1 -1
- package/dist/scripts/theme-generator/config.d.ts.map +1 -1
- package/dist/scripts/theme-generator/config.js +13 -2
- package/dist/scripts/theme-generator/config.js.map +1 -1
- package/dist/src/components/button/button.d.ts +2 -2
- package/dist/src/components/button/button.d.ts.map +1 -1
- package/dist/src/components/chart/EChart.d.ts +12 -4
- package/dist/src/components/chart/EChart.d.ts.map +1 -1
- package/dist/src/components/chart/Legend.d.ts +11 -2
- package/dist/src/components/chart/Legend.d.ts.map +1 -1
- package/dist/src/components/chart/TimeseriesChart.d.ts +15 -1
- package/dist/src/components/chart/TimeseriesChart.d.ts.map +1 -1
- package/dist/src/components/radio/index.d.ts +1 -1
- package/dist/src/components/radio/index.d.ts.map +1 -1
- package/dist/src/components/radio/radio.d.ts +49 -10
- package/dist/src/components/radio/radio.d.ts.map +1 -1
- package/dist/src/components/radio/radio.type-spec.d.ts +12 -0
- package/dist/src/components/radio/radio.type-spec.d.ts.map +1 -0
- package/dist/src/components/toolbar/index.d.ts +2 -0
- package/dist/src/components/toolbar/index.d.ts.map +1 -0
- package/dist/src/components/toolbar/toolbar.d.ts +50 -0
- package/dist/src/components/toolbar/toolbar.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/styles/kumo-standalone.css +1 -1
- package/dist/styles/theme-kumo.css +11 -4
- package/package.json +5 -1
- package/scripts/component-registry/discovery.ts +16 -11
- package/scripts/component-registry/metadata.ts +30 -0
- package/scripts/theme-generator/config.ts +14 -2
- package/dist/chunks/SankeyChart-i1m7zv0lys3j0iq6.js +0 -775
- package/dist/chunks/SankeyChart-i1m7zv0lys3j0iq6.js.map +0 -1
- package/dist/chunks/button-ov39dxshqbqrthhd.js +0 -210
- package/dist/chunks/button-ov39dxshqbqrthhd.js.map +0 -1
- package/dist/chunks/radio-gpg6kmzonr2cayq1.js +0 -218
- package/dist/chunks/radio-gpg6kmzonr2cayq1.js.map +0 -1
- package/dist/chunks/sidebar-dqw2uxx6xqln639l.js.map +0 -1
|
@@ -0,0 +1,890 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as d, jsxs as k, Fragment as we } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as he, useRef as A, useEffect as P, useCallback as be, useState as Ne, useMemo as ee, memo as $e } from "react";
|
|
4
|
+
import { W as Se, X as Fe, Y as Te, Z as Ie, _ as Re } from "./vendor-base-ui-f9z44m829vvptrg0.js";
|
|
5
|
+
import { c as B } from "./cn-ct4n7r74mh8y0f48.js";
|
|
6
|
+
var ye = /* @__PURE__ */ ((e) => (e.Attention = "#FC574A", e.Warning = "#F8A054", e.Success = "#00A63E", e.Neutral = "#B9D6FF", e.Disabled = "#CBCBCB", e.Skeleton = "#DDDDDD", e))(ye || {}), xe = /* @__PURE__ */ ((e) => (e.Attention = "#FC574A", e.Warning = "#F8A054", e.Success = "#00A63E", e.Neutral = "#8EC5FF", e.Disabled = "#878787", e.Skeleton = "#5C5C5C", e))(xe || {});
|
|
7
|
+
const Ae = {
|
|
8
|
+
blues: ["#E1EAF4", "#8EBCF6", "#4290F0", "#0E58B4", "#03254F"]
|
|
9
|
+
}, Ce = {
|
|
10
|
+
blues: ["#03254F", "#0E58B4", "#4290F0", "#A6BFDD", "#E1EAF4"]
|
|
11
|
+
}, le = [
|
|
12
|
+
"#4290F0",
|
|
13
|
+
"#F5B647",
|
|
14
|
+
"#E8649D",
|
|
15
|
+
"#8D58EE",
|
|
16
|
+
"#50C3B6",
|
|
17
|
+
"#D37536"
|
|
18
|
+
/* Orange */
|
|
19
|
+
], ie = [
|
|
20
|
+
"#4290F0",
|
|
21
|
+
"#EEB720",
|
|
22
|
+
"#E8649D",
|
|
23
|
+
"#8D58EE",
|
|
24
|
+
"#50C3B6",
|
|
25
|
+
"#D37536"
|
|
26
|
+
/* Orange */
|
|
27
|
+
];
|
|
28
|
+
var Y;
|
|
29
|
+
((e) => {
|
|
30
|
+
function n(o, s = !1) {
|
|
31
|
+
return s ? xe[o] : ye[o];
|
|
32
|
+
}
|
|
33
|
+
e.semantic = n;
|
|
34
|
+
function t(o, s = !1) {
|
|
35
|
+
return s ? ie[o % ie.length] : le[o % le.length];
|
|
36
|
+
}
|
|
37
|
+
e.categorical = t;
|
|
38
|
+
function a(o, s = !1) {
|
|
39
|
+
return s ? [...Ce[o]] : [...Ae[o]];
|
|
40
|
+
}
|
|
41
|
+
e.sequential = a;
|
|
42
|
+
function r(o, s = !1) {
|
|
43
|
+
const c = {
|
|
44
|
+
light: { primary: "#6B7280", secondary: "#9CA3AF" },
|
|
45
|
+
dark: { primary: "#9CA3AF", secondary: "#6B7280" }
|
|
46
|
+
};
|
|
47
|
+
return s ? c.dark[o] : c.light[o];
|
|
48
|
+
}
|
|
49
|
+
e.text = r;
|
|
50
|
+
})(Y || (Y = {}));
|
|
51
|
+
const me = (e) => {
|
|
52
|
+
const { dangerousHtmlFormatter: n, ...t } = e;
|
|
53
|
+
return {
|
|
54
|
+
...t,
|
|
55
|
+
formatter: n
|
|
56
|
+
};
|
|
57
|
+
}, Ee = ({
|
|
58
|
+
options: e,
|
|
59
|
+
isDarkMode: n
|
|
60
|
+
}) => {
|
|
61
|
+
const t = {
|
|
62
|
+
backgroundColor: "transparent",
|
|
63
|
+
color: n ? ie : le,
|
|
64
|
+
...e
|
|
65
|
+
};
|
|
66
|
+
return t.tooltip ? {
|
|
67
|
+
...t,
|
|
68
|
+
tooltip: Array.isArray(t.tooltip) ? t.tooltip.map(me) : me(t.tooltip)
|
|
69
|
+
} : t;
|
|
70
|
+
}, ce = he(function({
|
|
71
|
+
echarts: n,
|
|
72
|
+
options: t,
|
|
73
|
+
optionUpdateBehavior: a,
|
|
74
|
+
className: r,
|
|
75
|
+
isDarkMode: o,
|
|
76
|
+
height: s = 350,
|
|
77
|
+
onEvents: c
|
|
78
|
+
}, x) {
|
|
79
|
+
const b = A(null), v = A(null), D = A({}), T = A({}), I = A(/* @__PURE__ */ new Set());
|
|
80
|
+
return P(() => {
|
|
81
|
+
if (!b.current) return;
|
|
82
|
+
const f = n.init(b.current, o ? "dark" : void 0);
|
|
83
|
+
return v.current = f, typeof x == "function" ? x(f) : x && (x.current = f), () => {
|
|
84
|
+
for (const w of I.current) {
|
|
85
|
+
const u = T.current[w];
|
|
86
|
+
u && f.off(w, u);
|
|
87
|
+
}
|
|
88
|
+
I.current.clear(), typeof x == "function" ? x(null) : x && (x.current = null), v.current = null, f.dispose();
|
|
89
|
+
};
|
|
90
|
+
}, [b, o]), P(() => {
|
|
91
|
+
const f = v.current;
|
|
92
|
+
f && f.setOption(Ee({ options: t, isDarkMode: o }), {
|
|
93
|
+
notMerge: !1,
|
|
94
|
+
lazyUpdate: !0,
|
|
95
|
+
...a
|
|
96
|
+
});
|
|
97
|
+
}, [o, a, t]), P(() => {
|
|
98
|
+
D.current = c ?? {};
|
|
99
|
+
}, [c]), P(() => {
|
|
100
|
+
const f = v.current;
|
|
101
|
+
if (!f) return;
|
|
102
|
+
const w = /* @__PURE__ */ new Set();
|
|
103
|
+
for (const [u, N] of Object.entries(c ?? {}))
|
|
104
|
+
typeof N == "function" && (w.add(u), T.current[u] || (T.current[u] = (O) => {
|
|
105
|
+
D.current[u]?.(O);
|
|
106
|
+
}), I.current.has(u) || f.on(u, T.current[u]));
|
|
107
|
+
for (const u of I.current) {
|
|
108
|
+
if (w.has(u)) continue;
|
|
109
|
+
const N = T.current[u];
|
|
110
|
+
N && f.off(u, N);
|
|
111
|
+
}
|
|
112
|
+
I.current = w;
|
|
113
|
+
}, [n, o, c]), P(() => {
|
|
114
|
+
const f = v.current, w = b.current;
|
|
115
|
+
if (!f || !w) return;
|
|
116
|
+
let u = !0;
|
|
117
|
+
const N = new ResizeObserver(() => {
|
|
118
|
+
if (u) {
|
|
119
|
+
u = !1;
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
f.resize();
|
|
123
|
+
});
|
|
124
|
+
return N.observe(w), () => N.disconnect();
|
|
125
|
+
}, []), /* @__PURE__ */ d(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
ref: b,
|
|
129
|
+
className: B("w-full", r),
|
|
130
|
+
style: { height: s },
|
|
131
|
+
tabIndex: t.aria?.enabled ? 0 : void 0,
|
|
132
|
+
role: t.aria?.enabled ? "img" : void 0
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
});
|
|
136
|
+
ce.displayName = "Chart";
|
|
137
|
+
const Be = he(function({
|
|
138
|
+
echarts: n,
|
|
139
|
+
type: t = "line",
|
|
140
|
+
data: a,
|
|
141
|
+
xAxisName: r,
|
|
142
|
+
xAxisTickCount: o,
|
|
143
|
+
xAxisTickFormat: s,
|
|
144
|
+
yAxisTickFormat: c,
|
|
145
|
+
yAxisTickLabelFormat: x,
|
|
146
|
+
yAxisName: b,
|
|
147
|
+
yAxisTickCount: v,
|
|
148
|
+
tooltipValueFormat: D,
|
|
149
|
+
onTimeRangeChange: T,
|
|
150
|
+
height: I = 350,
|
|
151
|
+
incomplete: f,
|
|
152
|
+
enableLegendSelection: w = !1,
|
|
153
|
+
isDarkMode: u,
|
|
154
|
+
gradient: N,
|
|
155
|
+
loading: O,
|
|
156
|
+
ariaDescription: L,
|
|
157
|
+
optionUpdateBehavior: te,
|
|
158
|
+
tooltipMode: q = "all",
|
|
159
|
+
tooltipMaxItems: V = 10,
|
|
160
|
+
tooltipFollowCursor: ne = "both",
|
|
161
|
+
tooltipBoundary: Z
|
|
162
|
+
}, G) {
|
|
163
|
+
const h = A(null), $ = A(null), H = be(
|
|
164
|
+
(i) => {
|
|
165
|
+
h.current = i, typeof G == "function" ? G(i) : G && (G.current = i);
|
|
166
|
+
},
|
|
167
|
+
[G]
|
|
168
|
+
), C = A(a);
|
|
169
|
+
C.current = a;
|
|
170
|
+
const R = A(null);
|
|
171
|
+
P(() => {
|
|
172
|
+
R.current = null;
|
|
173
|
+
}, [w, u]);
|
|
174
|
+
const z = A(q);
|
|
175
|
+
z.current = q;
|
|
176
|
+
const l = A(V);
|
|
177
|
+
l.current = V;
|
|
178
|
+
const [m, S] = Ne(null), y = A({ x: 0, y: 0 });
|
|
179
|
+
P(() => {
|
|
180
|
+
const i = $.current;
|
|
181
|
+
if (!i) return;
|
|
182
|
+
const E = (p) => {
|
|
183
|
+
const F = i.getBoundingClientRect();
|
|
184
|
+
y.current = {
|
|
185
|
+
x: p.clientX - F.left,
|
|
186
|
+
y: p.clientY - F.top
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
return i.addEventListener("mousemove", E), () => i.removeEventListener("mousemove", E);
|
|
190
|
+
}, []);
|
|
191
|
+
const M = f?.before, K = f?.after, re = ee(() => {
|
|
192
|
+
const i = [], E = t === "bar" ? { type: "bar", stack: "total" } : { type: "line", showSymbol: !1 };
|
|
193
|
+
for (const p of a) {
|
|
194
|
+
const F = M && t === "line" ? p.data.filter((g) => g[0] <= M) : [], W = K && t === "line" ? p.data.filter((g) => g[0] >= K) : [], _ = F.length > 0 || W.length > 0 ? p.data.slice(
|
|
195
|
+
Math.max(0, F.length - 1),
|
|
196
|
+
Math.max(0, p.data.length - W.length + 1)
|
|
197
|
+
) : p.data, X = N && t === "line" ? {
|
|
198
|
+
color: new n.graphic.LinearGradient(0, 0, 0, 1, [
|
|
199
|
+
{ offset: 0, color: pe(p.color, 0.4) },
|
|
200
|
+
{ offset: 1, color: pe(p.color, 0) }
|
|
201
|
+
])
|
|
202
|
+
} : void 0;
|
|
203
|
+
i.push({
|
|
204
|
+
data: _,
|
|
205
|
+
color: p.color,
|
|
206
|
+
name: p.name,
|
|
207
|
+
emphasis: { focus: "series" },
|
|
208
|
+
...X ? { areaStyle: X } : {},
|
|
209
|
+
...E
|
|
210
|
+
});
|
|
211
|
+
const U = {
|
|
212
|
+
color: p.color,
|
|
213
|
+
name: p.name,
|
|
214
|
+
type: "line",
|
|
215
|
+
lineStyle: { type: "dashed" },
|
|
216
|
+
showSymbol: !1,
|
|
217
|
+
emphasis: { focus: "series" }
|
|
218
|
+
};
|
|
219
|
+
F.length > 0 && i.push({
|
|
220
|
+
...U,
|
|
221
|
+
data: F
|
|
222
|
+
}), W.length > 0 && i.push({
|
|
223
|
+
...U,
|
|
224
|
+
data: W
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
return {
|
|
228
|
+
aria: {
|
|
229
|
+
enabled: !0,
|
|
230
|
+
...L && { label: { description: L } }
|
|
231
|
+
},
|
|
232
|
+
brush: {
|
|
233
|
+
xAxisIndex: "all",
|
|
234
|
+
brushType: "lineX",
|
|
235
|
+
brushMode: "single",
|
|
236
|
+
outOfBrush: {
|
|
237
|
+
colorAlpha: 0.3
|
|
238
|
+
},
|
|
239
|
+
brushStyle: {
|
|
240
|
+
borderWidth: 1,
|
|
241
|
+
color: "rgba(120,140,180,0.3)",
|
|
242
|
+
borderColor: "rgba(120,140,180,0.8)"
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
tooltip: {
|
|
246
|
+
trigger: "axis",
|
|
247
|
+
showContent: !1,
|
|
248
|
+
axisPointer: { type: "shadow" }
|
|
249
|
+
},
|
|
250
|
+
backgroundColor: "transparent",
|
|
251
|
+
toolbox: { show: !1 },
|
|
252
|
+
...w ? { legend: { show: !1 } } : {},
|
|
253
|
+
xAxis: {
|
|
254
|
+
name: r,
|
|
255
|
+
nameLocation: "middle",
|
|
256
|
+
nameGap: 30,
|
|
257
|
+
type: "time",
|
|
258
|
+
splitLine: {
|
|
259
|
+
show: !1
|
|
260
|
+
},
|
|
261
|
+
axisLine: { show: !1 },
|
|
262
|
+
splitNumber: o ?? 5,
|
|
263
|
+
...s && {
|
|
264
|
+
axisLabel: {
|
|
265
|
+
formatter: (p) => s(p)
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
yAxis: {
|
|
270
|
+
name: b,
|
|
271
|
+
nameLocation: "middle",
|
|
272
|
+
nameGap: 40,
|
|
273
|
+
type: "value",
|
|
274
|
+
axisTick: { show: !0 },
|
|
275
|
+
axisLabel: {
|
|
276
|
+
margin: 15,
|
|
277
|
+
...c && {
|
|
278
|
+
formatter: (p) => c(p)
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
splitLine: {
|
|
282
|
+
show: !0,
|
|
283
|
+
lineStyle: { type: "dashed", width: 1 }
|
|
284
|
+
},
|
|
285
|
+
splitNumber: v
|
|
286
|
+
},
|
|
287
|
+
grid: {
|
|
288
|
+
left: b ? 30 : 24,
|
|
289
|
+
right: 24,
|
|
290
|
+
top: 24,
|
|
291
|
+
bottom: r ? 30 : 24
|
|
292
|
+
},
|
|
293
|
+
series: i
|
|
294
|
+
};
|
|
295
|
+
}, [
|
|
296
|
+
a,
|
|
297
|
+
r,
|
|
298
|
+
o,
|
|
299
|
+
s,
|
|
300
|
+
c,
|
|
301
|
+
b,
|
|
302
|
+
v,
|
|
303
|
+
M,
|
|
304
|
+
K,
|
|
305
|
+
t,
|
|
306
|
+
N,
|
|
307
|
+
w,
|
|
308
|
+
n,
|
|
309
|
+
L
|
|
310
|
+
]), oe = ee(() => ({
|
|
311
|
+
updateaxispointer: (i) => {
|
|
312
|
+
const E = i?.axesInfo?.[0]?.value;
|
|
313
|
+
if (E == null) return;
|
|
314
|
+
const p = /* @__PURE__ */ new Set(), F = [], W = R.current;
|
|
315
|
+
for (const g of C.current) {
|
|
316
|
+
if (p.has(g.name) || W && W[g.name] === !1) continue;
|
|
317
|
+
p.add(g.name);
|
|
318
|
+
const j = De(g.data, E);
|
|
319
|
+
j != null && F.push({ name: g.name, value: j, color: g.color });
|
|
320
|
+
}
|
|
321
|
+
F.sort((g, j) => j.value - g.value);
|
|
322
|
+
let _, X = 0;
|
|
323
|
+
if (z.current === "single") {
|
|
324
|
+
const g = h.current, j = g ? g.convertFromPixel("grid", [0, y.current.y])?.[1] : null;
|
|
325
|
+
j != null && F.length > 0 ? _ = [F.reduce(
|
|
326
|
+
(de, fe) => Math.abs(fe.value - j) < Math.abs(de.value - j) ? fe : de
|
|
327
|
+
)] : _ = F.slice(0, 1);
|
|
328
|
+
} else {
|
|
329
|
+
const g = l.current;
|
|
330
|
+
_ = F.slice(0, g), X = Math.max(0, F.length - g);
|
|
331
|
+
}
|
|
332
|
+
const U = { ts: E, rows: _, hiddenCount: X };
|
|
333
|
+
S((g) => Oe(g, U) ? g : U);
|
|
334
|
+
},
|
|
335
|
+
globalout: () => {
|
|
336
|
+
S(null);
|
|
337
|
+
},
|
|
338
|
+
// Keep the tooltip in sync with legend selection. Each action fires a
|
|
339
|
+
// different event — `legendToggleSelect` → `legendselectchanged`,
|
|
340
|
+
// `legendSelect` → `legendselected`, `legendUnSelect` → `legendunselected`
|
|
341
|
+
// — and all three carry the full `selected` map, so we listen to all of
|
|
342
|
+
// them (params type inferred from `ChartEvents`).
|
|
343
|
+
legendselectchanged: (i) => {
|
|
344
|
+
R.current = i.selected;
|
|
345
|
+
},
|
|
346
|
+
legendselected: (i) => {
|
|
347
|
+
R.current = i.selected;
|
|
348
|
+
},
|
|
349
|
+
legendunselected: (i) => {
|
|
350
|
+
R.current = i.selected;
|
|
351
|
+
},
|
|
352
|
+
...T && {
|
|
353
|
+
brushend: (i) => {
|
|
354
|
+
const E = i.areas[0].coordRange;
|
|
355
|
+
T(E[0], E[1]), h.current?.dispatchAction({ type: "brush", areas: [] });
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}), [T]), J = !!T;
|
|
359
|
+
P(() => {
|
|
360
|
+
const i = h.current;
|
|
361
|
+
if (i && J)
|
|
362
|
+
return i.dispatchAction({
|
|
363
|
+
type: "takeGlobalCursor",
|
|
364
|
+
key: "brush",
|
|
365
|
+
brushOption: {
|
|
366
|
+
brushType: "lineX",
|
|
367
|
+
brushMode: "single"
|
|
368
|
+
}
|
|
369
|
+
}), () => {
|
|
370
|
+
i.dispatchAction({
|
|
371
|
+
type: "takeGlobalCursor",
|
|
372
|
+
key: "brush",
|
|
373
|
+
brushOption: {
|
|
374
|
+
brushType: !1
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
}, [h, J, O]);
|
|
379
|
+
const se = D ?? x, ue = m !== null;
|
|
380
|
+
return /* @__PURE__ */ k(
|
|
381
|
+
Se,
|
|
382
|
+
{
|
|
383
|
+
open: ue,
|
|
384
|
+
trackCursorAxis: ne,
|
|
385
|
+
children: [
|
|
386
|
+
/* @__PURE__ */ k(
|
|
387
|
+
Fe,
|
|
388
|
+
{
|
|
389
|
+
render: /* @__PURE__ */ d(
|
|
390
|
+
"div",
|
|
391
|
+
{
|
|
392
|
+
ref: $,
|
|
393
|
+
className: "relative w-full",
|
|
394
|
+
style: { height: I }
|
|
395
|
+
}
|
|
396
|
+
),
|
|
397
|
+
children: [
|
|
398
|
+
O && /* @__PURE__ */ d(Me, { height: I, isDarkMode: u }),
|
|
399
|
+
!O && /* @__PURE__ */ d(
|
|
400
|
+
ce,
|
|
401
|
+
{
|
|
402
|
+
echarts: n,
|
|
403
|
+
ref: H,
|
|
404
|
+
options: re,
|
|
405
|
+
height: I,
|
|
406
|
+
isDarkMode: u,
|
|
407
|
+
onEvents: oe,
|
|
408
|
+
optionUpdateBehavior: te
|
|
409
|
+
}
|
|
410
|
+
)
|
|
411
|
+
]
|
|
412
|
+
}
|
|
413
|
+
),
|
|
414
|
+
ue && /* @__PURE__ */ d(Te, { children: /* @__PURE__ */ d(
|
|
415
|
+
Ie,
|
|
416
|
+
{
|
|
417
|
+
side: "right",
|
|
418
|
+
align: "start",
|
|
419
|
+
sideOffset: 12,
|
|
420
|
+
collisionAvoidance: { side: "flip", align: "shift" },
|
|
421
|
+
collisionBoundary: Z,
|
|
422
|
+
collisionPadding: 8,
|
|
423
|
+
children: /* @__PURE__ */ d(
|
|
424
|
+
Re,
|
|
425
|
+
{
|
|
426
|
+
"data-mode": u ? "dark" : "light",
|
|
427
|
+
className: "bg-kumo-base rounded-lg shadow-lg shadow-kumo-tip-shadow outline outline-1 outline-kumo-fill p-2 min-w-[150px] max-w-xs",
|
|
428
|
+
children: /* @__PURE__ */ d(ke, { state: m, formatValue: se })
|
|
429
|
+
}
|
|
430
|
+
)
|
|
431
|
+
}
|
|
432
|
+
) })
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
});
|
|
437
|
+
Be.displayName = "TimeseriesChart";
|
|
438
|
+
const ke = $e(function({
|
|
439
|
+
state: n,
|
|
440
|
+
formatValue: t
|
|
441
|
+
}) {
|
|
442
|
+
const { ts: a, rows: r, hiddenCount: o } = n;
|
|
443
|
+
return /* @__PURE__ */ k(we, { children: [
|
|
444
|
+
/* @__PURE__ */ d("div", { className: "text-xs font-semibold text-kumo-default mb-1", children: Pe(a) }),
|
|
445
|
+
r.map((s) => /* @__PURE__ */ k(
|
|
446
|
+
"div",
|
|
447
|
+
{
|
|
448
|
+
className: "flex items-center justify-between gap-4 py-0.5",
|
|
449
|
+
children: [
|
|
450
|
+
/* @__PURE__ */ k("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
451
|
+
/* @__PURE__ */ d(
|
|
452
|
+
"span",
|
|
453
|
+
{
|
|
454
|
+
className: "w-3 h-3 rounded-full shrink-0",
|
|
455
|
+
style: { backgroundColor: s.color }
|
|
456
|
+
}
|
|
457
|
+
),
|
|
458
|
+
/* @__PURE__ */ d(
|
|
459
|
+
"span",
|
|
460
|
+
{
|
|
461
|
+
className: "text-xs font-medium text-kumo-default truncate",
|
|
462
|
+
title: s.name,
|
|
463
|
+
children: s.name
|
|
464
|
+
}
|
|
465
|
+
)
|
|
466
|
+
] }),
|
|
467
|
+
/* @__PURE__ */ d("span", { className: "text-xs font-semibold text-kumo-default shrink-0", children: t ? t(s.value) : ze(s.value) })
|
|
468
|
+
]
|
|
469
|
+
},
|
|
470
|
+
s.name
|
|
471
|
+
)),
|
|
472
|
+
o > 0 && /* @__PURE__ */ k("div", { className: "text-xs text-kumo-subtle mt-1", children: [
|
|
473
|
+
"+",
|
|
474
|
+
o,
|
|
475
|
+
" more"
|
|
476
|
+
] })
|
|
477
|
+
] });
|
|
478
|
+
});
|
|
479
|
+
function De(e, n) {
|
|
480
|
+
if (e.length === 0) return null;
|
|
481
|
+
let t = 0, a = e.length - 1;
|
|
482
|
+
for (; t < a; ) {
|
|
483
|
+
const r = t + a >> 1;
|
|
484
|
+
e[r][0] < n ? t = r + 1 : a = r;
|
|
485
|
+
}
|
|
486
|
+
return t > 0 && Math.abs(e[t - 1][0] - n) < Math.abs(e[t][0] - n) && t--, e[t][1];
|
|
487
|
+
}
|
|
488
|
+
function Oe(e, n) {
|
|
489
|
+
return !e || e.ts !== n.ts || e.hiddenCount !== n.hiddenCount || e.rows.length !== n.rows.length ? !1 : e.rows.every((t, a) => {
|
|
490
|
+
const r = n.rows[a];
|
|
491
|
+
return t.name === r.name && t.value === r.value && t.color === r.color;
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
const Le = new Intl.NumberFormat(void 0, {
|
|
495
|
+
maximumFractionDigits: 3
|
|
496
|
+
});
|
|
497
|
+
function ze(e) {
|
|
498
|
+
return Number.isInteger(e) ? String(e) : Le.format(e);
|
|
499
|
+
}
|
|
500
|
+
function Me({
|
|
501
|
+
height: e,
|
|
502
|
+
isDarkMode: n
|
|
503
|
+
}) {
|
|
504
|
+
const t = e / 2, a = Math.min(e * 0.12, 28), r = 400, o = 120, s = [];
|
|
505
|
+
for (let b = 0; b <= o; b++) {
|
|
506
|
+
const v = -r + b / o * r * 3, D = t + Math.sin(b / o * 2 * Math.PI * 3) * a;
|
|
507
|
+
s.push(`${b === 0 ? "M" : "L"}${v.toFixed(2)},${D.toFixed(2)}`);
|
|
508
|
+
}
|
|
509
|
+
const c = s.join(" "), x = n ? "rgba(255,255,255,0.5)" : "rgba(0,0,0,0.2)";
|
|
510
|
+
return /* @__PURE__ */ d(
|
|
511
|
+
"div",
|
|
512
|
+
{
|
|
513
|
+
"aria-hidden": "true",
|
|
514
|
+
className: "absolute inset-0 overflow-hidden",
|
|
515
|
+
style: { height: e },
|
|
516
|
+
children: /* @__PURE__ */ d(
|
|
517
|
+
"svg",
|
|
518
|
+
{
|
|
519
|
+
width: "100%",
|
|
520
|
+
height: e,
|
|
521
|
+
viewBox: `0 0 ${r} ${e}`,
|
|
522
|
+
preserveAspectRatio: "none",
|
|
523
|
+
className: "w-full animate-pulse",
|
|
524
|
+
children: /* @__PURE__ */ d(
|
|
525
|
+
"path",
|
|
526
|
+
{
|
|
527
|
+
d: c,
|
|
528
|
+
fill: "none",
|
|
529
|
+
stroke: x,
|
|
530
|
+
strokeWidth: "2",
|
|
531
|
+
style: {
|
|
532
|
+
animation: "kumo-chart-wave 2.4s linear infinite",
|
|
533
|
+
transformOrigin: "0 0"
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
)
|
|
537
|
+
}
|
|
538
|
+
)
|
|
539
|
+
}
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
function pe(e, n) {
|
|
543
|
+
const t = Math.max(0, Math.min(1, n)), a = e.match(
|
|
544
|
+
/rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i
|
|
545
|
+
);
|
|
546
|
+
if (a)
|
|
547
|
+
return `rgba(${a[1]}, ${a[2]}, ${a[3]}, ${t})`;
|
|
548
|
+
let r = e.replace(/^#/, "");
|
|
549
|
+
r.length === 3 && (r = r[0] + r[0] + r[1] + r[1] + r[2] + r[2]), r.length === 8 && (r = r.slice(0, 6));
|
|
550
|
+
const o = parseInt(r.slice(0, 2), 16), s = parseInt(r.slice(2, 4), 16), c = parseInt(r.slice(4, 6), 16);
|
|
551
|
+
return `rgba(${o}, ${s}, ${c}, ${t})`;
|
|
552
|
+
}
|
|
553
|
+
const je = new Intl.DateTimeFormat(void 0, {
|
|
554
|
+
month: "short",
|
|
555
|
+
day: "numeric",
|
|
556
|
+
hour: "2-digit",
|
|
557
|
+
minute: "2-digit",
|
|
558
|
+
second: "2-digit",
|
|
559
|
+
hour12: !1
|
|
560
|
+
});
|
|
561
|
+
function Pe(e) {
|
|
562
|
+
return je.format(new Date(e));
|
|
563
|
+
}
|
|
564
|
+
const ve = (e) => {
|
|
565
|
+
e.key !== "Enter" && e.key !== " " || (e.preventDefault(), e.currentTarget.click());
|
|
566
|
+
};
|
|
567
|
+
function Ge({
|
|
568
|
+
color: e,
|
|
569
|
+
value: n,
|
|
570
|
+
name: t,
|
|
571
|
+
unit: a,
|
|
572
|
+
inactive: r,
|
|
573
|
+
onPointerEnter: o,
|
|
574
|
+
onPointerLeave: s,
|
|
575
|
+
onClick: c,
|
|
576
|
+
className: x
|
|
577
|
+
}) {
|
|
578
|
+
return /* @__PURE__ */ k(
|
|
579
|
+
"div",
|
|
580
|
+
{
|
|
581
|
+
role: "button",
|
|
582
|
+
tabIndex: c ? 0 : -1,
|
|
583
|
+
className: B(
|
|
584
|
+
"inline-flex flex-col gap-2 min-w-42 py-2",
|
|
585
|
+
{ "cursor-pointer": !!c },
|
|
586
|
+
x
|
|
587
|
+
),
|
|
588
|
+
onPointerEnter: o,
|
|
589
|
+
onPointerLeave: s,
|
|
590
|
+
onClick: c,
|
|
591
|
+
onKeyDown: c ? ve : void 0,
|
|
592
|
+
children: [
|
|
593
|
+
/* @__PURE__ */ k("div", { className: "flex items-center gap-2", children: [
|
|
594
|
+
/* @__PURE__ */ d(
|
|
595
|
+
"span",
|
|
596
|
+
{
|
|
597
|
+
className: B("size-2 rounded-full inline-block", {
|
|
598
|
+
"opacity-50": r
|
|
599
|
+
}),
|
|
600
|
+
style: { backgroundColor: e }
|
|
601
|
+
}
|
|
602
|
+
),
|
|
603
|
+
/* @__PURE__ */ d("span", { className: B("text-xs", { "opacity-50": r }), children: t })
|
|
604
|
+
] }),
|
|
605
|
+
/* @__PURE__ */ k("div", { className: "flex items-baseline gap-0.5", children: [
|
|
606
|
+
/* @__PURE__ */ d(
|
|
607
|
+
"span",
|
|
608
|
+
{
|
|
609
|
+
className: B("text-lg font-medium leading-none", {
|
|
610
|
+
"opacity-50": r
|
|
611
|
+
}),
|
|
612
|
+
children: n
|
|
613
|
+
}
|
|
614
|
+
),
|
|
615
|
+
a && /* @__PURE__ */ d(
|
|
616
|
+
"span",
|
|
617
|
+
{
|
|
618
|
+
className: B("text-xs text-kumo-subtle leading-none", {
|
|
619
|
+
"opacity-50": r
|
|
620
|
+
}),
|
|
621
|
+
children: a
|
|
622
|
+
}
|
|
623
|
+
)
|
|
624
|
+
] })
|
|
625
|
+
]
|
|
626
|
+
}
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
function He({
|
|
630
|
+
color: e,
|
|
631
|
+
value: n,
|
|
632
|
+
name: t,
|
|
633
|
+
inactive: a,
|
|
634
|
+
onPointerEnter: r,
|
|
635
|
+
onPointerLeave: o,
|
|
636
|
+
onClick: s,
|
|
637
|
+
className: c
|
|
638
|
+
}) {
|
|
639
|
+
return /* @__PURE__ */ k(
|
|
640
|
+
"div",
|
|
641
|
+
{
|
|
642
|
+
role: "button",
|
|
643
|
+
tabIndex: s ? 0 : -1,
|
|
644
|
+
className: B(
|
|
645
|
+
"inline-flex items-center gap-2",
|
|
646
|
+
{ "cursor-pointer": !!s },
|
|
647
|
+
c
|
|
648
|
+
),
|
|
649
|
+
onPointerEnter: r,
|
|
650
|
+
onPointerLeave: o,
|
|
651
|
+
onClick: s,
|
|
652
|
+
onKeyDown: s ? ve : void 0,
|
|
653
|
+
children: [
|
|
654
|
+
/* @__PURE__ */ d(
|
|
655
|
+
"span",
|
|
656
|
+
{
|
|
657
|
+
className: B("size-2 rounded-full inline-block", {
|
|
658
|
+
"opacity-50": a
|
|
659
|
+
}),
|
|
660
|
+
style: { backgroundColor: e }
|
|
661
|
+
}
|
|
662
|
+
),
|
|
663
|
+
/* @__PURE__ */ d("span", { className: B("text-xs", { "opacity-50": a }), children: t }),
|
|
664
|
+
/* @__PURE__ */ d("span", { className: B("text-xs font-medium", { "opacity-50": a }), children: n })
|
|
665
|
+
]
|
|
666
|
+
}
|
|
667
|
+
);
|
|
668
|
+
}
|
|
669
|
+
const Ze = {
|
|
670
|
+
SmallItem: He,
|
|
671
|
+
LargeItem: Ge
|
|
672
|
+
}, We = (e) => e.toLocaleString();
|
|
673
|
+
function qe(e) {
|
|
674
|
+
return typeof e == "object" && e !== null;
|
|
675
|
+
}
|
|
676
|
+
const Q = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), ge = (e) => e.replace(/[{}|]/g, (n) => `\\${n}`), ae = (e) => {
|
|
677
|
+
const n = "#666";
|
|
678
|
+
return !e || typeof e != "string" ? n : /^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e) || /^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*[\d.]+\s*)?\)$/i.test(
|
|
679
|
+
e
|
|
680
|
+
) || /^hsla?\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*[\d.]+\s*)?\)$/i.test(
|
|
681
|
+
e
|
|
682
|
+
) || /^[a-z]{3,20}$/i.test(e) ? e : n;
|
|
683
|
+
};
|
|
684
|
+
function Ve({
|
|
685
|
+
echarts: e,
|
|
686
|
+
nodes: n,
|
|
687
|
+
links: t,
|
|
688
|
+
height: a = 400,
|
|
689
|
+
nodeWidth: r = 8,
|
|
690
|
+
nodePadding: o = 10,
|
|
691
|
+
showTooltip: s = !0,
|
|
692
|
+
showNodeValues: c,
|
|
693
|
+
nodeLabelLayout: x = "stacked",
|
|
694
|
+
formatValue: b = We,
|
|
695
|
+
tooltipFormatter: v,
|
|
696
|
+
defaultNodeColor: D,
|
|
697
|
+
left: T,
|
|
698
|
+
right: I,
|
|
699
|
+
linkColor: f = "gradient",
|
|
700
|
+
linkOpacity: w = 0.5,
|
|
701
|
+
className: u,
|
|
702
|
+
isDarkMode: N,
|
|
703
|
+
onNodeClick: O,
|
|
704
|
+
onLinkClick: L
|
|
705
|
+
}) {
|
|
706
|
+
const te = n.some((h) => h.value !== void 0), q = c ?? te, V = x === "inline", ne = ee(() => {
|
|
707
|
+
const h = Y.text("primary", N), $ = Y.text("secondary", N), H = n.map(
|
|
708
|
+
(l, m) => l.color ?? D ?? Y.categorical(m, N)
|
|
709
|
+
), C = new Map(
|
|
710
|
+
n.map((l, m) => [l.name, { ...l, computedColor: H[m] }])
|
|
711
|
+
), R = n.map((l, m) => ({
|
|
712
|
+
name: l.name,
|
|
713
|
+
value: l.value,
|
|
714
|
+
itemStyle: {
|
|
715
|
+
color: H[m]
|
|
716
|
+
}
|
|
717
|
+
})), z = t.map((l) => ({
|
|
718
|
+
source: n[l.source]?.name ?? "",
|
|
719
|
+
target: n[l.target]?.name ?? "",
|
|
720
|
+
value: l.value
|
|
721
|
+
}));
|
|
722
|
+
return {
|
|
723
|
+
backgroundColor: "transparent",
|
|
724
|
+
animation: !0,
|
|
725
|
+
animationDuration: 500,
|
|
726
|
+
animationDurationUpdate: 300,
|
|
727
|
+
animationEasingUpdate: "cubicInOut",
|
|
728
|
+
tooltip: s ? {
|
|
729
|
+
trigger: "item",
|
|
730
|
+
triggerOn: "mousemove",
|
|
731
|
+
dangerousHtmlFormatter: (l) => {
|
|
732
|
+
if (!qe(l)) return "";
|
|
733
|
+
if (l.dataType === "node" && l.name) {
|
|
734
|
+
const m = C.get(l.name), S = ae(
|
|
735
|
+
m?.computedColor ?? l.color ?? "#666"
|
|
736
|
+
);
|
|
737
|
+
if (v)
|
|
738
|
+
return v({
|
|
739
|
+
type: "node",
|
|
740
|
+
name: l.name,
|
|
741
|
+
node: m,
|
|
742
|
+
color: S
|
|
743
|
+
});
|
|
744
|
+
const y = Q(l.name);
|
|
745
|
+
return `<div style="display:flex;align-items:center;gap:6px;"><span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${S}"></span><strong>${y}</strong></div>`;
|
|
746
|
+
}
|
|
747
|
+
if (l.dataType === "edge" && l.data) {
|
|
748
|
+
const { source: m, target: S, value: y } = l.data;
|
|
749
|
+
if (v)
|
|
750
|
+
return v({
|
|
751
|
+
type: "link",
|
|
752
|
+
name: `${m} → ${S}`,
|
|
753
|
+
link: {
|
|
754
|
+
source: m ?? "",
|
|
755
|
+
target: S ?? "",
|
|
756
|
+
value: y ?? 0
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
const M = C.get(m ?? ""), K = C.get(S ?? ""), re = ae(
|
|
760
|
+
M?.computedColor ?? "#666"
|
|
761
|
+
), oe = ae(
|
|
762
|
+
K?.computedColor ?? "#666"
|
|
763
|
+
), J = Q(m ?? ""), se = Q(S ?? "");
|
|
764
|
+
return `<div style="display:flex;align-items:center;gap:6px;margin-bottom:4px;">
|
|
765
|
+
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${re}"></span>
|
|
766
|
+
<strong>${J}</strong>
|
|
767
|
+
<span style="color:${$}">→</span>
|
|
768
|
+
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${oe}"></span>
|
|
769
|
+
<strong>${se}</strong>
|
|
770
|
+
</div>
|
|
771
|
+
<strong>${y !== void 0 ? Q(b(y)) : ""}</strong>`;
|
|
772
|
+
}
|
|
773
|
+
return "";
|
|
774
|
+
}
|
|
775
|
+
} : void 0,
|
|
776
|
+
series: [
|
|
777
|
+
{
|
|
778
|
+
type: "sankey",
|
|
779
|
+
...T !== void 0 && { left: T },
|
|
780
|
+
...I !== void 0 && { right: I },
|
|
781
|
+
data: R,
|
|
782
|
+
links: z,
|
|
783
|
+
draggable: !1,
|
|
784
|
+
emphasis: {
|
|
785
|
+
focus: "adjacency"
|
|
786
|
+
},
|
|
787
|
+
nodeWidth: r,
|
|
788
|
+
nodeGap: o,
|
|
789
|
+
lineStyle: {
|
|
790
|
+
color: f === "gradient" ? "source" : "#d1d5db",
|
|
791
|
+
opacity: f === "gradient" ? w : 0.4,
|
|
792
|
+
curveness: 0.5
|
|
793
|
+
},
|
|
794
|
+
label: {
|
|
795
|
+
show: !0,
|
|
796
|
+
color: h,
|
|
797
|
+
fontSize: 12,
|
|
798
|
+
formatter: q ? (l) => {
|
|
799
|
+
const m = l.name ?? "", S = C.get(m), y = ge(m);
|
|
800
|
+
if (S?.value !== void 0) {
|
|
801
|
+
const M = ge(
|
|
802
|
+
b(S.value)
|
|
803
|
+
);
|
|
804
|
+
return V ? `{name|${y}} {value|${M}}` : `{value|${M}}
|
|
805
|
+
{name|${y}}`;
|
|
806
|
+
}
|
|
807
|
+
return y;
|
|
808
|
+
} : void 0,
|
|
809
|
+
rich: q ? {
|
|
810
|
+
value: {
|
|
811
|
+
fontSize: 11,
|
|
812
|
+
color: h,
|
|
813
|
+
lineHeight: V ? void 0 : 16
|
|
814
|
+
},
|
|
815
|
+
name: {
|
|
816
|
+
fontSize: 12,
|
|
817
|
+
color: h,
|
|
818
|
+
fontWeight: 700
|
|
819
|
+
}
|
|
820
|
+
} : void 0
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
]
|
|
824
|
+
};
|
|
825
|
+
}, [
|
|
826
|
+
n,
|
|
827
|
+
t,
|
|
828
|
+
s,
|
|
829
|
+
r,
|
|
830
|
+
o,
|
|
831
|
+
D,
|
|
832
|
+
T,
|
|
833
|
+
I,
|
|
834
|
+
N,
|
|
835
|
+
f,
|
|
836
|
+
w,
|
|
837
|
+
q,
|
|
838
|
+
V,
|
|
839
|
+
b,
|
|
840
|
+
v
|
|
841
|
+
]), Z = be(
|
|
842
|
+
(h) => {
|
|
843
|
+
if (h.dataType === "node" && O && h.name) {
|
|
844
|
+
const $ = n.findIndex((R) => R.name === h.name), C = {
|
|
845
|
+
...$ >= 0 ? n[$] : null,
|
|
846
|
+
name: h.name
|
|
847
|
+
};
|
|
848
|
+
O(C);
|
|
849
|
+
} else if (h.dataType === "edge" && L && h.data) {
|
|
850
|
+
const $ = h.data, H = typeof $ == "object" && $ !== null && "source" in $ ? String($.source) : "", C = typeof $ == "object" && $ !== null && "target" in $ ? String($.target) : "", R = n.findIndex((y) => y.name === H), z = n.findIndex((y) => y.name === C);
|
|
851
|
+
if (R === -1 || z === -1) return;
|
|
852
|
+
const l = h.value, m = typeof l == "number" ? l : Array.isArray(l) && typeof l[0] == "number" ? l[0] : 0, S = t.find(
|
|
853
|
+
(y) => y.source === R && y.target === z
|
|
854
|
+
);
|
|
855
|
+
L({
|
|
856
|
+
...S,
|
|
857
|
+
source: R,
|
|
858
|
+
target: z,
|
|
859
|
+
value: m
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
},
|
|
863
|
+
[n, t, O, L]
|
|
864
|
+
), G = ee(
|
|
865
|
+
() => ({
|
|
866
|
+
click: Z
|
|
867
|
+
}),
|
|
868
|
+
[Z]
|
|
869
|
+
);
|
|
870
|
+
return /* @__PURE__ */ d(
|
|
871
|
+
ce,
|
|
872
|
+
{
|
|
873
|
+
echarts: e,
|
|
874
|
+
options: ne,
|
|
875
|
+
className: u,
|
|
876
|
+
isDarkMode: N,
|
|
877
|
+
height: a,
|
|
878
|
+
onEvents: G
|
|
879
|
+
}
|
|
880
|
+
);
|
|
881
|
+
}
|
|
882
|
+
Ve.displayName = "SankeyChart";
|
|
883
|
+
export {
|
|
884
|
+
ce as C,
|
|
885
|
+
Ve as S,
|
|
886
|
+
Be as T,
|
|
887
|
+
Ze as a,
|
|
888
|
+
Y as b
|
|
889
|
+
};
|
|
890
|
+
//# sourceMappingURL=SankeyChart-g1tng405ml2e0qg2.js.map
|