@ac-design/design-system 2.6.0 → 2.7.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 (52) hide show
  1. package/dist/lib/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +2 -2
  2. package/dist/lib/charts/graph.d.ts +9 -15
  3. package/dist/lib/charts/graph.js +79 -75
  4. package/dist/lib/charts/index.d.ts +4 -2
  5. package/dist/lib/charts/index.js +2 -1
  6. package/dist/lib/charts/nodeSymbol.d.ts +15 -0
  7. package/dist/lib/charts/nodeSymbol.js +27 -0
  8. package/dist/lib/charts/tree.d.ts +15 -0
  9. package/dist/lib/charts/tree.js +89 -0
  10. package/dist/lib/compat.css +119 -0
  11. package/dist/lib/components/AcAccordionItem.vue.d.ts +3 -1
  12. package/dist/lib/components/AcAccordionItem.vue_vue_type_script_setup_true_lang.js +35 -26
  13. package/dist/lib/components/AcAlert.vue.d.ts +1 -1
  14. package/dist/lib/components/AcBadge.vue.d.ts +1 -1
  15. package/dist/lib/components/AcBanner.vue.d.ts +1 -1
  16. package/dist/lib/components/AcCard.vue.d.ts +1 -1
  17. package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +2 -2
  18. package/dist/lib/components/AcCellValue.vue.d.ts +1 -1
  19. package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +3 -3
  20. package/dist/lib/components/AcCheckList.vue.d.ts +1 -1
  21. package/dist/lib/components/AcConfirmModal.vue.d.ts +1 -1
  22. package/dist/lib/components/AcDropdownItem.vue.d.ts +1 -1
  23. package/dist/lib/components/AcFeatureCard.vue.d.ts +1 -1
  24. package/dist/lib/components/AcGraphChart.vue.d.ts +53 -3
  25. package/dist/lib/components/AcGraphChart.vue_vue_type_script_setup_true_lang.js +401 -233
  26. package/dist/lib/components/AcList.js +5 -0
  27. package/dist/lib/components/AcList.vue.d.ts +56 -0
  28. package/dist/lib/components/AcList.vue_vue_type_script_setup_true_lang.js +74 -0
  29. package/dist/lib/components/AcListItem.js +5 -0
  30. package/dist/lib/components/AcListItem.vue.d.ts +53 -0
  31. package/dist/lib/components/AcListItem.vue_vue_type_script_setup_true_lang.js +105 -0
  32. package/dist/lib/components/AcMapChart.vue.d.ts +66 -3
  33. package/dist/lib/components/AcMapChart.vue_vue_type_script_setup_true_lang.js +403 -201
  34. package/dist/lib/components/AcMonthPicker.js +5 -0
  35. package/dist/lib/components/AcMonthPicker.vue.d.ts +102 -0
  36. package/dist/lib/components/AcMonthPicker.vue_vue_type_script_setup_true_lang.js +595 -0
  37. package/dist/lib/components/AcNavbarItem.vue.d.ts +1 -1
  38. package/dist/lib/components/AcResourceCard.vue.d.ts +1 -1
  39. package/dist/lib/components/AcSideTabs.vue.d.ts +3 -1
  40. package/dist/lib/components/AcSideTabs.vue_vue_type_script_setup_true_lang.js +53 -33
  41. package/dist/lib/components/AcSidebarItem.vue.d.ts +1 -1
  42. package/dist/lib/components/AcStatCard.vue.d.ts +1 -1
  43. package/dist/lib/components/AcTreeChart.js +5 -0
  44. package/dist/lib/components/AcTreeChart.vue.d.ts +135 -0
  45. package/dist/lib/components/AcTreeChart.vue_vue_type_script_setup_true_lang.js +809 -0
  46. package/dist/lib/components/AcUsageCard.vue.d.ts +1 -1
  47. package/dist/lib/components/index.d.ts +5 -2
  48. package/dist/lib/composables/copyText.d.ts +5 -1
  49. package/dist/lib/composables/copyText.js +15 -3
  50. package/dist/lib/index.d.ts +3 -0
  51. package/dist/lib/index.js +85 -81
  52. package/package.json +1 -1
@@ -0,0 +1,809 @@
1
+ import e from "./AcTooltip.js";
2
+ import t from "../charts/ChartFrame.js";
3
+ import { bindItemHover as n, useEChart as r } from "../charts/echarts.js";
4
+ import { chartColor as i } from "../charts/shared.js";
5
+ import "../charts/xy.js";
6
+ import { nodeImage as a } from "../charts/nodeSymbol.js";
7
+ import { fitText as o, textWidth as s, treeBreadth as c } from "../charts/tree.js";
8
+ import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createTextVNode as h, createVNode as g, defineComponent as _, guardReactiveProps as ee, normalizeClass as te, normalizeProps as ne, normalizeStyle as re, openBlock as v, ref as y, renderList as ie, renderSlot as ae, resolveDynamicComponent as oe, toDisplayString as b, unref as se, useId as ce, watch as x, withCtx as S } from "vue";
9
+ import { ListTree as le, Maximize as ue, ZoomIn as de, ZoomOut as fe } from "@lucide/vue";
10
+ import { use as pe } from "echarts/core";
11
+ import { TreeChart as me } from "echarts/charts";
12
+ //#region src/lib/components/AcTreeChart.vue?vue&type=script&setup=true&lang.ts
13
+ var he = { class: "font-medium text-heading" }, ge = {
14
+ key: 0,
15
+ class: "mt-0.5 flex items-center gap-1.5 text-muted"
16
+ }, _e = {
17
+ key: 2,
18
+ class: "mt-1.5 border-t border-border pt-1.5 text-muted"
19
+ }, ve = {
20
+ key: 3,
21
+ class: "mt-1.5 text-muted"
22
+ }, ye = ["aria-label", "aria-activedescendant"], be = [
23
+ "id",
24
+ "aria-level",
25
+ "aria-posinset",
26
+ "aria-setsize",
27
+ "aria-expanded"
28
+ ], xe = {
29
+ key: 0,
30
+ class: "absolute right-3 bottom-3 flex items-center gap-0.5 rounded-full border border-border bg-surface/90 p-1 shadow-sm backdrop-blur",
31
+ role: "group",
32
+ "aria-label": "Zoom"
33
+ }, Se = {
34
+ key: 0,
35
+ class: "w-10 text-center text-xs text-muted tabular-nums",
36
+ "aria-hidden": "true"
37
+ }, Ce = ["aria-label", "onClick"], we = "tree", Te = "\0roots", C = 16, Ee = 44, De = 10, w = 6, T = 14, E = 18, Oe = 4, ke = 2, Ae = 240, je = 72, Me = 64, Ne = 34, Pe = 40, Fe = 160, Ie = 4e3, Le = 1.25, D = .25, Re = 4, ze = /*@__PURE__*/ _({
38
+ __name: "AcTreeChart",
39
+ props: {
40
+ data: {},
41
+ direction: { default: "LR" },
42
+ expandDepth: { default: 2 },
43
+ search: { default: "" },
44
+ height: { default: 400 },
45
+ autoHeight: {
46
+ type: Boolean,
47
+ default: !1
48
+ },
49
+ edgeShape: { default: "polyline" },
50
+ kindColors: { default: void 0 },
51
+ kindIcons: { default: void 0 },
52
+ zoom: {
53
+ type: Boolean,
54
+ default: !0
55
+ },
56
+ tooltip: {
57
+ type: Boolean,
58
+ default: !0
59
+ },
60
+ loading: {
61
+ type: Boolean,
62
+ default: !1
63
+ },
64
+ emptyText: { default: "No items to show yet" },
65
+ title: { default: "" },
66
+ description: { default: "" },
67
+ renderer: { default: "canvas" },
68
+ animation: {
69
+ type: Boolean,
70
+ default: !0
71
+ }
72
+ },
73
+ emits: [
74
+ "select",
75
+ "open",
76
+ "toggle",
77
+ "matches"
78
+ ],
79
+ setup(_, { expose: ze, emit: Be }) {
80
+ pe([me]);
81
+ let O = _, k = Be, A = [.5, 2], Ve = [
82
+ ["wheel", sn],
83
+ ["mousewheel", sn],
84
+ ["touchstart", $],
85
+ ["touchmove", $],
86
+ ["touchend", $]
87
+ ], He = {
88
+ success: "var(--color-success)",
89
+ info: "var(--color-info)",
90
+ warning: "var(--color-warning)",
91
+ danger: "var(--color-danger)",
92
+ neutral: void 0
93
+ }, Ue = {
94
+ success: "var(--color-success-strong)",
95
+ info: "var(--color-info-strong)",
96
+ warning: "var(--color-warning-strong)",
97
+ danger: "var(--color-danger-strong)",
98
+ neutral: "var(--color-muted)"
99
+ }, We = {
100
+ success: "Healthy",
101
+ info: "Info",
102
+ warning: "Warning",
103
+ danger: "Critical",
104
+ neutral: ""
105
+ }, Ge = {
106
+ success: "text-success-strong",
107
+ info: "text-info-strong",
108
+ warning: "text-warning-strong",
109
+ danger: "text-danger-strong",
110
+ neutral: "text-muted"
111
+ }, Ke = {
112
+ success: "bg-success",
113
+ info: "bg-info",
114
+ warning: "bg-warning",
115
+ danger: "bg-danger",
116
+ neutral: "bg-border-dark"
117
+ }, qe = [
118
+ "success",
119
+ "info",
120
+ "warning",
121
+ "danger",
122
+ "neutral"
123
+ ], Je = ce(), Ye = y(), Xe = y(), Ze = y([]), Qe = y(0), j = y(null), $e = y(O.expandDepth), et = y(!0), M = y(/* @__PURE__ */ new Set()), N = y(/* @__PURE__ */ new Set()), P = y(null), F = y(!1), I = y(!1), L = y(1), tt = y(0), R = null, z = !1, nt = !1, B = null, rt = !1, it = !1, at = /* @__PURE__ */ new Map(), ot = /* @__PURE__ */ new Map(), st = u(() => Array.isArray(O.data) ? O.data : O.data ? [O.data] : []), V = u(() => {
124
+ let e = /* @__PURE__ */ new Map(), t = [], n = (r, i, a) => {
125
+ let o = {
126
+ node: r,
127
+ depth: i,
128
+ parent: a,
129
+ children: []
130
+ };
131
+ return e.set(r.id, o), t.push(o), o.children = (r.children ?? []).map((e) => n(e, i + 1, o)), o;
132
+ };
133
+ return {
134
+ byId: e,
135
+ list: t,
136
+ top: st.value.map((e) => n(e, 0, null))
137
+ };
138
+ }), ct = u(() => [...new Set(V.value.list.map((e) => e.node.kind).filter((e) => !!e))]), lt = u(() => new Map(ct.value.map((e, t) => [e, i(O.kindColors?.[e], t)]))), ut = u(() => O.search.trim().toLowerCase()), dt = u(() => {
139
+ let e = /* @__PURE__ */ new Set();
140
+ if (!ut.value) return e;
141
+ for (let { node: t } of V.value.list) [
142
+ t.name,
143
+ t.description,
144
+ t.kind
145
+ ].some((e) => e?.toLowerCase().includes(ut.value)) && e.add(t.id);
146
+ return e;
147
+ }), ft = u(() => {
148
+ let e = /* @__PURE__ */ new Set();
149
+ for (let t of dt.value) for (let n = V.value.byId.get(t)?.parent; n && !e.has(n.node.id); n = n.parent) e.add(n.node.id);
150
+ return e;
151
+ }), pt = u(() => V.value.list.filter((e) => dt.value.has(e.node.id)).map((e) => e.node));
152
+ function mt(e) {
153
+ if (!e.children.length) return !1;
154
+ let t = e.node.id;
155
+ return N.value.has(t) ? !1 : M.value.has(t) || ft.value.has(t) ? !0 : et.value && e.node.collapsed !== void 0 ? !e.node.collapsed : e.depth < $e.value;
156
+ }
157
+ let H = u(() => {
158
+ let e = [], t = (n) => {
159
+ n.forEach((r, i) => {
160
+ let a = mt(r);
161
+ e.push({
162
+ entry: r,
163
+ open: a,
164
+ index: e.length,
165
+ posInSet: i + 1,
166
+ setSize: n.length
167
+ }), a && t(r.children);
168
+ });
169
+ };
170
+ return t(V.value.top), e;
171
+ }), U = u(() => new Map(H.value.map((e) => [e.entry.node.id, e]))), ht = u(() => new Set(U.value.keys())), gt = u(() => V.value.top.length > 1), _t = u(() => H.value.reduce((e, t) => Math.max(e, t.entry.depth), 0)), W = u(() => P.value ? U.value.get(P.value) : void 0), vt = u(() => {
172
+ if (!I.value || !F.value) return null;
173
+ let e = W.value;
174
+ if (!e) return null;
175
+ let t = /* @__PURE__ */ new Set();
176
+ for (let n = e.entry; n; n = n.parent) t.add(n.node.id);
177
+ let n = (e) => {
178
+ for (let r of e.children) ht.value.has(r.node.id) && (t.add(r.node.id), n(r));
179
+ };
180
+ return n(e.entry), t;
181
+ });
182
+ function G(e) {
183
+ return e.status ?? "neutral";
184
+ }
185
+ function K(e) {
186
+ return e.statusText || We[G(e)];
187
+ }
188
+ function yt(e) {
189
+ return e.status === "warning" || e.status === "danger";
190
+ }
191
+ function bt(e) {
192
+ return e.kind && lt.value.get(e.kind) || "var(--color-muted)";
193
+ }
194
+ function xt(e) {
195
+ return e.icon ?? (e.kind ? O.kindIcons?.[e.kind] : void 0);
196
+ }
197
+ function q(e) {
198
+ return e.replace(/[{}|]/g, " ");
199
+ }
200
+ function St(e) {
201
+ return {
202
+ name: `500 12px ${e}`,
203
+ small: `450 11px ${e}`,
204
+ chip: `500 10px ${e}`
205
+ };
206
+ }
207
+ function Ct(e, t, n) {
208
+ let r = St(n), i = e.entry.node, a = s(" ", r.name), c = (e) => s(e, r.chip) + 10, l = 0, u = [], d = [];
209
+ if (i.relation && (u.push(`{rel|${q(i.relation)}}`), l += s(i.relation, r.small) + a), yt(i) && (d.push(`{${i.status}|!}`), l += 14 + a), !e.open && e.entry.children.length) {
210
+ let t = String(e.entry.children.length);
211
+ d.push(`{count|${t}}`), l += c(t) + a;
212
+ }
213
+ let f = t - 8, p = dt.value.has(i.id);
214
+ if (i.badge?.text) {
215
+ let e = c(i.badge.text) + a;
216
+ f - l - e - (p ? 6 : 0) >= Math.min(s(i.name, r.name), Me) && (d.unshift(`{b_${i.badge.tone ?? "neutral"}|${q(i.badge.text)}}`), l += e);
217
+ }
218
+ let m = o(i.name, Math.max(f - l - (p ? 6 : 0), 32), r.name), h = p ? "hit" : i.muted ? "mname" : "name", g = [
219
+ ...u,
220
+ `{${h}|${q(m)}}`,
221
+ ...d
222
+ ].join(" "), _ = l + s(m, r.name) + (p ? 6 : 0);
223
+ if (!i.description) return {
224
+ text: g,
225
+ width: _ + 8
226
+ };
227
+ let ee = o(i.description, f, r.small);
228
+ return _ = Math.max(_, s(ee, r.small)), {
229
+ text: `${g}\n{desc|${q(ee)}}`,
230
+ width: _ + 8
231
+ };
232
+ }
233
+ let wt = u(() => Y.theme.value?.font ?? "Roboto, sans-serif"), Tt = u(() => V.value.list.some((e) => !!e.node.description)), Et = u(() => V.value.list.reduce((e, t) => Math.max(e, Ct({
234
+ entry: t,
235
+ open: !1,
236
+ index: 0,
237
+ posInSet: 1,
238
+ setSize: 1
239
+ }, Ae, wt.value).width), 0)), J = u(() => {
240
+ let e = (t) => ({ children: mt(t) ? t.children.map(e) : [] }), t = V.value.top;
241
+ return t.length ? c(t.length === 1 ? e(t[0]) : { children: t.map(e) }) : 0;
242
+ }), Dt = u(() => {
243
+ let e = Math.max(Qe.value, 1), t = +!!gt.value, n = _t.value, r = O.zoom ? Ee : C, i = Math.max(e - 32, 1), a = (Tt.value ? 30 : 16) + 4, o, s, c, l, u;
244
+ if (O.direction === "TB") {
245
+ c = 28 + w + a + T + E;
246
+ let e = Math.min(Math.max(Et.value + 12, 84), 252);
247
+ e * J.value > i && (e = Math.max(i / J.value | 0, 84)), o = e * J.value, s = 28 + n * c + w + a, l = e - 12, u = (14 + w + a + T) / c;
248
+ } else {
249
+ let e = (e) => 28 + w + e + T + E, t = (t) => 14 + n * e(t) + 14 + w + t;
250
+ if (l = Math.min(Math.max(Et.value, je), Ae), t(l) > i) {
251
+ let e = (i - 28 - w - n * (28 + w + T + E)) / (n + 1);
252
+ l = Math.max(Math.floor(e), je);
253
+ }
254
+ c = e(l), o = t(l), s = J.value * (Tt.value ? Pe : Ne), u = (14 + w + l + T) / c;
255
+ }
256
+ let d = O.autoHeight ? Ot(s + C + r, Fe, Ie) : O.height, f = Math.max(d - C - r, 1), p = O.direction === "TB", m = p ? {
257
+ width: Math.max(o, 1),
258
+ height: Math.max((n + t) * c, 1)
259
+ } : {
260
+ width: Math.max((n + t) * c, 1),
261
+ height: Math.max(s, 1)
262
+ };
263
+ return {
264
+ plotHeight: d,
265
+ box: {
266
+ left: C + Math.max((i - o) / 2, 0) - (p ? 0 : t * c - 14),
267
+ top: C + Math.max((f - s) / 2, 0) - (p ? t * c - 14 : 0),
268
+ ...m
269
+ },
270
+ fork: u,
271
+ labelRoom: l,
272
+ descRows: Tt.value
273
+ };
274
+ });
275
+ function Ot(e, t, n) {
276
+ return Math.min(Math.max(e, t), n);
277
+ }
278
+ function kt(e) {
279
+ let t = ot.get(e);
280
+ return t === void 0 && (t = ot.size, ot.set(e, t)), t;
281
+ }
282
+ function At(e, t) {
283
+ let n = He[G(t)], r = xt(t);
284
+ if (!r) {
285
+ let t = n ? e.color(n) : e.muted;
286
+ return {
287
+ symbol: "circle",
288
+ size: De,
289
+ itemStyle: {
290
+ color: e.surface,
291
+ borderColor: t,
292
+ borderWidth: 2
293
+ }
294
+ };
295
+ }
296
+ let i = n ? e.color(n) : e.borderDark, o = e.color(bt(t)), s = [
297
+ typeof r == "string" ? `t:${r}` : `c:${kt(r)}`,
298
+ o,
299
+ i,
300
+ e.surface
301
+ ].join("|"), c = at.get(s);
302
+ return c || (c = a({
303
+ icon: r,
304
+ iconColor: o,
305
+ fill: e.surface,
306
+ ring: i,
307
+ ringWidth: 2.5,
308
+ shape: "circle",
309
+ font: e.font,
310
+ fontSize: 13
311
+ }), at.set(s, c)), {
312
+ symbol: c,
313
+ size: 28,
314
+ itemStyle: {}
315
+ };
316
+ }
317
+ function jt(e, t, n) {
318
+ let [r, i, a] = e.match(/[\d.]+/g).map(Number), [o, s, c] = t.match(/[\d.]+/g).map(Number), l = (e = 0, t = 0) => Math.round(e * n + t * (1 - n));
319
+ return `rgb(${l(r, o)}, ${l(i, s)}, ${l(a, c)})`;
320
+ }
321
+ function Mt(e, t) {
322
+ let n = He[t];
323
+ return {
324
+ backgroundColor: n ? e.alpha(n, .14) : e.sunken,
325
+ color: e.color(Ue[t]),
326
+ fontSize: 10,
327
+ fontWeight: 500,
328
+ lineHeight: 14,
329
+ padding: [1, 5],
330
+ borderRadius: 7,
331
+ fontFamily: e.font
332
+ };
333
+ }
334
+ function Nt(e) {
335
+ let t = (t, n) => ({
336
+ backgroundColor: e.color(t),
337
+ color: e.color(n),
338
+ padding: [0, 5],
339
+ lineHeight: 14,
340
+ borderRadius: 7,
341
+ fontSize: 10,
342
+ fontWeight: 700,
343
+ fontFamily: e.font
344
+ }), n = {
345
+ fontSize: 12,
346
+ fontWeight: 500,
347
+ lineHeight: 16,
348
+ color: e.heading,
349
+ fontFamily: e.font
350
+ };
351
+ return {
352
+ name: n,
353
+ mname: {
354
+ ...n,
355
+ fontWeight: 450,
356
+ color: e.muted
357
+ },
358
+ hit: {
359
+ ...n,
360
+ color: e.heading,
361
+ backgroundColor: e.alpha("var(--color-warning)", .3),
362
+ padding: [0, 3],
363
+ borderRadius: 3
364
+ },
365
+ rel: {
366
+ fontSize: 11,
367
+ lineHeight: 16,
368
+ color: e.muted,
369
+ fontFamily: e.font
370
+ },
371
+ desc: {
372
+ fontSize: 11,
373
+ lineHeight: 14,
374
+ color: e.muted,
375
+ fontFamily: e.font
376
+ },
377
+ count: {
378
+ ...Mt(e, "neutral"),
379
+ color: e.muted
380
+ },
381
+ warning: t("var(--color-warning)", "var(--color-on-warning)"),
382
+ danger: t("var(--color-danger)", "var(--color-white)"),
383
+ ...Object.fromEntries(qe.map((t) => [`b_${t}`, Mt(e, t)]))
384
+ };
385
+ }
386
+ function Pt(e) {
387
+ let t = Dt.value, n = vt.value, r = I.value && F.value ? W.value?.entry.node.id : void 0, i = O.edgeShape === "polyline", a = jt(e.primary, e.surface, .1), o = { opacity: 0 }, s = (c) => {
388
+ let l = c.entry.node, u = At(e, l), d = n && !n.has(l.id), f = d ? D : l.muted ? .6 : 1, p = l.id === r, m = !c.entry.parent && gt.value && !i;
389
+ return {
390
+ id: l.id,
391
+ name: l.id,
392
+ sym: u.symbol,
393
+ symSize: u.size,
394
+ itemStyle: {
395
+ ...u.itemStyle,
396
+ opacity: f
397
+ },
398
+ label: {
399
+ formatter: Ct(c, t.labelRoom, e.font).text,
400
+ opacity: d ? D : 1,
401
+ ...p ? {
402
+ backgroundColor: a,
403
+ borderColor: e.primary,
404
+ borderWidth: 1.5
405
+ } : {}
406
+ },
407
+ lineStyle: m ? o : { opacity: d ? D : 1 },
408
+ ...m ? {
409
+ emphasis: { lineStyle: o },
410
+ blur: { lineStyle: o }
411
+ } : {},
412
+ children: c.open ? c.entry.children.map((e) => s(U.value.get(e.node.id))) : []
413
+ };
414
+ }, c = V.value.top.map((e) => s(U.value.get(e.node.id))), l = gt.value ? [{
415
+ id: Te,
416
+ name: Te,
417
+ sym: "none",
418
+ symSize: 0,
419
+ label: { show: !1 },
420
+ lineStyle: o,
421
+ emphasis: { lineStyle: o },
422
+ blur: { lineStyle: o },
423
+ children: c
424
+ }] : c, u = O.direction === "TB";
425
+ return {
426
+ id: we,
427
+ type: "tree",
428
+ layout: "orthogonal",
429
+ orient: O.direction,
430
+ ...t.box,
431
+ data: l,
432
+ edgeShape: O.edgeShape,
433
+ edgeForkPosition: `${(t.fork * 100).toFixed(2)}%`,
434
+ expandAndCollapse: !1,
435
+ roam: !0,
436
+ roamTrigger: "global",
437
+ scaleLimit: {
438
+ min: A[0],
439
+ max: A[1]
440
+ },
441
+ zoom: R?.zoom ?? 1,
442
+ center: R?.center,
443
+ nodeScaleRatio: 1,
444
+ cursor: "pointer",
445
+ symbol: (e, t) => t.data?.sym ?? "none",
446
+ symbolSize: (e, t) => t.data?.symSize ?? 0,
447
+ label: {
448
+ show: !0,
449
+ position: u ? "bottom" : "right",
450
+ distance: w,
451
+ align: u ? "center" : "left",
452
+ verticalAlign: u ? "top" : "middle",
453
+ backgroundColor: e.surface,
454
+ padding: [ke, Oe],
455
+ borderRadius: 4,
456
+ fontFamily: e.font,
457
+ rich: Nt(e)
458
+ },
459
+ lineStyle: {
460
+ color: e.borderDark,
461
+ width: 1.5,
462
+ curveness: .5
463
+ },
464
+ emphasis: {
465
+ focus: "relative",
466
+ blurScope: "series",
467
+ scale: !1,
468
+ label: { backgroundColor: a }
469
+ },
470
+ blur: {
471
+ itemStyle: { opacity: D },
472
+ label: { opacity: D },
473
+ lineStyle: { opacity: .2 }
474
+ },
475
+ animationDuration: 400,
476
+ animationDurationUpdate: 400
477
+ };
478
+ }
479
+ let Y = r({
480
+ host: Ye,
481
+ renderer: () => O.renderer,
482
+ option: (e) => (tt.value, z && It(), {
483
+ animation: O.animation && !e.reducedMotion && !nt && V.value.list.length <= 2e3,
484
+ textStyle: { fontFamily: e.font },
485
+ series: [Pt(e)]
486
+ }),
487
+ setup: Ft
488
+ });
489
+ function Ft(e) {
490
+ let t = e.getZr();
491
+ n(e, an, on), t.on("mousedown", (e) => {
492
+ B = [e.offsetX, e.offsetY];
493
+ }), e.on("click", (e) => {
494
+ let t = e, n = t.data?.id ? U.value.get(t.data.id) : void 0, r = t.event?.event;
495
+ n && t.event && !Lt(t.event) && (P.value = n.entry.node.id, I.value = !1, it = !0, Xe.value?.focus({ preventScroll: !0 }), it = !1, !((r?.detail ?? 1) > 1) && Bt(n));
496
+ }), e.on("dblclick", (e) => {
497
+ let t = e.data?.id, n = t ? V.value.byId.get(t) : void 0;
498
+ n && k("open", n.node);
499
+ }), e.on("treeroam", (e) => {
500
+ z = !0, j.value = null;
501
+ let t = e.zoom;
502
+ t && (L.value = Ot(L.value * t, ...A));
503
+ }), e.on("finished", () => {
504
+ nt = !1;
505
+ });
506
+ }
507
+ function It() {
508
+ z = !1;
509
+ let e = (Y.chart.value?.getOption())?.series?.[0];
510
+ e && (R = {
511
+ zoom: e.zoom ?? 1,
512
+ center: e.center
513
+ });
514
+ }
515
+ function Lt(e) {
516
+ return !!B && Math.hypot(e.offsetX - B[0], e.offsetY - B[1]) > Re;
517
+ }
518
+ function Rt(e, t) {
519
+ let n = new Set(M.value), r = new Set(N.value);
520
+ t ? (n.add(e), r.delete(e)) : (r.add(e), n.delete(e)), M.value = n, N.value = r;
521
+ }
522
+ function zt(e) {
523
+ Rt(e.entry.node.id, !e.open), k("toggle", e.entry.node, !e.open);
524
+ }
525
+ function Bt(e) {
526
+ k("select", e.entry.node), e.entry.children.length && zt(e);
527
+ }
528
+ function X(e) {
529
+ $e.value = e, et.value = !1, M.value = /* @__PURE__ */ new Set(), N.value = /* @__PURE__ */ new Set();
530
+ }
531
+ function Vt() {
532
+ X(Infinity);
533
+ }
534
+ function Ht() {
535
+ X(1);
536
+ }
537
+ function Ut(e) {
538
+ let t = new Set(M.value), n = new Set(N.value);
539
+ for (let r = V.value.byId.get(e)?.parent; r; r = r.parent) t.add(r.node.id), n.delete(r.node.id);
540
+ M.value = t, N.value = n;
541
+ }
542
+ let Wt = u(() => Math.round(L.value * 100));
543
+ function Gt(e) {
544
+ let t = Y.chart.value;
545
+ t && t.dispatchAction({
546
+ type: "treeRoam",
547
+ seriesId: we,
548
+ zoom: e,
549
+ originX: t.getWidth() / 2,
550
+ originY: t.getHeight() / 2
551
+ });
552
+ }
553
+ function Kt() {
554
+ Gt(Le);
555
+ }
556
+ function qt() {
557
+ Gt(1 / Le);
558
+ }
559
+ function Jt() {
560
+ R = null, z = !1, L.value = 1, tt.value++;
561
+ }
562
+ let Yt = [
563
+ {
564
+ label: "Zoom out",
565
+ icon: fe,
566
+ action: qt
567
+ },
568
+ {
569
+ label: "Zoom in",
570
+ icon: de,
571
+ action: Kt
572
+ },
573
+ {
574
+ label: "Fit to view",
575
+ icon: ue,
576
+ action: Jt
577
+ }
578
+ ];
579
+ function Z(e) {
580
+ let t = H.value[Ot(e, 0, H.value.length - 1)];
581
+ t && (P.value = t.entry.node.id);
582
+ }
583
+ function Xt(e) {
584
+ let t = W.value;
585
+ if (!H.value.length || e.altKey || e.ctrlKey || e.metaKey) return;
586
+ I.value = !0;
587
+ let n = t?.index ?? -1;
588
+ switch (e.key) {
589
+ case "ArrowDown":
590
+ Z(n + 1);
591
+ break;
592
+ case "ArrowUp":
593
+ Z(n - 1);
594
+ break;
595
+ case "Home":
596
+ Z(0);
597
+ break;
598
+ case "End":
599
+ Z(H.value.length - 1);
600
+ break;
601
+ case "ArrowRight":
602
+ t ? t.entry.children.length && !t.open ? zt(t) : t.open && Z(n + 1) : Z(0);
603
+ break;
604
+ case "ArrowLeft":
605
+ t ? t.open ? zt(t) : t.entry.parent && (P.value = t.entry.parent.node.id) : Z(0);
606
+ break;
607
+ case "Enter":
608
+ t && k("open", t.entry.node);
609
+ break;
610
+ case " ":
611
+ t && Bt(t);
612
+ break;
613
+ default: return;
614
+ }
615
+ e.preventDefault();
616
+ }
617
+ function Zt() {
618
+ F.value = !0, it || (I.value = !0), W.value || Z(0);
619
+ }
620
+ function Qt() {
621
+ F.value = !1, I.value = !1;
622
+ }
623
+ let $t = u(() => ({
624
+ columns: [
625
+ "Name",
626
+ "Parent",
627
+ "Kind",
628
+ "Status",
629
+ "Description"
630
+ ],
631
+ rows: V.value.list.map(({ node: e, parent: t }) => [
632
+ e.name,
633
+ t?.node.name ?? "None",
634
+ e.kind ?? "",
635
+ K(e),
636
+ e.description ?? ""
637
+ ])
638
+ }));
639
+ function en(e, t) {
640
+ return `${e} ${t}${e === 1 ? "" : "s"}`;
641
+ }
642
+ let tn = u(() => {
643
+ let e = V.value.list, t = e.reduce((e, t) => Math.max(e, t.depth + 1), 0), n = e.filter((e) => yt(e.node)).length, r = `Tree: ${en(e.length, "item")}, ${en(t, "level")}${n ? `, ${n} with problems` : ""}.`;
644
+ return [O.title, O.description || r].filter(Boolean).join(". ");
645
+ });
646
+ function nn(e) {
647
+ let t = e.entry.node;
648
+ return [
649
+ t.relation ? `${t.relation} ${t.name}` : t.name,
650
+ t.kind,
651
+ K(t),
652
+ t.badge?.text,
653
+ t.description
654
+ ].filter(Boolean).join(", ");
655
+ }
656
+ let rn = u(() => j.value ? V.value.byId.get(String(j.value.datum.id)) : void 0), Q = u(() => {
657
+ let e = rn.value;
658
+ if (!e) return;
659
+ let t = [];
660
+ for (let n = e.parent; n; n = n.parent) t.unshift(n.node.name);
661
+ return {
662
+ node: e.node,
663
+ path: t,
664
+ expanded: !!U.value.get(e.node.id)?.open
665
+ };
666
+ });
667
+ function an(e) {
668
+ let t = V.value.byId.get(String(e.data?.id));
669
+ if (!t || !O.tooltip) return on();
670
+ j.value = {
671
+ clientX: e.clientX,
672
+ clientY: e.clientY,
673
+ title: t.node.name,
674
+ items: [],
675
+ datum: t.node,
676
+ index: e.dataIndex
677
+ };
678
+ }
679
+ function on() {
680
+ j.value = null;
681
+ }
682
+ function sn(e) {
683
+ let t = e;
684
+ !t.ctrlKey && !t.metaKey && e.stopPropagation();
685
+ }
686
+ function $(e) {
687
+ let t = e;
688
+ t.type === "touchstart" && t.touches.length > 1 && (rt = !0), rt || e.stopPropagation(), t.type === "touchend" && !t.touches.length && (rt = !1);
689
+ }
690
+ return x(ht, (e, t) => {
691
+ let n = Y.chart.value;
692
+ if (n && t && O.edgeShape === "polyline") {
693
+ for (let r of t) if (!e.has(r)) {
694
+ z && It(), nt = !0, n.clear();
695
+ return;
696
+ }
697
+ }
698
+ }, { flush: "sync" }), x(() => O.expandDepth, (e) => X(e)), x(ut, () => {
699
+ [...ft.value].some((e) => N.value.has(e)) && (N.value = new Set([...N.value].filter((e) => !ft.value.has(e))));
700
+ }), x(pt, (e) => k("matches", e), { immediate: !!O.search }), x(H, () => {
701
+ if (!P.value || U.value.has(P.value)) return;
702
+ let e = V.value.byId.get(P.value)?.parent ?? null;
703
+ for (; e && !U.value.has(e.node.id);) e = e.parent;
704
+ P.value = e?.node.id ?? null;
705
+ }), x(Ye, (e, t) => {
706
+ for (let [n, r] of Ve) t?.removeEventListener(n, r, { capture: !0 }), e?.addEventListener(n, r, {
707
+ capture: !0,
708
+ passive: !0
709
+ });
710
+ }), ze({
711
+ expandAll: Vt,
712
+ collapseAll: Ht,
713
+ expandToDepth: X,
714
+ reveal: Ut,
715
+ fit: Jt
716
+ }), (n, r) => (v(), d(t, {
717
+ hidden: Ze.value,
718
+ "onUpdate:hidden": r[0] ||= (e) => Ze.value = e,
719
+ width: Qe.value,
720
+ "onUpdate:width": r[1] ||= (e) => Qe.value = e,
721
+ testid: "ac-tree-chart",
722
+ height: Dt.value.plotHeight,
723
+ loading: _.loading,
724
+ empty: !st.value.length,
725
+ "empty-text": _.emptyText,
726
+ "empty-icon": se(le),
727
+ legend: "none",
728
+ "legend-items": [],
729
+ summary: tn.value,
730
+ title: _.title,
731
+ description: _.description,
732
+ table: $t.value,
733
+ tip: j.value,
734
+ tooltip: _.tooltip
735
+ }, {
736
+ tooltip: S(() => [Q.value ? ae(n.$slots, "tooltip", ne(ee(Q.value)), () => [
737
+ m("p", he, b(Q.value.node.name), 1),
738
+ Q.value.node.kind ? (v(), p("p", ge, [m("span", {
739
+ class: "size-2 shrink-0 rounded-full",
740
+ style: re({ backgroundColor: bt(Q.value.node) }),
741
+ "aria-hidden": "true"
742
+ }, null, 4), h(" " + b(Q.value.node.kind), 1)])) : f("", !0),
743
+ K(Q.value.node) ? (v(), p("p", {
744
+ key: 1,
745
+ class: te(["mt-1 flex items-center gap-1.5", Ge[G(Q.value.node)]])
746
+ }, [m("span", {
747
+ class: te(["size-2 shrink-0 rounded-full", Ke[G(Q.value.node)]]),
748
+ "aria-hidden": "true"
749
+ }, null, 2), h(" " + b(K(Q.value.node)), 1)], 2)) : f("", !0),
750
+ Q.value.node.description ? (v(), p("p", _e, b(Q.value.node.description), 1)) : f("", !0),
751
+ Q.value.node.children?.length ? (v(), p("p", ve, b(en(Q.value.node.children.length, "item")) + " inside · click to " + b(Q.value.expanded ? "fold" : "open"), 1)) : f("", !0)
752
+ ], void 0, 0) : f("", !0)]),
753
+ controls: S(() => [m("div", {
754
+ ref_key: "treeEl",
755
+ ref: Xe,
756
+ class: te(["pointer-events-none absolute inset-0 rounded-10 ring-inset ring-ring focus:outline-none", F.value && I.value && "ring-2"]),
757
+ role: "tree",
758
+ tabindex: "0",
759
+ "aria-label": _.title || "Tree",
760
+ "aria-activedescendant": F.value && W.value ? `${se(Je)}-${W.value.index}` : void 0,
761
+ onKeydown: Xt,
762
+ onFocus: Zt,
763
+ onBlur: Qt
764
+ }, [(v(!0), p(l, null, ie(H.value, (e) => (v(), p("div", {
765
+ id: `${se(Je)}-${e.index}`,
766
+ key: e.entry.node.id,
767
+ class: "sr-only",
768
+ role: "treeitem",
769
+ "aria-level": e.entry.depth + 1,
770
+ "aria-posinset": e.posInSet,
771
+ "aria-setsize": e.setSize,
772
+ "aria-expanded": e.entry.children.length ? e.open : void 0
773
+ }, b(nn(e)), 9, be))), 128))], 42, ye), _.zoom ? (v(), p("div", xe, [(v(), p(l, null, ie(Yt, (t) => (v(), p(l, { key: t.label }, [t.label === "Zoom in" ? (v(), p("span", Se, b(Wt.value) + "%", 1)) : f("", !0), g(e, { content: t.label }, {
774
+ default: S(() => [m("button", {
775
+ type: "button",
776
+ class: "inline-flex size-7 cursor-pointer items-center justify-center rounded-full text-muted transition-colors hover:bg-surface-sunken hover:text-heading focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none",
777
+ "aria-label": t.label,
778
+ onClick: t.action
779
+ }, [(v(), d(oe(t.icon), {
780
+ class: "size-4",
781
+ "aria-hidden": "true"
782
+ }))], 8, Ce)]),
783
+ _: 2
784
+ }, 1032, ["content"])], 64))), 64))])) : f("", !0)]),
785
+ default: S(() => [m("div", {
786
+ ref_key: "host",
787
+ ref: Ye,
788
+ class: "size-full"
789
+ }, null, 512)]),
790
+ _: 3
791
+ }, 8, [
792
+ "hidden",
793
+ "width",
794
+ "height",
795
+ "loading",
796
+ "empty",
797
+ "empty-text",
798
+ "empty-icon",
799
+ "summary",
800
+ "title",
801
+ "description",
802
+ "table",
803
+ "tip",
804
+ "tooltip"
805
+ ]));
806
+ }
807
+ });
808
+ //#endregion
809
+ export { ze as default };