vlite3 1.4.18 → 1.4.20

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.
@@ -17,13 +17,13 @@ import "v-datepicker-lite";
17
17
  import "v-datepicker-lite/style.css";
18
18
  import "@jaames/iro";
19
19
  import "@vueuse/core";
20
- /* empty css */
20
+ /* empty css */
21
21
  import qe from "../IconPicker.vue.js";
22
22
  /* empty css */
23
23
  /* empty css */
24
24
  /* empty css */
25
- /* empty css */
26
- /* empty css */
25
+ /* empty css */
26
+ /* empty css */
27
27
  import "../../core/config.js";
28
28
  /* empty css */
29
29
  /* empty css */
@@ -25,6 +25,8 @@ export interface BarChartProps {
25
25
  gridOpacity?: number;
26
26
  /** Opacity of axis border lines (0–1) */
27
27
  axisOpacity?: number;
28
+ /** Fixed width for Y-axis labels (horizontal mode) */
29
+ yLabelWidth?: number;
28
30
  }
29
31
  declare const _default: import('vue').DefineComponent<BarChartProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<BarChartProps> & Readonly<{}>, {
30
32
  animate: boolean;
@@ -1,12 +1,12 @@
1
- import { defineComponent as se, ref as A, computed as f, onMounted as ie, watch as ce, onUnmounted as ve, openBlock as n, createElementBlock as u, Fragment as d, renderList as h, createElementVNode as w, normalizeStyle as U, createTextVNode as de, toDisplayString as p, createCommentVNode as m, unref as k, withDirectives as he, vShow as fe, createBlock as me, Teleport as ye } from "vue";
2
- import { CHART_COLORS as xe, getColor as J, formatNumber as R, niceYTicks as ge, animateProgress as $e } from "./utils.js";
3
- const be = {
1
+ import { defineComponent as ie, ref as S, computed as f, onMounted as ce, watch as ve, onUnmounted as de, openBlock as n, createElementBlock as u, Fragment as d, renderList as h, createElementVNode as w, normalizeStyle as U, createTextVNode as he, toDisplayString as k, createCommentVNode as m, unref as M, withDirectives as fe, vShow as me, createBlock as ye, Teleport as xe } from "vue";
2
+ import { CHART_COLORS as ge, getColor as J, formatNumber as X, niceYTicks as $e, animateProgress as be } from "./utils.js";
3
+ const pe = {
4
4
  key: 0,
5
5
  class: "flex flex-wrap gap-x-4 gap-y-1 mb-3 pl-14"
6
- }, pe = ["width", "height"], ke = ["id"], we = ["stop-color"], Le = ["stop-color"], Me = ["id"], Ve = ["stop-color"], Ce = ["stop-color"], Be = ["transform"], Ye = ["y1", "x2", "y2", "stroke-opacity"], Re = ["y"], Xe = ["d", "fill"], Oe = ["x", "y"], ze = ["x", "y", "text-anchor", "transform"], Se = ["y1", "x2", "y2", "stroke-opacity"], Ae = ["y2", "stroke-opacity"], Ge = ["transform"], Te = ["x1", "x2", "y2", "stroke-opacity"], We = ["x"], Pe = ["y"], He = ["d", "fill"], Ne = ["x", "y"], Qe = ["y2", "stroke-opacity"], Ze = ["y1", "x2", "y2", "stroke-opacity"], De = { class: "font-medium text-xs mb-1.5" }, Ee = {
6
+ }, ke = ["width", "height"], Me = ["id"], Le = ["stop-color"], we = ["stop-color"], Ve = ["id"], Ce = ["stop-color"], Be = ["stop-color"], Re = ["transform"], Xe = ["y1", "x2", "y2", "stroke-opacity"], Ye = ["y"], ze = ["d", "fill"], Oe = ["x", "y"], Se = ["x", "y", "text-anchor", "transform"], Ae = ["y1", "x2", "y2", "stroke-opacity"], We = ["y2", "stroke-opacity"], Ge = ["transform"], Te = ["x1", "x2", "y2", "stroke-opacity"], Pe = ["x"], He = ["x", "y"], Ne = ["d", "fill"], Qe = ["x", "y"], Ze = ["y2", "stroke-opacity"], De = ["y1", "x2", "y2", "stroke-opacity"], Ee = { class: "font-medium text-xs mb-1.5" }, Fe = {
7
7
  key: 0,
8
8
  class: "text-muted-foreground"
9
- }, Fe = { class: "font-semibold" }, _e = /* @__PURE__ */ se({
9
+ }, Ie = { class: "font-semibold" }, je = /* @__PURE__ */ ie({
10
10
  __name: "BarChart",
11
11
  props: {
12
12
  data: {},
@@ -19,7 +19,7 @@ const be = {
19
19
  showLegend: { type: Boolean, default: !0 },
20
20
  showTooltip: { type: Boolean, default: !0 },
21
21
  showValues: { type: Boolean, default: !1 },
22
- colors: { default: () => xe },
22
+ colors: { default: () => ge },
23
23
  animate: { type: Boolean, default: !0 },
24
24
  formatValue: {},
25
25
  showXAxis: { type: Boolean, default: !0 },
@@ -27,10 +27,11 @@ const be = {
27
27
  showXLabels: { type: Boolean, default: !0 },
28
28
  showYLabels: { type: Boolean, default: !0 },
29
29
  gridOpacity: { default: 0.07 },
30
- axisOpacity: { default: 0.1 }
30
+ axisOpacity: { default: 0.1 },
31
+ yLabelWidth: {}
31
32
  },
32
33
  setup(i) {
33
- const s = i, G = A(), O = A(600), g = f(() => s.datasets?.length ? s.datasets.map((l, e) => ({
34
+ const s = i, A = S(), C = S(600), b = f(() => s.datasets?.length ? s.datasets.map((l, e) => ({
34
35
  label: l.label,
35
36
  color: l.color ?? J(s.colors, e),
36
37
  values: l.data
@@ -41,123 +42,137 @@ const be = {
41
42
  // will use per-bar color from data
42
43
  values: (s.data ?? []).map((l) => l.value)
43
44
  }
44
- ]), $ = f(() => g.value.length > 1 || !!s.datasets?.length), v = f(() => s.labels?.length ? s.labels : s.datasets?.length ? g.value[0]?.values.map((t, l) => String(l + 1)) ?? [] : (s.data ?? []).map((t) => t.label)), z = f(() => {
45
+ ]), p = f(() => b.value.length > 1 || !!s.datasets?.length), v = f(() => s.labels?.length ? s.labels : s.datasets?.length ? b.value[0]?.values.map((t, l) => String(l + 1)) ?? [] : (s.data ?? []).map((t) => t.label)), z = f(() => {
45
46
  if (s.orientation !== "vertical" || !s.showXLabels || v.value.length === 0) return !1;
46
- const t = Math.max(2, Math.floor(O.value / 65));
47
+ const t = Math.max(2, Math.floor(C.value / 65));
47
48
  return v.value.length > t;
48
- }), b = f(() => {
49
- const t = (o) => String(o).length;
49
+ }), K = (t, l) => {
50
+ if (!t) return "";
51
+ const e = Math.max(1, Math.floor(l / 6));
52
+ return t.length > e ? t.slice(0, Math.max(1, e - 2)) + "..." : t;
53
+ }, g = f(() => {
54
+ const t = (a) => String(a).length;
50
55
  if (s.orientation === "horizontal") {
51
- const o = s.showYLabels ? Math.max(2, ...v.value.map((y) => t(y))) * 6.5 : 0, r = s.showYLabels ? Math.max(24, o + 12) : 8;
52
- let M = 16;
56
+ let a = 8;
57
+ if (s.showYLabels)
58
+ if (s.yLabelWidth !== void 0)
59
+ a = s.yLabelWidth;
60
+ else {
61
+ const L = Math.max(2, ...v.value.map((x) => t(x))) * 6, y = Math.max(40, C.value * 0.4);
62
+ a = Math.min(y, Math.max(24, L + 16));
63
+ }
64
+ let r = 16;
53
65
  if (s.showValues) {
54
- const y = g.value.flatMap((C) => C.values), V = Math.max(2, ...y.map((C) => t(s.formatValue ? s.formatValue(C) : R(C)))) * 6.5;
55
- M = Math.max(16, V + 8);
66
+ const L = b.value.flatMap((x) => x.values), y = Math.max(2, ...L.map((x) => t(s.formatValue ? s.formatValue(x) : X(x)))) * 6.5;
67
+ r = Math.max(16, y + 8);
56
68
  }
57
69
  return {
58
70
  // top holds the value-tick labels that float above; collapse when hidden
59
71
  top: s.showXLabels ? 16 : 4,
60
- right: M,
72
+ right: r,
61
73
  bottom: 0,
62
- left: r
74
+ left: a
63
75
  };
64
76
  }
65
- const l = s.showYLabels ? Math.max(2, ...B.value.map((o) => t(s.formatValue ? s.formatValue(o) : R(o)))) * 6.5 : 0, e = s.showYLabels ? Math.max(24, l + 12) : 8;
66
- let a = s.showXLabels ? 24 : 6;
67
- return s.showXLabels && z.value && (a = Math.max(2, ...v.value.map((r) => String(r).length)) * 6.5 * 0.7 + 16), {
77
+ const l = s.showYLabels ? Math.max(2, ...B.value.map((a) => t(s.formatValue ? s.formatValue(a) : X(a)))) * 6.5 : 0, e = s.showYLabels ? Math.max(24, l + 12) : 8;
78
+ let o = s.showXLabels ? 24 : 6;
79
+ return s.showXLabels && z.value && (o = Math.max(2, ...v.value.map((r) => String(r).length)) * 6.5 * 0.7 + 16), {
68
80
  top: 24,
69
81
  right: 0,
70
- bottom: a,
82
+ bottom: o,
71
83
  left: e
72
84
  };
73
- }), x = f(() => Math.max(0, O.value - b.value.left - b.value.right)), c = f(() => Math.max(0, s.height - b.value.top - b.value.bottom)), Q = f(() => {
85
+ }), $ = f(() => Math.max(0, C.value - g.value.left - g.value.right)), c = f(() => Math.max(0, s.height - g.value.top - g.value.bottom)), N = f(() => {
74
86
  if (s.orientation !== "vertical") return 1;
75
- const t = z.value ? 25 : 65, l = Math.max(2, Math.floor(x.value / t));
87
+ const t = z.value ? 25 : 65, l = Math.max(2, Math.floor($.value / t));
76
88
  return Math.ceil(v.value.length / l);
77
- }), K = (t) => {
89
+ }), ee = (t) => {
78
90
  if (s.orientation !== "vertical") return !0;
79
91
  const l = v.value.length;
80
- return Q.value <= 1 || t === 0 || t === l - 1 ? !0 : l - 1 - t < Q.value * 0.7 ? !1 : t % Q.value === 0;
81
- }, T = f(
92
+ return N.value <= 1 || t === 0 || t === l - 1 ? !0 : l - 1 - t < N.value * 0.7 ? !1 : t % N.value === 0;
93
+ }, W = f(
82
94
  () => (s.data ?? []).map((t, l) => t.color ?? J(s.colors, l))
83
- ), ee = f(() => g.value.flatMap((t) => t.values)), _ = f(() => Math.max(...ee.value) || 1), B = f(() => ge(0, _.value, 5)), L = f(() => B.value[B.value.length - 1] || _.value), W = A(s.animate ? 0 : 1);
84
- let Z = null;
95
+ ), te = f(() => b.value.flatMap((t) => t.values)), _ = f(() => Math.max(...te.value) || 1), B = f(() => {
96
+ const t = s.orientation === "vertical" ? s.height : C.value, l = Math.max(2, Math.floor(t / 80));
97
+ return $e(0, _.value, Math.min(5, l));
98
+ }), V = f(() => B.value[B.value.length - 1] || _.value), G = S(s.animate ? 0 : 1);
99
+ let Q = null;
85
100
  function j() {
86
- Z?.(), W.value = 0, Z = $e(800, (t) => W.value = t);
101
+ Q?.(), G.value = 0, Q = be(800, (t) => G.value = t);
87
102
  }
88
- ie(() => {
89
- te(), s.animate && j();
90
- }), ce(() => [s.data, s.datasets], () => {
103
+ ce(() => {
104
+ le(), s.animate && j();
105
+ }), ve(() => [s.data, s.datasets], () => {
91
106
  s.animate && j();
92
- }, { deep: !0 }), ve(() => {
93
- Z?.(), D?.disconnect();
107
+ }, { deep: !0 }), de(() => {
108
+ Q?.(), Z?.disconnect();
94
109
  });
95
- let D = null;
96
- function te() {
97
- G.value && (D = new ResizeObserver((t) => {
98
- O.value = t[0].contentRect.width || 600;
99
- }), D.observe(G.value), O.value = G.value.clientWidth || 600);
110
+ let Z = null;
111
+ function le() {
112
+ A.value && (Z = new ResizeObserver((t) => {
113
+ C.value = t[0].contentRect.width || 600;
114
+ }), Z.observe(A.value), C.value = A.value.clientWidth || 600);
100
115
  }
101
- const le = f(() => {
116
+ const ae = f(() => {
102
117
  const t = v.value.length;
103
118
  if (t === 0) return [];
104
- const l = x.value / t, e = g.value.length, a = l * 0.2, o = l - a * 2, r = $.value ? o / e : o;
105
- return v.value.map((M, y) => {
106
- const V = y * l + a, C = g.value.map((P, H) => {
107
- const N = P.values[y] ?? 0, S = N / L.value * c.value * W.value, E = V + H * r, F = c.value - S, I = $.value ? P.color : T.value[y];
108
- return { val: N, bh: S, x: E, y: F, w: r - ($.value ? 2 : 0), color: I };
119
+ const l = $.value / t, e = b.value.length, o = l * 0.2, a = l - o * 2, r = p.value ? a / e : a;
120
+ return v.value.map((L, y) => {
121
+ const x = y * l + o, D = b.value.map((T, P) => {
122
+ const H = T.values[y] ?? 0, O = H / V.value * c.value * G.value, E = x + P * r, F = c.value - O, I = p.value ? T.color : W.value[y];
123
+ return { val: H, bh: O, x: E, y: F, w: r - (p.value ? 2 : 0), color: I };
109
124
  });
110
- return { label: M, bars: C };
125
+ return { label: L, bars: D };
111
126
  });
112
- }), ae = f(() => {
127
+ }), oe = f(() => {
113
128
  const t = v.value.length;
114
129
  if (t === 0) return [];
115
- const l = c.value / t, e = g.value.length, a = l * 0.2, o = l - a * 2, r = $.value ? o / e : o, M = L.value;
116
- return v.value.map((y, V) => {
117
- const C = V * l + a, P = g.value.map((H, N) => {
118
- const S = H.values[V] ?? 0, E = S / M * x.value * W.value, F = C + N * r, I = $.value ? H.color : T.value[V];
119
- return { val: S, bw: E, x: 0, y: F, h: r - ($.value ? 2 : 0), color: I };
130
+ const l = c.value / t, e = b.value.length, o = l * 0.2, a = l - o * 2, r = p.value ? a / e : a, L = V.value;
131
+ return v.value.map((y, x) => {
132
+ const D = x * l + o, T = b.value.map((P, H) => {
133
+ const O = P.values[x] ?? 0, E = O / L * $.value * G.value, F = D + H * r, I = p.value ? P.color : W.value[x];
134
+ return { val: O, bw: E, x: 0, y: F, h: r - (p.value ? 2 : 0), color: I };
120
135
  });
121
- return { label: y, bars: P };
136
+ return { label: y, bars: T };
122
137
  });
123
- }), Y = A(null), q = A(null);
124
- function oe(t) {
138
+ }), R = S(null), q = S(null);
139
+ function ne(t) {
125
140
  if (!s.showTooltip) return;
126
- const l = t.currentTarget.getBoundingClientRect(), e = t.clientX - l.left - b.value.left, a = t.clientY - l.top - b.value.top, o = v.value.length;
127
- if (o === 0) return;
141
+ const l = t.currentTarget.getBoundingClientRect(), e = t.clientX - l.left - g.value.left, o = t.clientY - l.top - g.value.top, a = v.value.length;
142
+ if (a === 0) return;
128
143
  let r;
129
- s.orientation === "vertical" ? r = Math.floor(e / x.value * o) : r = Math.floor(a / c.value * o), r = Math.max(0, Math.min(o - 1, r)), q.value = r;
130
- const M = g.value.map((y, V) => ({
131
- color: $.value ? y.color : T.value[r],
144
+ s.orientation === "vertical" ? r = Math.floor(e / $.value * a) : r = Math.floor(o / c.value * a), r = Math.max(0, Math.min(a - 1, r)), q.value = r;
145
+ const L = b.value.map((y, x) => ({
146
+ color: p.value ? y.color : W.value[r],
132
147
  label: y.label,
133
- value: s.formatValue ? s.formatValue(y.values[r]) : R(y.values[r])
148
+ value: s.formatValue ? s.formatValue(y.values[r]) : X(y.values[r])
134
149
  }));
135
- Y.value = {
150
+ R.value = {
136
151
  x: t.clientX,
137
152
  y: t.clientY,
138
153
  label: v.value[r],
139
- items: M
154
+ items: L
140
155
  };
141
156
  }
142
- function ne() {
143
- Y.value = null, q.value = null;
157
+ function ue() {
158
+ R.value = null, q.value = null;
144
159
  }
145
- function ue(t, l, e, a, o) {
146
- const r = Math.min(o, e / 2, a / 2);
147
- return r <= 0 || a <= 0 ? `M${t},${l + a} L${t},${l} L${t + e},${l} L${t + e},${l + a} Z` : `M${t},${l + a} L${t},${l + r} Q${t},${l} ${t + r},${l} L${t + e - r},${l} Q${t + e},${l} ${t + e},${l + r} L${t + e},${l + a} Z`;
160
+ function re(t, l, e, o, a) {
161
+ const r = Math.min(a, e / 2, o / 2);
162
+ return r <= 0 || o <= 0 ? `M${t},${l + o} L${t},${l} L${t + e},${l} L${t + e},${l + o} Z` : `M${t},${l + o} L${t},${l + r} Q${t},${l} ${t + r},${l} L${t + e - r},${l} Q${t + e},${l} ${t + e},${l + r} L${t + e},${l + o} Z`;
148
163
  }
149
- function re(t, l, e, a, o) {
150
- const r = Math.min(o, e / 2, a / 2);
151
- return r <= 0 || e <= 0 ? `M${t},${l} L${t + e},${l} L${t + e},${l + a} L${t},${l + a} Z` : `M${t},${l} L${t + e - r},${l} Q${t + e},${l} ${t + e},${l + r} L${t + e},${l + a - r} Q${t + e},${l + a} ${t + e - r},${l + a} L${t},${l + a} Z`;
164
+ function se(t, l, e, o, a) {
165
+ const r = Math.min(a, e / 2, o / 2);
166
+ return r <= 0 || e <= 0 ? `M${t},${l} L${t + e},${l} L${t + e},${l + o} L${t},${l + o} Z` : `M${t},${l} L${t + e - r},${l} Q${t + e},${l} ${t + e},${l + r} L${t + e},${l + o - r} Q${t + e},${l + o} ${t + e - r},${l + o} L${t},${l + o} Z`;
152
167
  }
153
- const X = Math.random().toString(36).slice(2, 7);
168
+ const Y = Math.random().toString(36).slice(2, 7);
154
169
  return (t, l) => (n(), u("div", {
155
170
  ref_key: "containerRef",
156
- ref: G,
171
+ ref: A,
157
172
  class: "vlite-bar-chart w-full select-none"
158
173
  }, [
159
- i.showLegend && $.value ? (n(), u("div", be, [
160
- (n(!0), u(d, null, h(g.value, (e) => (n(), u("div", {
174
+ i.showLegend && p.value ? (n(), u("div", pe, [
175
+ (n(!0), u(d, null, h(b.value, (e) => (n(), u("div", {
161
176
  key: e.label,
162
177
  class: "flex items-center gap-1.5 text-xs text-muted-foreground"
163
178
  }, [
@@ -165,22 +180,22 @@ const be = {
165
180
  class: "w-2.5 h-2.5 rounded-sm inline-block",
166
181
  style: U({ backgroundColor: e.color })
167
182
  }, null, 4),
168
- de(" " + p(e.label), 1)
183
+ he(" " + k(e.label), 1)
169
184
  ]))), 128))
170
185
  ])) : m("", !0),
171
186
  (n(), u("svg", {
172
- width: O.value,
187
+ width: C.value,
173
188
  height: i.height,
174
189
  role: "img",
175
190
  "aria-label": "Bar chart",
176
191
  class: "overflow-visible",
177
- onMousemove: oe,
178
- onMouseleave: ne
192
+ onMousemove: ne,
193
+ onMouseleave: ue
179
194
  }, [
180
195
  w("defs", null, [
181
- (n(!0), u(d, null, h(g.value, (e, a) => (n(), u("linearGradient", {
182
- key: a,
183
- id: `bgrad-${k(X)}-${a}`,
196
+ (n(!0), u(d, null, h(b.value, (e, o) => (n(), u("linearGradient", {
197
+ key: o,
198
+ id: `bgrad-${M(Y)}-${o}`,
184
199
  x1: "0",
185
200
  y1: "0",
186
201
  x2: "0",
@@ -190,16 +205,16 @@ const be = {
190
205
  offset: "0%",
191
206
  "stop-color": e.color,
192
207
  "stop-opacity": "1"
193
- }, null, 8, we),
208
+ }, null, 8, Le),
194
209
  w("stop", {
195
210
  offset: "100%",
196
211
  "stop-color": e.color,
197
212
  "stop-opacity": "0.7"
198
- }, null, 8, Le)
199
- ], 8, ke))), 128)),
200
- (n(!0), u(d, null, h(T.value, (e, a) => (n(), u("linearGradient", {
201
- key: `sc-${a}`,
202
- id: `bgrad-single-${k(X)}-${a}`,
213
+ }, null, 8, we)
214
+ ], 8, Me))), 128)),
215
+ (n(!0), u(d, null, h(W.value, (e, o) => (n(), u("linearGradient", {
216
+ key: `sc-${o}`,
217
+ id: `bgrad-single-${M(Y)}-${o}`,
203
218
  x1: "0",
204
219
  y1: "0",
205
220
  x2: "0",
@@ -209,74 +224,74 @@ const be = {
209
224
  offset: "0%",
210
225
  "stop-color": e,
211
226
  "stop-opacity": "1"
212
- }, null, 8, Ve),
227
+ }, null, 8, Ce),
213
228
  w("stop", {
214
229
  offset: "100%",
215
230
  "stop-color": e,
216
231
  "stop-opacity": "0.7"
217
- }, null, 8, Ce)
218
- ], 8, Me))), 128))
232
+ }, null, 8, Be)
233
+ ], 8, Ve))), 128))
219
234
  ]),
220
235
  i.orientation === "vertical" ? (n(), u("g", {
221
236
  key: 0,
222
- transform: `translate(${b.value.left},${b.value.top})`
237
+ transform: `translate(${g.value.left},${g.value.top})`
223
238
  }, [
224
239
  i.showGrid ? (n(!0), u(d, { key: 0 }, h(B.value, (e) => (n(), u("line", {
225
240
  key: e,
226
241
  x1: 0,
227
- y1: c.value - e / L.value * c.value,
228
- x2: x.value,
229
- y2: c.value - e / L.value * c.value,
242
+ y1: c.value - e / V.value * c.value,
243
+ x2: $.value,
244
+ y2: c.value - e / V.value * c.value,
230
245
  stroke: "currentColor",
231
246
  "stroke-opacity": i.gridOpacity,
232
247
  "stroke-width": "1"
233
- }, null, 8, Ye))), 128)) : m("", !0),
248
+ }, null, 8, Xe))), 128)) : m("", !0),
234
249
  i.showYLabels ? (n(!0), u(d, { key: 1 }, h(B.value, (e) => (n(), u("text", {
235
250
  key: `yt-${e}`,
236
251
  x: -10,
237
- y: c.value - e / L.value * c.value,
252
+ y: c.value - e / V.value * c.value,
238
253
  "text-anchor": "end",
239
254
  "dominant-baseline": "middle",
240
255
  "font-size": "11",
241
256
  class: "fill-muted-foreground"
242
- }, p(i.formatValue ? i.formatValue(e) : k(R)(e)), 9, Re))), 128)) : m("", !0),
243
- (n(!0), u(d, null, h(le.value, (e, a) => (n(), u("g", { key: a }, [
244
- (n(!0), u(d, null, h(e.bars, (o, r) => (n(), u("path", {
257
+ }, k(i.formatValue ? i.formatValue(e) : M(X)(e)), 9, Ye))), 128)) : m("", !0),
258
+ (n(!0), u(d, null, h(ae.value, (e, o) => (n(), u("g", { key: o }, [
259
+ (n(!0), u(d, null, h(e.bars, (a, r) => (n(), u("path", {
245
260
  key: r,
246
- d: ue(o.x, o.y, o.w, o.bh, i.barRadius),
247
- fill: $.value ? `url(#bgrad-${k(X)}-${r})` : `url(#bgrad-single-${k(X)}-${a})`,
261
+ d: re(a.x, a.y, a.w, a.bh, i.barRadius),
262
+ fill: p.value ? `url(#bgrad-${M(Y)}-${r})` : `url(#bgrad-single-${M(Y)}-${o})`,
248
263
  class: "transition-opacity duration-150"
249
- }, null, 8, Xe))), 128)),
250
- i.showValues ? (n(!0), u(d, { key: 0 }, h(e.bars, (o, r) => (n(), u("text", {
264
+ }, null, 8, ze))), 128)),
265
+ i.showValues ? (n(!0), u(d, { key: 0 }, h(e.bars, (a, r) => (n(), u("text", {
251
266
  key: `vl-${r}`,
252
- x: o.x + o.w / 2,
253
- y: o.y - 6,
267
+ x: a.x + a.w / 2,
268
+ y: a.y - 6,
254
269
  "text-anchor": "middle",
255
270
  "font-size": "10",
256
271
  "font-weight": "600",
257
272
  class: "fill-foreground"
258
- }, p(i.formatValue ? i.formatValue(o.val) : k(R)(o.val)), 9, Oe))), 128)) : m("", !0)
273
+ }, k(i.formatValue ? i.formatValue(a.val) : M(X)(a.val)), 9, Oe))), 128)) : m("", !0)
259
274
  ]))), 128)),
260
- i.showXLabels ? (n(!0), u(d, { key: 2 }, h(v.value, (e, a) => he((n(), u("text", {
261
- key: `xl-${a}`,
262
- x: (a + 0.5) * (x.value / v.value.length),
275
+ i.showXLabels ? (n(!0), u(d, { key: 2 }, h(v.value, (e, o) => fe((n(), u("text", {
276
+ key: `xl-${o}`,
277
+ x: (o + 0.5) * ($.value / v.value.length),
263
278
  y: c.value + (z.value ? 12 : 16),
264
279
  "text-anchor": z.value ? "end" : "middle",
265
- transform: z.value ? `rotate(-45, ${(a + 0.5) * (x.value / v.value.length)}, ${c.value + 12})` : void 0,
280
+ transform: z.value ? `rotate(-45, ${(o + 0.5) * ($.value / v.value.length)}, ${c.value + 12})` : void 0,
266
281
  "font-size": "11",
267
282
  class: "fill-muted-foreground"
268
- }, p(e), 9, ze)), [
269
- [fe, K(a)]
283
+ }, k(e), 9, Se)), [
284
+ [me, ee(o)]
270
285
  ])), 128)) : m("", !0),
271
286
  i.showXAxis ? (n(), u("line", {
272
287
  key: 3,
273
288
  x1: 0,
274
289
  y1: c.value,
275
- x2: x.value,
290
+ x2: $.value,
276
291
  y2: c.value,
277
292
  stroke: "currentColor",
278
293
  "stroke-opacity": i.axisOpacity
279
- }, null, 8, Se)) : m("", !0),
294
+ }, null, 8, Ae)) : m("", !0),
280
295
  i.showYAxis ? (n(), u("line", {
281
296
  key: 4,
282
297
  x1: 0,
@@ -285,16 +300,16 @@ const be = {
285
300
  y2: c.value,
286
301
  stroke: "currentColor",
287
302
  "stroke-opacity": i.axisOpacity
288
- }, null, 8, Ae)) : m("", !0)
289
- ], 8, Be)) : (n(), u("g", {
303
+ }, null, 8, We)) : m("", !0)
304
+ ], 8, Re)) : (n(), u("g", {
290
305
  key: 1,
291
- transform: `translate(${b.value.left},${b.value.top})`
306
+ transform: `translate(${g.value.left},${g.value.top})`
292
307
  }, [
293
308
  i.showGrid ? (n(!0), u(d, { key: 0 }, h(B.value, (e) => (n(), u("line", {
294
309
  key: e,
295
- x1: e / L.value * x.value,
310
+ x1: e / V.value * $.value,
296
311
  y1: 0,
297
- x2: e / L.value * x.value,
312
+ x2: e / V.value * $.value,
298
313
  y2: c.value,
299
314
  stroke: "currentColor",
300
315
  "stroke-opacity": i.gridOpacity,
@@ -302,37 +317,37 @@ const be = {
302
317
  }, null, 8, Te))), 128)) : m("", !0),
303
318
  i.showXLabels ? (n(!0), u(d, { key: 1 }, h(B.value, (e) => (n(), u("text", {
304
319
  key: `xt-${e}`,
305
- x: e / L.value * x.value,
320
+ x: e / V.value * $.value,
306
321
  y: -8,
307
322
  "text-anchor": "middle",
308
323
  "font-size": "11",
309
324
  class: "fill-muted-foreground"
310
- }, p(i.formatValue ? i.formatValue(e) : k(R)(e)), 9, We))), 128)) : m("", !0),
311
- i.showYLabels ? (n(!0), u(d, { key: 2 }, h(v.value, (e, a) => (n(), u("text", {
312
- key: `yl-${a}`,
313
- x: -12,
314
- y: (a + 0.5) * (c.value / v.value.length),
315
- "text-anchor": "end",
325
+ }, k(i.formatValue ? i.formatValue(e) : M(X)(e)), 9, Pe))), 128)) : m("", !0),
326
+ i.showYLabels ? (n(!0), u(d, { key: 2 }, h(v.value, (e, o) => (n(), u("text", {
327
+ key: `yl-${o}`,
328
+ x: -g.value.left + 4,
329
+ y: (o + 0.5) * (c.value / v.value.length),
330
+ "text-anchor": "start",
316
331
  "dominant-baseline": "middle",
317
332
  "font-size": "11",
318
333
  class: "fill-muted-foreground"
319
- }, p(e), 9, Pe))), 128)) : m("", !0),
320
- (n(!0), u(d, null, h(ae.value, (e, a) => (n(), u("g", { key: a }, [
321
- (n(!0), u(d, null, h(e.bars, (o, r) => (n(), u("path", {
334
+ }, k(K(String(e), g.value.left - 12)), 9, He))), 128)) : m("", !0),
335
+ (n(!0), u(d, null, h(oe.value, (e, o) => (n(), u("g", { key: o }, [
336
+ (n(!0), u(d, null, h(e.bars, (a, r) => (n(), u("path", {
322
337
  key: r,
323
- d: re(o.x, o.y, o.bw, o.h, i.barRadius),
324
- fill: $.value ? `url(#bgrad-${k(X)}-${r})` : `url(#bgrad-single-${k(X)}-${a})`,
338
+ d: se(a.x, a.y, a.bw, a.h, i.barRadius),
339
+ fill: p.value ? `url(#bgrad-${M(Y)}-${r})` : `url(#bgrad-single-${M(Y)}-${o})`,
325
340
  class: "transition-opacity duration-150"
326
- }, null, 8, He))), 128)),
327
- i.showValues ? (n(!0), u(d, { key: 0 }, h(e.bars, (o, r) => (n(), u("text", {
341
+ }, null, 8, Ne))), 128)),
342
+ i.showValues ? (n(!0), u(d, { key: 0 }, h(e.bars, (a, r) => (n(), u("text", {
328
343
  key: `hvl-${r}`,
329
- x: o.bw + 6,
330
- y: o.y + o.h / 2,
344
+ x: a.bw + 6,
345
+ y: a.y + a.h / 2,
331
346
  "dominant-baseline": "middle",
332
347
  "font-size": "10",
333
348
  "font-weight": "600",
334
349
  class: "fill-foreground"
335
- }, p(i.formatValue ? i.formatValue(o.val) : k(R)(o.val)), 9, Ne))), 128)) : m("", !0)
350
+ }, k(i.formatValue ? i.formatValue(a.val) : M(X)(a.val)), 9, Qe))), 128)) : m("", !0)
336
351
  ]))), 128)),
337
352
  i.showYAxis ? (n(), u("line", {
338
353
  key: 3,
@@ -342,26 +357,26 @@ const be = {
342
357
  y2: c.value,
343
358
  stroke: "currentColor",
344
359
  "stroke-opacity": i.axisOpacity
345
- }, null, 8, Qe)) : m("", !0),
360
+ }, null, 8, Ze)) : m("", !0),
346
361
  i.showXAxis ? (n(), u("line", {
347
362
  key: 4,
348
363
  x1: 0,
349
364
  y1: c.value,
350
- x2: x.value,
365
+ x2: $.value,
351
366
  y2: c.value,
352
367
  stroke: "currentColor",
353
368
  "stroke-opacity": i.axisOpacity
354
- }, null, 8, Ze)) : m("", !0)
369
+ }, null, 8, De)) : m("", !0)
355
370
  ], 8, Ge))
356
- ], 40, pe)),
357
- (n(), me(ye, { to: "body" }, [
358
- Y.value ? (n(), u("div", {
371
+ ], 40, ke)),
372
+ (n(), ye(xe, { to: "body" }, [
373
+ R.value ? (n(), u("div", {
359
374
  key: 0,
360
375
  class: "vlite-chart-tooltip",
361
- style: U({ left: `${Y.value.x + 12}px`, top: `${Y.value.y - 10}px` })
376
+ style: U({ left: `${R.value.x + 12}px`, top: `${R.value.y - 10}px` })
362
377
  }, [
363
- w("div", De, p(Y.value.label), 1),
364
- (n(!0), u(d, null, h(Y.value.items, (e) => (n(), u("div", {
378
+ w("div", Ee, k(R.value.label), 1),
379
+ (n(!0), u(d, null, h(R.value.items, (e) => (n(), u("div", {
365
380
  key: e.label,
366
381
  class: "flex items-center gap-1.5 text-xs"
367
382
  }, [
@@ -369,8 +384,8 @@ const be = {
369
384
  class: "w-2 h-2 rounded-sm shrink-0",
370
385
  style: U({ backgroundColor: e.color })
371
386
  }, null, 4),
372
- e.label ? (n(), u("span", Ee, p(e.label) + ":", 1)) : m("", !0),
373
- w("span", Fe, p(e.value), 1)
387
+ e.label ? (n(), u("span", Fe, k(e.label) + ":", 1)) : m("", !0),
388
+ w("span", Ie, k(e.value), 1)
374
389
  ]))), 128))
375
390
  ], 4)) : m("", !0)
376
391
  ]))
@@ -378,5 +393,5 @@ const be = {
378
393
  }
379
394
  });
380
395
  export {
381
- _e as default
396
+ je as default
382
397
  };
@@ -73,6 +73,8 @@ export interface BarChartProps {
73
73
  animate?: boolean;
74
74
  /** Custom value formatter */
75
75
  formatValue?: (v: number) => string;
76
+ /** Fixed width for Y-axis labels (horizontal mode) */
77
+ yLabelWidth?: number;
76
78
  }
77
79
  export type PieLabelMode = 'percent' | 'value' | 'label' | 'none' | 'outside';
78
80
  export type LegendPosition = 'right' | 'bottom';