x-next 1.8.4 → 1.10.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 (37) hide show
  1. package/AI_USAGE.md +67 -7
  2. package/CHANGELOG.md +44 -0
  3. package/dist/_styles/palette-aliases.d.ts +1 -0
  4. package/dist/_utils/chart/scale.d.ts +1 -1
  5. package/dist/components/_components/chart/axis-labels.d.ts +8 -0
  6. package/dist/components/link/Link.vue.d.ts +1 -1
  7. package/dist/components/link/index.d.ts +3 -3
  8. package/dist/components/virtual-list-v2/interface.d.ts +3 -0
  9. package/dist/components/virtual-list-v2/virtual-list.vue.d.ts +336 -1
  10. package/dist/es/_hooks/use-component-ref.js +9 -9
  11. package/dist/es/_styles/palette-aliases.js +30 -1
  12. package/dist/es/_utils/chart/scale.js +44 -39
  13. package/dist/es/_utils/palette.js +37 -35
  14. package/dist/es/components/_components/chart/ChartAxis.js +61 -36
  15. package/dist/es/components/_components/chart/axis-labels.js +26 -0
  16. package/dist/es/components/button/Button.js +23 -23
  17. package/dist/es/components/form-select/Select.js +142 -141
  18. package/dist/es/components/trigger/Trigger.js +174 -183
  19. package/dist/es/components/virtual-list-v2/virtual-list.vue.js +22 -23
  20. package/dist/es/components/virtual-list-v2/virtual-list.vue2.js +67 -53
  21. package/dist/es/icons/icon.js +37 -36
  22. package/dist/es/icons/index.js +6 -8
  23. package/dist/es/icons/public/lucide-names.js +167 -0
  24. package/dist/es/icons/public/lucide.js +75 -188
  25. package/dist/es/index.js +152 -148
  26. package/dist/es/style.css +1 -1
  27. package/dist/icons/index.d.ts +3 -3
  28. package/dist/icons/names.d.ts +2 -2
  29. package/dist/icons/public/lucide-names.d.ts +32 -0
  30. package/dist/icons/public/lucide.d.ts +2 -2
  31. package/dist/index.cjs +3 -62
  32. package/dist/index.umd.js +3 -62
  33. package/dist/style/base.css +1 -1
  34. package/dist/style/button.css +1 -1
  35. package/dist/style/heatmap.css +1 -1
  36. package/dist/style.css +1 -1
  37. package/package.json +3 -2
@@ -248,7 +248,36 @@ const r = {
248
248
  "--x-notification-color-accent-warning": "var(--x-color-warning-solid)",
249
249
  "--x-notification-color-icon-bg-warning": "var(--x-color-warning-subtle)"
250
250
  }
251
+ }, o = {
252
+ primary: {
253
+ "--x-color-primary-button-text": "var(--x-color-primary-7)",
254
+ "--x-color-primary-text": "var(--x-color-primary-7)",
255
+ "--x-heatmap-color-level-1": "var(--x-color-primary-3)",
256
+ "--x-heatmap-color-level-2": "var(--x-color-primary-4)",
257
+ "--x-heatmap-color-level-3": "var(--x-color-primary-5)",
258
+ "--x-heatmap-color-level-4": "var(--x-color-primary-6)",
259
+ "--x-heatmap-color-level-5": "var(--x-color-primary-7)",
260
+ "--x-tag-color-better-blue-bg": "rgb(28 47 89)",
261
+ "--x-tag-color-better-blue-border-hover": "rgb(37 59 109)"
262
+ },
263
+ success: {
264
+ "--x-color-success-button-text": "var(--x-color-success-7)",
265
+ "--x-color-success-text": "var(--x-color-success-7)"
266
+ },
267
+ danger: {
268
+ "--x-color-danger-button-text": "var(--x-color-danger-8)",
269
+ "--x-color-danger-text": "var(--x-color-danger-8)"
270
+ },
271
+ strong: {
272
+ "--x-color-strong-button-text": "var(--x-color-strong-7)",
273
+ "--x-color-strong-text": "var(--x-color-strong-7)"
274
+ },
275
+ warning: {
276
+ "--x-color-warning-button-text": "var(--x-color-warning-7)",
277
+ "--x-color-warning-text": "var(--x-color-warning-7)"
278
+ }
251
279
  };
252
280
  export {
253
- r as PALETTE_ALIASES
281
+ r as PALETTE_ALIASES,
282
+ o as PALETTE_ALIASES_DARK
254
283
  };
@@ -1,77 +1,82 @@
1
- const h = (t) => Number(t.toPrecision(12)), g = (t) => Number(t.toFixed(4)), f = (t) => Math.max(2, Math.floor(t)), p = (t) => {
1
+ const a = (t) => Number(t.toPrecision(12)), g = (t) => Number(t.toFixed(4)), f = (t) => Math.max(2, Math.floor(t)), F = (t) => {
2
2
  if (!Number.isFinite(t) || t <= 0) return 0;
3
- const e = 10 ** Math.floor(Math.log10(t)), i = t / e;
4
- return e * (i <= 1 ? 1 : i <= 2 ? 2 : i <= 5 ? 5 : 10);
5
- }, x = (t, e = 4) => {
3
+ const n = 10 ** Math.floor(Math.log10(t)), e = t / n;
4
+ return n * (e <= 1 ? 1 : e <= 2 ? 2 : e <= 5 ? 5 : 10);
5
+ }, x = (t, n = 4) => {
6
6
  if (!Number.isFinite(t) || t <= 0)
7
7
  return { max: 0, ticks: [0] };
8
- const i = f(e) - 1, s = p(t / i), r = h(Math.ceil(t / s) * s), n = Math.round(r / s);
8
+ const e = f(n) - 1, s = F(t / e), r = a(Math.ceil(t / s) * s), i = Math.round(r / s);
9
9
  return {
10
10
  max: r,
11
- ticks: Array.from({ length: n + 1 }, (o, c) => h(s * c))
11
+ ticks: Array.from({ length: i + 1 }, (o, c) => a(s * c))
12
12
  };
13
- }, M = (t, e = 4, i) => {
14
- const s = f(e);
15
- if (Number.isFinite(i) && i > 0) {
16
- const r = i, n = s - 1;
13
+ }, d = (t, n = 4, e) => {
14
+ const s = f(n);
15
+ if (Number.isFinite(e) && e > 0) {
16
+ const r = e, i = s - 1;
17
17
  return {
18
18
  max: r,
19
19
  ticks: Array.from(
20
- { length: n + 1 },
21
- (o, c) => g(r / n * c)
20
+ { length: i + 1 },
21
+ (o, c) => g(r / i * c)
22
22
  )
23
23
  };
24
24
  }
25
25
  return x(t, s);
26
- }, d = (t, e, i = 4) => {
27
- const s = Number.isFinite(t) ? t : 0, r = Number.isFinite(e) ? e : 0, n = Math.min(0, s), o = Math.max(0, r);
28
- if (n === 0 && o === 0)
26
+ }, M = (t, n, e = 4) => {
27
+ const s = Number.isFinite(t) ? t : 0, r = Number.isFinite(n) ? n : 0, i = Math.min(0, s), o = Math.max(0, r);
28
+ if (i === 0 && o === 0)
29
29
  return { min: 0, max: 0, ticks: [0] };
30
- const c = f(i) - 1, u = p((o - n) / c), l = h(Math.floor(n / u) * u), m = h(Math.ceil(o / u) * u), a = Math.round((m - l) / u);
30
+ const c = f(e) - 1, u = F((o - i) / c), h = a(Math.floor(i / u) * u), m = a(Math.ceil(o / u) * u), l = Math.round((m - h) / u);
31
31
  return {
32
- min: l,
32
+ min: h,
33
33
  max: m,
34
- ticks: Array.from({ length: a + 1 }, (N, b) => h(l + u * b))
34
+ ticks: Array.from({ length: l + 1 }, (N, b) => a(h + u * b))
35
35
  };
36
- }, A = (t, e, i = 4, s, r) => {
37
- const n = f(i), o = Number.isFinite(s), c = Number.isFinite(r);
36
+ }, A = (t, n, e = 4, s, r) => {
37
+ const i = f(e), o = Number.isFinite(s), c = Number.isFinite(r);
38
38
  if (!o && !c)
39
- return d(t, e, n);
40
- const u = Math.min(0, Number.isFinite(t) ? t : 0), l = Math.max(0, Number.isFinite(e) ? e : 0);
41
- let m = o ? s : u, a = c ? r : l;
42
- m > a && ([m, a] = [a, m]);
43
- const N = n - 1;
39
+ return M(t, n, i);
40
+ const u = Math.min(0, Number.isFinite(t) ? t : 0), h = Math.max(0, Number.isFinite(n) ? n : 0);
41
+ let m = o ? s : u, l = c ? r : h;
42
+ m > l && ([m, l] = [l, m]);
43
+ const N = i - 1;
44
44
  return {
45
45
  min: m,
46
- max: a,
46
+ max: l,
47
47
  ticks: Array.from(
48
48
  { length: N + 1 },
49
- (b, F) => g(m + (a - m) / N * F)
49
+ (b, p) => g(m + (l - m) / N * p)
50
50
  )
51
51
  };
52
52
  }, k = (t) => {
53
53
  if (!Number.isFinite(t)) return "";
54
- const e = Number(Number(t.toPrecision(12)).toFixed(4)), [i, s] = String(Math.abs(e)).split("."), r = i.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
55
- return `${e < 0 ? "-" : ""}${r}${s ? `.${s}` : ""}`;
56
- }, y = (t, e) => {
57
- let i = 0;
54
+ const n = Number(Number(t.toPrecision(12)).toFixed(4)), [e, s] = String(Math.abs(n)).split("."), r = e.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
55
+ return `${n < 0 ? "-" : ""}${r}${s ? `.${s}` : ""}`;
56
+ }, y = (t, n) => {
57
+ let e = 0;
58
58
  for (const s of t)
59
- i += s.charCodeAt(0) > 255 ? 1 : 0.6;
60
- return i * e;
61
- }, S = (t, e, i, s = 8) => {
59
+ e += s.charCodeAt(0) > 255 ? 1 : 0.6;
60
+ return e * n;
61
+ }, S = (t, n, e, s = 8) => {
62
62
  if (t <= 0) return [];
63
- const r = Math.max(1, Math.ceil((i + s) / Math.max(e, 1))), n = [];
63
+ const r = Math.max(1, Math.ceil((e + s) / Math.max(n, 1))), i = [];
64
64
  for (let c = 0; c < t; c += r)
65
- n.push(c);
65
+ i.push(c);
66
66
  const o = t - 1;
67
- return n[n.length - 1] !== o && (n.length > 1 && o - n[n.length - 1] < r * 0.6 && n.pop(), n.push(o)), n;
67
+ if (i[i.length - 1] !== o) {
68
+ for (; i.length && (o - i[i.length - 1]) * n < e + s; )
69
+ i.pop();
70
+ i.push(o);
71
+ }
72
+ return i;
68
73
  };
69
74
  export {
70
75
  k as defaultValueFormatter,
71
76
  y as estimateTextWidth,
72
77
  A as getDomain,
73
- d as getNiceDomain,
78
+ M as getNiceDomain,
74
79
  x as getNiceScale,
75
- M as getScale,
80
+ d as getScale,
76
81
  S as pickLabelIndices
77
82
  };
@@ -1,63 +1,65 @@
1
- import { PALETTE_ALIASES as g } from "../_styles/palette-aliases.js";
2
- const x = 2.05, d = 95.5, p = 22, b = [1, 0.8, 0.6, 0.4, 0.2], y = [1 / 3, 2 / 3, 1], E = 90, _ = 300, m = (s, i, a) => Math.min(a, Math.max(i, s)), A = (s) => {
1
+ import { PALETTE_ALIASES as g, PALETTE_ALIASES_DARK as E } from "../_styles/palette-aliases.js";
2
+ const x = 2.05, d = 95.5, p = 22, A = [1, 0.8, 0.6, 0.4, 0.2], _ = [1 / 3, 2 / 3, 1], b = 90, y = 300, m = (s, a, i) => Math.min(i, Math.max(a, s)), $ = (s) => {
3
3
  if (typeof s != "string") return null;
4
- const i = s.trim();
5
- if (i.startsWith("#")) {
6
- const t = i.slice(1);
4
+ const a = s.trim();
5
+ if (a.startsWith("#")) {
6
+ const t = a.slice(1);
7
7
  if (!/^(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)) return null;
8
8
  const c = t.length === 3 ? [...t].map((h) => h + h).join("") : t.length === 6 || t.length === 8 ? t.slice(0, 6) : null;
9
9
  return c ? [0, 2, 4].map((h) => parseInt(c.slice(h, h + 2), 16)) : null;
10
10
  }
11
- const a = i.match(/^rgba?\(([^)]+)\)$/i);
12
- if (!a) return null;
13
- const o = a[1].trim(), r = o.includes(",") ? o.split(",").map((t) => t.trim()) : o.split(/\s*\/\s*/)[0].split(/\s+/), e = o.includes(",") ? r[3] : o.includes("/") ? o.split("/")[1].trim() : void 0;
11
+ const i = a.match(/^rgba?\(([^)]+)\)$/i);
12
+ if (!i) return null;
13
+ const o = i[1].trim(), r = o.includes(",") ? o.split(",").map((t) => t.trim()) : o.split(/\s*\/\s*/)[0].split(/\s+/), e = o.includes(",") ? r[3] : o.includes("/") ? o.split("/")[1].trim() : void 0;
14
14
  if (o.split("/").length > 2 || r.length < 3 || r.length > (o.includes(",") ? 4 : 3)) return null;
15
15
  const n = /^[+-]?(?:\d+\.?\d*|\.\d+)%?$/;
16
16
  if (r.slice(0, 3).some((t) => !n.test(t)) || e !== void 0 && !n.test(e)) return null;
17
17
  const l = r.slice(0, 3).map((t) => t.endsWith("%") ? Math.round(parseFloat(t) / 100 * 255) : Number(t));
18
18
  return l.some((t) => !Number.isFinite(t)) ? null : l.map((t) => m(Math.round(t), 0, 255));
19
- }, $ = ([s, i, a]) => {
20
- const o = s / 255, r = i / 255, e = a / 255, n = Math.max(o, r, e), l = Math.min(o, r, e), t = n - l, c = (n + l) / 2;
19
+ }, H = ([s, a, i]) => {
20
+ const o = s / 255, r = a / 255, e = i / 255, n = Math.max(o, r, e), l = Math.min(o, r, e), t = n - l, c = (n + l) / 2;
21
21
  let h = 0, u = 0;
22
22
  return t !== 0 && (u = c > 0.5 ? t / (2 - n - l) : t / (n + l), n === o ? h = (r - e) / t + (r < e ? 6 : 0) : n === r ? h = (e - o) / t + 2 : h = (o - r) / t + 4, h *= 60), { h, s: u * 100, l: c * 100 };
23
- }, H = ({ h: s, s: i, l: a }) => {
24
- const o = m(i, 0, 100) / 100, r = m(a, 0, 100) / 100, e = (s % 360 + 360) % 360, n = (1 - Math.abs(2 * r - 1)) * o, l = n * (1 - Math.abs(e / 60 % 2 - 1)), t = r - n / 2;
23
+ }, S = ({ h: s, s: a, l: i }) => {
24
+ const o = m(a, 0, 100) / 100, r = m(i, 0, 100) / 100, e = (s % 360 + 360) % 360, n = (1 - Math.abs(2 * r - 1)) * o, l = n * (1 - Math.abs(e / 60 % 2 - 1)), t = r - n / 2;
25
25
  let c;
26
26
  return e < 60 ? c = [n, l, 0] : e < 120 ? c = [l, n, 0] : e < 180 ? c = [0, n, l] : e < 240 ? c = [0, l, n] : e < 300 ? c = [l, 0, n] : c = [n, 0, l], c.map((h) => m(Math.round((h + t) * 255), 0, 255));
27
- }, P = (s) => `#${s.map((i) => m(Math.round(i), 0, 255).toString(16).padStart(2, "0")).join("")}`, S = (s) => s <= E || s >= _ ? 1 : -1, I = (s, i = {}) => {
28
- const a = A(s);
29
- if (!a)
27
+ }, P = (s) => `#${s.map((a) => m(Math.round(a), 0, 255).toString(16).padStart(2, "0")).join("")}`, I = (s) => s <= b || s >= y ? 1 : -1, L = (s, a = {}) => {
28
+ const i = $(s);
29
+ if (!i)
30
30
  throw new Error(`[x-next] generatePalette: 无法解析种子色 "${s}"`);
31
- const { h: o, s: r, l: e } = $(a), n = S(o), { dark: l = !1 } = i, t = l ? Math.min(p, e) : Math.max(d, e), c = l ? Math.max(d, e) : Math.min(p, e), h = [];
31
+ const { h: o, s: r, l: e } = H(i), n = I(o), { dark: l = !1 } = a, t = l ? Math.min(p, e) : Math.max(d, e), c = l ? Math.max(d, e) : Math.min(p, e), h = [];
32
32
  for (let u = 0; u < 9; u += 1) {
33
33
  let f;
34
- u < 5 ? f = e + (t - e) * b[u] : u === 5 ? f = e : f = e + (c - e) * y[u - 6];
35
- const M = 5 - u, T = n * x * M * (l ? -1 : 1);
36
- h.push(P(H({ h: o + T, s: r, l: m(f, 0, 100) })));
34
+ u < 5 ? f = e + (t - e) * A[u] : u === 5 ? f = e : f = e + (c - e) * _[u - 6];
35
+ const T = 5 - u, M = n * x * T * (l ? -1 : 1);
36
+ h.push(P(S({ h: o + M, s: r, l: m(f, 0, 100) })));
37
37
  }
38
38
  return h;
39
- }, G = (s, i = {}) => {
40
- const { name: a = "primary", target: o, dark: r } = i, e = I(s, { dark: r }), n = o ?? (typeof document < "u" ? document.documentElement : null);
39
+ }, G = (s, a = {}) => {
40
+ const { name: i = "primary", target: o, dark: r } = a, e = L(s, { dark: r }), n = o ?? (typeof document < "u" ? document.documentElement : null);
41
41
  if (n) {
42
- n.style.setProperty(`--x-color-${a}`, e[5]), e.forEach((t, c) => {
43
- n.style.setProperty(`--x-color-${a}-${c + 1}`, t);
42
+ n.style.setProperty(`--x-color-${i}`, e[5]), e.forEach((t, c) => {
43
+ n.style.setProperty(`--x-color-${i}-${c + 1}`, t);
44
44
  });
45
- const l = g[a];
46
- if (l)
47
- for (const [t, c] of Object.entries(l))
48
- n.style.setProperty(t, c);
45
+ const l = g[i];
46
+ if (l) {
47
+ const t = r ? E[i] : void 0;
48
+ for (const [c, h] of Object.entries(l))
49
+ n.style.setProperty(c, (t == null ? void 0 : t[c]) ?? h);
50
+ }
49
51
  }
50
52
  return e;
51
- }, L = (s = "primary") => {
52
- const i = [`--x-color-${s}`, ...Array.from({ length: 9 }, (o, r) => `--x-color-${s}-${r + 1}`)], a = g[s];
53
- return a ? [...i, ...Object.keys(a)] : i;
53
+ }, W = (s = "primary") => {
54
+ const a = [`--x-color-${s}`, ...Array.from({ length: 9 }, (o, r) => `--x-color-${s}-${r + 1}`)], i = g[s];
55
+ return i ? [...a, ...Object.keys(i)] : a;
54
56
  };
55
57
  export {
56
58
  G as applyThemeColor,
57
- I as generatePalette,
58
- L as getThemeColorProperties,
59
- H as hslToRgb,
60
- A as parseColor,
61
- $ as rgbToHsl,
59
+ L as generatePalette,
60
+ W as getThemeColorProperties,
61
+ S as hslToRgb,
62
+ $ as parseColor,
63
+ H as rgbToHsl,
62
64
  P as toHex
63
65
  };
@@ -1,6 +1,8 @@
1
- import { defineComponent as s, createVNode as a } from "vue";
2
- import { getClassNameMixin as i } from "../../../_utils/config.js";
3
- const y = 6, x = 8, c = /* @__PURE__ */ s({
1
+ import { defineComponent as x, ref as u, computed as h, onMounted as b, watchPostEffect as g, onBeforeUnmount as L, createVNode as n } from "vue";
2
+ import { getClassNameMixin as S } from "../../../_utils/config.js";
3
+ import { layoutAxisLabels as v } from "./axis-labels.js";
4
+ import { estimateTextWidth as z } from "../../../_utils/chart/scale.js";
5
+ const A = 6, w = 8, N = /* @__PURE__ */ x({
4
6
  name: "ChartAxis",
5
7
  props: {
6
8
  plot: {
@@ -36,44 +38,67 @@ const y = 6, x = 8, c = /* @__PURE__ */ s({
36
38
  default: !0
37
39
  }
38
40
  },
39
- setup(e) {
40
- const l = i("chart"), o = () => ({
41
- fontSize: `${e.fontSize}px`,
42
- fill: e.color
43
- });
44
- return () => a("g", null, [e.showHorizontalLines && a("g", {
45
- class: l.element("grid")
46
- }, [e.ticks.map((t, n) => a("line", {
47
- key: n,
48
- class: [l.element("grid-line"), {
49
- [l.is("baseline")]: t.isBaseline
41
+ setup(t) {
42
+ const o = S("chart"), f = () => ({
43
+ fontSize: `${t.fontSize}px`,
44
+ fill: t.color
45
+ }), s = u(), d = u(), m = (e) => v(t.xLabels, t.plot.left, t.plot.right, t.fontSize * 0.6, e), y = h(() => d.value ?? m((e) => z(e, t.fontSize)));
46
+ let i = null, c = !0;
47
+ const a = () => {
48
+ if (!c || !s.value) return;
49
+ const e = getComputedStyle(s.value);
50
+ if (i) {
51
+ i.font = `${e.fontStyle} ${e.fontWeight} ${t.fontSize}px ${e.fontFamily}`;
52
+ const l = Number.parseFloat(e.letterSpacing) || 0;
53
+ d.value = m((r) => i.measureText(r).width + Math.max(0, Array.from(r).length - 1) * l);
54
+ }
55
+ };
56
+ return b(() => {
57
+ var e, l;
58
+ i = document.createElement("canvas").getContext("2d"), a(), (e = document.fonts) == null || e.addEventListener("loadingdone", a), (l = document.fonts) == null || l.ready.then(a);
59
+ }), g(() => {
60
+ t.xLabels, t.plot, t.fontSize, a();
61
+ }), L(() => {
62
+ var e;
63
+ c = !1, (e = document.fonts) == null || e.removeEventListener("loadingdone", a);
64
+ }), () => n("g", {
65
+ ref: s,
66
+ style: {
67
+ fontSize: `${t.fontSize}px`
68
+ }
69
+ }, [t.showHorizontalLines && n("g", {
70
+ class: o.element("grid")
71
+ }, [t.ticks.map((e, l) => n("line", {
72
+ key: l,
73
+ class: [o.element("grid-line"), {
74
+ [o.is("baseline")]: e.isBaseline
50
75
  }],
51
- x1: e.plot.left,
52
- x2: e.plot.left + e.plot.width,
53
- y1: t.y,
54
- y2: t.y
55
- }, null))]), e.showY && a("g", {
56
- class: l.element("y-labels")
57
- }, [e.ticks.map((t, n) => a("text", {
58
- key: n,
59
- class: l.element("axis-label"),
60
- x: e.plot.left - y,
61
- y: t.y,
76
+ x1: t.plot.left,
77
+ x2: t.plot.left + t.plot.width,
78
+ y1: e.y,
79
+ y2: e.y
80
+ }, null))]), t.showY && n("g", {
81
+ class: o.element("y-labels")
82
+ }, [t.ticks.map((e, l) => n("text", {
83
+ key: l,
84
+ class: o.element("axis-label"),
85
+ x: t.plot.left - A,
86
+ y: e.y,
62
87
  "text-anchor": "end",
63
88
  "dominant-baseline": "middle",
64
- style: o()
65
- }, [t.label]))]), e.showX && a("g", {
66
- class: l.element("x-labels")
67
- }, [e.xLabels.map((t, n) => a("text", {
68
- key: n,
69
- class: l.element("axis-label"),
70
- x: t.x,
71
- y: e.plot.bottom + x + e.fontSize * 0.9,
89
+ style: f()
90
+ }, [e.label]))]), t.showX && n("g", {
91
+ class: o.element("x-labels")
92
+ }, [y.value.map((e, l) => n("text", {
93
+ key: l,
94
+ class: o.element("axis-label"),
95
+ x: e.x,
96
+ y: t.plot.bottom + w + t.fontSize * 0.9,
72
97
  "text-anchor": "middle",
73
- style: o()
74
- }, [t.text]))])]);
98
+ style: f()
99
+ }, [e.text, e.title && n("title", null, [e.title])]))])]);
75
100
  }
76
101
  });
77
102
  export {
78
- c as default
103
+ N as default
79
104
  };
@@ -0,0 +1,26 @@
1
+ const M = (h, f, d, u, i) => {
2
+ const n = Math.max(0, d - f);
3
+ if (n <= 0) return [];
4
+ const m = [];
5
+ let I = Number.POSITIVE_INFINITY;
6
+ for (let c = h.length - 1; c >= 0; c--) {
7
+ const l = h[c];
8
+ let e = l.text, t = i(e);
9
+ if (t > n) {
10
+ if (i("…") > n) continue;
11
+ const a = Array.from(e);
12
+ let o = 0, s = a.length;
13
+ for (; o < s; ) {
14
+ const r = Math.ceil((o + s) / 2);
15
+ i(`${a.slice(0, r).join("")}…`) <= n ? o = r : s = r - 1;
16
+ }
17
+ e = `${a.slice(0, o).join("")}…`, t = i(e);
18
+ }
19
+ const x = Math.max(f + t / 2, Math.min(l.x, d - t / 2));
20
+ x + t / 2 + u > I || (m.push({ x, text: e, width: t, ...e !== l.text ? { title: l.text } : {} }), I = x - t / 2);
21
+ }
22
+ return m.reverse();
23
+ };
24
+ export {
25
+ M as layoutAxisLabels
26
+ };
@@ -1,5 +1,5 @@
1
- import { defineComponent as O, getCurrentInstance as P, inject as p, reactive as x, computed as c, withDirectives as T, createVNode as o, resolveDirective as F } from "vue";
2
- import { getClassNameMixin as L } from "../../_utils/config.js";
1
+ import { defineComponent as O, getCurrentInstance as P, inject as x, reactive as F, computed as t, withDirectives as T, createVNode as u, resolveDirective as L } from "vue";
2
+ import { getClassNameMixin as p } from "../../_utils/config.js";
3
3
  import { buttonProps as A } from "./props.js";
4
4
  import B from "../../icons/animation/animation-loading.js";
5
5
  import I from "../../directives/wave.js";
@@ -18,51 +18,51 @@ const H = /* @__PURE__ */ O({
18
18
  slots: l,
19
19
  emit: h
20
20
  }) {
21
- const f = P(), a = p(K, void 0), {
21
+ const s = P(), a = x(K, void 0), {
22
22
  mergedSize: k
23
23
  } = N(void 0, {
24
24
  defaultValue: "medium"
25
- }), r = x({
25
+ }), r = F({
26
26
  clicked: !1,
27
27
  isDebounce: !1
28
- }), i = L("button"), w = (n) => n.replace(/[A-Z]/g, (d) => `-${d.toLowerCase()}`), u = (n) => {
29
- const d = (f == null ? void 0 : f.vnode.props) ?? {};
28
+ }), i = p("button"), w = (n) => n.replace(/[A-Z]/g, (d) => `-${d.toLowerCase()}`), o = (n) => {
29
+ const d = (s == null ? void 0 : s.vnode.props) ?? {};
30
30
  return Object.prototype.hasOwnProperty.call(d, n) || Object.prototype.hasOwnProperty.call(d, w(n));
31
- }, s = c(() => u("type") ? e.type : (a == null ? void 0 : a.type) ?? e.type), v = c(() => u("size") ? e.size : (a == null ? void 0 : a.size) ?? k.value), b = c(() => u("status") ? e.status : (a == null ? void 0 : a.status) ?? e.status), g = c(() => u("shape") ? e.shape : (a == null ? void 0 : a.shape) ?? e.shape), m = c(() => u("disabled") ? e.disabled : (a == null ? void 0 : a.disabled) ?? e.disabled), D = c(() => [i.block, s.value && s.value !== "default" && i.modifier(s.value), v.value && i.modifier(v.value), b.value && i.modifier(b.value), m.value && i.is("disabled"), e.block && i.modifier("block"), e.plain && i.modifier("plain"), g.value && i.modifier(g.value), e.link && i.modifier("link"), !e.border && i.modifier("hide-border"), t.value && i.modifier("loading"), e.loadingFill && i.modifier("loading-fill"), e.narrow && i.modifier("narrow")]), z = () => {
31
+ }, m = t(() => o("type") ? e.type : (a == null ? void 0 : a.type) ?? e.type), v = t(() => o("size") ? e.size : (a == null ? void 0 : a.size) ?? k.value), b = t(() => o("status") ? e.status : (a == null ? void 0 : a.status) ?? e.status), g = t(() => o("shape") ? e.shape : (a == null ? void 0 : a.shape) ?? e.shape), f = t(() => o("disabled") ? e.disabled : (a == null ? void 0 : a.disabled) ?? e.disabled), D = t(() => [i.block, m.value && m.value !== "default" && i.modifier(m.value), v.value && i.modifier(v.value), b.value && i.modifier(b.value), f.value && i.is("disabled"), e.block && i.modifier("block"), e.plain && i.modifier("plain"), g.value && i.modifier(g.value), e.link && i.modifier("link"), !e.border && i.modifier("hide-border"), c.value && i.modifier("loading"), e.loadingFill && i.modifier("loading-fill"), e.narrow && i.modifier("narrow")]), z = () => {
32
32
  e.debounce > 0 && !r.isDebounce && (r.isDebounce = !0, setTimeout(() => {
33
33
  r.isDebounce = !1;
34
34
  }, e.debounce));
35
- }, t = c(() => e.loading || r.clicked || r.isDebounce), S = c(() => m.value || t.value || e.link || s.value === "text"), j = (n) => {
35
+ }, c = t(() => e.loading || r.clicked || r.isDebounce), S = t(() => f.value || c.value || e.link || m.value === "text"), j = (n) => {
36
36
  var d;
37
- n.detail > 0 && ((d = n.currentTarget) == null || d.blur()), !(m.value || t.value) && (z(), h("click", n));
37
+ n.detail > 0 && ((d = n.currentTarget) == null || d.blur()), !(f.value || c.value) && (z(), h("click", n));
38
38
  };
39
39
  return () => {
40
40
  var n, d, y;
41
- return T(o("button", {
41
+ return T(u("button", {
42
42
  class: D.value,
43
43
  type: e.htmlType,
44
- disabled: m.value || t.value,
45
- "aria-busy": t.value || void 0,
44
+ disabled: f.value || c.value,
45
+ "aria-busy": c.value || void 0,
46
46
  onClick: j
47
- }, [o("span", {
47
+ }, [u("span", {
48
48
  class: i.element("loading"),
49
+ "aria-hidden": "true",
49
50
  style: {
50
51
  display: "flex",
51
- opacity: t.value ? 1 : 0,
52
- width: t.value ? "auto" : 0,
53
- marginRight: t.value && !e.loadingFill ? "4px" : "0",
54
- overflow: "hidden",
55
- transition: "all 0.3s ease"
52
+ opacity: c.value ? 1 : 0,
53
+ width: c.value ? e.loadingFill ? "100%" : "1em" : 0,
54
+ marginRight: c.value && !e.loadingFill ? "4px" : "0",
55
+ overflow: "hidden"
56
56
  }
57
- }, [o(B, null, null)]), !!l.prefix && o("span", {
57
+ }, [c.value && u(B, null, null)]), !!l.prefix && u("span", {
58
58
  class: i.element("prefix")
59
- }, [(n = l.prefix) == null ? void 0 : n.call(l)]), l.icon && o("span", {
59
+ }, [(n = l.prefix) == null ? void 0 : n.call(l)]), l.icon && u("span", {
60
60
  class: i.element("prefix")
61
- }, [(d = l.icon) == null ? void 0 : d.call(l)]), o("span", {
61
+ }, [(d = l.icon) == null ? void 0 : d.call(l)]), u("span", {
62
62
  class: i.element("content")
63
- }, [(y = l.default) == null ? void 0 : y.call(l)]), l.suffix && o("span", {
63
+ }, [(y = l.default) == null ? void 0 : y.call(l)]), l.suffix && u("span", {
64
64
  class: i.element("suffix")
65
- }, [l.suffix()])]), [[F("wave"), {
65
+ }, [l.suffix()])]), [[L("wave"), {
66
66
  disabled: S.value
67
67
  }]]);
68
68
  };