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