@ac-design/design-system 2.0.0 → 2.1.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 (167) hide show
  1. package/dist/lib/charts/ChartFrame.vue.d.ts +2 -0
  2. package/dist/lib/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +42 -37
  3. package/dist/lib/charts/cartesian.d.ts +324 -0
  4. package/dist/lib/charts/cartesian.js +137 -0
  5. package/dist/lib/charts/echarts.d.ts +86 -0
  6. package/dist/lib/charts/echarts.js +173 -0
  7. package/dist/lib/charts/graph.d.ts +77 -0
  8. package/dist/lib/charts/graph.js +155 -0
  9. package/dist/lib/charts/index.d.ts +4 -0
  10. package/dist/lib/charts/index.js +3 -1
  11. package/dist/lib/charts/shared.d.ts +0 -7
  12. package/dist/lib/charts/shared.js +1 -19
  13. package/dist/lib/charts/xy.d.ts +11 -7
  14. package/dist/lib/charts/xy.js +53 -72
  15. package/dist/lib/compat.css +1322 -278
  16. package/dist/lib/components/AcAlert.vue.d.ts +9 -0
  17. package/dist/lib/components/AcAlert.vue_vue_type_script_setup_true_lang.js +121 -21
  18. package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +1 -1
  19. package/dist/lib/components/AcAreaChart.vue.d.ts +3 -0
  20. package/dist/lib/components/AcAreaChart.vue_vue_type_script_setup_true_lang.js +132 -142
  21. package/dist/lib/components/AcAvatar.vue.d.ts +7 -4
  22. package/dist/lib/components/AcAvatar.vue_vue_type_script_setup_true_lang.js +59 -54
  23. package/dist/lib/components/AcBadge.vue.d.ts +7 -3
  24. package/dist/lib/components/AcBadge.vue_vue_type_script_setup_true_lang.js +35 -28
  25. package/dist/lib/components/AcBarChart.vue.d.ts +3 -0
  26. package/dist/lib/components/AcBarChart.vue_vue_type_script_setup_true_lang.js +142 -146
  27. package/dist/lib/components/AcBreadcrumb.vue.d.ts +4 -1
  28. package/dist/lib/components/AcBreadcrumb.vue_vue_type_script_setup_true_lang.js +18 -17
  29. package/dist/lib/components/AcBulkActionBar.vue.d.ts +2 -0
  30. package/dist/lib/components/AcBulkActionBar.vue_vue_type_script_setup_true_lang.js +1 -1
  31. package/dist/lib/components/AcButton.vue.d.ts +12 -6
  32. package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +85 -47
  33. package/dist/lib/components/AcCard.vue.d.ts +34 -3
  34. package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +169 -34
  35. package/dist/lib/components/AcCellValue.vue.d.ts +3 -3
  36. package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +171 -165
  37. package/dist/lib/components/AcCheckBox.vue.d.ts +1 -1
  38. package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +58 -72
  39. package/dist/lib/components/AcCheckList.js +5 -0
  40. package/dist/lib/components/AcCheckList.vue.d.ts +45 -0
  41. package/dist/lib/components/AcCheckList.vue_vue_type_script_setup_true_lang.js +64 -0
  42. package/dist/lib/components/AcCheckRadio.vue.d.ts +30 -5
  43. package/dist/lib/components/AcCheckRadio.vue_vue_type_script_setup_true_lang.js +100 -36
  44. package/dist/lib/components/AcCircularProgress.vue.d.ts +4 -4
  45. package/dist/lib/components/AcCircularProgress.vue_vue_type_script_setup_true_lang.js +12 -9
  46. package/dist/lib/components/AcColorInput.vue.d.ts +5 -2
  47. package/dist/lib/components/AcColorInput.vue_vue_type_script_setup_true_lang.js +127 -97
  48. package/dist/lib/components/AcCommandBlock.js +5 -0
  49. package/dist/lib/components/AcCommandBlock.vue.d.ts +34 -0
  50. package/dist/lib/components/AcCommandBlock.vue_vue_type_script_setup_true_lang.js +88 -0
  51. package/dist/lib/components/AcConfirmModal.vue.d.ts +1 -1
  52. package/dist/lib/components/AcConfirmModal.vue_vue_type_script_setup_true_lang.js +7 -3
  53. package/dist/lib/components/AcCopyButton.vue.d.ts +2 -2
  54. package/dist/lib/components/AcCopyButton.vue_vue_type_script_setup_true_lang.js +4 -4
  55. package/dist/lib/components/AcCostSummary.js +5 -0
  56. package/dist/lib/components/AcCostSummary.vue.d.ts +102 -0
  57. package/dist/lib/components/AcCostSummary.vue_vue_type_script_setup_true_lang.js +179 -0
  58. package/dist/lib/components/AcDatePicker.vue.d.ts +3 -3
  59. package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +606 -380
  60. package/dist/lib/components/AcDeleteModal.vue_vue_type_script_setup_true_lang.js +47 -41
  61. package/dist/lib/components/AcDonutChart.vue.d.ts +10 -0
  62. package/dist/lib/components/AcDonutChart.vue_vue_type_script_setup_true_lang.js +116 -89
  63. package/dist/lib/components/AcDropdown.vue.d.ts +5 -2
  64. package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +88 -75
  65. package/dist/lib/components/AcDropdownDivider.vue_vue_type_script_setup_true_lang.js +11 -10
  66. package/dist/lib/components/AcDropdownItem.vue.d.ts +1 -1
  67. package/dist/lib/components/AcDropdownItem.vue_vue_type_script_setup_true_lang.js +17 -17
  68. package/dist/lib/components/AcEmptyState.vue.d.ts +1 -1
  69. package/dist/lib/components/AcErrorState.js +5 -0
  70. package/dist/lib/components/AcErrorState.vue.d.ts +46 -0
  71. package/dist/lib/components/AcErrorState.vue_vue_type_script_setup_true_lang.js +66 -0
  72. package/dist/lib/components/AcFeatureCard.vue.d.ts +6 -0
  73. package/dist/lib/components/AcFeatureCard.vue_vue_type_script_setup_true_lang.js +136 -114
  74. package/dist/lib/components/AcFooter.vue.d.ts +1 -1
  75. package/dist/lib/components/AcFooter.vue_vue_type_script_setup_true_lang.js +1 -1
  76. package/dist/lib/components/AcFormFooter.vue.d.ts +1 -1
  77. package/dist/lib/components/AcFormSection.vue.d.ts +1 -1
  78. package/dist/lib/components/AcGraphChart.js +5 -0
  79. package/dist/lib/components/AcGraphChart.vue.d.ts +124 -0
  80. package/dist/lib/components/AcGraphChart.vue_vue_type_script_setup_true_lang.js +578 -0
  81. package/dist/lib/components/AcHeader.vue.d.ts +17 -2
  82. package/dist/lib/components/AcHeader.vue_vue_type_script_setup_true_lang.js +79 -25
  83. package/dist/lib/components/AcInfoTable.vue.d.ts +1 -1
  84. package/dist/lib/components/AcInput.vue.d.ts +1 -1
  85. package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +76 -79
  86. package/dist/lib/components/AcKeyValueInput.vue.d.ts +4 -4
  87. package/dist/lib/components/AcKeyValueInput.vue_vue_type_script_setup_true_lang.js +199 -183
  88. package/dist/lib/components/AcLineChart.vue.d.ts +6 -0
  89. package/dist/lib/components/AcLineChart.vue_vue_type_script_setup_true_lang.js +113 -125
  90. package/dist/lib/components/AcLoader.js +5 -0
  91. package/dist/lib/components/AcLoader.vue.d.ts +15 -0
  92. package/dist/lib/components/AcLoader.vue_vue_type_script_setup_true_lang.js +66 -0
  93. package/dist/lib/components/AcLocaleSwitcher.vue.d.ts +3 -1
  94. package/dist/lib/components/AcLocaleSwitcher.vue_vue_type_script_setup_true_lang.js +44 -36
  95. package/dist/lib/components/AcMapChart.js +5 -0
  96. package/dist/lib/components/AcMapChart.vue.d.ts +136 -0
  97. package/dist/lib/components/AcMapChart.vue_vue_type_script_setup_true_lang.js +518 -0
  98. package/dist/lib/components/AcModal.vue.d.ts +6 -3
  99. package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +85 -61
  100. package/dist/lib/components/AcNavbar.vue.d.ts +8 -5
  101. package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +25 -17
  102. package/dist/lib/components/AcNavbarItem.vue.d.ts +2 -2
  103. package/dist/lib/components/AcNavbarItem.vue_vue_type_script_setup_true_lang.js +3 -4
  104. package/dist/lib/components/AcNotificationMenu.vue.d.ts +3 -3
  105. package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +133 -168
  106. package/dist/lib/components/AcNumberInput.vue.d.ts +2 -2
  107. package/dist/lib/components/AcNumberInput.vue_vue_type_script_setup_true_lang.js +137 -147
  108. package/dist/lib/components/AcPage.vue.d.ts +2 -2
  109. package/dist/lib/components/AcPage.vue_vue_type_script_setup_true_lang.js +1 -1
  110. package/dist/lib/components/AcPagination.vue.d.ts +5 -5
  111. package/dist/lib/components/AcPagination.vue_vue_type_script_setup_true_lang.js +59 -56
  112. package/dist/lib/components/AcPreloader.vue.d.ts +3 -3
  113. package/dist/lib/components/AcPreloader.vue_vue_type_script_setup_true_lang.js +15 -16
  114. package/dist/lib/components/AcProductHero.js +5 -0
  115. package/dist/lib/components/AcProductHero.vue.d.ts +56 -0
  116. package/dist/lib/components/AcProductHero.vue_vue_type_script_setup_true_lang.js +95 -0
  117. package/dist/lib/components/AcProgress.vue.d.ts +17 -2
  118. package/dist/lib/components/AcProgress.vue_vue_type_script_setup_true_lang.js +83 -29
  119. package/dist/lib/components/AcResourceCard.vue.d.ts +1 -1
  120. package/dist/lib/components/AcResourceCard.vue_vue_type_script_setup_true_lang.js +4 -4
  121. package/dist/lib/components/AcSearchBar.vue.d.ts +1 -1
  122. package/dist/lib/components/AcSearchBar.vue_vue_type_script_setup_true_lang.js +8 -4
  123. package/dist/lib/components/AcSelect.vue.d.ts +3 -3
  124. package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +232 -243
  125. package/dist/lib/components/AcSettingsRow.js +5 -0
  126. package/dist/lib/components/AcSettingsRow.vue.d.ts +29 -0
  127. package/dist/lib/components/AcSettingsRow.vue_vue_type_script_setup_true_lang.js +37 -0
  128. package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +5 -5
  129. package/dist/lib/components/AcSideTabs.vue.d.ts +1 -1
  130. package/dist/lib/components/AcSidebar.vue.d.ts +4 -1
  131. package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +104 -94
  132. package/dist/lib/components/AcSidebarItem.vue.d.ts +1 -1
  133. package/dist/lib/components/AcSidebarItem.vue_vue_type_script_setup_true_lang.js +42 -42
  134. package/dist/lib/components/AcSidebarSection.vue.d.ts +2 -2
  135. package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +23 -18
  136. package/dist/lib/components/AcSteps.vue_vue_type_script_setup_true_lang.js +1 -1
  137. package/dist/lib/components/AcSwitch.vue.d.ts +3 -0
  138. package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +46 -39
  139. package/dist/lib/components/AcSwitchCard.vue.d.ts +3 -3
  140. package/dist/lib/components/AcSwitchCard.vue_vue_type_script_setup_true_lang.js +9 -7
  141. package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +65 -65
  142. package/dist/lib/components/AcTabs.vue.d.ts +9 -2
  143. package/dist/lib/components/AcTabs.vue_vue_type_script_setup_true_lang.js +42 -27
  144. package/dist/lib/components/AcTag.vue.d.ts +1 -1
  145. package/dist/lib/components/AcTagInput.vue.d.ts +5 -5
  146. package/dist/lib/components/AcTagInput.vue_vue_type_script_setup_true_lang.js +140 -142
  147. package/dist/lib/components/AcTextarea.vue.d.ts +1 -1
  148. package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +69 -72
  149. package/dist/lib/components/AcThemeMode.vue.d.ts +3 -3
  150. package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +54 -22
  151. package/dist/lib/components/AcTimePicker.vue.d.ts +1 -1
  152. package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +177 -185
  153. package/dist/lib/components/AcToaster.vue.d.ts +6 -3
  154. package/dist/lib/components/AcToaster.vue_vue_type_script_setup_true_lang.js +103 -64
  155. package/dist/lib/components/AcTooltip.vue.d.ts +34 -14
  156. package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +184 -70
  157. package/dist/lib/components/AcUserMenu.vue.d.ts +23 -1
  158. package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +181 -138
  159. package/dist/lib/components/index.d.ts +7 -0
  160. package/dist/lib/components/status.d.ts +3 -1
  161. package/dist/lib/components/status.js +20 -5
  162. package/dist/lib/composables/useToast.d.ts +17 -1
  163. package/dist/lib/composables/useToast.js +10 -2
  164. package/dist/lib/index.d.ts +7 -3
  165. package/dist/lib/index.js +80 -73
  166. package/dist/lib/theme.css +39 -54
  167. package/package.json +12 -3
@@ -0,0 +1,86 @@
1
+ import type { ECharts, EChartsCoreOption } from "echarts/core";
2
+ import type { Ref } from "vue";
3
+ /** `canvas` (default) stays fast with tens of thousands of points; `svg` is crisper when printed or zoomed and lighter for a few dozen. */
4
+ export type ChartRenderer = "canvas" | "svg";
5
+ /** Our tokens resolved to plain colours, because ECharts can't read CSS variables. */
6
+ export interface ChartTheme {
7
+ /** Any CSS colour, including `var(--color-chart-1)`, as `rgba(r, g, b, a)`. */
8
+ color: (css: string) => string;
9
+ /** The colour at an opacity, e.g. `alpha(color, 0.3)` for an area fill. */
10
+ alpha: (css: string, opacity: number) => string;
11
+ heading: string;
12
+ body: string;
13
+ muted: string;
14
+ border: string;
15
+ borderDark: string;
16
+ surface: string;
17
+ sunken: string;
18
+ primary: string;
19
+ font: string;
20
+ reducedMotion: boolean;
21
+ }
22
+ /** Reads the tokens through a hidden probe inside the chart, so a `.dark` subtree or a re-hued brand resolves correctly. */
23
+ export declare function readChartTheme(scope: HTMLElement): ChartTheme;
24
+ /** Axis, grid and text styles every cartesian chart shares, in cloud-ui's look: muted 11px labels, dashed grid lines. */
25
+ export declare function axisStyle(t: ChartTheme): {
26
+ axisLine: {
27
+ lineStyle: {
28
+ color: string;
29
+ };
30
+ };
31
+ axisTick: {
32
+ show: boolean;
33
+ };
34
+ axisLabel: {
35
+ color: string;
36
+ fontSize: number;
37
+ fontFamily: string;
38
+ hideOverlap: boolean;
39
+ };
40
+ splitLine: {
41
+ lineStyle: {
42
+ color: string;
43
+ type: "dashed";
44
+ };
45
+ };
46
+ nameTextStyle: {
47
+ color: string;
48
+ fontSize: number;
49
+ fontFamily: string;
50
+ };
51
+ };
52
+ export declare function loadOnce(key: string, load: () => Promise<unknown>): Promise<unknown>;
53
+ interface UseEChartOptions {
54
+ /** The element ECharts draws into. It may appear later (after loading), and is re-initialised when it changes. */
55
+ host: Ref<HTMLElement | undefined>;
56
+ /** Builds the option from the theme. Read reactive props inside: the chart re-renders when they change. */
57
+ option: (theme: ChartTheme) => EChartsCoreOption;
58
+ renderer: () => ChartRenderer;
59
+ /** Loads extra ECharts modules before the first render, e.g. the zoom component. */
60
+ prepare?: () => Promise<unknown> | void;
61
+ /** Attaches event handlers once the instance exists. */
62
+ setup?: (chart: ECharts) => void;
63
+ }
64
+ export declare function useEChart(options: UseEChartOptions): {
65
+ chart: import("vue").ShallowRef<ECharts | undefined, ECharts | undefined>;
66
+ theme: import("vue").ShallowRef<ChartTheme | undefined, ChartTheme | undefined>;
67
+ };
68
+ /** Index of the value in a sorted list closest to `v` (binary search, so it stays fast on large series). */
69
+ export declare function nearestIndex(values: number[], v: number): number;
70
+ /**
71
+ * Feeds pointer moves over the plot into ChartFrame's tooltip: `locate` turns a pixel into a row index.
72
+ * ECharts' own tooltip box is turned off (`showContent: false`); its axis pointer still draws the guide line.
73
+ */
74
+ export declare function bindAxisHover(chart: ECharts, locate: (point: [number, number]) => number | null, onMove: (index: number, clientX: number, clientY: number) => void, onLeave: () => void): void;
75
+ /** The hovered item of a series (a donut segment, map point or graph node), with the pointer position for ChartFrame's tooltip. */
76
+ export interface ItemHover {
77
+ seriesIndex: number;
78
+ dataIndex: number;
79
+ dataType?: string;
80
+ data: unknown;
81
+ clientX: number;
82
+ clientY: number;
83
+ }
84
+ /** Feeds item hovers (donut, map, graph) into ChartFrame's tooltip. Turn ECharts' own tooltip box off for these series. */
85
+ export declare function bindItemHover(chart: ECharts, onMove: (hover: ItemHover) => void, onLeave: () => void): void;
86
+ export {};
@@ -0,0 +1,173 @@
1
+ import { onBeforeUnmount as e, shallowRef as t, watch as n } from "vue";
2
+ import { init as r, use as i } from "echarts/core";
3
+ import { CanvasRenderer as a } from "echarts/renderers";
4
+ //#region src/lib/charts/echarts.ts
5
+ i([a]);
6
+ function o(e) {
7
+ let t = /^#([0-9a-f]{6})$/i.exec(e);
8
+ if (t) {
9
+ let e = parseInt(t[1], 16);
10
+ return [
11
+ e >> 16 & 255,
12
+ e >> 8 & 255,
13
+ e & 255,
14
+ 1
15
+ ];
16
+ }
17
+ let n = e.match(/[\d.]+/g)?.map(Number) ?? [
18
+ 0,
19
+ 0,
20
+ 0,
21
+ 1
22
+ ];
23
+ return [
24
+ n[0] ?? 0,
25
+ n[1] ?? 0,
26
+ n[2] ?? 0,
27
+ n[3] ?? 1
28
+ ];
29
+ }
30
+ function s(e) {
31
+ let t = e.querySelector(":scope > [data-chart-probe]");
32
+ t || (t = document.createElement("span"), t.dataset.chartProbe = "", t.style.display = "none", e.appendChild(t));
33
+ let n = document.createElement("canvas").getContext("2d"), r = /* @__PURE__ */ new Map(), i = t;
34
+ function a(e) {
35
+ let t = r.get(e);
36
+ if (!t) {
37
+ i.style.color = "", i.style.color = e;
38
+ let a = getComputedStyle(i).color;
39
+ n && (n.fillStyle = "#000", n.fillStyle = a, a = String(n.fillStyle)), t = o(a), r.set(e, t);
40
+ }
41
+ return t;
42
+ }
43
+ let s = (e, t) => {
44
+ let [n, r, i, o] = a(e);
45
+ return `rgba(${n}, ${r}, ${i}, ${+(o * t).toFixed(3)})`;
46
+ }, c = (e) => s(e, 1);
47
+ return {
48
+ color: c,
49
+ alpha: s,
50
+ heading: c("var(--color-heading)"),
51
+ body: c("var(--color-body)"),
52
+ muted: c("var(--color-muted)"),
53
+ border: c("var(--color-border)"),
54
+ borderDark: c("var(--color-border-dark)"),
55
+ surface: c("var(--color-surface)"),
56
+ sunken: c("var(--color-surface-sunken)"),
57
+ primary: c("var(--color-primary)"),
58
+ font: getComputedStyle(e).fontFamily || "Roboto, sans-serif",
59
+ reducedMotion: typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches
60
+ };
61
+ }
62
+ function c(e) {
63
+ return {
64
+ axisLine: { lineStyle: { color: e.border } },
65
+ axisTick: { show: !1 },
66
+ axisLabel: {
67
+ color: e.muted,
68
+ fontSize: 11,
69
+ fontFamily: e.font,
70
+ hideOverlap: !0
71
+ },
72
+ splitLine: { lineStyle: {
73
+ color: e.border,
74
+ type: "dashed"
75
+ } },
76
+ nameTextStyle: {
77
+ color: e.muted,
78
+ fontSize: 11,
79
+ fontFamily: e.font
80
+ }
81
+ };
82
+ }
83
+ var l = /* @__PURE__ */ new Map();
84
+ function u(e, t) {
85
+ return l.has(e) || l.set(e, t()), l.get(e);
86
+ }
87
+ function d(a) {
88
+ let o = t(), c = t(), l, d, f, p = 0;
89
+ function m() {
90
+ let e = a.host.value;
91
+ e?.parentElement && (c.value = s(e.parentElement));
92
+ }
93
+ function h() {
94
+ l?.disconnect(), o.value?.dispose(), o.value = void 0;
95
+ }
96
+ async function g(e) {
97
+ let t = ++p;
98
+ if (h(), !e) return;
99
+ let n = a.renderer();
100
+ if (await Promise.all([n === "svg" ? u("svg", () => import("echarts/renderers").then((e) => i([e.SVGRenderer]))) : void 0, a.prepare?.()]), t !== p || a.host.value !== e) return;
101
+ m();
102
+ let s = r(e, void 0, { renderer: n });
103
+ o.value = s, a.setup?.(s), _(), typeof ResizeObserver < "u" && (l = new ResizeObserver(() => s.resize()), l.observe(e));
104
+ }
105
+ function _() {
106
+ let e = o.value;
107
+ if (!e || !c.value) return;
108
+ let t = a.option(c.value), n = e.getOption()?.dataZoom;
109
+ t.dataZoom && n?.length && (t.dataZoom = t.dataZoom.map((e, t) => ({
110
+ ...e,
111
+ start: n[t]?.start ?? e.start,
112
+ end: n[t]?.end ?? e.end
113
+ }))), e.setOption(t, {
114
+ notMerge: !0,
115
+ lazyUpdate: !0
116
+ });
117
+ }
118
+ return n(a.host, (e) => void g(e), {
119
+ immediate: !0,
120
+ flush: "post"
121
+ }), n(a.renderer, () => void g(a.host.value)), n(() => c.value ? a.option(c.value) : null, _), typeof window < "u" && (d = new MutationObserver(() => {
122
+ m(), _();
123
+ }), d.observe(document.documentElement, {
124
+ attributes: !0,
125
+ attributeFilter: [
126
+ "class",
127
+ "style",
128
+ "data-theme"
129
+ ]
130
+ }), d.observe(document.body, {
131
+ attributes: !0,
132
+ attributeFilter: ["class"]
133
+ }), f = window.matchMedia?.("(prefers-color-scheme: dark)"), f?.addEventListener("change", m)), e(() => {
134
+ p++, d?.disconnect(), f?.removeEventListener("change", m), h();
135
+ }), {
136
+ chart: o,
137
+ theme: c
138
+ };
139
+ }
140
+ function f(e, t) {
141
+ let n = 0, r = e.length - 1;
142
+ if (r < 0) return -1;
143
+ for (; n < r;) {
144
+ let i = n + r >> 1;
145
+ e[i] < t ? n = i + 1 : r = i;
146
+ }
147
+ return n > 0 && Math.abs(e[n - 1] - t) <= Math.abs(e[n] - t) ? n - 1 : n;
148
+ }
149
+ function p(e, t, n, r) {
150
+ let i = e.getZr();
151
+ i.on("mousemove", (i) => {
152
+ let a = [i.offsetX, i.offsetY];
153
+ if (!e.containPixel({ gridIndex: 0 }, a)) return r();
154
+ let o = t(a);
155
+ if (o === null || o < 0 || !i.event) return r();
156
+ n(o, i.event.clientX, i.event.clientY);
157
+ }), i.on("globalout", r);
158
+ }
159
+ function m(e, t, n) {
160
+ e.on("mousemove", (e) => {
161
+ let n = e, r = n.event?.event;
162
+ r && n.dataIndex !== void 0 && t({
163
+ seriesIndex: n.seriesIndex ?? 0,
164
+ dataIndex: n.dataIndex,
165
+ dataType: n.dataType,
166
+ data: n.data,
167
+ clientX: r.clientX,
168
+ clientY: r.clientY
169
+ });
170
+ }), e.on("mouseout", n), e.getZr().on("globalout", n);
171
+ }
172
+ //#endregion
173
+ export { c as axisStyle, p as bindAxisHover, m as bindItemHover, u as loadOnce, f as nearestIndex, s as readChartTheme, d as useEChart };
@@ -0,0 +1,77 @@
1
+ import type { Component } from "vue";
2
+ /** Node diameter in px at 100% zoom. */
3
+ export declare const NODE_SIZE = 40;
4
+ /** Gap between a node and its label. */
5
+ export declare const LABEL_GAP = 6;
6
+ export declare const NAME_LINE = 16;
7
+ export declare const KIND_LINE = 14;
8
+ export declare const GROUP_PAD = 10;
9
+ /** Room above a group's nodes for its name. */
10
+ export declare const GROUP_TITLE = 20;
11
+ export interface LayoutNode {
12
+ id: string;
13
+ label: string;
14
+ kind: string;
15
+ group?: string;
16
+ badge: boolean;
17
+ }
18
+ export interface LayoutLink {
19
+ source: string;
20
+ target: string;
21
+ label: string;
22
+ }
23
+ export interface GroupBox {
24
+ name: string;
25
+ /** Top-left corner and size, in layout px. */
26
+ x: number;
27
+ y: number;
28
+ width: number;
29
+ height: number;
30
+ }
31
+ export interface Bounds {
32
+ minX: number;
33
+ minY: number;
34
+ maxX: number;
35
+ maxY: number;
36
+ }
37
+ export interface GraphLayout {
38
+ /** Node centres in layout px (100% zoom). */
39
+ positions: Map<string, [number, number]>;
40
+ groups: GroupBox[];
41
+ /** Bounds of the node centres: what ECharts fits into the view. */
42
+ centers: Bounds;
43
+ /** Half the label width per node and detail, in screen px: labels keep their size at any zoom. */
44
+ labelHalf: Map<string, Record<LabelDetail, number>>;
45
+ }
46
+ /** How much text a node shows: name and kind, the name only, or only the problem badge. Set by the screen scale. */
47
+ export type LabelDetail = "full" | "name" | "badge";
48
+ /** The detail that still reads at a screen scale: everything from 60%, names from 40%. */
49
+ export declare const LABEL_DETAILS: LabelDetail[];
50
+ export declare function labelDetail(scale: number): LabelDetail;
51
+ export declare function truncate(text: string, max: number): string;
52
+ export declare function nodeName(label: string): string;
53
+ export declare function nodeKind(kind: string): string;
54
+ /** Layered layout: ranks follow the links, and nodes of a group are kept together as a dagre cluster. */
55
+ export declare function layoutGraph(nodes: LayoutNode[], links: LayoutLink[], direction: "LR" | "TB"): GraphLayout;
56
+ /**
57
+ * How far the drawing reaches past the node centres' box, in screen px at `scale`.
58
+ * Nodes and group boxes scale; labels don't, so the answer isn't linear in `scale`.
59
+ */
60
+ export declare function overhang(layout: GraphLayout, scale: number, detail: LabelDetail): {
61
+ left: number;
62
+ top: number;
63
+ right: number;
64
+ bottom: number;
65
+ };
66
+ export interface NodeImageOptions {
67
+ icon: Component | string;
68
+ /** Resolved colours (ECharts and SVG images can't read CSS variables). */
69
+ iconColor: string;
70
+ fill: string;
71
+ ring: string;
72
+ ringWidth: number;
73
+ shape: "circle" | "square";
74
+ font: string;
75
+ }
76
+ /** One node as an `image://` symbol: fill, ring and icon in a 40×40 view box, rasterised large enough to stay sharp at 150% on a 2× screen. */
77
+ export declare function nodeImage(o: NodeImageOptions): string;
@@ -0,0 +1,155 @@
1
+ import { h as e, render as t } from "vue";
2
+ import n from "@dagrejs/dagre";
3
+ var r = 20, i = 22, a = 24, o = 18, s = "\0group:", c = [
4
+ "full",
5
+ "name",
6
+ "badge"
7
+ ];
8
+ function l(e) {
9
+ return e >= .6 ? "full" : e >= .4 ? "name" : "badge";
10
+ }
11
+ var u = {
12
+ full: 36,
13
+ name: 22,
14
+ badge: 22
15
+ };
16
+ function d(e, t) {
17
+ return e.length > t ? `${e.slice(0, t - 1)}…` : e;
18
+ }
19
+ function f(e) {
20
+ return d(e, i);
21
+ }
22
+ function p(e) {
23
+ return d(e, a);
24
+ }
25
+ function m(e) {
26
+ let t = e.badge ? o : 0, n = f(e.label).length * 6.8 + t, r = p(e.kind).length * 6.2;
27
+ return {
28
+ full: Math.max(n, r) + 8,
29
+ name: n + 8,
30
+ badge: t
31
+ };
32
+ }
33
+ function h(e, t, r) {
34
+ let i = new n.graphlib.Graph({
35
+ compound: !0,
36
+ multigraph: !0
37
+ });
38
+ i.setGraph(r === "TB" ? {
39
+ rankdir: "TB",
40
+ nodesep: 28,
41
+ ranksep: 44,
42
+ edgesep: 52
43
+ } : {
44
+ rankdir: "LR",
45
+ nodesep: 20,
46
+ ranksep: 72,
47
+ edgesep: 52
48
+ }), i.setDefaultEdgeLabel(() => ({}));
49
+ let a = /* @__PURE__ */ new Map();
50
+ for (let t of e) {
51
+ let e = m(t);
52
+ a.set(t.id, {
53
+ full: e.full / 2,
54
+ name: e.name / 2,
55
+ badge: e.badge / 2
56
+ });
57
+ let n = Math.max(40, e.full);
58
+ if (i.setNode(t.id, {
59
+ width: n,
60
+ height: 76
61
+ }), t.group) {
62
+ let e = s + t.group;
63
+ i.hasNode(e) || i.setNode(e, {
64
+ width: 0,
65
+ height: 0
66
+ }), i.setParent(t.id, e);
67
+ }
68
+ }
69
+ t.forEach((e, t) => {
70
+ let n = e.label ? {
71
+ width: e.label.length * 6.4 + 16,
72
+ height: 18,
73
+ labelpos: "c"
74
+ } : {};
75
+ i.setEdge(e.source, e.target, n, String(t));
76
+ }), n.layout(i);
77
+ let o = /* @__PURE__ */ new Map(), c = {
78
+ minX: Infinity,
79
+ minY: Infinity,
80
+ maxX: -Infinity,
81
+ maxY: -Infinity
82
+ };
83
+ for (let t of e) {
84
+ let e = i.node(t.id), n = e.x ?? 0, r = (e.y ?? 0) - 38 + 20;
85
+ o.set(t.id, [n, r]), _(c, n, r, n, r);
86
+ }
87
+ let l = [];
88
+ for (let e of i.nodes()) {
89
+ if (!e.startsWith(s)) continue;
90
+ let t = i.node(e), n = (t.x ?? 0) - t.width / 2 - 10, r = (t.y ?? 0) - t.height / 2 - 10 - 20, a = {
91
+ name: e.slice(7),
92
+ x: n,
93
+ y: r,
94
+ width: t.width + 20,
95
+ height: t.height + 20 + 20
96
+ };
97
+ l.push(a);
98
+ }
99
+ return e.length || Object.assign(c, {
100
+ minX: 0,
101
+ minY: 0,
102
+ maxX: 0,
103
+ maxY: 0
104
+ }), {
105
+ positions: o,
106
+ groups: l,
107
+ centers: c,
108
+ labelHalf: a
109
+ };
110
+ }
111
+ function g(e, t, n) {
112
+ let { centers: r } = e, i = {
113
+ left: 0,
114
+ top: 0,
115
+ right: 0,
116
+ bottom: 0
117
+ }, a = u[n];
118
+ for (let [o, [s, c]] of e.positions) {
119
+ let l = e.labelHalf.get(o)?.[n] ?? 0, u = Math.max(20 * t, l);
120
+ i.left = Math.max(i.left, u - (s - r.minX) * t), i.right = Math.max(i.right, u - (r.maxX - s) * t), i.top = Math.max(i.top, 20 * t - (c - r.minY) * t);
121
+ let d = n === "badge" && !l ? 0 : a;
122
+ i.bottom = Math.max(i.bottom, 20 * t + d - (r.maxY - c) * t);
123
+ }
124
+ for (let n of e.groups) i.left = Math.max(i.left, (r.minX - n.x) * t), i.right = Math.max(i.right, (n.x + n.width - r.maxX) * t), i.top = Math.max(i.top, (r.minY - n.y) * t), i.bottom = Math.max(i.bottom, (n.y + n.height - r.maxY) * t);
125
+ return i;
126
+ }
127
+ function _(e, t, n, r, i) {
128
+ e.minX = Math.min(e.minX, t), e.minY = Math.min(e.minY, n), e.maxX = Math.max(e.maxX, r), e.maxY = Math.max(e.maxY, i);
129
+ }
130
+ var v = /* @__PURE__ */ new WeakMap();
131
+ function y(n) {
132
+ let i = v.get(n);
133
+ if (i !== void 0) return i;
134
+ if (i = "", typeof document < "u") {
135
+ let a = document.createElement("div");
136
+ t(e(n, {
137
+ size: r,
138
+ width: r,
139
+ height: r
140
+ }), a);
141
+ let o = a.querySelector("svg");
142
+ o && (o.removeAttribute("class"), o.setAttribute("x", "10"), o.setAttribute("y", "10"), o.setAttribute("width", String(r)), o.setAttribute("height", String(r)), i = new XMLSerializer().serializeToString(o)), t(null, a);
143
+ }
144
+ return v.set(n, i), i;
145
+ }
146
+ function b(e) {
147
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
148
+ }
149
+ var x = 160;
150
+ function S(e) {
151
+ let t = e.ringWidth / 2, n = 40 - e.ringWidth, r = `<svg xmlns="http://www.w3.org/2000/svg" width="${x}" height="${x}" viewBox="0 0 40 40">${e.shape === "square" ? `<rect x="${t}" y="${t}" width="${n}" height="${n}" rx="10" fill="${e.fill}" stroke="${e.ring}" stroke-width="${e.ringWidth}"/>` : `<circle cx="20" cy="20" r="${n / 2}" fill="${e.fill}" stroke="${e.ring}" stroke-width="${e.ringWidth}"/>`}${typeof e.icon == "string" ? `<text x="20" y="20" text-anchor="middle" dominant-baseline="central" font-size="11" font-weight="600" font-family="${b(e.font)}" fill="${e.iconColor}">${b(e.icon.slice(0, 3))}</text>` : `<g color="${e.iconColor}">${y(e.icon)}</g>`}</svg>`;
152
+ return `image://data:image/svg+xml;charset=utf-8,${encodeURIComponent(r)}`;
153
+ }
154
+ //#endregion
155
+ export { c as LABEL_DETAILS, l as labelDetail, h as layoutGraph, S as nodeImage, p as nodeKind, f as nodeName, g as overhang, d as truncate };
@@ -2,6 +2,10 @@ export { default as AcLineChart } from "../components/AcLineChart.vue";
2
2
  export { default as AcAreaChart } from "../components/AcAreaChart.vue";
3
3
  export { default as AcBarChart } from "../components/AcBarChart.vue";
4
4
  export { default as AcDonutChart } from "../components/AcDonutChart.vue";
5
+ export { default as AcGraphChart } from "../components/AcGraphChart.vue";
6
+ export { default as AcMapChart } from "../components/AcMapChart.vue";
5
7
  export type { ChartAccessor, ChartCategory, ChartColor, ChartCurve, ChartDatum, ChartLegendPosition, ChartTooltipItem, } from "./shared";
6
8
  export type { ChartTooltipSlotProps } from "./ChartFrame.vue";
7
9
  export type { XYChartProps } from "./xy";
10
+ export type { MapChartTooltipSlotProps, MapGeoJson, MapPoint, MapPointStatus } from "../components/AcMapChart.vue";
11
+ export type { GraphLink, GraphNode, GraphStatus, GraphTooltipSlotProps } from "../components/AcGraphChart.vue";
@@ -2,4 +2,6 @@ import e from "../components/AcLineChart.js";
2
2
  import t from "../components/AcAreaChart.js";
3
3
  import n from "../components/AcBarChart.js";
4
4
  import r from "../components/AcDonutChart.js";
5
- export { t as AcAreaChart, n as AcBarChart, r as AcDonutChart, e as AcLineChart };
5
+ import i from "../components/AcGraphChart.js";
6
+ import a from "../components/AcMapChart.js";
7
+ export { t as AcAreaChart, n as AcBarChart, r as AcDonutChart, i as AcGraphChart, e as AcLineChart, a as AcMapChart };
@@ -51,10 +51,3 @@ export declare function timeFormatters(values: number[]): {
51
51
  tick: (t: number) => string;
52
52
  title: (t: number) => string;
53
53
  };
54
- /** Rounds an axis maximum up to a tidy step, like d3's `nice()`. */
55
- export declare function niceMax(max: number, ticks?: number): number;
56
- /** Every k-th index so at most `max` category ticks are drawn. */
57
- export declare function categoryTicks(count: number, max: number): number[];
58
- /** Unovis animation length; 0 when the viewer asks for reduced motion. */
59
- export declare function chartDuration(): number;
60
- export declare const CURVES: Record<ChartCurve, string>;
@@ -92,23 +92,5 @@ function h(e) {
92
92
  title: (e) => n ? u.format(e) : r ? l.format(e) : c.format(e)
93
93
  };
94
94
  }
95
- function g(e, t = 5) {
96
- if (!(e > 0)) return e;
97
- let n = e / t, r = 10 ** Math.floor(Math.log10(n)), i = n / r;
98
- return r *= i >= 7.5 ? 10 : i >= 3.5 ? 5 : i >= 1.5 ? 2 : 1, Math.ceil(e / r) * r;
99
- }
100
- function _(e, t) {
101
- let n = Math.max(1, Math.ceil(e / Math.max(1, t))), r = [];
102
- for (let t = 0; t < e; t += n) r.push(t);
103
- return r;
104
- }
105
- function v() {
106
- return typeof window > "u" || !window.matchMedia ? 300 : window.matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : 300;
107
- }
108
- var y = {
109
- linear: "linear",
110
- monotone: "monotoneX",
111
- step: "step"
112
- };
113
95
  //#endregion
114
- export { y as CURVES, _ as categoryTicks, n as chartColor, v as chartDuration, l as detectXKind, o as formatCompact, g as niceMax, i as readNumber, r as readValue, h as timeFormatters, d as toTimestamp };
96
+ export { n as chartColor, l as detectXKind, o as formatCompact, i as readNumber, r as readValue, h as timeFormatters, d as toTimestamp };
@@ -32,8 +32,16 @@ export interface XYChartProps {
32
32
  title?: string;
33
33
  /** A sentence for screen readers on what the chart shows. Defaults to the series names and the x range. */
34
34
  description?: string;
35
+ /** Adds zoom and pan along the x axis: drag the slider under the plot, or scroll and pinch over it. For long time series. */
36
+ zoom?: boolean;
37
+ /** `canvas` (default) stays fast with tens of thousands of points; `svg` is crisper when printed and lighter for a few dozen. */
38
+ renderer?: "canvas" | "svg";
39
+ /** Animates the first draw and updates. Off by itself above 2,000 rows and when the viewer asks for reduced motion. */
40
+ animation?: boolean;
35
41
  }
36
- export type XYChartDefaults = Required<Pick<XYChartProps, "height" | "legend" | "tooltip" | "gridLines" | "loading" | "emptyText">>;
42
+ export type XYChartDefaults = Required<Pick<XYChartProps, "height" | "legend" | "tooltip" | "gridLines" | "loading" | "emptyText" | "zoom" | "renderer" | "animation">>;
43
+ /** Rows above this draw without animation and without point markers, and line series are sampled (LTTB). */
44
+ export declare const LARGE_DATA = 2000;
37
45
  /** `positions` places x by index (bars); otherwise time and number x values keep their real spacing. */
38
46
  export declare function useXYChart(props: XYChartProps, options: {
39
47
  stacked: () => boolean;
@@ -45,19 +53,15 @@ export declare function useXYChart(props: XYChartProps, options: {
45
53
  keys: import("vue").ComputedRef<string[]>;
46
54
  visibleKeys: import("vue").ComputedRef<string[]>;
47
55
  colorOf: import("vue").ComputedRef<Record<string, string>>;
48
- colors: import("vue").ComputedRef<string[]>;
49
56
  legendItems: import("vue").ComputedRef<ChartLegendItem[]>;
50
57
  xKind: import("vue").ComputedRef<import("./shared").XKind>;
58
+ rawX: import("vue").ComputedRef<unknown[]>;
59
+ xNumbers: import("vue").ComputedRef<number[]>;
51
60
  byPosition: import("vue").ComputedRef<boolean>;
52
- x: (_d: ChartDatum, i: number) => number;
53
- yAccessors: import("vue").ComputedRef<((d: ChartDatum) => number | null)[]>;
54
- xTickValues: import("vue").ComputedRef<number[] | undefined>;
55
- maxXTicks: import("vue").ComputedRef<number>;
56
61
  yTicks: import("vue").ComputedRef<number>;
57
62
  xTickFormat: (tick: number | Date) => string;
58
63
  formatY: (v: number | null) => string;
59
64
  rowLabel: (i: number) => string;
60
- yDomain: import("vue").ComputedRef<[number | undefined, number | undefined]>;
61
65
  tooltipItems: (d: ChartDatum) => ChartTooltipItem[];
62
66
  tooltipTotal: (d: ChartDatum) => string;
63
67
  table: import("vue").ComputedRef<ChartTable>;