vue-chrts 0.2.0 → 0.2.2-test.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,13 +1,13 @@
1
- import { defineComponent as U, useSlots as j, useTemplateRef as w, ref as R, computed as d, createElementBlock as c, openBlock as a, normalizeClass as T, createVNode as u, createCommentVNode as p, createElementVNode as X, unref as i, withCtx as S, createBlock as m, Fragment as L, renderList as Y, mergeProps as C, renderSlot as A } from "vue";
2
- import { Position as b, CurveType as D } from "@unovis/ts";
3
- import { createMarkers as z, getFirstPropertyValue as I } from "../../utils.js";
4
- import x from "../Tooltip.js";
5
- import { VisXYContainer as H, VisTooltip as K, VisArea as q, VisLine as J, VisAxis as B, VisCrosshair as Q, VisBulletLegend as Z } from "@unovis/vue";
6
- import { LegendPosition as _ } from "../../types.js";
7
- const ee = {
1
+ import { defineComponent as U, useSlots as j, useTemplateRef as w, ref as R, computed as u, createElementBlock as m, openBlock as r, normalizeClass as S, normalizeStyle as T, createVNode as p, createCommentVNode as d, createElementVNode as X, unref as i, withCtx as z, createBlock as c, Fragment as L, renderList as I, mergeProps as C, renderSlot as A } from "vue";
2
+ import { Position as D, CurveType as b } from "@unovis/ts";
3
+ import { createMarkers as Y, getFirstPropertyValue as x } from "../../utils.js";
4
+ import H from "../Tooltip.js";
5
+ import { VisXYContainer as K, VisTooltip as q, VisArea as J, VisLine as Q, VisAxis as B, VisCrosshair as Z, VisBulletLegend as _ } from "@unovis/vue";
6
+ import { LegendPosition as ee } from "../../types.js";
7
+ const te = {
8
8
  ref: "slotWrapper",
9
- class: "hidden"
10
- }, y = 24, V = 4, te = 0.5, F = "#3b82f6", se = /* @__PURE__ */ U({
9
+ style: { display: "none" }
10
+ }, y = 24, V = 4, ie = 0.5, F = "#3b82f6", de = /* @__PURE__ */ U({
11
11
  __name: "AreaChart",
12
12
  props: {
13
13
  data: {},
@@ -22,10 +22,10 @@ const ee = {
22
22
  curveType: {},
23
23
  lineWidth: { default: 2 },
24
24
  lineDashArray: {},
25
- xNumTicks: { default: (n) => n.data.length > y ? y / V : n.data.length - 1 },
25
+ xNumTicks: { default: (a) => a.data.length > y ? y / V : a.data.length - 1 },
26
26
  xExplicitTicks: {},
27
27
  minMaxTicksOnly: { type: Boolean },
28
- yNumTicks: { default: (n) => n.data.length > y ? y / V : n.data.length - 1 },
28
+ yNumTicks: { default: (a) => a.data.length > y ? y / V : a.data.length - 1 },
29
29
  hideLegend: { type: Boolean },
30
30
  hideTooltip: { type: Boolean },
31
31
  legendPosition: {},
@@ -42,10 +42,10 @@ const ee = {
42
42
  }) }
43
43
  },
44
44
  emits: ["click"],
45
- setup(n, { emit: $ }) {
46
- const G = $, r = n, O = j(), h = w("slotWrapper"), s = R(), f = d(
47
- () => Object.values(r.categories).map((e) => e.color)
48
- ), N = d(() => r.markerConfig ? z(r.markerConfig) : ""), g = d(() => r.legendPosition === _.Top), E = d(() => {
45
+ setup(a, { emit: $ }) {
46
+ const G = $, n = a, O = j(), h = w("slotWrapper"), s = R(), f = u(
47
+ () => Object.values(n.categories).map((e) => e.color)
48
+ ), N = u(() => n.markerConfig ? Y(n.markerConfig) : ""), g = u(() => n.legendPosition === ee.Top), E = u(() => {
49
49
  const e = (t, o) => `
50
50
  <linearGradient id="gradient${t}-${o}" gradientTransform="rotate(90)">
51
51
  <stop offset="0%" stop-color="${o}" stop-opacity="1" />
@@ -65,7 +65,7 @@ const ee = {
65
65
  var l;
66
66
  return {
67
67
  y: (t) => Number(t[e]),
68
- color: ((l = r.categories[e]) == null ? void 0 : l.color) ?? F
68
+ color: ((l = n.categories[e]) == null ? void 0 : l.color) ?? F
69
69
  };
70
70
  }
71
71
  function W(e) {
@@ -74,40 +74,44 @@ const ee = {
74
74
  function M(e) {
75
75
  return s.value = e, W();
76
76
  }
77
- return (e, l) => (a(), c("div", {
78
- class: T(["flex flex-col", { "flex-col-reverse": g.value, markers: !!r.markerConfig }]),
77
+ return (e, l) => (r(), m("div", {
78
+ style: T({
79
+ display: "flex",
80
+ flexDirection: g.value ? "column-reverse" : "column"
81
+ }),
82
+ class: S({ markers: !!n.markerConfig }),
79
83
  onClick: l[0] || (l[0] = (t) => G("click", t, s.value))
80
84
  }, [
81
- u(i(H), {
85
+ p(i(K), {
82
86
  data: e.data,
83
87
  height: e.height,
84
88
  padding: e.padding,
85
89
  "svg-defs": E.value + N.value
86
90
  }, {
87
- default: S(() => [
88
- e.hideTooltip ? p("", !0) : (a(), m(i(K), {
91
+ default: z(() => [
92
+ e.hideTooltip ? d("", !0) : (r(), c(i(q), {
89
93
  key: 0,
90
- "horizontal-placement": i(b).Right,
91
- "vertical-placement": i(b).Top
94
+ "horizontal-placement": i(D).Right,
95
+ "vertical-placement": i(D).Top
92
96
  }, null, 8, ["horizontal-placement", "vertical-placement"])),
93
- (a(!0), c(L, null, Y(Object.keys(r.categories), (t, o) => (a(), c(L, { key: t }, [
94
- u(i(q), C({
97
+ (r(!0), m(L, null, I(Object.keys(n.categories), (t, o) => (r(), m(L, { key: t }, [
98
+ p(i(J), C({
95
99
  x: (k, v) => v
96
100
  }, { ref_for: !0 }, P(t), {
97
101
  color: `url(#gradient${o}-${f.value[o]})`,
98
- opacity: te,
99
- "curve-type": e.curveType ?? i(D).MonotoneX
102
+ opacity: ie,
103
+ "curve-type": e.curveType ?? i(b).MonotoneX
100
104
  }), null, 16, ["x", "color", "curve-type"]),
101
- u(i(J), {
105
+ p(i(Q), {
102
106
  x: (k, v) => v,
103
107
  y: (k) => k[t],
104
108
  color: f.value[o],
105
- "curve-type": e.curveType ?? i(D).MonotoneX,
109
+ "curve-type": e.curveType ?? i(b).MonotoneX,
106
110
  "line-width": e.lineWidth,
107
111
  lineDashArray: e.lineDashArray ? e.lineDashArray[o] : void 0
108
112
  }, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"])
109
113
  ], 64))), 128)),
110
- e.hideXAxis ? p("", !0) : (a(), m(i(B), {
114
+ e.hideXAxis ? d("", !0) : (r(), c(i(B), {
111
115
  key: 1,
112
116
  type: "x",
113
117
  label: e.xLabel,
@@ -120,7 +124,7 @@ const ee = {
120
124
  "tick-line": e.xTickLine,
121
125
  "min-max-ticks-only": e.minMaxTicksOnly
122
126
  }, null, 8, ["label", "num-ticks", "tick-format", "tick-values", "grid-line", "domain-line", "tick-line", "min-max-ticks-only"])),
123
- e.hideYAxis ? p("", !0) : (a(), m(i(B), {
127
+ e.hideYAxis ? d("", !0) : (r(), c(i(B), {
124
128
  key: 2,
125
129
  type: "y",
126
130
  label: e.yLabel,
@@ -130,34 +134,40 @@ const ee = {
130
134
  "domain-line": e.yDomainLine,
131
135
  "tick-line": e.yTickLine
132
136
  }, null, 8, ["label", "num-ticks", "tick-format", "grid-line", "domain-line", "tick-line"])),
133
- e.hideTooltip ? p("", !0) : (a(), m(i(Q), C({ key: 3 }, e.crosshairConfig, { template: M }), null, 16))
137
+ e.hideTooltip ? d("", !0) : (r(), c(i(Z), C({ key: 3 }, e.crosshairConfig, { template: M }), null, 16))
134
138
  ]),
135
139
  _: 1
136
140
  }, 8, ["data", "height", "padding", "svg-defs"]),
137
- e.hideLegend ? p("", !0) : (a(), c("div", {
141
+ e.hideLegend ? d("", !0) : (r(), m("div", {
138
142
  key: 0,
139
- class: T(["flex items-center justify-end", { "pb-4": g.value, "pt-4": !g.value }])
143
+ style: T({
144
+ display: "flex",
145
+ alignItems: "center",
146
+ justifyContent: "flex-end",
147
+ paddingBottom: g.value ? "1rem" : void 0,
148
+ paddingTop: g.value ? void 0 : "1rem"
149
+ })
140
150
  }, [
141
- u(i(Z), {
151
+ p(i(_), {
142
152
  items: Object.values(e.categories)
143
153
  }, null, 8, ["items"])
144
- ], 2)),
145
- X("div", ee, [
154
+ ], 4)),
155
+ X("div", te, [
146
156
  i(O).tooltip ? A(e.$slots, "tooltip", {
147
157
  key: 0,
148
158
  values: s.value
149
159
  }) : s.value ? A(e.$slots, "fallback", { key: 1 }, () => [
150
- u(x, {
160
+ p(H, {
151
161
  data: s.value,
152
162
  categories: e.categories,
153
- toolTipTitle: i(I)(s.value) ?? "",
154
- yFormatter: r.yFormatter
163
+ toolTipTitle: i(x)(s.value) ?? "",
164
+ yFormatter: n.yFormatter
155
165
  }, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
156
- ]) : p("", !0)
166
+ ]) : d("", !0)
157
167
  ], 512)
158
- ], 2));
168
+ ], 6));
159
169
  }
160
170
  });
161
171
  export {
162
- se as default
172
+ de as default
163
173
  };
@@ -1,14 +1,14 @@
1
- import { defineComponent as C, useSlots as N, useTemplateRef as O, ref as D, computed as T, createElementBlock as m, openBlock as n, normalizeClass as L, createVNode as g, createCommentVNode as c, createElementVNode as w, unref as i, withCtx as E, createBlock as u, Fragment as M, renderList as S, renderSlot as v } from "vue";
1
+ import { defineComponent as C, useSlots as D, useTemplateRef as N, ref as O, computed as T, createElementBlock as y, openBlock as n, normalizeStyle as v, createVNode as g, createCommentVNode as m, createElementVNode as S, unref as i, withCtx as w, createBlock as u, Fragment as E, renderList as M, renderSlot as B } from "vue";
2
2
  import { Orientation as l, StackedBar as j, GroupedBar as z } from "@unovis/ts";
3
3
  import { getFirstPropertyValue as H } from "../../utils.js";
4
4
  import { useStackedGrouped as W } from "./stackedGroupedUtils.js";
5
- import { VisXYContainer as X, VisTooltip as Y, VisStackedBar as B, VisGroupedBar as $, VisAxis as A, VisBulletLegend as R } from "@unovis/vue";
5
+ import { VisXYContainer as X, VisTooltip as Y, VisStackedBar as L, VisGroupedBar as $, VisAxis as A, VisBulletLegend as R } from "@unovis/vue";
6
6
  import q from "../Tooltip.js";
7
- import { LegendPosition as U } from "../../types.js";
8
- const I = {
7
+ import { LegendPosition as I } from "../../types.js";
8
+ const U = {
9
9
  ref: "slotWrapper",
10
- class: "hidden"
11
- }, ae = /* @__PURE__ */ C({
10
+ style: { display: "none" }
11
+ }, oe = /* @__PURE__ */ C({
12
12
  __name: "BarChart",
13
13
  props: {
14
14
  data: {},
@@ -50,55 +50,59 @@ const I = {
50
50
  },
51
51
  emits: ["click"],
52
52
  setup(t, { emit: V }) {
53
- const x = V, a = t, P = N(), y = O("slotWrapper"), r = D();
54
- if (!a.yAxis || a.yAxis.length === 0)
53
+ const x = V, o = t, P = D(), c = N("slotWrapper"), r = O();
54
+ if (!o.yAxis || o.yAxis.length === 0)
55
55
  throw new Error("yAxis is required");
56
- const k = T(() => a.yAxis.map((e) => (d) => d[e])), f = (e, d) => {
57
- var o;
58
- return (o = Object.values(a.categories)[d]) == null ? void 0 : o.color;
56
+ const k = T(() => o.yAxis.map((e) => (d) => d[e])), f = (e, d) => {
57
+ var a;
58
+ return (a = Object.values(o.categories)[d]) == null ? void 0 : a.color;
59
59
  }, s = W({
60
- data: a.data,
61
- categories: a.categories,
62
- stackAndGrouped: a.stackAndGrouped,
63
- xAxis: a.xAxis
60
+ data: o.data,
61
+ categories: o.categories,
62
+ stackAndGrouped: o.stackAndGrouped,
63
+ xAxis: o.xAxis
64
64
  }), h = T(
65
- () => a.legendPosition === U.Top
65
+ () => o.legendPosition === I.Top
66
66
  );
67
67
  function b(e) {
68
68
  return r.value = e, G();
69
69
  }
70
70
  function G(e) {
71
- return typeof window > "u" ? "" : y.value ? y.value.innerHTML : "";
71
+ return typeof window > "u" ? "" : c.value ? c.value.innerHTML : "";
72
72
  }
73
- return (e, d) => (n(), m("div", {
74
- class: L(["flex flex-col space-y-4", { "flex-col-reverse": h.value }]),
75
- onClick: d[0] || (d[0] = (o) => x("click", o, r.value))
73
+ return (e, d) => (n(), y("div", {
74
+ style: v({
75
+ display: "flex",
76
+ flexDirection: h.value ? "column-reverse" : "column",
77
+ gap: "1rem"
78
+ }),
79
+ onClick: d[0] || (d[0] = (a) => x("click", a, r.value))
76
80
  }, [
77
81
  g(i(X), {
78
82
  padding: e.padding,
79
83
  height: e.height
80
84
  }, {
81
- default: E(() => [
85
+ default: w(() => [
82
86
  g(i(Y), {
83
87
  triggers: {
84
88
  [i(z).selectors.bar]: b,
85
89
  [i(j).selectors.bar]: b
86
90
  }
87
91
  }, null, 8, ["triggers"]),
88
- e.stackAndGrouped ? (n(!0), m(M, { key: 0 }, S(i(s).states, (o) => (n(), u(i(B), {
89
- key: o,
92
+ e.stackAndGrouped ? (n(!0), y(E, { key: 0 }, M(i(s).states, (a) => (n(), u(i(L), {
93
+ key: a,
90
94
  data: i(s).chartData,
91
- x: (p, F) => F + i(s).positions[o],
92
- y: i(s).bars[o],
93
- color: i(s).colorFunctions[o],
95
+ x: (p, F) => F + i(s).positions[a],
96
+ y: i(s).bars[a],
97
+ color: i(s).colorFunctions[a],
94
98
  "rounded-corners": e.radius ?? 0,
95
99
  "group-padding": e.groupPadding ?? 0,
96
100
  "bar-padding": e.barPadding ?? 0.2,
97
101
  orientation: e.orientation ?? i(l).Vertical
98
- }, null, 8, ["data", "x", "y", "color", "rounded-corners", "group-padding", "bar-padding", "orientation"]))), 128)) : e.stacked ? (n(), u(i(B), {
102
+ }, null, 8, ["data", "x", "y", "color", "rounded-corners", "group-padding", "bar-padding", "orientation"]))), 128)) : e.stacked ? (n(), u(i(L), {
99
103
  key: 2,
100
104
  data: e.data,
101
- x: (o, p) => p,
105
+ x: (a, p) => p,
102
106
  y: k.value,
103
107
  color: f,
104
108
  "rounded-corners": e.radius ?? 0,
@@ -108,7 +112,7 @@ const I = {
108
112
  }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (n(), u(i($), {
109
113
  key: 1,
110
114
  data: e.data,
111
- x: (o, p) => p,
115
+ x: (a, p) => p,
112
116
  y: k.value,
113
117
  color: f,
114
118
  "rounded-corners": e.radius ?? 0,
@@ -116,7 +120,7 @@ const I = {
116
120
  "bar-padding": e.barPadding ?? 0.2,
117
121
  orientation: e.orientation ?? i(l).Vertical
118
122
  }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
119
- e.hideXAxis ? c("", !0) : (n(), u(i(A), {
123
+ e.hideXAxis ? m("", !0) : (n(), u(i(A), {
120
124
  key: 3,
121
125
  type: "x",
122
126
  "tick-format": e.xFormatter,
@@ -128,7 +132,7 @@ const I = {
128
132
  "tick-values": e.xExplicitTicks,
129
133
  minMaxTicksOnly: e.minMaxTicksOnly
130
134
  }, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "minMaxTicksOnly"])),
131
- e.hideYAxis ? c("", !0) : (n(), u(i(A), {
135
+ e.hideYAxis ? m("", !0) : (n(), u(i(A), {
132
136
  key: 4,
133
137
  type: "y",
134
138
  label: e.yLabel,
@@ -141,30 +145,35 @@ const I = {
141
145
  ]),
142
146
  _: 1
143
147
  }, 8, ["padding", "height"]),
144
- e.hideLegend ? c("", !0) : (n(), m("div", {
148
+ e.hideLegend ? m("", !0) : (n(), y("div", {
145
149
  key: 0,
146
- class: L(["flex items center justify-end", { "pb-4": h.value }])
150
+ style: v({
151
+ display: "flex",
152
+ alignItems: "center",
153
+ justifyContent: "flex-end",
154
+ paddingBottom: h.value ? "1rem" : void 0
155
+ })
147
156
  }, [
148
157
  g(i(R), {
149
- items: Object.values(a.categories)
158
+ items: Object.values(o.categories)
150
159
  }, null, 8, ["items"])
151
- ], 2)),
152
- w("div", I, [
153
- i(P).tooltip ? v(e.$slots, "tooltip", {
160
+ ], 4)),
161
+ S("div", U, [
162
+ i(P).tooltip ? B(e.$slots, "tooltip", {
154
163
  key: 0,
155
164
  values: r.value
156
- }) : r.value ? v(e.$slots, "fallback", { key: 1 }, () => [
165
+ }) : r.value ? B(e.$slots, "fallback", { key: 1 }, () => [
157
166
  g(q, {
158
167
  data: r.value,
159
- categories: a.categories,
168
+ categories: o.categories,
160
169
  toolTipTitle: i(H)(r.value) ?? "",
161
- yFormatter: a.orientation === i(l).Horizontal ? a.xFormatter : a.yFormatter
170
+ yFormatter: o.orientation === i(l).Horizontal ? o.xFormatter : o.yFormatter
162
171
  }, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
163
- ]) : c("", !0)
172
+ ]) : m("", !0)
164
173
  ], 512)
165
- ], 2));
174
+ ], 4));
166
175
  }
167
176
  });
168
177
  export {
169
- ae as default
178
+ oe as default
170
179
  };
@@ -1,14 +1,19 @@
1
- import { defineComponent as V, useSlots as b, useTemplateRef as w, ref as D, createElementBlock as u, openBlock as c, Fragment as S, createElementVNode as o, createCommentVNode as p, createVNode as n, renderSlot as s, unref as l, withCtx as T, normalizeStyle as W, toDisplayString as B } from "vue";
1
+ import { defineComponent as V, useSlots as b, useTemplateRef as w, ref as T, createElementBlock as u, openBlock as p, Fragment as D, createElementVNode as n, createCommentVNode as m, createVNode as o, renderSlot as i, unref as l, withCtx as S, normalizeStyle as W, toDisplayString as B } from "vue";
2
2
  import { Donut as L } from "@unovis/ts";
3
- import { DonutType as $ } from "./types.js";
4
- import { VisSingleContainer as H, VisTooltip as N, VisDonut as j, VisBulletLegend as z } from "@unovis/vue";
5
- const A = {
3
+ import { DonutType as R } from "./types.js";
4
+ import { VisSingleContainer as H, VisTooltip as N, VisDonut as $, VisBulletLegend as j } from "@unovis/vue";
5
+ const z = {
6
6
  ref: "slotWrapper",
7
- class: "hidden"
8
- }, E = { class: "flex items-center px-[15px] py-[10px]" }, R = {
7
+ style: { display: "none" }
8
+ }, A = { style: { display: "flex", "align-items": "center", padding: "10px 15px" } }, E = {
9
9
  key: 0,
10
- class: "flex items-center justify-center mt-4"
11
- }, U = /* @__PURE__ */ V({
10
+ style: {
11
+ display: "flex",
12
+ alignItems: "center",
13
+ justifyContent: "center",
14
+ marginTop: "1rem"
15
+ }
16
+ }, M = /* @__PURE__ */ V({
12
17
  __name: "DonutChart",
13
18
  props: {
14
19
  type: {},
@@ -21,65 +26,74 @@ const A = {
21
26
  padAngle: {}
22
27
  },
23
28
  emits: ["click"],
24
- setup(f, { emit: m }) {
25
- const g = m, r = f, h = b(), i = w("slotWrapper"), t = D(), v = (e) => e, y = r.type === $.Half;
26
- function k(e) {
27
- return t.value = e, C();
28
- }
29
+ setup(c, { emit: g }) {
30
+ const f = g, r = c, h = b(), s = w("slotWrapper"), t = T(), y = (e) => e, v = r.type === R.Half;
29
31
  function C(e) {
30
- return typeof window > "u" ? "" : i.value ? i.value.innerHTML : "";
32
+ return t.value = e, k();
33
+ }
34
+ function k(e) {
35
+ return typeof window > "u" ? "" : s.value ? s.value.innerHTML : "";
31
36
  }
32
- return (e, d) => (c(), u(S, null, [
33
- o("div", {
34
- class: "flex items-center justify-center",
35
- onClick: d[0] || (d[0] = (a) => g("click", a, t.value))
37
+ return (e, d) => (p(), u(D, null, [
38
+ n("div", {
39
+ style: {
40
+ display: "flex",
41
+ alignItems: "center",
42
+ justifyContent: "center"
43
+ },
44
+ onClick: d[0] || (d[0] = (a) => f("click", a, t.value))
36
45
  }, [
37
- n(l(H), {
46
+ o(l(H), {
38
47
  data: e.data,
39
48
  height: e.height,
40
49
  margin: {}
41
50
  }, {
42
- default: T(() => [
43
- n(l(N), {
51
+ default: S(() => [
52
+ o(l(N), {
44
53
  "horizontal-shift": 20,
45
54
  "vertical-shift": 20,
46
55
  triggers: {
47
- [l(L).selectors.segment]: k
56
+ [l(L).selectors.segment]: C
48
57
  }
49
58
  }, null, 8, ["triggers"]),
50
- n(l(j), {
51
- value: v,
59
+ o(l($), {
60
+ value: y,
52
61
  "corner-radius": e.radius,
53
62
  "arc-width": e.arcWidth ?? 20,
54
63
  color: r.labels.map((a) => a.color),
55
- "angle-range": y ? [-1.5707963267948966, 1.5707963267948966] : [],
64
+ "angle-range": v ? [-1.5707963267948966, 1.5707963267948966] : [],
56
65
  "pad-angle": r.padAngle || 0
57
66
  }, null, 8, ["corner-radius", "arc-width", "color", "angle-range", "pad-angle"])
58
67
  ]),
59
68
  _: 1
60
69
  }, 8, ["data", "height"]),
61
- s(e.$slots, "default"),
62
- o("div", A, [
63
- l(h).tooltip ? s(e.$slots, "tooltip", {
70
+ i(e.$slots, "default"),
71
+ n("div", z, [
72
+ l(h).tooltip ? i(e.$slots, "tooltip", {
64
73
  key: 0,
65
74
  values: t.value
66
- }) : t.value ? s(e.$slots, "fallback", { key: 1 }, () => [
67
- o("div", E, [
68
- o("div", {
69
- class: "w-2 h-2 rounded-full mr-2",
70
- style: W(`background-color: ${r.labels[t.value.index].color} ;`)
75
+ }) : t.value ? i(e.$slots, "fallback", { key: 1 }, () => [
76
+ n("div", A, [
77
+ n("div", {
78
+ style: W({
79
+ width: "0.5rem",
80
+ height: "0.5rem",
81
+ borderRadius: "9999px",
82
+ marginRight: "0.5rem",
83
+ backgroundColor: r.labels[t.value.index].color
84
+ })
71
85
  }, null, 4),
72
- o("div", null, B(t.value.data), 1)
86
+ n("div", null, B(t.value.data), 1)
73
87
  ])
74
- ]) : p("", !0)
88
+ ]) : m("", !0)
75
89
  ], 512)
76
90
  ]),
77
- e.hideLegend ? p("", !0) : (c(), u("div", R, [
78
- n(l(z), { items: e.labels }, null, 8, ["items"])
91
+ e.hideLegend ? m("", !0) : (p(), u("div", E, [
92
+ o(l(j), { items: e.labels }, null, 8, ["items"])
79
93
  ]))
80
94
  ], 64));
81
95
  }
82
96
  });
83
97
  export {
84
- U as default
98
+ M as default
85
99
  };
@@ -1,13 +1,13 @@
1
- import { defineComponent as P, computed as k, useSlots as O, useTemplateRef as j, ref as w, createElementBlock as c, openBlock as n, normalizeClass as g, createVNode as s, createCommentVNode as l, createElementVNode as x, unref as i, withCtx as M, createBlock as d, Fragment as W, renderList as E, mergeProps as G, renderSlot as h } from "vue";
1
+ import { defineComponent as P, computed as f, useSlots as O, useTemplateRef as j, ref as w, createElementBlock as p, openBlock as n, normalizeClass as x, normalizeStyle as k, createVNode as s, createCommentVNode as a, createElementVNode as M, unref as i, withCtx as W, createBlock as m, Fragment as z, renderList as E, mergeProps as G, renderSlot as h } from "vue";
2
2
  import { Position as v, CurveType as X } from "@unovis/ts";
3
- import { createMarkers as $, getFirstPropertyValue as z } from "../../utils.js";
4
- import R from "../Tooltip.js";
5
- import { VisXYContainer as Y, VisTooltip as S, VisLine as H, VisAxis as T, VisCrosshair as U, VisBulletLegend as q } from "@unovis/vue";
6
- import { LegendPosition as I } from "../../types.js";
7
- const J = {
3
+ import { createMarkers as $, getFirstPropertyValue as R } from "../../utils.js";
4
+ import S from "../Tooltip.js";
5
+ import { VisXYContainer as Y, VisTooltip as H, VisLine as I, VisAxis as T, VisCrosshair as U, VisBulletLegend as q } from "@unovis/vue";
6
+ import { LegendPosition as J } from "../../types.js";
7
+ const Q = {
8
8
  ref: "slotWrapper",
9
- class: "hidden"
10
- }, te = /* @__PURE__ */ P({
9
+ style: { display: "none" }
10
+ }, oe = /* @__PURE__ */ P({
11
11
  __name: "LineChart",
12
12
  props: {
13
13
  data: {},
@@ -48,46 +48,48 @@ const J = {
48
48
  },
49
49
  emits: ["click"],
50
50
  setup(o, { emit: L }) {
51
- const C = L, t = o, b = k(() => t.markerConfig ? $(t.markerConfig) : ""), B = O(), p = j("slotWrapper"), a = w();
51
+ const C = L, t = o, B = f(() => t.markerConfig ? $(t.markerConfig) : ""), b = O(), c = j("slotWrapper"), l = w();
52
52
  function D(e) {
53
- return typeof window > "u" ? "" : p.value ? p.value.innerHTML : "";
53
+ return typeof window > "u" ? "" : c.value ? c.value.innerHTML : "";
54
54
  }
55
55
  function V(e) {
56
- return a.value = e, D();
56
+ return l.value = e, D();
57
57
  }
58
- const y = k(
59
- () => t.legendPosition === I.Top
58
+ const y = f(
59
+ () => t.legendPosition === J.Top
60
60
  ), A = Object.values(t.categories).map(
61
61
  (e, r) => `var(--vis-color${r})`
62
62
  ), F = (e) => Object.values(t.categories)[e].color ?? A[e];
63
- return (e, r) => (n(), c("div", {
64
- class: g(["flex flex-col space-y-4", {
65
- "flex-col-reverse": y.value,
66
- markers: !!t.markerConfig
67
- }]),
68
- onClick: r[0] || (r[0] = (m) => C("click", m, a.value))
63
+ return (e, r) => (n(), p("div", {
64
+ style: k({
65
+ display: "flex",
66
+ flexDirection: y.value ? "column-reverse" : "column",
67
+ gap: "1rem"
68
+ }),
69
+ class: x({ markers: !!t.markerConfig }),
70
+ onClick: r[0] || (r[0] = (d) => C("click", d, l.value))
69
71
  }, [
70
72
  s(i(Y), {
71
73
  data: e.data,
72
74
  padding: e.padding,
73
75
  height: e.height,
74
- svgDefs: b.value
76
+ svgDefs: B.value
75
77
  }, {
76
- default: M(() => [
77
- s(i(S), {
78
+ default: W(() => [
79
+ s(i(H), {
78
80
  "horizontal-placement": i(v).Right,
79
81
  "vertical-placement": i(v).Top
80
82
  }, null, 8, ["horizontal-placement", "vertical-placement"]),
81
- (n(!0), c(W, null, E(Object.keys(t.categories), (m, u) => (n(), d(i(H), {
83
+ (n(!0), p(z, null, E(Object.keys(t.categories), (d, u) => (n(), m(i(I), {
82
84
  key: u,
83
- x: (f, N) => N,
84
- y: (f) => f[m],
85
+ x: (g, N) => N,
86
+ y: (g) => g[d],
85
87
  color: F(u),
86
88
  "curve-type": e.curveType ?? i(X).MonotoneX,
87
89
  "line-width": e.lineWidth,
88
90
  lineDashArray: e.lineDashArray ? e.lineDashArray[u] : void 0
89
91
  }, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"]))), 128)),
90
- e.hideXAxis ? l("", !0) : (n(), d(i(T), {
92
+ e.hideXAxis ? a("", !0) : (n(), m(i(T), {
91
93
  key: 0,
92
94
  type: "x",
93
95
  "tick-format": e.xFormatter,
@@ -100,7 +102,7 @@ const J = {
100
102
  "tick-values": e.xExplicitTicks,
101
103
  "min-max-ticks-only": e.minMaxTicksOnly
102
104
  }, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"])),
103
- e.hideYAxis ? l("", !0) : (n(), d(i(T), {
105
+ e.hideYAxis ? a("", !0) : (n(), m(i(T), {
104
106
  key: 1,
105
107
  type: "y",
106
108
  "tick-format": e.yFormatter,
@@ -110,34 +112,39 @@ const J = {
110
112
  "grid-line": e.yGridLine,
111
113
  "tick-line": e.yTickLine
112
114
  }, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"])),
113
- e.hideTooltip ? l("", !0) : (n(), d(i(U), G({ key: 2 }, e.crosshairConfig, { template: V }), null, 16))
115
+ e.hideTooltip ? a("", !0) : (n(), m(i(U), G({ key: 2 }, e.crosshairConfig, { template: V }), null, 16))
114
116
  ]),
115
117
  _: 1
116
118
  }, 8, ["data", "padding", "height", "svgDefs"]),
117
- e.hideLegend ? l("", !0) : (n(), c("div", {
119
+ e.hideLegend ? a("", !0) : (n(), p("div", {
118
120
  key: 0,
119
- class: g(["flex items center justify-end", { "pb-4": y.value }])
121
+ style: k({
122
+ display: "flex",
123
+ alignItems: "center",
124
+ justifyContent: "flex-end",
125
+ paddingBottom: y.value ? "1rem" : void 0
126
+ })
120
127
  }, [
121
128
  s(i(q), {
122
129
  items: Object.values(e.categories)
123
130
  }, null, 8, ["items"])
124
- ], 2)),
125
- x("div", J, [
126
- i(B).tooltip ? h(e.$slots, "tooltip", {
131
+ ], 4)),
132
+ M("div", Q, [
133
+ i(b).tooltip ? h(e.$slots, "tooltip", {
127
134
  key: 0,
128
- values: a.value
129
- }) : a.value ? h(e.$slots, "fallback", { key: 1 }, () => [
130
- s(R, {
131
- data: a.value,
135
+ values: l.value
136
+ }) : l.value ? h(e.$slots, "fallback", { key: 1 }, () => [
137
+ s(S, {
138
+ data: l.value,
132
139
  categories: e.categories,
133
- toolTipTitle: i(z)(a.value) ?? "",
140
+ toolTipTitle: i(R)(l.value) ?? "",
134
141
  yFormatter: t.yFormatter
135
142
  }, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
136
- ]) : l("", !0)
143
+ ]) : a("", !0)
137
144
  ], 512)
138
- ], 2));
145
+ ], 6));
139
146
  }
140
147
  });
141
148
  export {
142
- te as default
149
+ oe as default
143
150
  };
@@ -1,11 +1,11 @@
1
- import { defineComponent as b, computed as v, createElementBlock as r, openBlock as i, createElementVNode as o, toDisplayString as l, Fragment as y, renderList as h, normalizeStyle as a } from "vue";
2
- const f = { class: "px-[15px] py-[10px]" }, _ = {
3
- class: "capitalize border-b mb-1 pb-1",
4
- style: {
5
- color: "var(--tooltip-value-color)",
6
- borderColor: "rgba(255, 255, 255, 0.05)"
7
- }
8
- }, F = /* @__PURE__ */ b({
1
+ import { defineComponent as v, computed as y, createElementBlock as r, openBlock as i, createElementVNode as e, toDisplayString as l, Fragment as h, renderList as b, normalizeStyle as n } from "vue";
2
+ const f = { style: { padding: "10px 15px" } }, x = { style: {
3
+ color: "var(--tooltip-value-color)",
4
+ textTransform: "capitalize",
5
+ borderBottom: "1px solid rgba(255, 255, 255, 0.05)",
6
+ marginBottom: "0.25rem",
7
+ paddingBottom: "0.25rem"
8
+ } }, B = /* @__PURE__ */ v({
9
9
  __name: "Tooltip",
10
10
  props: {
11
11
  data: {},
@@ -13,30 +13,30 @@ const f = { class: "px-[15px] py-[10px]" }, _ = {
13
13
  toolTipTitle: {},
14
14
  yFormatter: { type: Function }
15
15
  },
16
- setup(p) {
17
- const n = p, d = ["_index", "_stacked", "_ending"], m = v(() => Object.entries(n.data ?? []).filter(
18
- ([e, g]) => !d.includes(e) && Object.keys(n.categories).includes(e)
16
+ setup(c) {
17
+ const a = c, d = ["_index", "_stacked", "_ending"], m = y(() => Object.entries(a.data ?? []).filter(
18
+ ([t, g]) => !d.includes(t) && Object.keys(a.categories).includes(t)
19
19
  ));
20
- return (e, g) => (i(), r("div", f, [
21
- o("div", _, l(e.toolTipTitle), 1),
22
- (i(!0), r(y, null, h(m.value, ([t, s], u) => {
23
- var c;
20
+ return (t, g) => (i(), r("div", f, [
21
+ e("div", x, l(t.toolTipTitle), 1),
22
+ (i(!0), r(h, null, b(m.value, ([o, s], u) => {
23
+ var p;
24
24
  return i(), r("div", {
25
- key: t,
25
+ key: o,
26
26
  style: { display: "flex", "align-items": "center", "margin-bottom": "4px" }
27
27
  }, [
28
- o("span", {
29
- style: a([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, {
30
- backgroundColor: (c = e.categories[t]) != null && c.color ? e.categories[t].color : `var(--vis-color${u})`
28
+ e("span", {
29
+ style: n([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, {
30
+ backgroundColor: (p = t.categories[o]) != null && p.color ? t.categories[o].color : `var(--vis-color${u})`
31
31
  }])
32
32
  }, null, 4),
33
- o("div", null, [
34
- o("span", {
35
- style: a([{ "font-weight": "600", "margin-right": "8px" }, { color: "var(--tooltip-label-color)" }])
36
- }, l(e.categories[t].name) + ":", 1),
37
- o("span", {
38
- style: a([{ "font-weight": "400" }, { color: "var(--tooltip-value-color)" }])
39
- }, l(e.yFormatter ? e.yFormatter(s) : s), 1)
33
+ e("div", null, [
34
+ e("span", {
35
+ style: n([{ "font-weight": "600", "margin-right": "8px" }, { color: "var(--tooltip-label-color)" }])
36
+ }, l(t.categories[o].name) + ":", 1),
37
+ e("span", {
38
+ style: n([{ "font-weight": "400" }, { color: "var(--tooltip-value-color)" }])
39
+ }, l(t.yFormatter ? t.yFormatter(s) : s), 1)
40
40
  ])
41
41
  ]);
42
42
  }), 128))
@@ -44,5 +44,5 @@ const f = { class: "px-[15px] py-[10px]" }, _ = {
44
44
  }
45
45
  });
46
46
  export {
47
- F as default
47
+ B as default
48
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "0.2.0",
3
+ "version": "0.2.2-test.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -27,12 +27,14 @@
27
27
  "@tailwindcss/vite": "^4.0.15",
28
28
  "@tanstack/vue-table": "^8.21.2",
29
29
  "@types/node": "^22.13.11",
30
+ "@types/rollup": "^0.54.0",
30
31
  "@unovis/ts": "^1.5.2",
31
32
  "@unovis/vue": "^1.5.2",
32
33
  "@vitejs/plugin-vue": "^5.2.1",
33
34
  "@vue/tsconfig": "^0.7.0",
34
35
  "@vueuse/core": "^13.0.0",
35
36
  "commit-and-tag-version": "^12.5.1",
37
+ "rollup": "^4.46.2",
36
38
  "tailwindcss": "^4.0.15",
37
39
  "typescript": "~5.7.2",
38
40
  "vite": "^6.2.0",