vue-chrts 0.1.1-test.4 → 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,9 +1,9 @@
1
- import { defineComponent as b, computed as u, createApp as B, createElementBlock as y, openBlock as d, normalizeClass as k, createVNode as l, createCommentVNode as T, unref as i, withCtx as v, createBlock as f } from "vue";
2
- import { Orientation as s, StackedBar as x, GroupedBar as V } from "@unovis/ts";
3
- import { VisXYContainer as P, VisTooltip as A, VisGroupedBar as C, VisStackedBar as G, VisAxis as h, VisBulletLegend as N } from "@unovis/vue";
4
- import w from "../Tooltip.js";
5
- import { LegendPosition as E } from "../../types.js";
6
- const z = /* @__PURE__ */ b({
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: {},
@@ -23,7 +23,7 @@ const z = /* @__PURE__ */ b({
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 },
@@ -36,55 +36,56 @@ const z = /* @__PURE__ */ b({
36
36
  const a = n;
37
37
  if (!a.yAxis || a.yAxis.length === 0)
38
38
  throw new Error("yAxis is required");
39
- const c = u(() => a.yAxis.map((e) => (o) => o[e])), m = (e, o) => Object.values(a.categories)[o].color, p = u(
40
- () => a.legendPosition === E.Top
41
- ), g = u(() => (e, o) => {
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 r = B(w, {
46
+ const r = V(E, {
46
47
  data: e,
47
48
  categories: a.categories,
48
- xValue: a.xFormatter(Math.floor(o))
49
- }), t = document.createElement("div");
50
- r.mount(t);
51
- const L = t.innerHTML;
52
- return r.unmount(), L;
49
+ xValue: e[B]
50
+ }), k = document.createElement("div");
51
+ r.mount(k);
52
+ const T = k.innerHTML;
53
+ return r.unmount(), T;
53
54
  } catch {
54
55
  return "";
55
56
  }
56
57
  });
57
- return (e, o) => (d(), y("div", {
58
- 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 }])
59
60
  }, [
60
- l(i(P), { height: e.height }, {
61
- default: v(() => [
62
- l(i(A), {
61
+ l(i(C), { height: e.height }, {
62
+ default: x(() => [
63
+ l(i(G), {
63
64
  triggers: {
64
- [i(V).selectors.bar]: g.value,
65
- [i(x).selectors.bar]: g.value
65
+ [i(O).selectors.bar]: y.value,
66
+ [i(A).selectors.bar]: y.value
66
67
  }
67
68
  }, null, 8, ["triggers"]),
68
- e.stacked ? (d(), f(i(G), {
69
+ e.stacked ? (s(), L(i(j), {
69
70
  key: 1,
70
- data: e.data,
71
- x: (r, t) => t,
72
- y: c.value,
73
- 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,
74
75
  "rounded-corners": e.radius ?? 0,
75
76
  "group-padding": e.groupPadding ?? 0,
76
77
  "bar-padding": e.barPadding ?? 0.2,
77
- orientation: e.orientation ?? i(s).Vertical
78
- }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (d(), f(i(C), {
78
+ orientation: e.orientation ?? i(o).Vertical
79
+ }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (s(), L(i(N), {
79
80
  key: 0,
80
- data: e.data,
81
- x: (r, t) => t,
82
- y: c.value,
83
- 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,
84
85
  "rounded-corners": e.radius ?? 0,
85
86
  "group-padding": e.groupPadding ?? 0,
86
87
  "bar-padding": e.barPadding ?? 0.2,
87
- orientation: e.orientation ?? i(s).Vertical
88
+ orientation: e.orientation ?? i(o).Vertical
88
89
  }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
89
90
  l(i(h), {
90
91
  type: "x",
@@ -100,7 +101,7 @@ const z = /* @__PURE__ */ b({
100
101
  l(i(h), {
101
102
  type: "y",
102
103
  label: e.yLabel,
103
- "grid-line": e.orientation !== i(s).Horizontal && e.yGridLine,
104
+ "grid-line": e.orientation !== i(o).Horizontal && e.yGridLine,
104
105
  "domain-line": !!e.yDomainLine,
105
106
  "tick-format": () => "",
106
107
  "num-ticks": e.yNumTicks,
@@ -109,11 +110,11 @@ const z = /* @__PURE__ */ b({
109
110
  ]),
110
111
  _: 1
111
112
  }, 8, ["height"]),
112
- e.hideLegend ? T("", !0) : (d(), y("div", {
113
+ e.hideLegend ? P("", !0) : (s(), f("div", {
113
114
  key: 0,
114
- class: k(["flex items center justify-end", { "pb-4": p.value }])
115
+ class: b(["flex items center justify-end", { "pb-4": g.value }])
115
116
  }, [
116
- l(i(N), {
117
+ l(i(w), {
117
118
  items: Object.values(e.categories)
118
119
  }, null, 8, ["items"])
119
120
  ], 2))
@@ -121,5 +122,5 @@ const z = /* @__PURE__ */ b({
121
122
  }
122
123
  });
123
124
  export {
124
- z as default
125
+ S as default
125
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,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.4",
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",