vue-chrts 0.1.1-test.3 → 0.1.1

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,8 +1,8 @@
1
- import { defineComponent as d, computed as f, createApp as h, createElementBlock as y, openBlock as a, createVNode as o, createElementVNode as g, unref as t, withCtx as v, createBlock as _, createCommentVNode as V } from "vue";
2
- import { VisXYContainer as k, VisArea as C, VisAxis as c, VisCrosshair as T, VisBulletLegend as b } from "@unovis/vue";
3
- import { CurveType as x } from "@unovis/ts";
4
- import B from "../Tooltip.js";
5
- const N = { class: "flex flex-col space-y-4" }, A = { class: "flex items center justify-end" }, O = /* @__PURE__ */ d({
1
+ import { defineComponent as f, computed as h, createApp as y, createElementBlock as g, openBlock as a, createVNode as r, createElementVNode as v, unref as t, withCtx as _, createBlock as V, createCommentVNode as k } from "vue";
2
+ import { VisXYContainer as C, VisArea as T, VisAxis as c, VisCrosshair as b, VisBulletLegend as x } from "@unovis/vue";
3
+ import { CurveType as B } from "@unovis/ts";
4
+ import N from "../Tooltip.js";
5
+ const A = { class: "flex flex-col space-y-4" }, j = { class: "flex items center justify-end" }, H = /* @__PURE__ */ f({
6
6
  __name: "AreaStackedChart",
7
7
  props: {
8
8
  data: {},
@@ -11,44 +11,44 @@ const N = { class: "flex flex-col space-y-4" }, A = { class: "flex items center
11
11
  hideTooltip: { type: Boolean }
12
12
  },
13
13
  setup(s) {
14
- const i = s, l = f(() => (e) => {
14
+ const n = s, l = h(() => (e, p) => {
15
15
  if (typeof window > "u" || typeof document > "u")
16
16
  return "";
17
17
  try {
18
- const r = h(B, {
18
+ const o = y(N, {
19
19
  data: e,
20
- categories: i.categories
21
- }), n = document.createElement("div");
22
- r.mount(n);
23
- const p = n.innerHTML;
24
- return r.unmount(), p;
20
+ categories: n.categories
21
+ }), i = document.createElement("div");
22
+ o.mount(i);
23
+ const d = i.innerHTML;
24
+ return o.unmount(), d;
25
25
  } catch {
26
26
  return "";
27
27
  }
28
28
  }), m = (e) => Number.parseInt(e.time), u = [(e) => e.firstTime, (e) => e.returning];
29
- return (e, r) => (a(), y("div", N, [
30
- o(t(k), {
29
+ return (e, p) => (a(), g("div", A, [
30
+ r(t(C), {
31
31
  data: e.data,
32
32
  height: e.height
33
33
  }, {
34
- default: v(() => [
35
- o(t(C), {
34
+ default: _(() => [
35
+ r(t(T), {
36
36
  x: m,
37
37
  y: u,
38
- color: Object.values(i.categories).map((n) => n.color),
39
- "curve-type": t(x).Linear
38
+ color: Object.values(n.categories).map((o) => o.color),
39
+ "curve-type": t(B).Linear
40
40
  }, null, 8, ["color", "curve-type"]),
41
- o(t(c), {
41
+ r(t(c), {
42
42
  type: "x",
43
43
  label: "Time",
44
44
  "num-ticks": 12
45
45
  }),
46
- o(t(c), {
46
+ r(t(c), {
47
47
  type: "y",
48
48
  label: "Number of visitors",
49
49
  "num-ticks": 3
50
50
  }),
51
- e.hideTooltip ? V("", !0) : (a(), _(t(T), {
51
+ e.hideTooltip ? k("", !0) : (a(), V(t(b), {
52
52
  key: 0,
53
53
  color: "#666",
54
54
  template: l.value
@@ -56,8 +56,8 @@ const N = { class: "flex flex-col space-y-4" }, A = { class: "flex items center
56
56
  ]),
57
57
  _: 1
58
58
  }, 8, ["data", "height"]),
59
- g("div", A, [
60
- o(t(b), {
59
+ v("div", j, [
60
+ r(t(x), {
61
61
  items: Object.values(e.categories)
62
62
  }, null, 8, ["items"])
63
63
  ])
@@ -65,5 +65,5 @@ const N = { class: "flex flex-col space-y-4" }, A = { class: "flex items center
65
65
  }
66
66
  });
67
67
  export {
68
- O as default
68
+ H as default
69
69
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as h, computed as u, createApp as b, createElementBlock as y, openBlock as d, normalizeClass as k, createVNode as r, createCommentVNode as B, unref as i, withCtx as T, createBlock as f } from "vue";
2
- import { Orientation as s, StackedBar as v, GroupedBar as x } from "@unovis/ts";
3
- import { VisXYContainer as V, VisTooltip as P, VisGroupedBar as A, VisStackedBar as C, VisAxis as L, VisBulletLegend as G } from "@unovis/vue";
4
- import N from "../Tooltip.js";
5
- import { LegendPosition as w } from "../../types.js";
6
- const M = /* @__PURE__ */ h({
1
+ import { defineComponent as v, computed as c, createApp as V, createElementBlock as f, openBlock as s, normalizeClass as b, createVNode as l, createCommentVNode as P, unref as i, withCtx as x, createBlock as L } from "vue";
2
+ import { Orientation as o, StackedBar as A, GroupedBar as O } from "@unovis/ts";
3
+ import { VisXYContainer as C, VisTooltip as G, VisGroupedBar as N, VisStackedBar as j, VisAxis as h, VisBulletLegend as w } from "@unovis/vue";
4
+ import E from "../Tooltip.js";
5
+ import { LegendPosition as z } from "../../types.js";
6
+ const S = /* @__PURE__ */ v({
7
7
  __name: "BarChart",
8
8
  props: {
9
9
  data: {},
@@ -14,16 +14,16 @@ const M = /* @__PURE__ */ h({
14
14
  categories: {},
15
15
  xFormatter: {},
16
16
  yFormatter: {},
17
- yNumTicks: { default: (a) => a.data.length > 24 ? 24 / 4 : a.data.length - 1 },
17
+ yNumTicks: { default: (n) => n.data.length > 24 ? 24 / 4 : n.data.length - 1 },
18
18
  minMaxTicksOnly: { type: Boolean },
19
- xNumTicks: { default: (a) => a.data.length > 24 ? 24 / 4 : a.data.length - 1 },
19
+ xNumTicks: { default: (n) => n.data.length > 24 ? 24 / 4 : n.data.length - 1 },
20
20
  xExplicitTicks: {},
21
21
  yAxis: {},
22
22
  groupPadding: {},
23
23
  barPadding: {},
24
24
  radius: {},
25
25
  hideLegend: { type: Boolean },
26
- orientation: { default: s.Vertical },
26
+ orientation: { default: o.Vertical },
27
27
  legendPosition: {},
28
28
  xDomainLine: { type: Boolean },
29
29
  yDomainLine: { type: Boolean },
@@ -32,60 +32,62 @@ const M = /* @__PURE__ */ h({
32
32
  xGridLine: { type: Boolean },
33
33
  yGridLine: { type: Boolean, default: !0 }
34
34
  },
35
- setup(a) {
36
- const o = a;
37
- if (!o.yAxis || o.yAxis.length === 0)
35
+ setup(n) {
36
+ const a = n;
37
+ if (!a.yAxis || a.yAxis.length === 0)
38
38
  throw new Error("yAxis is required");
39
- const c = u(() => o.yAxis.map((e) => (n) => n[e])), m = (e, n) => Object.values(o.categories)[n].color, p = u(
40
- () => o.legendPosition === w.Top
41
- ), g = u(() => (e) => {
39
+ const m = c(() => a.yAxis.map((e) => (t) => t[e])), p = (e, t) => Object.values(a.categories)[t].color, g = c(
40
+ () => a.legendPosition === z.Top
41
+ ), y = c(() => (e, t) => {
42
42
  if (typeof window > "u" || typeof document > "u")
43
43
  return "";
44
+ const u = Object.keys(a.categories), B = Object.keys(e).find((r) => !u.includes(r));
44
45
  try {
45
- const n = b(N, {
46
+ const r = V(E, {
46
47
  data: e,
47
- categories: o.categories
48
- }), l = document.createElement("div");
49
- n.mount(l);
50
- const t = l.innerHTML;
51
- return n.unmount(), t;
48
+ categories: a.categories,
49
+ xValue: e[B]
50
+ }), k = document.createElement("div");
51
+ r.mount(k);
52
+ const T = k.innerHTML;
53
+ return r.unmount(), T;
52
54
  } catch {
53
55
  return "";
54
56
  }
55
57
  });
56
- return (e, n) => (d(), y("div", {
57
- class: k(["flex flex-col space-y-4", { "flex-col-reverse": p.value }])
58
+ return (e, t) => (s(), f("div", {
59
+ class: b(["flex flex-col space-y-4", { "flex-col-reverse": g.value }])
58
60
  }, [
59
- r(i(V), { height: e.height }, {
60
- default: T(() => [
61
- r(i(P), {
61
+ l(i(C), { height: e.height }, {
62
+ default: x(() => [
63
+ l(i(G), {
62
64
  triggers: {
63
- [i(x).selectors.bar]: g.value,
64
- [i(v).selectors.bar]: g.value
65
+ [i(O).selectors.bar]: y.value,
66
+ [i(A).selectors.bar]: y.value
65
67
  }
66
68
  }, null, 8, ["triggers"]),
67
- e.stacked ? (d(), f(i(C), {
69
+ e.stacked ? (s(), L(i(j), {
68
70
  key: 1,
69
- data: e.data,
70
- x: (l, t) => t,
71
- y: c.value,
72
- color: m,
71
+ data: e.orientation === i(o).Horizontal ? [...e.data].reverse() : e.data,
72
+ x: (u, d) => d,
73
+ y: m.value,
74
+ color: p,
73
75
  "rounded-corners": e.radius ?? 0,
74
76
  "group-padding": e.groupPadding ?? 0,
75
77
  "bar-padding": e.barPadding ?? 0.2,
76
- orientation: e.orientation ?? i(s).Vertical
77
- }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (d(), f(i(A), {
78
+ orientation: e.orientation ?? i(o).Vertical
79
+ }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (s(), L(i(N), {
78
80
  key: 0,
79
- data: e.data,
80
- x: (l, t) => t,
81
- y: c.value,
82
- color: m,
81
+ data: e.orientation === i(o).Horizontal ? [...e.data].reverse() : e.data,
82
+ x: (u, d) => d,
83
+ y: m.value,
84
+ color: p,
83
85
  "rounded-corners": e.radius ?? 0,
84
86
  "group-padding": e.groupPadding ?? 0,
85
87
  "bar-padding": e.barPadding ?? 0.2,
86
- orientation: e.orientation ?? i(s).Vertical
88
+ orientation: e.orientation ?? i(o).Vertical
87
89
  }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
88
- r(i(L), {
90
+ l(i(h), {
89
91
  type: "x",
90
92
  "tick-format": e.xFormatter,
91
93
  label: e.xLabel,
@@ -96,10 +98,10 @@ const M = /* @__PURE__ */ h({
96
98
  "tick-values": e.xExplicitTicks,
97
99
  "min-max-ticks-only": e.minMaxTicksOnly
98
100
  }, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"]),
99
- r(i(L), {
101
+ l(i(h), {
100
102
  type: "y",
101
103
  label: e.yLabel,
102
- "grid-line": e.orientation !== i(s).Horizontal && e.yGridLine,
104
+ "grid-line": e.orientation !== i(o).Horizontal && e.yGridLine,
103
105
  "domain-line": !!e.yDomainLine,
104
106
  "tick-format": () => "",
105
107
  "num-ticks": e.yNumTicks,
@@ -108,11 +110,11 @@ const M = /* @__PURE__ */ h({
108
110
  ]),
109
111
  _: 1
110
112
  }, 8, ["height"]),
111
- e.hideLegend ? B("", !0) : (d(), y("div", {
113
+ e.hideLegend ? P("", !0) : (s(), f("div", {
112
114
  key: 0,
113
- class: k(["flex items center justify-end", { "pb-4": p.value }])
115
+ class: b(["flex items center justify-end", { "pb-4": g.value }])
114
116
  }, [
115
- r(i(G), {
117
+ l(i(w), {
116
118
  items: Object.values(e.categories)
117
119
  }, null, 8, ["items"])
118
120
  ], 2))
@@ -120,5 +122,5 @@ const M = /* @__PURE__ */ h({
120
122
  }
121
123
  });
122
124
  export {
123
- M as default
125
+ S as default
124
126
  };
@@ -1,5 +1,5 @@
1
1
  import { BarChartProps } from './types';
2
- declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
2
+ declare const _default: <T extends {}>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
3
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & BarChartProps<T> & Partial<{}>> & import('vue').PublicProps;
4
4
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
5
5
  attrs: any;
@@ -1,8 +1,8 @@
1
- import { defineComponent as v, computed as u, createApp as b, createElementBlock as m, openBlock as n, normalizeClass as p, createVNode as o, createCommentVNode as y, unref as i, withCtx as B, createBlock as k, Fragment as x, renderList as C } from "vue";
2
- import { Position as g, CurveType as V } from "@unovis/ts";
3
- import { VisXYContainer as N, VisTooltip as F, VisLine as O, VisAxis as f, VisCrosshair as P, VisBulletLegend as j } from "@unovis/vue";
4
- import D from "../Tooltip.js";
5
- import { LegendPosition as E } from "../../types.js";
1
+ import { defineComponent as v, computed as d, createApp as b, createElementBlock as m, openBlock as l, normalizeClass as p, createVNode as r, createCommentVNode as y, unref as i, withCtx as x, createBlock as k, Fragment as B, renderList as V } from "vue";
2
+ import { Position as g, CurveType as C } from "@unovis/ts";
3
+ import { VisXYContainer as F, VisTooltip as N, VisLine as M, VisAxis as f, VisCrosshair as O, VisBulletLegend as P } from "@unovis/vue";
4
+ import j from "../Tooltip.js";
5
+ import { LegendPosition as D } from "../../types.js";
6
6
  const X = /* @__PURE__ */ v({
7
7
  __name: "LineChart",
8
8
  props: {
@@ -29,43 +29,44 @@ const X = /* @__PURE__ */ v({
29
29
  yTickLine: { type: Boolean }
30
30
  },
31
31
  setup(t) {
32
- const l = t, h = (e) => Object.values(l.categories)[e].color, L = u(() => (e) => {
32
+ const n = t, h = (e) => Object.values(n.categories)[e].color, L = d(() => (e, u) => {
33
33
  if (typeof window > "u" || typeof document > "u")
34
34
  return "";
35
35
  try {
36
- const a = b(D, {
36
+ const o = b(j, {
37
37
  data: e,
38
- categories: l.categories
39
- }), r = document.createElement("div");
40
- a.mount(r);
41
- const c = r.innerHTML;
42
- return a.unmount(), c;
38
+ categories: n.categories,
39
+ xValue: n.xFormatter(Math.floor(u))
40
+ }), a = document.createElement("div");
41
+ o.mount(a);
42
+ const c = a.innerHTML;
43
+ return o.unmount(), c;
43
44
  } catch {
44
45
  return "";
45
46
  }
46
- }), s = u(
47
- () => l.legendPosition === E.Top
47
+ }), s = d(
48
+ () => n.legendPosition === D.Top
48
49
  );
49
- return (e, a) => (n(), m("div", {
50
+ return (e, u) => (l(), m("div", {
50
51
  class: p(["flex flex-col space-y-4", { "flex-col-reverse": s.value }])
51
52
  }, [
52
- o(i(N), {
53
+ r(i(F), {
53
54
  data: e.data,
54
55
  height: e.height
55
56
  }, {
56
- default: B(() => [
57
- o(i(F), {
57
+ default: x(() => [
58
+ r(i(N), {
58
59
  "horizontal-placement": i(g).Right,
59
60
  "vertical-placement": i(g).Top
60
61
  }, null, 8, ["horizontal-placement", "vertical-placement"]),
61
- (n(!0), m(x, null, C(Object.keys(l.categories), (r, c) => (n(), k(i(O), {
62
- key: c,
63
- x: (d, T) => T,
64
- y: (d) => d[r],
65
- color: h(c),
66
- "curve-type": e.curveType ?? i(V).MonotoneX
62
+ (l(!0), m(B, null, V(Object.keys(n.categories), (o, a) => (l(), k(i(M), {
63
+ key: a,
64
+ x: (c, T) => T,
65
+ y: (c) => c[o],
66
+ color: h(a),
67
+ "curve-type": e.curveType ?? i(C).MonotoneX
67
68
  }, null, 8, ["x", "y", "color", "curve-type"]))), 128)),
68
- o(i(f), {
69
+ r(i(f), {
69
70
  type: "x",
70
71
  "tick-format": e.xFormatter,
71
72
  label: e.xLabel,
@@ -77,7 +78,7 @@ const X = /* @__PURE__ */ v({
77
78
  "tick-values": e.xExplicitTicks,
78
79
  "min-max-ticks-only": e.minMaxTicksOnly
79
80
  }, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"]),
80
- o(i(f), {
81
+ r(i(f), {
81
82
  type: "y",
82
83
  "tick-format": e.yFormatter,
83
84
  label: e.yLabel,
@@ -86,7 +87,7 @@ const X = /* @__PURE__ */ v({
86
87
  "grid-line": e.yGridLine,
87
88
  "tick-line": e.yTickLine
88
89
  }, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"]),
89
- e.hideTooltip ? y("", !0) : (n(), k(i(P), {
90
+ e.hideTooltip ? y("", !0) : (l(), k(i(O), {
90
91
  key: 0,
91
92
  color: "#666",
92
93
  template: L.value
@@ -94,11 +95,11 @@ const X = /* @__PURE__ */ v({
94
95
  ]),
95
96
  _: 1
96
97
  }, 8, ["data", "height"]),
97
- e.hideLegend ? y("", !0) : (n(), m("div", {
98
+ e.hideLegend ? y("", !0) : (l(), m("div", {
98
99
  key: 0,
99
100
  class: p(["flex items center justify-end", { "pb-4": s.value }])
100
101
  }, [
101
- o(i(j), {
102
+ r(i(P), {
102
103
  items: Object.values(e.categories)
103
104
  }, null, 8, ["items"])
104
105
  ], 2))
@@ -1,4 +1,4 @@
1
- import { BulletLegendItemInterface } from '@unovis/ts';
1
+ import { BulletLegendItemInterface } from '../types';
2
2
  declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
3
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
4
4
  data: T;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "0.1.1-test.3",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
8
8
  "main": "./dist/index.umd.cjs",
9
9
  "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
10
11
  "exports": {
11
12
  ".": {
12
13
  "import": "./dist/index.js",
@@ -24,7 +25,6 @@
24
25
  "devDependencies": {
25
26
  "@tailwindcss/vite": "^4.0.15",
26
27
  "@tanstack/vue-table": "^8.21.2",
27
- "@types/culori": "^2.1.1",
28
28
  "@types/node": "^22.13.11",
29
29
  "@unovis/ts": "^1.5.1",
30
30
  "@unovis/vue": "^1.5.1",