iryx-ui 0.15.0 → 0.16.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.
@@ -1,31 +1,37 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
2
  import { useElementSize as t } from "../composables/element-size.js";
3
3
  import { cartesianLayout as n, clampTooltip as r, seriesColor as i, slotOf as a, warnOnSlotOverflow as o } from "../composables/cartesian.js";
4
- import s from "./ChartLegend.js";
5
- import { lineChartTheme as c } from "../theme/line-chart.js";
6
- import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, defineComponent as h, guardReactiveProps as g, normalizeClass as _, normalizeProps as v, normalizeStyle as y, openBlock as b, ref as x, renderList as S, renderSlot as C, toDisplayString as w, unref as T, useId as ee } from "vue";
4
+ import { useChartAnimation as s, useChartReveal as c } from "../composables/chart-reveal.js";
5
+ import l from "./ChartLegend.js";
6
+ import { lineChartTheme as u } from "../theme/line-chart.js";
7
+ import { Fragment as d, computed as f, createBlock as ee, createCommentVNode as p, createElementBlock as m, createElementVNode as h, defineComponent as g, guardReactiveProps as _, normalizeClass as v, normalizeProps as y, normalizeStyle as b, openBlock as x, ref as S, renderList as C, renderSlot as w, toDisplayString as T, unref as E, useId as D } from "vue";
7
8
  //#region src/components/LineChart.vue?vue&type=script&setup=true&lang.ts
8
9
  var te = ["role", "aria-label"], ne = [
9
10
  "width",
10
11
  "height",
11
12
  "viewBox"
12
- ], re = [
13
+ ], O = [
13
14
  "x1",
14
15
  "y1",
15
16
  "x2",
16
17
  "y2"
17
- ], ie = ["x", "y"], ae = { key: 1 }, oe = ["d", "fill"], se = [
18
+ ], re = ["x", "y"], ie = { key: 1 }, ae = [
19
+ "x",
20
+ "y",
21
+ "width",
22
+ "height"
23
+ ], oe = [
18
24
  "x1",
19
25
  "y1",
20
26
  "x2",
21
27
  "y2"
22
- ], ce = ["d"], le = ["cx", "cy"], ue = ["cx", "cy"], E = ["x", "y"], D = [
28
+ ], se = ["clip-path"], ce = ["d", "fill"], le = ["d"], ue = ["cx", "cy"], de = ["cx", "cy"], fe = ["x", "y"], pe = [
23
29
  "x",
24
30
  "y",
25
31
  "width",
26
32
  "height",
27
33
  "onPointerenter"
28
- ], O = { scope: "row" }, k = /*@__PURE__*/ h({
34
+ ], me = { scope: "row" }, k = /*@__PURE__*/ g({
29
35
  __name: "LineChart",
30
36
  props: {
31
37
  data: { default: () => [] },
@@ -42,6 +48,10 @@ var te = ["role", "aria-label"], ne = [
42
48
  type: Boolean,
43
49
  default: !0
44
50
  },
51
+ animate: {
52
+ type: [Boolean, Object],
53
+ default: !0
54
+ },
45
55
  legend: {
46
56
  type: Boolean,
47
57
  default: !0
@@ -60,44 +70,44 @@ var te = ["role", "aria-label"], ne = [
60
70
  class: {},
61
71
  ui: {}
62
72
  },
63
- setup(h) {
64
- let k = h, A = e(), j = u(() => k.unstyled ?? A.unstyled), M = x(), { width: N } = t(M), P = u(() => new Intl.NumberFormat(k.locale, k.format));
65
- function F(e) {
66
- return P.value.format(e);
73
+ setup(g) {
74
+ let k = g, he = e(), A = f(() => k.unstyled ?? he.unstyled), j = S(), { width: M } = t(j), ge = f(() => new Intl.NumberFormat(k.locale, k.format));
75
+ function N(e) {
76
+ return ge.value.format(e);
67
77
  }
68
- let I = u(() => {
78
+ let P = f(() => {
69
79
  let e = k.series?.length ? [...k.series] : [{ key: "value" }];
70
80
  return o(e.length), e;
71
- }), L = u(() => I.value.length > 1), de = u(() => L.value || k.legend && I.value[0].name != null);
72
- function R(e, t) {
81
+ }), F = f(() => P.value.length > 1), _e = f(() => F.value || k.legend && P.value[0].name != null);
82
+ function I(e, t) {
73
83
  let n = e[t];
74
84
  return typeof n == "number" && Number.isFinite(n) ? n : null;
75
85
  }
76
- let z = u(() => n({
77
- values: k.data.flatMap((e) => I.value.map((t) => R(e, t.key))),
86
+ let L = f(() => n({
87
+ values: k.data.flatMap((e) => P.value.map((t) => I(e, t.key))),
78
88
  categories: k.data.length,
79
89
  longestLabel: Math.max(...k.data.map((e) => e.label.length), 1),
80
- width: N.value,
90
+ width: M.value,
81
91
  height: k.height,
82
92
  tickCount: k.ticks,
83
93
  showAxis: k.axis,
84
- formatTick: F,
94
+ formatTick: N,
85
95
  includeZero: k.zero
86
96
  }));
87
- function B(e) {
97
+ function R(e) {
88
98
  return Math.round(e * 100) / 100;
89
99
  }
90
- let V = u(() => N.value ? I.value.map((e, t) => {
100
+ let z = f(() => M.value ? P.value.map((e, t) => {
91
101
  let n = [], r = [];
92
102
  return k.data.forEach((t, i) => {
93
- let a = R(t, e.key);
103
+ let a = I(t, e.key);
94
104
  if (a == null) {
95
105
  r.length && n.push(r), r = [];
96
106
  return;
97
107
  }
98
108
  r.push({
99
- x: B(z.value.pointAt(i)),
100
- y: B(z.value.y(a)),
109
+ x: R(L.value.pointAt(i)),
110
+ y: R(L.value.y(a)),
101
111
  index: i
102
112
  });
103
113
  }), r.length && n.push(r), {
@@ -105,205 +115,214 @@ var te = ["role", "aria-label"], ne = [
105
115
  color: i(a(e, t)),
106
116
  seriesIndex: t
107
117
  };
108
- }) : []), H = u(() => k.variant === "area" && !L.value && V.value.length > 0), U = u(() => {
118
+ }) : []), B = f(() => k.variant === "area" && !F.value && z.value.length > 0), V = f(() => {
109
119
  let e = k.data?.length ?? 0;
110
120
  return {
111
- first: e ? B(z.value.pointAt(0)) : 0,
112
- last: e ? B(z.value.pointAt(e - 1)) : 0,
113
- left: B(z.value.plot.left),
114
- right: B(z.value.plot.left + z.value.plot.width)
121
+ first: e ? R(L.value.pointAt(0)) : 0,
122
+ last: e ? R(L.value.pointAt(e - 1)) : 0,
123
+ left: R(L.value.plot.left),
124
+ right: R(L.value.plot.left + L.value.plot.width)
115
125
  };
116
126
  });
117
- function W(e) {
118
- return k.flush && e.x === U.value.last ? `L${U.value.right} ${e.y}` : "";
127
+ function H(e) {
128
+ return k.flush && e.x === V.value.last ? `L${V.value.right} ${e.y}` : "";
119
129
  }
120
- let G = u(() => Math.min(Math.max(k.tension, 0), 1) / 6);
121
- function K(e) {
122
- let t = e[0], n = e[e.length - 1], r = k.flush && t.x === U.value.first ? `M${U.value.left} ${t.y} L${t.x} ${t.y}` : `M${t.x} ${t.y}`;
123
- if (G.value === 0 || e.length < 2) return [
130
+ let U = f(() => Math.min(Math.max(k.tension, 0), 1) / 6);
131
+ function W(e) {
132
+ let t = e[0], n = e[e.length - 1], r = k.flush && t.x === V.value.first ? `M${V.value.left} ${t.y} L${t.x} ${t.y}` : `M${t.x} ${t.y}`;
133
+ if (U.value === 0 || e.length < 2) return [
124
134
  r,
125
135
  ...e.slice(1).map((e) => `L${e.x} ${e.y}`),
126
- W(n)
136
+ H(n)
127
137
  ].filter(Boolean).join(" ");
128
138
  let i = (e, t, n) => Math.min(Math.max(e, Math.min(t, n)), Math.max(t, n));
129
139
  return [
130
140
  r,
131
141
  ...e.slice(1).map((t, n) => {
132
- let r = e[n], a = e[n - 1] ?? r, o = t, s = e[n + 2] ?? o, c = r.x + (o.x - a.x) * G.value, l = i(r.y + (o.y - a.y) * G.value, r.y, o.y), u = o.x - (s.x - r.x) * G.value, d = i(o.y - (s.y - r.y) * G.value, r.y, o.y);
133
- return `C${B(c)} ${B(l)}, ${B(u)} ${B(d)}, ${o.x} ${o.y}`;
142
+ let r = e[n], a = e[n - 1] ?? r, o = t, s = e[n + 2] ?? o, c = r.x + (o.x - a.x) * U.value, l = i(r.y + (o.y - a.y) * U.value, r.y, o.y), u = o.x - (s.x - r.x) * U.value, d = i(o.y - (s.y - r.y) * U.value, r.y, o.y);
143
+ return `C${R(c)} ${R(l)}, ${R(u)} ${R(d)}, ${o.x} ${o.y}`;
134
144
  }),
135
- W(n)
145
+ H(n)
136
146
  ].filter(Boolean).join(" ");
137
147
  }
138
- function fe(e) {
139
- let t = z.value.plot.top + z.value.plot.height, n = e[0], r = e[e.length - 1], i = k.flush && n.x === U.value.first ? U.value.left : n.x, a = k.flush && r.x === U.value.last ? U.value.right : r.x;
140
- return `${K(e)} L${a} ${t} L${i} ${t} Z`;
148
+ function ve(e) {
149
+ let t = L.value.plot.top + L.value.plot.height, n = e[0], r = e[e.length - 1], i = k.flush && n.x === V.value.first ? V.value.left : n.x, a = k.flush && r.x === V.value.last ? V.value.right : r.x;
150
+ return `${W(e)} L${a} ${t} L${i} ${t} Z`;
141
151
  }
142
- let q = `iryx-area-${ee()}`, J = x(), Y = u(() => J.value == null ? [] : V.value.flatMap((e) => {
152
+ let G = `iryx-area-${D()}`, K = `iryx-plot-clip-${D()}`, q = S(), J = f(() => q.value == null ? [] : z.value.flatMap((e) => {
143
153
  for (let t of e.runs) {
144
- let n = t.find((e) => e.index === J.value);
154
+ let n = t.find((e) => e.index === q.value);
145
155
  if (n) return [{
146
156
  ...n,
147
157
  color: e.color
148
158
  }];
149
159
  }
150
160
  return [];
151
- })), X = u(() => J.value == null ? void 0 : B(z.value.pointAt(J.value))), Z = u(() => {
152
- if (J.value == null) return;
153
- let e = k.data[J.value];
161
+ })), Y = f(() => q.value == null ? void 0 : R(L.value.pointAt(q.value))), X = f(() => {
162
+ if (q.value == null) return;
163
+ let e = k.data[q.value];
154
164
  if (!e) return;
155
- let t = I.value.map((t, n) => ({
165
+ let t = P.value.map((t, n) => ({
156
166
  name: t.name ?? t.key,
157
167
  color: i(a(t, n)),
158
- value: R(e, t.key)
168
+ value: I(e, t.key)
159
169
  })).filter((e) => e.value != null).map((e) => ({
160
170
  ...e,
161
- value: F(e.value)
171
+ value: N(e.value)
162
172
  }));
163
173
  if (!t.length) return;
164
- let n = L.value ? Math.max(e.label.length, ...t.map((e) => e.name.length + e.value.length + 3)) : e.label.length + t[0].value.length + 2;
174
+ let n = F.value ? Math.max(e.label.length, ...t.map((e) => e.name.length + e.value.length + 3)) : e.label.length + t[0].value.length + 2;
165
175
  return {
166
176
  label: e.label,
167
177
  rows: t,
168
- multi: L.value,
169
- x: r(z.value.pointAt(J.value), "x".repeat(n), N.value),
170
- y: Math.min(...Y.value.map((e) => e.y), z.value.plot.top + z.value.plot.height)
178
+ multi: F.value,
179
+ x: r(L.value.pointAt(q.value), "x".repeat(n), M.value),
180
+ y: Math.min(...J.value.map((e) => e.y), L.value.plot.top + L.value.plot.height)
171
181
  };
172
- }), Q = u(() => c());
182
+ }), Z = s(f(() => k.animate)), { revealed: ye } = c(f(() => !!(M.value && z.value.length)), Z), be = f(() => ({
183
+ transform: `scaleX(${+!!ye.value})`,
184
+ transformOrigin: `${L.value.plot.left}px 0px`,
185
+ transition: `transform ${Z.value.duration}ms ${Z.value.css}`
186
+ })), Q = f(() => u());
173
187
  function $(e, t) {
174
188
  let n = k.ui?.[e];
175
- return j.value ? [n, t] : Q.value[e]({ class: [n, t] });
189
+ return A.value ? [n, t] : Q.value[e]({ class: [n, t] });
176
190
  }
177
- return (e, t) => (b(), p("div", {
191
+ return (e, t) => (x(), m("div", {
178
192
  ref_key: "root",
179
- ref: M,
193
+ ref: j,
180
194
  role: k.label ? "figure" : void 0,
181
195
  "aria-label": k.label,
182
- class: _($("root", k.class))
196
+ class: v($("root", k.class))
183
197
  }, [
184
- de.value ? (b(), d(s, {
198
+ _e.value ? (x(), ee(l, {
185
199
  key: 0,
186
- series: I.value,
200
+ series: P.value,
187
201
  unstyled: k.unstyled
188
- }, null, 8, ["series", "unstyled"])) : f("", !0),
189
- m("div", { class: _(j.value ? void 0 : Q.value.plot()) }, [(b(), p("svg", {
190
- width: T(N),
202
+ }, null, 8, ["series", "unstyled"])) : p("", !0),
203
+ h("div", { class: v(A.value ? void 0 : Q.value.plot()) }, [(x(), m("svg", {
204
+ width: E(M),
191
205
  height: k.height,
192
- viewBox: `0 0 ${T(N)} ${k.height}`,
206
+ viewBox: `0 0 ${E(M)} ${k.height}`,
193
207
  "aria-hidden": "true",
194
- class: _($("svg"))
208
+ class: v($("svg"))
195
209
  }, [
196
- k.axis ? (b(!0), p(l, { key: 0 }, S(z.value.ticks, (e) => (b(), p("g", { key: `tick-${e}` }, [m("line", {
197
- x1: z.value.plot.left,
198
- y1: z.value.y(e),
199
- x2: z.value.plot.left + z.value.plot.width,
200
- y2: z.value.y(e),
210
+ k.axis ? (x(!0), m(d, { key: 0 }, C(L.value.ticks, (e) => (x(), m("g", { key: `tick-${e}` }, [h("line", {
211
+ x1: L.value.plot.left,
212
+ y1: L.value.y(e),
213
+ x2: L.value.plot.left + L.value.plot.width,
214
+ y2: L.value.y(e),
201
215
  "stroke-width": "1",
202
- class: _($("grid"))
203
- }, null, 10, re), m("text", {
204
- x: z.value.plot.left - T(8),
205
- y: z.value.y(e),
216
+ class: v($("grid"))
217
+ }, null, 10, O), h("text", {
218
+ x: L.value.plot.left - E(8),
219
+ y: L.value.y(e),
206
220
  "text-anchor": "end",
207
221
  "dominant-baseline": "middle",
208
- class: _($("tick"))
209
- }, w(F(e)), 11, ie)]))), 128)) : f("", !0),
210
- C(e.$slots, "underlay", v(g(z.value))),
211
- H.value ? (b(), p("defs", ae, [m("linearGradient", {
212
- id: q,
222
+ class: v($("tick"))
223
+ }, T(N(e)), 11, re)]))), 128)) : p("", !0),
224
+ w(e.$slots, "underlay", y(_(L.value))),
225
+ B.value ? (x(), m("defs", ie, [h("linearGradient", {
226
+ id: G,
213
227
  x1: "0",
214
228
  y1: "0",
215
229
  x2: "0",
216
230
  y2: "1"
217
- }, [...t[1] ||= [m("stop", {
231
+ }, [...t[1] ||= [h("stop", {
218
232
  offset: "0%",
219
233
  "stop-color": "currentColor",
220
234
  "stop-opacity": "0.35"
221
- }, null, -1), m("stop", {
235
+ }, null, -1), h("stop", {
222
236
  offset: "100%",
223
237
  "stop-color": "currentColor",
224
238
  "stop-opacity": "0"
225
- }, null, -1)]])])) : f("", !0),
226
- H.value ? (b(!0), p(l, { key: 2 }, S(V.value[0].runs, (e, t) => (b(), p("path", {
227
- key: `area-${t}`,
228
- d: fe(e),
229
- fill: `url(#${q})`,
230
- style: y({ color: V.value[0].color }),
231
- class: _($("area"))
232
- }, null, 14, oe))), 128)) : f("", !0),
233
- X.value == null ? f("", !0) : (b(), p("line", {
234
- key: 3,
235
- x1: X.value,
236
- y1: z.value.plot.top,
237
- x2: X.value,
238
- y2: z.value.plot.top + z.value.plot.height,
239
+ }, null, -1)]]), h("clipPath", { id: K }, [h("rect", {
240
+ x: L.value.plot.left,
241
+ y: L.value.plot.top,
242
+ width: L.value.plot.width,
243
+ height: L.value.plot.height,
244
+ style: b(be.value)
245
+ }, null, 12, ae)])])) : p("", !0),
246
+ Y.value == null ? p("", !0) : (x(), m("line", {
247
+ key: 2,
248
+ x1: Y.value,
249
+ y1: L.value.plot.top,
250
+ x2: Y.value,
251
+ y2: L.value.plot.top + L.value.plot.height,
239
252
  "stroke-width": "1",
240
- class: _($("crosshair"))
241
- }, null, 10, se)),
242
- (b(!0), p(l, null, S(V.value, (e) => (b(), p(l, { key: `series-${e.seriesIndex}` }, [(b(!0), p(l, null, S(e.runs, (t, n) => (b(), p("path", {
253
+ class: v($("crosshair"))
254
+ }, null, 10, oe)),
255
+ h("g", { "clip-path": `url(#${K})` }, [(x(!0), m(d, null, C(B.value ? z.value[0].runs : [], (e, t) => (x(), m("path", {
256
+ key: `area-${t}`,
257
+ d: ve(e),
258
+ fill: `url(#${G})`,
259
+ style: b({ color: z.value[0].color }),
260
+ class: v($("area"))
261
+ }, null, 14, ce))), 128)), (x(!0), m(d, null, C(z.value, (e) => (x(), m(d, { key: `series-${e.seriesIndex}` }, [(x(!0), m(d, null, C(e.runs, (t, n) => (x(), m("path", {
243
262
  key: `line-${e.seriesIndex}-${n}`,
244
- d: K(t),
245
- style: y({ stroke: e.color }),
246
- class: _($("line"))
247
- }, null, 14, ce))), 128))], 64))), 128)),
248
- (b(!0), p(l, null, S(Y.value, (e, t) => (b(), p(l, { key: `marker-${t}` }, [m("circle", {
263
+ d: W(t),
264
+ style: b({ stroke: e.color }),
265
+ class: v($("line"))
266
+ }, null, 14, le))), 128))], 64))), 128))], 8, se),
267
+ (x(!0), m(d, null, C(J.value, (e, t) => (x(), m(d, { key: `marker-${t}` }, [h("circle", {
249
268
  cx: e.x,
250
269
  cy: e.y,
251
270
  r: "6",
252
- class: _($("markerRing"))
253
- }, null, 10, le), m("circle", {
271
+ class: v($("markerRing"))
272
+ }, null, 10, ue), h("circle", {
254
273
  cx: e.x,
255
274
  cy: e.y,
256
275
  r: "4",
257
- style: y({ fill: e.color }),
258
- class: _($("marker"))
259
- }, null, 14, ue)], 64))), 128)),
260
- (b(!0), p(l, null, S(k.data, (e, t) => (b(), p(l, { key: `label-${e.label}-${t}` }, [t % z.value.labelStep === 0 ? (b(), p("text", {
276
+ style: b({ fill: e.color }),
277
+ class: v($("marker"))
278
+ }, null, 14, de)], 64))), 128)),
279
+ (x(!0), m(d, null, C(k.data, (e, t) => (x(), m(d, { key: `label-${e.label}-${t}` }, [t % L.value.labelStep === 0 ? (x(), m("text", {
261
280
  key: 0,
262
- x: z.value.pointAt(t),
263
- y: z.value.plot.top + z.value.plot.height + 14,
281
+ x: L.value.pointAt(t),
282
+ y: L.value.plot.top + L.value.plot.height + 14,
264
283
  "text-anchor": "middle",
265
- class: _($("category"))
266
- }, w(e.label), 11, E)) : f("", !0)], 64))), 128)),
267
- C(e.$slots, "overlay", v(g(z.value))),
268
- (b(!0), p(l, null, S(k.data, (e, n) => (b(), p("rect", {
284
+ class: v($("category"))
285
+ }, T(e.label), 11, fe)) : p("", !0)], 64))), 128)),
286
+ w(e.$slots, "overlay", y(_(L.value))),
287
+ (x(!0), m(d, null, C(k.data, (e, n) => (x(), m("rect", {
269
288
  key: `hit-${e.label}-${n}`,
270
- x: z.value.plot.left + z.value.bandWidth * n,
271
- y: z.value.plot.top,
272
- width: z.value.bandWidth,
273
- height: z.value.plot.height,
274
- class: _(j.value ? void 0 : Q.value.hit()),
275
- onPointerenter: (e) => J.value = n,
276
- onPointerleave: t[0] ||= (e) => J.value = void 0
277
- }, null, 42, D))), 128))
278
- ], 10, ne)), Z.value ? (b(), p("div", {
289
+ x: L.value.plot.left + L.value.bandWidth * n,
290
+ y: L.value.plot.top,
291
+ width: L.value.bandWidth,
292
+ height: L.value.plot.height,
293
+ class: v(A.value ? void 0 : Q.value.hit()),
294
+ onPointerenter: (e) => q.value = n,
295
+ onPointerleave: t[0] ||= (e) => q.value = void 0
296
+ }, null, 42, pe))), 128))
297
+ ], 10, ne)), X.value ? (x(), m("div", {
279
298
  key: 0,
280
- class: _($("tooltip", Z.value.multi ? "flex-col items-start gap-1" : void 0)),
281
- style: y({
282
- left: `${Z.value.x}px`,
283
- top: `${Z.value.y}px`,
299
+ class: v($("tooltip", X.value.multi ? "flex-col items-start gap-1" : void 0)),
300
+ style: b({
301
+ left: `${X.value.x}px`,
302
+ top: `${X.value.y}px`,
284
303
  transform: "translate(-50%, -100%) translateY(-12px)"
285
304
  })
286
- }, [m("span", { class: _($("tooltipLabel")) }, w(Z.value.label), 3), Z.value.multi ? (b(!0), p(l, { key: 0 }, S(Z.value.rows, (e) => (b(), p("span", {
305
+ }, [h("span", { class: v($("tooltipLabel")) }, T(X.value.label), 3), X.value.multi ? (x(!0), m(d, { key: 0 }, C(X.value.rows, (e) => (x(), m("span", {
287
306
  key: e.name,
288
307
  class: "flex items-center gap-1.5"
289
308
  }, [
290
- m("span", {
309
+ h("span", {
291
310
  class: "size-2 shrink-0 rounded-full",
292
- style: y({ background: e.color })
311
+ style: b({ background: e.color })
293
312
  }, null, 4),
294
- m("span", { class: _($("tooltipLabel")) }, w(e.name), 3),
295
- m("span", { class: _($("tooltipValue")) }, w(e.value), 3)
296
- ]))), 128)) : (b(), p("span", {
313
+ h("span", { class: v($("tooltipLabel")) }, T(e.name), 3),
314
+ h("span", { class: v($("tooltipValue")) }, T(e.value), 3)
315
+ ]))), 128)) : (x(), m("span", {
297
316
  key: 1,
298
- class: _($("tooltipValue"))
299
- }, w(Z.value.rows[0].value), 3))], 6)) : f("", !0)], 2),
300
- m("div", { class: _($("table")) }, [m("table", null, [
301
- m("caption", null, w(k.label), 1),
302
- m("thead", null, [m("tr", null, [t[2] ||= m("th", { scope: "col" }, " Category ", -1), (b(!0), p(l, null, S(I.value, (e) => (b(), p("th", {
317
+ class: v($("tooltipValue"))
318
+ }, T(X.value.rows[0].value), 3))], 6)) : p("", !0)], 2),
319
+ h("div", { class: v($("table")) }, [h("table", null, [
320
+ h("caption", null, T(k.label), 1),
321
+ h("thead", null, [h("tr", null, [t[2] ||= h("th", { scope: "col" }, " Category ", -1), (x(!0), m(d, null, C(P.value, (e) => (x(), m("th", {
303
322
  key: e.key,
304
323
  scope: "col"
305
- }, w(e.name ?? "Value"), 1))), 128))])]),
306
- m("tbody", null, [(b(!0), p(l, null, S(k.data, (e, t) => (b(), p("tr", { key: `row-${e.label}-${t}` }, [m("th", O, w(e.label), 1), (b(!0), p(l, null, S(I.value, (t) => (b(), p("td", { key: t.key }, w(R(e, t.key) == null ? "—" : F(R(e, t.key))), 1))), 128))]))), 128))])
324
+ }, T(e.name ?? "Value"), 1))), 128))])]),
325
+ h("tbody", null, [(x(!0), m(d, null, C(k.data, (e, t) => (x(), m("tr", { key: `row-${e.label}-${t}` }, [h("th", me, T(e.label), 1), (x(!0), m(d, null, C(P.value, (t) => (x(), m("td", { key: t.key }, T(I(e, t.key) == null ? "—" : N(I(e, t.key))), 1))), 128))]))), 128))])
307
326
  ])], 2)
308
327
  ], 10, te));
309
328
  }
@@ -1,3 +1,4 @@
1
+ import type { ChartAnimate } from '../composables/chart-reveal';
1
2
  import type { SparseValue } from '../composables/scale';
2
3
  export interface SparklineProps {
3
4
  /** Values, oldest first. `null` is a gap in the series, not a zero. */
@@ -21,6 +22,13 @@ export interface SparklineProps {
21
22
  label?: string;
22
23
  /** Rendered height in px. Width always fills the container. */
23
24
  height?: number;
25
+ /**
26
+ * Draw the line on across the box on the first paint. Off by default here,
27
+ * unlike the full-size charts: a sparkline usually sits inside a stat tile
28
+ * or a table row, and a page of them animating at once is a distraction
29
+ * rather than an arrival.
30
+ */
31
+ animate?: ChartAnimate;
24
32
  /** Skip built-in classes; you take over styling entirely. */
25
33
  unstyled?: boolean;
26
34
  class?: string;
@@ -31,6 +39,7 @@ declare const __VLS_export: import("vue").DefineComponent<SparklineProps, {}, {}
31
39
  variant: "line" | "area";
32
40
  unstyled: boolean;
33
41
  data: readonly SparseValue[];
42
+ animate: ChartAnimate;
34
43
  height: number;
35
44
  baseline: "min" | "zero";
36
45
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;